diff --git a/changelog.txt b/changelog.txt index 6efd308..8757699 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,38 @@ == Changelog == += 3.2.0 = + +_Release date: 2026-09-18_ +**Highlights** + +* Two roadmap features: JSON export/import of the settings (#6) and runtime conflict verification against the `wp_robots` API (#10). + +**Added** + +* **Export / Import of settings (JSON).** Two new controls on the settings page: "Export settings" downloads the consolidated settings as a JSON file (`noindex-seo-settings-{date}.json`), and "Import settings" restores the global settings from a previously exported file. Imports are strictly validated and sanitized: plugin marker check, 1 MB size limit, `is_uploaded_file()` verification, the upload is never persisted to the uploads directory, every directive is normalized to 0/1, config values go through the same safelists as the settings form, and contexts that do not exist on the importing site (e.g. custom post types from another install) are dropped. Per-post and per-term granular overrides are content data and are never touched by an import. Both actions require `manage_options` and a nonce; success and error notices survive the redirect. +* **Runtime conflict verification (TODO #10).** When no known SEO plugin conflicts, `noindex_seo_detect_conflicts()` now also inspects the callbacks actually registered on the `wp_robots` filter (WordPress 5.7+): anything that is not a core callback or one of ours — a foreign function, a class method, or a closure from a theme or unknown plugin — produces a dismissible admin notice naming the detected callback. The core callback safelist is filterable via `noindex_seo_core_robots_callbacks`. The notice honours the existing "disable compatibility warnings" opt-out. + +**Changed** + +* Nothing. + +**Fixed** + +* Nothing. + +**Security** + +* No security changes; the new endpoints follow the canonical checklist (capability + nonce on both actions, strict input validation, safelisted config values, no persistence of uploads) and PHPCS/PHPStan/composer audit stay clean. + +**Compatibility** + +* WordPress: 4.7 - 7.2 +* PHP: 5.6 - 8.5 + +**Tests** + +* PHPUnit: 9.6.36 (165 tests, all passing): export payload shape and JSON round-trip, import sanitizer (happy path, normalization, unknown-context dropping, malformed-payload rejection), handler guards, foreign-callback detection (functions, class methods, closures, own-prefix skipping, filterable safelist) and the runtime notice. + = 3.1.6 = _Release date: 2026-09-18_ diff --git a/languages/noindex-seo-ca.mo b/languages/noindex-seo-ca.mo index 4a9cbac..15b212d 100644 Binary files a/languages/noindex-seo-ca.mo and b/languages/noindex-seo-ca.mo differ diff --git a/languages/noindex-seo-ca.po b/languages/noindex-seo-ca.po index d4e1122..674d751 100644 --- a/languages/noindex-seo-ca.po +++ b/languages/noindex-seo-ca.po @@ -715,3 +715,32 @@ msgstr "Evita fragments de text als resultats de cerca" #: assets/js/editor-sidebar.js:237 msgid "Active Directives:" msgstr "Directrius actives:" + +#: noindex-seo.php +msgid "Export settings" +msgstr "Exporta els ajustaments" + +#: noindex-seo.php +msgid "Download the current settings as a JSON file." +msgstr "Baixa els ajustaments actuals en un fitxer JSON." + +#: noindex-seo.php +msgid "Import settings" +msgstr "Importa els ajustaments" + +#: noindex-seo.php +msgid "Restore the global settings from a previously exported JSON file. Per-post and per-term overrides are kept." +msgstr "Restaura els ajustaments globals des d'un fitxer JSON exportat anteriorment. Les sobreescriptures per entrada i per terme es conserven." + +#: noindex-seo.php +msgid "Settings imported successfully." +msgstr "S'han importat els ajustaments correctament." + +#: noindex-seo.php +msgid "The settings file could not be imported: it is missing, too large, or not a valid noindex SEO export." +msgstr "No s'ha pogut importar el fitxer d'ajustaments: no existeix, és massa gran o no és una exportació vàlida de noindex SEO." + +#, php-format +#: noindex-seo.php +msgid "noindex SEO has detected that another plugin or theme is adding robots directives through the wp_robots API (%s). This may cause conflicts. Please configure the options accordingly." +msgstr "noindex SEO ha detectat que un altre complement o tema està afegint directrius de robots a través de l'API wp_robots (%s). Això pot causar conflictes. Configureu les opcions en conseqüència." diff --git a/languages/noindex-seo-es_ES.mo b/languages/noindex-seo-es_ES.mo index 23164c5..91253a3 100644 Binary files a/languages/noindex-seo-es_ES.mo and b/languages/noindex-seo-es_ES.mo differ diff --git a/languages/noindex-seo-es_ES.po b/languages/noindex-seo-es_ES.po index c3774cb..1ea15ce 100644 --- a/languages/noindex-seo-es_ES.po +++ b/languages/noindex-seo-es_ES.po @@ -718,3 +718,32 @@ msgstr "Evitar fragmentos de texto en los resultados de búsqueda" #: assets/js/editor-sidebar.js:237 msgid "Active Directives:" msgstr "Directivas activas:" + +#: noindex-seo.php +msgid "Export settings" +msgstr "Exportar ajustes" + +#: noindex-seo.php +msgid "Download the current settings as a JSON file." +msgstr "Descarga los ajustes actuales en un archivo JSON." + +#: noindex-seo.php +msgid "Import settings" +msgstr "Importar ajustes" + +#: noindex-seo.php +msgid "Restore the global settings from a previously exported JSON file. Per-post and per-term overrides are kept." +msgstr "Restaura los ajustes globales desde un archivo JSON exportado anteriormente. Las sobrescrituras por entrada y por término se conservan." + +#: noindex-seo.php +msgid "Settings imported successfully." +msgstr "Ajustes importados correctamente." + +#: noindex-seo.php +msgid "The settings file could not be imported: it is missing, too large, or not a valid noindex SEO export." +msgstr "No se ha podido importar el archivo de ajustes: falta, es demasiado grande o no es una exportación válida de noindex SEO." + +#, php-format +#: noindex-seo.php +msgid "noindex SEO has detected that another plugin or theme is adding robots directives through the wp_robots API (%s). This may cause conflicts. Please configure the options accordingly." +msgstr "noindex SEO ha detectado que otro plugin o tema está añadiendo directivas de robots mediante la API wp_robots (%s). Esto puede causar conflictos. Configura las opciones en consecuencia." diff --git a/languages/noindex-seo.pot b/languages/noindex-seo.pot index b90ec37..900de93 100644 --- a/languages/noindex-seo.pot +++ b/languages/noindex-seo.pot @@ -665,3 +665,32 @@ msgstr "" #: assets/js/editor-sidebar.js:237 msgid "Active Directives:" msgstr "" + +#: noindex-seo.php +msgid "Export settings" +msgstr "" + +#: noindex-seo.php +msgid "Download the current settings as a JSON file." +msgstr "" + +#: noindex-seo.php +msgid "Import settings" +msgstr "" + +#: noindex-seo.php +msgid "Restore the global settings from a previously exported JSON file. Per-post and per-term overrides are kept." +msgstr "" + +#: noindex-seo.php +msgid "Settings imported successfully." +msgstr "" + +#: noindex-seo.php +msgid "The settings file could not be imported: it is missing, too large, or not a valid noindex SEO export." +msgstr "" + +#, php-format +#: noindex-seo.php +msgid "noindex SEO has detected that another plugin or theme is adding robots directives through the wp_robots API (%s). This may cause conflicts. Please configure the options accordingly." +msgstr "" diff --git a/noindex-seo.php b/noindex-seo.php index beba44b..68bbd20 100644 --- a/noindex-seo.php +++ b/noindex-seo.php @@ -3,7 +3,7 @@ * Plugin Name: noindex SEO * Plugin URI: https://www.robotstxt.software/plugins/noindex-seo/ * Description: Control search engine indexing with robots directives (noindex, nofollow, noarchive, nosnippet, noimageindex) for specific parts of your WordPress site. - * Version: 3.1.6 + * Version: 3.2.0 * Requires at least: 4.7 * Requires PHP: 5.6 * Author: ROBOTSTXT @@ -69,7 +69,7 @@ defined( 'ABSPATH' ) || die( 'Bye bye!' ); * form-handler wp_die() message corrected (I2); unreachable * REST fallbacks removed (I5). */ -define( 'NOINDEX_SEO_VERSION', '3.1.6' ); +define( 'NOINDEX_SEO_VERSION', '3.2.0' ); /** * Option key holding the consolidated plugin settings array. @@ -1643,6 +1643,7 @@ function noindex_seo_detect_conflicts() { ); // Iterate through the conflicting plugins to check if any are active. + $found_conflict = false; foreach ( $conflicting_plugins as $plugin_path => $plugin_name ) { if ( is_plugin_active( $plugin_path ) ) { // Add an admin notice if a conflicting plugin is active.. @@ -1655,13 +1656,113 @@ function noindex_seo_detect_conflicts() { echo '
'; } ); + $found_conflict = true; break; // Stop checking after finding the first conflict. } } + + // Runtime verification (3.2.0): when no known plugin conflicts, check + // whether anything else is actually emitting robots directives through + // the wp_robots API — this also catches themes and unknown plugins. + // Only possible on WordPress 5.7+ (the filter does not exist earlier). + if ( ! $found_conflict && function_exists( 'has_filter' ) && has_filter( 'wp_robots' ) ) { + $foreign_callbacks = noindex_seo_get_foreign_robots_callbacks(); + if ( ! empty( $foreign_callbacks ) ) { + add_action( + 'admin_notices', + function () use ( $foreign_callbacks ) { + echo ''; + // translators: %s: comma-separated list of wp_robots callbacks. + printf( esc_html__( 'noindex SEO has detected that another plugin or theme is adding robots directives through the wp_robots API (%s). This may cause conflicts. Please configure the options accordingly.', 'noindex-seo' ), esc_html( implode( ', ', $foreign_callbacks ) ) ); + echo '
'; + esc_html_e( 'Settings imported successfully.', 'noindex-seo' ); + echo '
'; + esc_html_e( 'The settings file could not be imported: it is missing, too large, or not a valid noindex SEO export.', 'noindex-seo' ); + echo '