diff --git a/changelog.txt b/changelog.txt index 236b950..0294c3a 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,105 @@ == Changelog == += 1.1.4 = + +_Release date: 2026-08-20_ + +**Highlights** + +* Security and compatibility review of the whole code base, with static analysis raised to PHPStan level 9 + +**Added** + +* Development: PHPStan (level 9) with the WordPress stubs and the wp-compat rules, PHPUnit with the polyfills, and the missing PHPCS utilities; `bin/preflight.sh` runs every automatable pre-deploy check +* Tests: plugin header test suite (15 tests) verifying the required headers, the readme consistency (Stable tag, Requires at least, Requires PHP, Tested up to, License), the contributor order, the changelog URL, and the absence of the removed self-updater files + +**Changed** + +* Development: the full code base passes WordPress Coding Standards with zero errors and warnings, PHPStan level 9 with zero errors, and PHPCompatibilityWP for PHP 5.6 - 8.5 with zero errors +* Type safety: every parameter and return type documented (PHP 5.6-compatible phpDoc generics), all input paths narrowed before sanitization, and two always-dead branches removed (the logs list parameters column helper and the caller backtrace object check) +* License header of the main plugin file aligned with readme.txt ("GPL-3.0-or-later") + +**Fixed** + +* The User-Agent masking keeps the previous value when the regular expression replacement fails instead of returning null +* The Multisite main-site fallback (WordPress 4.8 and older) reads the network's blog_id only when it is set + +**Security** + +* Full review following OWASP and WordPress Plugin Security guidelines: capabilities, nonces, validation, sanitization, output escaping, database access, and uninstall cleanup re-audited with the new tooling; no vulnerabilities found, and the type hardening above was applied + +**Compatibility** + +* WordPress: 4.0 - 7.1 +* PHP: 5.6 - 8.5 +* MariaDB: 10.6+ +* Multisite: compatible (Per-site and Global modes) + +**Tests** + +* WordPress 7.2-alpha-63320, PHP 8.5.9, MariaDB 11.8.8 +* Verified live: plugin active on the staging site with no PHP notices, warnings, or deprecated messages +* PHP Coding Standards: 3.13.6 +* WordPress Coding Standards: 3.4.1 +* PHPCompatibilityWP (PHP 5.6 - 8.5) and wp-since (WordPress 4.0) static reviews for the floor versions +* PHPStan level 9 with the WordPress stubs: zero errors + += 1.1.3 = + +_Release date: 2026-08-20_ + +**Highlights** + +* Security and compatibility review of the 1.1.2 settings-save rewrite + +**Security** + +* Full review of the tab-scoped save handler (per-site and Network Admin) following OWASP and WordPress Plugin Security guidelines: nonce pairing, capability ordering (the capability check precedes every save branch, so site administrators cannot write network options in Global mode), tab whitelisting, hardcoded option names, per-value sanitization, and safe redirects with no open-redirect surface; all areas passed with no findings + +**Compatibility** + +* WordPress: 4.0 - 7.1 +* PHP: 5.6 - 8.5 +* MariaDB: 10.6+ +* Multisite: compatible (Per-site and Global modes) + +**Tests** + +* WordPress 7.2-alpha-63320, PHP 8.5.9, MariaDB 11.8.8 +* PHP Coding Standards: 3.13.6 +* WordPress Coding Standards: 3.4.1 +* PHPCompatibilityWP (PHP 5.6 - 8.5) and wp-since (WordPress 4.0) static reviews for the floor versions + += 1.1.2 = + +_Release date: 2026-08-18_ + +**Highlights** + +* Cross-tab settings saves fixed on the per-site Settings screen + +**Fixed** + +* Saving one tab of the per-site Settings screen no longer resets the other tabs: WordPress core sets every unposted option of a settings group to null since WordPress 5.5, so saving any tab was wiping the options of the other tabs back to their defaults (or, for the User-Agent mode, to the legacy pre-0.9 value). Each tab now saves through its own tab-scoped, nonce- and capability-protected handler shared with the Network Admin screen, updating only the options of the tab being saved + +**Changed** + +* The per-site Settings screen no longer posts through options.php; the Settings API registration of the options was removed along with it (the sanitizers are unchanged and still applied by the save handler) + +**Compatibility** + +* WordPress: 4.0 - 7.1 +* PHP: 5.6 - 8.5 +* MariaDB: 10.6+ +* Multisite: compatible (Per-site and Global modes) + +**Tests** + +* WordPress 7.2-alpha-63320, PHP 8.5.9, MariaDB 11.8.8 +* Verified live: main tab values survive saves of the Plugins, Logs, and General tabs and vice versa; hidden plugins, retention, and uninstall options each preserved +* PHP Coding Standards: 3.13.6 +* WordPress Coding Standards: 3.4.1 + = 1.1.1 = _Release date: 2026-08-18_ diff --git a/includes/class-robotstxt-telemetry-admin.php b/includes/class-robotstxt-telemetry-admin.php index 5dd1ea6..d771e7e 100644 --- a/includes/class-robotstxt-telemetry-admin.php +++ b/includes/class-robotstxt-telemetry-admin.php @@ -17,11 +17,12 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { /** * Register hooks. + * + * @return void */ public function register() { add_action( 'admin_menu', array( $this, 'register_menu' ) ); add_action( 'network_admin_menu', array( $this, 'register_network_menu' ) ); - add_action( 'admin_init', array( $this, 'register_settings' ) ); add_action( 'admin_init', array( $this, 'handle_actions' ) ); add_action( 'admin_notices', array( $this, 'render_saved_notice' ) ); add_action( 'network_admin_notices', array( $this, 'render_saved_notice' ) ); @@ -32,6 +33,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { * * In global mode the per-site screens are replaced by the * Network Admin ones. + * + * @return void */ public function register_menu() { if ( Robotstxt_Telemetry_Network::is_global() ) { @@ -47,33 +50,33 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { 'dashicons-admin-generic' ); - add_submenu_page( - 'robotstxt-telemetry', - __( 'Settings', 'robotstxt-telemetry' ), - __( 'Settings', 'robotstxt-telemetry' ), - 'manage_options', - 'robotstxt-telemetry', - array( $this, 'render_settings_page' ) - ); + add_submenu_page( + 'robotstxt-telemetry', + __( 'Settings', 'robotstxt-telemetry' ), + __( 'Settings', 'robotstxt-telemetry' ), + 'manage_options', + 'robotstxt-telemetry', + array( $this, 'render_settings_page' ) + ); - add_submenu_page( - 'robotstxt-telemetry', - __( 'Plugins', 'robotstxt-telemetry' ), - __( 'Plugins', 'robotstxt-telemetry' ), - 'manage_options', - 'robotstxt-telemetry-plugins', - array( $this, 'render_plugins_page' ) - ); + add_submenu_page( + 'robotstxt-telemetry', + __( 'Plugins', 'robotstxt-telemetry' ), + __( 'Plugins', 'robotstxt-telemetry' ), + 'manage_options', + 'robotstxt-telemetry-plugins', + array( $this, 'render_plugins_page' ) + ); - add_submenu_page( - 'robotstxt-telemetry', - __( 'Logs', 'robotstxt-telemetry' ), - __( 'Logs', 'robotstxt-telemetry' ), - 'manage_options', - 'robotstxt-telemetry-logs', - array( $this, 'render_logs_page' ) - ); - } + add_submenu_page( + 'robotstxt-telemetry', + __( 'Logs', 'robotstxt-telemetry' ), + __( 'Logs', 'robotstxt-telemetry' ), + 'manage_options', + 'robotstxt-telemetry-logs', + array( $this, 'render_logs_page' ) + ); + } /** * Register the Network Admin menus (Multisite only). @@ -81,6 +84,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { * The Network Settings screen always exposes the configuration * mode; when the network runs in global mode it also hosts the * shared settings and the central Logs screen. + * + * @return void */ public function register_network_menu() { if ( ! is_multisite() ) { @@ -96,25 +101,25 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { 'dashicons-admin-generic' ); - add_submenu_page( - 'robotstxt-telemetry', - __( 'Settings', 'robotstxt-telemetry' ), - __( 'Settings', 'robotstxt-telemetry' ), - 'manage_network_options', - 'robotstxt-telemetry', - array( $this, 'render_network_settings_page' ) - ); + add_submenu_page( + 'robotstxt-telemetry', + __( 'Settings', 'robotstxt-telemetry' ), + __( 'Settings', 'robotstxt-telemetry' ), + 'manage_network_options', + 'robotstxt-telemetry', + array( $this, 'render_network_settings_page' ) + ); - add_submenu_page( - 'robotstxt-telemetry', - __( 'Plugins', 'robotstxt-telemetry' ), - __( 'Plugins', 'robotstxt-telemetry' ), - 'manage_network_options', - 'robotstxt-telemetry-plugins', - array( $this, 'render_plugins_page' ) - ); + add_submenu_page( + 'robotstxt-telemetry', + __( 'Plugins', 'robotstxt-telemetry' ), + __( 'Plugins', 'robotstxt-telemetry' ), + 'manage_network_options', + 'robotstxt-telemetry-plugins', + array( $this, 'render_plugins_page' ) + ); - if ( Robotstxt_Telemetry_Network::is_global() ) { + if ( Robotstxt_Telemetry_Network::is_global() ) { add_submenu_page( 'robotstxt-telemetry', __( 'Logs', 'robotstxt-telemetry' ), @@ -127,31 +132,54 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { } /** - * Register the plugin settings. + * Save the settings of a single tab (per-site and network screens). + * + * Only the options of the given tab are read from the POST and + * updated, so the other tabs keep their values. WordPress core + * options.php cannot be used for this: it updates every registered + * option of the group, setting the ones missing from the POST to null. + * + * @param string $tab Settings tab: 'main', 'plugins', 'logs', or 'general'. + * @return void */ - public function register_settings() { - $settings = array( - 'robotstxt_telemetry_useragent_url' => array( 'string', 'hash', 'sanitize_useragent_mode' ), - 'robotstxt_telemetry_wp_version' => array( 'string', 'actual', 'sanitize_version_mode' ), - 'robotstxt_telemetry_mask_locale' => array( 'boolean', false, 'sanitize_checkbox' ), - 'robotstxt_telemetry_replace_news_feed' => array( 'boolean', true, 'sanitize_checkbox' ), - 'robotstxt_telemetry_replace_events_api' => array( 'boolean', true, 'sanitize_checkbox' ), - 'robotstxt_telemetry_disable_browse_happy' => array( 'boolean', true, 'sanitize_checkbox' ), - 'robotstxt_telemetry_wp_core_check' => array( 'string', 'safe', 'sanitize_mode' ), - 'robotstxt_telemetry_wp_themes_check' => array( 'string', 'safe', 'sanitize_mode' ), - 'robotstxt_telemetry_wp_plugins_check' => array( 'string', 'safe', 'sanitize_mode' ), - 'robotstxt_telemetry_hidden_plugins' => array( 'array', array(), 'sanitize_hidden_plugins' ), - 'robotstxt_telemetry_retention_period' => array( 'string', '12hours', 'sanitize_retention' ), - 'robotstxt_telemetry_delete_on_uninstall' => array( 'boolean', false, 'sanitize_checkbox' ), - ); + private function save_tab_settings( $tab ) { + // phpcs:disable WordPress.Security.NonceVerification.Missing -- Callers verified the nonce. + if ( 'logs' === $tab ) { + $retention = isset( $_POST['robotstxt_telemetry_retention_period'] ) && is_string( $_POST['robotstxt_telemetry_retention_period'] ) ? sanitize_key( wp_unslash( $_POST['robotstxt_telemetry_retention_period'] ) ) : '12hours'; + Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_retention_period', $this->sanitize_retention( $retention ) ); + } elseif ( 'plugins' === $tab ) { + $hidden = isset( $_POST['robotstxt_telemetry_hidden_plugins'] ) ? array_map( + function ( $value ) { + return is_string( $value ) ? sanitize_text_field( $value ) : ''; + }, + (array) wp_unslash( $_POST['robotstxt_telemetry_hidden_plugins'] ) // phpcs:ignore WordPress.Security.ValidatedSanitizedInput -- Each value is sanitized in the callback above. + ) : array(); + Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_hidden_plugins', $this->sanitize_hidden_plugins( $hidden ) ); + } elseif ( 'general' === $tab ) { + $delete = ! empty( $_POST['robotstxt_telemetry_delete_on_uninstall'] ); + Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_delete_on_uninstall', $delete ); + } else { + $useragent_mode = isset( $_POST['robotstxt_telemetry_useragent_url'] ) && is_string( $_POST['robotstxt_telemetry_useragent_url'] ) ? sanitize_key( wp_unslash( $_POST['robotstxt_telemetry_useragent_url'] ) ) : 'hash'; + $version_mode = isset( $_POST['robotstxt_telemetry_wp_version'] ) && is_string( $_POST['robotstxt_telemetry_wp_version'] ) ? sanitize_key( wp_unslash( $_POST['robotstxt_telemetry_wp_version'] ) ) : 'actual'; + $mask_locale = ! empty( $_POST['robotstxt_telemetry_mask_locale'] ); + $replace_news = ! empty( $_POST['robotstxt_telemetry_replace_news_feed'] ); + $replace_events = ! empty( $_POST['robotstxt_telemetry_replace_events_api'] ); + $disable_browse_happy = ! empty( $_POST['robotstxt_telemetry_disable_browse_happy'] ); + $core = isset( $_POST['robotstxt_telemetry_wp_core_check'] ) && is_string( $_POST['robotstxt_telemetry_wp_core_check'] ) ? sanitize_key( wp_unslash( $_POST['robotstxt_telemetry_wp_core_check'] ) ) : 'safe'; + $themes = isset( $_POST['robotstxt_telemetry_wp_themes_check'] ) && is_string( $_POST['robotstxt_telemetry_wp_themes_check'] ) ? sanitize_key( wp_unslash( $_POST['robotstxt_telemetry_wp_themes_check'] ) ) : 'safe'; + $plugins = isset( $_POST['robotstxt_telemetry_wp_plugins_check'] ) && is_string( $_POST['robotstxt_telemetry_wp_plugins_check'] ) ? sanitize_key( wp_unslash( $_POST['robotstxt_telemetry_wp_plugins_check'] ) ) : 'safe'; - foreach ( $settings as $name => $config ) { - register_setting( - 'robotstxt_telemetry_settings', - $name, - array( $this, $config[2] ) - ); + Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_useragent_url', $this->sanitize_useragent_mode( $useragent_mode ) ); + Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_wp_version', $this->sanitize_version_mode( $version_mode ) ); + Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_mask_locale', $mask_locale ); + Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_replace_news_feed', $replace_news ); + Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_replace_events_api', $replace_events ); + Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_disable_browse_happy', $disable_browse_happy ); + Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_wp_core_check', $this->sanitize_mode( $core ) ); + Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_wp_themes_check', $this->sanitize_mode( $themes ) ); + Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_wp_plugins_check', $this->sanitize_mode( $plugins ) ); } + // phpcs:enable } /** @@ -206,7 +234,11 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { $hidden = array(); foreach ( $value as $basename ) { - $basename = sanitize_text_field( (string) $basename ); + if ( ! is_string( $basename ) ) { + continue; + } + + $basename = sanitize_text_field( $basename ); if ( in_array( $basename, $installed, true ) ) { $hidden[] = $basename; @@ -230,23 +262,15 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { return in_array( $value, $valid, true ) ? $value : '12hours'; } - /** - * Sanitize a checkbox value. - * - * @param mixed $value Raw input value. - * @return bool - */ - public function sanitize_checkbox( $value ) { - return (bool) $value; - } - /** * Handle admin actions. + * + * @return void */ public function handle_actions() { // phpcs:disable WordPress.Security.NonceVerification.Recommended -- State changes are protected by check_admin_referer() below. - $page = isset( $_GET['page'] ) ? sanitize_key( wp_unslash( $_GET['page'] ) ) : ''; - $action = isset( $_REQUEST['action'] ) ? sanitize_key( wp_unslash( $_REQUEST['action'] ) ) : ''; + $page = isset( $_GET['page'] ) && is_string( $_GET['page'] ) ? sanitize_key( wp_unslash( $_GET['page'] ) ) : ''; + $action = isset( $_REQUEST['action'] ) && is_string( $_REQUEST['action'] ) ? sanitize_key( wp_unslash( $_REQUEST['action'] ) ) : ''; // Network-level actions are always restricted to super administrators. if ( 'save_network_mode' === $action || 'save_network_settings' === $action ) { @@ -270,6 +294,13 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { return; } + if ( 'save_site_settings' === $action ) { + if ( 'robotstxt-telemetry' === $page ) { + $this->handle_site_settings_save(); + } + return; + } + if ( 'robotstxt-telemetry-logs' !== $page ) { return; } @@ -295,7 +326,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { return; } - $log_id = isset( $_GET['log'] ) ? absint( wp_unslash( $_GET['log'] ) ) : 0; + $log_id = isset( $_GET['log'] ) && is_string( $_GET['log'] ) ? absint( wp_unslash( $_GET['log'] ) ) : 0; // phpcs:enable if ( 0 === $log_id ) { return; @@ -321,13 +352,14 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { * Handle Network Admin settings actions. * * @param string $action Action name. + * @return void */ private function handle_network_actions( $action ) { if ( 'save_network_mode' === $action ) { check_admin_referer( 'robotstxt_telemetry_network_mode' ); // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Verified by check_admin_referer() above. - $new_mode = isset( $_POST['robotstxt_telemetry_config_mode'] ) ? sanitize_key( wp_unslash( $_POST['robotstxt_telemetry_config_mode'] ) ) : 'per-site'; + $new_mode = isset( $_POST['robotstxt_telemetry_config_mode'] ) && is_string( $_POST['robotstxt_telemetry_config_mode'] ) ? sanitize_key( wp_unslash( $_POST['robotstxt_telemetry_config_mode'] ) ) : 'per-site'; $new_mode = Robotstxt_Telemetry_Network::sanitize_mode( $new_mode ); $old_mode = get_site_option( Robotstxt_Telemetry_Network::MODE_OPTION, 'per-site' ); @@ -343,41 +375,11 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { if ( 'save_network_settings' === $action ) { check_admin_referer( 'robotstxt_telemetry_network_settings' ); - // phpcs:disable WordPress.Security.NonceVerification.Missing -- Verified by check_admin_referer() above. - $tab = isset( $_POST['tab'] ) ? sanitize_key( wp_unslash( $_POST['tab'] ) ) : 'main'; + // phpcs:ignore WordPress.Security.NonceVerification.Missing -- Verified by check_admin_referer() above. + $tab = isset( $_POST['tab'] ) && is_string( $_POST['tab'] ) ? sanitize_key( wp_unslash( $_POST['tab'] ) ) : 'main'; $tab = in_array( $tab, array( 'main', 'plugins', 'logs', 'general' ), true ) ? $tab : 'main'; - if ( 'logs' === $tab ) { - $retention = isset( $_POST['robotstxt_telemetry_retention_period'] ) ? sanitize_key( wp_unslash( $_POST['robotstxt_telemetry_retention_period'] ) ) : '12hours'; - Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_retention_period', $this->sanitize_retention( $retention ) ); - } elseif ( 'plugins' === $tab ) { - $hidden = isset( $_POST['robotstxt_telemetry_hidden_plugins'] ) ? array_map( 'sanitize_text_field', (array) wp_unslash( $_POST['robotstxt_telemetry_hidden_plugins'] ) ) : array(); - Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_hidden_plugins', $this->sanitize_hidden_plugins( $hidden ) ); - } elseif ( 'general' === $tab ) { - $delete = ! empty( $_POST['robotstxt_telemetry_delete_on_uninstall'] ); - Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_delete_on_uninstall', $delete ); - } else { - $useragent_mode = isset( $_POST['robotstxt_telemetry_useragent_url'] ) ? sanitize_key( wp_unslash( $_POST['robotstxt_telemetry_useragent_url'] ) ) : 'hash'; - $version_mode = isset( $_POST['robotstxt_telemetry_wp_version'] ) ? sanitize_key( wp_unslash( $_POST['robotstxt_telemetry_wp_version'] ) ) : 'actual'; - $mask_locale = ! empty( $_POST['robotstxt_telemetry_mask_locale'] ); - $replace_news = ! empty( $_POST['robotstxt_telemetry_replace_news_feed'] ); - $replace_events = ! empty( $_POST['robotstxt_telemetry_replace_events_api'] ); - $disable_browse_happy = ! empty( $_POST['robotstxt_telemetry_disable_browse_happy'] ); - $core = isset( $_POST['robotstxt_telemetry_wp_core_check'] ) ? sanitize_key( wp_unslash( $_POST['robotstxt_telemetry_wp_core_check'] ) ) : 'safe'; - $themes = isset( $_POST['robotstxt_telemetry_wp_themes_check'] ) ? sanitize_key( wp_unslash( $_POST['robotstxt_telemetry_wp_themes_check'] ) ) : 'safe'; - $plugins = isset( $_POST['robotstxt_telemetry_wp_plugins_check'] ) ? sanitize_key( wp_unslash( $_POST['robotstxt_telemetry_wp_plugins_check'] ) ) : 'safe'; - - Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_useragent_url', $this->sanitize_useragent_mode( $useragent_mode ) ); - Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_wp_version', $this->sanitize_version_mode( $version_mode ) ); - Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_mask_locale', $mask_locale ); - Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_replace_news_feed', $replace_news ); - Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_replace_events_api', $replace_events ); - Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_disable_browse_happy', $disable_browse_happy ); - Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_wp_core_check', $this->sanitize_mode( $core ) ); - Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_wp_themes_check', $this->sanitize_mode( $themes ) ); - Robotstxt_Telemetry_Network::update_setting( 'robotstxt_telemetry_wp_plugins_check', $this->sanitize_mode( $plugins ) ); - } - // phpcs:enable + $this->save_tab_settings( $tab ); $this->redirect_network_settings( 'settings-updated', $tab ); } @@ -388,6 +390,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { * * @param string $flag Query flag to append. * @param string $tab Settings tab to return to. + * @return void */ private function redirect_network_settings( $flag, $tab = 'main' ) { wp_safe_redirect( @@ -405,6 +408,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { /** * Render the settings saved notice. + * + * @return void */ public function render_saved_notice() { if ( ! current_user_can( Robotstxt_Telemetry_Network::manage_capability() ) ) { @@ -412,9 +417,9 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { } // phpcs:disable WordPress.Security.NonceVerification.Recommended -- Read-only rendering of an admin screen. - $settings_updated = isset( $_GET['settings-updated'] ) ? sanitize_key( wp_unslash( $_GET['settings-updated'] ) ) : ''; - $mode_updated = isset( $_GET['mode-updated'] ) ? sanitize_key( wp_unslash( $_GET['mode-updated'] ) ) : ''; - $page = isset( $_GET['page'] ) ? sanitize_key( wp_unslash( $_GET['page'] ) ) : ''; + $settings_updated = isset( $_GET['settings-updated'] ) && is_string( $_GET['settings-updated'] ) ? sanitize_key( wp_unslash( $_GET['settings-updated'] ) ) : ''; + $mode_updated = isset( $_GET['mode-updated'] ) && is_string( $_GET['mode-updated'] ) ? sanitize_key( wp_unslash( $_GET['mode-updated'] ) ) : ''; + $page = isset( $_GET['page'] ) && is_string( $_GET['page'] ) ? sanitize_key( wp_unslash( $_GET['page'] ) ) : ''; // phpcs:enable if ( 'robotstxt-telemetry' !== $page ) { @@ -432,6 +437,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { /** * Render the Network Admin settings page (Multisite only). + * + * @return void */ public function render_network_settings_page() { if ( ! current_user_can( 'manage_network_options' ) ) { @@ -501,7 +508,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { */ private function get_current_tab() { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only navigation state. - $tab = isset( $_GET['tab'] ) ? sanitize_key( wp_unslash( $_GET['tab'] ) ) : 'main'; + $tab = isset( $_GET['tab'] ) && is_string( $_GET['tab'] ) ? sanitize_key( wp_unslash( $_GET['tab'] ) ) : 'main'; return in_array( $tab, array( 'main', 'plugins', 'logs', 'general' ), true ) ? $tab : 'main'; } @@ -510,6 +517,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { * Render the settings screen tabs. * * @param string $current_tab Current tab slug. + * @return void */ private function render_tabs( $current_tab ) { $tabs = array( @@ -544,6 +552,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { /** * Render settings page. + * + * @return void */ public function render_settings_page() { if ( ! current_user_can( Robotstxt_Telemetry_Network::manage_capability() ) ) { @@ -560,8 +570,11 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { $this->render_tabs( $tab ); - echo '
'; - settings_fields( 'robotstxt_telemetry_settings' ); + echo ''; + wp_nonce_field( 'robotstxt_telemetry_settings' ); + echo ''; + echo ''; + echo ''; $this->render_settings_fields( $tab ); @@ -578,6 +591,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { * given tab are rendered, so each tab saves independently. * * @param string $tab Tab slug: 'main', 'logs', or 'general'. + * @return void */ private function render_settings_fields( $tab = 'main' ) { echo ''; @@ -585,126 +599,126 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { if ( 'main' === $tab ) { - $url_mode = Robotstxt_Telemetry_Network::get_useragent_url_mode(); + $url_mode = Robotstxt_Telemetry_Network::get_useragent_url_mode(); - echo ''; - echo ''; - echo ''; - echo ''; - - $version_mode = Robotstxt_Telemetry_Network::get_wp_version_mode(); - - echo ''; - echo ''; - echo ''; - echo ''; - - echo ''; - echo ''; - echo ''; - echo ''; - - $dashboard_services = array( - 'robotstxt_telemetry_replace_news_feed' => array( - 'label' => __( 'Replace the WordPress News feed', 'robotstxt-telemetry' ), - 'title' => __( 'Use WordPress Planet by Fair (planet.fair.pm) instead of wordpress.org/news for the Events and News dashboard widget', 'robotstxt-telemetry' ), - ), - 'robotstxt_telemetry_replace_events_api' => array( - 'label' => __( 'Replace the WordPress Events service', 'robotstxt-telemetry' ), - 'title' => __( 'Use WordPress Events by The WP World (api.fair.pm) instead of api.wordpress.org/events, sending the same request data', 'robotstxt-telemetry' ), - ), - 'robotstxt_telemetry_disable_browse_happy' => array( - 'label' => __( 'Disable the WordPress browser check', 'robotstxt-telemetry' ), - 'title' => __( 'Do not send the browser version to api.wordpress.org/core/browse-happy; the browser is always reported as compatible', 'robotstxt-telemetry' ), - ), - ); - - foreach ( $dashboard_services as $option_name => $service ) { echo ''; - echo ''; - echo ''; - echo ''; - } - - $wp_checks = array( - 'robotstxt_telemetry_wp_core_check' => array( - 'label' => __( 'WordPress Core version check', 'robotstxt-telemetry' ), - 'desc' => __( 'Safe sends only the WordPress version, PHP version, locale, MySQL version, and update channel. Original also sends site counts, database history, PHP extensions, and platform details.', 'robotstxt-telemetry' ), - ), - 'robotstxt_telemetry_wp_themes_check' => array( - 'label' => __( 'WordPress Themes version check', 'robotstxt-telemetry' ), - 'desc' => __( 'Safe sends only the theme name, version, update URI, template, and stylesheet, plus the translation revision date and site locale. Original also sends author details and other theme metadata.', 'robotstxt-telemetry' ), - ), - 'robotstxt_telemetry_wp_plugins_check' => array( - 'label' => __( 'WordPress Plugins version check', 'robotstxt-telemetry' ), - 'desc' => __( 'Safe sends only the plugin version, update URI, and requirements, plus the translation revision date, locale, and the "all" flag. Original also sends names, descriptions, authors, and other plugin metadata.', 'robotstxt-telemetry' ), - ), - ); - - foreach ( $wp_checks as $option_name => $check ) { - $mode = Robotstxt_Telemetry_Network::get_setting( $option_name, 'safe' ); - echo ''; - echo ''; + echo ''; echo ''; echo ''; - } + + $version_mode = Robotstxt_Telemetry_Network::get_wp_version_mode(); + + echo ''; + echo ''; + echo ''; + echo ''; + + echo ''; + echo ''; + echo ''; + echo ''; + + $dashboard_services = array( + 'robotstxt_telemetry_replace_news_feed' => array( + 'label' => __( 'Replace the WordPress News feed', 'robotstxt-telemetry' ), + 'title' => __( 'Use WordPress Planet by Fair (planet.fair.pm) instead of wordpress.org/news for the Events and News dashboard widget', 'robotstxt-telemetry' ), + ), + 'robotstxt_telemetry_replace_events_api' => array( + 'label' => __( 'Replace the WordPress Events service', 'robotstxt-telemetry' ), + 'title' => __( 'Use WordPress Events by The WP World (api.fair.pm) instead of api.wordpress.org/events, sending the same request data', 'robotstxt-telemetry' ), + ), + 'robotstxt_telemetry_disable_browse_happy' => array( + 'label' => __( 'Disable the WordPress browser check', 'robotstxt-telemetry' ), + 'title' => __( 'Do not send the browser version to api.wordpress.org/core/browse-happy; the browser is always reported as compatible', 'robotstxt-telemetry' ), + ), + ); + + foreach ( $dashboard_services as $option_name => $service ) { + echo ''; + echo ''; + echo ''; + echo ''; + } + + $wp_checks = array( + 'robotstxt_telemetry_wp_core_check' => array( + 'label' => __( 'WordPress Core version check', 'robotstxt-telemetry' ), + 'desc' => __( 'Safe sends only the WordPress version, PHP version, locale, MySQL version, and update channel. Original also sends site counts, database history, PHP extensions, and platform details.', 'robotstxt-telemetry' ), + ), + 'robotstxt_telemetry_wp_themes_check' => array( + 'label' => __( 'WordPress Themes version check', 'robotstxt-telemetry' ), + 'desc' => __( 'Safe sends only the theme name, version, update URI, template, and stylesheet, plus the translation revision date and site locale. Original also sends author details and other theme metadata.', 'robotstxt-telemetry' ), + ), + 'robotstxt_telemetry_wp_plugins_check' => array( + 'label' => __( 'WordPress Plugins version check', 'robotstxt-telemetry' ), + 'desc' => __( 'Safe sends only the plugin version, update URI, and requirements, plus the translation revision date, locale, and the "all" flag. Original also sends names, descriptions, authors, and other plugin metadata.', 'robotstxt-telemetry' ), + ), + ); + + foreach ( $wp_checks as $option_name => $check ) { + $mode = Robotstxt_Telemetry_Network::get_setting( $option_name, 'safe' ); + echo ''; + echo ''; + echo ''; + echo ''; + } } // End of the 'main' tab. if ( 'plugins' === $tab ) { @@ -714,44 +728,44 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { $retention = Robotstxt_Telemetry_Network::get_setting( 'robotstxt_telemetry_retention_period', '12hours' ); if ( 'logs' === $tab ) { - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; - echo ''; + foreach ( $retention_options as $value => $label ) { + printf( + '', + esc_attr( $value ), + selected( $retention, $value, false ), + esc_html( $label ) + ); + } + + echo ''; + echo '

' . esc_html__( 'Logs older than the selected period are deleted (12 hours by default). A maximum of 1000 entries is always kept; the cleanup runs when browsing the logs and twice a day automatically.', 'robotstxt-telemetry' ) . '

'; + echo ''; + echo ''; } // End of the 'logs' tab. if ( 'general' === $tab ) { - echo ''; - echo ''; - echo ''; - echo ''; + echo ''; + echo ''; + echo ''; + echo ''; } // End of the 'general' tab. echo ''; @@ -760,6 +774,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { /** * Render the Plugins page. + * + * @return void */ public function render_plugins_page() { $capability = Robotstxt_Telemetry_Network::is_global() ? 'manage_network_options' : Robotstxt_Telemetry_Network::manage_capability(); @@ -833,8 +849,37 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { save_tab_settings( $tab ); + + wp_safe_redirect( + add_query_arg( + array( + 'page' => 'robotstxt-telemetry', + 'tab' => $tab, + 'settings-updated' => 'true', + ), + Robotstxt_Telemetry_Network::base_url() + ) + ); + exit; + } + /** * Save the per-plugin safe-mode settings. + * + * @return void */ private function handle_plugin_modes_save() { check_admin_referer( 'robotstxt_telemetry_plugin_modes' ); @@ -894,6 +939,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { * A widefat table lists every installed plugin with a hide checkbox * (disabled and checked for this plugin), its status, its name, * and its version. + * + * @return void */ private function render_plugins_tab() { if ( ! function_exists( 'get_plugins' ) ) { @@ -956,6 +1003,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { /** * Render logs page. + * + * @return void */ public function render_logs_page() { $capability = Robotstxt_Telemetry_Network::is_global() ? 'manage_network_options' : Robotstxt_Telemetry_Network::manage_capability(); @@ -967,8 +1016,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { require_once ROBOTSTXT_TELEMETRY_PLUGIN_DIR . '/includes/class-robotstxt-telemetry-logs-table.php'; // phpcs:disable WordPress.Security.NonceVerification.Recommended -- Read-only rendering of an admin screen. - $view_action = isset( $_GET['action'] ) ? sanitize_key( wp_unslash( $_GET['action'] ) ) : ''; - $log_id = isset( $_GET['log'] ) ? absint( wp_unslash( $_GET['log'] ) ) : 0; + $view_action = isset( $_GET['action'] ) && is_string( $_GET['action'] ) ? sanitize_key( wp_unslash( $_GET['action'] ) ) : ''; + $log_id = isset( $_GET['log'] ) && is_string( $_GET['log'] ) ? absint( wp_unslash( $_GET['log'] ) ) : 0; echo '
'; echo '

' . esc_html__( 'Telemetry Logs', 'robotstxt-telemetry' ) . '

'; @@ -988,7 +1037,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { // Apply the retention policy before listing. Robotstxt_Telemetry_DB::cleanup(); - $deleted_notice = isset( $_GET['deleted'] ) ? sanitize_key( wp_unslash( $_GET['deleted'] ) ) : ''; + $deleted_notice = isset( $_GET['deleted'] ) && is_string( $_GET['deleted'] ) ? sanitize_key( wp_unslash( $_GET['deleted'] ) ) : ''; // phpcs:enable if ( 'all' === $deleted_notice ) { echo '

' . esc_html__( 'All log entries deleted.', 'robotstxt-telemetry' ) . '

'; @@ -1021,6 +1070,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { /** * Render the delete-all confirmation screen. + * + * @return void */ private function render_delete_all_confirm() { check_admin_referer( 'robotstxt_telemetry_delete_all_confirm' ); @@ -1042,6 +1093,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { * Render a single log entry. * * @param int $log_id Log ID. + * @return void */ private function render_single_log( $log_id ) { $log = Robotstxt_Telemetry_DB::get_log( $log_id ); @@ -1061,7 +1113,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { $this->render_log_row( __( 'Host', 'robotstxt-telemetry' ), $log['host'] ); $this->render_log_row( __( 'Path', 'robotstxt-telemetry' ), $log['path'] ); $this->render_log_row( __( 'Body Params', 'robotstxt-telemetry' ), $this->format_params_field( $log, 'body' ) ); - $this->render_log_row( __( 'Headers', 'robotstxt-telemetry' ), $this->format_json_field( $log['headers_json'] ) ); + $this->render_log_row( __( 'Headers', 'robotstxt-telemetry' ), $this->format_json_field( is_string( $log['headers_json'] ) ? $log['headers_json'] : null ) ); $this->render_log_row( __( 'User Agent', 'robotstxt-telemetry' ), $log['user_agent'] ); $this->render_log_row( __( 'Raw Body', 'robotstxt-telemetry' ), $log['raw_body'] ); $this->render_log_row( __( 'Caller', 'robotstxt-telemetry' ), $log['caller'] ); @@ -1075,7 +1127,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { /** * Render telemetry analysis section. * - * @param array $log Log data. + * @param array $log Log data. + * @return void */ private function render_telemetry_analysis( $log ) { $sections = Robotstxt_Telemetry_Analysis::build_sections( $log ); @@ -1100,12 +1153,13 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { * Render a table row. * * @param string $label Label. - * @param string $value Value. + * @param mixed $value Value. + * @return void */ private function render_log_row( $label, $value ) { echo '
'; echo ''; - echo ''; + echo ''; echo ''; } @@ -1131,8 +1185,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Admin' ) ) { /** * Format query/body params as line-per-parameter output. * - * @param array $log Log data. - * @param string $type Param source. + * @param array $log Log data. + * @param string $type Param source. * @return string */ private function format_params_field( $log, $type ) { diff --git a/includes/class-robotstxt-telemetry-analysis-api-wordpress-org.php b/includes/class-robotstxt-telemetry-analysis-api-wordpress-org.php index b862895..7c97856 100644 --- a/includes/class-robotstxt-telemetry-analysis-api-wordpress-org.php +++ b/includes/class-robotstxt-telemetry-analysis-api-wordpress-org.php @@ -18,8 +18,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Analysis_Api_WordPress_Org' ) ) { /** * Build analysis sections for api.wordpress.org. * - * @param array $log Log data. - * @return array + * @param array $log Log data. + * @return array */ public static function build_sections( $log ) { $sections = array(); @@ -40,8 +40,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Analysis_Api_WordPress_Org' ) ) { /** * Group query parameters. * - * @param array $params Query parameters. - * @return array + * @param array $params Query parameters. + * @return array */ private static function group_query_params( $params ) { $sections = array(); @@ -96,8 +96,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Analysis_Api_WordPress_Org' ) ) { /** * Group body parameters. * - * @param array $params Body parameters. - * @return array + * @param array $params Body parameters. + * @return array */ private static function group_body_params( $params ) { $sections = array(); @@ -114,8 +114,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Analysis_Api_WordPress_Org' ) ) { } if ( is_array( $translations ) ) { - $sections[ __( 'Translations', 'robotstxt-telemetry' ) ] = Robotstxt_Telemetry_Analysis::format_params_lines( $translations ); - } else { + $sections[ __( 'Translations', 'robotstxt-telemetry' ) ] = Robotstxt_Telemetry_Analysis::format_params_lines( Robotstxt_Telemetry_Analysis::normalize_params( $translations ) ); + } elseif ( is_scalar( $translations ) ) { $sections[ __( 'Translations', 'robotstxt-telemetry' ) ] = (string) $translations; } } @@ -130,14 +130,16 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Analysis_Api_WordPress_Org' ) ) { /** * Extract bracketed parameters into a nested array. * - * @param array $params Parameters (will be mutated). - * @param string $prefix Prefix name. - * @return array + * @param array $params Parameters (will be mutated). + * @param string $prefix Prefix name. + * @return array */ private static function pluck_bracketed( &$params, $prefix ) { $result = array(); foreach ( $params as $key => $value ) { + $key = (string) $key; + if ( 0 !== strpos( $key, $prefix . '[' ) ) { continue; } diff --git a/includes/class-robotstxt-telemetry-analysis.php b/includes/class-robotstxt-telemetry-analysis.php index b414bb9..0497047 100644 --- a/includes/class-robotstxt-telemetry-analysis.php +++ b/includes/class-robotstxt-telemetry-analysis.php @@ -18,11 +18,11 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Analysis' ) ) { /** * Build analysis sections for a log entry. * - * @param array $log Log data. - * @return array + * @param array $log Log data. + * @return array */ public static function build_sections( $log ) { - $host = isset( $log['host'] ) ? strtolower( (string) $log['host'] ) : ''; + $host = isset( $log['host'] ) && is_string( $log['host'] ) ? strtolower( $log['host'] ) : ''; if ( 'api.wordpress.org' === $host ) { return Robotstxt_Telemetry_Analysis_Api_WordPress_Org::build_sections( $log ); @@ -34,8 +34,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Analysis' ) ) { /** * Build generic analysis sections. * - * @param array $log Log data. - * @return array + * @param array $log Log data. + * @return array */ private static function build_generic_sections( $log ) { $sections = array(); @@ -58,22 +58,25 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Analysis' ) ) { * * Prefers the redacted query_json column over re-parsing the raw URL. * - * @param array $log Log data. - * @return array + * @param array $log Log data. + * @return array */ public static function extract_query_params( $log ) { - if ( empty( $log['url'] ) && empty( $log['query_json'] ) ) { + $url = isset( $log['url'] ) && is_string( $log['url'] ) ? $log['url'] : ''; + $query_json = isset( $log['query_json'] ) && is_string( $log['query_json'] ) ? $log['query_json'] : ''; + + if ( '' === $url && '' === $query_json ) { return array(); } - if ( ! empty( $log['query_json'] ) ) { - $decoded = json_decode( $log['query_json'], true ); + if ( '' !== $query_json ) { + $decoded = json_decode( $query_json, true ); if ( is_array( $decoded ) && ! empty( $decoded ) ) { - return $decoded; + return self::normalize_params( $decoded ); } } - $parts = explode( '?', (string) $log['url'], 2 ); + $parts = explode( '?', $url, 2 ); $query = isset( $parts[1] ) ? $parts[1] : ''; if ( '' === $query ) { @@ -86,14 +89,17 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Analysis' ) ) { /** * Extract parameters from the body. * - * @param array $log Log data. - * @return array + * @param array $log Log data. + * @return array */ public static function extract_body_params( $log ) { - if ( ! empty( $log['body_json'] ) ) { - $decoded = json_decode( $log['body_json'], true ); + $body_json = isset( $log['body_json'] ) && is_string( $log['body_json'] ) ? $log['body_json'] : ''; + $raw_body = isset( $log['raw_body'] ) && is_string( $log['raw_body'] ) ? $log['raw_body'] : ''; + + if ( '' !== $body_json ) { + $decoded = json_decode( $body_json, true ); if ( is_array( $decoded ) ) { - return $decoded; + return self::normalize_params( $decoded ); } if ( is_string( $decoded ) ) { @@ -101,18 +107,34 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Analysis' ) ) { } } - if ( ! empty( $log['raw_body'] ) ) { - return self::parse_query_string_flat( $log['raw_body'] ); + if ( '' !== $raw_body ) { + return self::parse_query_string_flat( $raw_body ); } return array(); } + /** + * Normalize a decoded parameter array to integer or string keys. + * + * @param array $params Decoded parameters. + * @return array + */ + public static function normalize_params( array $params ) { + $normalized = array(); + + foreach ( $params as $key => $value ) { + $normalized[ $key ] = $value; + } + + return $normalized; + } + /** * Parse a query string into a flat key/value array. * * @param string $query Query string. - * @return array + * @return array> */ public static function parse_query_string_flat( $query ) { $params = array(); @@ -149,7 +171,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Analysis' ) ) { /** * Format parameters as line-per-entry output. * - * @param array $params Parameters. + * @param array $params Parameters. * @return string */ public static function format_params_lines( $params ) { @@ -161,7 +183,15 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Analysis' ) ) { $value = wp_json_encode( $value ); } - $lines[] = sprintf( '%s=%s', $key, $value ); + if ( null === $value ) { + $value = ''; + } elseif ( is_scalar( $value ) ) { + $value = (string) $value; + } + + if ( is_string( $value ) ) { + $lines[] = sprintf( '%s=%s', $key, $value ); + } } return implode( "\n", $lines ); @@ -170,9 +200,9 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Analysis' ) ) { /** * Flatten nested parameters into bracketed keys. * - * @param array $params Parameters to flatten. - * @param string|null $prefix Current prefix. - * @return array + * @param array $params Parameters to flatten. + * @param string|null $prefix Current prefix. + * @return array */ public static function flatten_params( $params, $prefix = null ) { $flat = array(); diff --git a/includes/class-robotstxt-telemetry-db.php b/includes/class-robotstxt-telemetry-db.php index 09f114a..c5f0494 100644 --- a/includes/class-robotstxt-telemetry-db.php +++ b/includes/class-robotstxt-telemetry-db.php @@ -48,6 +48,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_DB' ) ) { /** * Activation hook. + * + * @return void */ public static function activate() { self::create_table(); @@ -56,6 +58,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_DB' ) ) { /** * Ensure the database schema is up to date. + * + * @return void */ public static function maybe_upgrade() { if ( self::$did_check ) { @@ -78,6 +82,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_DB' ) ) { /** * Create or update the logs table. + * + * @return void */ public static function create_table() { global $wpdb; @@ -115,7 +121,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_DB' ) ) { /** * Insert a log row. * - * @param array $data Log data. + * @param array $data Log data. + * @return void */ public static function insert_log( array $data ) { global $wpdb; @@ -144,7 +151,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_DB' ) ) { * Fetch a single log row. * * @param int $log_id Log ID. - * @return array|null + * @return array|null */ public static function get_log( $log_id ) { global $wpdb; @@ -221,7 +228,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_DB' ) ) { '3days' => 3 * DAY_IN_SECONDS, ); - if ( isset( $periods[ $retention ] ) ) { + if ( is_string( $retention ) && isset( $periods[ $retention ] ) ) { $cutoff = gmdate( 'Y-m-d H:i:s', time() - $periods[ $retention ] ); $wpdb->query( // phpcs:ignore WordPress.DB.DirectDatabaseQuery -- Delete from the plugin's custom table via the wpdb API. diff --git a/includes/class-robotstxt-telemetry-endpoints.php b/includes/class-robotstxt-telemetry-endpoints.php index 32edb77..9917416 100644 --- a/includes/class-robotstxt-telemetry-endpoints.php +++ b/includes/class-robotstxt-telemetry-endpoints.php @@ -44,6 +44,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Endpoints' ) ) { /** * Register hooks. + * + * @return void */ public function register() { add_filter( 'pre_http_request', array( $this, 'intercept' ), 10, 3 ); @@ -52,10 +54,10 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Endpoints' ) ) { /** * Intercept outbound WordPress.org requests. * - * @param false|array|WP_Error $preempt Short-circuit value from other filters. - * @param array $args HTTP request arguments. - * @param string $url Request URL. - * @return false|array|WP_Error + * @param false|array|WP_Error $preempt Short-circuit value from other filters. + * @param array{body?:string|array,headers?:string|array} $args HTTP request arguments. + * @param string $url Request URL. + * @return false|array|WP_Error */ public function intercept( $preempt, $args, $url ) { if ( false !== $preempt ) { @@ -112,20 +114,20 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Endpoints' ) ) { * Build a successful Browse Happy response marking the browser * as up to date and secure, so no browser nag is shown. * - * @return array + * @return array */ private function mock_browse_happy_response() { $body = wp_json_encode( array( - 'platform' => 'other', - 'name' => 'Browser', - 'version' => '1.0', + 'platform' => 'other', + 'name' => 'Browser', + 'version' => '1.0', 'current_version' => '1.0', - 'upgrade' => false, - 'insecure' => false, - 'update_url' => '', - 'img_src' => '', - 'img_src_ssl' => '', + 'upgrade' => false, + 'insecure' => false, + 'update_url' => '', + 'img_src' => '', + 'img_src_ssl' => '', ) ); diff --git a/includes/class-robotstxt-telemetry-logger.php b/includes/class-robotstxt-telemetry-logger.php index 27c91f7..e89f74f 100644 --- a/includes/class-robotstxt-telemetry-logger.php +++ b/includes/class-robotstxt-telemetry-logger.php @@ -38,6 +38,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Logger' ) ) { /** * Register hooks. + * + * @return void */ public function register() { add_filter( 'http_request_args', array( $this, 'capture_request' ), 10, 2 ); @@ -46,12 +48,12 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Logger' ) ) { /** * Capture outbound request arguments. * - * @param array $args HTTP request arguments. - * @param string $url Request URL. - * @return array + * @param array $args HTTP request arguments. + * @param string $url Request URL. + * @return array */ public function capture_request( $args, $url ) { - if ( empty( $url ) || ! is_array( $args ) ) { + if ( empty( $url ) ) { return $args; } @@ -72,21 +74,25 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Logger' ) ) { /** * Prepare log data for storage. * - * @param array $args Request args. - * @param string $url Request URL. - * @return array + * @param array $args Request args. + * @param string $url Request URL. + * @return array */ private function prepare_log_data( $args, $url ) { - $method = isset( $args['method'] ) ? strtoupper( sanitize_text_field( (string) $args['method'] ) ) : 'GET'; + $method = isset( $args['method'] ) && is_string( $args['method'] ) ? strtoupper( sanitize_text_field( $args['method'] ) ) : 'GET'; $url = esc_url_raw( $url ); $parsed_url = wp_parse_url( $url ); - $host = isset( $parsed_url['host'] ) ? sanitize_text_field( $parsed_url['host'] ) : ''; - $path = isset( $parsed_url['path'] ) ? sanitize_text_field( $parsed_url['path'] ) : ''; + if ( ! is_array( $parsed_url ) ) { + $parsed_url = array(); + } + + $host = isset( $parsed_url['host'] ) ? sanitize_text_field( $parsed_url['host'] ) : ''; + $path = isset( $parsed_url['path'] ) ? sanitize_text_field( $parsed_url['path'] ) : ''; $query_params = array(); if ( ! empty( $parsed_url['query'] ) ) { - $query_params = wp_parse_args( $parsed_url['query'] ); + $query_params = $this->normalize_keys( wp_parse_args( $parsed_url['query'] ) ); } $query_params = $this->redact_array( $query_params ); @@ -110,7 +116,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Logger' ) ) { if ( isset( $args['body'] ) ) { $body_data = $args['body']; if ( is_array( $body_data ) ) { - $redacted_body = $this->redact_array( $body_data ); + $redacted_body = $this->redact_array( $this->normalize_keys( $body_data ) ); $body_json = $this->encode_json_limited( $redacted_body, $this->max_json_bytes ); if ( empty( $body_json ) ) { @@ -147,11 +153,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Logger' ) ) { // phpcs:ignore WordPress.PHP.DevelopmentFunctions -- Needed for caller context logging. $caller = wp_debug_backtrace_summary( null, 0, false ); - if ( is_array( $caller ) || is_object( $caller ) ) { - $caller = wp_json_encode( $caller ); - } - - $caller = $this->truncate_string( (string) $caller, $this->max_caller_bytes ); + $caller = wp_json_encode( $caller ); + $caller = $this->truncate_string( is_string( $caller ) ? $caller : '', $this->max_caller_bytes ); return array( 'created_at' => current_time( 'mysql', true ), @@ -172,30 +175,31 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Logger' ) ) { /** * Rebuild a URL with a redacted query string and without credentials. * - * @param array $parts URL parts from wp_parse_url(). - * @param string $query Redacted query string. + * @param array $parts URL parts from wp_parse_url(). + * @param string $query Redacted query string. * @return string */ private function build_redacted_url( $parts, $query ) { - $url = ''; + $scheme = isset( $parts['scheme'] ) && is_string( $parts['scheme'] ) ? $parts['scheme'] : ''; + $host = isset( $parts['host'] ) && is_string( $parts['host'] ) ? $parts['host'] : ''; - if ( ! empty( $parts['scheme'] ) && ! empty( $parts['host'] ) ) { - $url = $parts['scheme'] . '://' . $parts['host']; - } else { + if ( '' === $scheme || '' === $host ) { return ''; } - if ( ! empty( $parts['port'] ) ) { - $url .= ':' . (int) $parts['port']; + $url = $scheme . '://' . $host; + + if ( isset( $parts['port'] ) && is_int( $parts['port'] ) ) { + $url .= ':' . $parts['port']; } - $url .= isset( $parts['path'] ) ? $parts['path'] : ''; + $url .= isset( $parts['path'] ) && is_string( $parts['path'] ) ? $parts['path'] : ''; if ( '' !== $query ) { $url .= '?' . $query; } - if ( ! empty( $parts['fragment'] ) ) { + if ( isset( $parts['fragment'] ) && is_string( $parts['fragment'] ) ) { $url .= '#' . $parts['fragment']; } @@ -206,7 +210,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Logger' ) ) { * Normalize request headers into a simple array. * * @param mixed $headers Headers value. - * @return array + * @return array */ private function normalize_headers( $headers ) { if ( is_object( $headers ) && method_exists( $headers, 'getAll' ) ) { @@ -230,20 +234,24 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Logger' ) ) { /** * Extract the user agent from request args. * - * @param array $args Request args. + * @param array $args Request args. * @return string|null */ private function extract_user_agent( $args ) { $user_agent = ''; - if ( isset( $args['user-agent'] ) ) { - $user_agent = (string) $args['user-agent']; - } elseif ( isset( $args['user_agent'] ) ) { - $user_agent = (string) $args['user_agent']; - } elseif ( isset( $args['headers']['user-agent'] ) ) { - $user_agent = (string) $args['headers']['user-agent']; - } elseif ( isset( $args['headers']['User-Agent'] ) ) { - $user_agent = (string) $args['headers']['User-Agent']; + if ( isset( $args['user-agent'] ) && is_string( $args['user-agent'] ) ) { + $user_agent = $args['user-agent']; + } elseif ( isset( $args['user_agent'] ) && is_string( $args['user_agent'] ) ) { + $user_agent = $args['user_agent']; + } elseif ( isset( $args['headers'] ) && is_array( $args['headers'] ) ) { + $headers = $args['headers']; + + if ( isset( $headers['user-agent'] ) && is_string( $headers['user-agent'] ) ) { + $user_agent = $headers['user-agent']; + } elseif ( isset( $headers['User-Agent'] ) && is_string( $headers['User-Agent'] ) ) { + $user_agent = $headers['User-Agent']; + } } if ( '' === $user_agent ) { @@ -257,33 +265,49 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Logger' ) ) { * Parse body strings into arrays when possible. * * @param string $body Raw body. - * @return array|null + * @return array|null */ private function parse_body_string( $body ) { $decoded = json_decode( $body, true ); if ( is_array( $decoded ) ) { - return $decoded; + return $this->normalize_keys( $decoded ); } $parsed = wp_parse_args( $body ); if ( ! empty( $parsed ) ) { - return $parsed; + return $this->normalize_keys( $parsed ); } return null; } + /** + * Normalize an array to integer or string keys. + * + * @param array $data Input array. + * @return array + */ + private function normalize_keys( array $data ) { + $normalized = array(); + + foreach ( $data as $key => $value ) { + $normalized[ $key ] = $value; + } + + return $normalized; + } + /** * Redact sensitive keys in arrays. * - * @param array $data Data to sanitize. - * @return array + * @param array $data Data to sanitize. + * @return array */ private function redact_array( $data ) { $redacted = array(); foreach ( $data as $key => $value ) { - $normalized_key = is_string( $key ) ? strtolower( $key ) : (string) $key; + $normalized_key = strtolower( (string) $key ); if ( $this->is_sensitive_key( $normalized_key ) ) { $redacted[ $key ] = '[redacted]'; @@ -348,14 +372,16 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Logger' ) ) { return $value; } - return sanitize_text_field( wp_json_encode( $value ) ); + $encoded = wp_json_encode( $value ); + + return false === $encoded ? '' : sanitize_text_field( $encoded ); } /** * Encode JSON with size limits. * - * @param array $data Data to encode. - * @param int $limit Max size in bytes. + * @param array $data Data to encode. + * @param int $limit Max size in bytes. * @return string|null */ private function encode_json_limited( $data, $limit ) { @@ -375,9 +401,9 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Logger' ) ) { /** * Truncate array values to keep payloads manageable. * - * @param array $data Data to trim. - * @param int $max_len Max length per string value. - * @return array + * @param array $data Data to trim. + * @param int $max_len Max length per string value. + * @return array */ private function truncate_array_values( $data, $max_len ) { $trimmed = array(); diff --git a/includes/class-robotstxt-telemetry-logs-table.php b/includes/class-robotstxt-telemetry-logs-table.php index b4a3c70..545fc73 100644 --- a/includes/class-robotstxt-telemetry-logs-table.php +++ b/includes/class-robotstxt-telemetry-logs-table.php @@ -42,7 +42,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Logs_Table' ) ) { /** * Get columns. * - * @return array + * @return array */ public function get_columns() { return array( @@ -55,6 +55,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Logs_Table' ) ) { /** * Prepare items for display. + * + * @return void */ public function prepare_items() { global $wpdb; @@ -119,18 +121,19 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Logs_Table' ) ) { /** * Render default column output. * - * @param array $item Column data. - * @param string $column_name Column name. + * @param array $item Column data. + * @param string $column_name Column name. * @return string */ public function column_default( $item, $column_name ) { switch ( $column_name ) { case 'created_at': - return esc_html( isset( $item[ $column_name ] ) ? $item[ $column_name ] : '' ); case 'method': case 'host': case 'path': - return esc_html( isset( $item[ $column_name ] ) ? $item[ $column_name ] : '' ); + $value = isset( $item[ $column_name ] ) && is_string( $item[ $column_name ] ) ? $item[ $column_name ] : ''; + + return esc_html( $value ); default: return ''; } @@ -139,11 +142,11 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Logs_Table' ) ) { /** * Add row actions. * - * @param array $item Item data. + * @param array $item Item data. * @return string */ public function column_created_at( $item ) { - $log_id = (int) $item['id']; + $log_id = isset( $item['id'] ) && is_numeric( $item['id'] ) ? (int) $item['id'] : 0; $view_url = add_query_arg( array( @@ -171,23 +174,27 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Logs_Table' ) ) { 'delete' => '' . esc_html__( 'Delete', 'robotstxt-telemetry' ) . '', ); - return esc_html( $item['created_at'] ) . $this->row_actions( $actions ); + $created_at = isset( $item['created_at'] ) && is_string( $item['created_at'] ) ? $item['created_at'] : ''; + + return esc_html( $created_at ) . $this->row_actions( $actions ); } /** * Render the URL column without query parameters. * - * @param array $item Item data. + * @param array $item Item data. * @return string */ public function column_url( $item ) { - if ( empty( $item['url'] ) ) { + $url = isset( $item['url'] ) && is_string( $item['url'] ) ? $item['url'] : ''; + + if ( '' === $url ) { return ''; } - $parsed_url = wp_parse_url( $item['url'] ); - if ( empty( $parsed_url ) || empty( $parsed_url['host'] ) ) { - return esc_html( $item['url'] ); + $parsed_url = wp_parse_url( $url ); + if ( ! is_array( $parsed_url ) || empty( $parsed_url['host'] ) ) { + return esc_html( $url ); } $scheme = isset( $parsed_url['scheme'] ) ? $parsed_url['scheme'] : 'https'; @@ -198,91 +205,11 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Logs_Table' ) ) { return esc_html( $base ); } - /** - * Format parameters column output. - * - * @param array $item Item data. - * @return string - */ - private function format_params_column( $item ) { - $params = array(); - - if ( ! empty( $item['url'] ) ) { - $parsed_url = wp_parse_url( $item['url'] ); - if ( ! empty( $parsed_url['query'] ) ) { - $fallback_query = wp_parse_args( $parsed_url['query'] ); - $params = array_merge( $params, $fallback_query ); - } - } - - $query_params = $this->decode_json_params( isset( $item['query_json'] ) ? $item['query_json'] : '' ); - if ( ! empty( $query_params ) ) { - $params = array_merge( $params, $query_params ); - } - - $body_params = $this->decode_json_params( isset( $item['body_json'] ) ? $item['body_json'] : '' ); - if ( ! empty( $body_params ) ) { - $params = array_merge( $params, $body_params ); - } - - if ( empty( $body_params ) && ! empty( $item['raw_body'] ) ) { - $fallback_body = wp_parse_args( $item['raw_body'] ); - if ( ! empty( $fallback_body ) ) { - $params = array_merge( $params, $fallback_body ); - } - } - - if ( empty( $params ) ) { - return ''; - } - - $lines = array(); - foreach ( $params as $key => $value ) { - if ( is_array( $value ) ) { - $value = wp_json_encode( $value ); - } - - $lines[] = sprintf( '%s=%s', $key, $value ); - } - - return '
' . esc_html( implode( "\n", $lines ) ) . '
'; - } - - /** - * Decode JSON parameters into arrays. - * - * @param string $value JSON string. - * @return array - */ - private function decode_json_params( $value ) { - if ( empty( $value ) ) { - return array(); - } - - $decoded = json_decode( $value, true ); - if ( is_array( $decoded ) ) { - return $decoded; - } - - if ( is_string( $decoded ) ) { - $parsed = wp_parse_args( $decoded ); - if ( ! empty( $parsed ) ) { - return $parsed; - } - } - - $parsed = wp_parse_args( $value ); - if ( ! empty( $parsed ) ) { - return $parsed; - } - - return array(); - } - /** * Extra controls for filtering. * * @param string $which Top or bottom. + * @return void */ public function extra_tablenav( $which ) { if ( 'top' !== $which ) { @@ -344,7 +271,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Logs_Table' ) ) { */ private function get_filter_value( $key ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Read-only list filters. - if ( ! isset( $_GET[ $key ] ) ) { + if ( ! isset( $_GET[ $key ] ) || ! is_string( $_GET[ $key ] ) ) { return ''; } diff --git a/includes/class-robotstxt-telemetry-manager-notice.php b/includes/class-robotstxt-telemetry-manager-notice.php index 5195c03..f2a9c17 100644 --- a/includes/class-robotstxt-telemetry-manager-notice.php +++ b/includes/class-robotstxt-telemetry-manager-notice.php @@ -34,6 +34,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Manager_Notice' ) ) { /** * Register hooks. + * + * @return void */ public function register() { add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) ); @@ -58,6 +60,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Manager_Notice' ) ) { /** * Enqueue the inline dismissal script on the plugins list screen. + * + * @return void */ public function enqueue_scripts() { if ( ! $this->should_show_notice() ) { @@ -93,6 +97,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Manager_Notice' ) ) { /** * Render the dismissible notice on the plugins list screen. + * + * @return void */ public function render_plugins_page_notice() { if ( ! $this->should_show_notice() ) { @@ -104,6 +110,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Manager_Notice' ) ) { /** * Render a permanent notice for the settings screen. + * + * @return void */ public function render_settings_notice() { $this->render_notice( 'notice-info', '' ); @@ -114,6 +122,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Manager_Notice' ) ) { * * @param string $classes Extra CSS classes. * @param string $id Optional DOM id for the notice container. + * @return void */ private function render_notice( $classes, $id ) { if ( self::is_manager_active() ) { @@ -159,6 +168,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Manager_Notice' ) ) { /** * Persist the notice dismissal for the current user. + * + * @return void */ public function handle_dismiss() { check_ajax_referer( 'robotstxt_telemetry_manager_notice' ); diff --git a/includes/class-robotstxt-telemetry-network.php b/includes/class-robotstxt-telemetry-network.php index 7c252cf..d036a30 100644 --- a/includes/class-robotstxt-telemetry-network.php +++ b/includes/class-robotstxt-telemetry-network.php @@ -33,22 +33,22 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Network' ) ) { /** * Plugin settings and their defaults. * - * @var array + * @var array */ const SETTINGS = array( - 'robotstxt_telemetry_useragent_url' => 'hash', - 'robotstxt_telemetry_wp_version' => 'actual', - 'robotstxt_telemetry_mask_locale' => false, - 'robotstxt_telemetry_replace_news_feed' => true, - 'robotstxt_telemetry_replace_events_api' => true, - 'robotstxt_telemetry_disable_browse_happy' => true, - 'robotstxt_telemetry_wp_core_check' => 'safe', - 'robotstxt_telemetry_wp_themes_check' => 'safe', - 'robotstxt_telemetry_wp_plugins_check' => 'safe', - 'robotstxt_telemetry_hidden_plugins' => array(), - 'robotstxt_telemetry_plugin_modes' => array(), - 'robotstxt_telemetry_retention_period' => '12hours', - 'robotstxt_telemetry_delete_on_uninstall' => false, + 'robotstxt_telemetry_useragent_url' => 'hash', + 'robotstxt_telemetry_wp_version' => 'actual', + 'robotstxt_telemetry_mask_locale' => false, + 'robotstxt_telemetry_replace_news_feed' => true, + 'robotstxt_telemetry_replace_events_api' => true, + 'robotstxt_telemetry_disable_browse_happy' => true, + 'robotstxt_telemetry_wp_core_check' => 'safe', + 'robotstxt_telemetry_wp_themes_check' => 'safe', + 'robotstxt_telemetry_wp_plugins_check' => 'safe', + 'robotstxt_telemetry_hidden_plugins' => array(), + 'robotstxt_telemetry_plugin_modes' => array(), + 'robotstxt_telemetry_retention_period' => '12hours', + 'robotstxt_telemetry_delete_on_uninstall' => false, ); /** @@ -134,6 +134,9 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Network' ) ) { /** * The main site ID of the current network. * + * On WordPress 4.8 and older the current network object exposes the + * main site ID through its magic "blog_id" property. + * * @return int */ public static function main_site_id() { @@ -143,7 +146,9 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Network' ) ) { $current_site = get_current_site(); - return max( 1, (int) $current_site->blog_id ); + $blog_id = isset( $current_site->blog_id ) ? (int) $current_site->blog_id : 0; + + return max( 1, $blog_id ); } /** @@ -194,10 +199,15 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Network' ) ) { * @return string[] */ public static function get_hidden_plugins() { - $hidden = self::get_setting( 'robotstxt_telemetry_hidden_plugins', array() ); + $stored = self::get_setting( 'robotstxt_telemetry_hidden_plugins', array() ); + $hidden = array(); - if ( ! is_array( $hidden ) ) { - $hidden = array(); + if ( is_array( $stored ) ) { + foreach ( $stored as $basename ) { + if ( is_string( $basename ) ) { + $hidden[] = $basename; + } + } } $hidden[] = 'robotstxt-telemetry/robotstxt-telemetry.php'; @@ -208,12 +218,24 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Network' ) ) { /** * Get the per-plugin safe-mode map (slug => safe|original). * - * @return array + * @return array */ public static function get_plugin_modes() { - $modes = self::get_setting( 'robotstxt_telemetry_plugin_modes', array() ); + $stored = self::get_setting( 'robotstxt_telemetry_plugin_modes', array() ); - return is_array( $modes ) ? $modes : array(); + if ( ! is_array( $stored ) ) { + return array(); + } + + $modes = array(); + + foreach ( $stored as $slug => $mode ) { + if ( is_string( $slug ) && is_string( $mode ) ) { + $modes[ $slug ] = $mode; + } + } + + return $modes; } /** diff --git a/includes/class-robotstxt-telemetry-plugin-guards.php b/includes/class-robotstxt-telemetry-plugin-guards.php index d224c77..dc3b59c 100644 --- a/includes/class-robotstxt-telemetry-plugin-guards.php +++ b/includes/class-robotstxt-telemetry-plugin-guards.php @@ -29,6 +29,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Plugin_Guards' ) ) { /** * Register hooks. + * + * @return void */ public function register() { add_filter( 'pre_http_request', array( $this, 'apply_guards' ), 4, 3 ); @@ -37,10 +39,10 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Plugin_Guards' ) ) { /** * Apply the Safe profiles to an outbound request. * - * @param false|array|WP_Error $preempt Preempt value. - * @param array $args Request arguments. - * @param string $url Request URL. - * @return false|array|WP_Error + * @param false|array|WP_Error $preempt Preempt value. + * @param array{body?:string|array,headers?:string|array,user-agent?:string} $args Request arguments. + * @param string $url Request URL. + * @return false|array|WP_Error */ public function apply_guards( $preempt, $args, $url ) { if ( false !== $preempt || self::$busy ) { @@ -75,7 +77,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Plugin_Guards' ) ) { } if ( 'strip_query' === $action ) { - $new_url = $this->strip_query_keys( $url, $matcher['keys'] ); + $new_url = $this->strip_query_keys( $url, isset( $matcher['keys'] ) ? $matcher['keys'] : array() ); if ( $new_url !== $url ) { $url = $new_url; $modified = true; @@ -84,8 +86,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Plugin_Guards' ) ) { } if ( 'strip_body' === $action ) { - $new_body = $this->strip_body_keys( $args, $matcher['keys'] ); - if ( null !== $new_body ) { + $new_body = $this->strip_body_keys( $args, isset( $matcher['keys'] ) ? $matcher['keys'] : array() ); + if ( is_string( $new_body ) || is_array( $new_body ) ) { $args['body'] = $new_body; $modified = true; } @@ -93,7 +95,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Plugin_Guards' ) ) { } if ( 'strip_headers' === $action ) { - $new_headers = $this->strip_header_keys( $args, $matcher['headers'] ); + $new_headers = $this->strip_header_keys( $args, isset( $matcher['headers'] ) ? $matcher['headers'] : array() ); if ( null !== $new_headers ) { $args['headers'] = $new_headers; $modified = true; @@ -127,7 +129,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Plugin_Guards' ) ) { * * @param string $host Request host. * @param string $path Request path. - * @return array Slug => list of matching matchers. + * @return array> Slug => list of matching matchers. */ private function match_profiles( $host, $path ) { $candidates = array(); @@ -160,8 +162,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Plugin_Guards' ) ) { * Matchers without a host restriction (path-only) apply to any host; * the caller attribution keeps them scoped to their own plugin. * - * @param string $host Request host. - * @param array $matcher Matcher. + * @param string $host Request host. + * @param array{host?:string,host_contains?:string} $matcher Matcher. * @return bool */ private function host_matches( $host, $matcher ) { @@ -179,7 +181,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Plugin_Guards' ) ) { /** * Find which of the candidate plugins issued the request. * - * @param array $slugs Candidate plugin slugs. + * @param array $slugs Candidate plugin slugs. * @return string Plugin slug or an empty string. */ private function find_calling_plugin( $slugs ) { @@ -187,7 +189,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Plugin_Guards' ) ) { $backtrace = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS ); foreach ( $backtrace as $frame ) { - if ( empty( $frame['file'] ) || ! is_string( $frame['file'] ) ) { + if ( empty( $frame['file'] ) ) { continue; } @@ -207,7 +209,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Plugin_Guards' ) ) { * Build a mock response for a blocked endpoint. * * @param string $body Mock body. - * @return array + * @return array */ private function mock_response( $body ) { return array( @@ -225,8 +227,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Plugin_Guards' ) ) { /** * Remove keys from the URL query string. * - * @param string $url Request URL. - * @param array $keys Keys to remove. + * @param string $url Request URL. + * @param array $keys Keys to remove. * @return string */ private function strip_query_keys( $url, $keys ) { @@ -256,8 +258,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Plugin_Guards' ) ) { * * Returns null when nothing changed. * - * @param array $args Request arguments. - * @param array $keys Keys to remove. + * @param array $args Request arguments. + * @param array $keys Keys to remove. * @return mixed|null */ private function strip_body_keys( $args, $keys ) { @@ -300,9 +302,9 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Plugin_Guards' ) ) { /** * Remove keys from an array (case-insensitive). * - * @param array $data Source array. - * @param array $keys Keys to remove. - * @return array + * @param array $data Source array. + * @param array $keys Keys to remove. + * @return array */ private function remove_keys( $data, $keys ) { $lower = array_map( 'strtolower', array_values( $keys ) ); @@ -321,9 +323,9 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Plugin_Guards' ) ) { /** * Remove headers from the request arguments. * - * @param array $args Request arguments. - * @param array $headers Header names to remove. - * @return array|null + * @param array $args Request arguments. + * @param array $headers Header names to remove. + * @return array|null */ private function strip_header_keys( $args, $headers ) { if ( ! isset( $args['headers'] ) || ! is_array( $args['headers'] ) ) { @@ -350,7 +352,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Plugin_Guards' ) ) { * * Returns null when there is nothing to strip. * - * @param array $args Request arguments. + * @param array $args Request arguments. * @return string|null */ private function strip_user_agent( $args ) { diff --git a/includes/class-robotstxt-telemetry-plugin-profiles.php b/includes/class-robotstxt-telemetry-plugin-profiles.php index 2328036..cd4cb92 100644 --- a/includes/class-robotstxt-telemetry-plugin-profiles.php +++ b/includes/class-robotstxt-telemetry-plugin-profiles.php @@ -28,7 +28,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Plugin_Profiles' ) ) { /** * Cached profile registry (built once per request). * - * @var array|null + * @var array,note:string}>|null */ private static $cache = null; @@ -37,7 +37,7 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Plugin_Profiles' ) ) { * * The array is built on demand so translations are loaded. * - * @return array + * @return array,note:string}> */ public static function get_profiles() { if ( null !== self::$cache ) { @@ -51,444 +51,915 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Plugin_Profiles' ) ) { $wpmudev = self::wpmudev_matchers(); $profiles = array( - 'ad-inserter' => array( - 'matchers' => array( array( 'host' => 'analytics.adinserter.pro', 'do' => 'block' ) ), + 'ad-inserter' => array( + 'matchers' => array( + array( + 'host' => 'analytics.adinserter.pro', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the analytics.adinserter.pro telemetry (site URL, site name, WordPress and PHP versions, admin email, plugin list and options). Update checks keep working.', 'robotstxt-telemetry' ), ), - 'all-in-one-seo-pack' => array( - 'matchers' => array( array( 'host_contains' => 'aioseo', 'do' => 'strip_ua' ) ), + 'all-in-one-seo-pack' => array( + 'matchers' => array( + array( + 'host_contains' => 'aioseo', + 'do' => 'strip_ua', + ), + ), 'note' => __( 'Removes the WordPress version and site URL from the API User-Agent. The connect flow keeps sending the site URL because it is the account identifier.', 'robotstxt-telemetry' ), ), - 'all-in-one-wp-migration' => array( - 'matchers' => array( array( 'host_contains' => 'servmask', 'do' => 'strip_query', 'keys' => array( 'site_url', 'admin_email' ) ) ), + 'all-in-one-wp-migration' => array( + 'matchers' => array( + array( + 'host_contains' => 'servmask', + 'do' => 'strip_query', + 'keys' => array( 'site_url', 'admin_email' ), + ), + ), 'note' => __( 'Removes the site URL and the admin email from the extension update-check query. Extension updates keep working (they only need the purchased extension slug and version).', 'robotstxt-telemetry' ), ), - 'antispam-bee' => array( + 'antispam-bee' => array( 'matchers' => array( - array( 'host' => 'api.pluginkollektiv.org', 'do' => 'block' ), - array( 'host_contains' => 'iplocate.io', 'do' => 'block' ), + array( + 'host' => 'api.pluginkollektiv.org', + 'do' => 'block', + ), + array( + 'host_contains' => 'iplocate.io', + 'do' => 'block', + ), ), 'note' => __( 'Blocks the comment-language check (which sends the comment text) and the IP country lookup. All the local spam checks keep working.', 'robotstxt-telemetry' ), ), - 'astra-sites' => array( + 'astra-sites' => array( 'matchers' => array( - array( 'host_contains' => 'websitedemos', 'do' => 'strip_query', 'keys' => array( 'site_url', 'domain' ) ), - array( 'host_contains' => 'startertemplates', 'do' => 'strip_query', 'keys' => array( 'site_url', 'domain' ) ), + array( + 'host_contains' => 'websitedemos', + 'do' => 'strip_query', + 'keys' => array( 'site_url', 'domain' ), + ), + array( + 'host_contains' => 'startertemplates', + 'do' => 'strip_query', + 'keys' => array( 'site_url', 'domain' ), + ), ), 'note' => __( 'Removes the site URL from the starter-template requests. License validation keeps sending the site URL because it is the account identifier.', 'robotstxt-telemetry' ), ), - 'autoptimize' => array( - 'matchers' => array( array( 'host' => 'misc.optimizingmatters.com', 'do' => 'block' ) ), + 'autoptimize' => array( + 'matchers' => array( + array( + 'host' => 'misc.optimizingmatters.com', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the usage ping. The critical CSS service keeps receiving the page URL because generating the CSS for a page requires that page URL.', 'robotstxt-telemetry' ), ), - 'backwpup' => array( + 'backwpup' => array( 'matchers' => $mixpanel, 'note' => __( 'Blocks the Mixpanel telemetry events (which include the site host and versions). Backup destinations are admin-configured and untouched.', 'robotstxt-telemetry' ), ), - 'better-wp-security' => array( - 'matchers' => array( array( 'path' => '#/telemetry#i', 'do' => 'block' ) ), + 'better-wp-security' => array( + 'matchers' => array( + array( + 'path' => '#/telemetry#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the StellarWP telemetry reports. The brute-force network and licensing keep working.', 'robotstxt-telemetry' ), ), - 'breeze' => array( - 'matchers' => array( array( 'host' => 'sitecheck.sucuri.net', 'do' => 'strip_headers', 'headers' => array( 'referer' ) ) ), + 'breeze' => array( + 'matchers' => array( + array( + 'host' => 'sitecheck.sucuri.net', + 'do' => 'strip_headers', + 'headers' => array( 'referer' ), + ), + ), 'note' => __( 'Removes the Referer header (your site URL) from the Sucuri site-check requests. The scan itself keeps working.', 'robotstxt-telemetry' ), ), - 'broken-link-checker' => array( + 'broken-link-checker' => array( 'matchers' => $wpmudev, 'note' => __( 'Removes the WordPress version, home URL, plugin and theme lists from the WPMU DEV Hub payloads, and the site URL from the User-Agent. The Hub connection keeps the domain as the account identifier.', 'robotstxt-telemetry' ), ), - 'broken-link-checker-seo' => array( - 'matchers' => array( array( 'host_contains' => 'aioseo', 'do' => 'strip_ua' ) ), + 'broken-link-checker-seo' => array( + 'matchers' => array( + array( + 'host_contains' => 'aioseo', + 'do' => 'strip_ua', + ), + ), 'note' => __( 'Removes the WordPress version and site URL from the API User-Agent. Link analysis keeps working.', 'robotstxt-telemetry' ), ), - 'burst-statistics' => array( - 'matchers' => array( array( 'host' => 'api.burst-statistics.com', 'path' => '#/telemetry#i', 'do' => 'block' ) ), + 'burst-statistics' => array( + 'matchers' => array( + array( + 'host' => 'api.burst-statistics.com', + 'path' => '#/telemetry#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the aggregated statistics telemetry. License checks keep sending the site URL as the account identifier.', 'robotstxt-telemetry' ), ), - 'call-now-button' => array( - 'matchers' => array( array( 'host_contains' => 'callnowbutton', 'do' => 'strip_ua' ) ), + 'call-now-button' => array( + 'matchers' => array( + array( + 'host_contains' => 'callnowbutton', + 'do' => 'strip_ua', + ), + ), 'note' => __( 'Removes the WordPress version, PHP version and site URL from the API User-Agent. All button features keep working.', 'robotstxt-telemetry' ), ), - 'cartflows' => array( - 'matchers' => array( array( 'host_contains' => 'cartflows', 'path' => '#nps|survey#i', 'do' => 'block' ) ), + 'cartflows' => array( + 'matchers' => array( + array( + 'host_contains' => 'cartflows', + 'path' => '#nps|survey#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the NPS survey requests that automatically attach the admin name and email. Template downloads keep working.', 'robotstxt-telemetry' ), ), - 'chaty' => array( - 'matchers' => array( array( 'host_contains' => 'premioapps', 'do' => 'block' ) ), + 'chaty' => array( + 'matchers' => array( + array( + 'host_contains' => 'premioapps', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the feedback and support pings that send the site URL. The chat channels keep working.', 'robotstxt-telemetry' ), ), - 'click-to-chat-for-whatsapp' => array( - 'matchers' => array( array( 'host_contains' => 'holithemes', 'path' => '#feedback|deactivat#i', 'do' => 'block' ) ), + 'click-to-chat-for-whatsapp' => array( + 'matchers' => array( + array( + 'host_contains' => 'holithemes', + 'path' => '#feedback|deactivat#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the deactivation feedback (WordPress version, PHP version, site URL, language, theme, plugin list, server software). Chat widgets keep working.', 'robotstxt-telemetry' ), ), - 'code-snippets' => array( - 'matchers' => array( array( 'host_contains' => 'codesnippets', 'do' => 'strip_query', 'keys' => array( 'site_host' ) ) ), + 'code-snippets' => array( + 'matchers' => array( + array( + 'host_contains' => 'codesnippets', + 'do' => 'strip_query', + 'keys' => array( 'site_host' ), + ), + ), 'note' => __( 'Removes the site host from the cloud search queries. Cloud search keeps working with the account token.', 'robotstxt-telemetry' ), ), - 'coming-soon' => array( - 'matchers' => array( array( 'host_contains' => 'seedprod', 'do' => 'strip_body', 'keys' => array( 'wp_version' ) ) ), + 'coming-soon' => array( + 'matchers' => array( + array( + 'host_contains' => 'seedprod', + 'do' => 'strip_body', + 'keys' => array( 'wp_version' ), + ), + ), 'note' => __( 'Removes the WordPress version from the license requests. The license key, site URL (account identifier) and installed version (needed for updates) are kept.', 'robotstxt-telemetry' ), ), - 'contact-form-7-honeypot' => array( + 'contact-form-7-honeypot' => array( 'matchers' => $freemius, 'note' => __( 'Blocks the Freemius analytics events (plugin and theme lists, versions, site URL, language). License activation keeps working.', 'robotstxt-telemetry' ), ), - 'cookie-law-info' => array( - 'matchers' => array( array( 'host_contains' => 'webtoffe', 'path' => '#feedback#i', 'do' => 'block' ) ), + 'cookie-law-info' => array( + 'matchers' => array( + array( + 'host_contains' => 'webtoffe', + 'path' => '#feedback#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the uninstall feedback (MySQL, WordPress and WooCommerce versions, locale, multisite flag). The cookie scanner keeps sending the scanned URLs because that is its function.', 'robotstxt-telemetry' ), ), - 'cookie-notice' => array( - 'matchers' => array( array( 'host' => 'hu-manity.co', 'path' => '#feedback|deactivat#i', 'do' => 'block' ) ), + 'cookie-notice' => array( + 'matchers' => array( + array( + 'host' => 'hu-manity.co', + 'path' => '#feedback|deactivat#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the deactivation feedback that sends the site URL. The notice and the account service keep working.', 'robotstxt-telemetry' ), ), - 'copy-delete-posts' => array( - 'matchers' => array( array( 'host' => 'feedback.sellcodes.com', 'do' => 'block' ) ), + 'copy-delete-posts' => array( + 'matchers' => array( + array( + 'host' => 'feedback.sellcodes.com', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the usage tracker (WordPress version, PHP version, server IP, MySQL version, locale, plugin list). Post duplication is fully local.', 'robotstxt-telemetry' ), ), - 'creame-whatsapp-me' => array( - 'matchers' => array( array( 'host_contains' => 'connectif', 'do' => 'strip_body', 'keys' => array( 'site', 'lang' ) ) ), + 'creame-whatsapp-me' => array( + 'matchers' => array( + array( + 'host_contains' => 'connectif', + 'do' => 'strip_body', + 'keys' => array( 'site', 'lang' ), + ), + ), 'note' => __( 'Removes the site URL and language from the newsletter subscribe. The admin-entered email is kept (it is an explicit subscription).', 'robotstxt-telemetry' ), ), - 'custom-fonts' => array( + 'custom-fonts' => array( 'matchers' => $bsf, 'note' => __( 'Blocks the BSF analytics report (site URL, WordPress/PHP/MySQL versions, user count, language, timezone, plugin list, server software). Font uploads are unaffected.', 'robotstxt-telemetry' ), ), - 'disable-comments' => array( + 'disable-comments' => array( 'matchers' => array( - array( 'host' => 'send.wpinsight.com', 'do' => 'block' ), - array( 'host' => 'ip-api.com', 'do' => 'block' ), + array( + 'host' => 'send.wpinsight.com', + 'do' => 'block', + ), + array( + 'host' => 'ip-api.com', + 'do' => 'block', + ), ), 'note' => __( 'Blocks the usage tracker and its country lookup (site URL, plugin slug, server IP). Comment disabling is fully local.', 'robotstxt-telemetry' ), ), - 'easy-wp-smtp' => array( - 'matchers' => array( array( 'host' => 'tools.keycdn.com', 'do' => 'strip_ua' ) ), + 'easy-wp-smtp' => array( + 'matchers' => array( + array( + 'host' => 'tools.keycdn.com', + 'do' => 'strip_ua', + ), + ), 'note' => __( 'Removes the site URL from the geo-lookup User-Agent. Mail delivery keeps working with your mailer credentials only.', 'robotstxt-telemetry' ), ), - 'elementor' => array( - 'matchers' => array( array( 'host_contains' => 'elementor.com', 'path' => '#feedback#i', 'do' => 'strip_body', 'keys' => array( 'site_lang', 'api_version' ) ) ), + 'elementor' => array( + 'matchers' => array( + array( + 'host_contains' => 'elementor.com', + 'path' => '#feedback#i', + 'do' => 'strip_body', + 'keys' => array( 'site_lang', 'api_version' ), + ), + ), 'note' => __( 'Removes the language and API version from the feedback surveys. The template library and the connect flow (site URL as account identifier) are untouched.', 'robotstxt-telemetry' ), ), - 'elementskit-lite' => array( - 'matchers' => array( array( 'host_contains' => 'wpmet', 'path' => '#unsubscribe#i', 'do' => 'strip_body', 'keys' => array( 'wp_version', 'php_version', 'site_url' ) ) ), + 'elementskit-lite' => array( + 'matchers' => array( + array( + 'host_contains' => 'wpmet', + 'path' => '#unsubscribe#i', + 'do' => 'strip_body', + 'keys' => array( 'wp_version', 'php_version', 'site_url' ), + ), + ), 'note' => __( 'Removes the WordPress version, PHP version and site URL from the unsubscribe feedback. Widgets and modules are unaffected.', 'robotstxt-telemetry' ), ), - 'enable-media-replace' => array( - 'matchers' => array( array( 'host_contains' => 'shortpixel', 'do' => 'strip_body', 'keys' => array( 'DomainCheck', 'Info' ) ) ), + 'enable-media-replace' => array( + 'matchers' => array( + array( + 'host_contains' => 'shortpixel', + 'do' => 'strip_body', + 'keys' => array( 'DomainCheck', 'Info' ), + ), + ), 'note' => __( 'Removes the site URL and the WordPress/PHP version block from the ShortPixel key check. The API key alone is enough to validate the account.', 'robotstxt-telemetry' ), ), 'essential-addons-for-elementor-lite' => array( - 'matchers' => array( array( 'host_contains' => 'wpdeveloper', 'path' => '#track#i', 'do' => 'block' ) ), + 'matchers' => array( + array( + 'host_contains' => 'wpdeveloper', + 'path' => '#track#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the usage tracker (site URL, site name, WordPress version, language, PHP version, admin email). Elements and templates keep working.', 'robotstxt-telemetry' ), ), - 'ewww-image-optimizer' => array( - 'matchers' => array( array( 'host' => 'stats.exactlywww.net', 'do' => 'block' ) ), + 'ewww-image-optimizer' => array( + 'matchers' => array( + array( + 'host' => 'stats.exactlywww.net', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the weekly check-in (plugin list, locale, WordPress version, OS, limits, image counts). Local and cloud optimization keep working.', 'robotstxt-telemetry' ), ), - 'extendify' => array( + 'extendify' => array( 'matchers' => array( - array( 'host_contains' => 'extendify', 'do' => 'strip_body', 'keys' => array( 'wpVersion', 'wpLanguage', 'title', 'siteProfile' ) ), - array( 'host_contains' => 'extendify', 'do' => 'strip_headers', 'headers' => array( 'referer' ) ), + array( + 'host_contains' => 'extendify', + 'do' => 'strip_body', + 'keys' => array( 'wpVersion', 'wpLanguage', 'title', 'siteProfile' ), + ), + array( + 'host_contains' => 'extendify', + 'do' => 'strip_headers', + 'headers' => array( 'referer' ), + ), ), 'note' => __( 'Removes the WordPress version, language, site title, site profile and Referer header from the AI requests. The AI assistance keeps working with the prompt content only.', 'robotstxt-telemetry' ), ), - 'fluentform' => array( - 'matchers' => array( array( 'host_contains' => 'fluentforms', 'path' => '#track#i', 'do' => 'block' ) ), + 'fluentform' => array( + 'matchers' => array( + array( + 'host_contains' => 'fluentforms', + 'path' => '#track#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the tracker (WordPress version, PHP version, MySQL version, server software, plugin list, admin email, IP). Form integrations keep working.', 'robotstxt-telemetry' ), ), - 'fluent-smtp' => array( - 'matchers' => array( array( 'host_contains' => 'fluentsmtp.com', 'path' => '#push|notify#i', 'do' => 'block' ) ), + 'fluent-smtp' => array( + 'matchers' => array( + array( + 'host_contains' => 'fluentsmtp.com', + 'path' => '#push|notify#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the opt-in ping and the failed-mail notifications (which include email metadata). Mail delivery keeps working with your mailer credentials only.', 'robotstxt-telemetry' ), ), - 'formidable' => array( - 'matchers' => array( array( 'host' => 'usage2.formidableforms.com', 'do' => 'block' ) ), + 'formidable' => array( + 'matchers' => array( + array( + 'host' => 'usage2.formidableforms.com', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the usage snapshot (UUID, WordPress/PHP/MySQL versions, OS, locale, plugin list, form counts) and the onboarding email collection. Forms keep working.', 'robotstxt-telemetry' ), ), - 'forminator' => array( + 'forminator' => array( 'matchers' => $wpmudev, 'note' => __( 'Removes the WordPress version, home URL, plugin and theme lists from the WPMU DEV Hub payloads, and the site URL from the User-Agent. The domain is kept as the account identifier.', 'robotstxt-telemetry' ), ), - 'google-analytics-dashboard-for-wp' => array( - 'matchers' => array( array( 'host_contains' => 'miusage', 'do' => 'block' ) ), + 'google-analytics-dashboard-for-wp' => array( + 'matchers' => array( + array( + 'host_contains' => 'miusage', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the check-in (plugin list, locale, home URL). Your Google Analytics measurement keeps working.', 'robotstxt-telemetry' ), ), - 'google-analytics-for-wordpress' => array( - 'matchers' => array( array( 'host_contains' => 'miusage', 'do' => 'block' ) ), + 'google-analytics-for-wordpress' => array( + 'matchers' => array( + array( + 'host_contains' => 'miusage', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the check-in (plugin list, locale, home URL). Your Google Analytics measurement keeps working.', 'robotstxt-telemetry' ), ), - 'google-site-kit' => array( - 'matchers' => array( array( 'host_contains' => 'withgoogle', 'do' => 'strip_body', 'keys' => array( 'platform_version', 'php_version', 'user_count' ) ) ), + 'google-site-kit' => array( + 'matchers' => array( + array( + 'host_contains' => 'withgoogle', + 'do' => 'strip_body', + 'keys' => array( 'platform_version', 'php_version', 'user_count' ), + ), + ), 'note' => __( 'Removes the WordPress version, PHP version and user count from the Site Kit feature reports. Search Console, Analytics and AdSense integrations keep working.', 'robotstxt-telemetry' ), ), - 'google-sitemap-generator' => array( + 'google-sitemap-generator' => array( 'matchers' => array( - array( 'host' => 'ssl.google-analytics.com', 'do' => 'block' ), - array( 'host_contains' => 'auctollo', 'do' => 'block' ), + array( + 'host' => 'ssl.google-analytics.com', + 'do' => 'block', + ), + array( + 'host_contains' => 'auctollo', + 'do' => 'block', + ), ), 'note' => __( 'Blocks the Google Analytics usage ping and the beta-consent ping (WordPress version, PHP version, post count, email, domain, language). Search-engine pings keep working.', 'robotstxt-telemetry' ), ), - 'happy-elementor-addons' => array( - 'matchers' => array( array( 'host' => 'api.appsero.com', 'path' => '#insights|stats#i', 'do' => 'block' ) ), + 'happy-elementor-addons' => array( + 'matchers' => array( + array( + 'host' => 'api.appsero.com', + 'path' => '#insights|stats#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the Appsero insights (site URL, PHP version, MySQL, server software, WordPress version). License and update checks keep working.', 'robotstxt-telemetry' ), ), - 'header-footer-elementor' => array( + 'header-footer-elementor' => array( 'matchers' => $bsf, 'note' => __( 'Blocks the BSF analytics report (site URL, PHP/WordPress versions, network URL, plugin list). Header and footer builder keep working.', 'robotstxt-telemetry' ), ), - 'hostinger' => array( - 'matchers' => array( array( 'host_contains' => 'hostinger.io', 'path' => '#events#i', 'do' => 'block' ) ), + 'hostinger' => array( + 'matchers' => array( + array( + 'host_contains' => 'hostinger.io', + 'path' => '#events#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the event reporting that sends your domain. Hosting management actions keep working with your token.', 'robotstxt-telemetry' ), ), - 'imagify' => array( + 'imagify' => array( 'matchers' => $mixpanel, 'note' => __( 'Blocks the Mixpanel telemetry events (which include the WordPress version). Image optimization keeps working with your API key.', 'robotstxt-telemetry' ), ), - 'image-optimization' => array( - 'matchers' => array( array( 'host_contains' => 'elementor.com', 'path' => '#notifications#i', 'do' => 'strip_body', 'keys' => array( 'site_lang' ) ) ), + 'image-optimization' => array( + 'matchers' => array( + array( + 'host_contains' => 'elementor.com', + 'path' => '#notifications#i', + 'do' => 'strip_body', + 'keys' => array( 'site_lang' ), + ), + ), 'note' => __( 'Removes the language from the notifications requests. Image optimization and connect keep working.', 'robotstxt-telemetry' ), ), - 'instagram-feed' => array( + 'instagram-feed' => array( 'matchers' => array( - array( 'host_contains' => 'smashballoon', 'path' => '#usage|checkin#i', 'do' => 'block' ), - array( 'host_contains' => 'sbswapi', 'path' => '#usage|checkin#i', 'do' => 'block' ), + array( + 'host_contains' => 'smashballoon', + 'path' => '#usage|checkin#i', + 'do' => 'block', + ), + array( + 'host_contains' => 'sbswapi', + 'path' => '#usage|checkin#i', + 'do' => 'block', + ), ), 'note' => __( 'Blocks the usage check-in (environment payload with a site-URL User-Agent). Feeds keep working with your access tokens.', 'robotstxt-telemetry' ), ), - 'jeg-elementor-kit' => array( + 'jeg-elementor-kit' => array( 'matchers' => array_merge( $freemius, - array( array( 'host_contains' => 'jegtheme', 'path' => '#newsletter#i', 'do' => 'strip_body', 'keys' => array( 'domain' ) ) ) + array( + array( + 'host_contains' => 'jegtheme', + 'path' => '#newsletter#i', + 'do' => 'strip_body', + 'keys' => array( 'domain' ), + ), + ) ), 'note' => __( 'Blocks the Freemius analytics events and removes the domain from the newsletter subscribe. Templates and elements keep working.', 'robotstxt-telemetry' ), ), - 'kadence-blocks' => array( - 'matchers' => array( array( 'path' => '#/telemetry#i', 'do' => 'block' ) ), + 'kadence-blocks' => array( + 'matchers' => array( + array( + 'path' => '#/telemetry#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the StellarWP telemetry reports. Blocks, AI features and the template library keep working.', 'robotstxt-telemetry' ), ), - 'mailchimp-for-woocommerce' => array( - 'matchers' => array( array( 'host' => 'tower.vextras.com', 'do' => 'block' ) ), + 'mailchimp-for-woocommerce' => array( + 'matchers' => array( + array( + 'host' => 'tower.vextras.com', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the support ping and wizard reporting (store name, domain, list data). Order and subscriber synchronization keep working.', 'robotstxt-telemetry' ), ), - 'mailpoet' => array( - 'matchers' => array( array( 'host' => 'public-api.wordpress.com', 'path' => '#/tracks/#i', 'do' => 'block' ) ), + 'mailpoet' => array( + 'matchers' => array( + array( + 'host' => 'public-api.wordpress.com', + 'path' => '#/tracks/#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the Tracks analytics worker. Newsletter sending and subscribers keep working.', 'robotstxt-telemetry' ), ), - 'meta-box' => array( + 'meta-box' => array( 'matchers' => array( - array( 'host' => 'metabox.io', 'do' => 'strip_query', 'keys' => array( 'wp_version', 'php_version', 'language' ) ), + array( + 'host' => 'metabox.io', + 'do' => 'strip_query', + 'keys' => array( 'wp_version', 'php_version', 'language' ), + ), ), 'note' => __( 'Removes the WordPress version, PHP version and language from the updater requests. The license key and site URL (account identifier) are kept.', 'robotstxt-telemetry' ), ), - 'metform' => array( - 'matchers' => array( array( 'host' => 'api.wpmet.com', 'path' => '#/public/#i', 'do' => 'block' ) ), + 'metform' => array( + 'matchers' => array( + array( + 'host' => 'api.wpmet.com', + 'path' => '#/public/#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the onboarding data sender (plugin and theme lists). Form integrations keep working.', 'robotstxt-telemetry' ), ), - 'nextgen-gallery' => array( - 'matchers' => array( array( 'host' => 'evusage.enviragallery.com', 'do' => 'block' ) ), + 'nextgen-gallery' => array( + 'matchers' => array( + array( + 'host' => 'evusage.enviragallery.com', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the usage tracking (PHP version, WordPress version, server software, home URL, theme, admin email, settings). Galleries keep working.', 'robotstxt-telemetry' ), ), - 'ninja-forms' => array( - 'matchers' => array( array( 'host_contains' => 'ninjaforms', 'do' => 'strip_body', 'keys' => array( 'site_data', 'nf_be_data' ) ) ), + 'ninja-forms' => array( + 'matchers' => array( + array( + 'host_contains' => 'ninjaforms', + 'do' => 'strip_body', + 'keys' => array( 'site_data', 'nf_be_data' ), + ), + ), 'note' => __( 'Removes the site data block (site URL and server IP) from the dispatcher requests. Forms and add-on services keep working.', 'robotstxt-telemetry' ), ), - 'ocean-extra' => array( + 'ocean-extra' => array( 'matchers' => $freemius, 'note' => __( 'Blocks the Freemius analytics events (plugin and theme lists, versions, site URL, language). Demos and license activation keep working.', 'robotstxt-telemetry' ), ), - 'otter-blocks' => array( + 'otter-blocks' => array( 'matchers' => $isle, 'note' => __( 'Blocks the Themeisle tracker and SDK logger (theme, plugin list, WordPress version). Blocks keep working.', 'robotstxt-telemetry' ), ), - 'password-protected' => array( + 'password-protected' => array( 'matchers' => $freemius, 'note' => __( 'Blocks the Freemius analytics events (plugin and theme lists, versions, site URL, language). Password protection is fully local.', 'robotstxt-telemetry' ), ), - 'pdf-embedder' => array( - 'matchers' => array( array( 'host_contains' => 'wpauthusagetracking', 'do' => 'block' ) ), + 'pdf-embedder' => array( + 'matchers' => array( + array( + 'host_contains' => 'wpauthusagetracking', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the weekly usage report (home URL, PHP/WordPress/MySQL versions, server software, multisite, plugin list, theme, locale, license, settings). PDF embedding keeps working.', 'robotstxt-telemetry' ), ), - 'pojo-accessibility' => array( - 'matchers' => array( array( 'host_contains' => 'elementor.com', 'path' => '#notifications#i', 'do' => 'strip_body', 'keys' => array( 'site_lang' ) ) ), + 'pojo-accessibility' => array( + 'matchers' => array( + array( + 'host_contains' => 'elementor.com', + 'path' => '#notifications#i', + 'do' => 'strip_body', + 'keys' => array( 'site_lang' ), + ), + ), 'note' => __( 'Removes the language from the notifications requests. All accessibility widgets keep working.', 'robotstxt-telemetry' ), ), - 'polylang' => array( + 'polylang' => array( 'matchers' => array( - array( 'host_contains' => 'polylang', 'do' => 'strip_body', 'keys' => array( 'php_version', 'language', 'locale' ) ), - array( 'host_contains' => 'polylang', 'do' => 'strip_query', 'keys' => array( 'php_version', 'language', 'locale' ) ), + array( + 'host_contains' => 'polylang', + 'do' => 'strip_body', + 'keys' => array( 'php_version', 'language', 'locale' ), + ), + array( + 'host_contains' => 'polylang', + 'do' => 'strip_query', + 'keys' => array( 'php_version', 'language', 'locale' ), + ), ), 'note' => __( 'Removes the PHP version and language from the Pro updater requests. The WordPress version, license and site URL (account identifier) are kept so updates keep working.', 'robotstxt-telemetry' ), ), - 'popup-maker' => array( + 'popup-maker' => array( 'matchers' => array( - array( 'host_contains' => 'wppopupmaker', 'path' => '#telemetry#i', 'do' => 'block' ), - array( 'host_contains' => 'wppopupmaker', 'do' => 'strip_body', 'keys' => array( 'phpversion', 'php_version' ) ), - array( 'host' => 'ssl.google-analytics.com', 'do' => 'block' ), + array( + 'host_contains' => 'wppopupmaker', + 'path' => '#telemetry#i', + 'do' => 'block', + ), + array( + 'host_contains' => 'wppopupmaker', + 'do' => 'strip_body', + 'keys' => array( 'phpversion', 'php_version' ), + ), + array( + 'host' => 'ssl.google-analytics.com', + 'do' => 'block', + ), ), 'note' => __( 'Blocks the telemetry check-in and the Google Analytics usage events, and removes the PHP version from the extension updater requests. Popups keep working.', 'robotstxt-telemetry' ), ), - 'post-smtp' => array( + 'post-smtp' => array( 'matchers' => array_merge( $freemius, - array( array( 'host_contains' => 'postmansmtp', 'do' => 'strip_body', 'keys' => array( 'site_url' ) ) ) + array( + array( + 'host_contains' => 'postmansmtp', + 'do' => 'strip_body', + 'keys' => array( 'site_url' ), + ), + ) ), 'note' => __( 'Blocks the Freemius analytics events and removes the site URL from the notification requests. Mail delivery keeps working.', 'robotstxt-telemetry' ), ), - 'premium-addons-for-elementor' => array( + 'premium-addons-for-elementor' => array( 'matchers' => array( - array( 'host' => 'feedbackpa.leap13.com', 'do' => 'block' ), - array( 'host_contains' => 'premiumaddons', 'path' => '#install|uninstall#i', 'do' => 'block' ), + array( + 'host' => 'feedbackpa.leap13.com', + 'do' => 'block', + ), + array( + 'host_contains' => 'premiumaddons', + 'path' => '#install|uninstall#i', + 'do' => 'block', + ), ), 'note' => __( 'Blocks the feedback and install pings (locale, theme and plugin lists, site domain, memory limit, execution time, used widgets). All addons keep working.', 'robotstxt-telemetry' ), ), - 'really-simple-ssl' => array( - 'matchers' => array( array( 'host_contains' => 'reallysimplessl', 'path' => '#mailing#i', 'do' => 'block' ) ), + 'really-simple-ssl' => array( + 'matchers' => array( + array( + 'host_contains' => 'reallysimplessl', + 'path' => '#mailing#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the mailing-list subscribe (email, license, site URL). The vulnerability scan keeps sending your installed versions because checking them is its function.', 'robotstxt-telemetry' ), ), - 'redux-framework' => array( - 'matchers' => array( array( 'host' => 'redux.io', 'do' => 'strip_ua' ) ), + 'redux-framework' => array( + 'matchers' => array( + array( + 'host' => 'redux.io', + 'do' => 'strip_ua', + ), + ), 'note' => __( 'Removes the theme name from the font-converter User-Agent. Font conversion keeps working.', 'robotstxt-telemetry' ), ), - 'royal-elementor-addons' => array( + 'royal-elementor-addons' => array( 'matchers' => array_merge( $freemius, - array( array( 'host' => 'reastats.kinsta.cloud', 'do' => 'block' ) ) + array( + array( + 'host' => 'reastats.kinsta.cloud', + 'do' => 'block', + ), + ) ), 'note' => __( 'Blocks the Freemius analytics events and the usage events server. Templates and widgets keep working.', 'robotstxt-telemetry' ), ), - 'seo-by-rank-math' => array( + 'seo-by-rank-math' => array( 'matchers' => $mixpanel, 'note' => __( 'Blocks the Mixpanel telemetry. Content AI and module updates keep working.', 'robotstxt-telemetry' ), ), - 'sg-cachepress' => array( - 'matchers' => array( array( 'host' => 'wpreports.sgvps.net', 'path' => '#collect_plugin_data#i', 'do' => 'block' ) ), + 'sg-cachepress' => array( + 'matchers' => array( + array( + 'host' => 'wpreports.sgvps.net', + 'path' => '#collect_plugin_data#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the plugin-data telemetry (home URL, admin email, PHP version and limits, OS, WordPress version, user count, MySQL version, server software). Caching keeps working.', 'robotstxt-telemetry' ), ), - 'sg-security' => array( - 'matchers' => array( array( 'host' => 'wpreports.sgvps.net', 'path' => '#collect_plugin_data#i', 'do' => 'block' ) ), + 'sg-security' => array( + 'matchers' => array( + array( + 'host' => 'wpreports.sgvps.net', + 'path' => '#collect_plugin_data#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the plugin-data telemetry (home URL, admin email, PHP and WordPress versions, user count, MySQL version, server software). Security hardening keeps working.', 'robotstxt-telemetry' ), ), - 'shortcodes-ultimate' => array( + 'shortcodes-ultimate' => array( 'matchers' => $freemius, 'note' => __( 'Blocks the Freemius analytics events (plugin and theme lists, versions, site URL, language). Shortcodes are fully local.', 'robotstxt-telemetry' ), ), 'sticky-header-effects-for-elementor' => array( - 'matchers' => array( array( 'host' => 'api.posimyth.com', 'path' => '#/track#i', 'do' => 'block' ) ), + 'matchers' => array( + array( + 'host' => 'api.posimyth.com', + 'path' => '#/track#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the Posimyth tracker (site URL, PHP version, plugin slugs, theme, install time). Header effects keep working.', 'robotstxt-telemetry' ), ), - 'sucuri-scanner' => array( - 'matchers' => array( array( 'host' => 'wp-plugin.sucuri.net', 'do' => 'strip_query', 'keys' => array( 'php', 'php_version' ) ) ), + 'sucuri-scanner' => array( + 'matchers' => array( + array( + 'host' => 'wp-plugin.sucuri.net', + 'do' => 'strip_query', + 'keys' => array( 'php', 'php_version' ), + ), + ), 'note' => __( 'Removes the PHP version from the API lookups. The WordPress version and the plugin/theme versions are kept because the integrity checks are the service itself.', 'robotstxt-telemetry' ), ), - 'sureforms' => array( + 'sureforms' => array( 'matchers' => $bsf, 'note' => __( 'Blocks the BSF analytics report (domain, PHP OS, server software, MySQL/PHP versions, WordPress version). Forms and the AI builder keep working.', 'robotstxt-telemetry' ), ), - 'surerank' => array( + 'surerank' => array( 'matchers' => $bsf, 'note' => __( 'Blocks the BSF analytics report (domain, PHP OS, server software, MySQL/PHP versions, WordPress version). SEO analysis keeps working.', 'robotstxt-telemetry' ), ), - 'tablepress' => array( + 'tablepress' => array( 'matchers' => $freemius, 'note' => __( 'Blocks the Freemius analytics events (plugin and theme lists, versions, site URL, language). Tables are fully local.', 'robotstxt-telemetry' ), ), - 'templately' => array( - 'matchers' => array( array( 'host_contains' => 'templately', 'do' => 'strip_headers', 'headers' => array( 'x-templately-ip', 'x-templately-url', 'x-templately-version' ) ) ), + 'templately' => array( + 'matchers' => array( + array( + 'host_contains' => 'templately', + 'do' => 'strip_headers', + 'headers' => array( 'x-templately-ip', 'x-templately-url', 'x-templately-version' ), + ), + ), 'note' => __( 'Removes the server IP, site URL and version headers from every API request. Template downloads keep working with your token.', 'robotstxt-telemetry' ), ), - 'the-events-calendar' => array( + 'the-events-calendar' => array( 'matchers' => array( - array( 'path' => '#/telemetry#i', 'do' => 'block' ), - array( 'host_contains' => 'tri.be', 'do' => 'strip_body', 'keys' => array( 'wp_version', 'phpversion', 'php_version', 'user_count', 'users' ) ), + array( + 'path' => '#/telemetry#i', + 'do' => 'block', + ), + array( + 'host_contains' => 'tri.be', + 'do' => 'strip_body', + 'keys' => array( 'wp_version', 'phpversion', 'php_version', 'user_count', 'users' ), + ), ), 'note' => __( 'Blocks the StellarWP telemetry and removes the WordPress version, PHP version and user counts from the license/update validation. The domain is kept as the account identifier.', 'robotstxt-telemetry' ), ), - 'translatepress-multilingual' => array( - 'matchers' => array( array( 'host_contains' => 'translatepress', 'path' => '#sync#i', 'do' => 'block' ) ), + 'translatepress-multilingual' => array( + 'matchers' => array( + array( + 'host_contains' => 'translatepress', + 'path' => '#sync#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the weekly sync and the opt-in subscribe (home URL, email, name, plugin list, WordPress version, locale, PHP version). Translations keep working.', 'robotstxt-telemetry' ), ), - 'unlimited-elements-for-elementor' => array( + 'unlimited-elements-for-elementor' => array( 'matchers' => $freemius, 'note' => __( 'Blocks the Freemius analytics events (plugin and theme lists, versions, site URL, language). Widgets keep working.', 'robotstxt-telemetry' ), ), - 'updraftplus' => array( - 'matchers' => array( array( 'host' => 'ipinfo.io', 'do' => 'strip_headers', 'headers' => array( 'referer' ) ) ), + 'updraftplus' => array( + 'matchers' => array( + array( + 'host' => 'ipinfo.io', + 'do' => 'strip_headers', + 'headers' => array( 'referer' ), + ), + ), 'note' => __( 'Removes the Referer header (your network site URL) from the IP info lookups. Backups go to the destinations you configured.', 'robotstxt-telemetry' ), ), - 'w3-total-cache' => array( - 'matchers' => array( array( 'host' => 'api.w3-edge.com', 'path' => '#survey#i', 'do' => 'block' ) ), + 'w3-total-cache' => array( + 'matchers' => array( + array( + 'host' => 'api.w3-edge.com', + 'path' => '#survey#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the survey requests that include the home URL and email. CDN and cache configuration keep working.', 'robotstxt-telemetry' ), ), - 'woo-cart-abandonment-recovery' => array( + 'woo-cart-abandonment-recovery' => array( 'matchers' => $bsf, 'note' => __( 'Blocks the BSF analytics report (WordPress version, PHP version, locale, site URL). Cart tracking and webhooks keep working.', 'robotstxt-telemetry' ), ), - 'woo-checkout-field-editor-pro' => array( - 'matchers' => array( array( 'host' => 'feedback.themehigh.in', 'do' => 'block' ) ), + 'woo-checkout-field-editor-pro' => array( + 'matchers' => array( + array( + 'host' => 'feedback.themehigh.in', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the feedback requests (server software, PHP version, MySQL version, WordPress and WooCommerce versions, locale, multisite). Checkout fields keep working.', 'robotstxt-telemetry' ), ), - 'woocommerce' => array( - 'matchers' => array( array( 'host' => 'pixel.wp.com', 'path' => '#\.gif#i', 'do' => 'block' ) ), + 'woocommerce' => array( + 'matchers' => array( + array( + 'host' => 'pixel.wp.com', + 'path' => '#\.gif#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the WooCommerce.com Tracks pixel (usage analytics). Store functionality and woocommerce.com connections keep working.', 'robotstxt-telemetry' ), ), - 'woocommerce-payments' => array( - 'matchers' => array( array( 'host' => 'pixel.wp.com', 'path' => '#\.gif#i', 'do' => 'block' ) ), + 'woocommerce-payments' => array( + 'matchers' => array( + array( + 'host' => 'pixel.wp.com', + 'path' => '#\.gif#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the WooPay tracker pixel. Payments keep working.', 'robotstxt-telemetry' ), ), - 'woo-variation-swatches' => array( - 'matchers' => array( array( 'host_contains' => 'getwooplugins', 'path' => '#feedback#i', 'do' => 'block' ) ), + 'woo-variation-swatches' => array( + 'matchers' => array( + array( + 'host_contains' => 'getwooplugins', + 'path' => '#feedback#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the deactivation feedback (PHP version, WordPress version, server info, plugin list, theme, settings). Swatches keep working.', 'robotstxt-telemetry' ), ), - 'wp-file-manager' => array( + 'wp-file-manager' => array( 'matchers' => array( - array( 'host' => 'filemanagerpro.io', 'do' => 'strip_body', 'keys' => array( 'SITE_URL', 'PHP_version', 'wp_version', 'HTTP_USER_AGENT', 'PHP_ini_max_execution_time', 'PHP_ini_memory_limit', 'PHP_ini_post_max_size', 'PHP_ini_upload_max_filesize' ) ), + array( + 'host' => 'filemanagerpro.io', + 'do' => 'strip_body', + 'keys' => array( 'SITE_URL', 'PHP_version', 'wp_version', 'HTTP_USER_AGENT', 'PHP_ini_max_execution_time', 'PHP_ini_memory_limit', 'PHP_ini_post_max_size', 'PHP_ini_upload_max_filesize' ), + ), ), 'note' => __( 'Removes the site URL, PHP and WordPress versions, user agent and PHP limits from the plugin-server requests. File management keeps working.', 'robotstxt-telemetry' ), ), - 'wpforms-lite' => array( - 'matchers' => array( array( 'host' => 'wpformsusage.com', 'do' => 'block' ) ), + 'wpforms-lite' => array( + 'matchers' => array( + array( + 'host' => 'wpformsusage.com', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the usage tracking (home URL, PHP version, WordPress version, MySQL version, server, form and entry counts). Forms keep working.', 'robotstxt-telemetry' ), ), - 'wp-headers-and-footers' => array( - 'matchers' => array( array( 'host' => 'app.telemetry.wpbrigade.com', 'do' => 'block' ) ), + 'wp-headers-and-footers' => array( + 'matchers' => array( + array( + 'host' => 'app.telemetry.wpbrigade.com', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the WPBrigade telemetry (PHP version, WordPress version, server, MySQL version, locale, limits). Header and footer scripts keep working.', 'robotstxt-telemetry' ), ), - 'wp-mail-smtp' => array( - 'matchers' => array( array( 'host' => 'wpmailsmtpusage.com', 'do' => 'block' ) ), + 'wp-mail-smtp' => array( + 'matchers' => array( + array( + 'host' => 'wpmailsmtpusage.com', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the usage tracking (MySQL version, server software, locale, theme, site count, mailer configuration). Mail delivery keeps working.', 'robotstxt-telemetry' ), ), - 'wp-maintenance-mode' => array( + 'wp-maintenance-mode' => array( 'matchers' => $isle, 'note' => __( 'Blocks the Themeisle SDK logger (theme, plugin list, WordPress version). The maintenance page is fully local.', 'robotstxt-telemetry' ), ), - 'wp-optimize' => array( - 'matchers' => array( array( 'host_contains' => 'resmush.it', 'do' => 'strip_ua' ) ), + 'wp-optimize' => array( + 'matchers' => array( + array( + 'host_contains' => 'resmush.it', + 'do' => 'strip_ua', + ), + ), 'note' => __( 'Removes the WordPress version from the re-smush.it User-Agent. Image optimization keeps working.', 'robotstxt-telemetry' ), ), - 'wp-reset' => array( - 'matchers' => array( array( 'host_contains' => 'wp-reset', 'do' => 'strip_query', 'keys' => array( 'wp_version' ) ) ), + 'wp-reset' => array( + 'matchers' => array( + array( + 'host_contains' => 'wp-reset', + 'do' => 'strip_query', + 'keys' => array( 'wp_version' ), + ), + ), 'note' => __( 'Removes the WordPress version from the licensing requests. The license key and site URL (account identifier) are kept.', 'robotstxt-telemetry' ), ), - 'wp-reviews-plugin-for-google' => array( - 'matchers' => array( array( 'host_contains' => 'trustindex', 'do' => 'strip_body', 'keys' => array( 'wp_info' ) ) ), + 'wp-reviews-plugin-for-google' => array( + 'matchers' => array( + array( + 'host_contains' => 'trustindex', + 'do' => 'strip_body', + 'keys' => array( 'wp_info' ), + ), + ), 'note' => __( 'Removes the WordPress environment block (domain, theme and version, full theme and plugin lists) from the connect requests. Review widgets keep working.', 'robotstxt-telemetry' ), ), - 'wp-seopress' => array( - 'matchers' => array( array( 'host_contains' => 'seopress', 'do' => 'strip_headers', 'headers' => array( 'X-SEOPress-Locale', 'X-SEOPress-Version', 'X-SEOPress-Pro-Active' ) ) ), + 'wp-seopress' => array( + 'matchers' => array( + array( + 'host_contains' => 'seopress', + 'do' => 'strip_headers', + 'headers' => array( 'X-SEOPress-Locale', 'X-SEOPress-Version', 'X-SEOPress-Pro-Active' ), + ), + ), 'note' => __( 'Removes the locale and version headers from the promotions requests. SEO features and instant indexing keep working.', 'robotstxt-telemetry' ), ), - 'wp-smushit' => array( + 'wp-smushit' => array( 'matchers' => $wpmudev, 'note' => __( 'Removes the WordPress version, home URL, plugin and theme lists from the WPMU DEV Hub payloads, and the site URL from the User-Agent. Image compression keeps working.', 'robotstxt-telemetry' ), ), - 'wp-statistics' => array( - 'matchers' => array( array( 'host_contains' => 'wp-statistics', 'path' => '#usage#i', 'do' => 'block' ) ), + 'wp-statistics' => array( + 'matchers' => array( + array( + 'host_contains' => 'wp-statistics', + 'path' => '#usage#i', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the anonymized usage reports (database version and type, aggregate counts). Statistics collection stays local.', 'robotstxt-telemetry' ), ), - 'wp-whatsapp-chat' => array( - 'matchers' => array( array( 'host' => 'feedback.quadlayers.com', 'do' => 'block' ) ), + 'wp-whatsapp-chat' => array( + 'matchers' => array( + array( + 'host' => 'feedback.quadlayers.com', + 'do' => 'block', + ), + ), 'note' => __( 'Blocks the deactivation feedback (PHP/MySQL/WordPress versions, site URL, theme, plugin list, email). Chat widgets keep working.', 'robotstxt-telemetry' ), ), - 'yith-woocommerce-wishlist' => array( - 'matchers' => array( array( 'host_contains' => 'yithemes', 'do' => 'strip_query', 'keys' => array( 'lang' ) ) ), + 'yith-woocommerce-wishlist' => array( + 'matchers' => array( + array( + 'host_contains' => 'yithemes', + 'do' => 'strip_query', + 'keys' => array( 'lang' ), + ), + ), 'note' => __( 'Removes the language from the pricing lookups. The store currency is kept because prices depend on it.', 'robotstxt-telemetry' ), ), ); @@ -501,152 +972,176 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Plugin_Profiles' ) ) { /** * Plugin versions each Safe profile was verified against. * - * @return array Slug => version. + * @return array Slug => version. */ public static function tested_versions() { return array( - 'ad-inserter' => '2.8.18', - 'all-in-one-seo-pack' => '5.0.0.1', - 'all-in-one-wp-migration' => '7.109', - 'antispam-bee' => '2.11.12', - 'astra-sites' => '4.7.4', - 'autoptimize' => '3.1.15.1', - 'backwpup' => '5.7.5', - 'better-wp-security' => '10.0.3', - 'breeze' => '2.5.13', - 'broken-link-checker' => '2.4.13', - 'broken-link-checker-seo' => '1.3.0', - 'burst-statistics' => '3.6.2', - 'call-now-button' => '2.0.2', - 'cartflows' => '3.1.4', - 'chaty' => '3.6.0', - 'click-to-chat-for-whatsapp' => '4.43', - 'code-snippets' => '3.9.6', - 'coming-soon' => '6.20.8', - 'contact-form-7-honeypot' => '3.7.2', - 'cookie-law-info' => '3.5.4', - 'cookie-notice' => '3.1.6', - 'copy-delete-posts' => '1.5.6', - 'creame-whatsapp-me' => '6.3.2', - 'custom-fonts' => '2.1.17', - 'disable-comments' => '2.8.0', - 'easy-wp-smtp' => '2.15.1', - 'elementor' => '4.2.2', - 'elementskit-lite' => '4.0.1', - 'enable-media-replace' => '4.2.2', + 'ad-inserter' => '2.8.18', + 'all-in-one-seo-pack' => '5.0.0.1', + 'all-in-one-wp-migration' => '7.109', + 'antispam-bee' => '2.11.12', + 'astra-sites' => '4.7.4', + 'autoptimize' => '3.1.15.1', + 'backwpup' => '5.7.5', + 'better-wp-security' => '10.0.3', + 'breeze' => '2.5.13', + 'broken-link-checker' => '2.4.13', + 'broken-link-checker-seo' => '1.3.0', + 'burst-statistics' => '3.6.2', + 'call-now-button' => '2.0.2', + 'cartflows' => '3.1.4', + 'chaty' => '3.6.0', + 'click-to-chat-for-whatsapp' => '4.43', + 'code-snippets' => '3.9.6', + 'coming-soon' => '6.20.8', + 'contact-form-7-honeypot' => '3.7.2', + 'cookie-law-info' => '3.5.4', + 'cookie-notice' => '3.1.6', + 'copy-delete-posts' => '1.5.6', + 'creame-whatsapp-me' => '6.3.2', + 'custom-fonts' => '2.1.17', + 'disable-comments' => '2.8.0', + 'easy-wp-smtp' => '2.15.1', + 'elementor' => '4.2.2', + 'elementskit-lite' => '4.0.1', + 'enable-media-replace' => '4.2.2', 'essential-addons-for-elementor-lite' => '6.7.3', - 'ewww-image-optimizer' => '8.7.5', - 'extendify' => '3.1.4', - 'fluent-smtp' => '2.3.1', - 'fluentform' => '6.2.12', - 'formidable' => '6.34', - 'forminator' => '1.57.0', - 'google-analytics-dashboard-for-wp' => '10.1.2', - 'google-analytics-for-wordpress' => '11.1.2', - 'google-site-kit' => '1.185.0', - 'google-sitemap-generator' => '4.1.24', - 'happy-elementor-addons' => '3.23.1', - 'header-footer-elementor' => '2.9.3', - 'hostinger' => '3.0.75', - 'image-optimization' => '1.7.6', - 'imagify' => '2.3.2', - 'instagram-feed' => '6.12.0', - 'jeg-elementor-kit' => '3.2.13', - 'kadence-blocks' => '3.7.9.1', - 'mailchimp-for-woocommerce' => '6.2', - 'mailpoet' => '5.36.0', - 'meta-box' => '5.14.1', - 'metform' => '4.2.0', - 'nextgen-gallery' => '4.3.0', - 'ninja-forms' => '3.15.0', - 'ocean-extra' => '2.5.9', - 'otter-blocks' => '3.2.2', - 'password-protected' => '2.8.4', - 'pdf-embedder' => '5.0.2', - 'pojo-accessibility' => '4.1.3', - 'polylang' => '3.8.7', - 'popup-maker' => '1.24.0', - 'post-smtp' => '3.9.5', - 'premium-addons-for-elementor' => '4.11.98', - 'really-simple-ssl' => '9.7.0', - 'redux-framework' => '4.5.13', - 'royal-elementor-addons' => '1.7.1066', - 'seo-by-rank-math' => '1.0.276', - 'sg-cachepress' => '7.8.1', - 'sg-security' => '1.6.5', - 'shortcodes-ultimate' => '7.8.4', + 'ewww-image-optimizer' => '8.7.5', + 'extendify' => '3.1.4', + 'fluent-smtp' => '2.3.1', + 'fluentform' => '6.2.12', + 'formidable' => '6.34', + 'forminator' => '1.57.0', + 'google-analytics-dashboard-for-wp' => '10.1.2', + 'google-analytics-for-wordpress' => '11.1.2', + 'google-site-kit' => '1.185.0', + 'google-sitemap-generator' => '4.1.24', + 'happy-elementor-addons' => '3.23.1', + 'header-footer-elementor' => '2.9.3', + 'hostinger' => '3.0.75', + 'image-optimization' => '1.7.6', + 'imagify' => '2.3.2', + 'instagram-feed' => '6.12.0', + 'jeg-elementor-kit' => '3.2.13', + 'kadence-blocks' => '3.7.9.1', + 'mailchimp-for-woocommerce' => '6.2', + 'mailpoet' => '5.36.0', + 'meta-box' => '5.14.1', + 'metform' => '4.2.0', + 'nextgen-gallery' => '4.3.0', + 'ninja-forms' => '3.15.0', + 'ocean-extra' => '2.5.9', + 'otter-blocks' => '3.2.2', + 'password-protected' => '2.8.4', + 'pdf-embedder' => '5.0.2', + 'pojo-accessibility' => '4.1.3', + 'polylang' => '3.8.7', + 'popup-maker' => '1.24.0', + 'post-smtp' => '3.9.5', + 'premium-addons-for-elementor' => '4.11.98', + 'really-simple-ssl' => '9.7.0', + 'redux-framework' => '4.5.13', + 'royal-elementor-addons' => '1.7.1066', + 'seo-by-rank-math' => '1.0.276', + 'sg-cachepress' => '7.8.1', + 'sg-security' => '1.6.5', + 'shortcodes-ultimate' => '7.8.4', 'sticky-header-effects-for-elementor' => '2.2.1', - 'sucuri-scanner' => '2.7.4', - 'sureforms' => '2.12.3', - 'surerank' => '1.9.3', - 'tablepress' => '3.3.3', - 'templately' => '3.7.2', - 'the-events-calendar' => '6.17.2', - 'translatepress-multilingual' => '3.3.3', - 'unlimited-elements-for-elementor' => '2.0.16', - 'updraftplus' => '1.26.6', - 'w3-total-cache' => '2.10.5', - 'woo-cart-abandonment-recovery' => '2.1.3', - 'woo-checkout-field-editor-pro' => '2.1.9', - 'woo-variation-swatches' => '2.3.0', - 'woocommerce' => '11.0.1', - 'woocommerce-payments' => '11.0.0', - 'wp-file-manager' => '8.0.4', - 'wp-headers-and-footers' => '3.1.5', - 'wp-mail-smtp' => '4.9.0', - 'wp-maintenance-mode' => '2.6.23', - 'wp-optimize' => '4.6.1', - 'wp-reset' => '2.08', - 'wp-reviews-plugin-for-google' => '13.3.2', - 'wp-seopress' => '10.1', - 'wp-smushit' => '4.3.0', - 'wp-statistics' => '14.16.10', - 'wp-whatsapp-chat' => '8.6.1', - 'wpforms-lite' => '2.0.0.5', - 'yith-woocommerce-wishlist' => '4.17.0', + 'sucuri-scanner' => '2.7.4', + 'sureforms' => '2.12.3', + 'surerank' => '1.9.3', + 'tablepress' => '3.3.3', + 'templately' => '3.7.2', + 'the-events-calendar' => '6.17.2', + 'translatepress-multilingual' => '3.3.3', + 'unlimited-elements-for-elementor' => '2.0.16', + 'updraftplus' => '1.26.6', + 'w3-total-cache' => '2.10.5', + 'woo-cart-abandonment-recovery' => '2.1.3', + 'woo-checkout-field-editor-pro' => '2.1.9', + 'woo-variation-swatches' => '2.3.0', + 'woocommerce' => '11.0.1', + 'woocommerce-payments' => '11.0.0', + 'wp-file-manager' => '8.0.4', + 'wp-headers-and-footers' => '3.1.5', + 'wp-mail-smtp' => '4.9.0', + 'wp-maintenance-mode' => '2.6.23', + 'wp-optimize' => '4.6.1', + 'wp-reset' => '2.08', + 'wp-reviews-plugin-for-google' => '13.3.2', + 'wp-seopress' => '10.1', + 'wp-smushit' => '4.3.0', + 'wp-statistics' => '14.16.10', + 'wp-whatsapp-chat' => '8.6.1', + 'wpforms-lite' => '2.0.0.5', + 'yith-woocommerce-wishlist' => '4.17.0', ); } /** * Freemius SDK analytics matchers (license and updates untouched). * - * @return array + * @return array */ private static function freemius_matchers() { - return array( array( 'host' => 'api.freemius.com', 'path' => '#/events\.json#i', 'do' => 'block' ) ); + return array( + array( + 'host' => 'api.freemius.com', + 'path' => '#/events\.json#i', + 'do' => 'block', + ), + ); } /** * Brainstorm Force analytics matchers. * - * @return array + * @return array */ private static function bsf_matchers() { - return array( array( 'host' => 'store.brainstormforce.com', 'path' => '#usage-tracking#i', 'do' => 'block' ) ); + return array( + array( + 'host' => 'store.brainstormforce.com', + 'path' => '#usage-tracking#i', + 'do' => 'block', + ), + ); } /** * Themeisle tracker and logger matchers. * - * @return array + * @return array */ private static function themeisle_matchers() { - return array( array( 'host' => 'api.themeisle.com', 'path' => '#/tracking/#i', 'do' => 'block' ) ); + return array( + array( + 'host' => 'api.themeisle.com', + 'path' => '#/tracking/#i', + 'do' => 'block', + ), + ); } /** * Mixpanel telemetry matchers. * - * @return array + * @return array */ private static function mixpanel_matchers() { - return array( array( 'host' => 'api.mixpanel.com', 'do' => 'block', 'mock' => '1' ) ); + return array( + array( + 'host' => 'api.mixpanel.com', + 'do' => 'block', + 'mock' => '1', + ), + ); } /** * WPMU DEV Hub matchers (domain kept as account identifier). * - * @return array + * @return array */ private static function wpmudev_matchers() { return array( @@ -655,7 +1150,10 @@ if ( ! class_exists( 'Robotstxt_Telemetry_Plugin_Profiles' ) ) { 'do' => 'strip_body', 'keys' => array( 'wp_version', 'home_url', 'plugins', 'themes' ), ), - array( 'host_contains' => 'wpmudev', 'do' => 'strip_ua' ), + array( + 'host_contains' => 'wpmudev', + 'do' => 'strip_ua', + ), ); } } diff --git a/includes/class-robotstxt-telemetry-wordpress-api.php b/includes/class-robotstxt-telemetry-wordpress-api.php index 270e4ca..7baa1e4 100644 --- a/includes/class-robotstxt-telemetry-wordpress-api.php +++ b/includes/class-robotstxt-telemetry-wordpress-api.php @@ -42,6 +42,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_WordPress_Api' ) ) { /** * Register hooks. + * + * @return void */ public function register() { add_filter( 'core_version_check_query_args', array( $this, 'filter_core_query_args' ) ); @@ -51,8 +53,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_WordPress_Api' ) ) { /** * Limit the core version check query arguments in safe mode. * - * @param array $query Query arguments. - * @return array + * @param array $query Query arguments. + * @return array */ public function filter_core_query_args( $query ) { if ( ! $this->is_safe( self::OPT_CORE ) ) { @@ -74,9 +76,9 @@ if ( ! class_exists( 'Robotstxt_Telemetry_WordPress_Api' ) ) { /** * Filter update check request arguments. * - * @param array $args HTTP request arguments. - * @param string $url Request URL. - * @return array + * @param array $args HTTP request arguments. + * @param string $url Request URL. + * @return array */ public function filter_request_args( $args, $url ) { $parsed = wp_parse_url( $url ); @@ -115,17 +117,19 @@ if ( ! class_exists( 'Robotstxt_Telemetry_WordPress_Api' ) ) { * Removes the wp_install/wp_blog headers and reduces the translations * payload to its project dates. * - * @param array $args HTTP request arguments. - * @return array + * @param array $args HTTP request arguments. + * @return array */ private function filter_core_request( $args ) { if ( ! $this->is_safe( self::OPT_CORE ) ) { return $args; } - unset( $args['headers']['wp_install'], $args['headers']['wp_blog'] ); + if ( isset( $args['headers'] ) && is_array( $args['headers'] ) ) { + unset( $args['headers']['wp_install'], $args['headers']['wp_blog'] ); + } - if ( isset( $args['body']['translations'] ) && is_string( $args['body']['translations'] ) ) { + if ( isset( $args['body'] ) && is_array( $args['body'] ) && isset( $args['body']['translations'] ) && is_string( $args['body']['translations'] ) ) { $args['body']['translations'] = $this->filter_translations( $args['body']['translations'] ); } @@ -135,15 +139,15 @@ if ( ! class_exists( 'Robotstxt_Telemetry_WordPress_Api' ) ) { /** * Limit the themes update check payload in safe mode. * - * @param array $args HTTP request arguments. - * @return array + * @param array $args HTTP request arguments. + * @return array */ private function filter_themes_request( $args ) { if ( ! $this->is_safe( self::OPT_THEMES ) ) { return $args; } - if ( ! isset( $args['body']['themes'] ) || ! is_string( $args['body']['themes'] ) ) { + if ( ! isset( $args['body'] ) || ! is_array( $args['body'] ) || ! isset( $args['body']['themes'] ) || ! is_string( $args['body']['themes'] ) ) { return $args; } @@ -180,15 +184,15 @@ if ( ! class_exists( 'Robotstxt_Telemetry_WordPress_Api' ) ) { /** * Limit the plugins update check payload in safe mode. * - * @param array $args HTTP request arguments. - * @return array + * @param array $args HTTP request arguments. + * @return array */ private function filter_plugins_request( $args ) { if ( ! $this->is_safe( self::OPT_PLUGINS ) ) { return $args; } - if ( ! isset( $args['body']['plugins'] ) || ! is_string( $args['body']['plugins'] ) ) { + if ( ! isset( $args['body'] ) || ! is_array( $args['body'] ) || ! isset( $args['body']['plugins'] ) || ! is_string( $args['body']['plugins'] ) ) { return $args; } @@ -231,13 +235,13 @@ if ( ! class_exists( 'Robotstxt_Telemetry_WordPress_Api' ) ) { * the active list, nor their translation projects), which also * means they stop receiving WordPress.org update notifications. * - * @param array $args HTTP request arguments. - * @return array + * @param array $args HTTP request arguments. + * @return array */ private function exclude_hidden_plugins( $args ) { $hidden = Robotstxt_Telemetry_Network::get_hidden_plugins(); - if ( empty( $hidden ) || empty( $args['body']['plugins'] ) || ! is_string( $args['body']['plugins'] ) ) { + if ( empty( $hidden ) || ! isset( $args['body'] ) || ! is_array( $args['body'] ) || empty( $args['body']['plugins'] ) || ! is_string( $args['body']['plugins'] ) ) { return $args; } @@ -250,10 +254,16 @@ if ( ! class_exists( 'Robotstxt_Telemetry_WordPress_Api' ) ) { $hidden_slugs = array(); foreach ( $hidden as $basename ) { - $slug = dirname( $basename ); + $slug = dirname( $basename ); $hidden_slugs[ $slug ] = true; - unset( $data['plugins'][ $basename ], $data['active'][ $basename ] ); + if ( isset( $data['plugins'] ) && is_array( $data['plugins'] ) ) { + unset( $data['plugins'][ $basename ] ); + } + + if ( isset( $data['active'] ) && is_array( $data['active'] ) ) { + unset( $data['active'][ $basename ] ); + } } if ( isset( $args['body']['translations'] ) && is_string( $args['body']['translations'] ) ) { @@ -290,11 +300,11 @@ if ( ! class_exists( 'Robotstxt_Telemetry_WordPress_Api' ) ) { * Handles the JSON-encoded locale arrays of the update checks * (for example `["es_ES","en_US"]`) and plain locale strings. * - * @param array $args HTTP request arguments. - * @return array + * @param array $args HTTP request arguments. + * @return array */ private function mask_locale_in_body( $args ) { - if ( ! isset( $args['body']['locale'] ) || ! is_array( $args['body'] ) ) { + if ( ! isset( $args['body'] ) || ! is_array( $args['body'] ) || ! isset( $args['body']['locale'] ) ) { return $args; } @@ -324,13 +334,13 @@ if ( ! class_exists( 'Robotstxt_Telemetry_WordPress_Api' ) ) { /** * Read a string field from the request body arguments. * - * @param array $args HTTP request arguments. - * @param string $key Body field name. - * @param string $fallback_value Default value when missing. + * @param array $args HTTP request arguments. + * @param string $key Body field name. + * @param string $fallback_value Default value when missing. * @return string */ private function body_field( $args, $key, $fallback_value ) { - if ( isset( $args['body'][ $key ] ) && is_string( $args['body'][ $key ] ) ) { + if ( isset( $args['body'] ) && is_array( $args['body'] ) && isset( $args['body'][ $key ] ) && is_string( $args['body'][ $key ] ) ) { return $args['body'][ $key ]; } @@ -377,7 +387,13 @@ if ( ! class_exists( 'Robotstxt_Telemetry_WordPress_Api' ) ) { return $json; } - return wp_json_encode( $filtered ); + $encoded = wp_json_encode( $filtered ); + + if ( false === $encoded ) { + return $json; + } + + return $encoded; } /** @@ -385,9 +401,9 @@ if ( ! class_exists( 'Robotstxt_Telemetry_WordPress_Api' ) ) { * * Matching is case-insensitive; original keys are preserved. * - * @param array $fields Fields of the entry. - * @param array $allowed Lowercase allowed field names. - * @return array + * @param array $fields Fields of the entry. + * @param array $allowed Lowercase allowed field names. + * @return array */ private function keep_fields( $fields, $allowed ) { $kept = array(); @@ -409,8 +425,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry_WordPress_Api' ) ) { * SHA-256 truncation of the URI, so the plugin or theme source is * no longer identifiable while staying consistent across requests. * - * @param array $fields Fields of a plugin or theme entry. - * @return array + * @param array $fields Fields of a plugin or theme entry. + * @return array */ private function hash_update_uri( $fields ) { foreach ( $fields as $key => $value ) { diff --git a/includes/class-robotstxt-telemetry.php b/includes/class-robotstxt-telemetry.php index aabb162..e41f46e 100644 --- a/includes/class-robotstxt-telemetry.php +++ b/includes/class-robotstxt-telemetry.php @@ -17,6 +17,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry' ) ) { /** * Initialize the plugin. + * + * @return void */ public static function init() { $instance = new self(); @@ -25,6 +27,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry' ) ) { /** * Register hooks. + * + * @return void */ private function register_hooks() { add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) ); @@ -67,9 +71,9 @@ if ( ! class_exists( 'Robotstxt_Telemetry' ) ) { * Runs at priority 9 so the telemetry logger records the value that * is actually sent on the wire. * - * @param array $args HTTP request arguments. - * @param string $url Request URL. - * @return array + * @param array $args HTTP request arguments. + * @param string $url Request URL. + * @return array */ public function filter_useragent( $args, $url ) { // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter -- Second argument required by the http_request_args filter signature. $url_mode = Robotstxt_Telemetry_Network::get_useragent_url_mode(); @@ -85,9 +89,11 @@ if ( ! class_exists( 'Robotstxt_Telemetry' ) ) { $args['user-agent'] = $this->mask_user_agent( $args['user-agent'], $url_mode, $version_mode, $site_url ); } - foreach ( array( 'User-Agent', 'user-agent' ) as $header ) { - if ( isset( $args['headers'][ $header ] ) && is_string( $args['headers'][ $header ] ) ) { - $args['headers'][ $header ] = $this->mask_user_agent( $args['headers'][ $header ], $url_mode, $version_mode, $site_url ); + if ( isset( $args['headers'] ) && is_array( $args['headers'] ) ) { + foreach ( array( 'User-Agent', 'user-agent' ) as $header ) { + if ( isset( $args['headers'][ $header ] ) && is_string( $args['headers'][ $header ] ) ) { + $args['headers'][ $header ] = $this->mask_user_agent( $args['headers'][ $header ], $url_mode, $version_mode, $site_url ); + } } } @@ -128,11 +134,15 @@ if ( ! class_exists( 'Robotstxt_Telemetry' ) ) { $user_agent = trim( $user_agent ); if ( 'actual' !== $version_mode && preg_match( '#^WordPress/(\d+[^\s;]*)#', $user_agent, $matches ) ) { - $user_agent = preg_replace( + $masked = preg_replace( '#^WordPress/[^\s;]+#', 'WordPress/' . Robotstxt_Telemetry_Network::mask_wp_version( $matches[1], $version_mode ), $user_agent ); + + if ( null !== $masked ) { + $user_agent = $masked; + } } return $user_agent; @@ -142,6 +152,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry' ) ) { * * In global mode the shared table is cleaned from the main site * only, so subsites do not schedule the event. + * + * @return void */ public function schedule_cleanup() { if ( Robotstxt_Telemetry_Network::is_global() && ! is_main_site() ) { @@ -155,6 +167,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry' ) ) { /** * Deactivation handler: clear the scheduled cleanup event. + * + * @return void */ public static function deactivate() { wp_clear_scheduled_hook( 'robotstxt_telemetry_cleanup' ); @@ -170,6 +184,8 @@ if ( ! class_exists( 'Robotstxt_Telemetry' ) ) { /** * Load plugin translations. + * + * @return void */ public function load_textdomain() { load_plugin_textdomain( diff --git a/languages/robotstxt-telemetry.pot b/languages/robotstxt-telemetry.pot index 14b42e8..c2a8a7a 100644 --- a/languages/robotstxt-telemetry.pot +++ b/languages/robotstxt-telemetry.pot @@ -1,15 +1,15 @@ # Copyright (C) 2026 ROBOTSTXT -# This file is distributed under the GPL v3 or later. +# This file is distributed under the GPL-3.0-or-later. msgid "" msgstr "" -"Project-Id-Version: Telemetry disabler (by ROBOTSTXT) 1.1.1\n" +"Project-Id-Version: Telemetry disabler (by ROBOTSTXT) 1.1.4\n" "Report-Msgid-Bugs-To: https://www.robotstxt.software/plugins/robotstxt-telemetry/" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2026-08-18T18:58:34+00:00\n" +"POT-Creation-Date: 2026-08-20T13:48:18+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.12.0\n" "X-Domain: robotstxt-telemetry\n" @@ -39,384 +39,384 @@ msgstr "" msgid "https://www.robotstxt.software/" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:42 -#: includes/class-robotstxt-telemetry-admin.php:43 -#: includes/class-robotstxt-telemetry-admin.php:91 -#: includes/class-robotstxt-telemetry-admin.php:92 +#: includes/class-robotstxt-telemetry-admin.php:45 +#: includes/class-robotstxt-telemetry-admin.php:46 +#: includes/class-robotstxt-telemetry-admin.php:96 +#: includes/class-robotstxt-telemetry-admin.php:97 msgid "Telemetry" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:52 -#: includes/class-robotstxt-telemetry-admin.php:53 -#: includes/class-robotstxt-telemetry-admin.php:101 -#: includes/class-robotstxt-telemetry-admin.php:102 -#: includes/class-robotstxt-telemetry-admin.php:516 +#: includes/class-robotstxt-telemetry-admin.php:55 +#: includes/class-robotstxt-telemetry-admin.php:56 +#: includes/class-robotstxt-telemetry-admin.php:106 +#: includes/class-robotstxt-telemetry-admin.php:107 +#: includes/class-robotstxt-telemetry-admin.php:524 msgid "Settings" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:61 -#: includes/class-robotstxt-telemetry-admin.php:62 -#: includes/class-robotstxt-telemetry-admin.php:110 -#: includes/class-robotstxt-telemetry-admin.php:111 -#: includes/class-robotstxt-telemetry-admin.php:517 +#: includes/class-robotstxt-telemetry-admin.php:64 +#: includes/class-robotstxt-telemetry-admin.php:65 +#: includes/class-robotstxt-telemetry-admin.php:115 +#: includes/class-robotstxt-telemetry-admin.php:116 +#: includes/class-robotstxt-telemetry-admin.php:525 msgid "Plugins" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:70 -#: includes/class-robotstxt-telemetry-admin.php:71 -#: includes/class-robotstxt-telemetry-admin.php:120 -#: includes/class-robotstxt-telemetry-admin.php:121 -#: includes/class-robotstxt-telemetry-admin.php:518 +#: includes/class-robotstxt-telemetry-admin.php:73 +#: includes/class-robotstxt-telemetry-admin.php:74 +#: includes/class-robotstxt-telemetry-admin.php:125 +#: includes/class-robotstxt-telemetry-admin.php:126 +#: includes/class-robotstxt-telemetry-admin.php:526 msgid "Logs" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:425 +#: includes/class-robotstxt-telemetry-admin.php:430 msgid "Settings saved." msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:429 +#: includes/class-robotstxt-telemetry-admin.php:434 msgid "Configuration mode saved." msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:446 +#: includes/class-robotstxt-telemetry-admin.php:453 msgid "Telemetry Network Settings" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:457 -#: includes/class-robotstxt-telemetry-admin.php:460 +#: includes/class-robotstxt-telemetry-admin.php:464 +#: includes/class-robotstxt-telemetry-admin.php:467 msgid "Configuration mode" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:462 +#: includes/class-robotstxt-telemetry-admin.php:469 msgid "Per-site" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:464 +#: includes/class-robotstxt-telemetry-admin.php:471 msgid "Global" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:466 +#: includes/class-robotstxt-telemetry-admin.php:473 msgid "Per-site: every site keeps its own settings and its own log table, managed by each site administrator. Global: one shared configuration and one central log on the main site collect the outbound requests of the whole network; the Telemetry screens are then managed from here only." msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:472 +#: includes/class-robotstxt-telemetry-admin.php:479 msgid "Save configuration mode" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:477 +#: includes/class-robotstxt-telemetry-admin.php:484 msgid "Switch to Global mode to manage the settings and the logs for the whole network from this screen." msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:519 +#: includes/class-robotstxt-telemetry-admin.php:527 msgid "General" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:522 +#: includes/class-robotstxt-telemetry-admin.php:530 msgid "Settings sections" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:556 +#: includes/class-robotstxt-telemetry-admin.php:566 msgid "Telemetry Settings" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:591 -#: includes/class-robotstxt-telemetry-admin.php:594 +#: includes/class-robotstxt-telemetry-admin.php:605 +#: includes/class-robotstxt-telemetry-admin.php:608 msgid "Outbound requests" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:598 +#: includes/class-robotstxt-telemetry-admin.php:612 msgid "Send your URL" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:599 +#: includes/class-robotstxt-telemetry-admin.php:613 msgid "Send a hash" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:600 +#: includes/class-robotstxt-telemetry-admin.php:614 msgid "Do not send anything" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:608 +#: includes/class-robotstxt-telemetry-admin.php:622 msgid "Outbound requests normally identify this site in the User-Agent with its URL (for example \"WordPress/6.9; https://example.com/\"). \"Send a hash\" (default) replaces it with a fixed hash so the site is no longer identifiable; \"Do not send anything\" removes it completely." msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:616 -#: includes/class-robotstxt-telemetry-admin.php:619 +#: includes/class-robotstxt-telemetry-admin.php:630 +#: includes/class-robotstxt-telemetry-admin.php:633 msgid "WordPress version" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:623 -#: includes/class-robotstxt-telemetry-admin.php:802 +#: includes/class-robotstxt-telemetry-admin.php:637 +#: includes/class-robotstxt-telemetry-admin.php:818 msgid "Actual version" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:624 +#: includes/class-robotstxt-telemetry-admin.php:638 msgid "Major version" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:625 +#: includes/class-robotstxt-telemetry-admin.php:639 msgid "Nulled version" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:633 +#: includes/class-robotstxt-telemetry-admin.php:647 msgid "The version reported in the User-Agent and in the WordPress.org version fields: the actual version (default), the major version with the rest masked (for example \"7.2.n\"), or a nulled version (\"0.0.0\"). The checksum and translation requests always use the real version so updates keep working." msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:639 +#: includes/class-robotstxt-telemetry-admin.php:653 msgid "Installation language" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:643 +#: includes/class-robotstxt-telemetry-admin.php:657 msgid "Send en_US as the language of outbound requests" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:645 +#: includes/class-robotstxt-telemetry-admin.php:659 msgid "When enabled, requests to WordPress.org report English (United States) instead of the installation language. The translation endpoints keep using the real language so installed language packs keep receiving updates." msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:651 +#: includes/class-robotstxt-telemetry-admin.php:665 msgid "Replace the WordPress News feed" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:652 +#: includes/class-robotstxt-telemetry-admin.php:666 msgid "Use WordPress Planet by Fair (planet.fair.pm) instead of wordpress.org/news for the Events and News dashboard widget" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:655 +#: includes/class-robotstxt-telemetry-admin.php:669 msgid "Replace the WordPress Events service" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:656 +#: includes/class-robotstxt-telemetry-admin.php:670 msgid "Use WordPress Events by The WP World (api.fair.pm) instead of api.wordpress.org/events, sending the same request data" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:659 +#: includes/class-robotstxt-telemetry-admin.php:673 msgid "Disable the WordPress browser check" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:660 +#: includes/class-robotstxt-telemetry-admin.php:674 msgid "Do not send the browser version to api.wordpress.org/core/browse-happy; the browser is always reported as compatible" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:678 +#: includes/class-robotstxt-telemetry-admin.php:692 msgid "WordPress Core version check" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:679 +#: includes/class-robotstxt-telemetry-admin.php:693 msgid "Safe sends only the WordPress version, PHP version, locale, MySQL version, and update channel. Original also sends site counts, database history, PHP extensions, and platform details." msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:682 +#: includes/class-robotstxt-telemetry-admin.php:696 msgid "WordPress Themes version check" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:683 +#: includes/class-robotstxt-telemetry-admin.php:697 msgid "Safe sends only the theme name, version, update URI, template, and stylesheet, plus the translation revision date and site locale. Original also sends author details and other theme metadata." msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:686 +#: includes/class-robotstxt-telemetry-admin.php:700 msgid "WordPress Plugins version check" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:687 +#: includes/class-robotstxt-telemetry-admin.php:701 msgid "Safe sends only the plugin version, update URI, and requirements, plus the translation revision date, locale, and the \"all\" flag. Original also sends names, descriptions, authors, and other plugin metadata." msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:699 +#: includes/class-robotstxt-telemetry-admin.php:713 msgid "Original" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:701 +#: includes/class-robotstxt-telemetry-admin.php:715 msgid "Safe" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:718 -#: includes/class-robotstxt-telemetry-admin.php:720 +#: includes/class-robotstxt-telemetry-admin.php:732 +#: includes/class-robotstxt-telemetry-admin.php:734 msgid "Log retention" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:724 +#: includes/class-robotstxt-telemetry-admin.php:738 msgid "12 hours" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:725 +#: includes/class-robotstxt-telemetry-admin.php:739 msgid "1 day" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:726 +#: includes/class-robotstxt-telemetry-admin.php:740 msgid "3 days" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:739 +#: includes/class-robotstxt-telemetry-admin.php:753 msgid "Logs older than the selected period are deleted (12 hours by default). A maximum of 1000 entries is always kept; the cleanup runs when browsing the logs and twice a day automatically." msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:746 +#: includes/class-robotstxt-telemetry-admin.php:760 msgid "Uninstall behavior" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:750 +#: includes/class-robotstxt-telemetry-admin.php:764 msgid "Delete all telemetry logs and plugin options on uninstall" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:752 +#: includes/class-robotstxt-telemetry-admin.php:766 msgid "By default, all telemetry logs are preserved when the plugin is uninstalled." msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:789 +#: includes/class-robotstxt-telemetry-admin.php:805 msgid "Telemetry - Plugins" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:791 +#: includes/class-robotstxt-telemetry-admin.php:807 msgid "Plugin modes saved." msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:793 +#: includes/class-robotstxt-telemetry-admin.php:809 msgid "Every installed plugin with a known telemetry behavior is listed below. In Safe mode the known telemetry endpoints are blocked or reduced to the minimum data each service needs to work; in Original mode the plugin behaves exactly as it would without Telemetry disabler. The tested version is the plugin version the Safe profile was verified against." msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:800 +#: includes/class-robotstxt-telemetry-admin.php:816 msgid "Safe Mode" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:801 -#: includes/class-robotstxt-telemetry-admin.php:921 +#: includes/class-robotstxt-telemetry-admin.php:817 +#: includes/class-robotstxt-telemetry-admin.php:968 msgid "Plugin" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:803 +#: includes/class-robotstxt-telemetry-admin.php:819 msgid "Tested version" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:804 +#: includes/class-robotstxt-telemetry-admin.php:820 msgid "Description" msgstr "" #. translators: %s: Plugin name. -#: includes/class-robotstxt-telemetry-admin.php:819 -#: includes/class-robotstxt-telemetry-admin.php:820 +#: includes/class-robotstxt-telemetry-admin.php:835 +#: includes/class-robotstxt-telemetry-admin.php:836 #, php-format msgid "Safe Mode for %s" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:830 +#: includes/class-robotstxt-telemetry-admin.php:846 msgid "Save plugin modes" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:909 +#: includes/class-robotstxt-telemetry-admin.php:956 msgid "The plugins checked below are never sent to WordPress.org: they are excluded from the plugin update check (including their translations and the active list). That also means they will not receive update notifications from WordPress.org." msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:910 +#: includes/class-robotstxt-telemetry-admin.php:957 msgid "Recommendation: keep external or private plugins (those not hosted on WordPress.org) checked, since they do not receive WordPress.org updates anyway and nothing is gained by reporting them." msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:919 +#: includes/class-robotstxt-telemetry-admin.php:966 msgid "Hide from WordPress.org" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:920 +#: includes/class-robotstxt-telemetry-admin.php:967 msgid "Status" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:922 +#: includes/class-robotstxt-telemetry-admin.php:969 msgid "Version" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:943 +#: includes/class-robotstxt-telemetry-admin.php:990 msgid "Always hidden" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:943 +#: includes/class-robotstxt-telemetry-admin.php:990 msgid "Active" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:943 +#: includes/class-robotstxt-telemetry-admin.php:990 msgid "Inactive" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:974 +#: includes/class-robotstxt-telemetry-admin.php:1023 msgid "Telemetry Logs" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:994 +#: includes/class-robotstxt-telemetry-admin.php:1043 msgid "All log entries deleted." msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:996 +#: includes/class-robotstxt-telemetry-admin.php:1045 msgid "Log entry deleted." msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:1010 +#: includes/class-robotstxt-telemetry-admin.php:1059 msgid "Delete all logs" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:1028 +#: includes/class-robotstxt-telemetry-admin.php:1079 msgid "You are about to permanently delete all telemetry log entries. This action cannot be undone." msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:1036 +#: includes/class-robotstxt-telemetry-admin.php:1087 msgid "Yes, delete all logs" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:1037 +#: includes/class-robotstxt-telemetry-admin.php:1088 msgid "Cancel" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:1050 +#: includes/class-robotstxt-telemetry-admin.php:1102 msgid "Log entry not found." msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:1054 +#: includes/class-robotstxt-telemetry-admin.php:1106 msgid "Back to logs" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:1058 +#: includes/class-robotstxt-telemetry-admin.php:1110 #: includes/class-robotstxt-telemetry-logs-table.php:49 msgid "Date" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:1059 +#: includes/class-robotstxt-telemetry-admin.php:1111 #: includes/class-robotstxt-telemetry-logs-table.php:50 msgid "Method" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:1060 +#: includes/class-robotstxt-telemetry-admin.php:1112 msgid "URL" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:1061 +#: includes/class-robotstxt-telemetry-admin.php:1113 #: includes/class-robotstxt-telemetry-logs-table.php:51 -#: includes/class-robotstxt-telemetry-logs-table.php:318 +#: includes/class-robotstxt-telemetry-logs-table.php:245 msgid "Host" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:1062 +#: includes/class-robotstxt-telemetry-admin.php:1114 #: includes/class-robotstxt-telemetry-logs-table.php:52 msgid "Path" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:1063 +#: includes/class-robotstxt-telemetry-admin.php:1115 msgid "Body Params" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:1064 +#: includes/class-robotstxt-telemetry-admin.php:1116 msgid "Headers" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:1065 +#: includes/class-robotstxt-telemetry-admin.php:1117 msgid "User Agent" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:1066 +#: includes/class-robotstxt-telemetry-admin.php:1118 msgid "Raw Body" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:1067 +#: includes/class-robotstxt-telemetry-admin.php:1119 msgid "Caller" msgstr "" -#: includes/class-robotstxt-telemetry-admin.php:1087 +#: includes/class-robotstxt-telemetry-admin.php:1140 msgid "Telemetry Analysis" msgstr "" @@ -457,441 +457,441 @@ msgstr "" msgid "Body Parameters" msgstr "" -#: includes/class-robotstxt-telemetry-logs-table.php:170 +#: includes/class-robotstxt-telemetry-logs-table.php:173 msgid "View" msgstr "" -#: includes/class-robotstxt-telemetry-logs-table.php:171 +#: includes/class-robotstxt-telemetry-logs-table.php:174 msgid "Delete" msgstr "" -#: includes/class-robotstxt-telemetry-logs-table.php:298 +#: includes/class-robotstxt-telemetry-logs-table.php:225 msgid "Filter by method" msgstr "" -#: includes/class-robotstxt-telemetry-logs-table.php:300 +#: includes/class-robotstxt-telemetry-logs-table.php:227 msgid "All methods" msgstr "" -#: includes/class-robotstxt-telemetry-logs-table.php:314 +#: includes/class-robotstxt-telemetry-logs-table.php:241 msgid "Filter by host" msgstr "" -#: includes/class-robotstxt-telemetry-logs-table.php:321 +#: includes/class-robotstxt-telemetry-logs-table.php:248 msgid "From date" msgstr "" -#: includes/class-robotstxt-telemetry-logs-table.php:327 +#: includes/class-robotstxt-telemetry-logs-table.php:254 msgid "To date" msgstr "" -#: includes/class-robotstxt-telemetry-logs-table.php:333 +#: includes/class-robotstxt-telemetry-logs-table.php:260 msgid "Filter" msgstr "" #. translators: 1: Manager plugin URL, 2: link text. -#: includes/class-robotstxt-telemetry-manager-notice.php:130 +#: includes/class-robotstxt-telemetry-manager-notice.php:139 #, php-format msgid "To receive updates for Telemetry disabler (by ROBOTSTXT), the %2$s plugin must be installed and active." msgstr "" -#: includes/class-robotstxt-telemetry-manager-notice.php:132 +#: includes/class-robotstxt-telemetry-manager-notice.php:141 msgid "Manager (by ROBOTSTXT)" msgstr "" -#: includes/class-robotstxt-telemetry-manager-notice.php:167 +#: includes/class-robotstxt-telemetry-manager-notice.php:178 msgid "You do not have sufficient permissions to perform this action." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:56 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:61 msgid "Blocks the analytics.adinserter.pro telemetry (site URL, site name, WordPress and PHP versions, admin email, plugin list and options). Update checks keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:60 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:70 msgid "Removes the WordPress version and site URL from the API User-Agent. The connect flow keeps sending the site URL because it is the account identifier." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:64 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:80 msgid "Removes the site URL and the admin email from the extension update-check query. Extension updates keep working (they only need the purchased extension slug and version)." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:71 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:93 msgid "Blocks the comment-language check (which sends the comment text) and the IP country lookup. All the local spam checks keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:78 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:108 msgid "Removes the site URL from the starter-template requests. License validation keeps sending the site URL because it is the account identifier." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:82 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:117 msgid "Blocks the usage ping. The critical CSS service keeps receiving the page URL because generating the CSS for a page requires that page URL." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:86 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:121 msgid "Blocks the Mixpanel telemetry events (which include the site host and versions). Backup destinations are admin-configured and untouched." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:90 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:130 msgid "Blocks the StellarWP telemetry reports. The brute-force network and licensing keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:94 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:140 msgid "Removes the Referer header (your site URL) from the Sucuri site-check requests. The scan itself keeps working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:98 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:144 msgid "Removes the WordPress version, home URL, plugin and theme lists from the WPMU DEV Hub payloads, and the site URL from the User-Agent. The Hub connection keeps the domain as the account identifier." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:102 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:153 msgid "Removes the WordPress version and site URL from the API User-Agent. Link analysis keeps working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:106 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:163 msgid "Blocks the aggregated statistics telemetry. License checks keep sending the site URL as the account identifier." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:110 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:172 msgid "Removes the WordPress version, PHP version and site URL from the API User-Agent. All button features keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:114 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:182 msgid "Blocks the NPS survey requests that automatically attach the admin name and email. Template downloads keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:118 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:191 msgid "Blocks the feedback and support pings that send the site URL. The chat channels keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:122 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:201 msgid "Blocks the deactivation feedback (WordPress version, PHP version, site URL, language, theme, plugin list, server software). Chat widgets keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:126 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:211 msgid "Removes the site host from the cloud search queries. Cloud search keeps working with the account token." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:130 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:221 msgid "Removes the WordPress version from the license requests. The license key, site URL (account identifier) and installed version (needed for updates) are kept." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:134 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:225 msgid "Blocks the Freemius analytics events (plugin and theme lists, versions, site URL, language). License activation keeps working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:138 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:235 msgid "Blocks the uninstall feedback (MySQL, WordPress and WooCommerce versions, locale, multisite flag). The cookie scanner keeps sending the scanned URLs because that is its function." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:142 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:245 msgid "Blocks the deactivation feedback that sends the site URL. The notice and the account service keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:146 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:254 msgid "Blocks the usage tracker (WordPress version, PHP version, server IP, MySQL version, locale, plugin list). Post duplication is fully local." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:150 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:264 msgid "Removes the site URL and language from the newsletter subscribe. The admin-entered email is kept (it is an explicit subscription)." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:154 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:268 msgid "Blocks the BSF analytics report (site URL, WordPress/PHP/MySQL versions, user count, language, timezone, plugin list, server software). Font uploads are unaffected." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:161 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:281 msgid "Blocks the usage tracker and its country lookup (site URL, plugin slug, server IP). Comment disabling is fully local." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:165 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:290 msgid "Removes the site URL from the geo-lookup User-Agent. Mail delivery keeps working with your mailer credentials only." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:169 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:301 msgid "Removes the language and API version from the feedback surveys. The template library and the connect flow (site URL as account identifier) are untouched." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:173 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:312 msgid "Removes the WordPress version, PHP version and site URL from the unsubscribe feedback. Widgets and modules are unaffected." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:177 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:322 msgid "Removes the site URL and the WordPress/PHP version block from the ShortPixel key check. The API key alone is enough to validate the account." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:181 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:332 msgid "Blocks the usage tracker (site URL, site name, WordPress version, language, PHP version, admin email). Elements and templates keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:185 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:341 msgid "Blocks the weekly check-in (plugin list, locale, WordPress version, OS, limits, image counts). Local and cloud optimization keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:192 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:356 msgid "Removes the WordPress version, language, site title, site profile and Referer header from the AI requests. The AI assistance keeps working with the prompt content only." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:196 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:366 msgid "Blocks the tracker (WordPress version, PHP version, MySQL version, server software, plugin list, admin email, IP). Form integrations keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:200 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:376 msgid "Blocks the opt-in ping and the failed-mail notifications (which include email metadata). Mail delivery keeps working with your mailer credentials only." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:204 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:385 msgid "Blocks the usage snapshot (UUID, WordPress/PHP/MySQL versions, OS, locale, plugin list, form counts) and the onboarding email collection. Forms keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:208 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:389 msgid "Removes the WordPress version, home URL, plugin and theme lists from the WPMU DEV Hub payloads, and the site URL from the User-Agent. The domain is kept as the account identifier." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:212 -#: includes/class-robotstxt-telemetry-plugin-profiles.php:216 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:398 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:407 msgid "Blocks the check-in (plugin list, locale, home URL). Your Google Analytics measurement keeps working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:220 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:417 msgid "Removes the WordPress version, PHP version and user count from the Site Kit feature reports. Search Console, Analytics and AdSense integrations keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:227 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:430 msgid "Blocks the Google Analytics usage ping and the beta-consent ping (WordPress version, PHP version, post count, email, domain, language). Search-engine pings keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:231 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:440 msgid "Blocks the Appsero insights (site URL, PHP version, MySQL, server software, WordPress version). License and update checks keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:235 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:444 msgid "Blocks the BSF analytics report (site URL, PHP/WordPress versions, network URL, plugin list). Header and footer builder keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:239 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:454 msgid "Blocks the event reporting that sends your domain. Hosting management actions keep working with your token." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:243 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:458 msgid "Blocks the Mixpanel telemetry events (which include the WordPress version). Image optimization keeps working with your API key." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:247 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:469 msgid "Removes the language from the notifications requests. Image optimization and connect keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:254 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:484 msgid "Blocks the usage check-in (environment payload with a site-URL User-Agent). Feeds keep working with your access tokens." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:261 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:498 msgid "Blocks the Freemius analytics events and removes the domain from the newsletter subscribe. Templates and elements keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:265 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:507 msgid "Blocks the StellarWP telemetry reports. Blocks, AI features and the template library keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:269 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:516 msgid "Blocks the support ping and wizard reporting (store name, domain, list data). Order and subscriber synchronization keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:273 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:526 msgid "Blocks the Tracks analytics worker. Newsletter sending and subscribers keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:279 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:536 msgid "Removes the WordPress version, PHP version and language from the updater requests. The license key and site URL (account identifier) are kept." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:283 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:546 msgid "Blocks the onboarding data sender (plugin and theme lists). Form integrations keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:287 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:555 msgid "Blocks the usage tracking (PHP version, WordPress version, server software, home URL, theme, admin email, settings). Galleries keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:291 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:565 msgid "Removes the site data block (site URL and server IP) from the dispatcher requests. Forms and add-on services keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:295 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:569 msgid "Blocks the Freemius analytics events (plugin and theme lists, versions, site URL, language). Demos and license activation keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:299 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:573 msgid "Blocks the Themeisle tracker and SDK logger (theme, plugin list, WordPress version). Blocks keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:303 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:577 msgid "Blocks the Freemius analytics events (plugin and theme lists, versions, site URL, language). Password protection is fully local." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:307 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:586 msgid "Blocks the weekly usage report (home URL, PHP/WordPress/MySQL versions, server software, multisite, plugin list, theme, locale, license, settings). PDF embedding keeps working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:311 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:597 msgid "Removes the language from the notifications requests. All accessibility widgets keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:318 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:612 msgid "Removes the PHP version and language from the Pro updater requests. The WordPress version, license and site URL (account identifier) are kept so updates keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:326 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:631 msgid "Blocks the telemetry check-in and the Google Analytics usage events, and removes the PHP version from the extension updater requests. Popups keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:333 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:644 msgid "Blocks the Freemius analytics events and removes the site URL from the notification requests. Mail delivery keeps working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:340 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:658 msgid "Blocks the feedback and install pings (locale, theme and plugin lists, site domain, memory limit, execution time, used widgets). All addons keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:344 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:668 msgid "Blocks the mailing-list subscribe (email, license, site URL). The vulnerability scan keeps sending your installed versions because checking them is its function." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:348 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:677 msgid "Removes the theme name from the font-converter User-Agent. Font conversion keeps working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:355 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:689 msgid "Blocks the Freemius analytics events and the usage events server. Templates and widgets keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:359 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:693 msgid "Blocks the Mixpanel telemetry. Content AI and module updates keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:363 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:703 msgid "Blocks the plugin-data telemetry (home URL, admin email, PHP version and limits, OS, WordPress version, user count, MySQL version, server software). Caching keeps working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:367 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:713 msgid "Blocks the plugin-data telemetry (home URL, admin email, PHP and WordPress versions, user count, MySQL version, server software). Security hardening keeps working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:371 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:717 msgid "Blocks the Freemius analytics events (plugin and theme lists, versions, site URL, language). Shortcodes are fully local." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:375 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:727 msgid "Blocks the Posimyth tracker (site URL, PHP version, plugin slugs, theme, install time). Header effects keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:379 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:737 msgid "Removes the PHP version from the API lookups. The WordPress version and the plugin/theme versions are kept because the integrity checks are the service itself." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:383 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:741 msgid "Blocks the BSF analytics report (domain, PHP OS, server software, MySQL/PHP versions, WordPress version). Forms and the AI builder keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:387 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:745 msgid "Blocks the BSF analytics report (domain, PHP OS, server software, MySQL/PHP versions, WordPress version). SEO analysis keeps working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:391 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:749 msgid "Blocks the Freemius analytics events (plugin and theme lists, versions, site URL, language). Tables are fully local." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:395 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:759 msgid "Removes the server IP, site URL and version headers from every API request. Template downloads keep working with your token." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:402 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:773 msgid "Blocks the StellarWP telemetry and removes the WordPress version, PHP version and user counts from the license/update validation. The domain is kept as the account identifier." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:406 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:783 msgid "Blocks the weekly sync and the opt-in subscribe (home URL, email, name, plugin list, WordPress version, locale, PHP version). Translations keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:410 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:787 msgid "Blocks the Freemius analytics events (plugin and theme lists, versions, site URL, language). Widgets keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:414 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:797 msgid "Removes the Referer header (your network site URL) from the IP info lookups. Backups go to the destinations you configured." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:418 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:807 msgid "Blocks the survey requests that include the home URL and email. CDN and cache configuration keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:422 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:811 msgid "Blocks the BSF analytics report (WordPress version, PHP version, locale, site URL). Cart tracking and webhooks keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:426 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:820 msgid "Blocks the feedback requests (server software, PHP version, MySQL version, WordPress and WooCommerce versions, locale, multisite). Checkout fields keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:430 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:830 msgid "Blocks the WooCommerce.com Tracks pixel (usage analytics). Store functionality and woocommerce.com connections keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:434 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:840 msgid "Blocks the WooPay tracker pixel. Payments keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:438 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:850 msgid "Blocks the deactivation feedback (PHP version, WordPress version, server info, plugin list, theme, settings). Swatches keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:444 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:860 msgid "Removes the site URL, PHP and WordPress versions, user agent and PHP limits from the plugin-server requests. File management keeps working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:448 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:869 msgid "Blocks the usage tracking (home URL, PHP version, WordPress version, MySQL version, server, form and entry counts). Forms keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:452 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:878 msgid "Blocks the WPBrigade telemetry (PHP version, WordPress version, server, MySQL version, locale, limits). Header and footer scripts keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:456 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:887 msgid "Blocks the usage tracking (MySQL version, server software, locale, theme, site count, mailer configuration). Mail delivery keeps working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:460 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:891 msgid "Blocks the Themeisle SDK logger (theme, plugin list, WordPress version). The maintenance page is fully local." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:464 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:900 msgid "Removes the WordPress version from the re-smush.it User-Agent. Image optimization keeps working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:468 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:910 msgid "Removes the WordPress version from the licensing requests. The license key and site URL (account identifier) are kept." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:472 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:920 msgid "Removes the WordPress environment block (domain, theme and version, full theme and plugin lists) from the connect requests. Review widgets keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:476 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:930 msgid "Removes the locale and version headers from the promotions requests. SEO features and instant indexing keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:480 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:934 msgid "Removes the WordPress version, home URL, plugin and theme lists from the WPMU DEV Hub payloads, and the site URL from the User-Agent. Image compression keeps working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:484 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:944 msgid "Blocks the anonymized usage reports (database version and type, aggregate counts). Statistics collection stays local." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:488 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:953 msgid "Blocks the deactivation feedback (PHP/MySQL/WordPress versions, site URL, theme, plugin list, email). Chat widgets keep working." msgstr "" -#: includes/class-robotstxt-telemetry-plugin-profiles.php:492 +#: includes/class-robotstxt-telemetry-plugin-profiles.php:963 msgid "Removes the language from the pricing lookups. The store currency is kept because prices depend on it." msgstr "" diff --git a/readme.txt b/readme.txt index d8e7572..d5912e6 100644 --- a/readme.txt +++ b/readme.txt @@ -3,9 +3,9 @@ Contributors: robotstxt, javiercasares Tags: telemetry, privacy, http, requests, logging Requires at least: 4.0 Tested up to: 7.1 -Stable tag: 1.1.1 +Stable tag: 1.1.4 Requires PHP: 5.6 -Version: 1.1.1 +Version: 1.1.4 License: GPL-3.0-or-later License URI: https://www.gnu.org/licenses/gpl-3.0.txt @@ -148,23 +148,17 @@ On WordPress versions older than 5.1, the Core update check Safe mode cannot red Only the 3 last versions. The full changelog will be at changelog.txt -= 1.1.1 = += 1.1.4 = -* Added: "Safe Mode" checkbox column in the Plugins screen (with accessible hidden labels per row) -* Fixed: the StellarWP telemetry blocks (iThemes Security, Kadence Blocks, The Events Calendar) are now actually applied (path-only matchers were never reached) -* Changed: the profile registry is built once per request instead of on every outbound call +* Security and compatibility review of the 1.1.3 code base: PHPStan level 9 with the WordPress stubs introduced (and every finding fixed), WordPress Coding Standards fixes applied across all files, and the real compatibility floors re-verified (WordPress 4.0 - 7.1, PHP 5.6 - 8.5) -= 1.1.0 = += 1.1.3 = -* Added: "Plugins" settings screen (Telemetry → Plugins) with a Safe/Original mode per plugin; in Safe mode the known telemetry endpoints are blocked and the environment data is reduced to what each service needs, and every row explains what is truncated and what is kept -* Added: safe profiles for 99 popular plugins, covering the common telemetry SDKs (Freemius, BSF analytics, Themeisle, Mixpanel, Appsero, StellarWP, WPMU DEV Hub) and the individual trackers, license-update extras, feedback surveys, and User-Agent/headers of each plugin +* Security and compatibility review of the 1.1.2 tab-scoped settings save: nonce and capability checks, tab whitelisting, option-name whitelisting, per-value sanitization, and redirect hardening all verified; no changes needed -= 1.0.1 = += 1.1.2 = -* Fixed: saving the "Plugins" tab from the Network Admin no longer resets the other network settings to their defaults (and the hidden plugins list can now be saved in Global mode) -* Fixed: credentials embedded in URLs are now always stripped, including URLs without query strings -* Changed: the redaction of sensitive keys now also covers "api-key", "cookie", "session", "private-key", and "private_key" -* Changed: documentation clarified — the WordPress version masking applies to the User-Agent only, and the query parameters always send the real version +* Fixed: saving one Settings tab no longer resets the other tabs (WordPress core sets every unposted option of a settings group to null since WordPress 5.5, so saving any tab was wiping the settings of the other tabs back to their defaults; each tab now saves through its own tab-scoped, nonce-protected handler) = Previous versions = diff --git a/robotstxt-telemetry.php b/robotstxt-telemetry.php index 8fad32f..634caca 100644 --- a/robotstxt-telemetry.php +++ b/robotstxt-telemetry.php @@ -4,7 +4,7 @@ * Plugin URI: https://www.robotstxt.software/plugins/robotstxt-telemetry/ * Update URI: https://www.robotstxt.software/plugins/robotstxt-telemetry/ * Description: Reduces the telemetry WordPress sends out and logs every outbound HTTP request, so your site shares less and you can see everything. - * Version: 1.1.1 + * Version: 1.1.4 * Author: ROBOTSTXT * Author URI: https://www.robotstxt.software/ * Text Domain: robotstxt-telemetry @@ -13,8 +13,8 @@ * Requires PHP: 5.6 * Tested up to: 7.1 * Network: true - * License: GPL v3 or later - * License URI: https://www.gnu.org/licenses/gpl-3.0.html + * License: GPL-3.0-or-later + * License URI: https://www.gnu.org/licenses/gpl-3.0.txt * * @package RobotstxtTelemetry */ @@ -23,7 +23,7 @@ if ( ! defined( 'ABSPATH' ) ) { exit; } -define( 'ROBOTSTXT_TELEMETRY_VERSION', '1.1.1' ); +define( 'ROBOTSTXT_TELEMETRY_VERSION', '1.1.4' ); define( 'ROBOTSTXT_TELEMETRY_DB_VERSION', '1.1.0' ); define( 'ROBOTSTXT_TELEMETRY_PLUGIN_FILE', __FILE__ ); define( 'ROBOTSTXT_TELEMETRY_PLUGIN_DIR', __DIR__ ); @@ -53,7 +53,7 @@ if ( ! function_exists( 'wp_json_encode' ) ) { * @return string|false */ function wp_json_encode( $data, $options = 0 ) { - return json_encode( $data, $options ); // phpcs:ignore WordPress.WP.AlternativeFunctions.json_encode_json_decode -- Native call is the purpose of this compatibility shim for WordPress 4.0. + return json_encode( $data, $options ); // phpcs:ignore WordPress.WP.AlternativeFunctions.json_encode_json_encode -- Native call is the purpose of this compatibility shim for WordPress 4.0. } } diff --git a/uninstall.php b/uninstall.php index 1802923..0213dfc 100644 --- a/uninstall.php +++ b/uninstall.php @@ -70,7 +70,7 @@ function robotstxt_telemetry_uninstall_site( $force_drop = null ) { if ( $drop ) { $table_name = $wpdb->prefix . 'robotstxt_telemetry_logs'; - $wpdb->query( "DROP TABLE IF EXISTS {$table_name}" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is internal; the %i placeholder requires WordPress 6.2. // phpcs:ignore WordPress.DB.DirectDatabaseQuery, WordPress.DB.DirectDatabaseQuery.SchemaChange, WordPress.DB.DirectDatabaseQuery.NoCaching + $wpdb->query( "DROP TABLE IF EXISTS {$table_name}" ); // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.DirectDatabaseQuery.SchemaChange -- Table name is internal (%i requires WordPress 6.2); dropping the table on uninstall is the intended, opt-in behavior. } delete_option( 'robotstxt_telemetry_delete_on_uninstall' );