Plugin Directory

Changeset 3061445


Ignore:
Timestamp:
03/30/2024 08:13:54 AM (23 months ago)
Author:
ABCdatos
Message:

1.0.5 version

Location:
magic-robots-txt
Files:
2 deleted
5 edited
11 copied
1 moved

Legend:

Unmodified
Added
Removed
  • magic-robots-txt

    • Property svn:ignore set to
      .svnignore
      composer.json
      composer.lock
      vendor
  • magic-robots-txt/tags/1.0.5/admin/opciones.php

    r2968365 r3061445  
    2626    }
    2727
     28    // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode -- Base64 encoding used for SVG icon; considered safe.
     29    $icono_base64 = 'data:image/svg+xml;base64,' . base64_encode( '<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 511.999 511.999" style="fill:#a7aaad" xml:space="preserve"><g><g><path d="M424.464,226.038h-31.289c-4.637,0-8.394,3.758-8.394,8.394v17.485H370.51v-17.485c0-4.636-3.757-8.394-8.394-8.394h-34.743v-17.351h34.743c4.637,0,8.394-3.758,8.394-8.394V66.121c0-20.285-16.502-36.787-36.787-36.787h-69.329V8.394c0-4.636-3.757-8.394-8.394-8.394c-4.637,0-8.394,3.758-8.394,8.394v20.939h-69.33c-20.285,0-36.787,16.503-36.787,36.787v134.173c0,4.636,3.757,8.394,8.394,8.394h34.744v17.351h-34.744c-4.637,0-8.394,3.758-8.394,8.394v17.485h-14.271v-17.485c0-4.636-3.757-8.394-8.394-8.394h-31.29c-4.637,0-8.394,3.758-8.394,8.394v169.096c0,4.636,3.757,8.394,8.394,8.394h31.289c4.637,0,8.394-3.758,8.394-8.394V303.215h14.271v68.203c0,4.636,3.757,8.394,8.394,8.394h14.9v75.713h-10.586c-4.637,0-8.394,3.758-8.394,8.394v39.686c0,4.636,3.757,8.394,8.394,8.394h70.744c4.637,0,8.394-3.758,8.394-8.394v-39.686c0-4.636-3.757-8.394-8.394-8.394h-10.585v-75.713h83.289v75.713h-10.586c-4.637,0-8.394,3.758-8.394,8.394v39.686c0,4.636,3.757,8.394,8.394,8.394h70.744c4.637,0,8.394-3.758,8.394-8.394v-39.686c0-4.636-3.757-8.394-8.394-8.394h-10.585v-75.713h14.9c4.637,0,8.394-3.758,8.394-8.394v-68.203h14.271v100.312c0,4.636,3.757,8.394,8.394,8.394h31.289c4.637,0,8.394-3.758,8.394-8.394V234.431C432.857,229.796,429.1,226.038,424.464,226.038z M110.43,395.134H95.929V242.826h14.501V395.134z M141.489,286.428h-14.271v-17.723h14.271V286.428z M158.276,191.9V66.121c0-11.028,8.972-20,20-20h155.447c11.028,0,20,8.972,20,20V191.9H158.276z M310.586,208.686v17.351H201.414v-17.351H310.586z M216.547,472.314v22.898h-53.957v-22.898H216.547z M181.571,455.526v-75.713h15.998v75.713H181.571z M349.409,472.314v22.898h-53.957v-22.898H349.409zM314.433,455.526v-75.713h15.998v75.713h0H314.433z M353.723,363.024H158.276V242.826h195.446V363.024z M384.781,286.428H370.51v-17.723h14.271V286.428z M416.07,395.134h-14.501V242.826h14.501V395.134z"/></g></g><g><g><path d="M204.236,84.744c-20.803,0-37.727,16.924-37.727,37.726c0,20.802,16.924,37.726,37.727,37.726c20.802,0.001,37.726-16.923,37.726-37.726C241.963,101.668,225.039,84.744,204.236,84.744z M204.236,143.409c-11.545,0-20.94-9.392-20.94-20.939c0-11.545,9.394-20.939,20.94-20.939c11.545,0,20.939,9.393,20.939,20.939C225.175,134.016,215.782,143.409,204.236,143.409z"/></g></g><g><g><path d="M307.765,84.744c-20.803,0-37.727,16.924-37.727,37.726c0,20.802,16.924,37.727,37.727,37.727c20.802,0,37.726-16.924,37.726-37.726S328.567,84.744,307.765,84.744z M307.765,143.409c-11.545,0-20.94-9.393-20.94-20.939c0-11.545,9.393-20.939,20.94-20.939c11.545,0,20.939,9.393,20.939,20.939C328.703,134.016,319.31,143.409,307.765,143.409z"/></g></g><g><g><path d="M256.001,270.9c-30.317,0-54.982,24.664-54.982,54.982c0,4.636,3.757,8.394,8.394,8.394h93.176c4.637,0,8.394-3.758,8.394-8.394C310.982,295.565,286.318,270.9,256.001,270.9z M218.735,317.488c3.835-17.036,19.089-29.8,37.265-29.8c18.177,0,33.43,12.764,37.265,29.8H218.735z"/></g></g><g><g><circle cx="326.744" cy="267.215" r="8.394"/></g></g><g><g><circle cx="185.257" cy="267.215" r="8.394"/></g></g></svg>' );
    2830    add_menu_page(
    2931        __( 'Magic robots.txt', 'magic-robots-txt' ) . ' - ' . __( 'Settings', 'magic-robots-txt' ), // Page title.
    3032        __( 'Magic robots.txt', 'magic-robots-txt' ) . wp_kses_post( $notificacion_globo ),
    31         'administrator',                                                      // Capability.
     33        'manage_options',                                                     // Capability.
    3234        'magic-robots-txt',                                                   // Menu slug.
    3335        'mrt_admin',                                                          // Function.
    34         'data:image/svg+xml;base64,' . base64_encode( '<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 511.999 511.999" style="fill:#a7aaad" xml:space="preserve"><g><g><path d="M424.464,226.038h-31.289c-4.637,0-8.394,3.758-8.394,8.394v17.485H370.51v-17.485c0-4.636-3.757-8.394-8.394-8.394h-34.743v-17.351h34.743c4.637,0,8.394-3.758,8.394-8.394V66.121c0-20.285-16.502-36.787-36.787-36.787h-69.329V8.394c0-4.636-3.757-8.394-8.394-8.394c-4.637,0-8.394,3.758-8.394,8.394v20.939h-69.33c-20.285,0-36.787,16.503-36.787,36.787v134.173c0,4.636,3.757,8.394,8.394,8.394h34.744v17.351h-34.744c-4.637,0-8.394,3.758-8.394,8.394v17.485h-14.271v-17.485c0-4.636-3.757-8.394-8.394-8.394h-31.29c-4.637,0-8.394,3.758-8.394,8.394v169.096c0,4.636,3.757,8.394,8.394,8.394h31.289c4.637,0,8.394-3.758,8.394-8.394V303.215h14.271v68.203c0,4.636,3.757,8.394,8.394,8.394h14.9v75.713h-10.586c-4.637,0-8.394,3.758-8.394,8.394v39.686c0,4.636,3.757,8.394,8.394,8.394h70.744c4.637,0,8.394-3.758,8.394-8.394v-39.686c0-4.636-3.757-8.394-8.394-8.394h-10.585v-75.713h83.289v75.713h-10.586c-4.637,0-8.394,3.758-8.394,8.394v39.686c0,4.636,3.757,8.394,8.394,8.394h70.744c4.637,0,8.394-3.758,8.394-8.394v-39.686c0-4.636-3.757-8.394-8.394-8.394h-10.585v-75.713h14.9c4.637,0,8.394-3.758,8.394-8.394v-68.203h14.271v100.312c0,4.636,3.757,8.394,8.394,8.394h31.289c4.637,0,8.394-3.758,8.394-8.394V234.431C432.857,229.796,429.1,226.038,424.464,226.038z M110.43,395.134H95.929V242.826h14.501V395.134z M141.489,286.428h-14.271v-17.723h14.271V286.428z M158.276,191.9V66.121c0-11.028,8.972-20,20-20h155.447c11.028,0,20,8.972,20,20V191.9H158.276z M310.586,208.686v17.351H201.414v-17.351H310.586z M216.547,472.314v22.898h-53.957v-22.898H216.547z M181.571,455.526v-75.713h15.998v75.713H181.571z M349.409,472.314v22.898h-53.957v-22.898H349.409zM314.433,455.526v-75.713h15.998v75.713h0H314.433z M353.723,363.024H158.276V242.826h195.446V363.024z M384.781,286.428H370.51v-17.723h14.271V286.428z M416.07,395.134h-14.501V242.826h14.501V395.134z"/></g></g><g><g><path d="M204.236,84.744c-20.803,0-37.727,16.924-37.727,37.726c0,20.802,16.924,37.726,37.727,37.726c20.802,0.001,37.726-16.923,37.726-37.726C241.963,101.668,225.039,84.744,204.236,84.744z M204.236,143.409c-11.545,0-20.94-9.392-20.94-20.939c0-11.545,9.394-20.939,20.94-20.939c11.545,0,20.939,9.393,20.939,20.939C225.175,134.016,215.782,143.409,204.236,143.409z"/></g></g><g><g><path d="M307.765,84.744c-20.803,0-37.727,16.924-37.727,37.726c0,20.802,16.924,37.727,37.727,37.727c20.802,0,37.726-16.924,37.726-37.726S328.567,84.744,307.765,84.744z M307.765,143.409c-11.545,0-20.94-9.393-20.94-20.939c0-11.545,9.393-20.939,20.94-20.939c11.545,0,20.939,9.393,20.939,20.939C328.703,134.016,319.31,143.409,307.765,143.409z"/></g></g><g><g><path d="M256.001,270.9c-30.317,0-54.982,24.664-54.982,54.982c0,4.636,3.757,8.394,8.394,8.394h93.176c4.637,0,8.394-3.758,8.394-8.394C310.982,295.565,286.318,270.9,256.001,270.9z M218.735,317.488c3.835-17.036,19.089-29.8,37.265-29.8c18.177,0,33.43,12.764,37.265,29.8H218.735z"/></g></g><g><g><circle cx="326.744" cy="267.215" r="8.394"/></g></g><g><g><circle cx="185.257" cy="267.215" r="8.394"/></g></g></svg>' )         // Icon.
     36        'data:image/svg+xml;base64,' . $icono_base64,                         // Icon.
    3537    );
    3638}
     
    8284function mrt_logo( $alturacss = '30px' ) {
    8385    $html  = '<img src="';
    84     $html .= plugin_dir_url( dirname( __FILE__ ) ) . 'admin/images/robot.svg';
     86    $html .= plugin_dir_url( __DIR__ ) . 'admin/images/robot.svg';
    8587    $html .= '" style="width:auto;height:';
    8688    $html .= $alturacss;
     
    122124        mrt_echo_debug_info();
    123125    }
    124 
    125 }
     126}
     127
     128/**
     129 * Maneja acciones posteriores a la actualización de opciones específicas del plugin.
     130 *
     131 * Esta función se engancha en la acción `updated_option` de WordPress y establece
     132 * un transitorio cuando se actualiza una opción relacionada con el plugin 'Magic robots.txt'.
     133 * Esto permite realizar acciones solo una vez después de que las opciones relevantes
     134 * han sido actualizadas, como regenerar archivos o limpiar cachés.
     135 *
     136 * @param string $option_name El nombre de la opción que se ha actualizado. Se espera que
     137 *                            comience con 'mrt_' para las opciones relevantes del plugin.
     138 */
     139function mrt_on_option_update( $option_name ) {
     140    // Comprueba si la opción actualizada es relevante para el plugin.
     141    if ( false !== strpos( $option_name, 'mrt_' ) ) {
     142        // Establece un transitorio para indicar que una opción relevante ha sido actualizada.
     143        // El transitorio 'mrt_settings_updated' se usa para desencadenar acciones específicas
     144        // del plugin que solo deben ocurrir después de la actualización de la configuración.
     145        set_transient( 'mrt_settings_updated', 'yes', 30 );
     146    }
     147}
     148// Engancha la función al hook 'updated_option' de WordPress.
     149add_action( 'updated_option', 'mrt_on_option_update', 10, 1 );
    126150
    127151/** Funcionalidad de la página de ajustes. */
     
    133157
    134158    // Gestión de uso de archivo físico.
    135     if ( isset( $_GET['settings-updated'] ) ) {
     159    // if ( isset( $_GET['settings-updated'] ) ) {
     160    // Mediante el transitorio creado en mrt_on_option_update, sabremso que se grabaron las opciones sin requerir
     161    // el acceso a $_GET y el consiguiente requisito de nonce de WPCS.
     162    if ( get_transient( 'mrt_settings_updated' ) ) {
    136163        // Grabando ajustes es el momento de editar el archivo robots.txt físico si corresponde.
    137164        // Solo si (está configurado hacerlo o es forzoso) y se puede.
     
    150177            }
    151178        }
     179        delete_transient( 'mrt_settings_updated' ); // Liquida el transitorio.
    152180    }
    153181
     
    269297    if ( mrt_conf_carga() ) {
    270298        $nivel_carga = mrt_conf_carga();
    271     } else {
    272         if ( mrt_carga_calculable() ) {
    273             // Considera el nivel obtenido si es posible.
    274             echo esc_html( ucfirst( __( 'the server load detected is', 'magic-robots-txt' ) ) . ' ' );
    275             $carga       = mrt_carga_15();
    276             $nivel_carga = mrt_nivel_carga( $carga );
    277             echo esc_html( ucfirst( mrt_texto_carga( $nivel_carga ) ) );
    278             echo ".<br />\n";
    279             // Considera el nivel por omisión si no es posible obtenerlo.
    280         } else {
    281             $carga       = mrt_carga_omision();
    282             $nivel_carga = mrt_nivel_carga( $carga );
    283             echo esc_html( ucfirst( __( 'server load can\'t be detected', 'magic-robots-txt' ) ) . '. ' );
    284             /* translators: %s: Load average number. */
    285             echo esc_html( ucfirst( sprintf( __( 'don\'t worry, estimating a %s value', 'magic-robots-txt' ), mrt_texto_carga( $nivel_carga ) ) ) . ' ' );
    286             esc_html_e( 'does the trick', 'magic-robots-txt' );
    287             echo ".<br /><br />\n";
    288         }
     299    } elseif ( mrt_carga_calculable() ) {
     300        // Considera el nivel obtenido si es posible.
     301        echo esc_html( ucfirst( __( 'the server load detected is', 'magic-robots-txt' ) ) . ' ' );
     302        $carga       = mrt_carga_15();
     303        $nivel_carga = mrt_nivel_carga( $carga );
     304        echo esc_html( ucfirst( mrt_texto_carga( $nivel_carga ) ) );
     305        echo ".<br />\n";
     306        // Considera el nivel por omisión si no es posible obtenerlo.
     307    } else {
     308        $carga       = mrt_carga_omision();
     309        $nivel_carga = mrt_nivel_carga( $carga );
     310        echo esc_html( ucfirst( __( 'server load can\'t be detected', 'magic-robots-txt' ) ) . '. ' );
     311        /* translators: %s: Load average number. */
     312        echo esc_html( ucfirst( sprintf( __( 'don\'t worry, estimating a %s value', 'magic-robots-txt' ), mrt_texto_carga( $nivel_carga ) ) ) . ' ' );
     313        esc_html_e( 'does the trick', 'magic-robots-txt' );
     314        echo ".<br /><br />\n";
    289315    }
    290316    echo '<input type="radio" name="mrt_carga" value="4" ' . checked( '4', $nivel_carga, false ) . '>';
     
    719745    echo esc_html( mrt_subdirectorio_wp() );
    720746    echo '<br />';
    721 
    722 }
     747}
  • magic-robots-txt/tags/1.0.5/lista-opciones.php

    r2968365 r3061445  
    2222        'mrt_carga',
    2323        'mrt_ahorro',
    24         // 'mrt_sitio_publico',
    2524        'mrt_venta_publicidad',
    2625        'mrt_venta_enlaces',
  • magic-robots-txt/tags/1.0.5/magic-robots-txt.php

    r3018300 r3061445  
    44 * Plugin URI:  https://taller.abcdatos.net/robots-txt-wordpress/
    55 * Description: Manages robots access control via robots.txt
    6  * Version:     1.0.4
     6 * Version:     1.0.5
    77 * Author:      ABCdatos
    88 * Author URI:  https://taller.abcdatos.net/
     
    1919/** Requerido o se obtiene error Plugin is not compatible with language packs: Missing load_plugin_textdomain(). en el canal de Slack #meta-language-packs. */
    2020function mrt_load_plugin_textdomain() {
    21     load_plugin_textdomain( 'magic-robots-txt', false, basename( dirname( __FILE__ ) ) . '/languages' );
     21    load_plugin_textdomain( 'magic-robots-txt', false, basename( __DIR__ ) . '/languages' );
    2222}
    2323add_action( 'plugins_loaded', 'mrt_load_plugin_textdomain' );
     
    2727require_once plugin_dir_path( __FILE__ ) . 'includes/publicidad.php';
    2828// Lista de variables usadas en tabla options.
    29 require_once plugin_dir_path( __FILE__ ) . 'lista_opciones.php';
     29require_once plugin_dir_path( __FILE__ ) . 'lista-opciones.php';
    3030// Funciones sobre el contenido del archivo robots.txt.
    3131require_once plugin_dir_path( __FILE__ ) . 'includes/robots.php';
     
    5555            $nuevo_sitemap .= '# Debug mode: ' . ucfirst( __( 'already have sitemap', 'magic-robots-txt' ) ) . "\n";
    5656        }
    57     } else {
    58         if ( mrt_sitemaps_enabled() ) {
    59             $nuevo_sitemap .= 'Sitemap: ' . mrt_sitemap_wp_url() . "\n\n";
    60         } elseif ( WP_DEBUG ) {
    61             $nuevo_sitemap .= '# Debug mode: ' . ucfirst( __( 'disabled sitemap', 'magic-robots-txt' ) ) . "\n";
    62         }
     57    } elseif ( mrt_sitemaps_enabled() ) {
     58        $nuevo_sitemap .= 'Sitemap: ' . mrt_sitemap_wp_url() . "\n\n";
     59    } elseif ( WP_DEBUG ) {
     60        $nuevo_sitemap .= '# Debug mode: ' . ucfirst( __( 'disabled sitemap', 'magic-robots-txt' ) ) . "\n";
    6361    }
    6462
  • magic-robots-txt/tags/1.0.5/readme.txt

    r3018299 r3061445  
    33Tags: robots,robots.txt,seo,google,bots
    44Requires at least: 4.2
    5 Tested up to: 6.4
    6 Stable tag: 1.0.3
     5Tested up to: 6.5
     6Stable tag: 1.0.5
    77Requires PHP: 5.4
    88License: GPLv2
     
    9595== Changelog ==
    9696
     97= 1.0.5 =
     98*Mar 30 2024*
     99* Changed the required capability to access the settings page.
     100* Improved settings update mechanism for conditional real robots.txt file generation.
     101* Minor code improvements.
     102* WordPress 6.5 basic compatibility checked.
     103
    97104= 1.0.4 =
    98 *Jan 06 2024*
     105*Jan 07 2024*
    99106* Added Owler (Open Web Search) to search engines bot list.
    100107* Added netEstate NE Crawler (Sengine) to search engines bot list.
  • magic-robots-txt/tags/1.0.5/uninstall.php

    r2968365 r3061445  
    1515defined( 'WP_UNINSTALL_PLUGIN' ) || die( esc_html( __( 'Access is not allowed.', 'magic-robots-txt' ) ) );
    1616
    17 require_once plugin_dir_path( __FILE__ ) . 'lista_opciones.php';
     17require_once plugin_dir_path( __FILE__ ) . 'lista-opciones.php';
    1818
    1919// Removes all the option values defined in the array.
  • magic-robots-txt/trunk/admin/opciones.php

    r2968365 r3061445  
    2626    }
    2727
     28    // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode -- Base64 encoding used for SVG icon; considered safe.
     29    $icono_base64 = 'data:image/svg+xml;base64,' . base64_encode( '<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 511.999 511.999" style="fill:#a7aaad" xml:space="preserve"><g><g><path d="M424.464,226.038h-31.289c-4.637,0-8.394,3.758-8.394,8.394v17.485H370.51v-17.485c0-4.636-3.757-8.394-8.394-8.394h-34.743v-17.351h34.743c4.637,0,8.394-3.758,8.394-8.394V66.121c0-20.285-16.502-36.787-36.787-36.787h-69.329V8.394c0-4.636-3.757-8.394-8.394-8.394c-4.637,0-8.394,3.758-8.394,8.394v20.939h-69.33c-20.285,0-36.787,16.503-36.787,36.787v134.173c0,4.636,3.757,8.394,8.394,8.394h34.744v17.351h-34.744c-4.637,0-8.394,3.758-8.394,8.394v17.485h-14.271v-17.485c0-4.636-3.757-8.394-8.394-8.394h-31.29c-4.637,0-8.394,3.758-8.394,8.394v169.096c0,4.636,3.757,8.394,8.394,8.394h31.289c4.637,0,8.394-3.758,8.394-8.394V303.215h14.271v68.203c0,4.636,3.757,8.394,8.394,8.394h14.9v75.713h-10.586c-4.637,0-8.394,3.758-8.394,8.394v39.686c0,4.636,3.757,8.394,8.394,8.394h70.744c4.637,0,8.394-3.758,8.394-8.394v-39.686c0-4.636-3.757-8.394-8.394-8.394h-10.585v-75.713h83.289v75.713h-10.586c-4.637,0-8.394,3.758-8.394,8.394v39.686c0,4.636,3.757,8.394,8.394,8.394h70.744c4.637,0,8.394-3.758,8.394-8.394v-39.686c0-4.636-3.757-8.394-8.394-8.394h-10.585v-75.713h14.9c4.637,0,8.394-3.758,8.394-8.394v-68.203h14.271v100.312c0,4.636,3.757,8.394,8.394,8.394h31.289c4.637,0,8.394-3.758,8.394-8.394V234.431C432.857,229.796,429.1,226.038,424.464,226.038z M110.43,395.134H95.929V242.826h14.501V395.134z M141.489,286.428h-14.271v-17.723h14.271V286.428z M158.276,191.9V66.121c0-11.028,8.972-20,20-20h155.447c11.028,0,20,8.972,20,20V191.9H158.276z M310.586,208.686v17.351H201.414v-17.351H310.586z M216.547,472.314v22.898h-53.957v-22.898H216.547z M181.571,455.526v-75.713h15.998v75.713H181.571z M349.409,472.314v22.898h-53.957v-22.898H349.409zM314.433,455.526v-75.713h15.998v75.713h0H314.433z M353.723,363.024H158.276V242.826h195.446V363.024z M384.781,286.428H370.51v-17.723h14.271V286.428z M416.07,395.134h-14.501V242.826h14.501V395.134z"/></g></g><g><g><path d="M204.236,84.744c-20.803,0-37.727,16.924-37.727,37.726c0,20.802,16.924,37.726,37.727,37.726c20.802,0.001,37.726-16.923,37.726-37.726C241.963,101.668,225.039,84.744,204.236,84.744z M204.236,143.409c-11.545,0-20.94-9.392-20.94-20.939c0-11.545,9.394-20.939,20.94-20.939c11.545,0,20.939,9.393,20.939,20.939C225.175,134.016,215.782,143.409,204.236,143.409z"/></g></g><g><g><path d="M307.765,84.744c-20.803,0-37.727,16.924-37.727,37.726c0,20.802,16.924,37.727,37.727,37.727c20.802,0,37.726-16.924,37.726-37.726S328.567,84.744,307.765,84.744z M307.765,143.409c-11.545,0-20.94-9.393-20.94-20.939c0-11.545,9.393-20.939,20.94-20.939c11.545,0,20.939,9.393,20.939,20.939C328.703,134.016,319.31,143.409,307.765,143.409z"/></g></g><g><g><path d="M256.001,270.9c-30.317,0-54.982,24.664-54.982,54.982c0,4.636,3.757,8.394,8.394,8.394h93.176c4.637,0,8.394-3.758,8.394-8.394C310.982,295.565,286.318,270.9,256.001,270.9z M218.735,317.488c3.835-17.036,19.089-29.8,37.265-29.8c18.177,0,33.43,12.764,37.265,29.8H218.735z"/></g></g><g><g><circle cx="326.744" cy="267.215" r="8.394"/></g></g><g><g><circle cx="185.257" cy="267.215" r="8.394"/></g></g></svg>' );
    2830    add_menu_page(
    2931        __( 'Magic robots.txt', 'magic-robots-txt' ) . ' - ' . __( 'Settings', 'magic-robots-txt' ), // Page title.
    3032        __( 'Magic robots.txt', 'magic-robots-txt' ) . wp_kses_post( $notificacion_globo ),
    31         'administrator',                                                      // Capability.
     33        'manage_options',                                                     // Capability.
    3234        'magic-robots-txt',                                                   // Menu slug.
    3335        'mrt_admin',                                                          // Function.
    34         'data:image/svg+xml;base64,' . base64_encode( '<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 511.999 511.999" style="fill:#a7aaad" xml:space="preserve"><g><g><path d="M424.464,226.038h-31.289c-4.637,0-8.394,3.758-8.394,8.394v17.485H370.51v-17.485c0-4.636-3.757-8.394-8.394-8.394h-34.743v-17.351h34.743c4.637,0,8.394-3.758,8.394-8.394V66.121c0-20.285-16.502-36.787-36.787-36.787h-69.329V8.394c0-4.636-3.757-8.394-8.394-8.394c-4.637,0-8.394,3.758-8.394,8.394v20.939h-69.33c-20.285,0-36.787,16.503-36.787,36.787v134.173c0,4.636,3.757,8.394,8.394,8.394h34.744v17.351h-34.744c-4.637,0-8.394,3.758-8.394,8.394v17.485h-14.271v-17.485c0-4.636-3.757-8.394-8.394-8.394h-31.29c-4.637,0-8.394,3.758-8.394,8.394v169.096c0,4.636,3.757,8.394,8.394,8.394h31.289c4.637,0,8.394-3.758,8.394-8.394V303.215h14.271v68.203c0,4.636,3.757,8.394,8.394,8.394h14.9v75.713h-10.586c-4.637,0-8.394,3.758-8.394,8.394v39.686c0,4.636,3.757,8.394,8.394,8.394h70.744c4.637,0,8.394-3.758,8.394-8.394v-39.686c0-4.636-3.757-8.394-8.394-8.394h-10.585v-75.713h83.289v75.713h-10.586c-4.637,0-8.394,3.758-8.394,8.394v39.686c0,4.636,3.757,8.394,8.394,8.394h70.744c4.637,0,8.394-3.758,8.394-8.394v-39.686c0-4.636-3.757-8.394-8.394-8.394h-10.585v-75.713h14.9c4.637,0,8.394-3.758,8.394-8.394v-68.203h14.271v100.312c0,4.636,3.757,8.394,8.394,8.394h31.289c4.637,0,8.394-3.758,8.394-8.394V234.431C432.857,229.796,429.1,226.038,424.464,226.038z M110.43,395.134H95.929V242.826h14.501V395.134z M141.489,286.428h-14.271v-17.723h14.271V286.428z M158.276,191.9V66.121c0-11.028,8.972-20,20-20h155.447c11.028,0,20,8.972,20,20V191.9H158.276z M310.586,208.686v17.351H201.414v-17.351H310.586z M216.547,472.314v22.898h-53.957v-22.898H216.547z M181.571,455.526v-75.713h15.998v75.713H181.571z M349.409,472.314v22.898h-53.957v-22.898H349.409zM314.433,455.526v-75.713h15.998v75.713h0H314.433z M353.723,363.024H158.276V242.826h195.446V363.024z M384.781,286.428H370.51v-17.723h14.271V286.428z M416.07,395.134h-14.501V242.826h14.501V395.134z"/></g></g><g><g><path d="M204.236,84.744c-20.803,0-37.727,16.924-37.727,37.726c0,20.802,16.924,37.726,37.727,37.726c20.802,0.001,37.726-16.923,37.726-37.726C241.963,101.668,225.039,84.744,204.236,84.744z M204.236,143.409c-11.545,0-20.94-9.392-20.94-20.939c0-11.545,9.394-20.939,20.94-20.939c11.545,0,20.939,9.393,20.939,20.939C225.175,134.016,215.782,143.409,204.236,143.409z"/></g></g><g><g><path d="M307.765,84.744c-20.803,0-37.727,16.924-37.727,37.726c0,20.802,16.924,37.727,37.727,37.727c20.802,0,37.726-16.924,37.726-37.726S328.567,84.744,307.765,84.744z M307.765,143.409c-11.545,0-20.94-9.393-20.94-20.939c0-11.545,9.393-20.939,20.94-20.939c11.545,0,20.939,9.393,20.939,20.939C328.703,134.016,319.31,143.409,307.765,143.409z"/></g></g><g><g><path d="M256.001,270.9c-30.317,0-54.982,24.664-54.982,54.982c0,4.636,3.757,8.394,8.394,8.394h93.176c4.637,0,8.394-3.758,8.394-8.394C310.982,295.565,286.318,270.9,256.001,270.9z M218.735,317.488c3.835-17.036,19.089-29.8,37.265-29.8c18.177,0,33.43,12.764,37.265,29.8H218.735z"/></g></g><g><g><circle cx="326.744" cy="267.215" r="8.394"/></g></g><g><g><circle cx="185.257" cy="267.215" r="8.394"/></g></g></svg>' )         // Icon.
     36        'data:image/svg+xml;base64,' . $icono_base64,                         // Icon.
    3537    );
    3638}
     
    8284function mrt_logo( $alturacss = '30px' ) {
    8385    $html  = '<img src="';
    84     $html .= plugin_dir_url( dirname( __FILE__ ) ) . 'admin/images/robot.svg';
     86    $html .= plugin_dir_url( __DIR__ ) . 'admin/images/robot.svg';
    8587    $html .= '" style="width:auto;height:';
    8688    $html .= $alturacss;
     
    122124        mrt_echo_debug_info();
    123125    }
    124 
    125 }
     126}
     127
     128/**
     129 * Maneja acciones posteriores a la actualización de opciones específicas del plugin.
     130 *
     131 * Esta función se engancha en la acción `updated_option` de WordPress y establece
     132 * un transitorio cuando se actualiza una opción relacionada con el plugin 'Magic robots.txt'.
     133 * Esto permite realizar acciones solo una vez después de que las opciones relevantes
     134 * han sido actualizadas, como regenerar archivos o limpiar cachés.
     135 *
     136 * @param string $option_name El nombre de la opción que se ha actualizado. Se espera que
     137 *                            comience con 'mrt_' para las opciones relevantes del plugin.
     138 */
     139function mrt_on_option_update( $option_name ) {
     140    // Comprueba si la opción actualizada es relevante para el plugin.
     141    if ( false !== strpos( $option_name, 'mrt_' ) ) {
     142        // Establece un transitorio para indicar que una opción relevante ha sido actualizada.
     143        // El transitorio 'mrt_settings_updated' se usa para desencadenar acciones específicas
     144        // del plugin que solo deben ocurrir después de la actualización de la configuración.
     145        set_transient( 'mrt_settings_updated', 'yes', 30 );
     146    }
     147}
     148// Engancha la función al hook 'updated_option' de WordPress.
     149add_action( 'updated_option', 'mrt_on_option_update', 10, 1 );
    126150
    127151/** Funcionalidad de la página de ajustes. */
     
    133157
    134158    // Gestión de uso de archivo físico.
    135     if ( isset( $_GET['settings-updated'] ) ) {
     159    // if ( isset( $_GET['settings-updated'] ) ) {
     160    // Mediante el transitorio creado en mrt_on_option_update, sabremso que se grabaron las opciones sin requerir
     161    // el acceso a $_GET y el consiguiente requisito de nonce de WPCS.
     162    if ( get_transient( 'mrt_settings_updated' ) ) {
    136163        // Grabando ajustes es el momento de editar el archivo robots.txt físico si corresponde.
    137164        // Solo si (está configurado hacerlo o es forzoso) y se puede.
     
    150177            }
    151178        }
     179        delete_transient( 'mrt_settings_updated' ); // Liquida el transitorio.
    152180    }
    153181
     
    269297    if ( mrt_conf_carga() ) {
    270298        $nivel_carga = mrt_conf_carga();
    271     } else {
    272         if ( mrt_carga_calculable() ) {
    273             // Considera el nivel obtenido si es posible.
    274             echo esc_html( ucfirst( __( 'the server load detected is', 'magic-robots-txt' ) ) . ' ' );
    275             $carga       = mrt_carga_15();
    276             $nivel_carga = mrt_nivel_carga( $carga );
    277             echo esc_html( ucfirst( mrt_texto_carga( $nivel_carga ) ) );
    278             echo ".<br />\n";
    279             // Considera el nivel por omisión si no es posible obtenerlo.
    280         } else {
    281             $carga       = mrt_carga_omision();
    282             $nivel_carga = mrt_nivel_carga( $carga );
    283             echo esc_html( ucfirst( __( 'server load can\'t be detected', 'magic-robots-txt' ) ) . '. ' );
    284             /* translators: %s: Load average number. */
    285             echo esc_html( ucfirst( sprintf( __( 'don\'t worry, estimating a %s value', 'magic-robots-txt' ), mrt_texto_carga( $nivel_carga ) ) ) . ' ' );
    286             esc_html_e( 'does the trick', 'magic-robots-txt' );
    287             echo ".<br /><br />\n";
    288         }
     299    } elseif ( mrt_carga_calculable() ) {
     300        // Considera el nivel obtenido si es posible.
     301        echo esc_html( ucfirst( __( 'the server load detected is', 'magic-robots-txt' ) ) . ' ' );
     302        $carga       = mrt_carga_15();
     303        $nivel_carga = mrt_nivel_carga( $carga );
     304        echo esc_html( ucfirst( mrt_texto_carga( $nivel_carga ) ) );
     305        echo ".<br />\n";
     306        // Considera el nivel por omisión si no es posible obtenerlo.
     307    } else {
     308        $carga       = mrt_carga_omision();
     309        $nivel_carga = mrt_nivel_carga( $carga );
     310        echo esc_html( ucfirst( __( 'server load can\'t be detected', 'magic-robots-txt' ) ) . '. ' );
     311        /* translators: %s: Load average number. */
     312        echo esc_html( ucfirst( sprintf( __( 'don\'t worry, estimating a %s value', 'magic-robots-txt' ), mrt_texto_carga( $nivel_carga ) ) ) . ' ' );
     313        esc_html_e( 'does the trick', 'magic-robots-txt' );
     314        echo ".<br /><br />\n";
    289315    }
    290316    echo '<input type="radio" name="mrt_carga" value="4" ' . checked( '4', $nivel_carga, false ) . '>';
     
    719745    echo esc_html( mrt_subdirectorio_wp() );
    720746    echo '<br />';
    721 
    722 }
     747}
  • magic-robots-txt/trunk/lista-opciones.php

    r3061444 r3061445  
    2222        'mrt_carga',
    2323        'mrt_ahorro',
    24         // 'mrt_sitio_publico',
    2524        'mrt_venta_publicidad',
    2625        'mrt_venta_enlaces',
  • magic-robots-txt/trunk/magic-robots-txt.php

    r3018300 r3061445  
    44 * Plugin URI:  https://taller.abcdatos.net/robots-txt-wordpress/
    55 * Description: Manages robots access control via robots.txt
    6  * Version:     1.0.4
     6 * Version:     1.0.5
    77 * Author:      ABCdatos
    88 * Author URI:  https://taller.abcdatos.net/
     
    1919/** Requerido o se obtiene error Plugin is not compatible with language packs: Missing load_plugin_textdomain(). en el canal de Slack #meta-language-packs. */
    2020function mrt_load_plugin_textdomain() {
    21     load_plugin_textdomain( 'magic-robots-txt', false, basename( dirname( __FILE__ ) ) . '/languages' );
     21    load_plugin_textdomain( 'magic-robots-txt', false, basename( __DIR__ ) . '/languages' );
    2222}
    2323add_action( 'plugins_loaded', 'mrt_load_plugin_textdomain' );
     
    2727require_once plugin_dir_path( __FILE__ ) . 'includes/publicidad.php';
    2828// Lista de variables usadas en tabla options.
    29 require_once plugin_dir_path( __FILE__ ) . 'lista_opciones.php';
     29require_once plugin_dir_path( __FILE__ ) . 'lista-opciones.php';
    3030// Funciones sobre el contenido del archivo robots.txt.
    3131require_once plugin_dir_path( __FILE__ ) . 'includes/robots.php';
     
    5555            $nuevo_sitemap .= '# Debug mode: ' . ucfirst( __( 'already have sitemap', 'magic-robots-txt' ) ) . "\n";
    5656        }
    57     } else {
    58         if ( mrt_sitemaps_enabled() ) {
    59             $nuevo_sitemap .= 'Sitemap: ' . mrt_sitemap_wp_url() . "\n\n";
    60         } elseif ( WP_DEBUG ) {
    61             $nuevo_sitemap .= '# Debug mode: ' . ucfirst( __( 'disabled sitemap', 'magic-robots-txt' ) ) . "\n";
    62         }
     57    } elseif ( mrt_sitemaps_enabled() ) {
     58        $nuevo_sitemap .= 'Sitemap: ' . mrt_sitemap_wp_url() . "\n\n";
     59    } elseif ( WP_DEBUG ) {
     60        $nuevo_sitemap .= '# Debug mode: ' . ucfirst( __( 'disabled sitemap', 'magic-robots-txt' ) ) . "\n";
    6361    }
    6462
  • magic-robots-txt/trunk/readme.txt

    r3018299 r3061445  
    33Tags: robots,robots.txt,seo,google,bots
    44Requires at least: 4.2
    5 Tested up to: 6.4
    6 Stable tag: 1.0.3
     5Tested up to: 6.5
     6Stable tag: 1.0.5
    77Requires PHP: 5.4
    88License: GPLv2
     
    9595== Changelog ==
    9696
     97= 1.0.5 =
     98*Mar 30 2024*
     99* Changed the required capability to access the settings page.
     100* Improved settings update mechanism for conditional real robots.txt file generation.
     101* Minor code improvements.
     102* WordPress 6.5 basic compatibility checked.
     103
    97104= 1.0.4 =
    98 *Jan 06 2024*
     105*Jan 07 2024*
    99106* Added Owler (Open Web Search) to search engines bot list.
    100107* Added netEstate NE Crawler (Sengine) to search engines bot list.
  • magic-robots-txt/trunk/uninstall.php

    r2968365 r3061445  
    1515defined( 'WP_UNINSTALL_PLUGIN' ) || die( esc_html( __( 'Access is not allowed.', 'magic-robots-txt' ) ) );
    1616
    17 require_once plugin_dir_path( __FILE__ ) . 'lista_opciones.php';
     17require_once plugin_dir_path( __FILE__ ) . 'lista-opciones.php';
    1818
    1919// Removes all the option values defined in the array.
Note: See TracChangeset for help on using the changeset viewer.