This commit is contained in:
Javier Casares 2026-11-03 17:04:31 +00:00
commit 0ec665db60
10 changed files with 415 additions and 337 deletions

View file

@ -14,61 +14,19 @@
margin: 20px 0;
}
/* ===========================
Tabs Navigation
=========================== */
.noindex-seo-tabs {
display: flex;
gap: 10px;
margin-bottom: 30px;
border-bottom: 2px solid #c3c4c7;
flex-wrap: wrap;
/* Tab navigation uses the native WordPress nav-tab classes. */
.noindex-seo-admin-wrap .nav-tab-wrapper {
margin-bottom: 20px;
}
.noindex-seo-tab {
padding: 12px 24px;
background: transparent;
border: none;
color: #646970;
font-size: 15px;
font-weight: 500;
cursor: pointer;
border-bottom: 3px solid transparent;
transition: color 0.3s ease;
position: relative;
top: 2px;
/* Section titles inside a tab panel. Vertical separation between
sections comes from the content blocks' own bottom margins. */
.noindex-seo-section-title {
margin: 0 0 12px 0;
}
.noindex-seo-tab:hover,
.noindex-seo-tab.active {
color: var(--wp-admin-theme-color, #2271b1);
}
.noindex-seo-tab.active {
border-bottom-color: var(--wp-admin-theme-color, #2271b1);
}
/* ===========================
Tab Content
=========================== */
.noindex-seo-tab-content {
display: none;
}
.noindex-seo-tab-content.active {
display: block;
animation: noindexSeoFadeIn 0.3s ease;
}
@keyframes noindexSeoFadeIn {
from {
opacity: 0;
transform: translateY(10px);
}
to {
opacity: 1;
transform: translateY(0);
}
.noindex-seo-section-title + .description {
margin: 0 0 12px 0;
}
/* ===========================
@ -365,11 +323,6 @@ input:checked + .noindex-seo-slider:before {
margin: 0 0 20px 0;
}
.noindex-seo-apply-note {
margin-inline-start: 8px;
vertical-align: middle;
}
/* ===========================
General Config Section
=========================== */
@ -758,15 +711,6 @@ input:checked + .noindex-seo-slider:before {
grid-template-columns: 1fr;
}
.noindex-seo-tabs {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
}
.noindex-seo-tab {
white-space: nowrap;
}
.noindex-seo-stats {
grid-template-columns: 1fr;
}

View file

@ -13,43 +13,10 @@
* Initialize the admin panel
*/
function init() {
initTabs();
initCollapsibleCards();
initSearch();
initStats();
initTooltips();
initMethodDependentFields();
}
/**
* Initialize tabs functionality
*/
function initTabs() {
$( '.noindex-seo-tab' ).on(
'click',
function (e) {
e.preventDefault();
const tabId = $( this ).data( 'tab' );
// Update active tab.
$( '.noindex-seo-tab' ).removeClass( 'active' );
$( this ).addClass( 'active' );
// Update active content.
$( '.noindex-seo-tab-content' ).removeClass( 'active' );
$( '#' + tabId ).addClass( 'active' );
// Save last active tab to localStorage.
localStorage.setItem( 'noindexSeoActiveTab', tabId );
}
);
// Restore last active tab.
const lastTab = localStorage.getItem( 'noindexSeoActiveTab' );
if (lastTab && $( '#' + lastTab ).length) {
$( '.noindex-seo-tab[data-tab="' + lastTab + '"]' ).click();
}
}
/**
@ -163,63 +130,6 @@
// Can be enhanced with a tooltip library if needed.
}
/**
* Initialize method-dependent field states
* Some fields only work with HTTP headers, not HTML meta tags
*/
function initMethodDependentFields() {
const methodSelect = $( '#noindex_seo_config_method' );
if (methodSelect.length === 0) {
return;
}
/**
* Update field states based on selected implementation method
*/
function updateFieldStates() {
const method = methodSelect.val();
const isHeaderEnabled = (method === 'header' || method === 'both');
// Contexts that ONLY work with HTTP headers (non-HTML content).
const headerOnlyContexts = [
'attachment', // Attachment pages (may contain PDFs, images, etc.).
'feed', // RSS/Atom feeds (XML, not HTML).
'comment_feed' // Comment feeds (XML, not HTML).
];
headerOnlyContexts.forEach(
function (context) {
// Find all directive checkboxes for this context.
const directiveCheckboxes = $( 'input[name$="_seo_' + context + '"]' );
const option = directiveCheckboxes.first().closest( '.noindex-seo-option' );
if ( ! isHeaderEnabled) {
// Disable all directives for this context.
directiveCheckboxes.prop( 'disabled', true );
directiveCheckboxes.prop( 'checked', false );
option.addClass( 'disabled' );
option.attr( 'title', 'This option only works with HTTP Headers implementation method' );
} else {
// Enable all directives for this context.
directiveCheckboxes.prop( 'disabled', false );
option.removeClass( 'disabled' );
option.removeAttr( 'title' );
}
}
);
// Update stats after changing field states.
updateStats();
}
// Listen for method changes.
methodSelect.on( 'change', updateFieldStates );
// Execute on page load.
updateFieldStates();
}
/**
* Expand all cards
*/
@ -325,9 +235,15 @@
if (urlParams.get( 'updated' ) === 'true') {
showSuccessMessage( noindexSeoAdmin.successMessage || 'Settings saved successfully!' );
// Remove the parameter from URL without reload.
const newUrl = window.location.pathname + window.location.hash;
window.history.replaceState( {}, document.title, newUrl );
// Remove only the success flag, keeping the page and tab
// parameters intact (tabs are URL-based since 3.3.0).
urlParams.delete( 'updated' );
const remaining = urlParams.toString();
window.history.replaceState(
{},
document.title,
window.location.pathname + ( remaining ? '?' + remaining : '' )
);
}
}
);

View file

@ -1,8 +1,45 @@
== Changelog ==
= 3.3.0 =
_Release date: 2026-09-19_
**Highlights**
* The settings page is reorganized with the native WordPress tab navigation (General / SEO Settings / Import-Export) and titled sections, built exclusively on core `nav-tab` classes with URL-based switching — no proprietary tab CSS or JavaScript.
**Added**
* Native WordPress tab navigation on the settings page (`nav-tab-wrapper` / `nav-tab`, the same pattern as the core Updates and Plugins screens): General (implementation method and configuration options), SEO Settings (the directive grid), and Import / Export (the JSON tools). Tabs switch through the `tab` query parameter and the active panel renders server-side, so they work without JavaScript and are bookmarkable.
* Titled sections inside the tabs: "Recommended settings" (one-click defaults), "Overview" (the number cards) and "Page contexts" (the directive grid) on SEO Settings; "Export settings" and "Import settings" headers on the Import / Export tab. Spacing added between the tab bar and the content below.
**Changed**
* `noindex_seo_process_form()` is now tab-scoped: saving from the General tab updates only the configuration and preserves the directive grid, saving from SEO Settings updates only the directives and preserves the configuration — hidden tabs can no longer reset each other's values. The form carries a `noindex_seo_form_scope` marker and the redirect returns to the tab the user saved from.
* The header-only restriction for the attachment context now follows the saved implementation method (the method select lives on the General tab), and switching the method to meta/HTML-only from General zeroes the attachment directives to keep the invariant consistent.
* The apply-suggestions redirect and the import success/error redirects return to their source tabs (`tab=settings`, `tab=tools`).
* Removed the dead custom tab machinery: the `.noindex-seo-tab*` CSS rules, the `initTabs()` JavaScript with its localStorage persistence, and the unused `.noindex-seo-apply-note` class (previously flagged as dead code by the 3.1.6 deploy audit).
**Fixed**
* Nothing.
**Security**
* No security changes; the tab parameter is strictly safelisted server-side (`sanitize_key` + allow list) and PHPCS/PHPStan/composer audit stay clean.
**Compatibility**
* WordPress: 4.7 - 7.2
* PHP: 5.6 - 8.5
**Tests**
* PHPUnit: 9.6.36 (172 tests, all passing): tab markup (three tabs, active class, unknown-tab fallback), per-tab rendering isolation, scope-aware saving (config-only / grid-only / preserve-other-side / attachment invariant / tab-aware redirect), and section ordering.
= 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).

Binary file not shown.

View file

@ -744,3 +744,31 @@ msgstr "No s'ha pogut importar el fitxer d'ajustaments: no existeix, és massa g
#: 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."
#: noindex-seo.php
msgid "Recommended settings"
msgstr "Ajustaments recomanats"
#: noindex-seo.php
msgid "Overview"
msgstr "Resum"
#: noindex-seo.php
msgid "Page contexts"
msgstr "Contextos de pàgina"
#: noindex-seo.php
msgid "General"
msgstr "General"
#: noindex-seo.php
msgid "SEO Settings"
msgstr "Ajustaments SEO"
#: noindex-seo.php
msgid "Import / Export"
msgstr "Importació i exportació"
#: noindex-seo.php
msgid "Settings sections"
msgstr "Seccions dels ajustaments"

Binary file not shown.

View file

@ -747,3 +747,31 @@ msgstr "No se ha podido importar el archivo de ajustes: falta, es demasiado gran
#: 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."
#: noindex-seo.php
msgid "Recommended settings"
msgstr "Ajustes recomendados"
#: noindex-seo.php
msgid "Overview"
msgstr "Resumen"
#: noindex-seo.php
msgid "Page contexts"
msgstr "Contextos de página"
#: noindex-seo.php
msgid "General"
msgstr "General"
#: noindex-seo.php
msgid "SEO Settings"
msgstr "Ajustes SEO"
#: noindex-seo.php
msgid "Import / Export"
msgstr "Importación y exportación"
#: noindex-seo.php
msgid "Settings sections"
msgstr "Secciones de los ajustes"

View file

@ -694,3 +694,31 @@ msgstr ""
#: 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.php
msgid "Recommended settings"
msgstr ""
#: noindex-seo.php
msgid "Overview"
msgstr ""
#: noindex-seo.php
msgid "Page contexts"
msgstr ""
#: noindex-seo.php
msgid "General"
msgstr ""
#: noindex-seo.php
msgid "SEO Settings"
msgstr ""
#: noindex-seo.php
msgid "Import / Export"
msgstr ""
#: noindex-seo.php
msgid "Settings sections"
msgstr ""

View file

@ -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.2.0
* Version: 3.3.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.2.0' );
define( 'NOINDEX_SEO_VERSION', '3.3.0' );
/**
* Option key holding the consolidated plugin settings array.
@ -1770,8 +1770,10 @@ function noindex_seo_get_foreign_robots_callbacks() {
* It first verifies the current user's capability and nonce for security. Then it resets all
* registered options to `0`, and selectively updates those submitted as checked in the form.
*
* Additionally, it updates the general configuration settings,
* clears the plugin's transient cache, and redirects back to the settings page.
* The settings page is tabbed (General / SEO Settings), and only the active
* tab's fields are present in the POST body. The form carries a
* `noindex_seo_form_scope` marker so the handler knows which group to
* process and preserves the values of the other group untouched.
*
* Hooked to the {@see 'admin_post_update_noindex_seo'} action.
*
@ -1780,6 +1782,9 @@ function noindex_seo_get_foreign_robots_callbacks() {
* @since 3.1.5 Nonce verification split out of the capability check:
* check_admin_referer() dies on failure instead of returning
* false, so `! check_admin_referer()` was dead code.
* @since 3.3.0 Tab-scoped processing: 'settings' saves only the directive
* grid, 'general' only the configuration options; the other
* group is preserved. The redirect returns to the saved tab.
*
* @return void
*/
@ -1789,26 +1794,34 @@ function noindex_seo_process_form() {
}
check_admin_referer( 'update_noindex_seo_nonce' );
// Which tab the form was submitted from. Unknown or missing scope
// defaults to the directive grid (the plugin's main surface).
// phpcs:ignore WordPress.Security.NonceVerification.Missing -- nonce verified above.
$scope = ( isset( $_POST['noindex_seo_form_scope'] ) && is_string( $_POST['noindex_seo_form_scope'] ) )
? sanitize_key( wp_unslash( $_POST['noindex_seo_form_scope'] ) )
: 'settings';
if ( ! in_array( $scope, array( 'general', 'settings' ), true ) ) {
$scope = 'settings';
}
$contexts = noindex_seo_get_contexts();
$directives = array( 'noindex', 'nofollow', 'noarchive', 'nosnippet', 'noimageindex' );
// Get the implementation method to validate field compatibility.
$method_value = ( isset( $_POST['noindex_seo_config_method'] ) && is_string( $_POST['noindex_seo_config_method'] ) )
? sanitize_text_field( wp_unslash( $_POST['noindex_seo_config_method'] ) )
: 'meta';
// Validate method.
$method_value = in_array( $method_value, array( 'meta', 'header', 'both' ), true ) ? $method_value : 'meta';
// Fields that only work with HTTP headers.
$header_only_contexts = array( 'attachment' );
$is_header_enabled = in_array( $method_value, array( 'header', 'both' ), true );
// Start from the current consolidated settings so we only overwrite what
// the form actually touches. The shape is preserved by noindex_seo_update_settings().
$settings = noindex_seo_get_settings();
if ( 'settings' === $scope ) {
// The method select lives on the General tab, so the header-only
// restriction follows the SAVED method, not the POST body.
$saved_method = noindex_seo_get_config( 'method', 'meta' );
$is_header_enabled = in_array( $saved_method, array( 'header', 'both' ), true );
// Process checkbox grid: one entry per (context, directive).
// phpcs:disable WordPress.Security.NonceVerification.Missing -- nonce verified above.
foreach ( $contexts as $context ) {
foreach ( $directives as $directive ) {
$option_key = $directive . '_seo_' . $context;
@ -1827,6 +1840,16 @@ function noindex_seo_process_form() {
$settings['contexts'][ $context ][ $directive ] = ( '1' === $option_value ) ? 1 : 0;
}
}
// phpcs:enable WordPress.Security.NonceVerification.Missing
} else {
// phpcs:disable WordPress.Security.NonceVerification.Missing -- nonce verified above.
// Get the implementation method to validate field compatibility.
$method_value = ( isset( $_POST['noindex_seo_config_method'] ) && is_string( $_POST['noindex_seo_config_method'] ) )
? sanitize_text_field( wp_unslash( $_POST['noindex_seo_config_method'] ) )
: 'meta';
// Validate method.
$settings['config']['method'] = in_array( $method_value, array( 'meta', 'header', 'both' ), true ) ? $method_value : 'meta';
// Save general configuration values.
$config_value = ( isset( $_POST['noindex_seo_config_seoplugins'] ) && is_string( $_POST['noindex_seo_config_seoplugins'] ) )
@ -1834,9 +1857,6 @@ function noindex_seo_process_form() {
: 0;
$settings['config']['seoplugins'] = ( 1 === $config_value ) ? 1 : 0;
// Implementation method (validated above).
$settings['config']['method'] = $method_value;
// Granular control.
$granular_value = ( isset( $_POST['noindex_seo_config_granular'] ) && is_string( $_POST['noindex_seo_config_granular'] ) )
? absint( $_POST['noindex_seo_config_granular'] )
@ -1854,13 +1874,25 @@ function noindex_seo_process_form() {
? absint( $_POST['noindex_seo_config_delete_on_uninstall'] )
: 0;
$settings['config']['delete_on_uninstall'] = ( 1 === $delete_value ) ? 1 : 0;
// phpcs:enable WordPress.Security.NonceVerification.Missing
// Keep the header-only invariant consistent with the (possibly just
// changed) method: attachment directives cannot survive a method
// that does not send HTTP headers.
$is_header_enabled = in_array( $settings['config']['method'], array( 'header', 'both' ), true );
if ( ! $is_header_enabled ) {
foreach ( $directives as $directive ) {
$settings['contexts']['attachment'][ $directive ] = 0;
}
}
}
// Persist. This fires update_option_noindex_seo_settings, which clears the
// transient via noindex_seo_invalidate_cache_on_settings_update() — so we
// no longer need to delete_transient() by hand here.
noindex_seo_update_settings( $settings );
wp_safe_redirect( admin_url( 'options-general.php?page=noindex_seo&updated=true' ) );
wp_safe_redirect( admin_url( 'options-general.php?page=noindex_seo&tab=' . $scope . '&updated=true' ) );
exit;
}
add_action( 'admin_post_update_noindex_seo', 'noindex_seo_process_form' );
@ -1881,6 +1913,7 @@ add_action( 'admin_post_update_noindex_seo', 'noindex_seo_process_form' );
*
* @since 3.0.0
* @since 3.1.5 Same nonce-verification split as noindex_seo_process_form().
* @since 3.3.0 Redirects back to the SEO Settings tab.
*
* @return void
*/
@ -1901,7 +1934,7 @@ function noindex_seo_process_apply_suggestions() {
noindex_seo_update_settings( $settings );
wp_safe_redirect( admin_url( 'options-general.php?page=noindex_seo&suggestions_applied=1' ) );
wp_safe_redirect( admin_url( 'options-general.php?page=noindex_seo&tab=settings&suggestions_applied=1' ) );
exit;
}
add_action( 'admin_post_noindex_seo_apply_suggestions', 'noindex_seo_process_apply_suggestions' );
@ -2019,6 +2052,7 @@ function noindex_seo_sanitize_imported_settings( $raw ) {
* Hooked to the {@see 'admin_post_noindex_seo_import'} action.
*
* @since 3.2.0
* @since 3.3.0 Redirects back to the Import / Export tab.
*
* @return void
*/
@ -2028,7 +2062,7 @@ function noindex_seo_handle_import() {
}
check_admin_referer( 'noindex_seo_import' );
$redirect_error = admin_url( 'options-general.php?page=noindex_seo&import_error=1' );
$redirect_error = admin_url( 'options-general.php?page=noindex_seo&tab=tools&import_error=1' );
// The upload is validated immediately below (error code, size, is_uploaded_file) and its
// contents go through strict JSON shape validation before anything is persisted.
@ -2064,7 +2098,7 @@ function noindex_seo_handle_import() {
noindex_seo_update_settings( $settings );
wp_safe_redirect( admin_url( 'options-general.php?page=noindex_seo&imported=1' ) );
wp_safe_redirect( admin_url( 'options-general.php?page=noindex_seo&tab=tools&imported=1' ) );
exit;
}
add_action( 'admin_post_noindex_seo_import', 'noindex_seo_handle_import' );
@ -3290,19 +3324,24 @@ add_action(
);
/**
* Renders the modern, visual settings page for the 'noindex SEO' plugin.
* Renders the settings page for the 'noindex SEO' plugin.
*
* This function outputs a completely redesigned admin interface with:
* - Modern card-based layout
* - Toggle switches instead of checkboxes
* - Tabbed navigation for better organization
* - Visual indicators and badges
* - Collapsible sections
* - Search/filter functionality
* - Statistics dashboard
* The page uses the native WordPress tab navigation (`nav-tab-wrapper` /
* `nav-tab`, the same pattern as the core Updates and Plugins screens):
* URL-based switching via the `tab` query parameter, with the active
* panel rendered server-side. No custom tab CSS or JavaScript.
*
* Tabs:
* - general: implementation method and general configuration options.
* - settings: the directive grid (contexts x directives) with stats,
* search and the "Apply Recommended Defaults" action.
* - tools: the JSON export / import forms.
*
* @since 1.0.0
* @since 2.0.0 Completely redesigned with modern UI/UX.
* @since 3.3.0 Reorganized into native WordPress nav tabs; the form
* handler became tab-scoped so saving one tab never
* resets the values of the other.
*
* @return void
*/
@ -3316,6 +3355,18 @@ function noindex_seo_admin() {
);
}
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- read-only navigation state, not form data.
$current_tab = isset( $_GET['tab'] ) && is_string( $_GET['tab'] ) ? sanitize_key( wp_unslash( $_GET['tab'] ) ) : 'general';
if ( ! in_array( $current_tab, array( 'general', 'settings', 'tools' ), true ) ) {
$current_tab = 'general';
}
$tabs = array(
'general' => __( 'General', 'noindex-seo' ),
'settings' => __( 'SEO Settings', 'noindex-seo' ),
'tools' => __( 'Import / Export', 'noindex-seo' ),
);
// Define section icons (using Dashicons)..
$section_icons = array(
'main_pages' => 'dashicons-admin-home',
@ -3627,94 +3678,32 @@ function noindex_seo_admin() {
}
?>
<!-- "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' ) ); ?>" class="noindex-seo-apply-form">
<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' ),
)
// Native WordPress tab navigation (core nav-tab classes, URL-based).
$page_url = admin_url( 'options-general.php?page=noindex_seo' );
echo '<nav class="nav-tab-wrapper" aria-label="' . esc_attr__( 'Settings sections', 'noindex-seo' ) . '">';
foreach ( $tabs as $tab_slug => $tab_label ) {
printf(
'<a href="%s" class="nav-tab%s">%s</a>',
esc_url( add_query_arg( 'tab', $tab_slug, $page_url ) ),
$tab_slug === $current_tab ? ' nav-tab-active' : '',
esc_html( $tab_label )
);
}
echo '</nav>';
?>
<span class="description noindex-seo-apply-note">
<?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>
<!-- Export / Import — standalone sibling forms, never nested inside
the main settings form (HTML5 forbids nested <form> elements). -->
<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" class="noindex-seo-apply-form">
<input type="hidden" name="action" value="noindex_seo_export">
<?php wp_nonce_field( 'noindex_seo_export' ); ?>
<?php
submit_button(
__( 'Export settings', 'noindex-seo' ),
'secondary',
'noindex-seo-export',
false
);
?>
<span class="description noindex-seo-apply-note">
<?php esc_html_e( 'Download the current settings as a JSON file.', 'noindex-seo' ); ?>
</span>
</form>
<?php if ( 'general' === $current_tab ) : ?>
<form method="post" enctype="multipart/form-data" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" class="noindex-seo-apply-form">
<input type="hidden" name="action" value="noindex_seo_import">
<?php wp_nonce_field( 'noindex_seo_import' ); ?>
<label for="noindex_seo_import_file" class="noindex-seo-config-label">
<?php esc_html_e( 'Import settings', 'noindex-seo' ); ?>
</label>
<input
type="file"
id="noindex_seo_import_file"
name="noindex_seo_import_file"
accept=".json,application/json"
>
<?php
submit_button(
__( 'Import settings', 'noindex-seo' ),
'secondary',
'noindex-seo-import',
false
);
?>
<span class="description noindex-seo-apply-note">
<?php esc_html_e( 'Restore the global settings from a previously exported JSON file. Per-post and per-term overrides are kept.', 'noindex-seo' ); ?>
</span>
</form>
<!-- Main settings form: wraps stats, config, alert, search, sections, submit. -->
<!-- General tab: implementation method and configuration options.
Own instance of the main form (scoped to this tab) so saving
from here never touches the directive grid of the SEO Settings
tab, and vice versa. -->
<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
<input type="hidden" name="action" value="update_noindex_seo">
<input type="hidden" name="noindex_seo_form_scope" value="general">
<?php wp_nonce_field( 'update_noindex_seo_nonce' ); ?>
<!-- Statistics Dashboard -->
<div class="noindex-seo-stats">
<div class="noindex-seo-stat-card">
<div class="noindex-seo-stat-number" id="noindex-seo-stat-total">0</div>
<div class="noindex-seo-stat-label"><?php esc_html_e( 'Total Options', 'noindex-seo' ); ?></div>
</div>
<div class="noindex-seo-stat-card">
<div class="noindex-seo-stat-number" id="noindex-seo-stat-enabled">0</div>
<div class="noindex-seo-stat-label"><?php esc_html_e( 'Enabled', 'noindex-seo' ); ?></div>
</div>
<div class="noindex-seo-stat-card">
<div class="noindex-seo-stat-number" id="noindex-seo-stat-recommended">0</div>
<div class="noindex-seo-stat-label"><?php esc_html_e( 'Recommended to Enable', 'noindex-seo' ); ?></div>
</div>
</div>
<!-- General Configuration -->
<div class="noindex-seo-general-config">
<h2>
@ -3827,6 +3816,63 @@ function noindex_seo_admin() {
</div>
</div>
<?php submit_button(); ?>
</form>
<?php endif; ?>
<?php if ( 'settings' === $current_tab ) : ?>
<!-- Recommended settings: one-click defaults. Standalone sibling
form, never nested inside the main settings form (HTML5 forbids
nested <form> elements). -->
<h2 class="noindex-seo-section-title"><?php esc_html_e( 'Recommended settings', 'noindex-seo' ); ?></h2>
<p class="description">
<?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' ); ?>
</p>
<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" class="noindex-seo-apply-form">
<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' ),
)
);
?>
</form>
<!-- Directive grid form (scoped to the settings tab): stats, alert,
search, section cards, submit. -->
<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>">
<input type="hidden" name="action" value="update_noindex_seo">
<input type="hidden" name="noindex_seo_form_scope" value="settings">
<?php wp_nonce_field( 'update_noindex_seo_nonce' ); ?>
<!-- Overview: the number cards. -->
<h2 class="noindex-seo-section-title"><?php esc_html_e( 'Overview', 'noindex-seo' ); ?></h2>
<div class="noindex-seo-stats">
<div class="noindex-seo-stat-card">
<div class="noindex-seo-stat-number" id="noindex-seo-stat-total">0</div>
<div class="noindex-seo-stat-label"><?php esc_html_e( 'Total Options', 'noindex-seo' ); ?></div>
</div>
<div class="noindex-seo-stat-card">
<div class="noindex-seo-stat-number" id="noindex-seo-stat-enabled">0</div>
<div class="noindex-seo-stat-label"><?php esc_html_e( 'Enabled', 'noindex-seo' ); ?></div>
</div>
<div class="noindex-seo-stat-card">
<div class="noindex-seo-stat-number" id="noindex-seo-stat-recommended">0</div>
<div class="noindex-seo-stat-label"><?php esc_html_e( 'Recommended to Enable', 'noindex-seo' ); ?></div>
</div>
</div>
<!-- Page contexts: the directive grid. -->
<h2 class="noindex-seo-section-title"><?php esc_html_e( 'Page contexts', 'noindex-seo' ); ?></h2>
<!-- Alert -->
<div class="noindex-seo-alert">
<span class="dashicons dashicons-warning"></span>
@ -3915,6 +3961,57 @@ function noindex_seo_admin() {
<?php submit_button(); ?>
</form>
<?php endif; ?>
<?php if ( 'tools' === $current_tab ) : ?>
<!-- Export: download the current settings as a JSON file. -->
<h2 class="noindex-seo-section-title"><?php esc_html_e( 'Export settings', 'noindex-seo' ); ?></h2>
<p class="description">
<?php esc_html_e( 'Download the current settings as a JSON file.', 'noindex-seo' ); ?>
</p>
<form method="post" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" class="noindex-seo-apply-form">
<input type="hidden" name="action" value="noindex_seo_export">
<?php wp_nonce_field( 'noindex_seo_export' ); ?>
<?php
submit_button(
__( 'Export settings', 'noindex-seo' ),
'secondary',
'noindex-seo-export',
false
);
?>
</form>
<!-- Import: restore the global settings from a previous export. -->
<h2 class="noindex-seo-section-title"><?php esc_html_e( 'Import settings', 'noindex-seo' ); ?></h2>
<p class="description">
<?php esc_html_e( 'Restore the global settings from a previously exported JSON file. Per-post and per-term overrides are kept.', 'noindex-seo' ); ?>
</p>
<form method="post" enctype="multipart/form-data" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" class="noindex-seo-apply-form">
<input type="hidden" name="action" value="noindex_seo_import">
<?php wp_nonce_field( 'noindex_seo_import' ); ?>
<label for="noindex_seo_import_file" class="noindex-seo-config-label">
<?php esc_html_e( 'Import settings', 'noindex-seo' ); ?>
</label>
<input
type="file"
id="noindex_seo_import_file"
name="noindex_seo_import_file"
accept=".json,application/json"
>
<?php
submit_button(
__( 'Import settings', 'noindex-seo' ),
'secondary',
'noindex-seo-import',
false
);
?>
</form>
<?php endif; ?>
</div>
<?php

View file

@ -3,9 +3,9 @@ Contributors: robotstxt, javiercasares
Tags: seo, noindex, nofollow, noarchive, robots
Requires at least: 4.7
Tested up to: 7.2
Stable tag: 3.2.0
Stable tag: 3.3.0
Requires PHP: 5.6
Version: 3.2.0
Version: 3.3.0
License: GPL-3.0-or-later
License URI: https://www.gnu.org/licenses/gpl-3.0.txt
@ -143,6 +143,10 @@ No. By default all plugin data is preserved on uninstall. If you want a complete
== Changelog ==
= 3.3.0 =
Settings page reorganized with the native WordPress tab navigation (General / SEO Settings / Import-Export, no custom tab code) and titled sections; saving is tab-scoped so hidden tabs never reset each other's values.
= 3.2.0 =
Feature release: JSON export/import of the settings (validated, sanitized, per-post and per-term overrides untouched) and runtime conflict verification against the `wp_robots` API (foreign callbacks named in a dismissible notice).
@ -151,10 +155,6 @@ Feature release: JSON export/import of the settings (validated, sanitized, per-p
Admin UI modernization: all inline styles removed in favour of WordPress admin color-scheme-aware, RTL-ready classes (follows the admin color schemes instead of hardcoded colors); stale form-handler message corrected; unreachable REST fallbacks removed; Catalan and Spanish translations updated.
= 3.1.5 =
Maintenance review: WordPress floor corrected to 4.7 (oldest tested version, first with the complete REST API) and tested up to 7.2; nonce verification in the form handlers split into a capability check plus a standalone `check_admin_referer()`; dev dependencies updated; test suite expanded to 147 tests with 94.78% coverage.
= Previous versions =
If you want to see the full changelog, visit the [noindex SEO plugin page](https://www.robotstxt.software/plugins/noindex-seo/).
@ -175,6 +175,6 @@ This plugin adheres to the following security measures and review protocols for
== Vulnerabilities ==
* No vulnerabilities have been published up to version 3.2.0.
* No vulnerabilities have been published up to version 3.3.0.
Found a security vulnerability? Please report it to us privately at the [noindex SEO GitHub repository](https://github.com/javiercasares/noindex-seo/security/advisories/new).