From ce09aa77e5960d17c9ddf96601e57aff23953369 Mon Sep 17 00:00:00 2001 From: Javier Casares Date: Mon, 10 Aug 2026 19:07:06 +0000 Subject: [PATCH 01/10] v3.1.2 --- README.md | 36 ++++++++++++++++++++++ changelog.txt | 38 +++++++++++++++++++++++ noindex-seo.php | 80 +++++++++++++++++++++++++++++++++---------------- readme.txt | 42 ++++++++++++++++++++++++-- 4 files changed, 168 insertions(+), 28 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..a11a859 --- /dev/null +++ b/README.md @@ -0,0 +1,36 @@ +# noindex SEO + +Control search engine indexing with robots directives (`noindex`, `nofollow`, `noarchive`, `nosnippet`, `noimageindex`) for specific parts of your WordPress site. + +## For end users + +See [`readme.txt`](readme.txt) for installation, usage, and the WordPress.org-format changelog. + +## For developers / contributors + +- **[`CLAUDE.md`](CLAUDE.md)** — project-specific architecture, data model, tooling setup, and deliberate exceptions to the AGENTS defaults. Read this first. +- **[`AGENTS.md`](AGENTS.md)** — index to the contribution guidelines (security, compatibility, tooling, testing, deployment). Topic-specific rules live in the `AGENTS-*.md` files. + +## Common commands + +```bash +composer install # Install dev dependencies +vendor/bin/phpcs # WordPress Coding Standards +vendor/bin/phpstan analyse --memory-limit=1G # Static analysis (level 9) +vendor/bin/phpunit # Test suite (71 tests) +bash bin/preflight.sh # Full pre-deploy verification +``` + +## Test setup + +Copy the sample config and fill in your local DB credentials: + +```bash +cp tests/wp-tests-config.sample.php tests/wp-tests-config.php +``` + +The WordPress test library must be installed at `/tmp/wordpress-tests-lib` (or set `WP_TESTS_DIR`). + +## License + +GPL-3.0-or-later. See [LICENSE](LICENSE). diff --git a/changelog.txt b/changelog.txt index 3e1fbc9..d33c463 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,43 @@ == Changelog == += 3.1.2 [2026-08-10] = + +Audit-driven maintenance release. + +**Security** + +* Fixed the composer-audit gate in `bin/preflight.sh`. The previous version grepped for "security vulnerability advisory" (singular), which never matched Composer's actual output "security vulnerability advisories" (plural) — the y→i pluralization change silently disabled CVE detection, green-lighting every release regardless of known vulnerabilities. The gate now uses Composer's bitmask exit code (bit 0 = security), which is immune to wording changes. +* Bumped `squizlabs/php_codesniffer` to ^3.13.6 and `wp-coding-standards/wpcs` to ^3.4.1, fixing CVE-2026-67434 (OS command injection) and CVE-2026-45293 (arbitrary code execution) in the development tooling. These are dev-only dependencies and were never shipped in the release ZIP. + +**Fixed** + +* Nested `
` elements on the settings page. The "Apply Recommended Defaults" form was physically nested inside the main settings form — HTML5 forbids this, and the stray `
` could close the main form early, orphaning the "Save Changes" button and all directive checkboxes. The apply-suggestions form is now a standalone sibling rendered before the main form. +* Meta-box "Effective Directives" reference panel now reads from the consolidated `noindex_seo_settings` option via `noindex_seo_get_setting()` instead of the stale legacy individual options that may diverge after a settings save. + +**Added** + +* `load_plugin_textdomain('noindex-seo')` hooked on `init`. The plugin ships `.mo` files for Catalan and Spanish (es_ES) in `languages/`, but without this call WordPress only loaded translations from `wp-content/languages/plugins/` — the bundled translations were effectively dead code. +* PHPUnit coverage measurement in `bin/preflight.sh` (requires Xdebug). Enforces a 25% regression floor against the current 26.64% baseline; the AGENTS target remains 80%. +* `` configuration in `phpunit.xml` so `--coverage-text` produces a report. +* `README.md` for developer and contributor onboarding. +* `tests/wp-tests-config.sample.php` template. The real `tests/wp-tests-config.php` is now gitignored and reads from environment variables. + +**Changed** + +* Pinned all remaining wildcard `"*"` dev dependencies to caret constraints in `composer.json` (`phpcsutils` ^1.2, `php-compatibility` ^9.3, `dealerdirect/phpcodesniffer-composer-installer` ^1.2). Unpinned ranges were how the CVE-affected versions were resolved. +* Lowered `phpstan.neon` `phpVersion` from 80500 (PHP 8.5) to 80200 (PHP 8.2) so PHPStan flags any accidental use of PHP 8.3+ syntax that would break on the development floor. +* Refreshed `CLAUDE.md` to reflect 3.1.x reality (version, line count, v3 consolidated storage model, four-priority output logic, current 8-file test suite). Documented the uninstall direct-DB exception. +* Updated `TODO.md` to mark shipped items (#1–#4). + +**Compatibility** + +* WordPress: 5.7 - 7.1 +* PHP: 7.2 - 8.5 + +**Tests** + +* 71 tests, 385 assertions — all passing. Coverage measured at 26.64% (471/1768 lines). + = 3.1.1 [2026-07-18] = **Security** diff --git a/noindex-seo.php b/noindex-seo.php index a84a9c9..8da13de 100644 --- a/noindex-seo.php +++ b/noindex-seo.php @@ -5,7 +5,7 @@ * Description: Control search engine indexing with robots directives (noindex, nofollow, noarchive, nosnippet, noimageindex) for specific parts of your WordPress site. * Requires at least: 5.7 * Requires PHP: 7.2 - * Version: 3.1.1 + * Version: 3.1.2 * Author: ROBOTSTXT * Author URI: https://www.robotstxt.es/ * License: GPL-3.0-or-later @@ -51,8 +51,13 @@ defined( 'ABSPATH' ) || die( 'Bye bye!' ); * published + non-password-protected posts and requires * `edit_post` for everything else. The previous `__return_true` * callback would have leaked the full configuration to anyone. + * @since 3.1.2 Audit-driven maintenance release: fixed broken CVE gate in + * bin/preflight.sh, un-nested the settings page forms (HTML5 + * compliance), added load_plugin_textdomain() for bundled + * translations, pinned all dev dependencies, wired up coverage + * measurement, refreshed project docs. */ -define( 'NOINDEX_SEO_VERSION', '3.1.1' ); +define( 'NOINDEX_SEO_VERSION', '3.1.2' ); /** * Option key holding the consolidated plugin settings array. @@ -746,6 +751,27 @@ add_action( 'admin_init', 'noindex_seo_register' ); add_action( 'admin_menu', 'noindex_seo_menu' ); add_action( 'admin_enqueue_scripts', 'noindex_seo_enqueue_admin_assets' ); add_action( 'plugins_loaded', 'noindex_seo_check_migration' ); +add_action( 'init', 'noindex_seo_load_textdomain' ); + +/** + * Loads the plugin's translated strings from the bundled languages directory. + * + * WordPress auto-loads translations from `wp-content/languages/plugins/`, but + * the `.mo` files shipped in the plugin's own `languages/` directory require + * this explicit call. Hooked on {@see 'init'} so the text domain is available + * before any user-facing string is rendered. + * + * @since 3.1.2 + * + * @return void + */ +function noindex_seo_load_textdomain(): void { + load_plugin_textdomain( + 'noindex-seo', + false, + dirname( plugin_basename( __FILE__ ) ) . '/languages' + ); +} /** * Excludes noindexed posts from the core XML sitemap (WP 5.5+). @@ -1874,8 +1900,7 @@ function noindex_seo_render_meta_box( WP_Post $post ): void { $context = ( 'page' === $post_type ) ? 'page' : 'single'; foreach ( $directives as $directive ) { - $option_key = $directive . '_seo_' . $context; - if ( get_option( $option_key, 0 ) ) { + if ( noindex_seo_get_setting( $context, $directive ) ) { $global_directives[] = $directive; } } @@ -3216,6 +3241,31 @@ function noindex_seo_admin(): void { } ?> + +
+ + + __( 'Enable all directives for the 12 contexts flagged as recommended.', 'noindex-seo' ), + ) + ); + ?> + + + +
+ +
@@ -3354,28 +3404,6 @@ function noindex_seo_admin(): void {

- - - - - __( 'Enable all directives for the 12 contexts flagged as recommended.', 'noindex-seo' ), - ) - ); - ?> - - - -
-