From b9c9879c4312f4265fb38b59e759aba2d0bcf011 Mon Sep 17 00:00:00 2001
From: contactashish13
Date: Mon, 2 Oct 2017 20:07:09 +0530
Subject: [PATCH 1/9] XML Sitemap - Embeds and other code being picked up as
images (#1215)
* XML Sitemap - Embeds and other code being picked up as images #1212
* codeclimate
* WPCS
---
modules/aioseop_sitemap.php | 40 +++++++++++++++++++++++++++++++++++++
1 file changed, 40 insertions(+)
diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php
index 590744e65..316052802 100644
--- a/modules/aioseop_sitemap.php
+++ b/modules/aioseop_sitemap.php
@@ -28,6 +28,18 @@ class All_in_One_SEO_Pack_Sitemap extends All_in_One_SEO_Pack_Module {
var $extra_sitemaps;
var $excludes = array();
+ /**
+ * The allowed image extensions.
+ *
+ * @var array $image_extensions The allowed image extensions.
+ */
+ private static $image_extensions = array(
+ 'jpg',
+ 'jpeg',
+ 'png',
+ 'gif',
+ );
+
/**
* All_in_One_SEO_Pack_Sitemap constructor.
*/
@@ -2723,6 +2735,8 @@ private function get_images_from_post( $post ) {
// Filter out duplicates.
$tmp = array_unique( $images );
}
+ // remove any invalid/empty images.
+ $tmp = array_filter( $images, array( $this, 'is_image_valid' ) );
$images = array();
foreach ( $tmp as $image ) {
$images[] = array(
@@ -2734,6 +2748,32 @@ private function get_images_from_post( $post ) {
return $images;
}
+
+ /**
+ * Validate the image.
+ *
+ * @param string $image The image src.
+ *
+ * @since 2.4.1
+ *
+ * @return bool
+ */
+ function is_image_valid( $image ) {
+ // Bail if empty image.
+ if ( empty( $image ) ) {
+ return false;
+ }
+
+ $extn = pathinfo( wp_parse_url( $image, PHP_URL_PATH ), PATHINFO_EXTENSION );
+ $allowed = apply_filters( 'aioseop_allowed_image_extensions', self::$image_extensions );
+ // Bail if image does not refer to an image file otherwise google webmaster tools might reject the sitemap.
+ if ( ! in_array( $extn, $allowed, true ) ) {
+ return false;
+ }
+
+ return true;
+ }
+
/**
* Return excluded categories for taxonomy queries.
*
From 184ba2eb570f2f265ccdb944829899f2a17f07b9 Mon Sep 17 00:00:00 2001
From: contactashish13
Date: Mon, 2 Oct 2017 20:18:59 +0530
Subject: [PATCH 2/9] check if dom module exists (#1216)
* check if dom module exists #1206
* fallback to regex
* fallback to regex
* codeclimate
* Use our internal logging system
---
modules/aioseop_sitemap.php | 55 +++++++++++++++++++++++++++----------
1 file changed, 40 insertions(+), 15 deletions(-)
diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php
index 316052802..326c28246 100644
--- a/modules/aioseop_sitemap.php
+++ b/modules/aioseop_sitemap.php
@@ -2713,21 +2713,7 @@ private function get_images_from_post( $post ) {
// Check images in the content.
$content = $post->post_content;
- $total = substr_count( $content, ' 0 ) {
- $dom = new domDocument();
- // Non-compliant HTML might give errors, so ignore them.
- libxml_use_internal_errors( true );
- $dom->loadHTML( $content );
- libxml_clear_errors();
- // @codingStandardsIgnoreStart
- $dom->preserveWhiteSpace = false;
- // @codingStandardsIgnoreEnd
- $matches = $dom->getElementsByTagName( 'img' );
- foreach ( $matches as $match ) {
- $images[] = $match->getAttribute( 'src' );
- }
- }
+ $this->parse_content_for_images( $content, $images );
if ( $images ) {
$tmp = $images;
@@ -2774,6 +2760,45 @@ function is_image_valid( $image ) {
return true;
}
+ /**
+ * Parse the post for images.
+ *
+ * @param string $content the post content.
+ * @param array $images the array of images.
+ */
+ function parse_content_for_images( $content, &$images ) {
+ $total = substr_count( $content, 'loadHTML( $content );
+ libxml_clear_errors();
+ $dom->preserveWhiteSpace = false;
+ $matches = $dom->getElementsByTagName( 'img' );
+ foreach ( $matches as $match ) {
+ $images[] = $match->getAttribute( 'src' );
+ }
+ } else {
+ // Fall back to regex, but also report an error.
+ global $img_err_msg;
+ if ( ! isset( $img_err_msg ) ) {
+ // we will log this error message only once, not per post.
+ $img_err_msg = true;
+ $this->debug_message( 'DOMDocument not found; using REGEX' );
+ }
+ preg_match_all( '/
Date: Tue, 3 Oct 2017 00:46:01 +0530
Subject: [PATCH 3/9] Find alternative to the_content filter for image sitemap
(#1204)
* Find alternative to the_content filter for image sitemap #1191
* code climate
* default $content to empty string
* Update aioseop_sitemap.php
---
modules/aioseop_sitemap.php | 31 +++++++++++++++++++++++++++++--
1 file changed, 29 insertions(+), 2 deletions(-)
diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php
index 326c28246..1b27b7717 100644
--- a/modules/aioseop_sitemap.php
+++ b/modules/aioseop_sitemap.php
@@ -2711,9 +2711,36 @@ private function get_images_from_post( $post ) {
$images[] = $attached_url;
}
- // Check images in the content.
+ $content = '';
$content = $post->post_content;
- $this->parse_content_for_images( $content, $images );
+
+ // Check images galleries in the content. DO NOT run the_content filter here as it might cause issues with other shortcodes.
+ if ( has_shortcode( $content, 'gallery' ) ) {
+ $galleries = get_post_galleries( $post, false );
+ if ( $galleries ) {
+ foreach ( $galleries as $gallery ) {
+ $images = array_merge( $images, $gallery['src'] );
+ }
+ }
+ }
+
+ $total = substr_count( $content, ' 0 ) {
+ $dom = new domDocument();
+ // Non-compliant HTML might give errors, so ignore them.
+ libxml_use_internal_errors( true );
+ $dom->loadHTML( $content );
+ libxml_clear_errors();
+ // @codingStandardsIgnoreStart
+ $dom->preserveWhiteSpace = false;
+ // @codingStandardsIgnoreEnd
+ $matches = $dom->getElementsByTagName( 'img' );
+ foreach ( $matches as $match ) {
+ $images[] = $match->getAttribute( 'src' );
+ }
+ }
+
+ $this->parse_content_for_images( $content, $images );
if ( $images ) {
$tmp = $images;
From 05e39e00bdd50d9363ba9778069cbe88fd9056b5 Mon Sep 17 00:00:00 2001
From: Michael Torbert
Date: Mon, 2 Oct 2017 15:25:18 -0400
Subject: [PATCH 4/9] version bump to 2.4.1
---
all_in_one_seo_pack.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/all_in_one_seo_pack.php b/all_in_one_seo_pack.php
index 41463e6db..b0bcb5050 100644
--- a/all_in_one_seo_pack.php
+++ b/all_in_one_seo_pack.php
@@ -3,7 +3,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 your WordPress blog. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. More than 30 million downloads since 2007.
-Version: 2.4
+Version: 2.4.1
Author: Michael Torbert
Author URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
Text Domain: all-in-one-seo-pack
@@ -31,14 +31,14 @@
* The original WordPress SEO plugin.
*
* @package All-in-One-SEO-Pack
- * @version 2.4
+ * @version 2.4.1
*/
if ( ! defined( 'AIOSEOPPRO' ) ) {
define( 'AIOSEOPPRO', false );
}
if ( ! defined( 'AIOSEOP_VERSION' ) ) {
- define( 'AIOSEOP_VERSION', '2.4' );
+ define( 'AIOSEOP_VERSION', '2.4.1' );
}
global $aioseop_plugin_name;
$aioseop_plugin_name = 'All in One SEO Pack';
From 0d264c77d442b342028efd104fbfcc0fabadfb1e Mon Sep 17 00:00:00 2001
From: Michael Torbert
Date: Mon, 2 Oct 2017 15:25:33 -0400
Subject: [PATCH 5/9] bump readme to 2.4.1
---
readme.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/readme.txt b/readme.txt
index 25fff1a2a..e53504c11 100644
--- a/readme.txt
+++ b/readme.txt
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtor
Tags: SEO, all in one seo, WordPress SEO, Google Search Console, XML Sitemap, image seo
Requires at least: 4.0
Tested up to: 4.8
-Stable tag: 2.4
+Stable tag: 2.4.1
License: GPLv2 or later
Requires PHP: 5.2.4
From dc067f4025557d96719c118d994859dbb680a703 Mon Sep 17 00:00:00 2001
From: Michael Torbert
Date: Mon, 2 Oct 2017 15:34:49 -0400
Subject: [PATCH 6/9] notice for lots of sitemap URLs #1225 (#1231)
---
all_in_one_seo_pack.php | 1 +
inc/aioseop_functions.php | 5 ++++
js/quickedit_functions.js | 17 +++++++++---
modules/aioseop_sitemap.php | 53 ++++++++++++++++++++++++++++++++++---
4 files changed, 70 insertions(+), 6 deletions(-)
diff --git a/all_in_one_seo_pack.php b/all_in_one_seo_pack.php
index b0bcb5050..57d1042db 100644
--- a/all_in_one_seo_pack.php
+++ b/all_in_one_seo_pack.php
@@ -464,6 +464,7 @@ function aioseop_welcome(){
add_action( 'wp_ajax_aioseo_dismiss_yst_notice', 'aioseop_update_yst_detected_notice' );
add_action( 'wp_ajax_aioseo_dismiss_visibility_notice', 'aioseop_update_user_visibilitynotice' );
add_action( 'wp_ajax_aioseo_dismiss_woo_upgrade_notice', 'aioseop_woo_upgrade_notice_dismissed' );
+ add_action( 'wp_ajax_aioseo_dismiss_sitemap_max_url_notice', 'aioseop_sitemap_max_url_notice_dismissed' );
if ( AIOSEOPPRO ) {
add_action( 'wp_ajax_aioseop_ajax_update_oembed', 'aioseop_ajax_update_oembed' );
}
diff --git a/inc/aioseop_functions.php b/inc/aioseop_functions.php
index 252a5dab2..1684ad89c 100644
--- a/inc/aioseop_functions.php
+++ b/inc/aioseop_functions.php
@@ -958,6 +958,11 @@ function aioseop_woo_upgrade_notice_dismissed() {
update_user_meta( get_current_user_id(), 'aioseop_woo_upgrade_notice_dismissed', true );
}
+function aioseop_sitemap_max_url_notice_dismissed() {
+
+ update_user_meta( get_current_user_id(), 'aioseop_sitemap_max_url_notice_dismissed', true );
+}
+
/**
* Returns home_url() value compatible for any use.
* Thought for compatibility purposes.
diff --git a/js/quickedit_functions.js b/js/quickedit_functions.js
index 9d8bb8c75..c1c2261fb 100644
--- a/js/quickedit_functions.js
+++ b/js/quickedit_functions.js
@@ -31,6 +31,17 @@ jQuery(document).on( 'click', '.woo-upgrade-notice', function() {
})
+jQuery(document).on( 'click', '.sitemap_max_urls_notice', function() {
+
+ jQuery.ajax({
+ url: ajaxurl,
+ data: {
+ action: 'aioseo_dismiss_sitemap_max_url_notice'
+ }
+ })
+
+})
+
function aioseop_ajax_edit_meta_form( post_id, meta, nonce ) {
var uform = jQuery('#aioseop_'+meta+'_' + post_id);
@@ -63,7 +74,7 @@ function handle_post_meta( p, t, m, n ) {
loading += 'Please wait…
';
jQuery("div#aioseop_"+m+"_"+p).fadeIn('fast', function() {
var aioseop_sack = new sack(aioseopadmin.requestUrl);
- aioseop_sack.execute = 1;
+ aioseop_sack.execute = 1;
aioseop_sack.method = 'POST';
aioseop_sack.setVar( "action", "aioseop_ajax_save_meta");
aioseop_sack.setVar( "post_id", p );
@@ -76,6 +87,6 @@ function handle_post_meta( p, t, m, n ) {
})
jQuery("div#aioseop_"+m+"_"+p).html(loading);
jQuery("div#aioseop_"+m+"_"+p).attr( "class", "aioseop_mpc_admin_meta_options" );
-
+
})
-}
\ No newline at end of file
+}
diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php
index 1b27b7717..120f0d6a6 100644
--- a/modules/aioseop_sitemap.php
+++ b/modules/aioseop_sitemap.php
@@ -323,8 +323,55 @@ function __construct() {
add_action( 'init', array( $this, 'make_dynamic_xsl' ) );
add_action( 'transition_post_status', array( $this, 'update_sitemap_from_posts' ), 10, 3 );
add_action( 'after_doing_aioseop_updates', array( $this, 'scan_sitemaps' ) );
+ add_action( 'all_admin_notices', array( $this, 'sitemap_notices' ) );
}
+ /**
+ * Sitemap notices.
+ *
+ * @since 2.4.1
+ */
+ function sitemap_notices() {
+
+ $sitemap_max_url_notice_dismissed = get_user_meta( get_current_user_id(), 'aioseop_sitemap_max_url_notice_dismissed', true );
+ if ( ! empty( $sitemap_max_url_notice_dismissed ) ) {
+ return;
+ }
+
+ global $options;
+ $options = $this->options;
+
+ if ( ( 'on ' !== $options["{$this->prefix}indexes"] ||
+ 'on ' !== $options["{$this->prefix}paginate"] ) &&
+ 1001 < $options["{$this->prefix}max_posts"]
+ ) {
+
+ $post_counts = $this->get_total_post_count( array(
+ 'post_type' => $options["{$this->prefix}posttypes"],
+ 'post_status' => 'publish',
+ ) );
+
+ $num_terms = array_sum( $this->get_all_term_counts( array( 'taxonomy' => $options["{$this->prefix}taxonomies"] ) ) );
+
+ $sitemap_urls = $post_counts + $num_terms;
+
+ if ( 1001 > $sitemap_urls ) {
+ return;
+ }
+
+ $aioseop_plugin_dirname = AIOSEOP_PLUGIN_DIRNAME;
+
+ printf( '
+ ',
+ __( 'Warning: Your website has a lot of URLs.', 'all-in-one-seo-pack' ),
+ sprintf( __( '%s Click here%s to enable Sitemap Indexes and then enable Paginate Sitemap Indexes, and set the Maximum Posts per Sitemap to 1000.', 'all-in-one-seo-pack' ), sprintf( '', esc_url( get_admin_url( null, "admin.php?page=$aioseop_plugin_dirname/modules/aioseop_sitemap.php" ) ) ), '' ) );
+ }
+ }
/**
* Update sitemap from posts.
@@ -2636,7 +2683,7 @@ function get_prio_from_posts( $posts, $prio_override = false, $freq_override = f
return $prio;
}
-
+
/**
* Return the images attached to the term.
*
@@ -2647,11 +2694,11 @@ function get_prio_from_posts( $posts, $prio_override = false, $freq_override = f
* @return array
*/
private function get_images_from_term( $term ) {
-
+
if ( false === apply_filters( 'aioseo_include_images_in_sitemap', true ) ) {
return array();
}
-
+
$images = array();
$thumbnail_id = get_term_meta( $term->term_id, 'thumbnail_id', true );
if ( $thumbnail_id ) {
From 3092d94e76c6341f1a8955e84079d98bff142ad9 Mon Sep 17 00:00:00 2001
From: wpsmort
Date: Mon, 2 Oct 2017 15:58:51 -0400
Subject: [PATCH 7/9] #1233 Improved wording for >1000 URLs notice (#1234)
---
modules/aioseop_sitemap.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php
index 120f0d6a6..b405dc761 100644
--- a/modules/aioseop_sitemap.php
+++ b/modules/aioseop_sitemap.php
@@ -368,8 +368,8 @@ function sitemap_notices() {
%2$s
',
- __( 'Warning: Your website has a lot of URLs.', 'all-in-one-seo-pack' ),
- sprintf( __( '%s Click here%s to enable Sitemap Indexes and then enable Paginate Sitemap Indexes, and set the Maximum Posts per Sitemap to 1000.', 'all-in-one-seo-pack' ), sprintf( '', esc_url( get_admin_url( null, "admin.php?page=$aioseop_plugin_dirname/modules/aioseop_sitemap.php" ) ) ), '' ) );
+ __( 'Notice: To avoid problems with your XML Sitemap, we strongly recommend you enable Sitemap Indexes and set the Maximum Posts per Sitemap Page to 1000.', 'all-in-one-seo-pack' ),
+ sprintf( __( '%s Click here%s to make these recommended changes.', 'all-in-one-seo-pack' ), sprintf( '', esc_url( get_admin_url( null, "admin.php?page=$aioseop_plugin_dirname/modules/aioseop_sitemap.php" ) ) ), '' ) );
}
}
From 59c7732836b762d2a80cf33cc4febaeb20720336 Mon Sep 17 00:00:00 2001
From: wpsmort
Date: Mon, 2 Oct 2017 16:00:31 -0400
Subject: [PATCH 8/9] #1235 Changed option label for Maximum Posts Per Sitemap
(#1238)
---
modules/aioseop_sitemap.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php
index b405dc761..44f025bd1 100644
--- a/modules/aioseop_sitemap.php
+++ b/modules/aioseop_sitemap.php
@@ -120,7 +120,7 @@ function __construct() {
'condshow' => array( "{$this->prefix}indexes" => 'on' ),
),
'max_posts' => array(
- 'name' => __( 'Maximum Posts Per Sitemap', 'all-in-one-seo-pack' ),
+ 'name' => __( 'Maximum Posts Per Sitemap Page', 'all-in-one-seo-pack' ),
'type' => 'text',
'default' => 50000,
'condshow' => array( "{$this->prefix}indexes" => 'on', "{$this->prefix}paginate" => 'on' ),
From 457b65b6d6f3153f321dc5c92dcf84a62c66a77e Mon Sep 17 00:00:00 2001
From: Michael Torbert
Date: Mon, 2 Oct 2017 16:15:35 -0400
Subject: [PATCH 9/9] remove pagination #1232 (#1236)
---
modules/aioseop_sitemap.php | 37 ++++++++++++-------------------------
1 file changed, 12 insertions(+), 25 deletions(-)
diff --git a/modules/aioseop_sitemap.php b/modules/aioseop_sitemap.php
index 44f025bd1..78b61249a 100644
--- a/modules/aioseop_sitemap.php
+++ b/modules/aioseop_sitemap.php
@@ -20,7 +20,6 @@ class All_in_One_SEO_Pack_Sitemap extends All_in_One_SEO_Pack_Module {
var $comment_string;
var $start_memory_usage = 0;
var $max_posts = 50000;
- var $paginate = false;
var $prio;
var $prio_sel;
var $freq;
@@ -58,7 +57,6 @@ function __construct() {
'filename' => __( "Specifies the name of your sitemap file. This will default to 'sitemap'.", 'all-in-one-seo-pack' ),
'daily_cron' => __( 'Notify search engines based on the selected schedule, and also update static sitemap daily if in use. (this uses WP-Cron, so make sure this is working properly on your server as well)', 'all-in-one-seo-pack' ),
'indexes' => __( 'Organize sitemap entries into distinct files in your sitemap. Enable this only if your sitemap contains over 50,000 URLs or the file is over 5MB in size.', 'all-in-one-seo-pack' ),
- 'paginate' => __( 'Split long sitemaps into separate files.', 'all-in-one-seo-pack' ),
'max_posts' => __( 'Allows you to specify the maximum number of posts in a sitemap (up to 50,000).', 'all-in-one-seo-pack' ),
'posttypes' => __( 'Select which Post Types appear in your sitemap.', 'all-in-one-seo-pack' ),
'taxonomies' => __( 'Select which taxonomy archives appear in your sitemap', 'all-in-one-seo-pack' ),
@@ -79,7 +77,6 @@ function __construct() {
'filename' => '#filename-prefix',
'daily_cron' => '#schedule-updates',
'indexes' => '#enable-sitemap-indexes',
- 'paginate' => '#enable-sitemap-indexes',
'max_posts' => '#enable-sitemap-indexes',
'posttypes' => '#post-types-and-taxonomies',
'taxonomies' => '#post-types-and-taxonomies',
@@ -115,15 +112,11 @@ function __construct() {
'default' => 0,
),
'indexes' => array( 'name' => __( 'Enable Sitemap Indexes', 'all-in-one-seo-pack' ) ),
- 'paginate' => array(
- 'name' => __( 'Paginate Sitemap Indexes', 'all-in-one-seo-pack' ),
- 'condshow' => array( "{$this->prefix}indexes" => 'on' ),
- ),
'max_posts' => array(
'name' => __( 'Maximum Posts Per Sitemap Page', 'all-in-one-seo-pack' ),
'type' => 'text',
'default' => 50000,
- 'condshow' => array( "{$this->prefix}indexes" => 'on', "{$this->prefix}paginate" => 'on' ),
+ 'condshow' => array( "{$this->prefix}indexes" => 'on', "{$this->prefix}indexes" => 'on' ),
),
'posttypes' => array(
'name' => __( 'Post Types', 'all-in-one-seo-pack' ),
@@ -341,10 +334,8 @@ function sitemap_notices() {
global $options;
$options = $this->options;
- if ( ( 'on ' !== $options["{$this->prefix}indexes"] ||
- 'on ' !== $options["{$this->prefix}paginate"] ) &&
- 1001 < $options["{$this->prefix}max_posts"]
- ) {
+ if ( isset( $options["{$this->prefix}indexes"] ) && 'on ' !== $options["{$this->prefix}indexes"] &&
+ 1001 < $options["{$this->prefix}max_posts"] ) {
$post_counts = $this->get_total_post_count( array(
'post_type' => $options["{$this->prefix}posttypes"],
@@ -457,8 +448,7 @@ function daily_update() {
function load_sitemap_options() {
// Load initial options / set defaults.
$this->update_options();
- if ( ! empty( $this->options["{$this->prefix}indexes"] ) && ! empty( $this->options["{$this->prefix}paginate"] ) ) {
- $this->paginate = true;
+ if ( ! empty( $this->options["{$this->prefix}indexes"] ) ) {
if ( $this->options["{$this->prefix}max_posts"] && ( $this->options["{$this->prefix}max_posts"] > 0 ) && ( $this->options["{$this->prefix}max_posts"] < 50000 ) ) {
$this->max_posts = $this->options["{$this->prefix}max_posts"];
}
@@ -1180,7 +1170,7 @@ function flush_rules_hook() {
*/
function query_var_hook( $vars ) {
$vars[] = "{$this->prefix}path";
- if ( $this->paginate ) {
+ if ( ! empty( $this->options["{$this->prefix}indexes"] ) ) {
$vars[] = "{$this->prefix}page";
}
@@ -1407,15 +1397,13 @@ function do_robots() {
* @param string $message
*/
function do_sitemaps( $message = '' ) {
- if ( ! empty( $this->options["{$this->prefix}indexes"] ) && ! empty( $this->options["{$this->prefix}paginate"] ) ) {
- $this->paginate = true;
+ if ( ! empty( $this->options["{$this->prefix}indexes"] ) ) {
if ( $this->options["{$this->prefix}max_posts"] && ( $this->options["{$this->prefix}max_posts"] > 0 ) && ( $this->options["{$this->prefix}max_posts"] < 50000 ) ) {
$this->max_posts = $this->options["{$this->prefix}max_posts"];
} else {
$this->max_posts = 50000;
}
} else {
- $this->paginate = false;
$this->max_posts = 50000;
}
if ( ! $this->options["{$this->prefix}rewrite"] ) {
@@ -1629,7 +1617,7 @@ function get_sitemap_index_filenames() {
if ( 0 == $post_counts[ $sm ] ) {
continue;
}
- if ( $this->paginate ) {
+ if ( ! empty( $this->options["{$this->prefix}indexes"] ) ) {
if ( $post_counts[ $sm ] > $this->max_posts ) {
$count = 1;
for ( $post_count = 0; $post_count < $post_counts[ $sm ]; $post_count += $this->max_posts ) {
@@ -1674,7 +1662,7 @@ function get_sitemap_index_filenames() {
foreach ( $options["{$this->prefix}taxonomies"] as $sm ) {
$term_count = wp_count_terms( $sm, array( 'hide_empty' => true ) );
if ( ! is_wp_error( $term_count ) && ( $term_count > 0 ) ) {
- if ( $this->paginate ) {
+ if ( ! empty( $this->options["{$this->prefix}indexes"] ) ) {
if ( $term_count > $this->max_posts ) {
$count = 1;
for ( $tc = 0; $tc < $term_count; $tc += $this->max_posts ) {
@@ -1800,7 +1788,7 @@ function do_indexed_sitemaps() {
if ( 0 === $post_counts[ $posttype ] ) {
continue;
}
- if ( $this->paginate && ( $post_counts[ $posttype ] > $this->max_posts ) ) {
+ 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, $options["{$this->prefix}filename"] . "_{$posttype}_{$count}" );
@@ -1816,7 +1804,7 @@ function do_indexed_sitemaps() {
foreach ( $options["{$this->prefix}taxonomies"] as $taxonomy ) {
$term_count = wp_count_terms( $taxonomy, array( 'hide_empty' => true ) );
if ( ! is_wp_error( $term_count ) && ( $term_count > 0 ) ) {
- if ( $this->paginate ) {
+ if ( ! empty( $this->options["{$this->prefix}indexes"] ) ) {
if ( $term_count > $this->max_posts ) {
$count = 1;
for ( $tc = 0; $tc < $term_count; $tc += $this->max_posts ) {
@@ -1887,7 +1875,6 @@ function get_simple_sitemap() {
'image:image' => $this->get_images_from_post( (int) get_option( 'page_on_front' ) ),
);
- $this->paginate = false;
if ( $posts ) {
$posts = $this->get_permalink( $posts );
if ( $posts == $home['loc'] ) {
@@ -2885,7 +2872,7 @@ function get_tax_args( $page = 0 ) {
if ( $this->option_isset( 'excl_categories' ) ) {
$args['exclude'] = $this->options[ $this->prefix . 'excl_categories' ];
}
- if ( $this->paginate ) {
+ if ( ! empty( $this->options["{$this->prefix}indexes"] ) ) {
$args['number'] = $this->max_posts;
$args['offset'] = $page * $this->max_posts;
@@ -2953,7 +2940,7 @@ function get_author_prio_data() {
*/
function get_all_post_priority_data( $include = 'any', $status = 'publish', $page = 0 ) {
$posts = $page_query = array();
- if ( $this->paginate ) {
+ if ( ! empty( $this->options["{$this->prefix}indexes"] ) ) {
$page_query = array( 'offset' => $page * $this->max_posts );
}
if ( ( 'publish' === $status ) && ( 'attachment' === $include ) ) {