All in One SEO Pack - Version 2.4.2

Version Description

Download this release

Release Info

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

Code changes from version 2.4.1.1 to 2.4.2

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 your WordPress blog. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. More than 30 million downloads since 2007.
6
- Version: 2.4.1.1
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,14 +31,14 @@ 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 2.4.1.1
35
  */
36
 
37
  if ( ! defined( 'AIOSEOPPRO' ) ) {
38
  define( 'AIOSEOPPRO', false );
39
  }
40
  if ( ! defined( 'AIOSEOP_VERSION' ) ) {
41
- define( 'AIOSEOP_VERSION', '2.4.1.1' );
42
  }
43
  global $aioseop_plugin_name;
44
  $aioseop_plugin_name = 'All in One SEO Pack';
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 your WordPress blog. Features like XML Sitemaps, SEO for custom post types, SEO for blogs or business sites, SEO for ecommerce sites, and much more. More than 30 million downloads since 2007.
6
+ Version: 2.4.2
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 2.4.2
35
  */
36
 
37
  if ( ! defined( 'AIOSEOPPRO' ) ) {
38
  define( 'AIOSEOPPRO', false );
39
  }
40
  if ( ! defined( 'AIOSEOP_VERSION' ) ) {
41
+ define( 'AIOSEOP_VERSION', '2.4.2' );
42
  }
43
  global $aioseop_plugin_name;
44
  $aioseop_plugin_name = 'All in One SEO Pack';
inc/aioseop_functions.php CHANGED
@@ -978,3 +978,24 @@ function aioseop_home_url( $path = '/' ) {
978
  $url = apply_filters( 'aioseop_home_url', $path );
979
  return $path === $url ? home_url( $path ) : $url;
980
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
978
  $url = apply_filters( 'aioseop_home_url', $path );
979
  return $path === $url ? home_url( $path ) : $url;
980
  }
981
+
982
+
983
+ if ( ! function_exists('aiosp_include_images') ) {
984
+ function aiosp_include_images() {
985
+ if ( false === apply_filters( 'aioseo_include_images_in_sitemap', true ) ) {
986
+ return false;
987
+ }
988
+
989
+ global $aioseop_options;
990
+
991
+ if( isset( $aioseop_options['modules'] ) &&
992
+ isset( $aioseop_options['modules']['aiosp_sitemap_options'] ) &&
993
+ isset( $aioseop_options['modules']['aiosp_sitemap_options']['aiosp_sitemap_images'] ) &&
994
+ 'on' === $aioseop_options['modules']['aiosp_sitemap_options']['aiosp_sitemap_images']
995
+ ){
996
+ return false;
997
+ }
998
+
999
+ return true;
1000
+ }
1001
+ }
inc/aiosp_common.php CHANGED
@@ -105,4 +105,19 @@ class aiosp_common {
105
  static function get_upgrade_url() {
106
  //put build URL stuff in here
107
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
108
  }
105
  static function get_upgrade_url() {
106
  //put build URL stuff in here
107
  }
108
+
109
+ /**
110
+ * Check whether a url is relative and if it is, make it absolute.
111
+ *
112
+ * @param string $url URL to check.
113
+ *
114
+ * @return string
115
+ */
116
+ static function absolutize_url( $url ) {
117
+ if ( strpos( $url, 'http' ) !== 0 && strpos( $url, '//' ) !== 0 && $url != '/' ) {
118
+ $url = home_url( $url );
119
+ }
120
+ return $url;
121
+ }
122
+
123
  }
inc/sitemap-xsl.php CHANGED
@@ -143,7 +143,13 @@ echo '<?xml version="1.0" encoding="UTF-8"?>';
143
  <thead>
144
  <tr>
145
  <th width="50%">URL</th>
 
 
 
146
  <th>Images</th>
 
 
 
147
  <th>Priority</th>
148
  <th>Change Frequency</th>
149
  <th>Last Change</th>
@@ -176,9 +182,15 @@ echo '<?xml version="1.0" encoding="UTF-8"?>';
176
  </xsl:if>
177
  </xsl:for-each>
178
  </td>
 
 
 
179
  <td>
180
  <xsl:value-of select="count(image:image)"/>
181
  </td>
 
 
 
182
  <td>
183
  <xsl:if test="string(number(sitemap:priority))!='NaN'">
184
  <xsl:value-of select="concat(sitemap:priority*100,'%')"/>
143
  <thead>
144
  <tr>
145
  <th width="50%">URL</th>
146
+ <?php
147
+ if ( aiosp_include_images() ) {
148
+ ?>
149
  <th>Images</th>
150
+ <?php
151
+ }
152
+ ?>
153
  <th>Priority</th>
154
  <th>Change Frequency</th>
155
  <th>Last Change</th>
182
  </xsl:if>
183
  </xsl:for-each>
184
  </td>
185
+ <?php
186
+ if ( aiosp_include_images() ) {
187
+ ?>
188
  <td>
189
  <xsl:value-of select="count(image:image)"/>
190
  </td>
191
+ <?php
192
+ }
193
+ ?>
194
  <td>
195
  <xsl:if test="string(number(sitemap:priority))!='NaN'">
196
  <xsl:value-of select="concat(sitemap:priority*100,'%')"/>
modules/aioseop_sitemap.php CHANGED
@@ -62,6 +62,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
62
  'taxonomies' => __( 'Select which taxonomy archives appear in your sitemap', 'all-in-one-seo-pack' ),
63
  'archive' => __( 'Include Date Archives in your sitemap.', 'all-in-one-seo-pack' ),
64
  'author' => __( 'Include Author Archives in your sitemap.', 'all-in-one-seo-pack' ),
 
65
  'gzipped' => __( 'Create a compressed sitemap file in .xml.gz format.', 'all-in-one-seo-pack' ),
66
  'robots' => __( 'Places a link to your Sitemap.xml into your virtual Robots.txt file.', 'all-in-one-seo-pack' ),
67
  'rewrite' => __( 'Dynamically creates the XML sitemap instead of using a static file.', 'all-in-one-seo-pack' ),
@@ -82,6 +83,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
82
  'taxonomies' => '#post-types-and-taxonomies',
83
  'archive' => '#include-archive-pages',
84
  'author' => '#include-archive-pages',
 
85
  'gzipped' => '#create-compressed-sitemap',
86
  'robots' => '#link-from-virtual-robots',
87
  'rewrite' => '#dynamically-generate-sitemap',
@@ -130,6 +132,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
130
  ),
131
  'archive' => array( 'name' => __( 'Include Date Archive Pages', 'all-in-one-seo-pack' ) ),
132
  'author' => array( 'name' => __( 'Include Author Pages', 'all-in-one-seo-pack' ) ),
 
133
  'gzipped' => array(
134
  'name' => __( 'Create Compressed Sitemap', 'all-in-one-seo-pack' ),
135
  'default' => 'On',
@@ -331,7 +334,6 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
331
  return;
332
  }
333
 
334
- global $options;
335
  $options = $this->options;
336
 
337
  if ( isset( $options["{$this->prefix}indexes"] ) && 'on ' !== $options["{$this->prefix}indexes"] &&
@@ -2687,7 +2689,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
2687
  */
2688
  private function get_images_from_term( $term ) {
2689
 
2690
- if ( false === apply_filters( 'aioseo_include_images_in_sitemap', true ) ) {
2691
  return array();
2692
  }
2693
 
@@ -2716,7 +2718,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
2716
  */
2717
  private function get_images_from_post( $post ) {
2718
 
2719
- if ( false === apply_filters( 'aioseo_include_images_in_sitemap', true ) ) {
2720
  return array();
2721
  }
2722
 
@@ -2737,7 +2739,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
2737
  $attributes = wp_get_attachment_image_src( $post->ID );
2738
  if ( $attributes ) {
2739
  $images[] = array(
2740
- 'image:loc' => $attributes[0],
2741
  );
2742
  }
2743
 
@@ -2763,23 +2765,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
2763
  }
2764
  }
2765
 
2766
- $total = substr_count( $content, '<img ' ) + substr_count( $content, '<IMG ' );
2767
- if ( $total > 0 ) {
2768
- $dom = new domDocument();
2769
- // Non-compliant HTML might give errors, so ignore them.
2770
- libxml_use_internal_errors( true );
2771
- $dom->loadHTML( $content );
2772
- libxml_clear_errors();
2773
- // @codingStandardsIgnoreStart
2774
- $dom->preserveWhiteSpace = false;
2775
- // @codingStandardsIgnoreEnd
2776
- $matches = $dom->getElementsByTagName( 'img' );
2777
- foreach ( $matches as $match ) {
2778
- $images[] = $match->getAttribute( 'src' );
2779
- }
2780
- }
2781
-
2782
- $this->parse_content_for_images( $content, $images );
2783
 
2784
  if ( $images ) {
2785
  $tmp = $images;
@@ -2792,7 +2778,7 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
2792
  $images = array();
2793
  foreach ( $tmp as $image ) {
2794
  $images[] = array(
2795
- 'image:loc' => $image,
2796
  );
2797
  }
2798
  }
@@ -2800,6 +2786,24 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
2800
  return $images;
2801
  }
2802
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2803
 
2804
  /**
2805
  * Validate the image.
@@ -2816,6 +2820,9 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
2816
  return false;
2817
  }
2818
 
 
 
 
2819
  $extn = pathinfo( wp_parse_url( $image, PHP_URL_PATH ), PATHINFO_EXTENSION );
2820
  $allowed = apply_filters( 'aioseop_allowed_image_extensions', self::$image_extensions );
2821
  // Bail if image does not refer to an image file otherwise google webmaster tools might reject the sitemap.
@@ -2823,6 +2830,13 @@ if ( ! class_exists( 'All_in_One_SEO_Pack_Sitemap' ) ) {
2823
  return false;
2824
  }
2825
 
 
 
 
 
 
 
 
2826
  return true;
2827
  }
2828
 
62
  'taxonomies' => __( 'Select which taxonomy archives appear in your sitemap', 'all-in-one-seo-pack' ),
63
  'archive' => __( 'Include Date Archives in your sitemap.', 'all-in-one-seo-pack' ),
64
  'author' => __( 'Include Author Archives in your sitemap.', 'all-in-one-seo-pack' ),
65
+ 'images' => __( 'Exclude Images in your sitemap.', 'all-in-one-seo-pack' ),
66
  'gzipped' => __( 'Create a compressed sitemap file in .xml.gz format.', 'all-in-one-seo-pack' ),
67
  'robots' => __( 'Places a link to your Sitemap.xml into your virtual Robots.txt file.', 'all-in-one-seo-pack' ),
68
  'rewrite' => __( 'Dynamically creates the XML sitemap instead of using a static file.', 'all-in-one-seo-pack' ),
83
  'taxonomies' => '#post-types-and-taxonomies',
84
  'archive' => '#include-archive-pages',
85
  'author' => '#include-archive-pages',
86
+ 'images' => '#exclude-images',
87
  'gzipped' => '#create-compressed-sitemap',
88
  'robots' => '#link-from-virtual-robots',
89
  'rewrite' => '#dynamically-generate-sitemap',
132
  ),
133
  'archive' => array( 'name' => __( 'Include Date Archive Pages', 'all-in-one-seo-pack' ) ),
134
  'author' => array( 'name' => __( 'Include Author Pages', 'all-in-one-seo-pack' ) ),
135
+ 'images' => array( 'name' => __( 'Exclude Images', 'all-in-one-seo-pack' ) ),
136
  'gzipped' => array(
137
  'name' => __( 'Create Compressed Sitemap', 'all-in-one-seo-pack' ),
138
  'default' => 'On',
334
  return;
335
  }
336
 
 
337
  $options = $this->options;
338
 
339
  if ( isset( $options["{$this->prefix}indexes"] ) && 'on ' !== $options["{$this->prefix}indexes"] &&
2689
  */
2690
  private function get_images_from_term( $term ) {
2691
 
2692
+ if ( ! aiosp_include_images() ) {
2693
  return array();
2694
  }
2695
 
2718
  */
2719
  private function get_images_from_post( $post ) {
2720
 
2721
+ if ( ! aiosp_include_images() ) {
2722
  return array();
2723
  }
2724
 
2739
  $attributes = wp_get_attachment_image_src( $post->ID );
2740
  if ( $attributes ) {
2741
  $images[] = array(
2742
+ 'image:loc' => $this->clean_url( $attributes[0] ),
2743
  );
2744
  }
2745
 
2765
  }
2766
  }
2767
 
2768
+ $this->parse_content_for_images( $content, $images );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2769
 
2770
  if ( $images ) {
2771
  $tmp = $images;
2778
  $images = array();
2779
  foreach ( $tmp as $image ) {
2780
  $images[] = array(
2781
+ 'image:loc' => $this->clean_url( $image ),
2782
  );
2783
  }
2784
  }
2786
  return $images;
2787
  }
2788
 
2789
+ /**
2790
+ * Cleans the URL so that its acceptable in the sitemap.
2791
+ *
2792
+ * @param string $url The image url.
2793
+ *
2794
+ * @since 2.4.1
2795
+ *
2796
+ * @return string
2797
+ */
2798
+ function clean_url( $url ) {
2799
+ // remove the query string.
2800
+ $url = strtok( $url, '?' );
2801
+ // make the url XML-safe.
2802
+ $url = htmlspecialchars( $url );
2803
+ // Make the url absolute, if its relative.
2804
+ $url = aiosp_common::absolutize_url( $url );
2805
+ return apply_filters( 'aioseop_clean_url', $url );
2806
+ }
2807
 
2808
  /**
2809
  * Validate the image.
2820
  return false;
2821
  }
2822
 
2823
+ // make the url absolute, if its relative.
2824
+ $image = aiosp_common::absolutize_url( $image );
2825
+
2826
  $extn = pathinfo( wp_parse_url( $image, PHP_URL_PATH ), PATHINFO_EXTENSION );
2827
  $allowed = apply_filters( 'aioseop_allowed_image_extensions', self::$image_extensions );
2828
  // Bail if image does not refer to an image file otherwise google webmaster tools might reject the sitemap.
2830
  return false;
2831
  }
2832
 
2833
+ // Bail if image refers to an external URL.
2834
+ $image_host = wp_parse_url( $image, PHP_URL_HOST );
2835
+ $wp_host = wp_parse_url( home_url(), PHP_URL_HOST );
2836
+ if ( $image_host !== $wp_host ) {
2837
+ return false;
2838
+ }
2839
+
2840
  return true;
2841
  }
2842
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=mrtor
4
  Tags: seo, all in one seo, google, twitter, page, image seo, social, search engine optimization, sitemap, WordPress SEO, meta, meta description, xml sitemap, google sitemap, sitemaps, robots meta, yahoo, bing, news sitemaps, multisite, canonical, nofollow, noindex, keywords, description, webmaster tools, google webmaster tools, google analytics
5
  Requires at least: 4.0
6
  Tested up to: 4.8
7
- Stable tag: 2.4.1.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
4
  Tags: seo, all in one seo, google, twitter, page, image seo, social, search engine optimization, sitemap, WordPress SEO, meta, meta description, xml sitemap, google sitemap, sitemaps, robots meta, yahoo, bing, news sitemaps, multisite, canonical, nofollow, noindex, keywords, description, webmaster tools, google webmaster tools, google analytics
5
  Requires at least: 4.0
6
  Tested up to: 4.8
7
+ Stable tag: 2.4.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10