Changeset 3440134
- Timestamp:
- 01/15/2026 08:40:56 AM (2 months ago)
- Location:
- admin-optimizer/trunk
- Files:
-
- 5 edited
-
admin-optimizer.php (modified) (1 diff)
-
languages/admin-optimizer.pot (modified) (3 diffs)
-
modules/xml-sitemap/settings/xml-sitemap-settings.php (modified) (2 diffs)
-
modules/xml-sitemap/xml-sitemap.php (modified) (4 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
admin-optimizer/trunk/admin-optimizer.php
r3440057 r3440134 4 4 * Plugin URI: https://www.adminoptimizer.com 5 5 * Description: An all-in-one plugin to enhance your WordPress sites 6 * Version: 1.5. 06 * Version: 1.5.1 7 7 * Requires PHP: 7.4.0 8 8 * Author: Yipresser -
admin-optimizer/trunk/languages/admin-optimizer.pot
r3440057 r3440134 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: Admin Optimizer 1.5. 0\n"5 "Project-Id-Version: Admin Optimizer 1.5.1\n" 6 6 "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/admin-optimizer\n" 7 7 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "POT-Creation-Date: 2026-01-15T0 6:35:32+00:00\n"12 "POT-Creation-Date: 2026-01-15T08:38:56+00:00\n" 13 13 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" 14 14 "X-Generator: WP-CLI 2.12.0\n" … … 3410 3410 msgstr "" 3411 3411 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 3415 msgid "Change the sitemap URL. The default is wp-sitemap.xml. Your current sitemap URL is %s" 3416 msgstr "" 3417 3418 #: modules/xml-sitemap/settings/xml-sitemap-settings.php:190 3417 3419 msgid "If you are not seeing the sitemap, go to Settings -> Permalinks, and press Save Changes to flush the rewrite rules." 3418 3420 msgstr "" 3419 3421 3420 #: modules/xml-sitemap/settings/xml-sitemap-settings.php:30 13422 #: modules/xml-sitemap/settings/xml-sitemap-settings.php:307 3421 3423 msgid "Open the post in the Post Editor. On the right menu, select \"Exclude from XML Sitemap\"." 3422 3424 msgstr "" 3423 3425 3424 #: modules/xml-sitemap/settings/xml-sitemap-settings.php:3 273426 #: modules/xml-sitemap/settings/xml-sitemap-settings.php:333 3425 3427 msgid "Admin Optimizer - XML Sitemap" 3426 3428 msgstr "" 3427 3429 3428 #: modules/xml-sitemap/settings/xml-sitemap-settings.php:33 23430 #: modules/xml-sitemap/settings/xml-sitemap-settings.php:338 3429 3431 msgid "The native WP sitemap has been disabled. Check if other Sitemap or SEO plugins have disabled it." 3430 3432 msgstr "" -
admin-optimizer/trunk/modules/xml-sitemap/settings/xml-sitemap-settings.php
r3440057 r3440134 181 181 ?> 182 182 <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> 184 190 <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> 185 191 <?php … … 442 448 return $sanitized_options; 443 449 } 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 } 444 463 } -
admin-optimizer/trunk/modules/xml-sitemap/xml-sitemap.php
r3440057 r3440134 218 218 if ( ! str_contains( $robots_txt, '# BEGIN XML-SITEMAP LINK' ) ) { 219 219 $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"; 221 221 $robots_txt .= '# END XML-SITEMAP LINK'; 222 222 $robots_options['robotstxt_content'] = $robots_txt; 223 223 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 } 224 232 } 225 233 } … … 238 246 if ( str_contains( $robots_txt, '# BEGIN XML-SITEMAP LINK' ) ) { 239 247 $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 ); 241 249 update_option( Ads_Robots_Txt::OPTION_NAME, $robots_options ); 242 250 } … … 251 259 private function get_sitemap_url() { 252 260 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' ); 254 262 } else { 255 263 return home_url( 'wp-sitemap.xml' ); … … 275 283 public function fix_wp_sitemap_url( $url, $path ) { 276 284 if ( '/wp-sitemap.xml' === $path ) { 277 $slug = esc_url( $this->options['custom_sitemap_slug'] );285 $slug = $this->options['custom_sitemap_slug']; 278 286 return str_replace( '/wp-sitemap.xml', "/{$slug}.xml", $url ); 279 287 } -
admin-optimizer/trunk/readme.txt
r3440057 r3440134 7 7 Requires PHP: 7.4.0 8 8 Tested up to: 6.9 9 Stable tag: 1.5. 09 Stable tag: 1.5.1 10 10 License: GPLv2 or later 11 11 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 114 114 115 115 == Changelog == 116 = 1.5.1 = 117 Fixed: XML Sitemap URL wrongly set on robots.txt 118 116 119 = 1.5.0 = 117 120 Added: new XML Sitemap module
Note: See TracChangeset
for help on using the changeset viewer.