Plugin Directory

Changeset 3440134


Ignore:
Timestamp:
01/15/2026 08:40:56 AM (2 months ago)
Author:
yipresser
Message:

updated to v1.5.1

Location:
admin-optimizer/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • admin-optimizer/trunk/admin-optimizer.php

    r3440057 r3440134  
    44 * Plugin URI: https://www.adminoptimizer.com
    55 * Description: An all-in-one plugin to enhance your WordPress sites
    6  * Version: 1.5.0
     6 * Version: 1.5.1
    77 * Requires PHP: 7.4.0
    88 * Author: Yipresser
  • admin-optimizer/trunk/languages/admin-optimizer.pot

    r3440057 r3440134  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: Admin Optimizer 1.5.0\n"
     5"Project-Id-Version: Admin Optimizer 1.5.1\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/admin-optimizer\n"
    77"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2026-01-15T06:35:32+00:00\n"
     12"POT-Creation-Date: 2026-01-15T08:38:56+00:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: WP-CLI 2.12.0\n"
     
    34103410msgstr ""
    34113411
    3412 #: modules/xml-sitemap/settings/xml-sitemap-settings.php:183
    3413 msgid "Change the sitemap URL. The default is wp-sitemap.xml"
    3414 msgstr ""
    3415 
    3416 #: modules/xml-sitemap/settings/xml-sitemap-settings.php:184
     3412#. translators: %s: sitemap URL
     3413#: modules/xml-sitemap/settings/xml-sitemap-settings.php:187
     3414#, php-format
     3415msgid "Change the sitemap URL. The default is wp-sitemap.xml. Your current sitemap URL is %s"
     3416msgstr ""
     3417
     3418#: modules/xml-sitemap/settings/xml-sitemap-settings.php:190
    34173419msgid "If you are not seeing the sitemap, go to Settings -> Permalinks, and press Save Changes to flush the rewrite rules."
    34183420msgstr ""
    34193421
    3420 #: modules/xml-sitemap/settings/xml-sitemap-settings.php:301
     3422#: modules/xml-sitemap/settings/xml-sitemap-settings.php:307
    34213423msgid "Open the post in the Post Editor. On the right menu, select \"Exclude from XML Sitemap\"."
    34223424msgstr ""
    34233425
    3424 #: modules/xml-sitemap/settings/xml-sitemap-settings.php:327
     3426#: modules/xml-sitemap/settings/xml-sitemap-settings.php:333
    34253427msgid "Admin Optimizer - XML Sitemap"
    34263428msgstr ""
    34273429
    3428 #: modules/xml-sitemap/settings/xml-sitemap-settings.php:332
     3430#: modules/xml-sitemap/settings/xml-sitemap-settings.php:338
    34293431msgid "The native WP sitemap has been disabled. Check if other Sitemap or SEO plugins have disabled it."
    34303432msgstr ""
  • admin-optimizer/trunk/modules/xml-sitemap/settings/xml-sitemap-settings.php

    r3440057 r3440134  
    181181        ?>
    182182        <code><?php echo esc_url( home_url( '/' ) ); ?></code> <input id="custom-url" type="text" name="<?php echo esc_attr( XML_Sitemap::OPTION_NAME ); ?>[custom_sitemap_slug]" value="<?php echo esc_attr( $value ); ?>"><code><?php echo esc_html( '.xml' ); ?></code>
    183         <p class="description"><?php esc_html_e( 'Change the sitemap URL. The default is wp-sitemap.xml', 'admin-optimizer' ); ?></p>
     183        <p class="description">
     184            <?php $sitemap_url = $this->get_sitemap_url(); ?>
     185            <?php
     186            /* translators: %s: sitemap URL */
     187            printf( esc_html__( 'Change the sitemap URL. The default is wp-sitemap.xml. Your current sitemap URL is %s', 'admin-optimizer' ), '<a href="' . esc_url( $sitemap_url ) . '" target="_blank">' . esc_url( $sitemap_url ) . '</a>' );
     188            ?>
     189        </p>
    184190        <p class="description"><?php esc_html_e( 'If you are not seeing the sitemap, go to Settings -> Permalinks, and press Save Changes to flush the rewrite rules.', 'admin-optimizer' ); ?></p>
    185191        <?php
     
    442448        return $sanitized_options;
    443449    }
     450
     451    /**
     452     * Get sitemap url
     453     *
     454     * @return string
     455     */
     456    private function get_sitemap_url() {
     457        if ( ! empty( $this->options['custom_sitemap_slug'] ) ) {
     458            return home_url( '/' . $this->options['custom_sitemap_slug'] . '.xml' );
     459        } else {
     460            return home_url( 'wp-sitemap.xml' );
     461        }
     462    }
    444463}
  • admin-optimizer/trunk/modules/xml-sitemap/xml-sitemap.php

    r3440057 r3440134  
    218218            if ( ! str_contains( $robots_txt, '# BEGIN XML-SITEMAP LINK' ) ) {
    219219                $robots_txt                         .= "\n\n# BEGIN XML-SITEMAP LINK\n";
    220                 $robots_txt                         .= "Sitemap: {$this->get_sitemap_url()}\n";
     220                $robots_txt                         .= 'Sitemap: ' . esc_url( $this->get_sitemap_url() ) . "\n";
    221221                $robots_txt                         .= '# END XML-SITEMAP LINK';
    222222                $robots_options['robotstxt_content'] = $robots_txt;
    223223                update_option( Ads_Robots_Txt::OPTION_NAME, $robots_options );
     224            } else { // check if the sitemap url is still the same one.
     225                preg_match( '/Sitemap: (.*).xml/', $robots_txt, $matches );
     226                if ( ! empty( $matches[1] ) ) {
     227                    $current_sitemap_url = $matches[1] . '.xml';
     228                    if ( $current_sitemap_url !== $this->get_sitemap_url() ) {
     229                        $this->remove_sitemap_link_robotstxt();
     230                    }
     231                }
    224232            }
    225233        }
     
    238246            if ( str_contains( $robots_txt, '# BEGIN XML-SITEMAP LINK' ) ) {
    239247                $robots_txt                          = preg_replace( '/# BEGIN XML-SITEMAP LINK(.*)# END XML-SITEMAP LINK/s', '', $robots_txt );
    240                 $robots_options['robotstxt_content'] = $robots_txt;
     248                $robots_options['robotstxt_content'] = rtrim( $robots_txt );
    241249                update_option( Ads_Robots_Txt::OPTION_NAME, $robots_options );
    242250            }
     
    251259    private function get_sitemap_url() {
    252260        if ( ! empty( $this->options['custom_sitemap_slug'] ) ) {
    253             return home_url( esc_url( $this->options['custom_sitemap_slug'] ) . '.xml' );
     261            return home_url( '/' . $this->options['custom_sitemap_slug'] . '.xml' );
    254262        } else {
    255263            return home_url( 'wp-sitemap.xml' );
     
    275283    public function fix_wp_sitemap_url( $url, $path ) {
    276284        if ( '/wp-sitemap.xml' === $path ) {
    277             $slug = esc_url( $this->options['custom_sitemap_slug'] );
     285            $slug = $this->options['custom_sitemap_slug'];
    278286            return str_replace( '/wp-sitemap.xml', "/{$slug}.xml", $url );
    279287        }
  • admin-optimizer/trunk/readme.txt

    r3440057 r3440134  
    77Requires PHP: 7.4.0
    88Tested up to: 6.9
    9 Stable tag: 1.5.0
     9Stable tag: 1.5.1
    1010License: GPLv2 or later
    1111License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    114114
    115115== Changelog ==
     116= 1.5.1 =
     117Fixed: XML Sitemap URL wrongly set on robots.txt
     118
    116119= 1.5.0 =
    117120Added: new XML Sitemap module
Note: See TracChangeset for help on using the changeset viewer.