AMP for WP – Accelerated Mobile Pages - Version 0.9.97.32

Version Description

(8th February 2019) = * Added: Rank Math SEO compatibility integrated #2701 & #2736 * Added: New filter "ampforwp_modify_thumb_url_array" to modify the thumbnail #2739 * Fixed: 'Call Button Color' option not working - code updated #2820 * Fixed: Validation error when uploading YouTube video in Comments #2827 * Fixed: When Mobile Redirection option is enabled then, fr (language symbol) is removed from the URL. #2721 * Fixed: Category Module from Page Builder not displaying #2870 * Fixed: The homepage displays the title of the first post in All in one SEO #2865 * Fixed: Title mismatch in some posts with Yoast #2871

Full changelog available in changelog.txt

Download this release

Release Info

Developer mohammed_kaludi
Plugin Icon 128x128 AMP for WP – Accelerated Mobile Pages
Version 0.9.97.32
Comparing to
See all releases

Code changes from version 0.9.97.31 to 0.9.97.32

README.md CHANGED
@@ -4,7 +4,7 @@ Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, go
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.0.3
7
- Stable tag: 0.9.97.31
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -184,6 +184,17 @@ You can contact us from [here](https://ampforwp.com/contact/)
184
 
185
  == Changelog ==
186
 
 
 
 
 
 
 
 
 
 
 
 
187
  = 0.9.97.31 (4th February 2019) =
188
  * Added: Subtitles plugin Compatibility #2853
189
  * Added: Created an option for Id's for all the modules and column in AMP Page builder #2730
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.0.3
7
+ Stable tag: 0.9.97.32
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
184
 
185
  == Changelog ==
186
 
187
+ = 0.9.97.32 (8th February 2019) =
188
+ * Added: Rank Math SEO compatibility integrated #2701 & #2736
189
+ * Added: New filter "ampforwp_modify_thumb_url_array" to modify the thumbnail #2739
190
+ * Fixed: 'Call Button Color' option not working - code updated #2820
191
+ * Fixed: Validation error when uploading YouTube video in Comments #2827
192
+ * Fixed: When Mobile Redirection option is enabled then, fr (language symbol) is removed from the URL. #2721
193
+ * Fixed: Category Module from Page Builder not displaying #2870
194
+ * Fixed: The homepage displays the title of the first post in All in one SEO #2865
195
+ * Fixed: Title mismatch in some posts with Yoast #2871
196
+
197
+
198
  = 0.9.97.31 (4th February 2019) =
199
  * Added: Subtitles plugin Compatibility #2853
200
  * Added: Created an option for Id's for all the modules and column in AMP Page builder #2730
accelerated-moblie-pages.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Accelerated Mobile Pages
4
  Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/
5
  Description: AMP for WP - Accelerated Mobile Pages for WordPress
6
- Version: 0.9.97.31
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
@@ -20,7 +20,7 @@ define('AMPFORWP_PLUGIN_DIR_URI', plugin_dir_url(__FILE__));
20
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.html');
21
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
22
  define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
23
- define('AMPFORWP_VERSION','0.9.97.31');
24
  // any changes to AMP_QUERY_VAR should be refelected here
25
  function ampforwp_generate_endpoint(){
26
  $ampforwp_slug = '';
@@ -864,4 +864,7 @@ function ampforwp_add_plugin_meta_links($meta_fields, $file) {
864
  }
865
  return $meta_fields;
866
  }
867
- }
 
 
 
3
  Plugin Name: Accelerated Mobile Pages
4
  Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/
5
  Description: AMP for WP - Accelerated Mobile Pages for WordPress
6
+ Version: 0.9.97.32
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
20
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.html');
21
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
22
  define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
23
+ define('AMPFORWP_VERSION','0.9.97.32');
24
  // any changes to AMP_QUERY_VAR should be refelected here
25
  function ampforwp_generate_endpoint(){
26
  $ampforwp_slug = '';
864
  }
865
  return $meta_fields;
866
  }
867
+ }
868
+
869
+ // AMPforWP Global Data variable
870
+ $ampforwp_data = array();
changelog.txt CHANGED
@@ -1,5 +1,15 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
 
 
 
3
  = 0.9.97.31 (4th February 2019) =
4
  * Added: Subtitles plugin Compatibility #2853
5
  * Added: Created an option for Id's for all the modules and column in AMP Page builder #2730
1
  == Changelog ==
2
 
3
+ = 0.9.97.32 (8th February 2019) =
4
+ * Added: Rank Math SEO compatibility integrated #2701 & #2736
5
+ * Added: New filter "ampforwp_modify_thumb_url_array" to modify the thumbnail #2739
6
+ * Fixed: 'Call Button Color' option not working - code updated #2820
7
+ * Fixed: Validation error when uploading YouTube video in Comments #2827
8
+ * Fixed: When Mobile Redirection option is enabled then, fr (language symbol) is removed from the URL. #2721
9
+ * Fixed: Category Module from Page Builder not displaying #2870
10
+ * Fixed: The homepage displays the title of the first post in All in one SEO #2865
11
+ * Fixed: Title mismatch in some posts with Yoast #2871
12
+
13
  = 0.9.97.31 (4th February 2019) =
14
  * Added: Subtitles plugin Compatibility #2853
15
  * Added: Created an option for Id's for all the modules and column in AMP Page builder #2730
components/comments/comments.php CHANGED
@@ -70,7 +70,11 @@ function ampforwp_framework_get_comments(){
70
  $sanitizer = new AMPFORWP_Content( $comment_content, array(), apply_filters( 'ampforwp_content_sanitizers', array(
71
  'AMP_Img_Sanitizer' => array(),
72
  'AMP_Video_Sanitizer' => array(),
73
- 'AMP_Style_Sanitizer' => array() ) ) );
 
 
 
 
74
  $sanitized_comment_content = $sanitizer->get_amp_content();
75
  echo make_clickable( $sanitized_comment_content ); ?>
76
  </div>
70
  $sanitizer = new AMPFORWP_Content( $comment_content, array(), apply_filters( 'ampforwp_content_sanitizers', array(
71
  'AMP_Img_Sanitizer' => array(),
72
  'AMP_Video_Sanitizer' => array(),
73
+ 'AMP_Style_Sanitizer' => array(),
74
+ 'AMP_Iframe_Sanitizer' =>
75
+ array(
76
+ 'add_placeholder' => true,
77
+ ) ) ) );
78
  $sanitized_comment_content = $sanitizer->get_amp_content();
79
  echo make_clickable( $sanitized_comment_content ); ?>
80
  </div>
components/loop/loop.php CHANGED
@@ -388,7 +388,8 @@ function amp_loop_image( $data=array() ) {
388
  $width = $width * $resolution;
389
  $height = $height * $resolution;
390
  }
391
- $thumb_url_array = ampforwp_aq_resize( $thumb_url, $width, $height, true, false, true ); //resize & crop the image
 
392
  $thumb_url = $thumb_url_array[0];
393
  $thumb_width = $thumb_url_array[1];
394
  $thumb_height = $thumb_url_array[2];
388
  $width = $width * $resolution;
389
  $height = $height * $resolution;
390
  }
391
+ $thumbnail_modify = apply_filters('ampforwp_modify_thumb_url_array', array('thumb_url'=>$thumb_url,'width'=>$width,'height'=> $height));
392
+ $thumb_url_array = ampforwp_aq_resize( $thumbnail_modify['thumb_url'], $thumbnail_modify['width'], $thumbnail_modify['height'], true, false, true ); //resize & crop the image
393
  $thumb_url = $thumb_url_array[0];
394
  $thumb_width = $thumb_url_array[1];
395
  $thumb_height = $thumb_url_array[2];
includes/options/admin-config.php CHANGED
@@ -1834,11 +1834,14 @@ Redux::setArgs( "redux_builder_amp", $args );
1834
  $default = '';
1835
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
1836
  if ( is_plugin_active('wordpress-seo/wp-seo.php') ) {
1837
- $default = 1;
1838
  }
1839
  elseif ( is_plugin_active('all-in-one-seo-pack/all_in_one_seo_pack.php') ) {
1840
  $default = 2;
1841
  }
 
 
 
1842
  return $default;
1843
  }
1844
  }
@@ -1884,8 +1887,9 @@ Redux::setArgs( "redux_builder_amp", $args );
1884
  'type' => 'select',
1885
  'title' => esc_html__('Select SEO Plugin', 'accelerated-mobile-pages'),
1886
  'options' => array(
1887
- '1' => 'Yoast',
1888
- '2' => 'All in One SEO'
 
1889
  ),
1890
  'default' => ampforwp_seo_default(),
1891
  ),
@@ -1896,7 +1900,7 @@ Redux::setArgs( "redux_builder_amp", $args );
1896
  'tooltip-subtitle' => esc_html__('Adds Social and Open Graph Meta Tags from Yoast', 'accelerated-mobile-pages'),
1897
  'title' => esc_html__( 'Meta Tags from Yoast', 'accelerated-mobile-pages' ),
1898
  'default' => '1',
1899
- 'required' => array('ampforwp-seo-selection', '=' , '1'),
1900
  ),
1901
  array(
1902
  'class' => 'child_opt',
@@ -1905,7 +1909,7 @@ Redux::setArgs( "redux_builder_amp", $args );
1905
  'tooltip-subtitle' => esc_html__('Adds Yoast Custom description to ld+json for AMP page', 'accelerated-mobile-pages'),
1906
  'title' => esc_html__( 'Yoast Description in ld+json', 'accelerated-mobile-pages' ),
1907
  'default' => 0,
1908
- 'required' => array('ampforwp-seo-selection', '=' , '1'),
1909
  ),
1910
  array(
1911
  'class' => 'child_opt',
@@ -1914,7 +1918,7 @@ Redux::setArgs( "redux_builder_amp", $args );
1914
  'tooltip-subtitle' => esc_html__('Pull Canonical from Yoast for AMP pages', 'accelerated-mobile-pages'),
1915
  'title' => esc_html__( 'Canonical from Yoast', 'accelerated-mobile-pages' ),
1916
  'default' => 0,
1917
- 'required' => array('ampforwp-seo-selection', '=' , '1'),
1918
  ),
1919
  array(
1920
  'id' => 'ampforwp-seo-aioseo',
1834
  $default = '';
1835
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
1836
  if ( is_plugin_active('wordpress-seo/wp-seo.php') ) {
1837
+ $default = 'yoast';
1838
  }
1839
  elseif ( is_plugin_active('all-in-one-seo-pack/all_in_one_seo_pack.php') ) {
1840
  $default = 2;
1841
  }
1842
+ elseif ( defined( 'RANK_MATH_FILE' ) ) {
1843
+ $default = 'rank_math';
1844
+ }
1845
  return $default;
1846
  }
1847
  }
1887
  'type' => 'select',
1888
  'title' => esc_html__('Select SEO Plugin', 'accelerated-mobile-pages'),
1889
  'options' => array(
1890
+ 'yoast' => 'Yoast',
1891
+ '2' => 'All in One SEO',
1892
+ 'rank_math' => 'Rank Math SEO'
1893
  ),
1894
  'default' => ampforwp_seo_default(),
1895
  ),
1900
  'tooltip-subtitle' => esc_html__('Adds Social and Open Graph Meta Tags from Yoast', 'accelerated-mobile-pages'),
1901
  'title' => esc_html__( 'Meta Tags from Yoast', 'accelerated-mobile-pages' ),
1902
  'default' => '1',
1903
+ 'required' => array('ampforwp-seo-selection', '=' , 'yoast'),
1904
  ),
1905
  array(
1906
  'class' => 'child_opt',
1909
  'tooltip-subtitle' => esc_html__('Adds Yoast Custom description to ld+json for AMP page', 'accelerated-mobile-pages'),
1910
  'title' => esc_html__( 'Yoast Description in ld+json', 'accelerated-mobile-pages' ),
1911
  'default' => 0,
1912
+ 'required' => array('ampforwp-seo-selection', '=' , 'yoast'),
1913
  ),
1914
  array(
1915
  'class' => 'child_opt',
1918
  'tooltip-subtitle' => esc_html__('Pull Canonical from Yoast for AMP pages', 'accelerated-mobile-pages'),
1919
  'title' => esc_html__( 'Canonical from Yoast', 'accelerated-mobile-pages' ),
1920
  'default' => 0,
1921
+ 'required' => array('ampforwp-seo-selection', '=' , 'yoast'),
1922
  ),
1923
  array(
1924
  'id' => 'ampforwp-seo-aioseo',
includes/redirect.php CHANGED
@@ -238,7 +238,10 @@ function ampforwp_page_template_redirect() {
238
  session_destroy();
239
  }
240
  }
241
-
 
 
 
242
  // Check if we are on Mobile phones then start redirection process
243
  if ( wp_is_mobile() ) {
244
 
238
  session_destroy();
239
  }
240
  }
241
+ if ( function_exists('weglot_plugin_loaded') ) {
242
+ $url_to_redirect = ampforwp_get_weglot_url();
243
+ $url_to_redirect = ampforwp_url_controller($url_to_redirect);
244
+ }
245
  // Check if we are on Mobile phones then start redirection process
246
  if ( wp_is_mobile() ) {
247
 
includes/vendor/amp/includes/amp-post-template-actions.php CHANGED
@@ -40,7 +40,7 @@ function amp_post_template_add_boilerplate_css( $amp_template ) {
40
  <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
41
  <?php
42
  }
43
- if( ! is_plugin_active('structured-data-for-wp/structured-data-for-wp.php') && ! is_plugin_active('schema-and-structured-data-for-wp/structured-data-for-wp.php') ):
44
  add_action( 'amp_post_template_footer', 'amp_post_template_add_schemaorg_metadata' );
45
  function amp_post_template_add_schemaorg_metadata( $amp_template ) {
46
  $metadata = $amp_template->get( 'metadata' );
40
  <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
41
  <?php
42
  }
43
+ if( ! is_plugin_active('structured-data-for-wp/structured-data-for-wp.php') && ! is_plugin_active('schema-and-structured-data-for-wp/structured-data-for-wp.php') && !defined( 'RANK_MATH_FILE' ) ):
44
  add_action( 'amp_post_template_footer', 'amp_post_template_add_schemaorg_metadata' );
45
  function amp_post_template_add_schemaorg_metadata( $amp_template ) {
46
  $metadata = $amp_template->get( 'metadata' );
pagebuilder/modules/contents-module.php CHANGED
@@ -3,7 +3,8 @@
3
  if ( ! defined( 'ABSPATH' ) ) exit;
4
  require_once ABSPATH . WPINC . '/category.php';
5
  $output = '{{if_condition_content_layout_type==1}}
6
- <div {{if_id}}id="{{id}}"{{ifend_id}} class="pb_mod cat_mod {{user_class}}"><h4>{{content_title}}</h4>
 
7
  </div>
8
  {{ifend_condition_content_layout_type_1}}
9
  ';
3
  if ( ! defined( 'ABSPATH' ) ) exit;
4
  require_once ABSPATH . WPINC . '/category.php';
5
  $output = '{{if_condition_content_layout_type==1}}
6
+ <div {{if_id}}id="{{id}}"{{ifend_id}} class="pb_mod cat_mod {{user_class}}"><h4>{{content_title}}</h4>
7
+ <div class="wrap"><ul>{{category_selection}}</ul></div>
8
  </div>
9
  {{ifend_condition_content_layout_type_1}}
10
  ';
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, go
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.0.3
7
- Stable tag: 0.9.97.31
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -185,17 +185,14 @@ You can contact us from [here](https://ampforwp.com/contact/)
185
 
186
  == Changelog ==
187
 
188
- = 0.9.97.31 (4th February 2019) =
189
- * Added: Subtitles plugin Compatibility #2853
190
- * Added: Created an option for Id's for all the modules and column in AMP Page builder #2730
191
- * Fixed: All the Images are Adding AMP at the End of their URL #2391
192
- * Fixed: When nextpage pagination is added, URL in is rendering /2?amp=1 #2767 #2766
193
- * Fixed: Comments Issues #2755
194
- * Fixed: The gutenberg button doesn't work in amp #2707
195
- * Fixed: Button Module color is not getting changed #2745
196
- * Fixed: Issue with amp menu converting & ASCII code to X #2855
197
- * Fixed: 'Call Button Color' option not working #2820
198
- * Fixed: Error: The attribute 'alt' may not appear in tag 'a' #2837
199
- * Fixed: Captions are not working in Gallery #2576
200
 
201
  Full changelog available in changelog.txt
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.0.3
7
+ Stable tag: 0.9.97.32
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
185
 
186
  == Changelog ==
187
 
188
+ = 0.9.97.32 (8th February 2019) =
189
+ * Added: Rank Math SEO compatibility integrated #2701 & #2736
190
+ * Added: New filter "ampforwp_modify_thumb_url_array" to modify the thumbnail #2739
191
+ * Fixed: 'Call Button Color' option not working - code updated #2820
192
+ * Fixed: Validation error when uploading YouTube video in Comments #2827
193
+ * Fixed: When Mobile Redirection option is enabled then, fr (language symbol) is removed from the URL. #2721
194
+ * Fixed: Category Module from Page Builder not displaying #2870
195
+ * Fixed: The homepage displays the title of the first post in All in one SEO #2865
196
+ * Fixed: Title mismatch in some posts with Yoast #2871
 
 
 
197
 
198
  Full changelog available in changelog.txt
templates/design-manager/design-1/elements/comments.php CHANGED
@@ -60,7 +60,11 @@
60
  $sanitizer = new AMPFORWP_Content( $comment_content, array(), apply_filters( 'ampforwp_content_sanitizers', array(
61
  'AMP_Img_Sanitizer' => array(),
62
  'AMP_Video_Sanitizer' => array(),
63
- 'AMP_Style_Sanitizer' => array()
 
 
 
 
64
  ) ) );
65
  $sanitized_comment_content = $sanitizer->get_amp_content();
66
  echo make_clickable( $sanitized_comment_content );// amphtml content, no kses ?>
60
  $sanitizer = new AMPFORWP_Content( $comment_content, array(), apply_filters( 'ampforwp_content_sanitizers', array(
61
  'AMP_Img_Sanitizer' => array(),
62
  'AMP_Video_Sanitizer' => array(),
63
+ 'AMP_Style_Sanitizer' => array(),
64
+ 'AMP_Iframe_Sanitizer' =>
65
+ array(
66
+ 'add_placeholder' => true,
67
+ )
68
  ) ) );
69
  $sanitized_comment_content = $sanitizer->get_amp_content();
70
  echo make_clickable( $sanitized_comment_content );// amphtml content, no kses ?>
templates/design-manager/design-2/elements/comments.php CHANGED
@@ -60,7 +60,11 @@
60
  $sanitizer = new AMPFORWP_Content( $comment_content, array(), apply_filters( 'ampforwp_content_sanitizers', array(
61
  'AMP_Img_Sanitizer' => array(),
62
  'AMP_Video_Sanitizer' => array(),
63
- 'AMP_Style_Sanitizer' => array()
 
 
 
 
64
  ) ) );
65
  $sanitized_comment_content = $sanitizer->get_amp_content();
66
  echo make_clickable( $sanitized_comment_content );// amphtml content, no kses ?>
60
  $sanitizer = new AMPFORWP_Content( $comment_content, array(), apply_filters( 'ampforwp_content_sanitizers', array(
61
  'AMP_Img_Sanitizer' => array(),
62
  'AMP_Video_Sanitizer' => array(),
63
+ 'AMP_Style_Sanitizer' => array(),
64
+ 'AMP_Iframe_Sanitizer' =>
65
+ array(
66
+ 'add_placeholder' => true,
67
+ )
68
  ) ) );
69
  $sanitized_comment_content = $sanitizer->get_amp_content();
70
  echo make_clickable( $sanitized_comment_content );// amphtml content, no kses ?>
templates/design-manager/design-3/elements/comments.php CHANGED
@@ -60,7 +60,11 @@
60
  $sanitizer = new AMPFORWP_Content( $comment_content, array(), apply_filters( 'ampforwp_content_sanitizers', array(
61
  'AMP_Img_Sanitizer' => array(),
62
  'AMP_Video_Sanitizer' => array(),
63
- 'AMP_Style_Sanitizer' => array()
 
 
 
 
64
  ) ) );
65
  $sanitized_comment_content = $sanitizer->get_amp_content();
66
  echo make_clickable( $sanitized_comment_content );//amphtml content, no kses ?>
60
  $sanitizer = new AMPFORWP_Content( $comment_content, array(), apply_filters( 'ampforwp_content_sanitizers', array(
61
  'AMP_Img_Sanitizer' => array(),
62
  'AMP_Video_Sanitizer' => array(),
63
+ 'AMP_Style_Sanitizer' => array(),
64
+ 'AMP_Iframe_Sanitizer' =>
65
+ array(
66
+ 'add_placeholder' => true,
67
+ )
68
  ) ) );
69
  $sanitized_comment_content = $sanitizer->get_amp_content();
70
  echo make_clickable( $sanitized_comment_content );//amphtml content, no kses ?>
templates/design-manager/swift/style.php CHANGED
@@ -84,7 +84,7 @@ header .cntr{
84
  <?php
85
  $callnowcolor = ampforwp_get_setting('amp-opt-color-rgba-colorscheme-call');
86
  if ( !empty($callnowcolor['color']) ) { ?>
87
- .h-call a:after{color:<?php echo $callnowcolor['color'];?>;}
88
  <?php }
89
  } ?>
90
  .h-shop a:after{align-self: center;}
84
  <?php
85
  $callnowcolor = ampforwp_get_setting('amp-opt-color-rgba-colorscheme-call');
86
  if ( !empty($callnowcolor['color']) ) { ?>
87
+ .h-call a:after{color:<?php echo ampforwp_sanitize_color($callnowcolor['color']);?>;}
88
  <?php }
89
  } ?>
90
  .h-shop a:after{align-self: center;}
templates/features.php CHANGED
@@ -2416,6 +2416,10 @@ function ampforwp_replace_title_tags() {
2416
  $post_id = ampforwp_get_frontpage_id();
2417
  $post = get_post($post_id);
2418
  }
 
 
 
 
2419
  if ( !$post ) {
2420
  return;
2421
  }
@@ -2452,22 +2456,29 @@ function ampforwp_replace_title_tags() {
2452
  $ID = ampforwp_get_blog_details('id');
2453
  $site_title = get_the_title( $ID ) . $sep . get_option( 'blogname' );
2454
  }
2455
- // Custom Front Page Title From Yoast SEO #1163
2456
- if ( class_exists('WPSEO_Meta_Columns') && (ampforwp_is_front_page() || ampforwp_is_blog()) ) {
2457
- $ID = ampforwp_get_frontpage_id();
2458
- if ( ampforwp_is_blog() ) {
2459
- $ID = ampforwp_get_blog_details('id');
2460
- }
2461
- $fixed_title = WPSEO_Meta::get_value( 'title', $ID );
2462
- if ( $fixed_title ) {
2463
- $site_title = apply_filters( 'wpseo_title', wpseo_replace_vars( $fixed_title, get_post( $ID, ARRAY_A ) ) );
2464
- }
2465
- }
2466
  }
2467
 
2468
  if ( is_search() ) {
2469
  $site_title = $redux_builder_amp['amp-translator-search-text'] . ' ' . get_search_query();
2470
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2471
  //Genesis #1013
2472
  if(function_exists('genesis_title')){
2473
  if(is_home() && is_front_page() && !$redux_builder_amp['amp-frontpage-select-option']){
@@ -2520,15 +2531,27 @@ function ampforwp_replace_title_tags() {
2520
  $site_title = $genesis_title;
2521
  }
2522
  }
2523
-
2524
  // All in One SEO #2816
2525
- if ( class_exists('All_in_One_SEO_Pack') && ampforwp_is_front_page() ) {
2526
- $aiseop_title = $post = '';
2527
- $aiseop_title = get_post_meta( $post_id, '_aioseop_title', true );
2528
- if ( !empty($aiseop_title) ) {
2529
- $site_title = $aiseop_title;
2530
- }
2531
- add_filter('aioseop_title', '__return_false');
 
 
 
 
 
 
 
 
 
 
 
 
 
2532
  }
2533
  return esc_html( convert_chars( wptexturize( trim( $site_title ) ) ) );
2534
  }
@@ -3825,7 +3848,7 @@ function ampforwp_change_default_amp_page_meta() {
3825
  add_action('amp_post_template_head','ampforwp_meta_description');
3826
  function ampforwp_meta_description() {
3827
  global $redux_builder_amp;
3828
- if ( ! $redux_builder_amp['ampforwp-seo-meta-description'] ) {
3829
  return;
3830
  }
3831
  $desc = "";
@@ -4876,6 +4899,14 @@ function ampforwp_add_blacklist_sanitizer($data){
4876
  function ampforwp_generate_meta_desc($json=""){
4877
  global $post, $redux_builder_amp;
4878
  $desc = $post_id = '';
 
 
 
 
 
 
 
 
4879
  $post_id = $post->ID;
4880
  if ( $redux_builder_amp['ampforwp-seo-meta-description'] ) {
4881
  if ( ampforwp_is_home() || ampforwp_is_blog() ) {
@@ -4904,7 +4935,7 @@ function ampforwp_generate_meta_desc($json=""){
4904
  }
4905
 
4906
  // Yoast
4907
- if ( class_exists('WPSEO_Frontend') && 1 == $redux_builder_amp['ampforwp-seo-selection'] ) {
4908
  $front = $yoast_desc = '';
4909
  $front = WPSEO_Frontend::get_instance();
4910
  $yoast_desc = addslashes( strip_tags( $front->metadesc( false ) ) );
@@ -4983,6 +5014,14 @@ function ampforwp_generate_meta_desc($json=""){
4983
  $desc = $genesis_description;
4984
  }
4985
  }
 
 
 
 
 
 
 
 
4986
  // strip_shortcodes strategy not working here so had to do this way
4987
  // strips shortcodes
4988
  $desc = preg_replace('/\[(.*?)\]/','', $desc);
@@ -7254,6 +7293,9 @@ function ampforwp_generate_canonical(){
7254
  $opts = $All_in_One_SEO_Pack->get_current_options( array(), 'aiosp' );
7255
  $canonical = $opts['aiosp_custom_link'];
7256
  }
 
 
 
7257
  return $canonical;
7258
  }
7259
  add_filter('amp_post_template_data', 'ampforwp_modified_canonical', 85);
@@ -7812,4 +7854,95 @@ if (class_exists('Subtitles')){
7812
  <?php
7813
  }
7814
  }
7815
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2416
  $post_id = ampforwp_get_frontpage_id();
2417
  $post = get_post($post_id);
2418
  }
2419
+ if ( ampforwp_is_blog() ) {
2420
+ $post_id = ampforwp_get_blog_details('id');
2421
+ $post = get_post($post_id);
2422
+ }
2423
  if ( !$post ) {
2424
  return;
2425
  }
2456
  $ID = ampforwp_get_blog_details('id');
2457
  $site_title = get_the_title( $ID ) . $sep . get_option( 'blogname' );
2458
  }
 
 
 
 
 
 
 
 
 
 
 
2459
  }
2460
 
2461
  if ( is_search() ) {
2462
  $site_title = $redux_builder_amp['amp-translator-search-text'] . ' ' . get_search_query();
2463
  }
2464
+
2465
+ // Yoast SEO Title compatibility #2871
2466
+ if( class_exists('WPSEO_Frontend') && 'yoast' == ampforwp_get_setting('ampforwp-seo-selection') ) {
2467
+ $yoast_title = $WPSEO_Frontend = '';
2468
+ $WPSEO_Frontend = WPSEO_Frontend::get_instance();
2469
+ $yoast_title = $WPSEO_Frontend->title($site_title);
2470
+ if ( ampforwp_is_home() ) {
2471
+ $yoast_title = $WPSEO_Frontend->get_title_from_options( 'title-home-wpseo' );
2472
+ }
2473
+ // Custom Front Page Title From Yoast SEO #1163
2474
+ if ( ampforwp_is_front_page() || ampforwp_is_blog() ) {
2475
+ $yoast_title = WPSEO_Meta::get_value( 'title', $post_id );
2476
+ }
2477
+ if ( $yoast_title ) {
2478
+ $site_title = apply_filters( 'wpseo_title', $yoast_title );
2479
+ }
2480
+ }
2481
+
2482
  //Genesis #1013
2483
  if(function_exists('genesis_title')){
2484
  if(is_home() && is_front_page() && !$redux_builder_amp['amp-frontpage-select-option']){
2531
  $site_title = $genesis_title;
2532
  }
2533
  }
 
2534
  // All in One SEO #2816
2535
+ if ( class_exists('All_in_One_SEO_Pack') && ( ampforwp_is_front_page() )) {
2536
+ $aiseop_title = $post = '';
2537
+ $aiseop_title = get_post_meta( $post_id, '_aioseop_title', true );
2538
+ if ( !empty($aiseop_title) ) {
2539
+ $site_title = $aiseop_title;
2540
+ }
2541
+ add_filter('aioseop_title', '__return_false');
2542
+ }
2543
+ if(class_exists('All_in_One_SEO_Pack') && ampforwp_is_home()){
2544
+ global $aioseop_options;
2545
+ if(!empty($aioseop_options['aiosp_home_title'])){
2546
+ $aiseop_title = $aioseop_options['aiosp_home_title'];
2547
+ }
2548
+ if ( !empty($aiseop_title) ) {
2549
+ $site_title = $aiseop_title;
2550
+ }
2551
+ }
2552
+ // Custom Front Page Title From Rank Math SEO #2701
2553
+ if ( defined( 'RANK_MATH_FILE' ) && 'rank_math' == ampforwp_get_setting('ampforwp-seo-selection') ) {
2554
+ $site_title = RankMath\Post::get_meta( 'title', $post_id );
2555
  }
2556
  return esc_html( convert_chars( wptexturize( trim( $site_title ) ) ) );
2557
  }
3848
  add_action('amp_post_template_head','ampforwp_meta_description');
3849
  function ampforwp_meta_description() {
3850
  global $redux_builder_amp;
3851
+ if ( false == ampforwp_get_setting('ampforwp-seo-meta-description') || 'rank_math' == ampforwp_get_setting('ampforwp-seo-selection') ) {
3852
  return;
3853
  }
3854
  $desc = "";
4899
  function ampforwp_generate_meta_desc($json=""){
4900
  global $post, $redux_builder_amp;
4901
  $desc = $post_id = '';
4902
+ if ( ampforwp_is_front_page() ) {
4903
+ $post_id = ampforwp_get_frontpage_id();
4904
+ $post = get_post($post_id);
4905
+ }
4906
+ if ( ampforwp_is_blog() ) {
4907
+ $post_id = ampforwp_get_blog_details('id');
4908
+ $post = get_post($post_id);
4909
+ }
4910
  $post_id = $post->ID;
4911
  if ( $redux_builder_amp['ampforwp-seo-meta-description'] ) {
4912
  if ( ampforwp_is_home() || ampforwp_is_blog() ) {
4935
  }
4936
 
4937
  // Yoast
4938
+ if ( class_exists('WPSEO_Frontend') && 'yoast' == $redux_builder_amp['ampforwp-seo-selection'] ) {
4939
  $front = $yoast_desc = '';
4940
  $front = WPSEO_Frontend::get_instance();
4941
  $yoast_desc = addslashes( strip_tags( $front->metadesc( false ) ) );
5014
  $desc = $genesis_description;
5015
  }
5016
  }
5017
+ // Rank Math SEO #2701
5018
+ if ( defined( 'RANK_MATH_FILE' ) && 'rank_math' == ampforwp_get_setting('ampforwp-seo-selection') ) {
5019
+ $rank_math_desc = '';
5020
+ $rank_math_desc = RankMath\Post::get_meta( 'description', $post_id );
5021
+ if ( $rank_math_desc ) {
5022
+ $desc = $rank_math_desc;
5023
+ }
5024
+ }
5025
  // strip_shortcodes strategy not working here so had to do this way
5026
  // strips shortcodes
5027
  $desc = preg_replace('/\[(.*?)\]/','', $desc);
7293
  $opts = $All_in_One_SEO_Pack->get_current_options( array(), 'aiosp' );
7294
  $canonical = $opts['aiosp_custom_link'];
7295
  }
7296
+ elseif (defined( 'RANK_MATH_FILE' ) && 'rank_math' == ampforwp_get_setting('ampforwp-seo-selection') ) {
7297
+ $canonical = rank_math()->head->canonical( false );
7298
+ }
7299
  return $canonical;
7300
  }
7301
  add_filter('amp_post_template_data', 'ampforwp_modified_canonical', 85);
7854
  <?php
7855
  }
7856
  }
7857
+ }
7858
+
7859
+ // AMPforWP Global Sanitizer
7860
+ add_action('pre_amp_render_post','ampforwp_comments_sanitizer');
7861
+ function ampforwp_comments_sanitizer(){
7862
+ global $ampforwp_data;
7863
+ $comments_scripts = array();
7864
+ $comments = $postID = $comment_text = '';
7865
+ $postID = get_the_ID();
7866
+ if ( ampforwp_is_front_page() ) {
7867
+ $postID = ampforwp_get_frontpage_id();
7868
+ }
7869
+ if ( ampforwp_get_comments_status() && true == ampforwp_get_setting('wordpress-comments-support') ) {
7870
+ $comments = get_comments(array(
7871
+ 'post_id' => $postID,
7872
+ 'status' => 'approve' //Change this to the type of comments to be displayed
7873
+ ) );
7874
+ foreach ($comments as $comment) {
7875
+ $comment_text = get_comment_text($comment->comment_ID);
7876
+ $comment_text = wpautop( $comment_text );
7877
+ $sanitizer = new AMPforWP_Content( $comment_text, apply_filters( 'amp_content_embed_handlers', array(
7878
+ 'AMP_Twitter_Embed_Handler' => array(),
7879
+ 'AMP_YouTube_Embed_Handler' => array(),
7880
+ 'AMP_DailyMotion_Embed_Handler' => array(),
7881
+ 'AMP_Vimeo_Embed_Handler' => array(),
7882
+ 'AMP_SoundCloud_Embed_Handler' => array(),
7883
+ 'AMP_Instagram_Embed_Handler' => array(),
7884
+ 'AMP_Vine_Embed_Handler' => array(),
7885
+ 'AMP_Facebook_Embed_Handler' => array(),
7886
+ 'AMP_Pinterest_Embed_Handler' => array(),
7887
+ 'AMP_Gallery_Embed_Handler' => array(),
7888
+ ) ), apply_filters( 'amp_sidebar_sanitizers', array(
7889
+ 'AMP_Style_Sanitizer' => array(),
7890
+ 'AMP_Blacklist_Sanitizer' => array(),
7891
+ 'AMP_Img_Sanitizer' => array(),
7892
+ 'AMP_Video_Sanitizer' => array(),
7893
+ 'AMP_Audio_Sanitizer' => array(),
7894
+ 'AMP_Playbuzz_Sanitizer' => array(),
7895
+ 'AMP_Iframe_Sanitizer' => array(
7896
+ 'add_placeholder' => true,
7897
+ ),
7898
+ ) ) );
7899
+ if ( $sanitizer ) {
7900
+ $sanitizer_scripts = $sanitizer->get_amp_scripts();
7901
+ if ( $sanitizer_scripts ){
7902
+ $comments_scripts = array_merge($comments_scripts, $sanitizer_scripts);
7903
+ }
7904
+ }
7905
+ }
7906
+ if ( $comments_scripts ) {
7907
+ $ampforwp_data['comments']['scripts'] = $comments_scripts;
7908
+ }
7909
+ }
7910
+ }
7911
+ // AMPforWP Global Scripts
7912
+ add_filter('amp_post_template_data','ampforwp_add_global_scripts');
7913
+ function ampforwp_add_global_scripts($data){
7914
+ global $ampforwp_data;
7915
+ // Add Comments Scripts #2827
7916
+ $comments_scripts = $ampforwp_data['comments']['scripts'];
7917
+ if ( !empty($comments_scripts) ) {
7918
+ foreach ($comments_scripts as $key => $value ) {
7919
+ if( empty( $data['amp_component_scripts'][$key] ) ){
7920
+ $data['amp_component_scripts'][$key] = $value;
7921
+ }
7922
+ }
7923
+ }
7924
+ return $data;
7925
+ }
7926
+ if ( ! function_exists('ampforwp_get_weglot_url') ) {
7927
+ function ampforwp_get_weglot_url(){
7928
+ $url = weglot_get_full_url_no_language();
7929
+ $current_lang = weglot_get_current_and_original_language();
7930
+ $original_lang = $current_lang['original'];
7931
+ $current_lang = $current_lang['current'];
7932
+ if($current_lang == $original_lang ){
7933
+ return $url;
7934
+ }else{
7935
+ $url = trailingslashit($url) . $current_lang;
7936
+ return esc_url(user_trailingslashit($url));
7937
+ }
7938
+
7939
+ }
7940
+ }
7941
+ // Rank Math SEO Compatibility #2701
7942
+ // og tags and Schema
7943
+ add_action('amp_post_template_head','ampforwp_rank_math');
7944
+ if ( ! function_exists('ampforwp_rank_math') ) {
7945
+ function ampforwp_rank_math(){
7946
+ do_action( 'rank_math/head' );
7947
+ }
7948
+ }