All in One SEO Pack - Version 2.1.6

Version Description

Download this release

Release Info

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

Code changes from version 2.1.5 to 2.1.6

aioseop_class.php CHANGED
@@ -173,6 +173,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
173
  "ga_use_universal_analytics" => __( "Use the new Universal Analytics tracking code for Google Analytics; do this for new analytics accounts.", 'all_in_one_seo_pack' ),
174
  "ga_domain" => __( "Enter your domain name if you have enabled tracking of Subdomains in Google Analytics.<br /><a href='http://semperplugins.com/documentation/google-settings/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
175
  "ga_multi_domain" => __( "Check this if you have enabled tracking of Multiple top-level domains in Google Analytics.<br /><a href='http://semperplugins.com/documentation/google-settings/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
 
176
  "ga_display_advertising"=> __( "Support for Doubleclick Display Advertising tracking.", 'all_in_one_seo_pack' ),
177
  "ga_exclude_users" => __( "Exclude logged-in users from Google Analytics tracking by role.", 'all_in_one_seo_pack' ),
178
  "ga_track_outbound_links"=> __( "Check this if you want to track outbound links with Google Analytics.<br /><a href='http://semperplugins.com/documentation/google-settings/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
@@ -396,6 +397,10 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
396
  'name' => __( 'Track Multiple Domains:', 'all_in_one_seo_pack' ),
397
  'default' => 0,
398
  'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ) ) ),
 
 
 
 
399
  "ga_display_advertising"=> Array(
400
  'name' => __( '"Display Advertising" Tracking:', 'all_in_one_seo_pack' ),
401
  'type' => 'checkbox',
@@ -487,7 +492,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
487
  });
488
  });
489
  </script>
490
- <div class="preview_snippet"><div id="aioseop_snippet"><h3><a id="aioseop_snippet_title">%s</a></h3><div><div><cite id="aioseop_snippet_link">%s</cite></div><span id="aioseop_snippet_description">%s</span></div></div></div>' ),
491
  'title' => Array( 'name' => __( 'Title', 'all_in_one_seo_pack' ), 'type' => 'text', 'count' => true, 'size' => 60 ),
492
  'description' => Array( 'name' => __( 'Description', 'all_in_one_seo_pack' ), 'type' => 'textarea', 'count' => true, 'cols' => 80, 'rows' => 2 ),
493
  'keywords' => Array( 'name' => __( 'Keywords (comma separated)', 'all_in_one_seo_pack' ), 'type' => 'text' ),
@@ -552,7 +557,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
552
  'name' => __( 'Google Settings', 'all_in_one_seo_pack' ),
553
  'help_link' => 'http://semperplugins.com/documentation/google-settings/',
554
  'options' => Array( "google_publisher", "google_disable_profile", "google_author_advanced", "google_author_location", "google_enable_publisher" , "google_specify_publisher",
555
- "google_connect", "google_analytics_id", "ga_use_universal_analytics", "ga_domain", "ga_multi_domain", "ga_display_advertising", "ga_exclude_users", "ga_track_outbound_links" )
556
  ),
557
  'noindex' => Array(
558
  'name' => __( 'Noindex Settings', 'all_in_one_seo_pack' ),
@@ -594,6 +599,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
594
  $wp_query->is_attachment = true;
595
  else
596
  $wp_query->is_single = true;
 
597
  if ( get_option( 'show_on_front' ) == 'page' ) {
598
  if ( is_page() && $post->ID == get_option( 'page_on_front' ) )
599
  $wp_query->is_front_page = true;
@@ -606,20 +612,48 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
606
  $args['options']['save'] = false;
607
  $wp_query->queried_object = $post;
608
 
609
- $title = $this->wp_title();
610
- if ( empty( $title ) ) $title = $post->post_title;
 
 
 
 
 
 
 
 
611
 
612
  if ( ( $aioseop_options['aiosp_can'] ) && ( $url = $this->aiosp_mrt_get_url( $wp_query ) ) )
613
  $url = apply_filters( 'aioseop_canonical_url', $url );
614
  if ( !$url ) $url = get_permalink();
615
 
 
 
616
  $description = $this->get_aioseop_description( $post );
617
- $description = apply_filters( 'aioseop_description', $description );
 
618
 
619
  if ( $this->strlen( $title ) > 70 ) $title = $this->trim_excerpt_without_filters( $title, 70 ) . '...';
620
  if ( $this->strlen( $description ) > 156 ) $description = $this->trim_excerpt_without_filters( $description, 156 ) . '...';
621
 
622
- $args['value'] = sprintf( $args['value'], esc_attr( strip_tags( $title ) ), esc_url( $url ), esc_attr( strip_tags( $description ) ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
623
  $buf = $this->get_option_row( $args['name'], $args['options'], $args );
624
 
625
  wp_reset_postdata();
@@ -1257,7 +1291,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1257
  }
1258
  $meta_string .= sprintf( "<meta name=\"description\" content=\"%s\" />\n", $description );
1259
  }
1260
-
1261
  $keywords = apply_filters( 'aioseop_keywords', $keywords );
1262
 
1263
  if ( isset( $aioseop_options['aiosp_togglekeywords'] ) )
@@ -1314,7 +1348,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1314
 
1315
  foreach( Array( 'page_meta', 'post_meta', 'home_meta', 'front_meta' ) as $meta ) {
1316
  if ( !empty( $aioseop_options["aiosp_{$meta}_tags" ] ) )
1317
- $$meta = html_entity_decode( stripslashes( $aioseop_options["aiosp_{$meta}_tags" ] ) );
1318
  else
1319
  $$meta = '';
1320
  }
@@ -1706,9 +1740,13 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1706
  if ( !empty( $aioseop_options['aiosp_ga_multi_domain'] ) ) {
1707
  $allow_linker = "'allowLinker': true";
1708
  }
1709
- $display_advertising = '';
1710
  if (!empty( $aioseop_options['aiosp_ga_display_advertising'] ) ) {
1711
- $display_advertising = "ga('require', 'displayfeatures');";
 
 
 
 
1712
  }
1713
  $js_options = Array();
1714
  foreach( Array( 'cookie_domain', 'allow_linker' ) as $opts ) {
@@ -1727,7 +1765,7 @@ class All_in_One_SEO_Pack extends All_in_One_SEO_Pack_Module {
1727
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
1728
 
1729
  ga('create', '{$analytics_id}'{$js_options});
1730
- {$display_advertising}
1731
  ga('send', 'pageview');
1732
  </script>
1733
 
@@ -1759,6 +1797,11 @@ function aiosp_google_analytics() {
1759
  _gaq.push(['_setAccount', '<?php
1760
  echo $aioseop_options['aiosp_google_analytics_id'];
1761
  ?>']);
 
 
 
 
 
1762
  <?php if ( !empty( $aioseop_options['aiosp_ga_multi_domain'] ) ) {
1763
  ?> _gaq.push(['_setAllowLinker', true]);
1764
  <?php
@@ -1822,19 +1865,25 @@ function aiosp_google_analytics() {
1822
  }
1823
  }
1824
  }
 
 
 
 
 
 
 
1825
 
1826
  aiosp_addLoadEvent(function () {
1827
  var links = document.getElementsByTagName('a');
1828
  for (var x=0; x < links.length; x++) {
1829
  if (typeof links[x] == 'undefined') continue;
1830
- if (typeof links[x].onclick != 'undefined') continue;
1831
- links[x].onclick = function () {
1832
  var mydomain = new RegExp(document.domain, 'i');
1833
  href = getAttr(this, 'href');
1834
- if(href && href.toLowerCase().indexOf('http') === 0 && !mydomain.test(href)) {
1835
  recordOutboundLink(this, 'Outbound Links', href);
1836
  }
1837
- }
1838
  }
1839
  });
1840
  </script>
@@ -1987,14 +2036,14 @@ function aiosp_google_analytics() {
1987
  $description = $this->get_post_description( $blog_page );
1988
  if ( empty( $description ) && is_object( $post ) && !is_archive() && empty( $blog_page ) )
1989
  $description = $this->get_post_description( $post );
 
1990
  return $description;
1991
  }
1992
 
1993
  function replace_title( $content, $title ) {
1994
  $title = trim( strip_tags( $title ) );
1995
- $title_tag_start = "<title>";
1996
- $title_tag_end = "</title>";
1997
- $len_start = $this->strlen( $title_tag_start );
1998
  $title = stripslashes( trim( $title ) );
1999
  $start = $this->strpos( $content, $title_tag_start );
2000
  $end = $this->strpos( $content, $title_tag_end );
@@ -2003,7 +2052,7 @@ function aiosp_google_analytics() {
2003
  $this->title_end = $end;
2004
  $this->orig_title = $title;
2005
 
2006
- return preg_replace( '/<title>(.*?)<\/title>/is', '<title>' . preg_replace('/(\$|\\\\)(?=\d)/', '\\\\\1', strip_tags( $title ) ) . '</title>', $content, 1 );
2007
  }
2008
 
2009
  function internationalize( $in ) {
@@ -2178,7 +2227,7 @@ function aiosp_google_analytics() {
2178
  $title = $this->internationalize( $post->post_title );
2179
  if ( !$title )
2180
  $title = $this->internationalize( $this->get_original_title( '', false ) );
2181
- $title = get_the_title( $post->post_parent ) . ' ' . $title . ' ' . get_option( 'blogname' );
2182
  apply_filters( 'aioseop_attachment_title', $title );
2183
  } else if ( is_page() || $this->is_static_posts_page() || ( is_home() && !$this->is_static_posts_page() ) ) {
2184
  if ( $post === null ) return false;
@@ -2331,8 +2380,10 @@ function aiosp_google_analytics() {
2331
  global $aioseop_options;
2332
  $title = false;
2333
  $post = $this->get_queried_object();
2334
- if ( !empty( $aioseop_options['aiosp_rewrite_titles'] ) )
2335
  $title = $this->get_aioseop_title( $post );
 
 
2336
  if ( $title === false )
2337
  $title = $this->get_original_title();
2338
  return apply_filters( 'aioseop_title', $title );
173
  "ga_use_universal_analytics" => __( "Use the new Universal Analytics tracking code for Google Analytics; do this for new analytics accounts.", 'all_in_one_seo_pack' ),
174
  "ga_domain" => __( "Enter your domain name if you have enabled tracking of Subdomains in Google Analytics.<br /><a href='http://semperplugins.com/documentation/google-settings/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
175
  "ga_multi_domain" => __( "Check this if you have enabled tracking of Multiple top-level domains in Google Analytics.<br /><a href='http://semperplugins.com/documentation/google-settings/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
176
+ "ga_anonymize_ip" => __( "Support for IP Anonymization in Google Analytics.", 'all_in_one_seo_pack' ),
177
  "ga_display_advertising"=> __( "Support for Doubleclick Display Advertising tracking.", 'all_in_one_seo_pack' ),
178
  "ga_exclude_users" => __( "Exclude logged-in users from Google Analytics tracking by role.", 'all_in_one_seo_pack' ),
179
  "ga_track_outbound_links"=> __( "Check this if you want to track outbound links with Google Analytics.<br /><a href='http://semperplugins.com/documentation/google-settings/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
397
  'name' => __( 'Track Multiple Domains:', 'all_in_one_seo_pack' ),
398
  'default' => 0,
399
  'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ) ) ),
400
+ "ga_anonymize_ip"=> Array(
401
+ 'name' => __( 'Anonymize IP Addresses:', 'all_in_one_seo_pack' ),
402
+ 'type' => 'checkbox',
403
+ 'condshow' => Array( 'aiosp_google_analytics_id' => Array( 'lhs' => 'aiosp_google_analytics_id', 'op' => '!=', 'rhs' => '' ) ) ),
404
  "ga_display_advertising"=> Array(
405
  'name' => __( '"Display Advertising" Tracking:', 'all_in_one_seo_pack' ),
406
  'type' => 'checkbox',
492
  });
493
  });
494
  </script>
495
+ <div class="preview_snippet"><div id="aioseop_snippet"><h3><a>%s</a></h3><div><div><cite id="aioseop_snippet_link">%s</cite></div><span id="aioseop_snippet_description">%s</span></div></div></div>' ),
496
  'title' => Array( 'name' => __( 'Title', 'all_in_one_seo_pack' ), 'type' => 'text', 'count' => true, 'size' => 60 ),
497
  'description' => Array( 'name' => __( 'Description', 'all_in_one_seo_pack' ), 'type' => 'textarea', 'count' => true, 'cols' => 80, 'rows' => 2 ),
498
  'keywords' => Array( 'name' => __( 'Keywords (comma separated)', 'all_in_one_seo_pack' ), 'type' => 'text' ),
557
  'name' => __( 'Google Settings', 'all_in_one_seo_pack' ),
558
  'help_link' => 'http://semperplugins.com/documentation/google-settings/',
559
  'options' => Array( "google_publisher", "google_disable_profile", "google_author_advanced", "google_author_location", "google_enable_publisher" , "google_specify_publisher",
560
+ "google_connect", "google_analytics_id", "ga_use_universal_analytics", "ga_domain", "ga_multi_domain", "ga_anonymize_ip", "ga_display_advertising", "ga_exclude_users", "ga_track_outbound_links" )
561
  ),
562
  'noindex' => Array(
563
  'name' => __( 'Noindex Settings', 'all_in_one_seo_pack' ),
599
  $wp_query->is_attachment = true;
600
  else
601
  $wp_query->is_single = true;
602
+ if ( empty( $wp_query->is_front_page ) ) $wp_query->is_front_page = false;
603
  if ( get_option( 'show_on_front' ) == 'page' ) {
604
  if ( is_page() && $post->ID == get_option( 'page_on_front' ) )
605
  $wp_query->is_front_page = true;
612
  $args['options']['save'] = false;
613
  $wp_query->queried_object = $post;
614
 
615
+ if ( !empty( $post ) && !$wp_query->is_home && !$wp_query->is_front_page ) {
616
+ $title = $this->internationalize( get_post_meta( $post->ID, "_aioseop_title", true ) );
617
+ if ( empty( $title ) ) $title = $post->post_title;
618
+ }
619
+
620
+ $title_format = '';
621
+ if ( empty( $title ) ) {
622
+ $title = $this->wp_title();
623
+ $title_format = '%post_title%';
624
+ }
625
 
626
  if ( ( $aioseop_options['aiosp_can'] ) && ( $url = $this->aiosp_mrt_get_url( $wp_query ) ) )
627
  $url = apply_filters( 'aioseop_canonical_url', $url );
628
  if ( !$url ) $url = get_permalink();
629
 
630
+ $title = $this->apply_cf_fields( $title );
631
+
632
  $description = $this->get_aioseop_description( $post );
633
+ $description = $this->apply_cf_fields( $description );
634
+ $description = apply_filters( 'aioseop_description', $description );
635
 
636
  if ( $this->strlen( $title ) > 70 ) $title = $this->trim_excerpt_without_filters( $title, 70 ) . '...';
637
  if ( $this->strlen( $description ) > 156 ) $description = $this->trim_excerpt_without_filters( $description, 156 ) . '...';
638
 
639
+ if ( empty( $title_format ) ) {
640
+ if ( is_page() )
641
+ $title_format = $aioseop_options['aiosp_page_title_format'];
642
+ elseif ( is_single() )
643
+ $title_format = $this->get_post_title_format();
644
+ }
645
+ if ( empty( $title_format ) ) {
646
+ $title = '<span id="aioseop_snippet_title">' . esc_attr( strip_tags( $title ) ) . '</span>';
647
+ } else {
648
+ $title_format = str_replace( '%blog_title%', get_bloginfo( 'name' ), $title_format );
649
+ $title_format = $this->apply_cf_fields( $title_format );
650
+ $title_format = str_replace( '%post_title%', '<span id="aioseop_snippet_title">' . esc_attr( strip_tags( $title ) ) . '</span>', $title_format );
651
+ $title_format = str_replace( '%page_title%', '<span id="aioseop_snippet_title">' . esc_attr( strip_tags( $title ) ) . '</span>', $title_format );
652
+ $title_format = preg_replace( '/%([^%]*?)%/', '', $title_format );
653
+ $title = $title_format;
654
+ }
655
+
656
+ $args['value'] = sprintf( $args['value'], $title, esc_url( $url ), esc_attr( strip_tags( $description ) ) );
657
  $buf = $this->get_option_row( $args['name'], $args['options'], $args );
658
 
659
  wp_reset_postdata();
1291
  }
1292
  $meta_string .= sprintf( "<meta name=\"description\" content=\"%s\" />\n", $description );
1293
  }
1294
+ $keywords = $this->apply_cf_fields( $keywords );
1295
  $keywords = apply_filters( 'aioseop_keywords', $keywords );
1296
 
1297
  if ( isset( $aioseop_options['aiosp_togglekeywords'] ) )
1348
 
1349
  foreach( Array( 'page_meta', 'post_meta', 'home_meta', 'front_meta' ) as $meta ) {
1350
  if ( !empty( $aioseop_options["aiosp_{$meta}_tags" ] ) )
1351
+ $$meta = html_entity_decode( stripslashes( $aioseop_options["aiosp_{$meta}_tags" ] ), ENT_QUOTES );
1352
  else
1353
  $$meta = '';
1354
  }
1740
  if ( !empty( $aioseop_options['aiosp_ga_multi_domain'] ) ) {
1741
  $allow_linker = "'allowLinker': true";
1742
  }
1743
+ $extra_options = '';
1744
  if (!empty( $aioseop_options['aiosp_ga_display_advertising'] ) ) {
1745
+ $extra_options = "ga('require', 'displayfeatures');";
1746
+ }
1747
+ if ( !empty( $aioseop_options['aiosp_ga_anonymize_ip'] ) ) {
1748
+ if ( !empty( $extra_options ) ) $extra_options .= "\n\t\t\t";
1749
+ $extra_options .= "ga('set', 'anonymizeIp', true);";
1750
  }
1751
  $js_options = Array();
1752
  foreach( Array( 'cookie_domain', 'allow_linker' ) as $opts ) {
1765
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
1766
 
1767
  ga('create', '{$analytics_id}'{$js_options});
1768
+ {$extra_options}
1769
  ga('send', 'pageview');
1770
  </script>
1771
 
1797
  _gaq.push(['_setAccount', '<?php
1798
  echo $aioseop_options['aiosp_google_analytics_id'];
1799
  ?>']);
1800
+ <?php if ( !empty( $aioseop_options['aiosp_ga_anonymize_ip'] ) ) {
1801
+ ?> _gaq.push(['_gat._anonymizeIp']);
1802
+ <?php
1803
+ }
1804
+ ?>
1805
  <?php if ( !empty( $aioseop_options['aiosp_ga_multi_domain'] ) ) {
1806
  ?> _gaq.push(['_setAllowLinker', true]);
1807
  <?php
1865
  }
1866
  }
1867
  }
1868
+
1869
+ function aiosp_addEvent(element, evnt, funct){
1870
+ if (element.attachEvent)
1871
+ return element.attachEvent('on'+evnt, funct);
1872
+ else
1873
+ return element.addEventListener(evnt, funct, false);
1874
+ }
1875
 
1876
  aiosp_addLoadEvent(function () {
1877
  var links = document.getElementsByTagName('a');
1878
  for (var x=0; x < links.length; x++) {
1879
  if (typeof links[x] == 'undefined') continue;
1880
+ aiosp_addEvent( links[x], 'onclick', function () {
 
1881
  var mydomain = new RegExp(document.domain, 'i');
1882
  href = getAttr(this, 'href');
1883
+ if (href && href.toLowerCase().indexOf('http') === 0 && !mydomain.test(href)) {
1884
  recordOutboundLink(this, 'Outbound Links', href);
1885
  }
1886
+ });
1887
  }
1888
  });
1889
  </script>
2036
  $description = $this->get_post_description( $blog_page );
2037
  if ( empty( $description ) && is_object( $post ) && !is_archive() && empty( $blog_page ) )
2038
  $description = $this->get_post_description( $post );
2039
+ $description = $this->apply_cf_fields( $description );
2040
  return $description;
2041
  }
2042
 
2043
  function replace_title( $content, $title ) {
2044
  $title = trim( strip_tags( $title ) );
2045
+ $title_tag_start = "<title";
2046
+ $title_tag_end = "</title";
 
2047
  $title = stripslashes( trim( $title ) );
2048
  $start = $this->strpos( $content, $title_tag_start );
2049
  $end = $this->strpos( $content, $title_tag_end );
2052
  $this->title_end = $end;
2053
  $this->orig_title = $title;
2054
 
2055
+ return preg_replace( '/<title([^>]*?)\s*>([^<]*?)<\/title\s*>/is', '<title\\1>' . preg_replace('/(\$|\\\\)(?=\d)/', '\\\\\1', strip_tags( $title ) ) . '</title>', $content, 1 );
2056
  }
2057
 
2058
  function internationalize( $in ) {
2227
  $title = $this->internationalize( $post->post_title );
2228
  if ( !$title )
2229
  $title = $this->internationalize( $this->get_original_title( '', false ) );
2230
+ $title = get_the_title( $post->post_parent ) . ' ' . $title . ' – ' . get_option( 'blogname' );
2231
  apply_filters( 'aioseop_attachment_title', $title );
2232
  } else if ( is_page() || $this->is_static_posts_page() || ( is_home() && !$this->is_static_posts_page() ) ) {
2233
  if ( $post === null ) return false;
2380
  global $aioseop_options;
2381
  $title = false;
2382
  $post = $this->get_queried_object();
2383
+ if ( !empty( $aioseop_options['aiosp_rewrite_titles'] ) ) {
2384
  $title = $this->get_aioseop_title( $post );
2385
+ $title = $this->apply_cf_fields( $title );
2386
+ }
2387
  if ( $title === false )
2388
  $title = $this->get_original_title();
2389
  return apply_filters( 'aioseop_title', $title );
aioseop_functions.php CHANGED
@@ -190,17 +190,26 @@ if ( !function_exists( 'aioseop_ajax_save_meta' ) ) {
190
  else
191
  check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' );
192
  $post_id = intval( $_POST['post_id'] );
193
- $new_meta = $_POST['new_meta'];
194
  $target = $_POST['target_meta'];
195
- update_post_meta( $post_id, '_aioseop_' . $target, esc_attr( $new_meta ) );
196
- $result = get_post_meta( $post_id, '_aioseop_' . $target, true );
197
- if( $result != '' ): $label = $result;
198
- else: $label = ''; $result = '<strong><i>' . __( 'No', 'all_in_one_seo_pack' ) . ' ' . $target . '</i></strong>' ; endif;
199
- $output = $result . '<a id="' . $target . 'editlink' . $post_id . '" href="javascript:void(0);"';
200
- $output .= 'onclick=\'aioseop_ajax_edit_meta_form(' . $post_id . ', ' . json_encode( $label ) . ', "' . $target . '");return false;\' title="' . __('Edit') . '">';
 
 
 
 
 
 
 
 
 
201
  $output .= '<img class="aioseop_edit_button" id="aioseop_edit_id" src="' . AIOSEOP_PLUGIN_IMAGES_URL . '/cog_edit.png" /></a>';
202
- die( "jQuery('div#aioseop_" . $target . "_" . $post_id . "').fadeOut('fast', function() {
203
- jQuery('div#aioseop_" . $target . "_" . $post_id . "').html('" . addslashes_gpc($output) . "').fadeIn('fast');
204
  });" );
205
  }
206
  }
@@ -454,11 +463,14 @@ if ( !function_exists( 'aioseop_mrt_pccolumn' ) ) {
454
  <div class="aioseop_mpc_admin_meta_options"
455
  id="aioseop_<?php print $target; ?>_<?php echo $id; ?>"
456
  style="float:left;">
457
- <?php $content = htmlspecialchars( stripslashes( get_post_meta( $id, "_aioseop_" . $target, TRUE ) ) );
458
- if( !empty($content) ): $label = esc_js( $content );
459
- else: $label = ''; $content = '<strong><i>No ' . $target . '</i></strong>' ; endif;
460
- print $content . '<a id="' . $target . 'editlink' . $id . '" href="javascript:void(0);" onclick=\'aioseop_ajax_edit_meta_form(' .
461
- $id . ', "' . str_replace( Array( '"', '&quot;' ), Array( '\x22', '\x22' ), esc_js( $label ) ) . '", "' . $target . '");return false;\' title="' . __('Edit') . '">';
 
 
 
462
  print "<img class='aioseop_edit_button'
463
  id='aioseop_edit_id'
464
  src='" . AIOSEOP_PLUGIN_IMAGES_URL . "cog_edit.png' /></a>";
@@ -574,6 +586,24 @@ if ( !function_exists( 'aioseop_add_contactmethods' ) ) {
574
  }
575
  }
576
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
577
  /***
578
  * JSON support for PHP < 5.2
579
  */
190
  else
191
  check_ajax_referer( 'screen-options-nonce', 'screenoptionnonce' );
192
  $post_id = intval( $_POST['post_id'] );
193
+ $new_meta = strip_tags( $_POST['new_meta'] );
194
  $target = $_POST['target_meta'];
195
+ $result = '';
196
+ if ( in_array( $target, Array( 'title', 'description', 'keywords' ) ) && current_user_can( 'edit_post', $post_id ) ) {
197
+ update_post_meta( $post_id, '_aioseop_' . $target, esc_attr( $new_meta ) );
198
+ $result = get_post_meta( $post_id, '_aioseop_' . $target, true );
199
+ } else {
200
+ die();
201
+ }
202
+ if( $result != '' ):
203
+ $label = "<label id='aioseop_label_{$target}_{$post_id}'>" . $result . '</label>';
204
+ else:
205
+ $label = '';
206
+ $label = "<label id='aioseop_label_{$target}_{$post_id}'></label><strong><i>" . __( 'No', 'all_in_one_seo_pack' ) . ' ' . $target . '</i></strong>';
207
+ endif;
208
+ $output = $label . '<a id="' . $target . 'editlink' . $post_id . '" href="javascript:void(0);"';
209
+ $output .= 'onclick=\'aioseop_ajax_edit_meta_form(' . $post_id . ', "' . $target . '");return false;\' title="' . __('Edit') . '">';
210
  $output .= '<img class="aioseop_edit_button" id="aioseop_edit_id" src="' . AIOSEOP_PLUGIN_IMAGES_URL . '/cog_edit.png" /></a>';
211
+ die( "jQuery('div#aioseop_" . $target . "_" . $post_id . "').fadeOut('fast', function() { var my_label = " . json_encode( $output ) . ";
212
+ jQuery('div#aioseop_" . $target . "_" . $post_id . "').html(my_label).fadeIn('fast');
213
  });" );
214
  }
215
  }
463
  <div class="aioseop_mpc_admin_meta_options"
464
  id="aioseop_<?php print $target; ?>_<?php echo $id; ?>"
465
  style="float:left;">
466
+ <?php $content = strip_tags( stripslashes( get_post_meta( $id, "_aioseop_" . $target, TRUE ) ) );
467
+ if( !empty($content) ):
468
+ $label = "<label id='aioseop_label_{$target}_{$id}'>" . $content . '</label>';
469
+ else:
470
+ $label = "<label id='aioseop_label_{$target}_{$id}'></label><strong><i>No " . $target . '</i></strong>';
471
+ endif;
472
+ print $label . '<a id="' . $target . 'editlink' . $id . '" href="javascript:void(0);" onclick=\'aioseop_ajax_edit_meta_form(' .
473
+ $id . ', "' . $target . '");return false;\' title="' . __('Edit') . '">';
474
  print "<img class='aioseop_edit_button'
475
  id='aioseop_edit_id'
476
  src='" . AIOSEOP_PLUGIN_IMAGES_URL . "cog_edit.png' /></a>";
586
  }
587
  }
588
 
589
+ /***
590
+ * Utility function for inserting elements into associative arrays by key
591
+ */
592
+ if ( !function_exists( 'aioseop_array_insert_after' ) ) {
593
+ function aioseop_array_insert_after( $arr, $insertKey, $newValues ) {
594
+ $keys = array_keys($arr);
595
+ $vals = array_values($arr);
596
+ $insertAfter = array_search($insertKey, $keys) + 1;
597
+ $keys2 = array_splice($keys, $insertAfter);
598
+ $vals2 = array_splice($vals, $insertAfter);
599
+ foreach( $newValues as $k => $v ) {
600
+ $keys[] = $k;
601
+ $vals[] = $v;
602
+ }
603
+ return array_merge(array_combine($keys, $vals), array_combine($keys2, $vals2));
604
+ }
605
+ }
606
+
607
  /***
608
  * JSON support for PHP < 5.2
609
  */
aioseop_module_class.php CHANGED
@@ -288,6 +288,27 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Module' ) ) {
288
  return $output;
289
  }
290
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
  /**
292
  * Returns child blogs of parent in a multisite.
293
  */
288
  return $output;
289
  }
290
 
291
+ /*** adds support for using %cf_(name of field)% for using custom fields / Advanced Custom Fields in titles / descriptions etc. ***/
292
+ function apply_cf_fields( $format ) {
293
+ return preg_replace_callback( '/%cf_([^%]*?)%/', Array( $this, 'cf_field_replace' ), $format );
294
+ }
295
+
296
+ function cf_field_replace( $matches ) {
297
+ $result = '';
298
+ if ( !empty( $matches ) ) {
299
+ if ( !empty( $matches[1] ) ) {
300
+ if ( function_exists( 'get_field' ) ) $result = get_field( $matches[1] );
301
+ if ( empty( $result ) ) {
302
+ global $post;
303
+ if ( !empty( $post ) ) $result = get_post_meta( $post->ID, $matches[1], true );
304
+ }
305
+ if ( empty( $result ) ) $result = $matches[0];
306
+ } else $result = $matches[0];
307
+ }
308
+ $result = strip_tags( $result );
309
+ return $result;
310
+ }
311
+
312
  /**
313
  * Returns child blogs of parent in a multisite.
314
  */
aioseop_opengraph.php CHANGED
@@ -90,6 +90,8 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
90
  "customimg" => __( "This option lets you upload an image to use as the Open Graph image for this Page or Post.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
91
  "imagewidth" => __( "Enter the width for your Open Graph image in pixels (i.e. 600).<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
92
  "imageheight" => __( "Enter the height for your Open Graph image in pixels (i.e. 600).<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
 
 
93
  "types" => __( "Select which Post Types you want to use All in One SEO Pack to set Open Graph meta values for.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
94
  "title" => __( "This is the Open Graph title of this Page or Post.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
95
  "desc" => __( "This is the Open Graph description of this Page or Post.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
@@ -123,6 +125,10 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
123
  'type' => 'text', 'default' => '' ),
124
  'imageheight' => Array( 'name' => __( 'Specify Image Height', 'all_in_one_seo_pack' ),
125
  'type' => 'text', 'default' => '' ),
 
 
 
 
126
  'types' => Array( 'name' => __( 'Enable Facebook Meta for', 'all_in_one_seo_pack'),
127
  'type' => 'multicheckbox', 'initial_options' => $this->get_post_type_titles( Array( '_builtin' => false ) ),
128
  'default' => Array( 'post' => 'post', 'page' => 'page' ) ),
@@ -149,10 +155,10 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
149
 
150
  $this->locations = array(
151
  'opengraph' => Array( 'name' => $this->name, 'prefix' => 'aiosp_', 'type' => 'settings',
152
- 'options' => Array('scan_header', 'setmeta', 'key', 'sitename', 'hometitle', 'description', 'homeimage', 'disable_jetpack', 'generate_descriptions', 'defimg', 'fallback', 'dimg', 'meta_key', 'categories', 'types') ),
153
  'settings' => Array( 'name' => __('Social Settings', 'all_in_one_seo_pack'),
154
  'type' => 'metabox', 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/#pagepost_settings',
155
- 'options' => Array( 'title', 'desc', 'image', 'customimg', 'imagewidth', 'imageheight', 'category' ),
156
  'display' => $display, 'prefix' => 'aioseop_opengraph_'
157
  )
158
  );
@@ -232,6 +238,9 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
232
  if ( isset( $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] ) ) {
233
  $settings[$prefix . 'category']['initial_options'] = array_merge( Array( '' => 'Default - ' . $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] ), $settings[$prefix . 'category']['initial_options'] );
234
  }
 
 
 
235
  }
236
  if ( isset( $current[ $prefix . 'setmeta' ] ) && $current[ $prefix . 'setmeta' ] )
237
  foreach ( $opts as $opt )
@@ -370,7 +379,10 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
370
  if ( !empty( $description ) )
371
  $description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $description ) ), 1000 );
372
 
373
- /* Data Validation */
 
 
 
374
  $title = strip_tags( esc_attr( $title ) );
375
  $sitename = strip_tags( esc_attr( $sitename ) );
376
  $description = strip_tags( esc_attr( $description ) );
@@ -418,6 +430,11 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Opengraph' ) ) {
418
  }
419
 
420
  $card = 'summary';
 
 
 
 
 
421
 
422
  /* OG only: */
423
  $meta = Array(
90
  "customimg" => __( "This option lets you upload an image to use as the Open Graph image for this Page or Post.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
91
  "imagewidth" => __( "Enter the width for your Open Graph image in pixels (i.e. 600).<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
92
  "imageheight" => __( "Enter the height for your Open Graph image in pixels (i.e. 600).<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
93
+ "defcard" => __( "Select the default type of Twitter card to display.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
94
+ "setcard" => __( "Select the default type of Twitter card to display.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
95
  "types" => __( "Select which Post Types you want to use All in One SEO Pack to set Open Graph meta values for.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
96
  "title" => __( "This is the Open Graph title of this Page or Post.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
97
  "desc" => __( "This is the Open Graph description of this Page or Post.<br /><a href='http://semperplugins.com/documentation/social-meta-module/' target='_blank'>Click here for documentation on this setting</a>", 'all_in_one_seo_pack' ),
125
  'type' => 'text', 'default' => '' ),
126
  'imageheight' => Array( 'name' => __( 'Specify Image Height', 'all_in_one_seo_pack' ),
127
  'type' => 'text', 'default' => '' ),
128
+ 'defcard' => Array( 'name' => __( 'Default Twitter Card', 'all_in_one_seo_pack' ),
129
+ 'type' => 'select', 'initial_options' => Array( 'summary' => __( 'Summary', 'all_in_one_seo_pack' ), 'summary_large_image' => __( 'Summary Large Image', 'all_in_one_seo_pack' ), 'photo' => __( 'Photo', 'all_in_one_seo_pack' ) ), 'default' => 'summary' ),
130
+ 'setcard' => Array( 'name' => __( 'Twitter Card Type', 'all_in_one_seo_pack' ),
131
+ 'type' => 'select', 'initial_options' => Array( 'summary' => __( 'Summary', 'all_in_one_seo_pack' ), 'summary_large_image' => __( 'Summary Large Image', 'all_in_one_seo_pack' ), 'photo' => __( 'Photo', 'all_in_one_seo_pack' ) ) ),
132
  'types' => Array( 'name' => __( 'Enable Facebook Meta for', 'all_in_one_seo_pack'),
133
  'type' => 'multicheckbox', 'initial_options' => $this->get_post_type_titles( Array( '_builtin' => false ) ),
134
  'default' => Array( 'post' => 'post', 'page' => 'page' ) ),
155
 
156
  $this->locations = array(
157
  'opengraph' => Array( 'name' => $this->name, 'prefix' => 'aiosp_', 'type' => 'settings',
158
+ 'options' => Array('scan_header', 'setmeta', 'key', 'sitename', 'hometitle', 'description', 'homeimage', 'disable_jetpack', 'generate_descriptions', 'defimg', 'fallback', 'dimg', 'meta_key', 'categories', 'defcard', 'types') ),
159
  'settings' => Array( 'name' => __('Social Settings', 'all_in_one_seo_pack'),
160
  'type' => 'metabox', 'help_link' => 'http://semperplugins.com/documentation/social-meta-module/#pagepost_settings',
161
+ 'options' => Array( 'title', 'desc', 'image', 'customimg', 'imagewidth', 'imageheight', 'category', 'setcard' ),
162
  'display' => $display, 'prefix' => 'aioseop_opengraph_'
163
  )
164
  );
238
  if ( isset( $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] ) ) {
239
  $settings[$prefix . 'category']['initial_options'] = array_merge( Array( '' => 'Default - ' . $this->options["aiosp_opengraph_{$current_post_type}_fb_object_type"] ), $settings[$prefix . 'category']['initial_options'] );
240
  }
241
+ if ( isset( $this->options["aiosp_opengraph_defcard"] ) ) {
242
+ $settings[$prefix . 'setcard']['default'] = $this->options["aiosp_opengraph_defcard"];
243
+ }
244
  }
245
  if ( isset( $current[ $prefix . 'setmeta' ] ) && $current[ $prefix . 'setmeta' ] )
246
  foreach ( $opts as $opt )
379
  if ( !empty( $description ) )
380
  $description = $aiosp->trim_excerpt_without_filters( $aiosp->internationalize( preg_replace( '/\s+/', ' ', $description ) ), 1000 );
381
 
382
+ $title = $this->apply_cf_fields( $title );
383
+ $description = $this->apply_cf_fields( $description );
384
+
385
+ /* Data Validation */
386
  $title = strip_tags( esc_attr( $title ) );
387
  $sitename = strip_tags( esc_attr( $sitename ) );
388
  $description = strip_tags( esc_attr( $description ) );
430
  }
431
 
432
  $card = 'summary';
433
+ if ( !empty( $this->options['aiosp_opengraph_defcard'] ) )
434
+ $card = $this->options['aiosp_opengraph_defcard'];
435
+
436
+ if ( !empty( $metabox['aioseop_opengraph_settings_setcard'] ) )
437
+ $card = $metabox['aioseop_opengraph_settings_setcard'];
438
 
439
  /* OG only: */
440
  $meta = Array(
aioseop_sitemap.php CHANGED
@@ -13,7 +13,12 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
13
  var $start_memory_usage = 0;
14
  var $max_posts = 50000;
15
  var $paginate = false;
16
-
 
 
 
 
 
17
  function All_in_One_SEO_Pack_Sitemap( ) {
18
  if ( get_class( $this ) === 'All_in_One_SEO_Pack_Sitemap' ) { // Set this up only when instantiated as this class
19
  $this->name = __( 'XML Sitemap', 'all_in_one_seo_pack' ); // Human-readable name of the plugin
@@ -85,16 +90,20 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
85
  )
86
  );
87
 
88
- $prio = Array( 'no' => 'Do Not Override' );
89
-
90
  for( $i = 0; $i <= 10; $i++ ) {
91
  $str = sprintf( "%0.1f", $i / 10.0 );
92
  $prio[ $str ] = $str;
93
  }
 
 
 
 
94
 
95
- $freq = Array( 'no' => 'Do Not Override' );
96
-
97
  foreach ( Array( 'always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never' ) as $f ) $freq[ $f ] = $f;
 
 
98
 
99
  foreach( Array( 'prio' => __( 'priority', 'all_in_one_seo_pack' ), 'freq' => __( 'frequency', 'all_in_one_seo_pack' ) ) as $k => $v ) {
100
  $s = "{$k}_options";
@@ -105,7 +114,13 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
105
  'archive' => __( 'archive pages', 'all_in_one_seo_pack' ),
106
  'author' => __( 'author pages', 'all_in_one_seo_pack' ) ) as $opt => $val ) {
107
  $arr = $$s;
108
- $arr[ $k . '_' . $opt ] = Array( 'name' => $this->ucwords( $val ), 'help_text' => sprintf( __( "Manually set the %s of your %s.", 'all_in_one_seo_pack' ), $v, $val ), 'type' => 'select', 'initial_options' => $$k, 'default' => 'no' );
 
 
 
 
 
 
109
  if ( ( $opt == 'archive' ) || ( $opt == 'author' ) ) $arr[ $k . '_' . $opt ][ 'condshow' ] = Array( $this->prefix . $opt => 'on' );
110
  $$s = $arr;
111
  }
@@ -168,7 +183,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
168
  function load_sitemap_options() {
169
  // load initial options / set defaults
170
  $this->update_options( );
171
- if ( !empty( $this->options["{$this->prefix}paginate"] ) ) {
172
  $this->paginate = true;
173
  if ( ( $this->options["{$this->prefix}max_posts"] ) && ( $this->options["{$this->prefix}max_posts"] > 0 ) && ( $this->options["{$this->prefix}max_posts"] < 50000 ) )
174
  $this->max_posts = $this->options["{$this->prefix}max_posts"];
@@ -236,12 +251,33 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
236
  /** Add post type details for settings once post types have been registered. **/
237
  function add_post_types() {
238
  $post_type_titles = $this->get_post_type_titles( Array( 'public' => true ) );
 
239
  if ( isset( $post_type_titles['attachment'] ) ) $post_type_titles['attachment'] = __( "Media / Attachments", 'all_in_one_seo_pack' );
240
  $this->default_options['posttypes' ]['initial_options'] = array_merge( Array( 'all' => __( 'All Post Types', 'all_in_one_seo_pack' ) ), $post_type_titles );
241
- $this->default_options['taxonomies']['initial_options'] = array_merge( Array( 'all' => __( 'All Taxonomies', 'all_in_one_seo_pack' ) ), $this->get_taxonomy_titles( Array( 'public' => true ) ) );
242
  $this->default_options['posttypes' ]['default'] = array_keys( $this->default_options['posttypes' ]['initial_options'] );
243
  $this->default_options['taxonomies']['default'] = array_keys( $this->default_options['taxonomies']['initial_options'] );
244
  $this->default_options['excl_categories']['initial_options'] = $this->get_category_titles();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
245
  $this->update_options();
246
  }
247
 
@@ -392,7 +428,8 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
392
  }
393
  }
394
  }
395
- return apply_filters( $this->prefix . 'sitemap_urls', $siteurls );
 
396
  }
397
 
398
  /** Scan for sitemaps on filesystem. **/
@@ -656,30 +693,39 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
656
  exit();
657
  }
658
  }
659
-
660
- /** Output sitemaps dynamically based on rewrite rules. **/
661
- function do_rewrite_sitemap( $sitemap_type, $page = 0 ) {
662
- $this->add_post_types();
663
- $comment = __( "dynamically", 'all_in_one_seo_pack' );
664
  if ( $this->options["{$this->prefix}indexes"] ) {
665
  $posttypes = $this->options["{$this->prefix}posttypes"];
666
  if ( empty( $posttypes ) ) $posttypes = Array();
667
  $taxonomies = $this->options["{$this->prefix}taxonomies"];
668
  if ( empty( $taxonomies ) ) $taxonomies = Array();
669
  if ( $sitemap_type === 'root' ) {
670
- $this->output_sitemap_index( array_merge( $this->get_sitemap_index_filenames() ), $comment );
671
  } elseif ( $sitemap_type === 'addl' ) {
672
- $this->output_sitemap( $this->get_addl_pages(), $comment );
673
  } elseif ( $sitemap_type === 'archive' && $this->option_isset( 'archive' ) ) {
674
- $this->output_sitemap( $this->get_archive_prio_data(), $comment );
675
  } elseif ( $sitemap_type === 'author' && $this->option_isset( 'author' ) ) {
676
- $this->output_sitemap( $this->get_author_prio_data(), $comment );
677
  } elseif ( in_array( $sitemap_type, $posttypes ) ) {
678
- $this->output_sitemap( $this->get_all_post_priority_data( $sitemap_type, 'publish', $page ), $comment );
679
  } elseif ( in_array( $sitemap_type, $taxonomies ) ) {
680
- $this->output_sitemap( $this->get_term_priority_data( get_terms( $sitemap_type, $this->get_tax_args( $page ) ) ), $comment );
 
 
 
681
  }
682
- } elseif ( $sitemap_type === 'root' ) echo $this->do_simple_sitemap( $comment );
 
 
 
 
 
 
 
 
683
  }
684
 
685
  /** Build a url to the sitemap. **/
@@ -722,7 +768,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
722
 
723
  /** Build static sitemaps on submit if rewrite rules are not in use, do logging. **/
724
  function do_sitemaps() {
725
- if ( !empty( $this->options["{$this->prefix}paginate"] ) ) {
726
  $this->paginate = true;
727
  if ( ( $this->options["{$this->prefix}max_posts"] ) && ( $this->options["{$this->prefix}max_posts"] > 0 ) && ( $this->options["{$this->prefix}max_posts"] < 50000 ) )
728
  $this->max_posts = $this->options["{$this->prefix}max_posts"];
@@ -771,40 +817,39 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
771
  return $this->save_file( $filename, $contents );
772
  }
773
 
774
- /** Get priority settings for sitemap entries. **/
775
- function get_default_priority( $item, $nodefaults = false ) {
776
- $defaults = Array( 'homepage' => '1.0', 'blog' => '0.9', 'sitemap' => '0.8', 'post' => '0.7', 'archive' => '0.5', 'author' => '0.3', 'taxonomies' => '0.3' );
777
- static $cache = Array();
778
- if ( !empty( $cache[ $item ] ) ) return $cache[ $item ];
779
  if ( !empty( $defaults[ $item ] ) ) {
780
- $field = $this->prefix . 'prio_' . $item;
781
- if ( $this->option_isset( 'prio_' . $item ) && $this->options[ $field ] != 'no' ) {
782
- $cache[ $item ] = $this->options[ $field ];
783
- return $this->options[ $field ];
 
 
 
 
784
  }
785
  if ( $nodefaults ) return false;
786
  return $defaults[ $item ];
787
  }
788
  return false;
789
  }
790
-
 
 
 
 
 
 
 
791
  /** Get frequency settings for sitemap entries. **/
792
  function get_default_frequency( $item, $nodefaults = false ) {
793
  $defaults = Array( 'homepage' => 'always', 'blog' => 'daily', 'sitemap' => 'hourly', 'post' => 'weekly', 'archive' => 'monthly', 'author' => 'weekly', 'taxonomies' => 'monthly' );
794
  static $cache = Array();
795
- if ( !empty( $cache[ $item ] ) ) return $cache[ $item ];
796
- if ( !empty( $defaults[ $item ] ) ) {
797
- $field = $this->prefix . 'freq_' . $item;
798
- if ( $this->option_isset( 'freq_' . $item ) && $this->options[ $field ] != 'no' ) {
799
- $cache[ $item ] = $this->options[ $field ];
800
- return $this->options[ $field ];
801
- }
802
- if ( $nodefaults ) return false;
803
- return $defaults[ $item ];
804
- }
805
- return false;
806
  }
807
-
808
  /** Build an index of sitemaps used. **/
809
  function get_sitemap_index_filenames() {
810
  $files = Array();
@@ -859,56 +904,70 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
859
  $files[] = Array( 'loc' => $csm, 'priority' => $this->get_default_priority( 'sitemap' ), 'changefreq' => $this->get_default_frequency( 'sitemap' ) );
860
  return $files;
861
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
862
 
863
  /** Build all the indexes. **/
864
  function do_indexed_sitemaps() {
865
  $this->start_memory_usage = memory_get_peak_usage();
866
  $options = $this->options;
867
- $comment = __( "file '%s' statically", 'all_in_one_seo_pack' );
868
- $this->write_sitemaps( $options["{$this->prefix}filename"],
869
- $this->build_sitemap_index( $this->get_sitemap_index_filenames() ), sprintf( $comment, $options["{$this->prefix}filename"] ) );
870
- $this->write_sitemaps( $options["{$this->prefix}filename"] . "_addl",
871
- $this->build_sitemap( $this->get_addl_pages(), sprintf( $comment, $options["{$this->prefix}filename"] . "_addl" ) ) );
 
 
872
  if ( ( !isset( $options["{$this->prefix}posttypes"] ) ) || ( !is_array( $options["{$this->prefix}posttypes"] ) ) ) $options["{$this->prefix}posttypes"] = Array();
873
  if ( ( !isset( $options["{$this->prefix}taxonomies"] ) ) || ( !is_array( $options["{$this->prefix}taxonomies"] ) ) ) $options["{$this->prefix}taxonomies"] = Array();
874
  $options["{$this->prefix}posttypes"] = array_diff( $options["{$this->prefix}posttypes"], Array( 'all' ) );
875
  $options["{$this->prefix}taxonomies"] = array_diff( $options["{$this->prefix}taxonomies"], Array( 'all' ) );
876
-
877
  if ( !empty( $options["{$this->prefix}posttypes"] ) ) {
878
  $post_counts = $this->get_all_post_counts( Array('post_type' => $options["{$this->prefix}posttypes"], 'post_status' => 'publish') );
879
  foreach ( $options["{$this->prefix}posttypes"] as $posttype ) {
880
  if ( $post_counts[$posttype] === 0 ) continue;
881
  if ( $this->paginate && ( $post_counts[$posttype] > $this->max_posts ) ) {
882
  $count = 1;
883
- for( $post_count = 0; $post_count < $post_counts[$posttype]; $post_count += $this->max_posts ) {
884
- $comment = sprintf( $comment, $options["{$this->prefix}filename"] . "_{$posttype}_{$count}" );
885
- $this->write_sitemaps( $options["{$this->prefix}filename"] . "_{$posttype}_{$count}",
886
- $this->build_sitemap( $this->get_all_post_priority_data( $posttype, 'publish', ( $count - 1 ) ), $comment ) );
887
  $count++;
888
  }
889
  } else {
890
- $comment = sprintf( $comment, $options["{$this->prefix}filename"] . "_$posttype" );
891
- $this->write_sitemaps( $options["{$this->prefix}filename"] . "_$posttype",
892
- $this->build_sitemap( $this->get_all_post_priority_data( $posttype ), $comment ) );
893
  }
894
- }
895
  }
896
 
897
- if ( $this->option_isset( 'archive') ) {
898
- $comment = sprintf( $comment, $options["{$this->prefix}filename"] . "_archive" );
899
- $this->write_sitemaps( $options["{$this->prefix}filename"] . "_archive",
900
- $this->build_sitemap( $this->get_archive_prio_data(), $comment ) );
901
- }
902
- if ( $this->option_isset( 'author') ) {
903
- $comment = sprintf( $comment, $options["{$this->prefix}filename"] . "_author" );
904
- $this->write_sitemaps( $options["{$this->prefix}filename"] . "_author",
905
- $this->build_sitemap( $this->get_author_prio_data(), $comment ) );
906
- }
907
- if ( !empty( $options["{$this->prefix}taxonomies"] ) )
908
- foreach ( $options["{$this->prefix}taxonomies"] as $taxonomy ) {
909
-
910
- }
911
-
912
  if ( !empty( $options["{$this->prefix}taxonomies"] ) )
913
  foreach( $options["{$this->prefix}taxonomies"] as $taxonomy ) {
914
  $term_count = wp_count_terms( $taxonomy, array('hide_empty' => true) );
@@ -916,30 +975,22 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
916
  if ( $this->paginate ) {
917
  if ( $term_count > $this->max_posts ) {
918
  $count = 1;
919
- for( $tc = 0; $tc < $term_count; $tc += $this->max_posts ) {
920
- $comment = sprintf( $comment, $options["{$this->prefix}filename"] . "_$taxonomy_$count" );
921
- $this->write_sitemaps( $options["{$this->prefix}filename"] . "_$taxonomy_$count",
922
- $this->build_sitemap( $this->get_term_priority_data( get_terms( $taxonomy, $this->get_tax_args( $tc ) ), $comment ) ) );
923
  $count++;
924
  }
925
  } else {
926
- $comment = sprintf( $comment, $options["{$this->prefix}filename"] . "_$taxonomy" );
927
- $this->write_sitemaps( $options["{$this->prefix}filename"] . "_$taxonomy",
928
- $this->build_sitemap( $this->get_term_priority_data( get_terms( $taxonomy, $this->get_tax_args() ), $comment ) ) );
929
  }
930
  } else {
931
- $comment = sprintf( $comment, $options["{$this->prefix}filename"] . "_$taxonomy" );
932
- $this->write_sitemaps( $options["{$this->prefix}filename"] . "_$taxonomy",
933
- $this->build_sitemap( $this->get_term_priority_data( get_terms( $taxonomy, $this->get_tax_args() ), $comment ) ) );
934
  }
935
  }
936
  }
937
-
938
  $this->log_stats( 'indexed', $options["{$this->prefix}gzipped"], false );
939
  }
940
-
941
- /** Build a single, stand-alone sitemap without indexes. **/
942
- function do_simple_sitemap( $comment = '' ) {
943
  $home = Array(
944
  'loc' => get_home_url(),
945
  'priority' => $this->get_default_priority( 'homepage' ),
@@ -987,7 +1038,20 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
987
  $prio2 = $this->get_term_priority_data( $terms );
988
  $prio3 = $this->get_addl_pages_only();
989
  $prio = array_merge( $child, $prio, $prio2, $prio3 );
990
- return $this->build_sitemap( $prio, $comment );
 
 
 
 
 
 
 
 
 
 
 
 
 
991
  }
992
 
993
  /** Output the XML for a sitemap. **/
@@ -1000,6 +1064,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
1000
  $plugin_url = parse_url( $plugin_path );
1001
  $current_host = $_SERVER['HTTP_HOST'];
1002
  if ( empty( $current_host ) ) $current_host = $_SERVER['SERVER_NAME'];
 
1003
  if ( !empty( $current_host ) && ( $current_host != $plugin_url['host'] ) ) {
1004
  $plugin_url['host'] = $current_host;
1005
  $plugin_path = $this->unparse_url( $plugin_url );
@@ -1101,15 +1166,18 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
1101
  function get_term_priority_data( $terms ) {
1102
  $prio = Array();
1103
  if (is_array( $terms ) ) {
1104
- $f = $this->get_default_frequency( 'taxonomies' );
1105
- $p = $this->get_default_priority( 'taxonomies' );
1106
  foreach ($terms as $term) {
1107
- $url = $this->get_term_link( $term, $term->taxonomy );
1108
- $prio[] = Array(
1109
- 'loc' => $url,
1110
- 'changefreq' => $f,
1111
- 'priority' => $p
1112
- );
 
 
 
1113
  }
1114
  }
1115
  return $prio;
@@ -1393,6 +1461,12 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
1393
  $pr_info[ 'priority' ] = $prio_override;
1394
  if ( $freq_override )
1395
  $pr_info[ 'changefreq' ] = $freq_override;
 
 
 
 
 
 
1396
  $pr_info['loc'] = $url;
1397
  $pr_info = apply_filters( $this->prefix . 'prio_item_filter', $pr_info, $post, $args );
1398
  if ( !empty( $pr_info ) )
@@ -1618,6 +1692,7 @@ if ( !class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
1618
  $ex_args['meta_value'] = 'on';
1619
  $ex_args['meta_compare'] = '=';
1620
  $ex_args['fields'] = 'ids';
 
1621
  $q = new WP_Query( $ex_args );
1622
  if ( !is_array( $args['exclude'] ) ) $args['exclude'] = explode( ',', $args['exclude'] );
1623
  if ( !empty( $q->posts ) ) $args['exclude'] = array_merge( $args['exclude'], $q->posts );
13
  var $start_memory_usage = 0;
14
  var $max_posts = 50000;
15
  var $paginate = false;
16
+ var $prio;
17
+ var $prio_sel;
18
+ var $freq;
19
+ var $freq_sel;
20
+ var $extra_sitemaps;
21
+
22
  function All_in_One_SEO_Pack_Sitemap( ) {
23
  if ( get_class( $this ) === 'All_in_One_SEO_Pack_Sitemap' ) { // Set this up only when instantiated as this class
24
  $this->name = __( 'XML Sitemap', 'all_in_one_seo_pack' ); // Human-readable name of the plugin
90
  )
91
  );
92
 
93
+ $prio = Array();
 
94
  for( $i = 0; $i <= 10; $i++ ) {
95
  $str = sprintf( "%0.1f", $i / 10.0 );
96
  $prio[ $str ] = $str;
97
  }
98
+ $arr_no = Array( 'no' => __( 'Do Not Override', 'all_in_one_seo_pack' ) );
99
+ $arr_sel = Array( 'sel' => __( 'Select Individual', 'all_in_one_seo_pack' ) );
100
+ $this->prio_sel = array_merge( $arr_no, $arr_sel, $prio );
101
+ $this->prio = array_merge( $arr_no, $prio );
102
 
103
+ $freq = Array();
 
104
  foreach ( Array( 'always', 'hourly', 'daily', 'weekly', 'monthly', 'yearly', 'never' ) as $f ) $freq[ $f ] = $f;
105
+ $this->freq_sel = array_merge( $arr_no, $arr_sel, $freq );
106
+ $this->freq = array_merge( $arr_no, $freq );
107
 
108
  foreach( Array( 'prio' => __( 'priority', 'all_in_one_seo_pack' ), 'freq' => __( 'frequency', 'all_in_one_seo_pack' ) ) as $k => $v ) {
109
  $s = "{$k}_options";
114
  'archive' => __( 'archive pages', 'all_in_one_seo_pack' ),
115
  'author' => __( 'author pages', 'all_in_one_seo_pack' ) ) as $opt => $val ) {
116
  $arr = $$s;
117
+ if ( ( $opt == 'post' ) || ( $opt == 'taxonomies' ) ) {
118
+ $iopts = $this->{"{$k}_sel"};
119
+ } else {
120
+ $iopts = $this->$k;
121
+ }
122
+
123
+ $arr[ $k . '_' . $opt ] = Array( 'name' => $this->ucwords( $val ), 'help_text' => sprintf( __( "Manually set the %s of your %s.", 'all_in_one_seo_pack' ), $v, $val ), 'type' => 'select', 'initial_options' => $iopts, 'default' => 'no' );
124
  if ( ( $opt == 'archive' ) || ( $opt == 'author' ) ) $arr[ $k . '_' . $opt ][ 'condshow' ] = Array( $this->prefix . $opt => 'on' );
125
  $$s = $arr;
126
  }
183
  function load_sitemap_options() {
184
  // load initial options / set defaults
185
  $this->update_options( );
186
+ if ( !empty( $this->options["{$this->prefix}indexes"] ) && !empty( $this->options["{$this->prefix}paginate"] ) ) {
187
  $this->paginate = true;
188
  if ( ( $this->options["{$this->prefix}max_posts"] ) && ( $this->options["{$this->prefix}max_posts"] > 0 ) && ( $this->options["{$this->prefix}max_posts"] < 50000 ) )
189
  $this->max_posts = $this->options["{$this->prefix}max_posts"];
251
  /** Add post type details for settings once post types have been registered. **/
252
  function add_post_types() {
253
  $post_type_titles = $this->get_post_type_titles( Array( 'public' => true ) );
254
+ $taxonomy_titles = $this->get_taxonomy_titles( Array( 'public' => true ) );
255
  if ( isset( $post_type_titles['attachment'] ) ) $post_type_titles['attachment'] = __( "Media / Attachments", 'all_in_one_seo_pack' );
256
  $this->default_options['posttypes' ]['initial_options'] = array_merge( Array( 'all' => __( 'All Post Types', 'all_in_one_seo_pack' ) ), $post_type_titles );
257
+ $this->default_options['taxonomies']['initial_options'] = array_merge( Array( 'all' => __( 'All Taxonomies', 'all_in_one_seo_pack' ) ), $taxonomy_titles );
258
  $this->default_options['posttypes' ]['default'] = array_keys( $this->default_options['posttypes' ]['initial_options'] );
259
  $this->default_options['taxonomies']['default'] = array_keys( $this->default_options['taxonomies']['initial_options'] );
260
  $this->default_options['excl_categories']['initial_options'] = $this->get_category_titles();
261
+ $prio_help = __( "Manually set the priority for the ", 'all_in_one_seo_pack' );
262
+ $freq_help = __( "Manually set the frequency for the ", 'all_in_one_seo_pack' );
263
+ $post_name = __( " Post Type", 'all_in_one_seo_pack' );
264
+ $tax_name = __( " Taxonomy", 'all_in_one_seo_pack' );
265
+ foreach( $post_type_titles as $k => $v ) {
266
+ $key = 'prio_post_' . $k;
267
+ $this->default_options = aioseop_array_insert_after( $this->default_options, 'prio_post', Array( $key => Array( 'name' => $v . $post_name, 'help_text' => $prio_help . $v . $post_name, 'type' => 'select', 'initial_options' => $this->prio, 'default' => 'no', 'condshow' => Array( "{$this->prefix}prio_post" => 'sel' ) ) ) );
268
+ $this->layout['priorities']['options'][] = $key;
269
+ $key = 'freq_post_' . $k;
270
+ $this->default_options = aioseop_array_insert_after( $this->default_options, 'freq_post', Array( $key => Array( 'name' => $v . $post_name, 'help_text' => $freq_help . $v . $post_name, 'type' => 'select', 'initial_options' => $this->freq, 'default' => 'no', 'condshow' => Array( "{$this->prefix}freq_post" => 'sel' ) ) ) );
271
+ $this->layout['frequencies']['options'][] = $key;
272
+ }
273
+ foreach( $taxonomy_titles as $k => $v ) {
274
+ $key = 'prio_taxonomies_' . $k;
275
+ $this->default_options = aioseop_array_insert_after( $this->default_options, 'prio_taxonomies', Array( $key => Array( 'name' => $v . $tax_name, 'help_text' => $prio_help . $v . $tax_name, 'type' => 'select', 'initial_options' => $this->prio, 'default' => 'no', 'condshow' => Array( "{$this->prefix}prio_taxonomies" => 'sel' ) ) ) );
276
+ $this->layout['priorities']['options'][] = $key;
277
+ $key = 'freq_taxonomies_' . $k;
278
+ $this->default_options = aioseop_array_insert_after( $this->default_options, 'freq_taxonomies', Array( $key => Array( 'name' => $v . $tax_name, 'help_text' => $freq_help . $v . $tax_name, 'type' => 'select', 'initial_options' => $this->freq, 'default' => 'no', 'condshow' => Array( "{$this->prefix}freq_taxonomies" => 'sel' ) ) ) );
279
+ $this->layout['frequencies']['options'][] = $key;
280
+ }
281
  $this->update_options();
282
  }
283
 
428
  }
429
  }
430
  }
431
+ return apply_filters( $this->prefix . 'child_urls', $siteurls );
432
+ return apply_filters( $this->prefix . 'sitemap_urls', $siteurls ); // legacy
433
  }
434
 
435
  /** Scan for sitemaps on filesystem. **/
693
  exit();
694
  }
695
  }
696
+
697
+ function get_sitemap_data( $sitemap_type, $page = 0 ) {
698
+ $sitemap_data = Array();
 
 
699
  if ( $this->options["{$this->prefix}indexes"] ) {
700
  $posttypes = $this->options["{$this->prefix}posttypes"];
701
  if ( empty( $posttypes ) ) $posttypes = Array();
702
  $taxonomies = $this->options["{$this->prefix}taxonomies"];
703
  if ( empty( $taxonomies ) ) $taxonomies = Array();
704
  if ( $sitemap_type === 'root' ) {
705
+ $sitemap_data = array_merge( $this->get_sitemap_index_filenames() );
706
  } elseif ( $sitemap_type === 'addl' ) {
707
+ $sitemap_data = $this->get_addl_pages();
708
  } elseif ( $sitemap_type === 'archive' && $this->option_isset( 'archive' ) ) {
709
+ $sitemap_data = $this->get_archive_prio_data();
710
  } elseif ( $sitemap_type === 'author' && $this->option_isset( 'author' ) ) {
711
+ $sitemap_data = $this->get_author_prio_data();
712
  } elseif ( in_array( $sitemap_type, $posttypes ) ) {
713
+ $sitemap_data = $this->get_all_post_priority_data( $sitemap_type, 'publish', $page );
714
  } elseif ( in_array( $sitemap_type, $taxonomies ) ) {
715
+ $sitemap_data = $this->get_term_priority_data( get_terms( $sitemap_type, $this->get_tax_args( $page ) ) );
716
+ } else {
717
+ if ( is_array( $this->extra_sitemaps ) && in_array( $sitemap_type, $this->extra_sitemaps ) )
718
+ $sitemap_data = apply_filters( $this->prefix . 'custom_' . $sitemap_type, $sitemap_data, $page, $this_options );
719
  }
720
+ } elseif ( $sitemap_type === 'root' ) $sitemap_data = $this->get_simple_sitemap();
721
+ return apply_filters( $this->prefix . 'data', $sitemap_data, $sitemap_type, $page, $this->options );
722
+ }
723
+
724
+ /** Output sitemaps dynamically based on rewrite rules. **/
725
+ function do_rewrite_sitemap( $sitemap_type, $page = 0 ) {
726
+ $this->add_post_types();
727
+ $comment = __( "dynamically", 'all_in_one_seo_pack' );
728
+ $this->output_sitemap( $this->get_sitemap_data( $sitemap_type, $page ), $comment );
729
  }
730
 
731
  /** Build a url to the sitemap. **/
768
 
769
  /** Build static sitemaps on submit if rewrite rules are not in use, do logging. **/
770
  function do_sitemaps() {
771
+ if ( !empty( $this->options["{$this->prefix}indexes"] ) && !empty( $this->options["{$this->prefix}paginate"] ) ) {
772
  $this->paginate = true;
773
  if ( ( $this->options["{$this->prefix}max_posts"] ) && ( $this->options["{$this->prefix}max_posts"] > 0 ) && ( $this->options["{$this->prefix}max_posts"] < 50000 ) )
774
  $this->max_posts = $this->options["{$this->prefix}max_posts"];
817
  return $this->save_file( $filename, $contents );
818
  }
819
 
820
+ /*** Helper function for handling default values ***/
821
+ function get_default_values( $defaults, $prefix, &$cache, $item, $nodefaults = false, $type = '' ) {
822
+ if ( !empty( $cache[ $item . $type ] ) ) return $cache[ $item . $type ];
 
 
823
  if ( !empty( $defaults[ $item ] ) ) {
824
+ $field = $this->prefix . $prefix . $item;
825
+ if ( $this->option_isset( $prefix . $item ) && $this->options[ $field ] != 'no' ) {
826
+ if ( ( $this->options[ $field ] == 'sel' ) && !empty( $type ) && ( isset( $this->options[ $this->prefix . $prefix . $item . '_' . $type ] ) ) ) {
827
+ $cache[ $item . $type ] = $this->options[ $this->prefix . $prefix . $item . '_' . $type ];
828
+ } else {
829
+ $cache[ $item . $type ] = $this->options[ $field ];
830
+ }
831
+ return $cache[ $item . $type ];
832
  }
833
  if ( $nodefaults ) return false;
834
  return $defaults[ $item ];
835
  }
836
  return false;
837
  }
838
+
839
+ /** Get priority settings for sitemap entries. **/
840
+ function get_default_priority( $item, $nodefaults = false, $type = '' ) {
841
+ $defaults = Array( 'homepage' => '1.0', 'blog' => '0.9', 'sitemap' => '0.8', 'post' => '0.7', 'archive' => '0.5', 'author' => '0.3', 'taxonomies' => '0.3' );
842
+ static $cache = Array();
843
+ return $this->get_default_values( $defaults, 'prio_', $cache, $item, $nodefaults, $type );
844
+ }
845
+
846
  /** Get frequency settings for sitemap entries. **/
847
  function get_default_frequency( $item, $nodefaults = false ) {
848
  $defaults = Array( 'homepage' => 'always', 'blog' => 'daily', 'sitemap' => 'hourly', 'post' => 'weekly', 'archive' => 'monthly', 'author' => 'weekly', 'taxonomies' => 'monthly' );
849
  static $cache = Array();
850
+ return $this->get_default_values( $defaults, 'freq_', $cache, $item, $nodefaults, $type );
 
 
 
 
 
 
 
 
 
 
851
  }
852
+
853
  /** Build an index of sitemaps used. **/
854
  function get_sitemap_index_filenames() {
855
  $files = Array();
904
  $files[] = Array( 'loc' => $csm, 'priority' => $this->get_default_priority( 'sitemap' ), 'changefreq' => $this->get_default_frequency( 'sitemap' ) );
905
  return $files;
906
  }
907
+
908
+ function do_build_sitemap( $sitemap_type, $page = 0, $filename = '', $comment = '' ) {
909
+ if ( empty( $filename ) ) {
910
+ if ( $sitemap_type == 'root' ) {
911
+ $filename = $this->options["{$this->prefix}filename"];
912
+ } else {
913
+ $filename = $this->options["{$this->prefix}filename"] . '_' . $sitemap_type;
914
+ }
915
+ }
916
+ if ( empty( $comment ) )
917
+ $comment = __( "file '%s' statically", 'all_in_one_seo_pack' );
918
+ $sitemap_data = $this->get_sitemap_data( $sitemap_type, $page );
919
+ if ( $sitemap_type == 'root' ) {
920
+ return $this->build_sitemap_index( $sitemap_data, sprintf( $comment, $filename ) );
921
+ } else {
922
+ return $this->build_sitemap( $sitemap_data, sprintf( $comment, $filename ) );
923
+ }
924
+ }
925
+
926
+ function do_write_sitemap( $sitemap_type, $page = 0, $filename = '', $comment = '' ) {
927
+ if ( empty( $filename ) ) {
928
+ if ( $sitemap_type == 'root' ) {
929
+ $filename = $this->options["{$this->prefix}filename"];
930
+ } else {
931
+ $filename = $this->options["{$this->prefix}filename"] . '_' . $sitemap_type;
932
+ }
933
+ }
934
+ if ( empty( $comment ) )
935
+ $comment = __( "file '%s' statically", 'all_in_one_seo_pack' );
936
+ $this->write_sitemaps( $filename, $this->do_build_sitemap( $sitemap_type, $page, $filename, $comment ) );
937
+ }
938
 
939
  /** Build all the indexes. **/
940
  function do_indexed_sitemaps() {
941
  $this->start_memory_usage = memory_get_peak_usage();
942
  $options = $this->options;
943
+
944
+ $this->do_write_sitemap( 'root' );
945
+ $this->do_write_sitemap( 'addl' );
946
+
947
+ if ( $this->option_isset( 'archive' ) ) $this->do_write_sitemap( 'archive' );
948
+ if ( $this->option_isset( 'author' ) ) $this->do_write_sitemap( 'author' );
949
+
950
  if ( ( !isset( $options["{$this->prefix}posttypes"] ) ) || ( !is_array( $options["{$this->prefix}posttypes"] ) ) ) $options["{$this->prefix}posttypes"] = Array();
951
  if ( ( !isset( $options["{$this->prefix}taxonomies"] ) ) || ( !is_array( $options["{$this->prefix}taxonomies"] ) ) ) $options["{$this->prefix}taxonomies"] = Array();
952
  $options["{$this->prefix}posttypes"] = array_diff( $options["{$this->prefix}posttypes"], Array( 'all' ) );
953
  $options["{$this->prefix}taxonomies"] = array_diff( $options["{$this->prefix}taxonomies"], Array( 'all' ) );
954
+
955
  if ( !empty( $options["{$this->prefix}posttypes"] ) ) {
956
  $post_counts = $this->get_all_post_counts( Array('post_type' => $options["{$this->prefix}posttypes"], 'post_status' => 'publish') );
957
  foreach ( $options["{$this->prefix}posttypes"] as $posttype ) {
958
  if ( $post_counts[$posttype] === 0 ) continue;
959
  if ( $this->paginate && ( $post_counts[$posttype] > $this->max_posts ) ) {
960
  $count = 1;
961
+ for( $post_count = 0; $post_count < $post_counts[$posttype]; $post_count += $this->max_posts ) {
962
+ $this->do_write_sitemap( $posttype, $count - 1, $options["{$this->prefix}filename"] . "_{$posttype}_{$count}" );
 
 
963
  $count++;
964
  }
965
  } else {
966
+ $this->do_write_sitemap( $posttype );
 
 
967
  }
968
+ }
969
  }
970
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
971
  if ( !empty( $options["{$this->prefix}taxonomies"] ) )
972
  foreach( $options["{$this->prefix}taxonomies"] as $taxonomy ) {
973
  $term_count = wp_count_terms( $taxonomy, array('hide_empty' => true) );
975
  if ( $this->paginate ) {
976
  if ( $term_count > $this->max_posts ) {
977
  $count = 1;
978
+ for( $tc = 0; $tc < $term_count; $tc += $this->max_posts ) {
979
+ $this->do_write_sitemap( $taxonomy, $tc, $options["{$this->prefix}filename"] . "_{$taxonomy}_{$count}" );
 
 
980
  $count++;
981
  }
982
  } else {
983
+ $this->do_write_sitemap( $taxonomy );
 
 
984
  }
985
  } else {
986
+ $this->do_write_sitemap( $taxonomy );
 
 
987
  }
988
  }
989
  }
 
990
  $this->log_stats( 'indexed', $options["{$this->prefix}gzipped"], false );
991
  }
992
+
993
+ function get_simple_sitemap() {
 
994
  $home = Array(
995
  'loc' => get_home_url(),
996
  'priority' => $this->get_default_priority( 'homepage' ),
1038
  $prio2 = $this->get_term_priority_data( $terms );
1039
  $prio3 = $this->get_addl_pages_only();
1040
  $prio = array_merge( $child, $prio, $prio2, $prio3 );
1041
+ if ( is_array( $this->extra_sitemaps ) )
1042
+ foreach( $this->extra_sitemaps as $sitemap_type ) {
1043
+ $sitemap_data = Array();
1044
+ $sitemap_data = apply_filters( $this->prefix . 'custom_' . $sitemap_type, $sitemap_data, $page, $this_options );
1045
+ $prio = array_merge( $prio, $sitemap_data );
1046
+ }
1047
+ return $prio;
1048
+ }
1049
+
1050
+ /** Build a single, stand-alone sitemap without indexes. **/
1051
+ function do_simple_sitemap( $comment = '' ) {
1052
+ $sitemap_data = $this->get_simple_sitemap();
1053
+ $sitemap_data = apply_filters( $this->prefix . 'data', $sitemap_data, 'root', 0, $this->options );
1054
+ return $this->build_sitemap( $sitemap_data, $comment );
1055
  }
1056
 
1057
  /** Output the XML for a sitemap. **/
1064
  $plugin_url = parse_url( $plugin_path );
1065
  $current_host = $_SERVER['HTTP_HOST'];
1066
  if ( empty( $current_host ) ) $current_host = $_SERVER['SERVER_NAME'];
1067
+
1068
  if ( !empty( $current_host ) && ( $current_host != $plugin_url['host'] ) ) {
1069
  $plugin_url['host'] = $current_host;
1070
  $plugin_path = $this->unparse_url( $plugin_url );
1166
  function get_term_priority_data( $terms ) {
1167
  $prio = Array();
1168
  if (is_array( $terms ) ) {
1169
+ $def_prio = $this->get_default_priority( 'taxonomies' );
1170
+ $def_freq = $this->get_default_frequency( 'taxonomies' );
1171
  foreach ($terms as $term) {
1172
+ $pr_info = Array();
1173
+ $pr_info['loc'] = $this->get_term_link( $term, $term->taxonomy );
1174
+ if ( ( $this->options[ $this->prefix . 'prio_taxonomies' ] == 'sel' ) && ( isset( $this->options[ $this->prefix . 'prio_taxonomies_' . $term->taxonomy ] ) ) ) {
1175
+ $pr_info['priority'] = $this->options[ $this->prefix . 'prio_taxonomies_' . $term->taxonomy ];
1176
+ } else $pr_info['priority'] = $def_prio;
1177
+ if ( ( $this->options[ $this->prefix . 'freq_taxonomies' ] == 'sel' ) && ( isset( $this->options[ $this->prefix . 'freq_taxonomies_' . $term->taxonomy ] ) ) ) {
1178
+ $pr_info['changefreq'] = $this->options[ $this->prefix . 'freq_taxonomies_' . $term->taxonomy ];
1179
+ } else $pr_info['changefreq'] = $def_freq;
1180
+ $prio[] = $pr_info;
1181
  }
1182
  }
1183
  return $prio;
1461
  $pr_info[ 'priority' ] = $prio_override;
1462
  if ( $freq_override )
1463
  $pr_info[ 'changefreq' ] = $freq_override;
1464
+ if ( ( $this->options[ $this->prefix . 'prio_post' ] == 'sel' ) && ( isset( $this->options[ $this->prefix . 'prio_post_' . $post->post_type ] ) ) ) {
1465
+ $pr_info[ 'priority' ] = $this->options[ $this->prefix . 'prio_post_' . $post->post_type ];
1466
+ }
1467
+ if ( ( $this->options[ $this->prefix . 'freq_post' ] == 'sel' ) && ( isset( $this->options[ $this->prefix . 'freq_post_' . $post->post_type ] ) ) ) {
1468
+ $pr_info[ 'changefreq' ] = $this->options[ $this->prefix . 'freq_post_' . $post->post_type ];
1469
+ }
1470
  $pr_info['loc'] = $url;
1471
  $pr_info = apply_filters( $this->prefix . 'prio_item_filter', $pr_info, $post, $args );
1472
  if ( !empty( $pr_info ) )
1692
  $ex_args['meta_value'] = 'on';
1693
  $ex_args['meta_compare'] = '=';
1694
  $ex_args['fields'] = 'ids';
1695
+ $ex_args['posts_per_page'] = -1;
1696
  $q = new WP_Query( $ex_args );
1697
  if ( !is_array( $args['exclude'] ) ) $args['exclude'] = explode( ',', $args['exclude'] );
1698
  if ( !empty( $q->posts ) ) $args['exclude'] = array_merge( $args['exclude'], $q->posts );
all_in_one_seo_pack.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: All In One SEO Pack
4
  Plugin URI: http://semperfiwebdesign.com
5
  Description: Out-of-the-box SEO for your WordPress blog. <a href="admin.php?page=all-in-one-seo-pack/aioseop_class.php">Options configuration panel</a> | <a href="http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=plugins" target="_blank">Upgrade to Pro Version</a> | <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8">Donate</a> | <a href="http://semperplugins.com/support/" >Support</a> | <a href="https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web" target="_blank" title="Amazon Wish List">Amazon Wishlist</a>
6
- Version: 2.1.5
7
  Author: Michael Torbert
8
  Author URI: http://michaeltorbert.com
9
  */
@@ -30,11 +30,11 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
30
 
31
  /**
32
  * @package All-in-One-SEO-Pack
33
- * @version 2.1.5
34
  */
35
 
36
  if ( ! defined( 'AIOSEOP_VERSION' ) )
37
- define( 'AIOSEOP_VERSION', '2.1.5' );
38
 
39
  if ( ! defined( 'AIOSEOP_PLUGIN_DIR' ) ) {
40
  define( 'AIOSEOP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
3
  Plugin Name: All In One SEO Pack
4
  Plugin URI: http://semperfiwebdesign.com
5
  Description: Out-of-the-box SEO for your WordPress blog. <a href="admin.php?page=all-in-one-seo-pack/aioseop_class.php">Options configuration panel</a> | <a href="http://semperplugins.com/plugins/all-in-one-seo-pack-pro-version/?loc=plugins" target="_blank">Upgrade to Pro Version</a> | <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8">Donate</a> | <a href="http://semperplugins.com/support/" >Support</a> | <a href="https://www.amazon.com/wishlist/1NFQ133FNCOOA/ref=wl_web" target="_blank" title="Amazon Wish List">Amazon Wishlist</a>
6
+ Version: 2.1.6
7
  Author: Michael Torbert
8
  Author URI: http://michaeltorbert.com
9
  */
30
 
31
  /**
32
  * @package All-in-One-SEO-Pack
33
+ * @version 2.1.6
34
  */
35
 
36
  if ( ! defined( 'AIOSEOP_VERSION' ) )
37
+ define( 'AIOSEOP_VERSION', '2.1.6' );
38
 
39
  if ( ! defined( 'AIOSEOP_PLUGIN_DIR' ) ) {
40
  define( 'AIOSEOP_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
quickedit_functions.js CHANGED
@@ -1,5 +1,6 @@
1
- function aioseop_ajax_edit_meta_form( post_id, post_title, meta ) {
2
  var uform = jQuery('#aioseop_'+meta+'_' + post_id);
 
3
  var element = uform.html(); var input;
4
  input = '<textarea id="aioseop_new_'+meta+'_' + post_id + '" style="font-size:10px;width:65%;float:left" rows=2 cols=16>' + post_title + '</textarea>';
5
  input += '<label style="float:left">';
1
+ function aioseop_ajax_edit_meta_form( post_id, meta ) {
2
  var uform = jQuery('#aioseop_'+meta+'_' + post_id);
3
+ var post_title = jQuery('#aioseop_label_' + meta + '_' + post_id).text();
4
  var element = uform.html(); var input;
5
  input = '<textarea id="aioseop_new_'+meta+'_' + post_id + '" style="font-size:10px;width:65%;float:left" rows=2 cols=16>' + post_title + '</textarea>';
6
  input += '<label style="float:left">';
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: hallsofmontezuma
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8
4
  Tags: all in one, all in one seo, all in one seo pack, seo, search engine optimization, google
5
  Requires at least: 3.3
6
- Tested up to: 3.9
7
  Stable tag: trunk
8
 
9
  All in One SEO Pack is a WordPress SEO plugin to automatically optimize your WordPress blog for Search Engines such as Google.
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtorbert%40gmail%2ecom&item_name=All%20In%20One%20SEO%20Pack&item_number=Support%20Open%20Source&no_shipping=0&no_note=1&tax=0&currency_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8
4
  Tags: all in one, all in one seo, all in one seo pack, seo, search engine optimization, google
5
  Requires at least: 3.3
6
+ Tested up to: 3.9.1
7
  Stable tag: trunk
8
 
9
  All in One SEO Pack is a WordPress SEO plugin to automatically optimize your WordPress blog for Search Engines such as Google.