AMP for WP – Accelerated Mobile Pages - Version 1.0.53.2

Version Description

(21st June 2020) = * Fixed: Minor Bug

Download this release

Release Info

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

Code changes from version 1.0.53 to 1.0.53.2

README.md CHANGED
@@ -3,8 +3,8 @@ Contributors: mohammed_kaludi, ahmedkaludi, ampforwp
3
  Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin, SEO
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
- Tested up to: 5.4
7
- Stable tag: 1.0.52
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -42,7 +42,6 @@ Bug reports for AMP for WP are [welcomed on GitHub](https://github.com/ahmedkalu
42
  * 3 Pre-built AMP Layouts for Business websites and landing pages
43
  * OneSignal Push Notifications integration
44
  * Advanced WooCommerce Support [More Info](https://ampforwp.com/woocommerce/)
45
- * Gravity Forms Support [More Info](https://ampforwp.com/gravity-forms/)
46
  * AMP Plugins Manager - Which allows you to disable a specific plugin functionality only in the AMP version
47
  * Structured Data Options
48
  * Page Break / NextPage (Pagination) Support
@@ -194,6 +193,30 @@ Device testing done through [BrowserStack](https://www.browserstack.com)
194
 
195
  == Changelog ==
196
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
197
  = 1.0.52 (27th May 2020) =
198
  * Fixed: Reverted the CDN code of WP Rocket plugin which was causing the malformed url issue #4342
199
 
3
  Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin, SEO
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
+ Tested up to: 5.4.2
7
+ Stable tag: 1.0.53.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
42
  * 3 Pre-built AMP Layouts for Business websites and landing pages
43
  * OneSignal Push Notifications integration
44
  * Advanced WooCommerce Support [More Info](https://ampforwp.com/woocommerce/)
 
45
  * AMP Plugins Manager - Which allows you to disable a specific plugin functionality only in the AMP version
46
  * Structured Data Options
47
  * Page Break / NextPage (Pagination) Support
193
 
194
  == Changelog ==
195
 
196
+ = 1.0.53.2 (21st June 2020) =
197
+ * Fixed: Minor Bug
198
+
199
+ = 1.0.53 (19th June 2020) =
200
+ * Improvement: Need to implement YOAST breadcrumb for the category and the tags pages #4493
201
+ * Improvement: Added new set of hooks in all designs #4550
202
+ * Improvement: Added PostViews for AMP Extension #4549
203
+ * Improvement: Created an extra argument to pass for amp_author_box function so author links can be controlled #4466
204
+ * Fixed: Meta description tag is missing in AMP, when custom home page is selected. #4521
205
+ * Fixed: The attribute 'src' in tag 'amp-form extension .js script' is set to the invalid value'. #4515
206
+ * Fixed: The tag 'link rel=canonical' appears more than once in the document due to Yoast SEO premium plugin. #4511
207
+ * Fixed: Getting warnings due to Yoast SEO plugin. #4510
208
+ * Fixed: Issue with Image block of Gutenberg #4507
209
+ * Fixed: Gallery images(Gutenberg editor) are stretched when the Optimize CSS option is enabled. #4502
210
+ * Fixed: If category label has backslash in the name breadcrumbs break #4500
211
+ * Fixed: Vertical scroll Issue in iOS devices when the 'menu overlay' is positioned in right. #4461
212
+ * Fixed: WPRocket CDN is not working properly with the amp pages. #4342
213
+ * Fixed: When gdpr option is enabled the site is becoming unclickable in browser Safari on IOS and MacOS #4542
214
+ * Fixed: Unused HTML was showing in Video Module #4524
215
+ * Fixed: Getting validation error as "The attribute '"_blank"' may not appear in tag 'a' with RankMath #4527
216
+ * Fixed: Anchor tag is stripping in AMP with Sitekit By Google plugin is active #4552
217
+ * Fixed: Date styling not looking good in Design 3 archive pages #4557
218
+ * Fixed: Debug warning #4555
219
+
220
  = 1.0.52 (27th May 2020) =
221
  * Fixed: Reverted the CDN code of WP Rocket plugin which was causing the malformed url issue #4342
222
 
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: 1.0.52
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','1.0.52');
24
  define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
25
  if(!defined('AMPFROWP_HOST_NAME')){
26
  $urlinfo = get_bloginfo('url');
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: 1.0.53.2
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','1.0.53.2');
24
  define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
25
  if(!defined('AMPFROWP_HOST_NAME')){
26
  $urlinfo = get_bloginfo('url');
changelog.txt CHANGED
@@ -1,5 +1,29 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 1.0.52 (27th May 2020) =
4
  * Fixed: Reverted the CDN code of WP Rocket plugin which was causing the malformed url issue #4342
5
 
1
  == Changelog ==
2
 
3
+ = 1.0.53.2 (21st June 2020) =
4
+ * Fixed: Minor Bug
5
+
6
+ = 1.0.53 (19th June 2020) =
7
+ * Improvement: Need to implement YOAST breadcrumb for the category and the tags pages #4493
8
+ * Improvement: Added new set of hooks in all designs #4550
9
+ * Improvement: Added PostViews for AMP Extension #4549
10
+ * Improvement: Created an extra argument to pass for amp_author_box function so author links can be controlled #4466
11
+ * Fixed: Meta description tag is missing in AMP, when custom home page is selected. #4521
12
+ * Fixed: The attribute 'src' in tag 'amp-form extension .js script' is set to the invalid value'. #4515
13
+ * Fixed: The tag 'link rel=canonical' appears more than once in the document due to Yoast SEO premium plugin. #4511
14
+ * Fixed: Getting warnings due to Yoast SEO plugin. #4510
15
+ * Fixed: Issue with Image block of Gutenberg #4507
16
+ * Fixed: Gallery images(Gutenberg editor) are stretched when the Optimize CSS option is enabled. #4502
17
+ * Fixed: If category label has backslash in the name breadcrumbs break #4500
18
+ * Fixed: Vertical scroll Issue in iOS devices when the 'menu overlay' is positioned in right. #4461
19
+ * Fixed: WPRocket CDN is not working properly with the amp pages. #4342
20
+ * Fixed: When gdpr option is enabled the site is becoming unclickable in browser Safari on IOS and MacOS #4542
21
+ * Fixed: Unused HTML was showing in Video Module #4524
22
+ * Fixed: Getting validation error as "The attribute '"_blank"' may not appear in tag 'a' with RankMath #4527
23
+ * Fixed: Anchor tag is stripping in AMP with Sitekit By Google plugin is active #4552
24
+ * Fixed: Date styling not looking good in Design 3 archive pages #4557
25
+ * Fixed: Debug warning #4555
26
+
27
  = 1.0.52 (27th May 2020) =
28
  * Fixed: Reverted the CDN code of WP Rocket plugin which was causing the malformed url issue #4342
29
 
classes/class-ampforwp-youtube-embed.php CHANGED
@@ -117,7 +117,9 @@ class AMPforWP_YouTube_Embed_Handler extends AMP_Base_Embed_Handler {
117
  }
118
  } else {
119
  // ?v={id} or ?list={id}
120
- parse_str( $parsed_url['query'], $query_args );
 
 
121
 
122
  if ( isset( $query_args['v'] ) ) {
123
  $video_id = $this->sanitize_v_arg( $query_args['v'] );
117
  }
118
  } else {
119
  // ?v={id} or ?list={id}
120
+ if(isset($parsed_url['query'])){
121
+ parse_str( $parsed_url['query'], $query_args );
122
+ }
123
 
124
  if ( isset( $query_args['v'] ) ) {
125
  $video_id = $this->sanitize_v_arg( $query_args['v'] );
components/author-box/author-box.php CHANGED
@@ -71,6 +71,10 @@ if ( isset( $args['author_prefix']) ) {
71
  if ( isset( $args['author_link']) ) {
72
  $author_link = $args['author_link'];
73
  }
 
 
 
 
74
  if ( isset( $args['author_wrapper_class']) ) {
75
  $author_wrapper_class = $args['author_wrapper_class'];
76
  }
@@ -100,14 +104,21 @@ if ( isset($args['show_time']) ) {
100
  if ( true == ampforwp_get_setting('ampforwp-author-page-url') ){
101
  if ( function_exists('coauthors_posts_links') ) {
102
  if( $author_pub_name ){
103
- $author_link = (true == ampforwp_get_setting('ampforwp-archive-support'))? esc_url(ampforwp_url_controller($author_link)) : esc_url($author_link);
 
 
 
 
104
  echo '<span class="author-name">' .esc_html($author_prefix) . ' <a href="'. esc_url($author_link).'" title="'. esc_html($author_name).'"> ' .esc_html( $author_name ).'</a></span>';
105
  echo ampforwp_yoast_twitter_handle();
106
  }
107
  }
108
  else {
109
  if( $author_pub_name ){
110
- echo '<span class="author-name">' .esc_html($author_prefix) . ' <a href="'. esc_url(ampforwp_url_controller($author_link)).'" title="'. esc_html($author_name).'"> ' .esc_html( $author_name ).'</a></span>';
 
 
 
111
  echo ampforwp_yoast_twitter_handle();
112
  }
113
  }
71
  if ( isset( $args['author_link']) ) {
72
  $author_link = $args['author_link'];
73
  }
74
+ $is_author_link_amp = true;
75
+ if ( isset( $args['is_author_link_amp']) ) {
76
+ $is_author_link_amp = $args['is_author_link_amp'];
77
+ }
78
  if ( isset( $args['author_wrapper_class']) ) {
79
  $author_wrapper_class = $args['author_wrapper_class'];
80
  }
104
  if ( true == ampforwp_get_setting('ampforwp-author-page-url') ){
105
  if ( function_exists('coauthors_posts_links') ) {
106
  if( $author_pub_name ){
107
+ $auth_link = $author_link;
108
+ if($is_author_link_amp==true){
109
+ $auth_link = ampforwp_url_controller($author_link);
110
+ }
111
+ $author_link = (true == ampforwp_get_setting('ampforwp-archive-support'))? esc_url($auth_link) : esc_url($author_link);
112
  echo '<span class="author-name">' .esc_html($author_prefix) . ' <a href="'. esc_url($author_link).'" title="'. esc_html($author_name).'"> ' .esc_html( $author_name ).'</a></span>';
113
  echo ampforwp_yoast_twitter_handle();
114
  }
115
  }
116
  else {
117
  if( $author_pub_name ){
118
+ if($is_author_link_amp==true){
119
+ $author_link = ampforwp_url_controller($author_link);
120
+ }
121
+ echo '<span class="author-name">' .esc_html($author_prefix) . ' <a href="'. esc_url($author_link).'" title="'. esc_html($author_name).'"> ' .esc_html( $author_name ).'</a></span>';
122
  echo ampforwp_yoast_twitter_handle();
123
  }
124
  }
components/breadcrumb/breadcrumb.php CHANGED
@@ -130,7 +130,8 @@ function amp_breadcrumb_output(){
130
  // Loop through parent categories and store in variable $cat_display
131
  $cat_display = '';
132
  foreach($cat_parents as $parents) {
133
- $cat_id = get_cat_ID( $parents);
 
134
  $cat_link = get_category_link($cat_id);
135
  if(ampforwp_get_setting('ampforwp-archive-support-cat') == true && ampforwp_get_setting('ampforwp-archive-support') == true){
136
  $cat_link = ampforwp_url_controller( $cat_link );
130
  // Loop through parent categories and store in variable $cat_display
131
  $cat_display = '';
132
  foreach($cat_parents as $parents) {
133
+ $categories = get_the_category();
134
+ $cat_id = $categories[0]->cat_ID;
135
  $cat_link = get_category_link($cat_id);
136
  if(ampforwp_get_setting('ampforwp-archive-support-cat') == true && ampforwp_get_setting('ampforwp-archive-support') == true){
137
  $cat_link = ampforwp_url_controller( $cat_link );
components/gdpr/gdpr.php CHANGED
@@ -249,6 +249,8 @@ function ampforwp_gdpr_css(){
249
  z-index:9999;
250
  display: initial;
251
  position: inherit;
 
 
252
  }
253
  <?php }
254
 
249
  z-index:9999;
250
  display: initial;
251
  position: inherit;
252
+ height:20px;
253
+ width:100%;
254
  }
255
  <?php }
256
 
images/postviews-for-amp.png ADDED
Binary file
includes/features/performance/performance-functions.php CHANGED
@@ -227,6 +227,9 @@ function ampforwp_white_list_selectors($completeContent){
227
  if(ampforwp_get_setting('ampforwp_css_tree_shaking')==1 && ampforwp_get_setting('content-sneak-peek')==1 ){
228
  $white_list[] = '.hide';
229
  }
 
 
 
230
  $white_list = (array)apply_filters('ampforwp_tree_shaking_white_list_selector',$white_list);
231
  $w_l_str = '';
232
  for($i=0;$i<count($white_list);$i++){
227
  if(ampforwp_get_setting('ampforwp_css_tree_shaking')==1 && ampforwp_get_setting('content-sneak-peek')==1 ){
228
  $white_list[] = '.hide';
229
  }
230
+ if(ampforwp_get_setting('ampforwp_css_tree_shaking')==1){
231
+ $white_list[] = '.amp-carousel-img img';
232
+ }
233
  $white_list = (array)apply_filters('ampforwp_tree_shaking_white_list_selector',$white_list);
234
  $w_l_str = '';
235
  for($i=0;$i<count($white_list);$i++){
includes/options/admin-config.php CHANGED
@@ -675,6 +675,18 @@ $extension_listing_array = array(
675
  'store_url'=>'https://accounts.ampforwp.com',
676
  'is_activated'=>(is_plugin_active('polls-for-amp/polls-for-amp.php')? 1 : 2),
677
  ),
 
 
 
 
 
 
 
 
 
 
 
 
678
  array(
679
  'name'=>'Transposh for AMP',
680
  'class'=>'new-ext',
@@ -3009,7 +3021,7 @@ Redux::setSection( $opt_name, array(
3009
  array(
3010
  'id' => 'ampforwp-duplicate-featured-image',
3011
  'type' => 'switch',
3012
- 'title' => esc_html__('Duplicate Featured Image', 'accelerated-mobile-pages'),
3013
  'tooltip-subtitle' => esc_html__('Turn On the support if you want to show the Featured Image if it already exists in post content.', 'accelerated-mobile-pages'),
3014
  'true' => 'true',
3015
  'false' => 'false',
675
  'store_url'=>'https://accounts.ampforwp.com',
676
  'is_activated'=>(is_plugin_active('polls-for-amp/polls-for-amp.php')? 1 : 2),
677
  ),
678
+ array(
679
+ 'name'=>'Post Views for AMP',
680
+ 'class'=>'new-ext',
681
+ 'desc'=>'Add Post Views Support in AMP',
682
+ 'img_src'=>AMPFORWP_IMAGE_DIR . '/postviews-for-amp.png',
683
+ 'price'=>'$29',
684
+ 'url_link'=>'https://ampforwp.com/addons/postviews-for-amp/',
685
+ 'plugin_active_path'=> 'postviews-for-amp/postviews-for-amp.php',
686
+ 'item_name'=>'Post Views for AMP',
687
+ 'store_url'=>'https://accounts.ampforwp.com',
688
+ 'is_activated'=>(is_plugin_active('postviews-for-amp/postviews-for-amp.php')? 1 : 2),
689
+ ),
690
  array(
691
  'name'=>'Transposh for AMP',
692
  'class'=>'new-ext',
3021
  array(
3022
  'id' => 'ampforwp-duplicate-featured-image',
3023
  'type' => 'switch',
3024
+ 'title' => esc_html__('Show Featured Image if already preset in content.', 'accelerated-mobile-pages'),
3025
  'tooltip-subtitle' => esc_html__('Turn On the support if you want to show the Featured Image if it already exists in post content.', 'accelerated-mobile-pages'),
3026
  'true' => 'true',
3027
  'false' => 'false',
includes/thirdparty-compatibility.php CHANGED
@@ -59,15 +59,22 @@ function ampforwp_thirdparty_compatibility(){
59
  if(function_exists('heateor_sss_save_default_options') && false == ampforwp_get_setting('ampforwp-sassy_social-switch') ){
60
  add_filter('heateor_sss_disable_sharing','ampforwp_removing_sassy_social_share');
61
  }
62
- if(function_exists('tbn_theme_setup')){
63
  remove_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 );
64
  }
65
- $yoast_noindex = $yoast_noindex_post = '';
66
- $yoast_noindex = get_option( 'wpseo_titles' );
67
- if(isset($yoast_noindex['noindex-post'])){
68
- $yoast_noindex_post = $yoast_noindex['noindex-post'];
69
  }
70
- if (class_exists('WPSEO_Options') && 'yoast' == ampforwp_get_setting('ampforwp-seo-selection') && $yoast_noindex_post && WPSEO_Meta::get_value( 'meta-robots-noindex', ampforwp_get_the_ID()) != 2) {
 
 
 
 
 
 
 
71
  add_action( 'amp_post_template_head', 'AMPforWP\\AMPVendor\\amp_post_template_add_canonical' );
72
  }elseif (class_exists('WPSEO_Options') && 'yoast' == ampforwp_get_setting('ampforwp-seo-selection') && WPSEO_Meta::get_value( 'meta-robots-noindex', ampforwp_get_the_ID()) == 1) {
73
  add_action( 'amp_post_template_head', 'AMPforWP\\AMPVendor\\amp_post_template_add_canonical' );
59
  if(function_exists('heateor_sss_save_default_options') && false == ampforwp_get_setting('ampforwp-sassy_social-switch') ){
60
  add_filter('heateor_sss_disable_sharing','ampforwp_removing_sassy_social_share');
61
  }
62
+ if(function_exists('defer_parsing_of_js')){
63
  remove_filter( 'clean_url', 'defer_parsing_of_js', 11, 1 );
64
  }
65
+ $yoast_canonical = $yoast_canonical_post = $yoast_canonical_page = '';
66
+ $yoast_canonical = get_option( 'wpseo_titles' );
67
+ if(isset($yoast_canonical['noindex-post'])){
68
+ $yoast_canonical_post = $yoast_canonical['noindex-post'];
69
  }
70
+ if(isset($yoast_canonical['noindex-page'])){
71
+ $yoast_canonical_page = $yoast_canonical['noindex-page'];
72
+ }
73
+ if (class_exists('WPSEO_Options') && 'yoast' == ampforwp_get_setting('ampforwp-seo-selection') && $yoast_canonical_post && $yoast_canonical_page && WPSEO_Meta::get_value( 'meta-robots-noindex', ampforwp_get_the_ID()) != 2) {
74
+ add_action( 'amp_post_template_head', 'AMPforWP\\AMPVendor\\amp_post_template_add_canonical' );
75
+ }elseif(class_exists('WPSEO_Options') && 'yoast' == ampforwp_get_setting('ampforwp-seo-selection') && is_page() && $yoast_canonical_page ){
76
+ add_action( 'amp_post_template_head', 'AMPforWP\\AMPVendor\\amp_post_template_add_canonical' );
77
+ }elseif(class_exists('WPSEO_Options') && 'yoast' == ampforwp_get_setting('ampforwp-seo-selection') && is_single() && $yoast_canonical_post ){
78
  add_action( 'amp_post_template_head', 'AMPforWP\\AMPVendor\\amp_post_template_add_canonical' );
79
  }elseif (class_exists('WPSEO_Options') && 'yoast' == ampforwp_get_setting('ampforwp-seo-selection') && WPSEO_Meta::get_value( 'meta-robots-noindex', ampforwp_get_the_ID()) == 1) {
80
  add_action( 'amp_post_template_head', 'AMPforWP\\AMPVendor\\amp_post_template_add_canonical' );
includes/vendor/amp/includes/amp-post-template-actions.php CHANGED
@@ -22,7 +22,6 @@ if( (class_exists('Yoast\\WP\\SEO\\Integrations\\Front_End_Integration')) ){
22
  add_action( 'amp_post_template_head', 'AMPforWP\\AMPVendor\\amp_post_template_add_canonical' );
23
  add_action( 'amp_post_template_head', 'AMPforWP\\AMPVendor\\amp_post_template_add_title' );
24
  }
25
-
26
  function amp_post_template_add_canonical( $amp_template ) {
27
  ?>
28
  <link rel="canonical" href="<?php echo esc_url( apply_filters('ampforwp_modify_rel_url',$amp_template->get( 'canonical_url' ) ) ); ?>" />
22
  add_action( 'amp_post_template_head', 'AMPforWP\\AMPVendor\\amp_post_template_add_canonical' );
23
  add_action( 'amp_post_template_head', 'AMPforWP\\AMPVendor\\amp_post_template_add_title' );
24
  }
 
25
  function amp_post_template_add_canonical( $amp_template ) {
26
  ?>
27
  <link rel="canonical" href="<?php echo esc_url( apply_filters('ampforwp_modify_rel_url',$amp_template->get( 'canonical_url' ) ) ); ?>" />
includes/vendor/amp/includes/sanitizers/class-amp-blacklist-sanitizer.php CHANGED
@@ -52,7 +52,13 @@ class AMP_Blacklist_Sanitizer extends AMP_Base_Sanitizer {
52
  }
53
  $node->setAttribute('href',$href);
54
  }
55
- $node->setAttribute('href', \ampforwp_findInternalUrl($href));
 
 
 
 
 
 
56
 
57
  }
58
 
@@ -227,7 +233,7 @@ class AMP_Blacklist_Sanitizer extends AMP_Base_Sanitizer {
227
  * For more info check: https://github.com/ahmedkaludi/accelerated-mobile-pages/issues/2556 and https://github.com/ahmedkaludi/accelerated-mobile-pages/issues/2967
228
  */
229
  if( false === $this->contains_any_multibyte($href) ){
230
- if ( false === filter_var( $href, FILTER_VALIDATE_URL )
231
  && ! in_array( $protocol, $special_protocols, true ) ) {
232
  return false;
233
  }
52
  }
53
  $node->setAttribute('href',$href);
54
  }
55
+ if( function_exists('googlesitekit_activate_plugin') ){
56
+ if(strpos($href,'#') !== 0){
57
+ $node->setAttribute('href', \ampforwp_findInternalUrl($href));
58
+ }
59
+ }else{
60
+ $node->setAttribute('href', \ampforwp_findInternalUrl($href));
61
+ }
62
 
63
  }
64
 
233
  * For more info check: https://github.com/ahmedkaludi/accelerated-mobile-pages/issues/2556 and https://github.com/ahmedkaludi/accelerated-mobile-pages/issues/2967
234
  */
235
  if( false === $this->contains_any_multibyte($href) ){
236
+ if ( false === parse_url( $href,PHP_URL_HOST )
237
  && ! in_array( $protocol, $special_protocols, true ) ) {
238
  return false;
239
  }
pagebuilder/modules/video-module.php CHANGED
@@ -14,8 +14,8 @@ $output = '
14
  controls >
15
  <source src="{{video_upload_link}}"
16
  type="video/mp4" />
17
- <source type="{{video_upload_link}}"
18
- src="/video/tokyo.webm">
19
  </amp-video>
20
  {{ifend_condition_video_option_custom}}
21
 
@@ -87,6 +87,7 @@ return array(
87
  'type' =>'text',
88
  'name' =>"video_upload_link",
89
  'label' =>'Video link',
 
90
  'tab' =>'customizer',
91
  'default' =>'',
92
  'content_type'=>'html',
14
  controls >
15
  <source src="{{video_upload_link}}"
16
  type="video/mp4" />
17
+ <source type="video/webm"
18
+ src="{{video_upload_link}}">
19
  </amp-video>
20
  {{ifend_condition_video_option_custom}}
21
 
87
  'type' =>'text',
88
  'name' =>"video_upload_link",
89
  'label' =>'Video link',
90
+ 'helpmessage' => esc_html__('Please make sure to enter https url link.', 'accelerated-mobile-pages'),
91
  'tab' =>'customizer',
92
  'default' =>'',
93
  'content_type'=>'html',
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: mohammed_kaludi, ahmedkaludi, ampforwp
3
  Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin, SEO
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
- Tested up to: 5.4
7
- Stable tag: 1.0.52
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -42,7 +42,6 @@ Bug reports for AMP for WP are [welcomed on GitHub](https://github.com/ahmedkalu
42
  * 3 Pre-built AMP Layouts for Business websites and landing pages
43
  * OneSignal Push Notifications integration
44
  * Advanced WooCommerce Support [More Info](https://ampforwp.com/woocommerce/)
45
- * Gravity Forms Support [More Info](https://ampforwp.com/gravity-forms/)
46
  * AMP Plugins Manager - Which allows you to disable a specific plugin functionality only in the AMP version
47
  * Structured Data Options
48
  * Page Break / NextPage (Pagination) Support
@@ -191,6 +190,30 @@ You can contact us from [here](https://ampforwp.com/contact/)
191
 
192
  == Changelog ==
193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  = 1.0.52 (27th May 2020) =
195
  * Fixed: Reverted the CDN code of WP Rocket plugin which was causing the malformed url issue #4342
196
 
@@ -207,21 +230,5 @@ You can contact us from [here](https://ampforwp.com/contact/)
207
  * Fixed: Custom taxonomy archive not working LSVR Knowledge Base #4478
208
  * Fixed: Debug Notice trying to access array offset on value of type bool #4469
209
 
210
- = 1.0.50 (20th May 2020) =
211
- * Improvement: Added option to display the GDPR bar at top or bottom #4409
212
- * Improvement: Added option to enable/disable the AMP from the categories or product or any custom taxonomy #4326
213
- * Improvement: Added Hooks in Instant Article #4417
214
- * Improvement: Added Polls for AMP Extension #4451
215
- * Fixed: View Non-AMP link in the footer does not redirect to Non-AMP #3884
216
- * Fixed: Banner notice not looking good in reading settings #4414
217
- * Fixed: Lightbox for images appearing even after disabling #4442
218
- * Fixed: Last modified date showing wrong in header #4456
219
- * Fixed: WPRocket CDN is not working properly in the AMP pages #4342
220
- * Fixed: Lighthouse issues #4443
221
- * Fixed: Thumbnail images in category module not showing in RTL #4459
222
- * Fixed: Blank screen when alt added in images with short pixel plugin #4452
223
- * Fixed: invalid value defer onload with The Business News theme #4465
224
- * Fixed: Text links are not working in mobile #4462
225
- * Fixed: PHP Notice Undefined variable thumb_alt #4460
226
 
227
  Full changelog available [ at changelog.txt](https://plugins.svn.wordpress.org/accelerated-mobile-pages/trunk/changelog.txt)
3
  Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin, SEO
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
+ Tested up to: 5.4.2
7
+ Stable tag: 1.0.53.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
42
  * 3 Pre-built AMP Layouts for Business websites and landing pages
43
  * OneSignal Push Notifications integration
44
  * Advanced WooCommerce Support [More Info](https://ampforwp.com/woocommerce/)
 
45
  * AMP Plugins Manager - Which allows you to disable a specific plugin functionality only in the AMP version
46
  * Structured Data Options
47
  * Page Break / NextPage (Pagination) Support
190
 
191
  == Changelog ==
192
 
193
+ = 1.0.53.2 (21st June 2020) =
194
+ * Fixed: Minor Bug
195
+
196
+ = 1.0.53 (19th June 2020) =
197
+ * Improvement: Need to implement YOAST breadcrumb for the category and the tags pages #4493
198
+ * Improvement: Added new set of hooks in all designs #4550
199
+ * Improvement: Added PostViews for AMP Extension #4549
200
+ * Improvement: Created an extra argument to pass for amp_author_box function so author links can be controlled #4466
201
+ * Fixed: Meta description tag is missing in AMP, when custom home page is selected. #4521
202
+ * Fixed: The attribute 'src' in tag 'amp-form extension .js script' is set to the invalid value'. #4515
203
+ * Fixed: The tag 'link rel=canonical' appears more than once in the document due to Yoast SEO premium plugin. #4511
204
+ * Fixed: Getting warnings due to Yoast SEO plugin. #4510
205
+ * Fixed: Issue with Image block of Gutenberg #4507
206
+ * Fixed: Gallery images(Gutenberg editor) are stretched when the Optimize CSS option is enabled. #4502
207
+ * Fixed: If category label has backslash in the name breadcrumbs break #4500
208
+ * Fixed: Vertical scroll Issue in iOS devices when the 'menu overlay' is positioned in right. #4461
209
+ * Fixed: WPRocket CDN is not working properly with the amp pages. #4342
210
+ * Fixed: When gdpr option is enabled the site is becoming unclickable in browser Safari on IOS and MacOS #4542
211
+ * Fixed: Unused HTML was showing in Video Module #4524
212
+ * Fixed: Getting validation error as "The attribute '"_blank"' may not appear in tag 'a' with RankMath #4527
213
+ * Fixed: Anchor tag is stripping in AMP with Sitekit By Google plugin is active #4552
214
+ * Fixed: Date styling not looking good in Design 3 archive pages #4557
215
+ * Fixed: Debug warning #4555
216
+
217
  = 1.0.52 (27th May 2020) =
218
  * Fixed: Reverted the CDN code of WP Rocket plugin which was causing the malformed url issue #4342
219
 
230
  * Fixed: Custom taxonomy archive not working LSVR Knowledge Base #4478
231
  * Fixed: Debug Notice trying to access array offset on value of type bool #4469
232
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
233
 
234
  Full changelog available [ at changelog.txt](https://plugins.svn.wordpress.org/accelerated-mobile-pages/trunk/changelog.txt)
templates/design-manager/design-1/elements/bread-crumbs.php CHANGED
@@ -130,7 +130,8 @@ if ( ( (is_single() && 1 == ampforwp_get_setting('ampforwp-bread-crumb')) || (is
130
  // Loop through parent categories and store in variable $cat_display
131
  $cat_display = '';
132
  foreach($cat_parents as $parents) {
133
- $cat_id = get_cat_ID( $parents);
 
134
  $cat_link = get_category_link($cat_id);
135
  if(ampforwp_get_setting('ampforwp-archive-support-cat') == true && ampforwp_get_setting('ampforwp-archive-support') == true){
136
  $cat_link = ampforwp_url_controller( $cat_link );
130
  // Loop through parent categories and store in variable $cat_display
131
  $cat_display = '';
132
  foreach($cat_parents as $parents) {
133
+ $categories = get_the_category();
134
+ $cat_id = $categories[0]->cat_ID;
135
  $cat_link = get_category_link($cat_id);
136
  if(ampforwp_get_setting('ampforwp-archive-support-cat') == true && ampforwp_get_setting('ampforwp-archive-support') == true){
137
  $cat_link = ampforwp_url_controller( $cat_link );
templates/design-manager/design-1/elements/meta-info.php CHANGED
@@ -46,6 +46,7 @@ if ( is_single() || (is_page() && $redux_builder_amp['meta_page']) ) : ?>
46
  echo esc_attr(apply_filters('ampforwp_modify_post_date', ampforwp_translation($redux_builder_amp['amp-translator-on-text'], 'On') . ' ' . $date ));
47
  }?>
48
  </time>
 
49
  </div>
50
 
51
  </div>
46
  echo esc_attr(apply_filters('ampforwp_modify_post_date', ampforwp_translation($redux_builder_amp['amp-translator-on-text'], 'On') . ' ' . $date ));
47
  }?>
48
  </time>
49
+ <?php do_action('ampforwp_post_views_ct'); ?>
50
  </div>
51
 
52
  </div>
templates/design-manager/design-2/elements/bread-crumbs.php CHANGED
@@ -128,7 +128,8 @@ if ( ( (is_single() && 1 == ampforwp_get_setting('ampforwp-bread-crumb')) || (is
128
  // Loop through parent categories and store in variable $cat_display
129
  $cat_display = '';
130
  foreach($cat_parents as $parents) {
131
- $cat_id = get_cat_ID( $parents);
 
132
  $cat_link = get_category_link($cat_id);
133
  if(ampforwp_get_setting('ampforwp-archive-support-cat') == true && ampforwp_get_setting('ampforwp-archive-support') == true){
134
  $cat_link = ampforwp_url_controller( $cat_link );
128
  // Loop through parent categories and store in variable $cat_display
129
  $cat_display = '';
130
  foreach($cat_parents as $parents) {
131
+ $categories = get_the_category();
132
+ $cat_id = $categories[0]->cat_ID;
133
  $cat_link = get_category_link($cat_id);
134
  if(ampforwp_get_setting('ampforwp-archive-support-cat') == true && ampforwp_get_setting('ampforwp-archive-support') == true){
135
  $cat_link = ampforwp_url_controller( $cat_link );
templates/design-manager/design-2/elements/meta-info.php CHANGED
@@ -29,6 +29,7 @@ if ( is_single() || (is_page() && $redux_builder_amp['meta_page']) ) : ?>
29
  }
30
  echo esc_attr(apply_filters('ampforwp_modify_post_date', ampforwp_translation($redux_builder_amp['amp-translator-on-text'], 'On') . ' ' . $date )) ?></li>
31
  <?php } ?>
 
32
  </div>
33
  <?php endif; ?>
34
 
29
  }
30
  echo esc_attr(apply_filters('ampforwp_modify_post_date', ampforwp_translation($redux_builder_amp['amp-translator-on-text'], 'On') . ' ' . $date )) ?></li>
31
  <?php } ?>
32
+ <?php do_action('ampforwp_post_views'); ?>
33
  </div>
34
  <?php endif; ?>
35
 
templates/design-manager/design-3/elements/bread-crumbs.php CHANGED
@@ -127,7 +127,8 @@ if ( ( (is_single() && 1 == ampforwp_get_setting('ampforwp-bread-crumb')) || (is
127
  // Loop through parent categories and store in variable $cat_display
128
  $cat_display = '';
129
  foreach($cat_parents as $parents) {
130
- $cat_id = get_cat_ID( $parents);
 
131
  $cat_link = get_category_link($cat_id);
132
  if(ampforwp_get_setting('ampforwp-archive-support-cat') == true && ampforwp_get_setting('ampforwp-archive-support') == true){
133
  $cat_link = ampforwp_url_controller( $cat_link );
127
  // Loop through parent categories and store in variable $cat_display
128
  $cat_display = '';
129
  foreach($cat_parents as $parents) {
130
+ $categories = get_the_category();
131
+ $cat_id = $categories[0]->cat_ID;
132
  $cat_link = get_category_link($cat_id);
133
  if(ampforwp_get_setting('ampforwp-archive-support-cat') == true && ampforwp_get_setting('ampforwp-archive-support') == true){
134
  $cat_link = ampforwp_url_controller( $cat_link );
templates/design-manager/design-3/elements/meta-info.php CHANGED
@@ -33,7 +33,8 @@ if( isset($redux_builder_amp['ampforwp-cats-single']) && $redux_builder_amp['amp
33
  if( true == ampforwp_get_setting('ampforwp-archive-support') && true == ampforwp_get_setting('ampforwp-archive-support-cat')){
34
  $cat_link = ampforwp_url_controller(get_category_link( $cat->term_id ));
35
  }
36
- echo ('<span class="amp-cat-'.esc_attr($cat->term_id).'"><a href="'.esc_url($cat_link). '" >'. esc_html($cat->name) .'</a></span>');
 
37
  }else{
38
  echo '<span class="amp-cat">'. esc_html($cat->name) .'</span>';
39
  }
33
  if( true == ampforwp_get_setting('ampforwp-archive-support') && true == ampforwp_get_setting('ampforwp-archive-support-cat')){
34
  $cat_link = ampforwp_url_controller(get_category_link( $cat->term_id ));
35
  }
36
+ echo ('<span class="amp-cat-'.esc_attr($cat->term_id).'"><a href="'.esc_url($cat_link). '" >'. esc_html($cat->name) .'</a></span>');
37
+ do_action('ampforwp_post_views_ct');
38
  }else{
39
  echo '<span class="amp-cat">'. esc_html($cat->name) .'</span>';
40
  }
templates/design-manager/design-3/style.php CHANGED
@@ -32,8 +32,9 @@ if ( ! defined( 'ABSPATH' ) ) {
32
  $icon_url = plugin_dir_url('accelerated-mobile-pages/accelerated-moblie-pages.php').'templates/design-manager/'.esc_attr($design).'/';
33
  }
34
  $icon_url = ampforwp_font_url($icon_url);
35
- ?>
36
-
 
37
  /* Global Styling */
38
  body{
39
  font-size: 16px;
@@ -554,6 +555,7 @@ amp-lightbox{ background: rgba(0, 0, 0,0.85); }
554
  .archives_body main{ margin-top:20px }
555
  .taxonomy-description p{margin-top: 5px;font-size: 14px;line-height: 1.5;}
556
  .amp-sub-archives li{width: 50%;} .amp-sub-archives ul{padding: 0;list-style: none;display: flex;font-size: 12px;line-height: 1.2;margin: 5px 0 10px 0px;} .author-img amp-img{border-radius: 50%;margin: 0px 12px 10px 0px;display: block; width:50px;}.author-img{float: left;padding-bottom: 25px;}
 
557
  <?php if ( ampforwp_is_home() || ampforwp_is_blog() ) {?>
558
  /* AMP carousel */
559
  .amp-carousel-button-prev, .amp-carousel-button-next{ top:30px;border-radius:60px; }
@@ -566,7 +568,6 @@ amp-lightbox{ background: rgba(0, 0, 0,0.85); }
566
  .featured_meta{ color:#575757; font-size:12px; margin:0 15px; }
567
  .featured_meta_left{ float:left }
568
  .featured_meta_right{ float:right }
569
- .featured_time{ font-size: 12px; color: #fff; opacity: 0.8; padding-left: 20px;}
570
  <?php }
571
  if( !ampforwp_woocommerce_conditional_check() ) {
572
  if ( is_singular() || is_home() && $redux_builder_amp['amp-frontpage-select-option'] && ampforwp_get_blog_details() == false ) { ?>
32
  $icon_url = plugin_dir_url('accelerated-mobile-pages/accelerated-moblie-pages.php').'templates/design-manager/'.esc_attr($design).'/';
33
  }
34
  $icon_url = ampforwp_font_url($icon_url);
35
+ if ( is_user_logged_in() ) {?>
36
+ #wpadminbar ~ main { margin-top:52px } <?php
37
+ }?>
38
  /* Global Styling */
39
  body{
40
  font-size: 16px;
555
  .archives_body main{ margin-top:20px }
556
  .taxonomy-description p{margin-top: 5px;font-size: 14px;line-height: 1.5;}
557
  .amp-sub-archives li{width: 50%;} .amp-sub-archives ul{padding: 0;list-style: none;display: flex;font-size: 12px;line-height: 1.2;margin: 5px 0 10px 0px;} .author-img amp-img{border-radius: 50%;margin: 0px 12px 10px 0px;display: block; width:50px;}.author-img{float: left;padding-bottom: 25px;}
558
+ .featured_time{ font-size: 12px; color: #fff; opacity: 0.8; padding-left: 20px;}
559
  <?php if ( ampforwp_is_home() || ampforwp_is_blog() ) {?>
560
  /* AMP carousel */
561
  .amp-carousel-button-prev, .amp-carousel-button-next{ top:30px;border-radius:60px; }
568
  .featured_meta{ color:#575757; font-size:12px; margin:0 15px; }
569
  .featured_meta_left{ float:left }
570
  .featured_meta_right{ float:right }
 
571
  <?php }
572
  if( !ampforwp_woocommerce_conditional_check() ) {
573
  if ( is_singular() || is_home() && $redux_builder_amp['amp-frontpage-select-option'] && ampforwp_get_blog_details() == false ) { ?>
templates/design-manager/swift/archive.php CHANGED
@@ -5,6 +5,9 @@ if ( ! defined( 'ABSPATH' ) ) {
5
  global $redux_builder_amp;
6
  amp_header() ?>
7
  <div class="cntr archive">
 
 
 
8
  <div class="arch-tlt">
9
  <?php amp_archive_title(); ?>
10
  </div>
5
  global $redux_builder_amp;
6
  amp_header() ?>
7
  <div class="cntr archive">
8
+ <?php if(true == ampforwp_get_setting('ampforwp-yoast-bread-crumb')){
9
+ echo ampforwp_yoast_breadcrumbs_output();
10
+ }?>
11
  <div class="arch-tlt">
12
  <?php amp_archive_title(); ?>
13
  </div>
templates/design-manager/swift/single.php CHANGED
@@ -102,7 +102,7 @@ global $redux_builder_amp; ?>
102
  <div class="post-date">
103
  <?php amp_date(); ?><?php edit_post_link(); ?>
104
  </div>
105
-
106
  <?php }
107
  if ( ampforwp_get_setting('rp_design_type') == '1' && true == ampforwp_get_setting('ampforwp-single-related-posts-switch')) {
108
  $my_query = ampforwp_related_post_loop_query();
102
  <div class="post-date">
103
  <?php amp_date(); ?><?php edit_post_link(); ?>
104
  </div>
105
+ <?php do_action('ampforwp_post_views_ctr'); ?>
106
  <?php }
107
  if ( ampforwp_get_setting('rp_design_type') == '1' && true == ampforwp_get_setting('ampforwp-single-related-posts-switch')) {
108
  $my_query = ampforwp_related_post_loop_query();
templates/design-manager/swift/style.php CHANGED
@@ -2111,7 +2111,7 @@ if (ampforwp_get_setting('enable-amp-ads-resp-6')){?>
2111
  .amp_mod.text-mod p {margin: 0 0 1.5em;}
2112
  <?php } ?>
2113
  <?php //Breadcrumbs
2114
- if( !checkAMPforPageBuilderStatus(ampforwp_get_the_ID()) && ( (is_single() && true == ampforwp_get_setting('ampforwp-bread-crumb')) || (is_page() && ampforwp_get_setting('ampforwp_pages_breadcrumbs')) )) {?>
2115
  .breadcrumbs{padding-bottom: 8px;margin-bottom: 20px;
2116
  <?php if( true == ampforwp_get_setting('breadcrumb-border') ) {?>
2117
  border-bottom: 1px solid #eee;
@@ -2128,6 +2128,7 @@ if ( $ampforwp_font_icon == 'fontawesome-icons' ){ ?>
2128
  <?php } ?>
2129
  display: inline-block;color: #bdbdbd;padding-left: 5px;position: relative;top: 1px;}
2130
  .breadcrumbs li:last-child a:after {display: none;}
 
2131
  <?php } //Breadcrumbs Ends?>
2132
  <?php if(true == ampforwp_get_setting('ampforwp-smooth-scrolling-for-links')){?>
2133
  html {
@@ -2447,4 +2448,16 @@ a.bread-link.bread-home::after {
2447
  border: 1px solid #fff;
2448
  }
2449
  }
 
 
 
 
 
 
 
 
 
 
 
 
2450
  <?php }
2111
  .amp_mod.text-mod p {margin: 0 0 1.5em;}
2112
  <?php } ?>
2113
  <?php //Breadcrumbs
2114
+ if( !checkAMPforPageBuilderStatus(ampforwp_get_the_ID()) && ( (is_single() && true == ampforwp_get_setting('ampforwp-bread-crumb')) || (is_page() && ampforwp_get_setting('ampforwp_pages_breadcrumbs'))) || (is_archive() && true == ampforwp_get_setting('ampforwp-yoast-bread-crumb') ) ) {?>
2115
  .breadcrumbs{padding-bottom: 8px;margin-bottom: 20px;
2116
  <?php if( true == ampforwp_get_setting('breadcrumb-border') ) {?>
2117
  border-bottom: 1px solid #eee;
2128
  <?php } ?>
2129
  display: inline-block;color: #bdbdbd;padding-left: 5px;position: relative;top: 1px;}
2130
  .breadcrumbs li:last-child a:after {display: none;}
2131
+ .archive .breadcrumbs {margin-top: 20px;}
2132
  <?php } //Breadcrumbs Ends?>
2133
  <?php if(true == ampforwp_get_setting('ampforwp-smooth-scrolling-for-links')){?>
2134
  html {
2448
  border: 1px solid #fff;
2449
  }
2450
  }
2451
+ <?php }
2452
+ if(ampforwp_get_setting('header-position-type') == '2'){?>
2453
+ @supports (-webkit-touch-callout: none) {
2454
+ .tg + .hamb-mnu {
2455
+ position:relative;
2456
+ overflow:hidden;
2457
+ }
2458
+ .tg:checked + .hamb-mnu {
2459
+ overflow: scroll;
2460
+ position: inherit;
2461
+ }
2462
+ }
2463
  <?php }
templates/features.php CHANGED
@@ -1422,7 +1422,9 @@ function ampforwp_add_proper_post_meta(){
1422
  // og url
1423
  add_filter('wpseo_opengraph_url', 'ampforwp_custom_og_url_homepage');
1424
  // This is causing the 2nd debug issue reported in #740
1425
- add_action('wpseo_twitter', 'ampforwp_custom_twitter_image_homepage');
 
 
1426
  add_action('wpseo_add_opengraph_images', 'ampforwp_custom_og_image_homepage');
1427
  }
1428
  }
@@ -1693,11 +1695,12 @@ function ampforwp_replace_title_tags() {
1693
  $yoast_instance = new \Yoast\WP\SEO\Presentations\Indexable_Presentation();
1694
  }
1695
 
1696
-
1697
- $WPSEO_Frontend = WPSEO_Frontend::get_instance();
1698
- $yoast_title = $WPSEO_Frontend->title($site_title);
1699
- if ( ampforwp_is_home() ) {
1700
- $yoast_title = $WPSEO_Frontend->get_title_from_options( 'title-home-wpseo' );
 
1701
  }
1702
  // Custom Front Page Title From Yoast SEO #1163
1703
  if ( ampforwp_is_front_page() || ampforwp_is_blog() ) {
@@ -3225,6 +3228,13 @@ function ampforwp_meta_description() {
3225
  echo '<meta name="description" content="'. esc_attr( convert_chars( stripslashes( $desc ) ) ) .'"/>';
3226
  }else if(class_exists('Yoast\\WP\\SEO\\Integrations\\Front_End_Integration')){
3227
  $yoast_desc = addslashes( strip_tags( WPSEO_Meta::get_value('metadesc', ampforwp_get_the_ID() ) ) );
 
 
 
 
 
 
 
3228
  if ($yoast_desc && ampforwp_is_front_page()) {
3229
  echo '<meta name="description" content="'. esc_attr( convert_chars( stripslashes( $yoast_desc ) ) ) .'"/>';
3230
  }
@@ -7204,6 +7214,9 @@ function ampforwp_yoast_breadcrumbs_output(){
7204
  $breadcrumb = '';
7205
  if ( true == ampforwp_get_setting('ampforwp-yoast-bread-crumb') && true === WPSEO_Options::get( 'breadcrumbs-enable' ) && function_exists('yoast_breadcrumb')) {
7206
  $breadcrumb = yoast_breadcrumb('','', false);
 
 
 
7207
  return $breadcrumb;
7208
  }
7209
  }
@@ -7790,7 +7803,27 @@ if( ! function_exists('ampforwp_font_selector') ) {
7790
  return sanitize_text_field($fontFamily);
7791
  }
7792
  }
7793
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7794
  // Font URL controller
7795
  if ( ! function_exists('ampforwp_font_url') ) {
7796
  function ampforwp_font_url($font_url){
@@ -7978,7 +8011,6 @@ function ampforwp_remove_unwanted_code($content){
7978
  // close #4206
7979
  return $content;
7980
  }
7981
-
7982
  add_filter('ampforwp_the_content_last_filter','ampforwp_include_required_scripts',12);
7983
  function ampforwp_include_required_scripts($content){
7984
  $comp_to_remove_arr = array();
@@ -8199,6 +8231,7 @@ if(!function_exists('ampforwp_add_fallback_element')){
8199
  $m_content = $matches[1][$i];
8200
  $m_content = ampforwp_imagify_webp_compatibility($m_content);
8201
  $m_content = ampforwp_ewww_webp_compatibility($m_content);
 
8202
  $m1_content = ampforwp_set_default_fallback_image($matches[1][$i]);
8203
  preg_match_all('/src="(.*?)"/', $m1_content,$fimgsrc);
8204
  preg_match_all('/width="(.*?)"/', $m1_content,$fimgwidth);
@@ -8233,6 +8266,7 @@ if(!function_exists('ampforwp_add_fallback_element')){
8233
  $m1_content = str_replace($swidth, $width_rep, $m1_content);
8234
  $m1_content = str_replace($sheight, $height_rep, $m1_content);
8235
  $m1_content = str_replace($salt, $alt_rep, $m1_content);
 
8236
  $fallback_img = "<amp-img ".$m_content."<amp-img fallback ".$m1_content."</amp-img></amp-img>";//$m_content, $m1_content escaped above.
8237
  $content = str_replace("$match", $fallback_img, $content);
8238
  }
@@ -8368,14 +8402,24 @@ if(class_exists('RankMath')){
8368
  function ampforwp_rank_math_external_link_newtab($content){
8369
  $rank_math_external_link = RankMath\Helper::get_settings( 'general.new_window_external_links' );
8370
  if($rank_math_external_link){
8371
- preg_match_all('/<a href="(.*?)">(.*?)<\/a>/', $content, $matches);
8372
- for($i=0;$i<count($matches[1]);$i++){
8373
- $url = $matches[1][$i];
8374
- $is_external = ampforwp_isexternal($url);
 
 
 
 
8375
  if($is_external){
8376
- $content = preg_replace('/<a href="(.*?)">(.*?)<\/a>/', '<a href="$1" target="_blank">$2</a>', $content);
 
 
 
 
 
 
8377
  }
8378
- }
8379
  }
8380
  return $content;
8381
  }
@@ -8540,3 +8584,56 @@ function ampforwp_extra_category_fields( $tag ) {
8540
  </tr>
8541
  <?php
8542
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1422
  // og url
1423
  add_filter('wpseo_opengraph_url', 'ampforwp_custom_og_url_homepage');
1424
  // This is causing the 2nd debug issue reported in #740
1425
+ if ( !class_exists('Yoast\\WP\\SEO\\Integrations\\Front_End_Integration')) {
1426
+ add_action('wpseo_twitter', 'ampforwp_custom_twitter_image_homepage');
1427
+ }
1428
  add_action('wpseo_add_opengraph_images', 'ampforwp_custom_og_image_homepage');
1429
  }
1430
  }
1695
  $yoast_instance = new \Yoast\WP\SEO\Presentations\Indexable_Presentation();
1696
  }
1697
 
1698
+ if ( !class_exists('Yoast\\WP\\SEO\\Integrations\\Front_End_Integration')) {
1699
+ $WPSEO_Frontend = WPSEO_Frontend::get_instance();
1700
+ $yoast_title = $WPSEO_Frontend->title($site_title);
1701
+ if ( ampforwp_is_home() ) {
1702
+ $yoast_title = $WPSEO_Frontend->get_title_from_options( 'title-home-wpseo' );
1703
+ }
1704
  }
1705
  // Custom Front Page Title From Yoast SEO #1163
1706
  if ( ampforwp_is_front_page() || ampforwp_is_blog() ) {
3228
  echo '<meta name="description" content="'. esc_attr( convert_chars( stripslashes( $desc ) ) ) .'"/>';
3229
  }else if(class_exists('Yoast\\WP\\SEO\\Integrations\\Front_End_Integration')){
3230
  $yoast_desc = addslashes( strip_tags( WPSEO_Meta::get_value('metadesc', ampforwp_get_the_ID() ) ) );
3231
+ $yoast_desc_meta = get_option( 'wpseo_titles' );
3232
+ if(isset($yoast_desc_meta['metadesc-page'])){
3233
+ $yoast_desc_meta = $yoast_desc_meta['metadesc-page'];
3234
+ }
3235
+ if(empty($yoast_desc)){
3236
+ $yoast_desc = $yoast_desc_meta;
3237
+ }
3238
  if ($yoast_desc && ampforwp_is_front_page()) {
3239
  echo '<meta name="description" content="'. esc_attr( convert_chars( stripslashes( $yoast_desc ) ) ) .'"/>';
3240
  }
7214
  $breadcrumb = '';
7215
  if ( true == ampforwp_get_setting('ampforwp-yoast-bread-crumb') && true === WPSEO_Options::get( 'breadcrumbs-enable' ) && function_exists('yoast_breadcrumb')) {
7216
  $breadcrumb = yoast_breadcrumb('','', false);
7217
+ if(true == ampforwp_get_setting('ampforwp-archive-support')){
7218
+ $breadcrumb = preg_replace('/<div class="breadcrumbs">(.*?)<a href="(.*?)">(.*?)<\/a>(.*?)<a href="(.*?)"(.*?)<\/span><\/div>/', '<div class="breadcrumbs">$1<a href="$2amp">$3</a>$4<a href="$5amp"$6</span></div>', $breadcrumb);
7219
+ }
7220
  return $breadcrumb;
7221
  }
7222
  }
7803
  return sanitize_text_field($fontFamily);
7804
  }
7805
  }
7806
+ if(class_exists('WPSEO_Options')){
7807
+ add_filter('ampforwp_the_content_last_filter','ampforwp_remove_duplicate_canonical',25);
7808
+ }
7809
+ function ampforwp_remove_duplicate_canonical($content){
7810
+ $comp_dom = new DOMDocument();
7811
+ @$comp_dom->loadHTML($content);
7812
+ $xpath = new DOMXPath( $comp_dom );
7813
+ $count = 0;
7814
+ $nodes = $xpath->query('//link[@rel="canonical"]');
7815
+ $con = '';
7816
+ foreach ($nodes as $node) {
7817
+ $count++;
7818
+ }
7819
+ if($count>1){
7820
+ if(preg_match("/<link\b[^>]*?\brel=[\'\"]canonical[\'\"][^>]*>/", $content, $matches, PREG_OFFSET_CAPTURE)){
7821
+ $content = preg_replace("/<link\b[^>]*?\brel=[\'\"]canonical[\'\"][^>]*>/", "", $content);
7822
+ $content = substr_replace($content, $matches[0][0], $matches[0][1], 0);
7823
+ }
7824
+ }
7825
+ return $content;
7826
+ }
7827
  // Font URL controller
7828
  if ( ! function_exists('ampforwp_font_url') ) {
7829
  function ampforwp_font_url($font_url){
8011
  // close #4206
8012
  return $content;
8013
  }
 
8014
  add_filter('ampforwp_the_content_last_filter','ampforwp_include_required_scripts',12);
8015
  function ampforwp_include_required_scripts($content){
8016
  $comp_to_remove_arr = array();
8231
  $m_content = $matches[1][$i];
8232
  $m_content = ampforwp_imagify_webp_compatibility($m_content);
8233
  $m_content = ampforwp_ewww_webp_compatibility($m_content);
8234
+
8235
  $m1_content = ampforwp_set_default_fallback_image($matches[1][$i]);
8236
  preg_match_all('/src="(.*?)"/', $m1_content,$fimgsrc);
8237
  preg_match_all('/width="(.*?)"/', $m1_content,$fimgwidth);
8266
  $m1_content = str_replace($swidth, $width_rep, $m1_content);
8267
  $m1_content = str_replace($sheight, $height_rep, $m1_content);
8268
  $m1_content = str_replace($salt, $alt_rep, $m1_content);
8269
+ $m1_content = preg_replace('/srcset="(.*?)"/', '', $m1_content);
8270
  $fallback_img = "<amp-img ".$m_content."<amp-img fallback ".$m1_content."</amp-img></amp-img>";//$m_content, $m1_content escaped above.
8271
  $content = str_replace("$match", $fallback_img, $content);
8272
  }
8402
  function ampforwp_rank_math_external_link_newtab($content){
8403
  $rank_math_external_link = RankMath\Helper::get_settings( 'general.new_window_external_links' );
8404
  if($rank_math_external_link){
8405
+ $comp_dom = new DOMDocument();
8406
+ @$comp_dom->loadHTML($content);
8407
+ $xpath = new DOMXPath( $comp_dom );
8408
+ $count = 0;
8409
+ $nodes = $xpath->query('//a[@href]');
8410
+ foreach ($nodes as $node) {
8411
+ $url = $node->getAttribute('href');
8412
+ $is_external = ampforwp_isexternal($url);
8413
  if($is_external){
8414
+ if(!$node->hasAttribute('target')){
8415
+ $node->setAttribute('target','_blank');
8416
+ $new_node = $comp_dom->saveHTML($node);
8417
+ if(preg_match('/<a\b[^>]*?\bhref=[\'\"]'.preg_quote($url,'/').'[\'\"][^>]*>/', $content, $matches)){
8418
+ $content = preg_replace('/<a\b[^>]*?\bhref=[\'\"]'.preg_quote($url,'/').'[\'\"][^>]*>/', $new_node, $content);
8419
+ }
8420
+ }
8421
  }
8422
+ }
8423
  }
8424
  return $content;
8425
  }
8584
  </tr>
8585
  <?php
8586
  }
8587
+ if(function_exists('rocket_activation')){
8588
+ add_filter("ampforwp_the_content_last_filter",'ampforwp_wp_rocket_compatibility',25);
8589
+ }
8590
+ function ampforwp_wp_rocket_compatibility($content){
8591
+ $cdn_url = get_option('wp_rocket_settings');
8592
+ if($cdn_url['cdn'] == 1){
8593
+ $img_cdn_url = '';
8594
+ $cnds_arr = array();
8595
+ if(!empty($cdn_url['cdn_zone']) && !empty($cdn_url['cdn_cnames'])){
8596
+ foreach ($cdn_url['cdn_zone'] as $key => $element) {
8597
+ if(isset($cdn_url['cdn_cnames'][$key]) && $cdn_url['cdn_cnames'][$key]!=''){
8598
+ $cnds_arr[$element] = $cdn_url['cdn_cnames'][$key];
8599
+ }
8600
+ }
8601
+ }
8602
+ if(isset($cnds_arr['images'])){
8603
+ $img_cdn_url = $cnds_arr['images'];
8604
+ }else if(isset($cnds_arr['all'])){
8605
+ $img_cdn_url = $cnds_arr['all'];
8606
+ }
8607
+ if($img_cdn_url!=''){
8608
+ $parse_url = parse_url($img_cdn_url);
8609
+ if(!isset($parse_url['scheme'])){
8610
+ if(!preg_match('/\/\//', $img_cdn_url)){
8611
+ $img_cdn_url = '//'.$img_cdn_url;
8612
+ }
8613
+ }
8614
+ $comp_dom = new DOMDocument();
8615
+ @$comp_dom->loadHTML($content);
8616
+ $xpath = new DOMXPath( $comp_dom );
8617
+ $nodes = $xpath->query('//amp-img[@src]');
8618
+ $home_url = home_url();
8619
+ foreach ($nodes as $node) {
8620
+ $url = $node->getAttribute('src');
8621
+ $srcset = $node->getAttribute('srcset');
8622
+ $is_external = ampforwp_isexternal($url);
8623
+ if(!$is_external && !$node->hasAttribute('fallback')){
8624
+ $img_src = str_replace($home_url, $img_cdn_url, $url);
8625
+ $content = str_replace($url, $img_src, $content);
8626
+ $srcset_arr = explode(",", $srcset);
8627
+ for($i=0;$i<count($srcset_arr);$i++){
8628
+ $original = $srcset_arr[$i];
8629
+ $new = str_replace($home_url, $img_cdn_url, $original);
8630
+ if(preg_match('/'.preg_quote($original,'/').'/', $content)){
8631
+ $content = preg_replace('/'.preg_quote($original,'/').'/', $new, $content);
8632
+ }
8633
+ }
8634
+ }
8635
+ }
8636
+ }
8637
+ }
8638
+ return $content;
8639
+ }