All in One SEO Pack - Version 3.3.5

Version Description

Download this release

Release Info

Developer benjaminprojas
Plugin Icon 128x128 All in One SEO Pack
Version 3.3.5
Comparing to
See all releases

Code changes from version 3.3.4 to 3.3.5

admin/aioseop_module_class.php CHANGED
@@ -2731,7 +2731,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
2731
  wp_enqueue_script( 'jquery-ui-datepicker' );
2732
  // fall through.
2733
  default:
2734
- $buf .= "<input name='" . esc_attr( $name ) . "' type='" . esc_attr( $options['type'] ) . "' " . wp_kses( $attr, wp_kses_allowed_html( 'data' ) ) . " value='" . esc_attr( $value ) . "'>\n";
2735
  }
2736
 
2737
  // TODO Maybe Change/Add a function for SEO character count.
2731
  wp_enqueue_script( 'jquery-ui-datepicker' );
2732
  // fall through.
2733
  default:
2734
+ $buf .= "<input name='" . esc_attr( $name ) . "' type='" . esc_attr( $options['type'] ) . "' " . wp_kses( $attr, wp_kses_allowed_html( 'data' ) ) . " value='" . esc_attr( $value ) . "' autocomplete='aioseop-" . time() . "'>\n";
2735
  }
2736
 
2737
  // TODO Maybe Change/Add a function for SEO character count.
admin/class-aioseop-helper.php CHANGED
@@ -835,7 +835,7 @@ class AIOSEOP_Helper {
835
  'aiosp_opengraph_meta_key' => __( 'Enter the name of a custom field (or multiple field names separated by commas) to use that field to specify the Open Graph image on Pages or Posts.', 'all-in-one-seo-pack' ),
836
 
837
  // Facebook Settings.
838
- 'aiosp_opengraph_key' => __( 'Enter your Facebook Admin ID here. You can enter multiple IDs separated by a comma. You can look up your Facebook ID using this tool http://findmyfbid.com/', 'all-in-one-seo-pack' ),
839
  'aiosp_opengraph_appid' => __( 'Enter your Facebook App ID here. Information about how to get your Facebook App ID can be found at https://developers.facebook.com/docs/apps/register', 'all-in-one-seo-pack' ),
840
  'aiosp_opengraph_gen_tags' => __( 'Automatically generate article tags for Facebook type article when not provided.', 'all-in-one-seo-pack' ),
841
  'aiosp_opengraph_gen_keywords' => __( 'Use keywords in generated article tags.', 'all-in-one-seo-pack' ),
835
  'aiosp_opengraph_meta_key' => __( 'Enter the name of a custom field (or multiple field names separated by commas) to use that field to specify the Open Graph image on Pages or Posts.', 'all-in-one-seo-pack' ),
836
 
837
  // Facebook Settings.
838
+ 'aiosp_opengraph_key' => __( 'Enter your Facebook Admin ID here. You can enter multiple IDs separated by a comma.', 'all-in-one-seo-pack' ),
839
  'aiosp_opengraph_appid' => __( 'Enter your Facebook App ID here. Information about how to get your Facebook App ID can be found at https://developers.facebook.com/docs/apps/register', 'all-in-one-seo-pack' ),
840
  'aiosp_opengraph_gen_tags' => __( 'Automatically generate article tags for Facebook type article when not provided.', 'all-in-one-seo-pack' ),
841
  'aiosp_opengraph_gen_keywords' => __( 'Use keywords in generated article tags.', 'all-in-one-seo-pack' ),
aioseop_class.php CHANGED
@@ -4382,10 +4382,10 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4382
  if ( ! $this->is_page_included() ) {
4383
 
4384
  $aioseop_robots_meta = new AIOSEOP_Robots_Meta();
4385
- $robots_meta = $aioseop_robots_meta->get_robots_meta();
4386
 
4387
  if ( ! empty( $robots_meta ) ) {
4388
- echo sprintf( '<meta name="robots" content="%s"', esc_attr( $robots_meta ) ) . " />\n";
4389
  }
4390
 
4391
  if ( ! empty( $old_wp_query ) ) {
@@ -4503,7 +4503,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
4503
  }
4504
 
4505
  $aioseop_robots_meta = new AIOSEOP_Robots_Meta();
4506
- $robots_meta = $aioseop_robots_meta->get_robots_meta();
4507
 
4508
  if ( ! empty( $robots_meta ) ) {
4509
  $meta_string .= $robots_meta;
4382
  if ( ! $this->is_page_included() ) {
4383
 
4384
  $aioseop_robots_meta = new AIOSEOP_Robots_Meta();
4385
+ $robots_meta = $aioseop_robots_meta->get_robots_meta_tag();
4386
 
4387
  if ( ! empty( $robots_meta ) ) {
4388
+ echo $robots_meta;
4389
  }
4390
 
4391
  if ( ! empty( $old_wp_query ) ) {
4503
  }
4504
 
4505
  $aioseop_robots_meta = new AIOSEOP_Robots_Meta();
4506
+ $robots_meta = $aioseop_robots_meta->get_robots_meta_tag();
4507
 
4508
  if ( ! empty( $robots_meta ) ) {
4509
  $meta_string .= $robots_meta;
all_in_one_seo_pack.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: All In One SEO Pack
4
  Plugin URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
5
  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.
6
- Version: 3.3.4
7
  Author: Michael Torbert
8
  Author URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
9
  Text Domain: all-in-one-seo-pack
@@ -31,7 +31,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
31
  * The original WordPress SEO plugin.
32
  *
33
  * @package All-in-One-SEO-Pack
34
- * @version 3.3.4
35
  */
36
 
37
  if ( ! defined( 'AIOSEOPPRO' ) ) {
@@ -45,7 +45,7 @@ if ( ! defined( 'AIOSEOP_PLUGIN_NAME' ) ) {
45
  }
46
  }
47
  if ( ! defined( 'AIOSEOP_VERSION' ) ) {
48
- define( 'AIOSEOP_VERSION', '3.3.4' );
49
  }
50
 
51
  /*
@@ -297,7 +297,25 @@ if ( ! function_exists( 'aioseop_activate' ) ) {
297
  delete_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed' );
298
 
299
  if ( AIOSEOPPRO ) {
 
 
300
  $aioseop_update_checker->checkForUpdates();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
301
  }
302
  }
303
  }
3
  Plugin Name: All In One SEO Pack
4
  Plugin URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
5
  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.
6
+ Version: 3.3.5
7
  Author: Michael Torbert
8
  Author URI: https://semperplugins.com/all-in-one-seo-pack-pro-version/
9
  Text Domain: all-in-one-seo-pack
31
  * The original WordPress SEO plugin.
32
  *
33
  * @package All-in-One-SEO-Pack
34
+ * @version 3.3.5
35
  */
36
 
37
  if ( ! defined( 'AIOSEOPPRO' ) ) {
45
  }
46
  }
47
  if ( ! defined( 'AIOSEOP_VERSION' ) ) {
48
+ define( 'AIOSEOP_VERSION', '3.3.5' );
49
  }
50
 
51
  /*
297
  delete_user_meta( get_current_user_id(), 'aioseop_yst_detected_notice_dismissed' );
298
 
299
  if ( AIOSEOPPRO ) {
300
+ global $aioseop_options;
301
+
302
  $aioseop_update_checker->checkForUpdates();
303
+
304
+ if (
305
+ isset( $aioseop_options['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_video_sitemap'] ) &&
306
+ 'on' === $aioseop_options['modules']['aiosp_feature_manager_options']['aiosp_feature_manager_enable_video_sitemap']
307
+ ) {
308
+ $next_scan_timestamp = wp_next_scheduled( 'aiosp_video_sitemap_scan' );
309
+ if ( false !== $next_scan_timestamp && 10 < ( $next_scan_timestamp - time() ) ) {
310
+ // Reschedule cron job to avoid waiting for next (daily) scan.
311
+ wp_unschedule_event( $next_scan_timestamp, 'aiosp_video_sitemap_scan' );
312
+ $next_scan_timestamp = false;
313
+ }
314
+
315
+ if ( false === $next_scan_timestamp ) {
316
+ wp_schedule_single_event( time() + 10, 'aiosp_video_sitemap_scan' );
317
+ }
318
+ }
319
  }
320
  }
321
  }
inc/aioseop_functions.php CHANGED
@@ -1274,7 +1274,10 @@ if ( ! function_exists( 'aioseop_get_logo' ) ) {
1274
  */
1275
  function aioseop_do_shortcodes( $content ) {
1276
  $conflicting_shortcodes = array(
1277
- 'WooCommerce Login' => '[woocommerce_my_account]',
 
 
 
1278
  );
1279
 
1280
  $rtn_conflict_shortcodes = array();
1274
  */
1275
  function aioseop_do_shortcodes( $content ) {
1276
  $conflicting_shortcodes = array(
1277
+ 'WooCommerce Login' => '[woocommerce_my_account]',
1278
+ 'WooCommerce Checkout' => '[woocommerce_checkout]',
1279
+ 'WooCommerce Order Tracking' => '[woocommerce_order_tracking]',
1280
+ 'WooCommerce Cart' => '[woocommerce_cart]',
1281
  );
1282
 
1283
  $rtn_conflict_shortcodes = array();
inc/general/aioseop-robots-meta.php CHANGED
@@ -16,7 +16,7 @@ class AIOSEOP_Robots_Meta {
16
 
17
  /**
18
  * User-defined plugin options.
19
- *
20
  * @since 3.3.1
21
  *
22
  * @var array
@@ -29,9 +29,7 @@ class AIOSEOP_Robots_Meta {
29
  }
30
 
31
  /**
32
- * The get_robots_meta() function.
33
- *
34
- * Returns the noindex & nofollow value for the robots meta tag string.
35
  *
36
  * @since 2.3.5
37
  * @since 2.3.11.5 Added noindex API filter hook for password protected posts.
@@ -41,7 +39,7 @@ class AIOSEOP_Robots_Meta {
41
  *
42
  * @return string
43
  */
44
- public function get_robots_meta() {
45
  $post_type = get_post_type();
46
  $page_number = aioseop_get_page_number();
47
 
@@ -55,7 +53,7 @@ class AIOSEOP_Robots_Meta {
55
  }
56
 
57
  if ( is_front_page() && 0 === $page_number ) {
58
- return $this->get_robots_meta_helper( false, false );
59
  }
60
 
61
  if ( $this->is_static_page() ) {
@@ -80,13 +78,11 @@ class AIOSEOP_Robots_Meta {
80
  $nofollow = true;
81
  }
82
 
83
- return $this->get_robots_meta_helper( $noindex, $nofollow );
84
  }
85
 
86
  /**
87
- * The get_robots_meta_helper() function.
88
- *
89
- * Helper function for get_robots_meta().
90
  *
91
  * @since 3.2.0
92
  *
@@ -95,7 +91,7 @@ class AIOSEOP_Robots_Meta {
95
  *
96
  * @return string
97
  */
98
- private function get_robots_meta_helper( $noindex, $nofollow ) {
99
  $index_value = 'index';
100
  $follow_value = 'follow';
101
 
16
 
17
  /**
18
  * User-defined plugin options.
19
+ *
20
  * @since 3.3.1
21
  *
22
  * @var array
29
  }
30
 
31
  /**
32
+ * Returns the robots meta tag string.
 
 
33
  *
34
  * @since 2.3.5
35
  * @since 2.3.11.5 Added noindex API filter hook for password protected posts.
39
  *
40
  * @return string
41
  */
42
+ public function get_robots_meta_tag() {
43
  $post_type = get_post_type();
44
  $page_number = aioseop_get_page_number();
45
 
53
  }
54
 
55
  if ( is_front_page() && 0 === $page_number ) {
56
+ return $this->get_robots_meta_tag_helper( false, false );
57
  }
58
 
59
  if ( $this->is_static_page() ) {
78
  $nofollow = true;
79
  }
80
 
81
+ return $this->get_robots_meta_tag_helper( $noindex, $nofollow );
82
  }
83
 
84
  /**
85
+ * Helper function for get_robots_meta_tag().
 
 
86
  *
87
  * @since 3.2.0
88
  *
91
  *
92
  * @return string
93
  */
94
+ private function get_robots_meta_tag_helper( $noindex, $nofollow ) {
95
  $index_value = 'index';
96
  $follow_value = 'follow';
97
 
inc/translations.php CHANGED
@@ -252,8 +252,11 @@ if ( ! class_exists( 'AIOSEOP_Translations' ) ) :
252
  return;
253
  }
254
  if ( function_exists( 'wp_get_available_translations' ) ) {
255
- $translations = wp_get_available_translations();
256
- $this->native_name = $translations[ $this->current_locale ]['native_name'];
 
 
 
257
  }
258
  }
259
 
252
  return;
253
  }
254
  if ( function_exists( 'wp_get_available_translations' ) ) {
255
+ $translations = wp_get_available_translations();
256
+
257
+ if ( ! empty( $translations ) ) {
258
+ $this->native_name = $translations[ $this->current_locale ]['native_name'];
259
+ }
260
  }
261
  }
262
 
js/admin/aioseop-admin-functions.js CHANGED
@@ -79,13 +79,13 @@ function aioseopSetClassicEditorTabSwitchEventListener(functionName) {
79
  * Gets the content of the active Classic Editor tab.
80
  *
81
  * @since 3.3.4
 
82
  *
83
  * @return string The content of the active editor tab.
84
  */
85
  function aioseopGetClassicEditorContent() {
86
  if (aioseopIsVisualTab()) {
87
- //tinymce.activeEditor.getContent();
88
- return jQuery('#content_ifr').contents().find('body')[0].innerHTML;
89
  }
90
  return jQuery('.wp-editor-area').val();
91
  }
79
  * Gets the content of the active Classic Editor tab.
80
  *
81
  * @since 3.3.4
82
+ * @since 3.3.5 Use built-in function tinymce.activeEditor.getContent() to grab content.
83
  *
84
  * @return string The content of the active editor tab.
85
  */
86
  function aioseopGetClassicEditorContent() {
87
  if (aioseopIsVisualTab()) {
88
+ return tinymce.activeEditor.getContent({format : 'raw'});
 
89
  }
90
  return jQuery('.wp-editor-area').val();
91
  }
js/admin/aioseop-preview-snippet.js CHANGED
@@ -21,13 +21,16 @@ jQuery(function($){
21
  let skipExcerpt = aioseop_preview_snippet.skipExcerpt;
22
  let isGutenbergEditor = aioseopIsGutenbergEditor();
23
 
24
- aioseopInitPreviewSnippet();
 
 
25
 
26
  /**
27
  * Defines the relevant fields and adds the relevant event listeners based on which editor is active.
28
  *
29
  * @since 3.3.0
30
  * @since 3.3.4 Add support for text tab in Classic Editor.
 
31
  */
32
  function aioseopInitPreviewSnippet() {
33
  let inputFields = [aioseopTitle, aioseopDescription];
@@ -37,25 +40,36 @@ jQuery(function($){
37
  let postExcerpt = $('#excerpt');
38
 
39
  inputFields.push(docTitle, postExcerpt);
 
40
 
41
  aioseopSetClassicEditorTabSwitchEventListener(aioseopUpdatePreviewSnippet);
42
  aioseopSetClassicEditorEventListener(aioseopUpdatePreviewSnippet);
 
 
 
 
43
  }
44
  else {
45
- aioseopSetGutenbergEditorEventListener(aioseopUpdatePreviewSnippet);
 
 
46
  }
 
47
 
 
 
 
 
 
 
 
 
48
  inputFields.forEach(addEvent);
49
  function addEvent(item) {
50
- item.on('input', function () {
51
  aioseopUpdatePreviewSnippet();
52
  });
53
  }
54
-
55
- // Run once on page load.
56
- timeout = setTimeout(function () {
57
- aioseopUpdatePreviewSnippet();
58
- }, 1000);
59
  }
60
 
61
  /**
21
  let skipExcerpt = aioseop_preview_snippet.skipExcerpt;
22
  let isGutenbergEditor = aioseopIsGutenbergEditor();
23
 
24
+ $(window).on("load", function() {
25
+ aioseopInitPreviewSnippet();
26
+ });
27
 
28
  /**
29
  * Defines the relevant fields and adds the relevant event listeners based on which editor is active.
30
  *
31
  * @since 3.3.0
32
  * @since 3.3.4 Add support for text tab in Classic Editor.
33
+ * @since 3.3.5 Run preview snippet only after Classic Editor content iframe is loaded - #3097.
34
  */
35
  function aioseopInitPreviewSnippet() {
36
  let inputFields = [aioseopTitle, aioseopDescription];
40
  let postExcerpt = $('#excerpt');
41
 
42
  inputFields.push(docTitle, postExcerpt);
43
+ aioseopAddPreviewSnippetEventListeners(inputFields)
44
 
45
  aioseopSetClassicEditorTabSwitchEventListener(aioseopUpdatePreviewSnippet);
46
  aioseopSetClassicEditorEventListener(aioseopUpdatePreviewSnippet);
47
+
48
+ $('#content_ifr').load(function() {
49
+ aioseopUpdatePreviewSnippet();
50
+ });
51
  }
52
  else {
53
+ aioseopSetGutenbergEditorEventListener(aioseopUpdatePreviewSnippet);
54
+ aioseopAddPreviewSnippetEventListeners(inputFields)
55
+ aioseopUpdatePreviewSnippet();
56
  }
57
+ }
58
 
59
+ /**
60
+ * Adds event listeners to input fields that need to update the preview snippet on change.
61
+ *
62
+ * @since 3.3.5
63
+ *
64
+ * @param Array inputFields All input fields that need to update the preview snippet on change.
65
+ */
66
+ function aioseopAddPreviewSnippetEventListeners(inputFields) {
67
  inputFields.forEach(addEvent);
68
  function addEvent(item) {
69
+ item.on('keyup', function () {
70
  aioseopUpdatePreviewSnippet();
71
  });
72
  }
 
 
 
 
 
73
  }
74
 
75
  /**
modules/aioseop_sitemap.php CHANGED
@@ -2207,8 +2207,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
2207
 
2208
  $files = apply_filters( 'aioseop_sitemap_index_filenames', $files, $prefix, $suffix );
2209
 
2210
- // Remove Additional Pages index if all pages are static and no extra pages are specified.
2211
- if ( ! $this->does_addl_sitemap_contain_urls() ) {
2212
  $page_to_remove = array( get_site_url() . '/addl-sitemap.xml' );
2213
  $files = $this->remove_urls_from_sitemap_page( $files, $page_to_remove );
2214
  }
@@ -2217,20 +2216,24 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
2217
  }
2218
 
2219
  /**
2220
- * The does_addl_sitemap_contain_urls() function.
2221
- *
2222
- * Checks whether the Additional Pages index will contain URLs.
2223
- * This will not be the case if there is both a static homepage/posts page and there are no additional pages specified.
2224
  *
2225
  * @since 3.2.0
 
2226
  *
2227
- * @return bool
2228
  */
2229
- private function does_addl_sitemap_contain_urls() {
2230
- $is_addl_pages = ! empty( $this->options['aiosp_sitemap_addl_pages'] );
2231
- if ( ! $is_addl_pages && ( 'page' === get_option( 'show_on_front' ) ) ) {
 
 
 
 
2232
  return false;
2233
  }
 
2234
  return true;
2235
  }
2236
 
@@ -3234,47 +3237,55 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
3234
  }
3235
 
3236
  /**
3237
- * The remove_addl_static_pages() function.
3238
- *
3239
- * Removes the homepage/posts page from the Additional Pages index if it is static - #2126.
3240
  *
3241
  * @since 3.2.0
 
3242
  *
3243
- * @param array $pages
3244
- * @return array $pages
3245
  */
3246
  private function remove_addl_static_pages( $pages ) {
 
 
 
 
 
 
 
3247
  $pages_to_remove = array();
3248
- if ( 0 !== (int) get_option( 'page_on_front' ) ) {
3249
- $homepage_url = get_site_url() . '/';
3250
- array_push( $pages_to_remove, $homepage_url );
3251
  }
3252
 
3253
- $static_posts_page_id = (int) get_option( 'page_for_posts' );
3254
- if ( 0 !== $static_posts_page_id ) {
3255
- array_push( $pages_to_remove, get_permalink( $static_posts_page_id ) );
3256
- }
3257
 
3258
- if ( count( $pages_to_remove ) > 0 ) {
3259
- return $this->remove_urls_from_sitemap_page( $pages, $pages_to_remove );
 
 
3260
  }
3261
- return $pages;
 
3262
  }
3263
 
3264
  /**
3265
- * The remove_urls_from_sitemap_page() function.
3266
- *
3267
  * Removes URLs from a sitemap page. This is used both for indexes and pages within indexes.
3268
  *
3269
  * @since 3.2.0
3270
  *
3271
- * @param array $pages
3272
- * @param array $pages_to_remove
3273
- * @return array $pages
3274
  */
3275
  private function remove_urls_from_sitemap_page( $pages, $pages_to_remove ) {
3276
- $count = count( $pages );
3277
- for ( $i = 0; $i < $count; $i++ ) {
 
 
 
 
3278
  if ( in_array( $pages[ $i ]['loc'], $pages_to_remove, true ) ) {
3279
  unset( $pages[ $i ] );
3280
  }
2207
 
2208
  $files = apply_filters( 'aioseop_sitemap_index_filenames', $files, $prefix, $suffix );
2209
 
2210
+ if ( ! $this->should_addl_sitemap_exist() ) {
 
2211
  $page_to_remove = array( get_site_url() . '/addl-sitemap.xml' );
2212
  $files = $this->remove_urls_from_sitemap_page( $files, $page_to_remove );
2213
  }
2216
  }
2217
 
2218
  /**
2219
+ * Checks whether the addl-sitemap file should be added to the root sitemap index.
2220
+ * This should not happen if both the static homepage/posts page have been set and no additional pages have been specified manually.
 
 
2221
  *
2222
  * @since 3.2.0
2223
+ * @since 3.3.5 Fix issue where addl-sitemap file is not added to root when static pages are set but not being used - #3090.
2224
  *
2225
+ * @return bool Whether or not the addl-sitemap file should be added to the root sitemap index.
2226
  */
2227
+ private function should_addl_sitemap_exist() {
2228
+ $are_addl_pages = ! empty( $this->options['aiosp_sitemap_addl_pages'] );
2229
+ $static_homepage_id = (int) get_option( 'page_on_front' );
2230
+ $is_static_homepage_set = ( 0 !== $static_homepage_id ) ? true : false;
2231
+ $is_homepage_set_to_latest_posts = ( 'posts' === get_option( 'show_on_front' ) ) ? true : false;
2232
+
2233
+ if ( ! $is_homepage_set_to_latest_posts && $is_static_homepage_set && ! $are_addl_pages ) {
2234
  return false;
2235
  }
2236
+
2237
  return true;
2238
  }
2239
 
3237
  }
3238
 
3239
  /**
3240
+ * Removes static pages (set under Settings > Reading) from the addl-sitemap file - #2126.
 
 
3241
  *
3242
  * @since 3.2.0
3243
+ * @since 3.3.5 Fixed a bug where the addl-sitemap file returns a 404 error when static pages have not been cleared - #3090.
3244
  *
3245
+ * @param array $pages Pages inside the addl-sitemap file.
3246
+ * @return array $pages Filtered pages without static pages.
3247
  */
3248
  private function remove_addl_static_pages( $pages ) {
3249
+ $static_homepage_id = (int) get_option( 'page_on_front' );
3250
+ $is_static_homepage_set = ( 0 !== $static_homepage_id ) ? true : false;
3251
+ $static_blog_page_id = (int) get_option( 'page_for_posts' );
3252
+ $is_static_blog_page_set = ( 0 !== $static_blog_page_id ) ? true : false;
3253
+ $is_homepage_set_to_latest_posts = ( 'posts' === get_option( 'show_on_front' ) ) ? true : false;
3254
+ $are_addl_pages_set = ! empty( $this->options['aiosp_sitemap_addl_pages'] );
3255
+
3256
  $pages_to_remove = array();
3257
+ if ( $is_static_blog_page_set ) {
3258
+ array_push( $pages_to_remove, get_permalink( $static_blog_page_id ) );
 
3259
  }
3260
 
3261
+ if ( ! $is_homepage_set_to_latest_posts && $is_static_homepage_set ) {
3262
+ array_push( $pages_to_remove, get_permalink( $is_static_homepage_set ) );
 
 
3263
 
3264
+ if ( $are_addl_pages_set ) {
3265
+ $homepage_url = get_site_url() . '/';
3266
+ array_push( $pages_to_remove, $homepage_url );
3267
+ }
3268
  }
3269
+
3270
+ return $this->remove_urls_from_sitemap_page( $pages, $pages_to_remove );
3271
  }
3272
 
3273
  /**
 
 
3274
  * Removes URLs from a sitemap page. This is used both for indexes and pages within indexes.
3275
  *
3276
  * @since 3.2.0
3277
  *
3278
+ * @param array $pages All pages, including the ones that have to be removed.
3279
+ * @param array $pages_to_remove The pages that have to be removed.
3280
+ * @return array $pages The remaining pages.
3281
  */
3282
  private function remove_urls_from_sitemap_page( $pages, $pages_to_remove ) {
3283
+ if ( empty( $pages ) ) {
3284
+ return $pages;
3285
+ }
3286
+
3287
+ $page_count = count( $pages );
3288
+ for ( $i = 0; $i < $page_count; $i++ ) {
3289
  if ( in_array( $pages[ $i ]['loc'], $pages_to_remove, true ) ) {
3290
  unset( $pages[ $i ] );
3291
  }
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === All in One SEO Pack ===
2
- Contributors: hallsofmontezuma, semperplugins, wpsmort, arnaudbroes
3
  Tags: SEO, Google Search Console, XML Sitemap, meta description, meta title, noindex
4
  Requires at least: 4.9
5
  Tested up to: 5.3
6
- Stable tag: 3.3.4
7
  License: GPLv2 or later
8
  Requires PHP: 5.2.4
9
 
1
  === All in One SEO Pack ===
2
+ Contributors: semperplugins, smub, benjaminprojas
3
  Tags: SEO, Google Search Console, XML Sitemap, meta description, meta title, noindex
4
  Requires at least: 4.9
5
  Tested up to: 5.3
6
+ Stable tag: 3.3.5
7
  License: GPLv2 or later
8
  Requires PHP: 5.2.4
9