*/ final class AdstxtPushHandler implements PushEndpointHandlerInterface { /** * {@inheritDoc} * * @since 4.3.0 * @return string */ public function endpoint() { return 'adstxt'; } /** * {@inheritDoc} * * @since 4.3.0 * @return string */ public function event_type() { return 'wordpress.adstxt.updated'; // phpcs:ignore WordPress.WP.CapitalPDangit.MisspelledInText -- Actirise API event-type identifier. } /** * {@inheritDoc} * * @since 4.3.0 * @return int[] */ public function supported_versions() { return array( 1 ); } /** * Apply an ads.txt update. * * The payload must be a non-empty string; anything else is treated as a * schema error and rejected with a 400 by the controller. * * @since 4.3.0 * @param mixed $data The full ads.txt content. * @return bool True when the content was applied. */ public function apply( $data ) { if ( ! is_string( $data ) || '' === trim( $data ) ) { return false; } AdsTxt::apply_pushed_content( $data ); return true; } }