Skip to content

Commit

Permalink
Merge pull request #2629 from semperfiwebdesign/3.1
Browse files Browse the repository at this point in the history
3.1 to master
  • Loading branch information
michaeltorbert authored Jun 10, 2019
2 parents 2e61d15 + 7fb3734 commit 4c47feb
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 19 deletions.
6 changes: 3 additions & 3 deletions all_in_one_seo_pack.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Plugin Name: All In One SEO Pack
Plugin URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
Description: Out-of-the-box SEO for WordPress. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. More than 50 million downloads since 2007.
Version: 3.0.4
Version: 3.1
Author: Michael Torbert
Author URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
Text Domain: all-in-one-seo-pack
Expand Down Expand Up @@ -32,7 +32,7 @@
* The original WordPress SEO plugin.
*
* @package All-in-One-SEO-Pack
* @version 3.0.4
* @version 3.1
*/

if ( ! defined( 'AIOSEOPPRO' ) ) {
Expand All @@ -42,7 +42,7 @@
define( 'AIOSEOP_PLUGIN_NAME', 'All in One SEO Pack' );
}
if ( ! defined( 'AIOSEOP_VERSION' ) ) {
define( 'AIOSEOP_VERSION', '3.0.4' );
define( 'AIOSEOP_VERSION', '3.1' );
}

/*
Expand Down
17 changes: 17 additions & 0 deletions inc/aioseop_updates_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,12 @@ function do_version_updates( $old_version ) {
) {
$this->reset_review_notice_201906();
}

if (
version_compare( $old_version, '3.1', '<' )
) {
$this->reset_flush_rewrite_rules_201906();
}
}

/**
Expand Down Expand Up @@ -325,4 +331,15 @@ public function reset_review_notice_201906() {
$aioseop_notices->reset_notice( 'review_plugin' );
$aioseop_notices->remove_notice( 'review_plugin' );
}

/**
* Flushes rewrite rules for XML Sitemap URL changes
*
* @since 3.1
*/
public function reset_flush_rewrite_rules_201906() {
add_action( 'shutdown', 'flush_rewrite_rules' );
}
}


31 changes: 16 additions & 15 deletions modules/aioseop_sitemap.php
Original file line number Diff line number Diff line change
Expand Up @@ -1434,10 +1434,11 @@ public function setup_rewrites() {
* @return array
*/
public function get_rewrite_rules( $prefix_removed_rules_with = null ) {

$sitemap_rules = array(
$this->get_filename() . '.xml' => 'index.php?' . $this->prefix . 'path=root',
$this->get_filename() . '_(.+)_(\d+).xml' => 'index.php?' . $this->prefix . 'path=$matches[1]&' . $this->prefix . 'page=$matches[2]',
$this->get_filename() . '_(.+).xml' => 'index.php?' . $this->prefix . 'path=$matches[1]',
$this->get_filename() . '.xml' => 'index.php?' . $this->prefix . 'path=root',
'(.+)-' . $this->get_filename() . '(\d+).xml' => 'index.php?' . $this->prefix . 'path=$matches[1]&' . $this->prefix . 'page=$matches[2]',
'(.+)-' . $this->get_filename() . '.xml' => 'index.php?' . $this->prefix . 'path=$matches[1]',
);

if ( isset( $this->options[ "{$this->prefix}rss_sitemap" ] ) && $this->options[ "{$this->prefix}rss_sitemap" ] ) {
Expand Down Expand Up @@ -1952,7 +1953,7 @@ public function get_sitemap_index_filenames() {
$options[ "{$this->prefix}posttypes" ] = array_diff( $options[ "{$this->prefix}posttypes" ], array( 'all' ) );
$options[ "{$this->prefix}taxonomies" ] = $this->show_or_hide_taxonomy( array_diff( $options[ "{$this->prefix}taxonomies" ], array( 'all' ) ) );

$files[] = array( 'loc' => aioseop_home_url( '/' . $prefix . '_addl' . $suffix ) );
$files[] = array( 'loc' => aioseop_home_url( '/addl-' . $prefix . $suffix ) );

// Get post types selected, and NoIndex post types & Index posts.
$post_types = $options[ "{$this->prefix}posttypes" ];
Expand Down Expand Up @@ -2027,21 +2028,21 @@ public function get_sitemap_index_filenames() {
$count = 1;
for ( $post_count = 0; $post_count < $post_counts[ $sm ]; $post_count += $this->max_posts ) {
$files[] = array(
'loc' => aioseop_home_url( '/' . $prefix . '_' . $sm . '_' . ( $count ++ ) . $suffix ),
'loc' => aioseop_home_url( '/' . $sm . '-' . $prefix . ( $count ++ ) . $suffix ),
'changefreq' => $freq,
'priority' => $prio,
);
}
} else {
$files[] = array(
'loc' => aioseop_home_url( '/' . $prefix . '_' . $sm . $suffix ),
'loc' => aioseop_home_url( '/' . $sm . '-' . $prefix . $suffix ),
'changefreq' => $freq,
'priority' => $prio,
);
}
} else {
$files[] = array(
'loc' => aioseop_home_url( '/' . $prefix . '_' . $sm . $suffix ),
'loc' => aioseop_home_url( '/' . $sm . '-' . $prefix . $suffix ),
'changefreq' => $freq,
'priority' => $prio,
);
Expand All @@ -2050,14 +2051,14 @@ public function get_sitemap_index_filenames() {
}
if ( $this->option_isset( 'archive' ) ) {
$files[] = array(
'loc' => aioseop_home_url( '/' . $prefix . '_archive' . $suffix ),
'loc' => aioseop_home_url( '/' . 'archive-' . $prefix . $suffix ),
'changefreq' => $this->get_default_frequency( 'archive' ),
'priority' => $this->get_default_priority( 'archive' ),
);
}
if ( $this->option_isset( 'author' ) ) {
$files[] = array(
'loc' => aioseop_home_url( '/' . $prefix . '_author' . $suffix ),
'loc' => aioseop_home_url( '/' . 'author-' . $prefix . $suffix ),
'changefreq' => $this->get_default_frequency( 'author' ),
'priority' => $this->get_default_priority( 'author' ),
);
Expand All @@ -2075,21 +2076,21 @@ public function get_sitemap_index_filenames() {
$count = 1;
for ( $tc = 0; $tc < $term_count; $tc += $this->max_posts ) {
$files[] = array(
'loc' => aioseop_home_url( '/' . $prefix . '_' . $v1_taxonomy . '_' . ( $count ++ ) . $suffix ),
'loc' => aioseop_home_url( '/' . $v1_taxonomy . '-' . $prefix . ( $count ++ ) . $suffix ),
'changefreq' => $this->get_default_frequency( 'taxonomies' ),
'priority' => $this->get_default_priority( 'taxonomies' ),
);
}
} else {
$files[] = array(
'loc' => aioseop_home_url( '/' . $prefix . '_' . $v1_taxonomy . $suffix ),
'loc' => aioseop_home_url( '/' . $v1_taxonomy . '-' . $prefix . $suffix ),
'changefreq' => $this->get_default_frequency( 'taxonomies' ),
'priority' => $this->get_default_priority( 'taxonomies' ),
);
}
} else {
$files[] = array(
'loc' => aioseop_home_url( '/' . $prefix . '_' . $v1_taxonomy . $suffix ),
'loc' => aioseop_home_url( '/' . $v1_taxonomy . '-' . $prefix . $suffix ),
'changefreq' => $this->get_default_frequency( 'taxonomies' ),
'priority' => $this->get_default_priority( 'taxonomies' ),
);
Expand Down Expand Up @@ -2162,7 +2163,7 @@ public function do_write_sitemap( $sitemap_type, $page = 0, $filename = '', $com
if ( 'root' === $sitemap_type ) {
$filename = $this->get_filename();
} else {
$filename = $this->get_filename() . '_' . $sitemap_type;
$filename = $sitemap_type . '-' . $this->get_filename();
}
}
if ( empty( $comment ) ) {
Expand Down Expand Up @@ -2211,7 +2212,7 @@ public function do_indexed_sitemaps() {
if ( ! empty( $this->options[ "{$this->prefix}indexes" ] ) && ( $post_counts[ $posttype ] > $this->max_posts ) ) {
$count = 1;
for ( $post_count = 0; $post_count < $post_counts[ $posttype ]; $post_count += $this->max_posts ) {
$this->do_write_sitemap( $posttype, $count - 1, $this->get_filename() . "_{$posttype}_{$count}" );
$this->do_write_sitemap( $posttype, $count - 1, "{$posttype}-" . $this->get_filename() . "{$count}" );
$count ++;
}
} else {
Expand All @@ -2228,7 +2229,7 @@ public function do_indexed_sitemaps() {
if ( $term_count > $this->max_posts ) {
$count = 1;
for ( $tc = 0; $tc < $term_count; $tc += $this->max_posts ) {
$this->do_write_sitemap( $taxonomy, $tc, $this->get_filename() . "_{$taxonomy}_{$count}" );
$this->do_write_sitemap( $taxonomy, $tc, "{$taxonomy}-" . $this->get_filename() . "{$count}" );
$count ++;
}
} else {
Expand Down
2 changes: 1 addition & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Contributors: hallsofmontezuma, semperplugins, wpsmort, arnaudbroes
Tags: SEO, Google Search Console, XML Sitemap, meta description, meta title, noindex
Requires at least: 4.7
Tested up to: 5.2
Stable tag: 3.0.4
Stable tag: 3.1
License: GPLv2 or later
Requires PHP: 5.2.4

Expand Down

0 comments on commit 4c47feb

Please sign in to comment.