v3.1.2
This commit is contained in:
parent
dbccd5fb07
commit
ce09aa77e5
4 changed files with 168 additions and 28 deletions
36
README.md
Normal file
36
README.md
Normal file
|
|
@ -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).
|
||||
|
|
@ -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 `<form>` elements on the settings page. The "Apply Recommended Defaults" form was physically nested inside the main settings form — HTML5 forbids this, and the stray `</form>` 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%.
|
||||
* `<coverage>` 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**
|
||||
|
|
|
|||
|
|
@ -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 {
|
|||
}
|
||||
?>
|
||||
|
||||
<!-- "Apply Recommended Defaults" — standalone sibling form, rendered
|
||||
BEFORE the main settings form. MUST NOT be nested inside it: HTML5
|
||||
forbids nested <form> elements; a stray </form> inside the parent
|
||||
would close the parent early and orphan the Save Changes button and
|
||||
all directive checkboxes. -->
|
||||
<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" style="margin: 0 0 20px 0;">
|
||||
<input type="hidden" name="action" value="noindex_seo_apply_suggestions">
|
||||
<?php wp_nonce_field( 'noindex_seo_apply_suggestions_nonce' ); ?>
|
||||
<?php
|
||||
submit_button(
|
||||
__( 'Apply Recommended Defaults', 'noindex-seo' ),
|
||||
'secondary',
|
||||
'noindex-seo-apply-suggestions',
|
||||
false,
|
||||
array(
|
||||
'title' => __( 'Enable all directives for the 12 contexts flagged as recommended.', 'noindex-seo' ),
|
||||
)
|
||||
);
|
||||
?>
|
||||
<span class="description" style="margin-left: 8px; vertical-align: middle;">
|
||||
<?php esc_html_e( 'Enables all 5 directives on the 12 contexts flagged "Recommended" (privacy policy, date archives, pagination, search results, attachment pages, previews, 404). Review and save.', 'noindex-seo' ); ?>
|
||||
</span>
|
||||
</form>
|
||||
|
||||
<!-- Main settings form: wraps stats, config, alert, search, sections, submit. -->
|
||||
<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
|
||||
<input type="hidden" name="action" value="update_noindex_seo">
|
||||
<?php wp_nonce_field( 'update_noindex_seo_nonce' ); ?>
|
||||
|
|
@ -3354,28 +3404,6 @@ function noindex_seo_admin(): void {
|
|||
<p><?php esc_html_e( 'Important: Enabling noindex on the wrong pages can harm your search engine rankings. Only enable options you fully understand.', 'noindex-seo' ); ?></p>
|
||||
</div>
|
||||
|
||||
<!-- "Apply Recommended Defaults" button — sits between the stat cards
|
||||
and the option-search input. Separate form so it does not collide
|
||||
with the main settings form's nonce/action. -->
|
||||
<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" style="margin: 0 0 20px 0;">
|
||||
<input type="hidden" name="action" value="noindex_seo_apply_suggestions">
|
||||
<?php wp_nonce_field( 'noindex_seo_apply_suggestions_nonce' ); ?>
|
||||
<?php
|
||||
submit_button(
|
||||
__( 'Apply Recommended Defaults', 'noindex-seo' ),
|
||||
'secondary',
|
||||
'noindex-seo-apply-suggestions',
|
||||
false,
|
||||
array(
|
||||
'title' => __( 'Enable all directives for the 12 contexts flagged as recommended.', 'noindex-seo' ),
|
||||
)
|
||||
);
|
||||
?>
|
||||
<span class="description" style="margin-left: 8px; vertical-align: middle;">
|
||||
<?php esc_html_e( 'Enables all 5 directives on the 12 contexts flagged "Recommended" (privacy policy, date archives, pagination, search results, attachment pages, previews, 404). Review and save.', 'noindex-seo' ); ?>
|
||||
</span>
|
||||
</form>
|
||||
|
||||
<!-- Search Box -->
|
||||
<div class="noindex-seo-search">
|
||||
<input
|
||||
|
|
|
|||
42
readme.txt
42
readme.txt
|
|
@ -3,9 +3,9 @@ Contributors: javiercasares
|
|||
Tags: seo, noindex, nofollow, noarchive, robots
|
||||
Requires at least: 5.7
|
||||
Tested up to: 7.1
|
||||
Stable tag: 3.1.1
|
||||
Stable tag: 3.1.2
|
||||
Requires PHP: 7.2
|
||||
Version: 3.1.1
|
||||
Version: 3.1.2
|
||||
License: GPL-3.0-or-later
|
||||
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
|
||||
|
||||
|
|
@ -114,6 +114,44 @@ Extract the contents of the ZIP and upload the contents to the `/wp-content/plug
|
|||
|
||||
== 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 `<form>` elements on the settings page. The "Apply Recommended Defaults" form was physically nested inside the main settings form — HTML5 forbids this, and the stray `</form>` 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%.
|
||||
* `<coverage>` 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**
|
||||
|
|
|
|||
Loading…
Reference in a new issue