AMP for WP – Accelerated Mobile Pages - Version 0.9.97.59

Version Description

(21th June 2019) = * Improvements: WP Recipe Maker & WP Recipe Maker PRO Schema compatibility added #3043 * Improvements: Impreza Theme's lazyLoad Option compatibility integrated #3259 * Improvements: WordPress Content Gallery integrated with Design - 1,2 & 3 #3255 * Improvements: amp-recaptcha-input support added in allowed tag sanitizer #3315 * Improvements: Yoast 11.4 Schema Compatibility #3332 * Improvements: Google Tag Manager Advanced Option integrated #2660 * Fixed: Disqus comments are not loading in the multilingual slug #3106 * Fixed: Incorrect escaping done on author name when Link to Author Pages is enabled along with the Co-Authors plugin activate [ Theme-Swift ] #3162 * Fixed: AMP Panel options code improved #2517 * Fixed: License key code improved #2528 * Fixed: When site url is different from home url #2881 * Fixed: Related Posts Design is coming in all the single page designs in AMP Layouts #3091 * Fixed: CM Tooltip Glossary custom post types are not working with /amp #2882 * Fixed: Variables replacing in Advanced Google Analytics config code don't work #3237 * Fixed: "Optimize For Viewability" option for Ads improved #3142 * Fixed: Advertisement section Ads are not working through Google search result #2693 * Fixed: When AMP takeover and yoast seo is activated,AMP page builder is not working #3292 * Fixed: link="next" is appearing in the custom front page #3266 * Fixed: 404 error when custom post type and page having same slug [Bug for the Rare use case] #2374 * Fixed: Code improved for attribute layout=responsive in amp-img #3248 * Fixed: Gallery Lightbox feature code improved #3184 * Fixed: Elementor stops working when AMP Take Over is enabled #3284 * Fixed: Activating Thrive lead plugin AMP Page builder doesn't work on the custom front page #3312 * Fixed: To many redirection issue with hidden post in IOS #3287 * Fixed: Gallery with GIF is not working #3304 * Fixed: Indexing Issue of Plugin File #3271 * Fixed: Post/page throwing an error on hiding AMP for that particular post/page if AMP takeover option is enabled. #3329 * Fixed: Addthis Sharing default option code improved #3327 * Fixed: When Custom frontpage option is enabled, it's not taking the Polylang static page id #3330 * Fixed: Webp image format as featured image is not working in the single posts #2996 * Fixed: Improper amphtml on HomePage when WPML is activate #3341 * Fixed: Schema not generating after 0.9.97.57 #3344

Full changelog available at changelog.txt

Download this release

Release Info

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

Code changes from version 0.9.97.58 to 0.9.97.59

Files changed (39) hide show
  1. README.md +35 -1
  2. accelerated-moblie-pages.php +7 -2
  3. changelog.txt +34 -0
  4. components/author-box/author-box.php +2 -1
  5. components/comments/comments.php +2 -2
  6. components/featured-image/featured-image.php +1 -1
  7. components/loop/loop.php +2 -2
  8. includes/admin-script.js +7 -2
  9. includes/features/advertisement/ads-functions.php +14 -36
  10. includes/features/advertisement/ads-options.php +0 -1
  11. includes/features/analytics/analytics-functions.php +74 -9
  12. includes/features/analytics/analytics-options.php +58 -18
  13. includes/features/functions.php +14 -8
  14. includes/features/structure-data/structured-data-functions.php +3 -1
  15. includes/onesignal-integration/amp-helper-frame.html +3 -1
  16. includes/onesignal-integration/amp-permission-dialog.html +3 -1
  17. includes/options/admin-config.php +76 -44
  18. includes/options/extensions/amp_slider/amp_slider/field_amp_slider.php +1 -1
  19. includes/options/extensions/amp_slider/extension_amp_slider.php +1 -1
  20. includes/options/extensions/checkbox_hierarchy/checkbox_hierarchy/field_checkbox_hierarchy.php +1 -1
  21. includes/options/extensions/checkbox_hierarchy/extension_checkbox_hierarchy.php +1 -1
  22. includes/options/extensions/demolink_image_select/demolink_image_select/field_demolink_image_select.php +1 -1
  23. includes/options/extensions/demolink_image_select/extension_demolink_image_select.php +1 -1
  24. includes/options/extensions/vendor_support/vendor_support/extension_vendor_support.php +1 -1
  25. includes/redirect.php +9 -1
  26. includes/vendor/amp/includes/amp-post-template-actions.php +1 -1
  27. includes/vendor/amp/includes/embeds/class-amp-gallery-embed.php +8 -1
  28. includes/vendor/amp/includes/sanitizers/class-amp-allowed-tags-generated.php +28 -0
  29. includes/vendor/amp/includes/sanitizers/class-amp-gallery-block-sanitizer.php +27 -1
  30. includes/vendor/vendor-changelog.txt +3 -1
  31. pagebuilder/amp-page-builder.php +1 -1
  32. readme.txt +34 -32
  33. templates/category-widget.php +1 -1
  34. templates/design-manager/design-1/elements/featured-image.php +1 -1
  35. templates/design-manager/design-2/elements/featured-image.php +1 -1
  36. templates/design-manager/design-3/elements/featured-image.php +1 -1
  37. templates/design-manager/swift/index.php +3 -1
  38. templates/design-manager/swift/single.php +4 -4
  39. templates/features.php +31 -42
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.2.1
7
- Stable tag: 0.9.97.58
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -188,6 +188,40 @@ Device testing done through [BrowserStack](https://www.browserstack.com)
188
 
189
  == Changelog ==
190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  = 0.9.97.58 (14th June 2019) =
192
  * Improvements: Option for H1-H6 Heading Font Sizes for all the designs #3035
193
  * Improvements: New filter to add the classes which have to be excluded in infinity scroll #3297
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.2.1
7
+ Stable tag: 0.9.97.59
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
188
 
189
  == Changelog ==
190
 
191
+ = 0.9.97.59 (21th June 2019) =
192
+ * Improvements: WP Recipe Maker & WP Recipe Maker PRO Schema compatibility added #3043
193
+ * Improvements: Impreza Theme's lazyLoad Option compatibility integrated #3259
194
+ * Improvements: WordPress Content Gallery integrated with Design - 1,2 & 3 #3255
195
+ * Improvements: amp-recaptcha-input support added in allowed tag sanitizer #3315
196
+ * Improvements: Yoast 11.4 Schema Compatibility #3332
197
+ * Improvements: Google Tag Manager Advanced Option integrated #2660
198
+ * Fixed: Disqus comments are not loading in the multilingual slug #3106
199
+ * Fixed: Incorrect escaping done on author name when Link to Author Pages is enabled along with the Co-Authors plugin activate [ Theme-Swift ] #3162
200
+ * Fixed: AMP Panel options code improved #2517
201
+ * Fixed: License key code improved #2528
202
+ * Fixed: When site url is different from home url #2881
203
+ * Fixed: Related Posts Design is coming in all the single page designs in AMP Layouts #3091
204
+ * Fixed: CM Tooltip Glossary custom post types are not working with /amp #2882
205
+ * Fixed: Variables replacing in Advanced Google Analytics config code don't work #3237
206
+ * Fixed: "Optimize For Viewability" option for Ads improved #3142
207
+ * Fixed: Advertisement section Ads are not working through Google search result #2693
208
+ * Fixed: When AMP takeover and yoast seo is activated,AMP page builder is not working #3292
209
+ * Fixed: link="next" is appearing in the custom front page #3266
210
+ * Fixed: 404 error when custom post type and page having same slug [Bug for the Rare use case] #2374
211
+ * Fixed: Code improved for attribute layout=responsive in amp-img #3248
212
+ * Fixed: Gallery Lightbox feature code improved #3184
213
+ * Fixed: Elementor stops working when AMP Take Over is enabled #3284
214
+ * Fixed: Activating Thrive lead plugin AMP Page builder doesn't work on the custom front page #3312
215
+ * Fixed: To many redirection issue with hidden post in IOS #3287
216
+ * Fixed: Gallery with GIF is not working #3304
217
+ * Fixed: Indexing Issue of Plugin File #3271
218
+ * Fixed: Post/page throwing an error on hiding AMP for that particular post/page if AMP takeover option is enabled. #3329
219
+ * Fixed: Addthis Sharing default option code improved #3327
220
+ * Fixed: When Custom frontpage option is enabled, it's not taking the Polylang static page id #3330
221
+ * Fixed: Webp image format as featured image is not working in the single posts #2996
222
+ * Fixed: Improper amphtml on HomePage when WPML is activate #3341
223
+ * Fixed: Schema not generating after 0.9.97.57 #3344
224
+
225
  = 0.9.97.58 (14th June 2019) =
226
  * Improvements: Option for H1-H6 Heading Font Sizes for all the designs #3035
227
  * Improvements: New filter to add the classes which have to be excluded in infinity scroll #3297
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.58
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.58');
24
  define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
25
  // any changes to AMP_QUERY_VAR should be refelected here
26
  function ampforwp_generate_endpoint(){
@@ -247,6 +247,11 @@ function ampforwp_add_custom_rewrite_rules() {
247
  'index.php?amp&'.$post_type.'=$matches[1]',
248
  'top'
249
  );
 
 
 
 
 
250
  add_rewrite_rule(
251
  $post_type.'\/amp/'.$wp_rewrite->pagination_base.'/([0-9]{1,})/?$',
252
  'index.php?amp=1&post_type='.$post_type.'&paged=$matches[1]',
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.59
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.59');
24
  define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
25
  // any changes to AMP_QUERY_VAR should be refelected here
26
  function ampforwp_generate_endpoint(){
247
  'index.php?amp&'.$post_type.'=$matches[1]',
248
  'top'
249
  );
250
+ add_rewrite_rule(
251
+ $post_type.'\/(.+?)\/amp\/?$',
252
+ 'index.php?amp&'.$post_type.'=$matches[1]',
253
+ 'top'
254
+ );
255
  add_rewrite_rule(
256
  $post_type.'\/amp/'.$wp_rewrite->pagination_base.'/([0-9]{1,})/?$',
257
  'index.php?amp=1&post_type='.$post_type.'&paged=$matches[1]',
changelog.txt CHANGED
@@ -1,5 +1,39 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 0.9.97.58 (14th June 2019) =
4
  * Improvements: Option for H1-H6 Heading Font Sizes for all the designs #3035
5
  * Improvements: New filter to add the classes which have to be excluded in infinity scroll #3297
1
  == Changelog ==
2
 
3
+ = 0.9.97.59 (21th June 2019) =
4
+ * Improvements: WP Recipe Maker & WP Recipe Maker PRO Schema compatibility added #3043
5
+ * Improvements: Impreza Theme's lazyLoad Option compatibility integrated #3259
6
+ * Improvements: WordPress Content Gallery integrated with Design - 1,2 & 3 #3255
7
+ * Improvements: amp-recaptcha-input support added in allowed tag sanitizer #3315
8
+ * Improvements: Yoast 11.4 Schema Compatibility #3332
9
+ * Improvements: Google Tag Manager Advanced Option integrated #2660
10
+ * Fixed: Disqus comments are not loading in the multilingual slug #3106
11
+ * Fixed: Incorrect escaping done on author name when Link to Author Pages is enabled along with the Co-Authors plugin activate [ Theme-Swift ] #3162
12
+ * Fixed: AMP Panel options code improved #2517
13
+ * Fixed: License key code improved #2528
14
+ * Fixed: When site url is different from home url #2881
15
+ * Fixed: Related Posts Design is coming in all the single page designs in AMP Layouts #3091
16
+ * Fixed: CM Tooltip Glossary custom post types are not working with /amp #2882
17
+ * Fixed: Variables replacing in Advanced Google Analytics config code don't work #3237
18
+ * Fixed: "Optimize For Viewability" option for Ads improved #3142
19
+ * Fixed: Advertisement section Ads are not working through Google search result #2693
20
+ * Fixed: When AMP takeover and yoast seo is activated,AMP page builder is not working #3292
21
+ * Fixed: link="next" is appearing in the custom front page #3266
22
+ * Fixed: 404 error when custom post type and page having same slug [Bug for the Rare use case] #2374
23
+ * Fixed: Code improved for attribute layout=responsive in amp-img #3248
24
+ * Fixed: Gallery Lightbox feature code improved #3184
25
+ * Fixed: Elementor stops working when AMP Take Over is enabled #3284
26
+ * Fixed: Activating Thrive lead plugin AMP Page builder doesn't work on the custom front page #3312
27
+ * Fixed: To many redirection issue with hidden post in IOS #3287
28
+ * Fixed: Gallery with GIF is not working #3304
29
+ * Fixed: Indexing Issue of Plugin File #3271
30
+ * Fixed: Post/page throwing an error on hiding AMP for that particular post/page if AMP takeover option is enabled. #3329
31
+ * Fixed: Addthis Sharing default option code improved #3327
32
+ * Fixed: When Custom frontpage option is enabled, it's not taking the Polylang static page id #3330
33
+ * Fixed: Webp image format as featured image is not working in the single posts #2996
34
+ * Fixed: Improper amphtml on HomePage when WPML is activate #3341
35
+ * Fixed: Schema not generating after 0.9.97.57 #3344
36
+
37
  = 0.9.97.58 (14th June 2019) =
38
  * Improvements: Option for H1-H6 Heading Font Sizes for all the designs #3035
39
  * Improvements: New filter to add the classes which have to be excluded in infinity scroll #3297
components/author-box/author-box.php CHANGED
@@ -84,7 +84,8 @@ if ( isset($args['show_time']) ) {
84
  if ( true == ampforwp_get_setting('ampforwp-author-page-url') ){
85
  if ( function_exists('coauthors_posts_links') ) {
86
  if( $author_pub_name ){
87
- echo '<span class="author-name">' .esc_html($author_prefix) . esc_url($author_link) . ' </span>';
 
88
  echo ampforwp_yoast_twitter_handle();
89
  }
90
  }
84
  if ( true == ampforwp_get_setting('ampforwp-author-page-url') ){
85
  if ( function_exists('coauthors_posts_links') ) {
86
  if( $author_pub_name ){
87
+ $allowed_tags = '<a>';
88
+ echo '<span class="author-name">' .esc_html($author_prefix) . strip_tags($author_link, $allowed_tags) . ' </span>';
89
  echo ampforwp_yoast_twitter_handle();
90
  }
91
  }
components/comments/comments.php CHANGED
@@ -166,7 +166,7 @@ function ampforwp_framework_get_disqus_comments(){
166
  }
167
 
168
  if( $redux_builder_amp['ampforwp-disqus-comments-name'] !== '' ) {
169
- global $post; $post_slug=$post->post_name;
170
 
171
  $disqus_script_host_url = "https://ampforwp.appspot.com/?api=". AMPFORWP_DISQUS_URL;
172
 
@@ -174,7 +174,7 @@ function ampforwp_framework_get_disqus_comments(){
174
  $disqus_script_host_url = esc_url( $redux_builder_amp['ampforwp-disqus-host-file'] );
175
  }
176
 
177
- $disqus_url = $disqus_script_host_url.'?disqus_title='.$post_slug.'&url='.get_permalink().'&disqus_name='. esc_url( $redux_builder_amp['ampforwp-disqus-comments-name'] ) ."/embed.js" ;
178
  ?>
179
  <section class="amp-disqus-comments">
180
  <amp-iframe
166
  }
167
 
168
  if( $redux_builder_amp['ampforwp-disqus-comments-name'] !== '' ) {
169
+ global $post; $post_slug = rawurlencode($post->post_name);
170
 
171
  $disqus_script_host_url = "https://ampforwp.appspot.com/?api=". AMPFORWP_DISQUS_URL;
172
 
174
  $disqus_script_host_url = esc_url( $redux_builder_amp['ampforwp-disqus-host-file'] );
175
  }
176
 
177
+ $disqus_url = $disqus_script_host_url.'?disqus_title='.$post_slug.'&url='.rawurlencode(get_permalink()).'&disqus_name='. esc_url( ampforwp_get_setting('ampforwp-disqus-comments-name') ) ."/embed.js" ;
178
  ?>
179
  <section class="amp-disqus-comments">
180
  <amp-iframe
components/featured-image/featured-image.php CHANGED
@@ -42,7 +42,7 @@ function ampforwp_framework_get_featured_image(){
42
  if(empty($image[2])){
43
  $image[2] = 600;
44
  }
45
- $amp_html = "<amp-img src='$image[0]' width='$image[1]' height='$image[2]' layout=responsive alt='$alt'></amp-img>";
46
  }
47
  }
48
  elseif ( ampforwp_is_custom_field_featured_image() ) {
42
  if(empty($image[2])){
43
  $image[2] = 600;
44
  }
45
+ $amp_html = "<amp-img src='$image[0]' width='$image[1]' height='$image[2]' layout='responsive' alt='$alt'></amp-img>";
46
  }
47
  }
48
  elseif ( ampforwp_is_custom_field_featured_image() ) {
components/loop/loop.php CHANGED
@@ -339,9 +339,9 @@ function amp_loop_excerpt($excerpt_length = 15,$tag = 'p', $class = ''){
339
  }
340
 
341
  if( ampforwp_get_setting('ampforwp-homepage-loop-readmore-link') == 1 ) {
342
- echo ('<'.$tag.' class="'.$class.'">'. wp_trim_words( $content, $excerpt_length ) .' '.'<a href="'. ampforwp_url_controller(get_permalink($post->ID)) . '">'. ampforwp_translation($redux_builder_amp['amp-translator-read-more'],'Read More') . '</a></'.$tag.'>');
343
  } else {
344
- echo ('<'.$tag.' class="'.esc_attr($class).'">'. wp_trim_words( $content, $excerpt_length ) .'</'.$tag.'>');
345
  }
346
 
347
  }
339
  }
340
 
341
  if( ampforwp_get_setting('ampforwp-homepage-loop-readmore-link') == 1 ) {
342
+ echo ('<'.esc_attr($tag).' class="'.$class.'">'. wp_trim_words( $content, $excerpt_length ) .' '.'<a href="'. ampforwp_url_controller(get_permalink($post->ID)) . '">'. ampforwp_translation($redux_builder_amp['amp-translator-read-more'],'Read More') . '</a></'.esc_attr($tag).'>');
343
  } else {
344
+ echo ('<'.esc_attr($tag).' class="'.esc_attr($class).'">'. wp_trim_words( $content, $excerpt_length ) .'</'.esc_attr($tag).'>');
345
  }
346
 
347
  }
includes/admin-script.js CHANGED
@@ -465,6 +465,11 @@ var reduxOptionTab = function(){
465
  }
466
  //reduxOptionTab();
467
 
 
 
 
 
 
468
  $(".redux-ampforwp-ext-activate").click(function(){
469
  var currentThis = $(this);
470
  var plugin_id = currentThis.attr("id");
@@ -473,7 +478,7 @@ $(".redux-ampforwp-ext-activate").click(function(){
473
  var license = $('input[name="redux_builder_amp[amp-license]['+plugin_id+'][license]"]').val();
474
 
475
  if(newlicense!='' && newlicense.indexOf("**")<0){
476
- license = newlicense;
477
  $('input[name="redux_builder_amp[amp-license]['+plugin_id+'][license]"]').val(license);
478
  }
479
 
@@ -486,7 +491,7 @@ $(".redux-ampforwp-ext-activate").click(function(){
486
  method: 'post',
487
  data: {action: 'ampforwp_get_licence_activate_update',
488
  ampforwp_license_activate:plugin_id,
489
- license:license,
490
  item_name:item_name,
491
  store_url:store_url,
492
  plugin_active_path:plugin_active_path,
465
  }
466
  //reduxOptionTab();
467
 
468
+ $( '.redux-action_bar input' ).on('click', function( e ) {
469
+ var license = $(".amp-ls-solve").val();
470
+ license = window.atob(license);
471
+ $(".amp-ls-solve").val(license);
472
+ });
473
  $(".redux-ampforwp-ext-activate").click(function(){
474
  var currentThis = $(this);
475
  var plugin_id = currentThis.attr("id");
478
  var license = $('input[name="redux_builder_amp[amp-license]['+plugin_id+'][license]"]').val();
479
 
480
  if(newlicense!='' && newlicense.indexOf("**")<0){
481
+ license = window.btoa(newlicense);
482
  $('input[name="redux_builder_amp[amp-license]['+plugin_id+'][license]"]').val(license);
483
  }
484
 
491
  method: 'post',
492
  data: {action: 'ampforwp_get_licence_activate_update',
493
  ampforwp_license_activate:plugin_id,
494
+ license:window.atob(license),
495
  item_name:item_name,
496
  store_url:store_url,
497
  plugin_active_path:plugin_active_path,
includes/features/advertisement/ads-functions.php CHANGED
@@ -1,16 +1,21 @@
1
  <?php
2
  // Advertisement code
3
- // Below Header Global
4
- if(!is_plugin_active( 'ads-for-wp/ads-for-wp.php' )){
5
- add_action('ampforwp_after_header','ampforwp_header_advert');
6
- add_action('ampforwp_design_1_after_header','ampforwp_header_advert');
 
 
 
 
 
7
  }
 
8
  function ampforwp_header_advert() {
9
  global $redux_builder_amp;
10
  if($redux_builder_amp==null){
11
  $redux_builder_amp = get_option('redux_builder_amp',true);
12
  }
13
- $optimize = '';
14
  $is_dboc = '';
15
  $is_dboc = ampforwp_get_data_consent();
16
  $post_id = get_the_ID();
@@ -27,7 +32,6 @@ function ampforwp_header_advert() {
27
  }
28
  $client_id = $redux_builder_amp['enable-amp-ads-text-feild-client-1'];
29
  $data_slot = $redux_builder_amp['enable-amp-ads-text-feild-slot-1'];
30
- $optimize = ampforwp_ad_optimize();
31
  if ( isset($redux_builder_amp['enable-amp-ads-1']) && true == $redux_builder_amp['enable-amp-ads-1'] ) {
32
  if ( 1 == $redux_builder_amp['enable-amp-ads-select-1'] ) {
33
  $advert_width = '300';
@@ -57,7 +61,7 @@ function ampforwp_header_advert() {
57
  }
58
  $output = '<div class="amp-ad-wrapper amp_ad_1">';
59
  $output .= '<amp-ad class="amp-ad-1"
60
- type="adsense" '. $optimize .'
61
  width='. $advert_width .' height='. $advert_height . '
62
  data-ad-client="'. $redux_builder_amp['enable-amp-ads-text-feild-client-1'].'"
63
  data-ad-slot="'. $redux_builder_amp['enable-amp-ads-text-feild-slot-1'] .'"';
@@ -79,9 +83,6 @@ function ampforwp_header_advert() {
79
  }
80
 
81
  // Above Footer Global
82
- if(!is_plugin_active( 'ads-for-wp/ads-for-wp.php' )){
83
- add_action('amp_post_template_footer','ampforwp_footer_advert',10);
84
- }
85
  function ampforwp_footer_advert() {
86
  global $redux_builder_amp;
87
  if($redux_builder_amp==null){
@@ -156,16 +157,11 @@ function ampforwp_footer_advert() {
156
  }
157
 
158
  // Above Post Content
159
- if(!is_plugin_active( 'ads-for-wp/ads-for-wp.php' )){
160
- add_action('ampforwp_before_post_content','ampforwp_before_post_content_advert');
161
- add_action('ampforwp_inside_post_content_before','ampforwp_before_post_content_advert');
162
- }
163
  function ampforwp_before_post_content_advert() {
164
  global $redux_builder_amp;
165
  if($redux_builder_amp==null){
166
  $redux_builder_amp = get_option('redux_builder_amp',true);
167
  }
168
- $optimize = '';
169
  $is_global = '';
170
  $display_on = '';
171
  $is_dboc = '';
@@ -181,7 +177,6 @@ function ampforwp_before_post_content_advert() {
181
  }
182
  $client_id = $redux_builder_amp['enable-amp-ads-text-feild-client-3'];
183
  $data_slot = $redux_builder_amp['enable-amp-ads-text-feild-slot-3'];
184
- $optimize = ampforwp_ad_optimize();
185
  if(isset($redux_builder_amp['made-amp-ad-3-global']) && $redux_builder_amp['made-amp-ad-3-global']){
186
  if($redux_builder_amp['made-amp-ad-3-global'] == 1){
187
  $is_global = is_single();
@@ -233,7 +228,7 @@ function ampforwp_before_post_content_advert() {
233
  }
234
  $output = '<div class="amp-ad-wrapper amp_ad_3">';
235
  $output .= '<amp-ad class="amp-ad-3"
236
- type="adsense" '. $optimize .'
237
  width='. $advert_width .' height='. $advert_height . '
238
  data-ad-client="'. $redux_builder_amp['enable-amp-ads-text-feild-client-3'].'"
239
  data-ad-slot="'. $redux_builder_amp['enable-amp-ads-text-feild-slot-3'] .'"';
@@ -257,10 +252,7 @@ function ampforwp_before_post_content_advert() {
257
  }
258
 
259
  // Below Content Single
260
- if(!is_plugin_active( 'ads-for-wp/ads-for-wp.php' )){
261
- add_action('ampforwp_after_post_content','ampforwp_after_post_content_advert');
262
- }
263
- // Hook updated
264
  // add_action('ampforwp_inside_post_content_after','ampforwp_after_post_content_advert');
265
  function ampforwp_after_post_content_advert() {
266
  global $redux_builder_amp;
@@ -333,16 +325,11 @@ function ampforwp_after_post_content_advert() {
333
  }
334
 
335
  // Below The Title
336
- if(!is_plugin_active( 'ads-for-wp/ads-for-wp.php' )){
337
- add_action('ampforwp_below_the_title','ampforwp_below_the_title_advert');
338
- }
339
-
340
  function ampforwp_below_the_title_advert() {
341
  global $redux_builder_amp;
342
  if($redux_builder_amp==null){
343
  $redux_builder_amp = get_option('redux_builder_amp',true);
344
  }
345
- $optimize = '';
346
  $is_dboc = '';
347
  $is_dboc = ampforwp_get_data_consent();
348
  $post_id = get_the_ID();
@@ -356,7 +343,6 @@ function ampforwp_below_the_title_advert() {
356
  }
357
  $client_id = $redux_builder_amp['enable-amp-ads-text-feild-client-5'];
358
  $data_slot = $redux_builder_amp['enable-amp-ads-text-feild-slot-5'];
359
- $optimize = ampforwp_ad_optimize();
360
  if ( isset($redux_builder_amp['enable-amp-ads-5']) && true == $redux_builder_amp['enable-amp-ads-5'] && is_single() ) {
361
  if($redux_builder_amp['enable-amp-ads-select-5'] == 1) {
362
  $advert_width = '300';
@@ -386,7 +372,7 @@ function ampforwp_below_the_title_advert() {
386
  }
387
  $output = '<div class="amp-ad-wrapper amp_ad_5">';
388
  $output .= '<amp-ad class="amp-ad-5"
389
- type="adsense" '. $optimize .'
390
  width='. $advert_width .' height='. $advert_height . '
391
  data-ad-client="'. $redux_builder_amp['enable-amp-ads-text-feild-client-5'].'"
392
  data-ad-slot="'. $redux_builder_amp['enable-amp-ads-text-feild-slot-5'] .'"';
@@ -409,10 +395,6 @@ function ampforwp_below_the_title_advert() {
409
 
410
 
411
  // Above Related post
412
- if(!is_plugin_active( 'ads-for-wp/ads-for-wp.php' )){
413
- add_action('ampforwp_above_related_post','ampforwp_above_related_post_advert');
414
- }
415
-
416
  function ampforwp_above_related_post_advert() {
417
  global $redux_builder_amp;
418
  if($redux_builder_amp==null){
@@ -495,10 +477,6 @@ function ampforwp_ads_sponsorship(){
495
  // Ads Optimize For Viewability
496
  if( !function_exists('ampforwp_ad_optimize')){
497
  function ampforwp_ad_optimize(){
498
- global $redux_builder_amp;
499
- if($redux_builder_amp==null){
500
- $redux_builder_amp = get_option('redux_builder_amp',true);
501
- }
502
  $optimized_code = '';
503
  if( true == ampforwp_get_setting('ampforwp-ads-data-loading-strategy')){
504
  $optimized_code = 'data-loading-strategy=1';
1
  <?php
2
  // Advertisement code
3
+ if( !class_exists('adsforwp_output_functions') ){
4
+ add_action('ampforwp_after_header','ampforwp_header_advert');
5
+ add_action('ampforwp_design_1_after_header','ampforwp_header_advert');
6
+ add_action('amp_post_template_footer','ampforwp_footer_advert',10);
7
+ add_action('ampforwp_before_post_content','ampforwp_before_post_content_advert');
8
+ add_action('ampforwp_inside_post_content_before','ampforwp_before_post_content_advert');
9
+ add_action('ampforwp_after_post_content','ampforwp_after_post_content_advert');
10
+ add_action('ampforwp_below_the_title','ampforwp_below_the_title_advert');
11
+ add_action('ampforwp_above_related_post','ampforwp_above_related_post_advert');
12
  }
13
+ // Below Header Global
14
  function ampforwp_header_advert() {
15
  global $redux_builder_amp;
16
  if($redux_builder_amp==null){
17
  $redux_builder_amp = get_option('redux_builder_amp',true);
18
  }
 
19
  $is_dboc = '';
20
  $is_dboc = ampforwp_get_data_consent();
21
  $post_id = get_the_ID();
32
  }
33
  $client_id = $redux_builder_amp['enable-amp-ads-text-feild-client-1'];
34
  $data_slot = $redux_builder_amp['enable-amp-ads-text-feild-slot-1'];
 
35
  if ( isset($redux_builder_amp['enable-amp-ads-1']) && true == $redux_builder_amp['enable-amp-ads-1'] ) {
36
  if ( 1 == $redux_builder_amp['enable-amp-ads-select-1'] ) {
37
  $advert_width = '300';
61
  }
62
  $output = '<div class="amp-ad-wrapper amp_ad_1">';
63
  $output .= '<amp-ad class="amp-ad-1"
64
+ type="adsense"
65
  width='. $advert_width .' height='. $advert_height . '
66
  data-ad-client="'. $redux_builder_amp['enable-amp-ads-text-feild-client-1'].'"
67
  data-ad-slot="'. $redux_builder_amp['enable-amp-ads-text-feild-slot-1'] .'"';
83
  }
84
 
85
  // Above Footer Global
 
 
 
86
  function ampforwp_footer_advert() {
87
  global $redux_builder_amp;
88
  if($redux_builder_amp==null){
157
  }
158
 
159
  // Above Post Content
 
 
 
 
160
  function ampforwp_before_post_content_advert() {
161
  global $redux_builder_amp;
162
  if($redux_builder_amp==null){
163
  $redux_builder_amp = get_option('redux_builder_amp',true);
164
  }
 
165
  $is_global = '';
166
  $display_on = '';
167
  $is_dboc = '';
177
  }
178
  $client_id = $redux_builder_amp['enable-amp-ads-text-feild-client-3'];
179
  $data_slot = $redux_builder_amp['enable-amp-ads-text-feild-slot-3'];
 
180
  if(isset($redux_builder_amp['made-amp-ad-3-global']) && $redux_builder_amp['made-amp-ad-3-global']){
181
  if($redux_builder_amp['made-amp-ad-3-global'] == 1){
182
  $is_global = is_single();
228
  }
229
  $output = '<div class="amp-ad-wrapper amp_ad_3">';
230
  $output .= '<amp-ad class="amp-ad-3"
231
+ type="adsense"
232
  width='. $advert_width .' height='. $advert_height . '
233
  data-ad-client="'. $redux_builder_amp['enable-amp-ads-text-feild-client-3'].'"
234
  data-ad-slot="'. $redux_builder_amp['enable-amp-ads-text-feild-slot-3'] .'"';
252
  }
253
 
254
  // Below Content Single
255
+ // Hook updated
 
 
 
256
  // add_action('ampforwp_inside_post_content_after','ampforwp_after_post_content_advert');
257
  function ampforwp_after_post_content_advert() {
258
  global $redux_builder_amp;
325
  }
326
 
327
  // Below The Title
 
 
 
 
328
  function ampforwp_below_the_title_advert() {
329
  global $redux_builder_amp;
330
  if($redux_builder_amp==null){
331
  $redux_builder_amp = get_option('redux_builder_amp',true);
332
  }
 
333
  $is_dboc = '';
334
  $is_dboc = ampforwp_get_data_consent();
335
  $post_id = get_the_ID();
343
  }
344
  $client_id = $redux_builder_amp['enable-amp-ads-text-feild-client-5'];
345
  $data_slot = $redux_builder_amp['enable-amp-ads-text-feild-slot-5'];
 
346
  if ( isset($redux_builder_amp['enable-amp-ads-5']) && true == $redux_builder_amp['enable-amp-ads-5'] && is_single() ) {
347
  if($redux_builder_amp['enable-amp-ads-select-5'] == 1) {
348
  $advert_width = '300';
372
  }
373
  $output = '<div class="amp-ad-wrapper amp_ad_5">';
374
  $output .= '<amp-ad class="amp-ad-5"
375
+ type="adsense"
376
  width='. $advert_width .' height='. $advert_height . '
377
  data-ad-client="'. $redux_builder_amp['enable-amp-ads-text-feild-client-5'].'"
378
  data-ad-slot="'. $redux_builder_amp['enable-amp-ads-text-feild-slot-5'] .'"';
395
 
396
 
397
  // Above Related post
 
 
 
 
398
  function ampforwp_above_related_post_advert() {
399
  global $redux_builder_amp;
400
  if($redux_builder_amp==null){
477
  // Ads Optimize For Viewability
478
  if( !function_exists('ampforwp_ad_optimize')){
479
  function ampforwp_ad_optimize(){
 
 
 
 
480
  $optimized_code = '';
481
  if( true == ampforwp_get_setting('ampforwp-ads-data-loading-strategy')){
482
  $optimized_code = 'data-loading-strategy=1';
includes/features/advertisement/ads-options.php CHANGED
@@ -446,7 +446,6 @@
446
  'id' =>'ampforwp-ads-data-loading-strategy',
447
  'type' => 'switch',
448
  'title' => esc_html__('Optimize For Viewability', 'accelerated-mobile-pages'),
449
- 'desc'=>'Enable this option only if your Ads are either 600px away from the top or not within the first 75% of the viewport and <a href="https://www.ampproject.org/docs/reference/components/amp-iframe" target="_blank">Click here for more information</a>',
450
  'default' => 0,
451
  'tooltip-subtitle' => esc_html__('This will increase the loading speed of the Ads', 'accelerated-mobile-pages'),
452
  'true' => 'Enabled',
446
  'id' =>'ampforwp-ads-data-loading-strategy',
447
  'type' => 'switch',
448
  'title' => esc_html__('Optimize For Viewability', 'accelerated-mobile-pages'),
 
449
  'default' => 0,
450
  'tooltip-subtitle' => esc_html__('This will increase the loading speed of the Ads', 'accelerated-mobile-pages'),
451
  'true' => 'Enabled',
includes/features/analytics/analytics-functions.php CHANGED
@@ -29,12 +29,11 @@ function ampforwp_analytics() {
29
  'enabled'=> true
30
  );
31
  }
32
- $ampforwp_ga_fields = apply_filters('ampforwp_advance_google_analytics', $ampforwp_ga_fields );
33
  $ampforwp_ga_fields = json_encode( $ga_fields);
34
- if($ampforwp_ga_fields && ampforwp_get_setting('ampforwp-ga-field-advance-switch')){
35
- $ampforwp_ga_fields = ampforwp_get_setting('ampforwp-ga-field-advance');
36
- $ampforwp_ga_fields = preg_replace('!//.*!', '', $ampforwp_ga_fields);
37
  $ampforwp_ga_fields = preg_replace('!/\*.*?\*/!s', '', $ampforwp_ga_fields);
 
38
  }
39
  ?>
40
  <amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="googleanalytics" id="analytics1">
@@ -45,6 +44,7 @@ function ampforwp_analytics() {
45
  <?php
46
  }//code ends for supporting Google Analytics
47
 
 
48
  // 10.2 Analytics Support added for segment.com
49
  if ( true == ampforwp_get_setting('ampforwp-Segment-switch') ) {
50
  $segment = ampforwp_get_setting('sa-feild');
@@ -277,7 +277,7 @@ if( ! function_exists( ' ampforwp_analytics_clientid_api ' ) ) {
277
  add_filter('amp_post_template_data','ampforwp_register_analytics_script', 20);
278
  function ampforwp_register_analytics_script( $data ){
279
  global $redux_builder_amp;
280
- if( true == ampforwp_get_setting('ampforwp-ga-switch') || true == ampforwp_get_setting('ampforwp-Segment-switch') || true == ampforwp_get_setting('ampforwp-Quantcast-switch') || true == ampforwp_get_setting('ampforwp-comScore-switch') || true == ampforwp_get_setting('ampforwp-Yandex-switch') || true == ampforwp_get_setting('ampforwp-Chartbeat-switch') || true == ampforwp_get_setting('ampforwp-Alexa-switch') || true == ampforwp_get_setting('ampforwp-afs-analytics-switch')) {
281
 
282
  if ( empty( $data['amp_component_scripts']['amp-analytics'] ) ) {
283
  $data['amp_component_scripts']['amp-analytics'] = 'https://cdn.ampproject.org/v0/amp-analytics-0.1.js';
@@ -311,6 +311,9 @@ if ( ! function_exists('amp_activate') ) {
311
  // Create GTM support
312
  add_filter( 'amp_post_template_analytics', 'amp_gtm_add_gtm_support' );
313
  function amp_gtm_add_gtm_support( $analytics ) {
 
 
 
314
  if ( true == ampforwp_get_setting('amp-use-gtm-option') ) {
315
  global $redux_builder_amp;
316
  $gtm_id = "";
@@ -321,14 +324,14 @@ function amp_gtm_add_gtm_support( $analytics ) {
321
  $gtm_id = str_replace(" ", "", $gtm_id);
322
 
323
  $analytics['amp-gtm-googleanalytics'] = array(
324
- 'type' => $redux_builder_amp['amp-gtm-analytics-type'],
325
  'attributes' => array(
326
  'data-credentials' => 'include',
327
  'config' => 'https://www.googletagmanager.com/amp.json?id='. esc_attr( $gtm_id ) .'&gtm.url=SOURCE_URL'
328
  ),
329
  'config_data' => array(
330
  'vars' => array(
331
- 'account' => $redux_builder_amp['amp-gtm-analytics-code'],
332
  ),
333
  'triggers' => array(
334
  'trackPageview' => array(
@@ -338,9 +341,71 @@ function amp_gtm_add_gtm_support( $analytics ) {
338
  ),
339
  ),
340
  );
341
- if ( isset($redux_builder_amp['ampforwp-gtm-field-anonymizeIP']) && true == $redux_builder_amp['ampforwp-gtm-field-anonymizeIP'] ) {
342
  $analytics['amp-gtm-googleanalytics']['config_data']['vars']['anonymizeIP'] = 'true';
343
  }
344
  }
 
 
 
 
 
 
345
  return $analytics;
346
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  'enabled'=> true
30
  );
31
  }
 
32
  $ampforwp_ga_fields = json_encode( $ga_fields);
33
+ if( ampforwp_get_setting('ampforwp-ga-field-advance-switch') ){
34
+ $ampforwp_ga_fields = apply_filters('ampforwp_advance_google_analytics', $ampforwp_ga_fields );
 
35
  $ampforwp_ga_fields = preg_replace('!/\*.*?\*/!s', '', $ampforwp_ga_fields);
36
+ $ampforwp_ga_fields = preg_replace('/\n\s*\n/', '', $ampforwp_ga_fields);
37
  }
38
  ?>
39
  <amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="googleanalytics" id="analytics1">
44
  <?php
45
  }//code ends for supporting Google Analytics
46
 
47
+
48
  // 10.2 Analytics Support added for segment.com
49
  if ( true == ampforwp_get_setting('ampforwp-Segment-switch') ) {
50
  $segment = ampforwp_get_setting('sa-feild');
277
  add_filter('amp_post_template_data','ampforwp_register_analytics_script', 20);
278
  function ampforwp_register_analytics_script( $data ){
279
  global $redux_builder_amp;
280
+ if( true == ampforwp_get_setting('ampforwp-ga-switch') || true == ampforwp_get_setting('ampforwp-Segment-switch') || true == ampforwp_get_setting('ampforwp-Quantcast-switch') || true == ampforwp_get_setting('ampforwp-comScore-switch') || true == ampforwp_get_setting('ampforwp-Yandex-switch') || true == ampforwp_get_setting('ampforwp-Chartbeat-switch') || true == ampforwp_get_setting('ampforwp-Alexa-switch') || true == ampforwp_get_setting('ampforwp-afs-analytics-switch') || true == ampforwp_get_setting('amp-use-gtm-option')) {
281
 
282
  if ( empty( $data['amp_component_scripts']['amp-analytics'] ) ) {
283
  $data['amp_component_scripts']['amp-analytics'] = 'https://cdn.ampproject.org/v0/amp-analytics-0.1.js';
311
  // Create GTM support
312
  add_filter( 'amp_post_template_analytics', 'amp_gtm_add_gtm_support' );
313
  function amp_gtm_add_gtm_support( $analytics ) {
314
+ if(true == ampforwp_get_setting('ampforwp-gtm-field-advance-switch') ){
315
+ return $analytics;
316
+ }
317
  if ( true == ampforwp_get_setting('amp-use-gtm-option') ) {
318
  global $redux_builder_amp;
319
  $gtm_id = "";
324
  $gtm_id = str_replace(" ", "", $gtm_id);
325
 
326
  $analytics['amp-gtm-googleanalytics'] = array(
327
+ 'type' => ampforwp_get_setting('amp-gtm-analytics-type'),
328
  'attributes' => array(
329
  'data-credentials' => 'include',
330
  'config' => 'https://www.googletagmanager.com/amp.json?id='. esc_attr( $gtm_id ) .'&gtm.url=SOURCE_URL'
331
  ),
332
  'config_data' => array(
333
  'vars' => array(
334
+ 'account' => ampforwp_get_setting('amp-gtm-analytics-code'),
335
  ),
336
  'triggers' => array(
337
  'trackPageview' => array(
341
  ),
342
  ),
343
  );
344
+ if ( true == ampforwp_get_setting('ampforwp-gtm-field-anonymizeIP') ) {
345
  $analytics['amp-gtm-googleanalytics']['config_data']['vars']['anonymizeIP'] = 'true';
346
  }
347
  }
348
+ $gtm_fields = '';
349
+ $gtm_fields = apply_filters('ampforwp_advance_gtm_analytics', $gtm_fields );
350
+ if($gtm_fields && ampforwp_get_setting('ampforwp-gtm-field-advance-switch')){
351
+ $gtm_fields = preg_replace('!/\*.*?\*/!s', '', $gtm_fields);
352
+ $analytics['amp-gtm-googleanalytics']['config_data'] = json_decode($gtm_fields, true);
353
+ }
354
  return $analytics;
355
+ }
356
+ add_filter( 'ampforwp_body_beginning', 'ampforwp_add_advance_gtm_fields' );
357
+ function ampforwp_add_advance_gtm_fields( $ampforwp_adv_gtm_fields ) {
358
+ if(true == ampforwp_get_setting('amp-use-gtm-option') && true == ampforwp_get_setting('ampforwp-gtm-field-advance-switch') ){
359
+ $ampforwp_adv_gtm_fields = "";
360
+ $ampforwp_adv_gtm_fields = ampforwp_get_setting('ampforwp-gtm-field-advance');
361
+ $ampforwp_adv_gtm_fields = preg_replace('!/\*.*?\*/!s', '', $ampforwp_adv_gtm_fields);
362
+ $ampforwp_adv_gtm_fields = preg_replace('/\n\s*\n/', '', $ampforwp_adv_gtm_fields);
363
+ ?>
364
+ <amp-analytics id="<?php echo ampforwp_get_setting('amp-gtm-analytics-type'); ?>" type="googleanalytics" data-credentials="include" config="https://www.googletagmanager.com/amp.json?id=<?php echo ampforwp_get_setting('amp-gtm-id'); ?>&amp;gtm.url=SOURCE_URL"><script type="application/json"><?php echo $ampforwp_adv_gtm_fields ?></script></amp-analytics>
365
+ <?php
366
+ }
367
+ return $ampforwp_adv_gtm_fields;
368
+ }
369
+
370
+ // 83. Advance Analytics(Google Analytics)
371
+ add_filter('ampforwp_advance_google_analytics','ampforwp_add_advance_ga_fields');
372
+ function ampforwp_add_advance_ga_fields($ga_fields){
373
+ global $redux_builder_amp, $post;
374
+ $url = $title = $id = $author_id = $author_name = '';
375
+ $url = get_the_permalink();
376
+ $tag_names = array();
377
+ if(!is_object($post)){ return $ga_fields; }
378
+ $title = $post->post_title;
379
+ $id = $post->ID;
380
+ $category_detail = get_the_category($id);//$post->ID
381
+ foreach($category_detail as $cd){
382
+ $category_name = $cd->cat_name;
383
+ }
384
+ $tags = get_the_tags( $id );
385
+
386
+ $tagNames = '';
387
+ if( !empty($tags) ){
388
+ foreach( $tags as $tag ) {
389
+ $tag_names[] = $tag->name;
390
+ }
391
+ $tagNames = implode( ', ', $tag_names );
392
+ }
393
+ $author_id = $post->post_author;
394
+ $author_name = get_the_author_meta( 'display_name' , $author_id );
395
+ $published_at = get_the_date( 'l F j, Y' , $id );
396
+ $ampforwp_adv_ga_fields = array();
397
+ $ampforwp_adv_ga_fields = ampforwp_get_setting('ampforwp-ga-field-advance');
398
+ if($ampforwp_adv_ga_fields) {
399
+ $ampforwp_adv_ga_fields = str_replace('{url}', $url, $ampforwp_adv_ga_fields);
400
+ $ampforwp_adv_ga_fields = str_replace('{id}', $id, $ampforwp_adv_ga_fields);
401
+ $ampforwp_adv_ga_fields = str_replace('{title}', $title, $ampforwp_adv_ga_fields);
402
+ $ampforwp_adv_ga_fields = str_replace('{author_id}', $author_id, $ampforwp_adv_ga_fields);
403
+ $ampforwp_adv_ga_fields = str_replace('{author_name}', $author_name, $ampforwp_adv_ga_fields);
404
+ $ampforwp_adv_ga_fields = str_replace('{category}', $category_name, $ampforwp_adv_ga_fields);
405
+ $ampforwp_adv_ga_fields = str_replace('{published_at}', $published_at, $ampforwp_adv_ga_fields);
406
+ $ampforwp_adv_ga_fields = str_replace('{tags}', $tagNames, $ampforwp_adv_ga_fields);
407
+
408
+ return $ampforwp_adv_ga_fields;
409
+ }
410
+ return $ga_fields;
411
+ }
includes/features/analytics/analytics-options.php CHANGED
@@ -75,19 +75,6 @@ function ampforwp_analytics_options($opt_name){
75
  'tooltip-subtitle' => esc_html__( 'Enter your Google Analytics ID. Example: UA-XXXXX-Y', 'accelerated-mobile-pages' ),
76
  'default' => 'UA-XXXXX-Y',
77
  ),
78
-
79
- // Advance Tracking options for Google Analytics
80
- array(
81
- 'class' => 'child_opt',
82
- 'id' => 'ampforwp-ga-field-advance-switch',
83
- 'type' => 'switch',
84
- 'title' => esc_html__( 'Advanced Google Analytics', 'accelerated-mobile-pages' ),
85
- 'required' => array(
86
- array('amp-use-gtm-option', '=' , '0'),
87
- array('ampforwp-ga-switch', '=' , '1')
88
- ),
89
- 'default' => 0,
90
- ),
91
  array(
92
  'class' => 'child_opt',
93
  'id' => 'ampforwp-ga-field-anonymizeIP',
@@ -105,7 +92,22 @@ function ampforwp_analytics_options($opt_name){
105
  'type' => 'switch',
106
  'title' => esc_html__( 'AMP Linker', 'accelerated-mobile-pages' ),
107
  'required' => array('ampforwp-ga-switch', '=' , '1'),
108
- 'tooltip-subtitle' => esc_html__( '<a href="https://amphtml.wordpress.com/2018/09/17/measuring-user-journeys-across-the-amp-cache-and-your-website/amp/" target="_blank">Click Here</a> for more details on AMP Linker', 'accelerated-mobile-pages' ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
109
  'default' => 0,
110
  ),
111
  array(
@@ -177,11 +179,49 @@ function ampforwp_analytics_options($opt_name){
177
  'title' => esc_html__('Analytics ID','accelerated-mobile-pages'),
178
  'default' => '',
179
  'tooltip-subtitle' => 'Eg: UA-XXXXXX-Y',
180
- // 'validate' => 'not_empty',
181
- 'required' => array(
182
- array('amp-use-gtm-option', '=' , '1'),
183
- ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
185
  array(
186
  'class' => 'child_opt',
187
  'id' => 'ampforwp-gtm-field-anonymizeIP',
75
  'tooltip-subtitle' => esc_html__( 'Enter your Google Analytics ID. Example: UA-XXXXX-Y', 'accelerated-mobile-pages' ),
76
  'default' => 'UA-XXXXX-Y',
77
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  array(
79
  'class' => 'child_opt',
80
  'id' => 'ampforwp-ga-field-anonymizeIP',
92
  'type' => 'switch',
93
  'title' => esc_html__( 'AMP Linker', 'accelerated-mobile-pages' ),
94
  'required' => array('ampforwp-ga-switch', '=' , '1'),
95
+ 'tooltip-subtitle' => sprintf( '<a href="%s" target="_blank">%s</a> %s',
96
+ esc_url('https://amphtml.wordpress.com/2018/09/17/measuring-user-journeys-across-the-amp-cache-and-your-website/amp/'),
97
+ esc_html__( 'Click Here','accelerated-mobile-pages' ),
98
+ esc_html__( 'for more details on AMP Linker','accelerated-mobile-pages' ) ),
99
+ 'default' => 0,
100
+ ),
101
+ // Advance Tracking options for Google Analytics
102
+ array(
103
+ 'class' => 'child_opt',
104
+ 'id' => 'ampforwp-ga-field-advance-switch',
105
+ 'type' => 'switch',
106
+ 'title' => esc_html__( 'Advanced Google Analytics', 'accelerated-mobile-pages' ),
107
+ 'required' => array(
108
+ array('amp-use-gtm-option', '=' , '0'),
109
+ array('ampforwp-ga-switch', '=' , '1')
110
+ ),
111
  'default' => 0,
112
  ),
113
  array(
179
  'title' => esc_html__('Analytics ID','accelerated-mobile-pages'),
180
  'default' => '',
181
  'tooltip-subtitle' => 'Eg: UA-XXXXXX-Y',
182
+ 'required' => array(
183
+ array('amp-use-gtm-option', '=' , '1'),
184
+ array('ampforwp-gtm-field-advance-switch', '=' , '0'),
185
+ ),
186
+ ),
187
+ array(
188
+ 'class' => 'child_opt',
189
+ 'id' => 'ampforwp-gtm-field-advance-switch',
190
+ 'type' => 'switch',
191
+ 'title' => esc_html__( 'Advanced Google Analytics', 'accelerated-mobile-pages' ),
192
+ 'required' => array(
193
+ array('amp-use-gtm-option', '=' , '1'),
194
+ ),
195
+ 'default' => 0,
196
+ ),
197
+ array(
198
+ 'class' => 'child_opt',
199
+ 'id' => 'ampforwp-gtm-field-advance',
200
+ 'type' => 'ace_editor',
201
+ 'title' => esc_html__('Analytics Code in JSON Format', 'accelerated-mobile-pages'),
202
+ 'tooltip-subtitle' => sprintf( '%s<a href="%s" target="_blank">%s</a>', esc_html__( 'Tutorial: ','accelerated-mobile-pages' ), esc_url('https://ampforwp.com/tutorials/article/add-advanced-google-analytics-amp/'), esc_html__( 'How To Add Advanced Google Analytics in AMP?','accelerated-mobile-pages' ) ),
203
+ 'required' => array(
204
+ array('amp-use-gtm-option', '=' , '1'),
205
+ array('ampforwp-gtm-field-advance-switch', '=' , '1')
206
  ),
207
+ 'mode' => 'javascript',
208
+ 'theme' => 'monokai',
209
+ 'desc' => '',
210
+ 'default' => ('{
211
+ "vars": {
212
+ "account": "UA-xxxxxxx-x" /*Replace this with your Tracking ID*/
213
+ },
214
+ "triggers": {
215
+ "trackPageview": {
216
+ "on": "visible",
217
+ "request": "pageview"
218
+ }
219
+ /**
220
+ * Enter your Advanced Analytics code here
221
+ */
222
+ }
223
+ }')
224
+ ),
225
  array(
226
  'class' => 'child_opt',
227
  'id' => 'ampforwp-gtm-field-anonymizeIP',
includes/features/functions.php CHANGED
@@ -13,7 +13,7 @@ function ampforwp_include_aqresizer(){
13
  }
14
  // Some Extra Styling for Admin area
15
  add_action( 'admin_enqueue_scripts', 'ampforwp_add_admin_styling' );
16
- function ampforwp_add_admin_styling(){
17
  global $redux_builder_amp;
18
  // Style file to add or modify css inside admin area
19
  wp_register_style( 'ampforwp_admin_css', untrailingslashit(AMPFORWP_PLUGIN_DIR_URI) . '/includes/admin-style.css', false, AMPFORWP_VERSION );
@@ -23,7 +23,11 @@ function ampforwp_add_admin_styling(){
23
  wp_register_script( 'ampforwp_admin_js', untrailingslashit(AMPFORWP_PLUGIN_DIR_URI) . '/includes/admin-script.js', false, AMPFORWP_VERSION );
24
 
25
  // Localize the script with new data
26
- wp_localize_script( 'ampforwp_admin_js', 'redux_data', $redux_builder_amp );
 
 
 
 
27
  wp_localize_script( 'ampforwp_admin_js', 'ampforwp_nonce', wp_create_nonce('ampforwp-verify-request') );
28
  wp_enqueue_script( 'ampforwp_admin_js' );
29
  }
@@ -44,7 +48,12 @@ function ampforwp_is_front_page(){
44
  if ( ampforwp_get_setting('amp-frontpage-select-option-pages') ) {
45
  $get_amp_custom_frontpage_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
46
  }
47
-
 
 
 
 
 
48
  // TRUE: When we have "Your latest posts" in reading settings and custom frontpage in amp
49
  if ( 'posts' == get_option( 'show_on_front') && is_home() && $get_amp_homepage_settings && $get_custom_frontpage_settings)
50
  return true;
@@ -606,10 +615,7 @@ function ampforwp_url_purifier($url){
606
  else{
607
  $query_name = isset($wp_query->query['pagename'])?$wp_query->query['pagename']:'';
608
  }
609
- if( $query_name && ampforwp_is_query_post_same( $_SERVER['QUERY_STRING'],$query_name) && isset( $query_arg['q'] ) ){
610
- unset($query_arg['q']);
611
- }
612
- else if ( $query_name && isset( $query_arg['q'] ) ){
613
  unset($query_arg['q']);
614
  }
615
  $url = add_query_arg( $query_arg, $url);
@@ -846,7 +852,7 @@ function ampforwp_carousel_bind_script($data){
846
  }
847
  function ampforwp_new_thumbnail_images($amp_images, $uniqueid, $markup_arr){
848
  if(!isset($markup_arr['carousel_with_thumbnail_html'])){return '';}
849
- $amp_thumb_image_buttons = '';
850
  foreach ($amp_images as $key => $value) {
851
  $returnHtml = $markup_arr['carousel_with_thumbnail_html'];
852
  $returnHtml = str_replace('{{thumbnail}}', $value , $returnHtml);
13
  }
14
  // Some Extra Styling for Admin area
15
  add_action( 'admin_enqueue_scripts', 'ampforwp_add_admin_styling' );
16
+ function ampforwp_add_admin_styling($hook_suffix){
17
  global $redux_builder_amp;
18
  // Style file to add or modify css inside admin area
19
  wp_register_style( 'ampforwp_admin_css', untrailingslashit(AMPFORWP_PLUGIN_DIR_URI) . '/includes/admin-style.css', false, AMPFORWP_VERSION );
23
  wp_register_script( 'ampforwp_admin_js', untrailingslashit(AMPFORWP_PLUGIN_DIR_URI) . '/includes/admin-script.js', false, AMPFORWP_VERSION );
24
 
25
  // Localize the script with new data
26
+ $redux_data = array();
27
+ if( current_user_can("manage_options") && $hook_suffix=='toplevel_page_amp_options' ){
28
+ $redux_data = $redux_builder_amp;
29
+ }
30
+ wp_localize_script( 'ampforwp_admin_js', 'redux_data', $redux_data );
31
  wp_localize_script( 'ampforwp_admin_js', 'ampforwp_nonce', wp_create_nonce('ampforwp-verify-request') );
32
  wp_enqueue_script( 'ampforwp_admin_js' );
33
  }
48
  if ( ampforwp_get_setting('amp-frontpage-select-option-pages') ) {
49
  $get_amp_custom_frontpage_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
50
  }
51
+ // Passing Frontpage id true for polylang static pages
52
+ if ( (class_exists('polylang') || class_exists('Polylang_Pro')) && function_exists('poly_archive_url') ) {
53
+ if( !ampforwp_get_setting('amp-frontpage-select-option-pages') && $get_custom_frontpage_settings && 'page' === get_option( 'show_on_front' )){
54
+ $get_amp_custom_frontpage_id = true;
55
+ }
56
+ }
57
  // TRUE: When we have "Your latest posts" in reading settings and custom frontpage in amp
58
  if ( 'posts' == get_option( 'show_on_front') && is_home() && $get_amp_homepage_settings && $get_custom_frontpage_settings)
59
  return true;
615
  else{
616
  $query_name = isset($wp_query->query['pagename'])?$wp_query->query['pagename']:'';
617
  }
618
+ if ( $query_name && isset( $query_arg['q'] ) ){
 
 
 
619
  unset($query_arg['q']);
620
  }
621
  $url = add_query_arg( $query_arg, $url);
852
  }
853
  function ampforwp_new_thumbnail_images($amp_images, $uniqueid, $markup_arr){
854
  if(!isset($markup_arr['carousel_with_thumbnail_html'])){return '';}
855
+ $amp_thumb_image_buttons = array();
856
  foreach ($amp_images as $key => $value) {
857
  $returnHtml = $markup_arr['carousel_with_thumbnail_html'];
858
  $returnHtml = str_replace('{{thumbnail}}', $value , $returnHtml);
includes/features/structure-data/structured-data-functions.php CHANGED
@@ -251,7 +251,9 @@ function ampforwp_structured_data_type( $metadata ) {
251
  $set_sd_post = ampforwp_get_setting('ampforwp-sd-type-posts');
252
  $set_sd_page = ampforwp_get_setting('ampforwp-sd-type-pages');
253
  $post_types = ampforwp_get_all_post_types();
254
-
 
 
255
  if ( $post_types ) { // If there are any custom public post types.
256
  foreach ( $post_types as $post_type ) {
257
 
251
  $set_sd_post = ampforwp_get_setting('ampforwp-sd-type-posts');
252
  $set_sd_page = ampforwp_get_setting('ampforwp-sd-type-pages');
253
  $post_types = ampforwp_get_all_post_types();
254
+ if((function_exists('activate_wp_recipe_maker') || function_exists('activate_wp_recipe_maker_premium')) && (isset($set_sd_post) && $set_sd_post == 'Recipe')){
255
+ return;
256
+ }
257
  if ( $post_types ) { // If there are any custom public post types.
258
  foreach ( $post_types as $post_type ) {
259
 
includes/onesignal-integration/amp-helper-frame.html CHANGED
@@ -1,5 +1,7 @@
1
  <html>
2
- <head></head>
 
 
3
  <body>
4
  <script src="https://cdn.onesignal.com/sdks/amp/amp-helper-frame.js"></script>
5
  </body>
1
  <html>
2
+ <head>
3
+ <meta name="robots" content="noindex,nofollow"/>
4
+ </head>
5
  <body>
6
  <script src="https://cdn.onesignal.com/sdks/amp/amp-helper-frame.js"></script>
7
  </body>
includes/onesignal-integration/amp-permission-dialog.html CHANGED
@@ -1,5 +1,7 @@
1
  <html>
2
- <head></head>
 
 
3
  <body>
4
  <script src="https://cdn.onesignal.com/sdks/amp/amp-permission-dialog.js"></script>
5
  </body>
1
  <html>
2
+ <head>
3
+ <meta name="robots" content="noindex,nofollow"/>
4
+ </head>
5
  <body>
6
  <script src="https://cdn.onesignal.com/sdks/amp/amp-permission-dialog.js"></script>
7
  </body>
includes/options/admin-config.php CHANGED
@@ -574,8 +574,7 @@ foreach ($extension_listing_array as $key => $extension) {
574
  }
575
  }
576
 
577
- $pluginReview = '<input id="redux_builder_amp_amp-license_'.$pathExploded.'_license" type="text" value="'. str_replace(substr($amplicense, 0, strlen($amplicense)-4), '**', $amplicense).'" onclick="return false;">
578
- <input name="redux_builder_amp[amp-license]['.$pathExploded.'][license]" type="hidden" value="'. $amplicense.'">
579
  <input name="redux_builder_amp[amp-license]['.$pathExploded.'][item_name]" type="hidden" value="'.$extension['item_name'].'">';
580
  if (isset($extension['store_url'])){
581
  $pluginReview .= '<input name="redux_builder_amp[amp-license]['.$pathExploded.'][store_url]" type="hidden" value="'.$extension['store_url'].'">';
@@ -589,6 +588,7 @@ foreach ($extension_listing_array as $key => $extension) {
589
  <input name="redux_builder_amp[amp-license]['.$pathExploded.'][all_data][expires]" type="hidden" value="'.$allResponseData['expires'].'">
590
  <input name="redux_builder_amp[amp-license]['.$pathExploded.'][all_data][customer_name]" type="hidden" value="'.$allResponseData['customer_name'].'">
591
  <input name="redux_builder_amp[amp-license]['.$pathExploded.'][all_data][customer_email]" type="hidden" value="'.$allResponseData['customer_email'].'">
 
592
  ';
593
 
594
  $pluginReview .= $verify. "<br/>".$amp_license_response;
@@ -4218,6 +4218,7 @@ Redux::setSection( $opt_name, array(
4218
  ),
4219
  array(
4220
  'id' =>'amp-design-1-excerpt',
 
4221
  'type' =>'text',
4222
  'tooltip-subtitle' =>esc_html__('Enter the number of words Eg: 10','accelerated-mobile-pages'),
4223
  'title' =>esc_html__('Excerpt Length','accelerated-mobile-pages'),
@@ -4228,6 +4229,17 @@ Redux::setSection( $opt_name, array(
4228
  'validate' =>'numeric',
4229
  'default' =>'20',
4230
  ),
 
 
 
 
 
 
 
 
 
 
 
4231
  array(
4232
  'id' => 'ampforwp-design1-cats-home',
4233
  'type' => 'switch',
@@ -4241,17 +4253,21 @@ Redux::setSection( $opt_name, array(
4241
  // Excerpt Length for design2 #1122
4242
  array(
4243
  'id' =>'amp-design-2-excerpt',
 
4244
  'type' =>'text',
4245
  'tooltip-subtitle' =>esc_html__('Enter the number of words Eg: 10','accelerated-mobile-pages'),
4246
  'title' =>esc_html__('Excerpt Length','accelerated-mobile-pages'),
4247
  'required' => array(
4248
- array('amp-design-selector', '=' , '2')),
 
 
4249
  'validate' =>'numeric',
4250
  'default' =>'20',
4251
  ),
4252
  array(
4253
 
4254
  'id' => 'excerpt-option-design-2',
 
4255
  'type' => 'switch',
4256
  'title' => esc_html__('Excerpt on Small Screens', 'accelerated-mobile-pages'),
4257
  'default' => '0',
@@ -4264,6 +4280,7 @@ Redux::setSection( $opt_name, array(
4264
  // Excerpt Length for design3 #1122
4265
  array(
4266
  'id' =>'amp-design-3-excerpt',
 
4267
  'type' =>'text',
4268
  'tooltip-subtitle' =>esc_html__('Enter the number of words Eg: 10','accelerated-mobile-pages'),
4269
  'title' =>esc_html__('Excerpt Length','accelerated-mobile-pages'),
@@ -4275,6 +4292,7 @@ Redux::setSection( $opt_name, array(
4275
  ),
4276
  array(
4277
  'id' => 'excerpt-option-design-3',
 
4278
  'type' => 'switch',
4279
  'title' => esc_html__('Excerpt on Small Screens', 'accelerated-mobile-pages'),
4280
  'default' => '0',
@@ -4287,15 +4305,28 @@ Redux::setSection( $opt_name, array(
4287
  // Excerpt length for Swift
4288
  array(
4289
  'id' =>'amp-swift-excerpt-len',
 
4290
  'type' =>'text',
4291
- 'tooltip-subtitle' =>__('Enter the number of words Eg: 20','accelerated-mobile-pages'),
4292
- 'title' =>__('Excerpt Length','accelerated-mobile-pages'),
4293
  'required' => array(
4294
- array('amp-design-selector', '=' , '4')),
 
 
4295
  'validate' =>'numeric',
4296
  'default' =>'20',
4297
  ),
4298
-
 
 
 
 
 
 
 
 
 
 
4299
  // Featured Time
4300
  array(
4301
  'id' =>'amp-design-1-featured-time',
@@ -5463,6 +5494,41 @@ else{
5463
  'desc' => esc_html__('All the Social sharing and the social profile related settings are here','accelerated-mobile-pages'),
5464
  'subsection' => true,
5465
  'fields' => array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5466
  // AddThis Support
5467
  array(
5468
  'id' => 'add-this-support',
@@ -5478,7 +5544,7 @@ else{
5478
  'type' => 'switch',
5479
  'title' => esc_html__('AddThis Sharing', 'accelerated-mobile-pages'),
5480
  'tooltip-subtitle' => sprintf('%s <a href="https://www.addthis.com/register" target="_blank">%s</a>, %s <a href="https://www.addthis.com/academy/how-to-customize-your-share-buttons-on-the-amp-for-wp-plugin" target="_blank">%s</a>',esc_html__('You are using the default AddThis share buttons. To customize your share buttons, create a free account at','accelerated-mobile-pages'),esc_html__('AddThis.com','accelerated-mobile-pages'),esc_html__('then activate the Inline Share Buttons. Once your buttons are activated, replace the default Pub ID and Tool ID with your personalized IDs. For instructions, visit','accelerated-mobile-pages'),esc_html__('here','accelerated-mobile-pages')),
5481
- 'default' => false,
5482
  ),
5483
  array(
5484
  'id' => 'swift-add-this-position',
@@ -5489,7 +5555,7 @@ else{
5489
  'above-content' => 'Above Content',
5490
  'below-content' => 'Below Content'
5491
  ),
5492
- 'default' => 'default',
5493
  'required' => array(
5494
  array('amp-design-selector', '=', '4'),
5495
  array('enable-add-this-option', '=', '1'),
@@ -5542,41 +5608,7 @@ else{
5542
  'default' => esc_html__('cwgj','accelerated-mobile-pages'),
5543
  ),
5544
  //End AddThis Support
5545
- array(
5546
- 'id' => 'social-settings',
5547
- 'type' => 'section',
5548
- 'title' => esc_html__('Social Settings', 'accelerated-mobile-pages'),
5549
- 'indent' => true,
5550
- 'layout_type' => 'accordion',
5551
- 'accordion-open'=> 1,
5552
- ),
5553
- // Social Icons Position [Swift] #1722
5554
- array(
5555
- 'id' => 'swift-social-position',
5556
- 'type' => 'select',
5557
- 'title' => esc_html__( 'Position', 'accelerated-mobile-pages' ),
5558
- 'options' => array(
5559
- 'default' => 'Single Sidebar (left side)',
5560
- 'above-content' => 'Above Content',
5561
- 'below-content' => 'Below Content'
5562
- ),
5563
- 'default' => 'default',
5564
- 'required' => array(array('amp-design-selector', '=', '4') )
5565
- ),
5566
- // Social Share links to AMP
5567
- array(
5568
- 'id' => 'ampforwp-social-share-amp',
5569
- 'type' => 'switch',
5570
- 'title' => esc_html__('Social Share links to AMP', 'accelerated-mobile-pages'),
5571
- 'default' => 0,
5572
- ),
5573
- // Social No Follow links
5574
- array(
5575
- 'id' => 'ampforwp-social-no-follow',
5576
- 'type' => 'switch',
5577
- 'title' => esc_html__('No Follow All Your Social Links', 'accelerated-mobile-pages'),
5578
- 'default' => 0,
5579
- ),
5580
  array(
5581
  'id' => 'social-shre',
5582
  'type' => 'section',
574
  }
575
  }
576
 
577
+ $pluginReview = '<input id="redux_builder_amp_amp-license_'.$pathExploded.'_license" type="text" value="'. str_replace(substr($amplicense, 0, strlen($amplicense)-4), '**', $amplicense).'" onclick="return false;">
 
578
  <input name="redux_builder_amp[amp-license]['.$pathExploded.'][item_name]" type="hidden" value="'.$extension['item_name'].'">';
579
  if (isset($extension['store_url'])){
580
  $pluginReview .= '<input name="redux_builder_amp[amp-license]['.$pathExploded.'][store_url]" type="hidden" value="'.$extension['store_url'].'">';
588
  <input name="redux_builder_amp[amp-license]['.$pathExploded.'][all_data][expires]" type="hidden" value="'.$allResponseData['expires'].'">
589
  <input name="redux_builder_amp[amp-license]['.$pathExploded.'][all_data][customer_name]" type="hidden" value="'.$allResponseData['customer_name'].'">
590
  <input name="redux_builder_amp[amp-license]['.$pathExploded.'][all_data][customer_email]" type="hidden" value="'.$allResponseData['customer_email'].'">
591
+ <input name="redux_builder_amp[amp-license]['.$pathExploded.'][license]" type="hidden" value="'. base64_encode($amplicense).'">
592
  ';
593
 
594
  $pluginReview .= $verify. "<br/>".$amp_license_response;
4218
  ),
4219
  array(
4220
  'id' =>'amp-design-1-excerpt',
4221
+ 'class' => 'child_opt',
4222
  'type' =>'text',
4223
  'tooltip-subtitle' =>esc_html__('Enter the number of words Eg: 10','accelerated-mobile-pages'),
4224
  'title' =>esc_html__('Excerpt Length','accelerated-mobile-pages'),
4229
  'validate' =>'numeric',
4230
  'default' =>'20',
4231
  ),
4232
+ array(
4233
+ 'id' => 'excerpt-option-design-1',
4234
+ 'class' => 'child_opt',
4235
+ 'type' => 'switch',
4236
+ 'title' => esc_html__('Excerpt on Small Screens', 'accelerated-mobile-pages'),
4237
+ 'default' => '0',
4238
+ 'required' => array(
4239
+ array('amp-design-selector', '=' , '1'),
4240
+ array('excerpt-option', '=' , '1'),
4241
+ )
4242
+ ),
4243
  array(
4244
  'id' => 'ampforwp-design1-cats-home',
4245
  'type' => 'switch',
4253
  // Excerpt Length for design2 #1122
4254
  array(
4255
  'id' =>'amp-design-2-excerpt',
4256
+ 'class' => 'child_opt',
4257
  'type' =>'text',
4258
  'tooltip-subtitle' =>esc_html__('Enter the number of words Eg: 10','accelerated-mobile-pages'),
4259
  'title' =>esc_html__('Excerpt Length','accelerated-mobile-pages'),
4260
  'required' => array(
4261
+ array('amp-design-selector', '=' , '2'),
4262
+ array('excerpt-option', '=' , '1')
4263
+ ),
4264
  'validate' =>'numeric',
4265
  'default' =>'20',
4266
  ),
4267
  array(
4268
 
4269
  'id' => 'excerpt-option-design-2',
4270
+ 'class' => 'child_opt',
4271
  'type' => 'switch',
4272
  'title' => esc_html__('Excerpt on Small Screens', 'accelerated-mobile-pages'),
4273
  'default' => '0',
4280
  // Excerpt Length for design3 #1122
4281
  array(
4282
  'id' =>'amp-design-3-excerpt',
4283
+ 'class' => 'child_opt',
4284
  'type' =>'text',
4285
  'tooltip-subtitle' =>esc_html__('Enter the number of words Eg: 10','accelerated-mobile-pages'),
4286
  'title' =>esc_html__('Excerpt Length','accelerated-mobile-pages'),
4292
  ),
4293
  array(
4294
  'id' => 'excerpt-option-design-3',
4295
+ 'class' => 'child_opt',
4296
  'type' => 'switch',
4297
  'title' => esc_html__('Excerpt on Small Screens', 'accelerated-mobile-pages'),
4298
  'default' => '0',
4305
  // Excerpt length for Swift
4306
  array(
4307
  'id' =>'amp-swift-excerpt-len',
4308
+ 'class' => 'child_opt',
4309
  'type' =>'text',
4310
+ 'tooltip-subtitle' => esc_html__('Enter the number of words Eg: 20','accelerated-mobile-pages'),
4311
+ 'title' => esc_html__('Excerpt Length','accelerated-mobile-pages'),
4312
  'required' => array(
4313
+ array('amp-design-selector', '=' , '4'),
4314
+ array('excerpt-option', '=' , '1'),
4315
+ ),
4316
  'validate' =>'numeric',
4317
  'default' =>'20',
4318
  ),
4319
+ array(
4320
+ 'id' => 'excerpt-option-design-4',
4321
+ 'class' => 'child_opt',
4322
+ 'type' => 'switch',
4323
+ 'title' => esc_html__('Excerpt on Small Screens', 'accelerated-mobile-pages'),
4324
+ 'default' => '0',
4325
+ 'required' => array(
4326
+ array('amp-design-selector', '=' , '4'),
4327
+ array('excerpt-option', '=' , '1'),
4328
+ )
4329
+ ),
4330
  // Featured Time
4331
  array(
4332
  'id' =>'amp-design-1-featured-time',
5494
  'desc' => esc_html__('All the Social sharing and the social profile related settings are here','accelerated-mobile-pages'),
5495
  'subsection' => true,
5496
  'fields' => array(
5497
+ array(
5498
+ 'id' => 'social-settings',
5499
+ 'type' => 'section',
5500
+ 'title' => esc_html__('Social Settings', 'accelerated-mobile-pages'),
5501
+ 'indent' => true,
5502
+ 'layout_type' => 'accordion',
5503
+ 'accordion-open'=> 1,
5504
+ ),
5505
+ // Social Icons Position [Swift] #1722
5506
+ array(
5507
+ 'id' => 'swift-social-position',
5508
+ 'type' => 'select',
5509
+ 'title' => esc_html__( 'Position', 'accelerated-mobile-pages' ),
5510
+ 'options' => array(
5511
+ 'default' => 'Single Sidebar (left side)',
5512
+ 'above-content' => 'Above Content',
5513
+ 'below-content' => 'Below Content'
5514
+ ),
5515
+ 'default' => 'default',
5516
+ 'required' => array(array('amp-design-selector', '=', '4') )
5517
+ ),
5518
+ // Social Share links to AMP
5519
+ array(
5520
+ 'id' => 'ampforwp-social-share-amp',
5521
+ 'type' => 'switch',
5522
+ 'title' => esc_html__('Social Share links to AMP', 'accelerated-mobile-pages'),
5523
+ 'default' => 0,
5524
+ ),
5525
+ // Social No Follow links
5526
+ array(
5527
+ 'id' => 'ampforwp-social-no-follow',
5528
+ 'type' => 'switch',
5529
+ 'title' => esc_html__('No Follow All Your Social Links', 'accelerated-mobile-pages'),
5530
+ 'default' => 0,
5531
+ ),
5532
  // AddThis Support
5533
  array(
5534
  'id' => 'add-this-support',
5544
  'type' => 'switch',
5545
  'title' => esc_html__('AddThis Sharing', 'accelerated-mobile-pages'),
5546
  'tooltip-subtitle' => sprintf('%s <a href="https://www.addthis.com/register" target="_blank">%s</a>, %s <a href="https://www.addthis.com/academy/how-to-customize-your-share-buttons-on-the-amp-for-wp-plugin" target="_blank">%s</a>',esc_html__('You are using the default AddThis share buttons. To customize your share buttons, create a free account at','accelerated-mobile-pages'),esc_html__('AddThis.com','accelerated-mobile-pages'),esc_html__('then activate the Inline Share Buttons. Once your buttons are activated, replace the default Pub ID and Tool ID with your personalized IDs. For instructions, visit','accelerated-mobile-pages'),esc_html__('here','accelerated-mobile-pages')),
5547
+ 'default' => true,
5548
  ),
5549
  array(
5550
  'id' => 'swift-add-this-position',
5555
  'above-content' => 'Above Content',
5556
  'below-content' => 'Below Content'
5557
  ),
5558
+ 'default' => 'below-content',
5559
  'required' => array(
5560
  array('amp-design-selector', '=', '4'),
5561
  array('enable-add-this-option', '=', '1'),
5608
  'default' => esc_html__('cwgj','accelerated-mobile-pages'),
5609
  ),
5610
  //End AddThis Support
5611
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5612
  array(
5613
  'id' => 'social-shre',
5614
  'type' => 'section',
includes/options/extensions/amp_slider/amp_slider/field_amp_slider.php CHANGED
@@ -52,7 +52,7 @@ if ( ! class_exists( 'ReduxCore\\ReduxFramework\\ReduxFramework_amp_slider' ) )
52
 
53
  if( empty( $this->extension_dir ) ) {
54
  $this->extension_dir = trailingslashit( str_replace( '\\', '/', dirname( __FILE__ ) ) );
55
- $this->extension_url = site_url( str_replace( trailingslashit( str_replace( '\\', '/', ABSPATH ) ), '', $this->extension_dir ) );
56
  }
57
  // Set defaults
58
  $defaults = array(
52
 
53
  if( empty( $this->extension_dir ) ) {
54
  $this->extension_dir = trailingslashit( str_replace( '\\', '/', dirname( __FILE__ ) ) );
55
+ $this->extension_url = plugin_dir_url(__FILE__);
56
  }
57
  // Set defaults
58
  $defaults = array(
includes/options/extensions/amp_slider/extension_amp_slider.php CHANGED
@@ -65,7 +65,7 @@ if( !class_exists( 'ReduxCore\\ReduxFramework\\ReduxFramework_extension_amp_slid
65
  $this->field_name = 'amp_slider';
66
  if ( empty( $this->extension_dir ) ) {
67
  $this->extension_dir = trailingslashit( str_replace( '\\', '/', AMPFORWP_EXTENSION_DIR.'/'.$this->field_name ));
68
- $this->extension_url = site_url( str_replace( trailingslashit( str_replace( '\\', '/', ABSPATH ) ), '', $this->extension_dir ) );
69
  }
70
 
71
  self::$theInstance = $this;
65
  $this->field_name = 'amp_slider';
66
  if ( empty( $this->extension_dir ) ) {
67
  $this->extension_dir = trailingslashit( str_replace( '\\', '/', AMPFORWP_EXTENSION_DIR.'/'.$this->field_name ));
68
+ $this->extension_url = plugin_dir_url(__FILE__);
69
  }
70
 
71
  self::$theInstance = $this;
includes/options/extensions/checkbox_hierarchy/checkbox_hierarchy/field_checkbox_hierarchy.php CHANGED
@@ -47,7 +47,7 @@ if ( !class_exists ( 'ReduxCore\\ReduxFramework\\ReduxFramework_checkbox_hierarc
47
  }
48
  if ( empty( $this->extension_dir ) ) {
49
  $this->extension_dir = trailingslashit( str_replace( '\\', '/', AMPFORWP_EXTENSION_DIR.'/checkbox_hierarchy/checkbox_hierarchy' ) );
50
- $this->extension_url = site_url( str_replace( trailingslashit( str_replace( '\\', '/', ABSPATH ) ), '', $this->extension_dir ) );
51
  }
52
  }
53
  /**
47
  }
48
  if ( empty( $this->extension_dir ) ) {
49
  $this->extension_dir = trailingslashit( str_replace( '\\', '/', AMPFORWP_EXTENSION_DIR.'/checkbox_hierarchy/checkbox_hierarchy' ) );
50
+ $this->extension_url = plugin_dir_url(__FILE__);
51
  }
52
  }
53
  /**
includes/options/extensions/checkbox_hierarchy/extension_checkbox_hierarchy.php CHANGED
@@ -65,7 +65,7 @@ if( !class_exists( 'ReduxCore\\ReduxFramework\\ReduxFramework_extension_checkbox
65
  $this->field_name = 'checkbox_hierarchy';
66
  if ( empty( $this->extension_dir ) ) {
67
  $this->extension_dir = trailingslashit( str_replace( '\\', '/', AMPFORWP_EXTENSION_DIR.'/'.$this->field_name ) );
68
- $this->extension_url = site_url( str_replace( trailingslashit( str_replace( '\\', '/', ABSPATH ) ), '', $this->extension_dir ) );
69
  }
70
 
71
  self::$theInstance = $this;
65
  $this->field_name = 'checkbox_hierarchy';
66
  if ( empty( $this->extension_dir ) ) {
67
  $this->extension_dir = trailingslashit( str_replace( '\\', '/', AMPFORWP_EXTENSION_DIR.'/'.$this->field_name ) );
68
+ $this->extension_url = plugin_dir_url(__FILE__);
69
  }
70
 
71
  self::$theInstance = $this;
includes/options/extensions/demolink_image_select/demolink_image_select/field_demolink_image_select.php CHANGED
@@ -33,7 +33,7 @@ if ( ! class_exists( 'ReduxCore\\ReduxFramework\\ReduxFramework_demolink_image_s
33
  }
34
  if ( empty( $this->extension_dir ) ) {
35
  $this->extension_dir = trailingslashit( str_replace( '\\', '/', AMPFORWP_EXTENSION_DIR.'/demolink_image_select/demolink_image_select' ) );
36
- $this->extension_url = site_url( str_replace( trailingslashit( str_replace( '\\', '/', ABSPATH ) ), '', $this->extension_dir ) );
37
  }
38
  // Set default args for this field to avoid bad indexes. Change this to anything you use.
39
  $defaults = array(
33
  }
34
  if ( empty( $this->extension_dir ) ) {
35
  $this->extension_dir = trailingslashit( str_replace( '\\', '/', AMPFORWP_EXTENSION_DIR.'/demolink_image_select/demolink_image_select' ) );
36
+ $this->extension_url = plugin_dir_url(__FILE__);
37
  }
38
  // Set default args for this field to avoid bad indexes. Change this to anything you use.
39
  $defaults = array(
includes/options/extensions/demolink_image_select/extension_demolink_image_select.php CHANGED
@@ -65,7 +65,7 @@ if( !class_exists( 'ReduxFramework_extension_demolink_image_select' ) ) {
65
  $this->field_name = 'demolink_image_select';
66
  if ( empty( $this->extension_dir ) ) {
67
  $this->extension_dir = trailingslashit( str_replace( '\\', '/', AMPFORWP_EXTENSION_DIR.'/'.$this->field_name ) );
68
- $this->extension_url = site_url( str_replace( trailingslashit( str_replace( '\\', '/', ABSPATH ) ), '', $this->extension_dir ) );
69
  }
70
 
71
  self::$theInstance = $this;
65
  $this->field_name = 'demolink_image_select';
66
  if ( empty( $this->extension_dir ) ) {
67
  $this->extension_dir = trailingslashit( str_replace( '\\', '/', AMPFORWP_EXTENSION_DIR.'/'.$this->field_name ) );
68
+ $this->extension_url = plugin_dir_url(__FILE__);
69
  }
70
 
71
  self::$theInstance = $this;
includes/options/extensions/vendor_support/vendor_support/extension_vendor_support.php CHANGED
@@ -49,7 +49,7 @@ namespace ReduxCore\ReduxFramework;
49
  public function __construct( $parent = null ) {
50
  if ( empty( $this->extension_dir ) ) {
51
  $this->extension_dir = trailingslashit( str_replace( '\\', '/', AMPFORWP_EXTENSION_DIR.'/vendor_support/vendor_support' ) );
52
- //$this->extension_url = site_url( str_replace( trailingslashit( str_replace( '\\', '/', ABSPATH ) ), '', $this->extension_dir ) );
53
  $this->extension_url = AMPFORWP_PLUGIN_DIR_URI.'includes/options/extensions/vendor_support/vendor_support/';
54
  }
55
 
49
  public function __construct( $parent = null ) {
50
  if ( empty( $this->extension_dir ) ) {
51
  $this->extension_dir = trailingslashit( str_replace( '\\', '/', AMPFORWP_EXTENSION_DIR.'/vendor_support/vendor_support' ) );
52
+ //$this->extension_url = plugin_dir_url(__FILE__);
53
  $this->extension_url = AMPFORWP_PLUGIN_DIR_URI.'includes/options/extensions/vendor_support/vendor_support/';
54
  }
55
 
includes/redirect.php CHANGED
@@ -9,6 +9,10 @@ function ampforwp_redirection() {
9
  global $redux_builder_amp, $wp, $post;
10
  $hide_cats_amp = $url = $archive_check = $go_to_url = '';
11
  $hide_cats_amp = is_category_amp_disabled();
 
 
 
 
12
  // Redirection for Homepage and Archive Pages when Turned Off from options panel
13
  if ( ampforwp_is_amp_endpoint() ) {
14
  if( (is_archive() && 0 == ampforwp_get_setting('ampforwp-archive-support')) || (is_category() && 0 == ampforwp_get_setting('ampforwp-archive-support-cat')) || (is_tag() && 0 == ampforwp_get_setting('ampforwp-archive-support-tag')) ){
@@ -125,7 +129,11 @@ function ampforwp_redirection() {
125
  if ( ( is_single() && $redux_builder_amp['amp-on-off-for-all-posts'] ) || ( is_page() && $redux_builder_amp['amp-on-off-for-all-pages'] ) ) {
126
  $redirection_location = get_the_permalink();
127
  }
128
-
 
 
 
 
129
  /* Fallback, if for any reason, $redirection_location is still NULL
130
  * then redirect it to homepage.
131
  */
9
  global $redux_builder_amp, $wp, $post;
10
  $hide_cats_amp = $url = $archive_check = $go_to_url = '';
11
  $hide_cats_amp = is_category_amp_disabled();
12
+ // No redirection if Post/Page is AMP Disabled #3287
13
+ if ( ( is_singular() || ampforwp_is_front_page() || ampforwp_is_blog() ) && false == get_post_meta( ampforwp_get_the_ID(),'ampforwp-amp-on-off',true) ) {
14
+ return;
15
+ }
16
  // Redirection for Homepage and Archive Pages when Turned Off from options panel
17
  if ( ampforwp_is_amp_endpoint() ) {
18
  if( (is_archive() && 0 == ampforwp_get_setting('ampforwp-archive-support')) || (is_category() && 0 == ampforwp_get_setting('ampforwp-archive-support-cat')) || (is_tag() && 0 == ampforwp_get_setting('ampforwp-archive-support-tag')) ){
129
  if ( ( is_single() && $redux_builder_amp['amp-on-off-for-all-posts'] ) || ( is_page() && $redux_builder_amp['amp-on-off-for-all-pages'] ) ) {
130
  $redirection_location = get_the_permalink();
131
  }
132
+ $ampforwp_amp_post_on_off_meta = "";
133
+ $ampforwp_amp_post_on_off_meta = get_post_meta( $post_id,'ampforwp-amp-on-off',true);
134
+ if(false == $ampforwp_amp_post_on_off_meta){
135
+ return;
136
+ }
137
  /* Fallback, if for any reason, $redirection_location is still NULL
138
  * then redirect it to homepage.
139
  */
includes/vendor/amp/includes/amp-post-template-actions.php CHANGED
@@ -47,7 +47,7 @@ function amp_post_template_add_boilerplate_css( $amp_template ) {
47
  <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>
48
  <?php
49
  }
50
- 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') && ! ampforwp_get_setting('ampforwp-seo-rank_math-schema') ):
51
  add_action( 'amp_post_template_footer', 'AMPforWP\\AMPVendor\\amp_post_template_add_schemaorg_metadata' );
52
  function amp_post_template_add_schemaorg_metadata( $amp_template ) {
53
  $metadata = $amp_template->get( 'metadata' );
47
  <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>
48
  <?php
49
  }
50
+ if(!function_exists('ampforwp_with_scheme_app_output') && !function_exists('saswp_schema_markup_output') && ( ampforwp_get_setting('ampforwp-seo-selection') != "rank_math" || ! ampforwp_get_setting('ampforwp-seo-rank_math-schema'))):
51
  add_action( 'amp_post_template_footer', 'AMPforWP\\AMPVendor\\amp_post_template_add_schemaorg_metadata' );
52
  function amp_post_template_add_schemaorg_metadata( $amp_template ) {
53
  $metadata = $amp_template->get( 'metadata' );
includes/vendor/amp/includes/embeds/class-amp-gallery-embed.php CHANGED
@@ -123,7 +123,8 @@ class AMP_Gallery_Embed_Handler extends AMP_Base_Embed_Handler {
123
  {{amp_image_lightbox}}',
124
  'image-with-caption-html'=>'<figure><div class="ampforwp-gallery-item amp-carousel-container">{{main_images}} </div><figcaption {{openbrack}}class{{closebrack}}="expanded? \'expanded\' : \'\'" on="tap:AMP.setState({expanded: !expanded})" tabindex="0" role="button" >{{main_images_caption}}<span {{openbrack}}text{{closebrack}}="expanded ? \'less\' : \'more\'">more</span> </figcaption></figure>',
125
  'image-without-caption-html' =>'<div class="ampforwp-gallery-item amp-carousel-container">{{main_images}} </div>',
126
- 'gallery_css' => '',
 
127
 
128
  'scripts' => array()
129
  ),
@@ -138,6 +139,8 @@ class AMP_Gallery_Embed_Handler extends AMP_Base_Embed_Handler {
138
  .carousel-preview button{padding:0;}
139
  .carousel-preview amp-img{height:40px;width:60px;position:relative;}
140
  .carousel-preview {width: 100%;display: inline-block;text-align: center;margin: 20px 0px;}
 
 
141
  ',
142
  'scripts' => array()
143
  ),
@@ -225,6 +228,10 @@ class AMP_Gallery_Embed_Handler extends AMP_Base_Embed_Handler {
225
  // Replace the openbrack with [ and closebrack with ]
226
  $returnHtml = str_replace('{{openbrack}}', '[', $returnHtml);
227
  $returnHtml = str_replace('{{closebrack}}', ']', $returnHtml);
 
 
 
 
228
  }
229
  elseif( isset($markup['image-without-caption-html']) ){
230
  // If there is no caption
123
  {{amp_image_lightbox}}',
124
  'image-with-caption-html'=>'<figure><div class="ampforwp-gallery-item amp-carousel-container">{{main_images}} </div><figcaption {{openbrack}}class{{closebrack}}="expanded? \'expanded\' : \'\'" on="tap:AMP.setState({expanded: !expanded})" tabindex="0" role="button" >{{main_images_caption}}<span {{openbrack}}text{{closebrack}}="expanded ? \'less\' : \'more\'">more</span> </figcaption></figure>',
125
  'image-without-caption-html' =>'<div class="ampforwp-gallery-item amp-carousel-container">{{main_images}} </div>',
126
+ 'gallery_css' => '.cls-btn { background: #0d0d0d; border: none;position: absolute;right: 10px;}
127
+ .cls-btn:after{content:"X";display:inline-block;color:#fff;font-size:20px;padding:20px;}',
128
 
129
  'scripts' => array()
130
  ),
139
  .carousel-preview button{padding:0;}
140
  .carousel-preview amp-img{height:40px;width:60px;position:relative;}
141
  .carousel-preview {width: 100%;display: inline-block;text-align: center;margin: 20px 0px;}
142
+ .cls-btn { background: #0d0d0d; border: none;position: absolute;right: 10px;}
143
+ .cls-btn:after{content:"X";display:inline-block;color:#fff;font-size:20px;padding:20px;}
144
  ',
145
  'scripts' => array()
146
  ),
228
  // Replace the openbrack with [ and closebrack with ]
229
  $returnHtml = str_replace('{{openbrack}}', '[', $returnHtml);
230
  $returnHtml = str_replace('{{closebrack}}', ']', $returnHtml);
231
+ if( strlen($caption) < 200){
232
+ $returnHtml = str_replace('<span [text]="expanded ? \'less\' : \'more\'">more</span>', '', $returnHtml);
233
+ $returnHtml = preg_replace('/<span(.*?)>(.*?)<\/span>/', '', $returnHtml);
234
+ }
235
  }
236
  elseif( isset($markup['image-without-caption-html']) ){
237
  // If there is no caption
includes/vendor/amp/includes/sanitizers/class-amp-allowed-tags-generated.php CHANGED
@@ -1965,6 +1965,34 @@ class AMP_Allowed_Tags_Generated {
1965
  ),
1966
  ),
1967
  ),
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1968
  'amp-reach-player' => array(
1969
  array(
1970
  'attr_spec_list' => array(
1965
  ),
1966
  ),
1967
  ),
1968
+ 'amp-recaptcha-input' => array(
1969
+ array(
1970
+ 'attr_spec_list' => array(
1971
+ 'data-action' => array(
1972
+ 'mandatory' => true,
1973
+ ),
1974
+ 'data-sitekey' => array(
1975
+ 'mandatory' => true,
1976
+ ),
1977
+ 'name' => array(
1978
+ 'blacklisted_value_regex' => '(^|\\s)(__amp_\\S*|__count__|__defineGetter__|__defineSetter__|__lookupGetter__|__lookupSetter__|__noSuchMethod__|__parent__|__proto__|__AMP_\\S*|\\$p|\\$proxy|acceptCharset|addEventListener|appendChild|assignedSlot|attachShadow|baseURI|checkValidity|childElementCount|childNodes|classList|className|clientHeight|clientLeft|clientTop|clientWidth|compareDocumentPosition|computedName|computedRole|contentEditable|createShadowRoot|enqueAction|firstChild|firstElementChild|getAnimations|getAttribute|getAttributeNS|getAttributeNode|getAttributeNodeNS|getBoundingClientRect|getClientRects|getDestinationInsertionPoints|getElementsByClassName|getElementsByTagName|getElementsByTagNameNS|getRootNode|hasAttribute|hasAttributeNS|hasAttributes|hasChildNodes|hasPointerCapture|innerHTML|innerText|inputMode|insertAdjacentElement|insertAdjacentHTML|insertAdjacentText|isContentEditable|isDefaultNamespace|isEqualNode|isSameNode|lastChild|lastElementChild|lookupNamespaceURI|namespaceURI|nextElementSibling|nextSibling|nodeName|nodeType|nodeValue|offsetHeight|offsetLeft|offsetParent|offsetTop|offsetWidth|outerHTML|outerText|ownerDocument|parentElement|parentNode|previousElementSibling|previousSibling|querySelector|querySelectorAll|releasePointerCapture|removeAttribute|removeAttributeNS|removeAttributeNode|removeChild|removeEventListener|replaceChild|reportValidity|requestPointerLock|scrollHeight|scrollIntoView|scrollIntoViewIfNeeded|scrollLeft|scrollWidth|setAttribute|setAttributeNS|setAttributeNode|setAttributeNodeNS|setPointerCapture|shadowRoot|styleMap|tabIndex|tagName|textContent|toString|valueOf|(webkit|ms|moz|o)dropzone|(webkit|moz|ms|o)MatchesSelector|(webkit|moz|ms|o)RequestFullScreen|(webkit|moz|ms|o)RequestFullscreen)(\\s|$)',
1979
+ 'mandatory' => true,
1980
+ ),
1981
+ ),
1982
+ 'tag_spec' => array(
1983
+ 'amp_layout' => array(
1984
+ 'supported_layouts' => array(
1985
+ 1,
1986
+ ),
1987
+ ),
1988
+ 'mandatory_ancestor' => 'form',
1989
+ 'requires_extension' => array(
1990
+ 'amp-form',
1991
+ 'amp-recaptcha-input',
1992
+ ),
1993
+ ),
1994
+ ),
1995
+ ),
1996
  'amp-reach-player' => array(
1997
  array(
1998
  'attr_spec_list' => array(
includes/vendor/amp/includes/sanitizers/class-amp-gallery-block-sanitizer.php CHANGED
@@ -109,6 +109,25 @@ class AMP_Gallery_Block_Sanitizer extends AMP_Base_Sanitizer {
109
  $images[] = $element;
110
  }
111
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  // If not linking to anything then look for <amp-img>.
113
  foreach ( $node->getElementsByTagName( 'amp-img' ) as $element ) {
114
  $url = $element->getAttribute('src');
@@ -341,14 +360,21 @@ class AMP_Gallery_Block_Sanitizer extends AMP_Base_Sanitizer {
341
  if ( $amp_image_lightbox ) {
342
  add_action('ampforwp_after_post_content', 'AMPforWP\\AMPVendor\\ampforwp_gallery_lightbox');
343
  }
 
 
 
344
  add_filter('amp_post_template_data','ampforwp_carousel_bind_script');
345
  add_action('amp_post_template_css', 'ampforwp_additional_style_carousel_caption');
346
  return $amp_carousel;
347
  }
348
  }
349
 
 
 
 
 
350
  function ampforwp_gal_des_2(){
351
- echo ".carousel-preview button{padding:0;}.carousel-preview amp-img{height:40px;width:60px;position:relative;}.carousel-preview {width: 100%;display: inline-block;text-align: center;margin: 20px 0px;}";
352
  }
353
  function ampforwp_gal_des_3(){
354
  echo '.gal_w{display:inline-block;width:100%}.gal_w amp-img{background:#f1f1f1;height:134px;width:150px;position: relative;float:left;margin:10px;}.cls-btn{background:#0d0d0d;border:none;position: absolute;right: 10px;}.cls-btn:after{content:"X";display:inline-block;color:#fff;font-size:20px;padding:20px;}';
109
  $images[] = $element;
110
  }
111
  }
112
+
113
+ if( $node->getElementsByTagName( 'amp-anim' )){
114
+ foreach ( $node->getElementsByTagName( 'amp-anim' ) as $element ) {
115
+ $url = $element->getAttribute('src');
116
+ $width = $element->getAttribute('width');
117
+ $height = $element->getAttribute('height');
118
+ $attachment_id = attachment_url_to_postid($url);
119
+ if ( empty( $images ) ) {
120
+ $images[] = $element;
121
+ }
122
+ $urls[] = apply_filters('amp_gallery_image_params', array(
123
+ 'url' => $url,
124
+ 'width' => $width,
125
+ 'height' => $height,
126
+ ),$attachment_id);
127
+
128
+ }
129
+ }
130
+
131
  // If not linking to anything then look for <amp-img>.
132
  foreach ( $node->getElementsByTagName( 'amp-img' ) as $element ) {
133
  $url = $element->getAttribute('src');
360
  if ( $amp_image_lightbox ) {
361
  add_action('ampforwp_after_post_content', 'AMPforWP\\AMPVendor\\ampforwp_gallery_lightbox');
362
  }
363
+ if($markup == 1){
364
+ add_action('amp_post_template_css', 'AMPforWP\\AMPVendor\\ampforwp_gal_des_1');
365
+ }
366
  add_filter('amp_post_template_data','ampforwp_carousel_bind_script');
367
  add_action('amp_post_template_css', 'ampforwp_additional_style_carousel_caption');
368
  return $amp_carousel;
369
  }
370
  }
371
 
372
+ function ampforwp_gal_des_1(){
373
+ echo '.cls-btn{background:#0d0d0d;border:none;position: absolute;right: 10px;}.cls-btn:after{content:"X";display:inline-block;color:#fff;font-size:20px;padding:20px;}';
374
+ }
375
+
376
  function ampforwp_gal_des_2(){
377
+ echo ".carousel-preview button{padding:0;}.carousel-preview amp-img{height:40px;width:60px;position:relative;}.carousel-preview {width: 100%;display: inline-block;text-align: center;margin: 20px 0px;}.cls-btn{background:#0d0d0d;border:none;position: absolute;right: 10px;}.cls-btn:after{content:\"X\";display:inline-block;color:#fff;font-size:20px;padding:20px;}";
378
  }
379
  function ampforwp_gal_des_3(){
380
  echo '.gal_w{display:inline-block;width:100%}.gal_w amp-img{background:#f1f1f1;height:134px;width:150px;position: relative;float:left;margin:10px;}.cls-btn{background:#0d0d0d;border:none;position: absolute;right: 10px;}.cls-btn:after{content:"X";display:inline-block;color:#fff;font-size:20px;padding:20px;}';
includes/vendor/vendor-changelog.txt CHANGED
@@ -72,4 +72,6 @@ Reason: To extend the functionality of sidebars and Pagebuilder
72
  45. class-amp-iframe-sanitizer.php updated #2836
73
  45. Class-amp-gallery-block-sanitizer file Updated for new Gallery Designs #2868
74
  45. Added class-amp-gallery-block-sanitizer.php, class-amp-block-sanitizer.php in Vendor AMP Sanitizers and class-amp-core-block-handler.php in Vendor AMP Embed Handlers #2427
75
- 45. Added a filter called ampforwp_featured_image_size, so users can change the default size of featured image in single post. #2896
 
 
72
  45. class-amp-iframe-sanitizer.php updated #2836
73
  45. Class-amp-gallery-block-sanitizer file Updated for new Gallery Designs #2868
74
  45. Added class-amp-gallery-block-sanitizer.php, class-amp-block-sanitizer.php in Vendor AMP Sanitizers and class-amp-core-block-handler.php in Vendor AMP Embed Handlers #2427
75
+ 45. Added a filter called ampforwp_featured_image_size, so users can change the default size of featured image in single post. #2896
76
+ 46. Class-amp-gallery-block-sanitizer file updated for Gallery with GIF Image not working issue #3304
77
+ 47. class-amp-allowed-tag-generated.php added amp-recaptcha-input support #3315
pagebuilder/amp-page-builder.php CHANGED
@@ -132,7 +132,7 @@ function ampforwp_call_page_builder(){
132
  wp_nonce_field( basename( __FILE__) , 'amp_content_editor_nonce' );
133
 
134
  if(class_exists('WPSEO_Frontend') && true == ampforwp_get_setting('ampforwp-yoast-seo-analysis') && true == ampforwp_get_setting('ampforwp-amp-takeover') ) { ?>
135
- <div class="hide" id="amp-page-builder-ready"><?php echo stripcslashes( amppb_post_content('') ); ?></div>
136
  <?php } ?>
137
  <div id="ampForWpPageBuilder_container">
138
  <div id="start_amp_pb_post" class="start_amp_pb" data-postId="<?php echo esc_attr(get_the_ID()) ?>" v-if="startPagebuilder==0" @click="amppb_startFunction($event)"><?php echo esc_html__('Start the AMP Page Builder','accelerated-mobile-pages'); ?></div>
132
  wp_nonce_field( basename( __FILE__) , 'amp_content_editor_nonce' );
133
 
134
  if(class_exists('WPSEO_Frontend') && true == ampforwp_get_setting('ampforwp-yoast-seo-analysis') && true == ampforwp_get_setting('ampforwp-amp-takeover') ) { ?>
135
+ <script type="text/template" class="hide" id="amp-page-builder-ready"><?php echo stripcslashes( amppb_post_content('') ); ?></script>
136
  <?php } ?>
137
  <div id="ampForWpPageBuilder_container">
138
  <div id="start_amp_pb_post" class="start_amp_pb" data-postId="<?php echo esc_attr(get_the_ID()) ?>" v-if="startPagebuilder==0" @click="amppb_startFunction($event)"><?php echo esc_html__('Start the AMP Page Builder','accelerated-mobile-pages'); ?></div>
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.2.1
7
- Stable tag: 0.9.97.58
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -190,36 +190,38 @@ You can contact us from [here](https://ampforwp.com/contact/)
190
 
191
  == Changelog ==
192
 
193
- = 0.9.97.58 (14th June 2019) =
194
- * Improvements: Option for H1-H6 Heading Font Sizes for all the designs #3035
195
- * Improvements: New filter to add the classes which have to be excluded in infinity scroll #3297
196
- * Improvements: Additional options for the Rank Math SEO plugin #3314
197
- * Improvements: Purge AMP CDN Cache added in Extension List #3324
198
- * Fixed: After v0.9.97.57 error can't disable featured image #3272
199
- * Fixed: Amp options panel's section code improved #3205
200
- * Fixed: Matemo Switch UI issue #3041
201
- * Fixed: Redux options for translating the field #2460
202
- * Fixed: Problem with pagination links in AMP #3313
203
- * Fixed: AMP Page Builder options not working due to Groovy Menu Plugin #3226
204
- * Fixed: Analytics not working due to Glue for Yoast SEO & AMP plugin #3153
205
- * Fixed: Yoast Meta Description not being picked up #3290
206
- * Fixed: ampforwp_new_gallery_images called multiple times resulting Fatal Error #3296
207
- * Fixed: Error message comes after search in post or page in Swift theme #3309
208
- * Fixed: Pages redirect to /amp/amp after last update #3270
209
- * Fixed: Archive and Categoy not working properly with Swift design #3265
210
- * Fixed: Fatal error when remove author meta name and date on AMP posts/articles in design-2 #3260
211
- * Fixed: Lightbox for image does not work when link [anchor tag] attached to images #2695
212
- * Fixed: Webp as featured image is not working in the single posts #2996
213
- * Fixed: Redirection issue when visiting AMP version after clicking Non-AMP link in Header #2940
214
- * Fixed: code imporved in the amp_loop_image #3084
215
- * Fixed: Sidebar breaks the blog page design #3056
216
- * Fixed: In content related posts in Design-3 images are not showing #3109
217
- * Fixed: Close Button is not coming in iphone in swift theme #3107
218
- * Fixed: AMP strings are not translatable #3169
219
- * Fixed: Option Panel's tooltips code updated #3172
220
- * Fixed: Table style is not loading in AMP Page #3204
221
- * Fixed: H1 tag on Logo in design-swift #3231
222
- * Fixed: Color of button not working properly in design-swift #3216
223
- * Fixed: PHP Debug warning fixed #3128
 
 
224
 
225
  Full changelog available [ at changelog.txt](https://plugins.svn.wordpress.org/accelerated-mobile-pages/trunk/changelog.txt)
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.2.1
7
+ Stable tag: 0.9.97.59
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
190
 
191
  == Changelog ==
192
 
193
+ = 0.9.97.59 (21th June 2019) =
194
+ * Improvements: WP Recipe Maker & WP Recipe Maker PRO Schema compatibility added #3043
195
+ * Improvements: Impreza Theme's lazyLoad Option compatibility integrated #3259
196
+ * Improvements: WordPress Content Gallery integrated with Design - 1,2 & 3 #3255
197
+ * Improvements: amp-recaptcha-input support added in allowed tag sanitizer #3315
198
+ * Improvements: Yoast 11.4 Schema Compatibility #3332
199
+ * Improvements: Google Tag Manager Advanced Option integrated #2660
200
+ * Fixed: Disqus comments are not loading in the multilingual slug #3106
201
+ * Fixed: Incorrect escaping done on author name when Link to Author Pages is enabled along with the Co-Authors plugin activate [ Theme-Swift ] #3162
202
+ * Fixed: AMP Panel options code improved #2517
203
+ * Fixed: License key code improved #2528
204
+ * Fixed: When site url is different from home url #2881
205
+ * Fixed: Related Posts Design is coming in all the single page designs in AMP Layouts #3091
206
+ * Fixed: CM Tooltip Glossary custom post types are not working with /amp #2882
207
+ * Fixed: Variables replacing in Advanced Google Analytics config code don't work #3237
208
+ * Fixed: "Optimize For Viewability" option for Ads improved #3142
209
+ * Fixed: Advertisement section Ads are not working through Google search result #2693
210
+ * Fixed: When AMP takeover and yoast seo is activated,AMP page builder is not working #3292
211
+ * Fixed: link="next" is appearing in the custom front page #3266
212
+ * Fixed: 404 error when custom post type and page having same slug [Bug for the Rare use case] #2374
213
+ * Fixed: Code improved for attribute layout=responsive in amp-img #3248
214
+ * Fixed: Gallery Lightbox feature code improved #3184
215
+ * Fixed: Elementor stops working when AMP Take Over is enabled #3284
216
+ * Fixed: Activating Thrive lead plugin AMP Page builder doesn't work on the custom front page #3312
217
+ * Fixed: To many redirection issue with hidden post in IOS #3287
218
+ * Fixed: Gallery with GIF is not working #3304
219
+ * Fixed: Indexing Issue of Plugin File #3271
220
+ * Fixed: Post/page throwing an error on hiding AMP for that particular post/page if AMP takeover option is enabled. #3329
221
+ * Fixed: Addthis Sharing default option code improved #3327
222
+ * Fixed: When Custom frontpage option is enabled, it's not taking the Polylang static page id #3330
223
+ * Fixed: Webp image format as featured image is not working in the single posts #2996
224
+ * Fixed: Improper amphtml on HomePage when WPML is activate #3341
225
+ * Fixed: Schema not generating after 0.9.97.57 #3344
226
 
227
  Full changelog available [ at changelog.txt](https://plugins.svn.wordpress.org/accelerated-mobile-pages/trunk/changelog.txt)
templates/category-widget.php CHANGED
@@ -62,7 +62,7 @@ class AMPFORWP_Categories_Widget extends WP_Widget {
62
  <?php if ( ampforwp_has_post_thumbnail() ) {
63
  $thumb_url = ampforwp_get_post_thumbnail('url');
64
  ?>
65
- <a href="<?php echo esc_url(ampforwp_url_controller($ampforwp_post_url));?>"><amp-img class="ampforwp_wc_shortcode_img" src=<?php echo $thumb_url ?> width=150 height=150 layout=responsive></amp-img></a>
66
  <?php } ?>
67
 
68
  <a class="ampforwp_wc_shortcode_title" href="<?php echo ampforwp_url_controller($ampforwp_post_url) ;?>">
62
  <?php if ( ampforwp_has_post_thumbnail() ) {
63
  $thumb_url = ampforwp_get_post_thumbnail('url');
64
  ?>
65
+ <a href="<?php echo esc_url(ampforwp_url_controller($ampforwp_post_url));?>"><amp-img class="ampforwp_wc_shortcode_img" src=<?php echo $thumb_url ?> width=150 height=150 layout="responsive"></amp-img></a>
66
  <?php } ?>
67
 
68
  <a class="ampforwp_wc_shortcode_title" href="<?php echo ampforwp_url_controller($ampforwp_post_url) ;?>">
templates/design-manager/design-1/elements/featured-image.php CHANGED
@@ -30,7 +30,7 @@ if($featured_image || ( ampforwp_is_custom_field_featured_image() && ampforwp_cf
30
  $amp_img_width = ampforwp_cf_featured_image_src('width');
31
  $amp_img_height = ampforwp_cf_featured_image_src('height');
32
  if( $amp_img_src ){
33
- $amp_html = "<amp-img src='$amp_img_src' width=$amp_img_width height=$amp_img_height layout=responsive ></amp-img>";
34
  }
35
  }
36
  elseif ( true == ampforwp_get_setting('ampforwp-featured-image-from-content') && ampforwp_get_featured_image_from_content()) {
30
  $amp_img_width = ampforwp_cf_featured_image_src('width');
31
  $amp_img_height = ampforwp_cf_featured_image_src('height');
32
  if( $amp_img_src ){
33
+ $amp_html = "<amp-img src='$amp_img_src' width=$amp_img_width height=$amp_img_height layout='responsive' ></amp-img>";
34
  }
35
  }
36
  elseif ( true == ampforwp_get_setting('ampforwp-featured-image-from-content') && ampforwp_get_featured_image_from_content()) {
templates/design-manager/design-2/elements/featured-image.php CHANGED
@@ -30,7 +30,7 @@ if( $featured_image || ( ampforwp_is_custom_field_featured_image() && ampforwp_c
30
  $amp_img_width = ampforwp_cf_featured_image_src('width');
31
  $amp_img_height = ampforwp_cf_featured_image_src('height');
32
  if( $amp_img_src ){
33
- $amp_html = "<amp-img src='$amp_img_src' width=$amp_img_width height=$amp_img_height layout=responsive ></amp-img>";
34
  }
35
  }
36
  elseif ( true == ampforwp_get_setting('ampforwp-featured-image-from-content') && ampforwp_get_featured_image_from_content() ){
30
  $amp_img_width = ampforwp_cf_featured_image_src('width');
31
  $amp_img_height = ampforwp_cf_featured_image_src('height');
32
  if( $amp_img_src ){
33
+ $amp_html = "<amp-img src='$amp_img_src' width=$amp_img_width height=$amp_img_height layout='responsive' ></amp-img>";
34
  }
35
  }
36
  elseif ( true == ampforwp_get_setting('ampforwp-featured-image-from-content') && ampforwp_get_featured_image_from_content() ){
templates/design-manager/design-3/elements/featured-image.php CHANGED
@@ -30,7 +30,7 @@ if($featured_image || ( ampforwp_is_custom_field_featured_image() && ampforwp_cf
30
  $amp_img_width = ampforwp_cf_featured_image_src('width');
31
  $amp_img_height = ampforwp_cf_featured_image_src('height');
32
  if( $amp_img_src ){
33
- $amp_html = "<amp-img src='$amp_img_src' width=$amp_img_width height=$amp_img_height layout=responsive ></amp-img>";
34
  }
35
  }
36
  elseif ( true == ampforwp_get_setting('ampforwp-featured-image-from-content') && ampforwp_get_featured_image_from_content() ){
30
  $amp_img_width = ampforwp_cf_featured_image_src('width');
31
  $amp_img_height = ampforwp_cf_featured_image_src('height');
32
  if( $amp_img_src ){
33
+ $amp_html = "<amp-img src='$amp_img_src' width=$amp_img_width height=$amp_img_height layout='responsive' ></amp-img>";
34
  }
35
  }
36
  elseif ( true == ampforwp_get_setting('ampforwp-featured-image-from-content') && ampforwp_get_featured_image_from_content() ){
templates/design-manager/swift/index.php CHANGED
@@ -33,7 +33,9 @@
33
  array('author_pub_name'=>true,)
34
  ); ?>
35
  </div>
36
- <?php if( ampforwp_check_excerpt() ) { amp_loop_excerpt(50); } ?>
 
 
37
  </div>
38
  </div>
39
  <?php } else {
33
  array('author_pub_name'=>true,)
34
  ); ?>
35
  </div>
36
+ <?php if( ampforwp_check_excerpt() ) {
37
+ amp_loop_excerpt(ampforwp_get_setting('amp-swift-excerpt-len'));
38
+ } ?>
39
  </div>
40
  </div>
41
  <?php } else {
templates/design-manager/swift/single.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php global $redux_builder_amp; ?>
2
  <?php amp_header(); ?>
3
- <?php if($redux_builder_amp['single-design-type'] == '1'){?>
4
  <div class="sp sgl">
5
  <?php if(!checkAMPforPageBuilderStatus(get_the_ID())){ ?>
6
  <div class="cntr">
@@ -129,8 +129,8 @@
129
  <?php
130
  do_action("ampforwp_single_design_type_handle_d1");
131
  ?>
132
- <?php if($redux_builder_amp['rp_design_type'] == '2'){
133
- if ( isset($redux_builder_amp['ampforwp-single-related-posts-switch']) && $redux_builder_amp['ampforwp-single-related-posts-switch'] && !checkAMPforPageBuilderStatus(get_the_ID()) ) {
134
  $my_query = ampforwp_related_post_loop_query();
135
  if( $my_query->have_posts() ) { $r_count = 1;?>
136
  <div class="srp">
@@ -163,7 +163,7 @@ do_action("ampforwp_single_design_type_handle_d1");
163
  </div>
164
  </div>
165
  <?php wp_reset_postdata(); } } ?>
166
- <?php if(ampforwp_get_setting('rp_design_type') == '3'){
167
  if ( true == ampforwp_get_setting('ampforwp-single-related-posts-switch') && !checkAMPforPageBuilderStatus(get_the_ID()) ) {
168
  $my_query = ampforwp_related_post_loop_query();
169
  if( $my_query->have_posts() ) { $r_count = 1;?>
1
  <?php global $redux_builder_amp; ?>
2
  <?php amp_header(); ?>
3
+ <?php if(ampforwp_get_setting('single-design-type') == '1'){?>
4
  <div class="sp sgl">
5
  <?php if(!checkAMPforPageBuilderStatus(get_the_ID())){ ?>
6
  <div class="cntr">
129
  <?php
130
  do_action("ampforwp_single_design_type_handle_d1");
131
  ?>
132
+ <?php if( ampforwp_get_setting('single-design-type') == '1' && ampforwp_get_setting('rp_design_type') == '2'){
133
+ if ( true == ampforwp_get_setting('ampforwp-single-related-posts-switch') && !checkAMPforPageBuilderStatus(get_the_ID()) ) {
134
  $my_query = ampforwp_related_post_loop_query();
135
  if( $my_query->have_posts() ) { $r_count = 1;?>
136
  <div class="srp">
163
  </div>
164
  </div>
165
  <?php wp_reset_postdata(); } } ?>
166
+ <?php if( ampforwp_get_setting('single-design-type') == '1' && ampforwp_get_setting('rp_design_type') == '3'){
167
  if ( true == ampforwp_get_setting('ampforwp-single-related-posts-switch') && !checkAMPforPageBuilderStatus(get_the_ID()) ) {
168
  $my_query = ampforwp_related_post_loop_query();
169
  if( $my_query->have_posts() ) { $r_count = 1;?>
templates/features.php CHANGED
@@ -400,6 +400,8 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
400
  }
401
  }
402
  }
 
 
403
  }
404
  }
405
  }
@@ -1095,6 +1097,10 @@ function ampforwp_remove_schema_data() {
1095
  ampforwp_remove_filters_for_class( 'the_content', 'A3_Lazy_Load', 'filter_content_images', 100 );
1096
  //optimole plugin images get removed in AMP #3073
1097
  ampforwp_remove_filters_for_class( 'optml_content_url', 'Optml_Url_Replacer', 'build_image_url', 1, 2 );
 
 
 
 
1098
  //SiteOrigin Page builder compatibilty with AMP Frontpage
1099
  if ( ampforwp_is_front_page() ) {
1100
  ampforwp_remove_filters_for_class( 'the_content', 'SiteOrigin_Panels', 'generate_post_content', 10 );
@@ -1164,6 +1170,9 @@ function ampforwp_remove_schema_data() {
1164
  remove_filter( 'wp_calculate_image_srcset', 'rocket_protocol_rewrite_srcset', PHP_INT_MAX );
1165
  }
1166
  }
 
 
 
1167
  // Publisher theme lazy load #3063
1168
  if( class_exists('Publisher') ){
1169
  remove_filter( 'post_thumbnail_html', 'publisher_lazy_loading_img_tags', 6 );
@@ -2045,7 +2054,7 @@ function ampforwp_add_disqus_support() {
2045
 
2046
  if ( $redux_builder_amp['ampforwp-disqus-comments-support'] && 4 != $redux_builder_amp['amp-design-selector'] && $display_comments_on ) {
2047
  if( $redux_builder_amp['ampforwp-disqus-comments-name'] !== '' ) {
2048
- global $post; $post_slug=$post->post_name;
2049
 
2050
  $disqus_script_host_url = "https://ampforwp.appspot.com/?api=". AMPFORWP_DISQUS_URL;
2051
 
@@ -2053,7 +2062,7 @@ function ampforwp_add_disqus_support() {
2053
  $disqus_script_host_url = esc_url( $redux_builder_amp['ampforwp-disqus-host-file'] );
2054
  }
2055
 
2056
- $disqus_url = $disqus_script_host_url.'?disqus_title='.$post_slug.'&url='.get_permalink().'&disqus_name='. esc_url( $redux_builder_amp['ampforwp-disqus-comments-name'] ) ."/embed.js" ;
2057
  ?>
2058
  <section class="amp-wp-content post-comments amp-wp-article-content amp-disqus-comments" id="comments">
2059
  <amp-iframe
@@ -4359,31 +4368,7 @@ if( ! function_exists( 'featured_image_content_filter' ) ){
4359
  }
4360
 
4361
 
4362
- // 83. Advance Analytics(Google Analytics)
4363
- add_filter('ampforwp_advance_google_analytics','ampforwp_add_advance_ga_fields');
4364
- function ampforwp_add_advance_ga_fields($ga_fields){
4365
- global $redux_builder_amp, $post;
4366
- $url = $title = $id = $author_id = $author_name = '';
4367
- $url = get_the_permalink();
4368
- if(!is_object($post)){ return $ga_fields; }
4369
- $title = $post->post_title;
4370
- $id = $post->ID;
4371
- $author_id = $post->post_author;
4372
- $author_name = get_the_author_meta( 'display_name' , $author_id );
4373
- $ampforwp_adv_ga_fields = array();
4374
- $ampforwp_adv_ga_fields = $redux_builder_amp['ampforwp-ga-field-advance'];
4375
- if($ampforwp_adv_ga_fields && $redux_builder_amp['ampforwp-ga-field-advance-switch']) {
4376
- $ampforwp_adv_ga_fields = str_replace('{url}', $url, $ampforwp_adv_ga_fields);
4377
- $ampforwp_adv_ga_fields = str_replace('{id}', $id, $ampforwp_adv_ga_fields);
4378
- $ampforwp_adv_ga_fields = str_replace('{title}', $title, $ampforwp_adv_ga_fields);
4379
- $ampforwp_adv_ga_fields = str_replace('{author_name}', $author_name, $ampforwp_adv_ga_fields);
4380
- $ampforwp_adv_ga_fields = str_replace('{author_id}', $author_id, $ampforwp_adv_ga_fields);
4381
- $ampforwp_adv_ga_fields = preg_replace('!//.*!', '', $ampforwp_adv_ga_fields);
4382
- $ampforwp_adv_ga_fields = preg_replace('!/\*.*?\*/!s', '', $ampforwp_adv_ga_fields);
4383
- return $ampforwp_adv_ga_fields;
4384
- }
4385
- return $ga_fields;
4386
- }
4387
  // 84. Inline Related Posts
4388
 
4389
  function ampforwp_inline_related_posts(){
@@ -5969,24 +5954,14 @@ function ampforwp_back_to_top_markup(){
5969
  }
5970
  }
5971
 
5972
-
5973
- // Function to check if the query and the post name are same #2361
5974
- function ampforwp_is_query_post_same($haystack = '' , $needle = ''){
5975
- $result = '';
5976
- if(!empty($haystack) && !empty($needle)){
5977
- $result = strpos($haystack ,$needle);
5978
- }
5979
- if( ($result != false || is_int($result)) && !empty($result) ){
5980
- return true;
5981
- }
5982
- return false;
5983
- }
5984
-
5985
  // rel="next" & rel="prev" pagination meta tags #2343
5986
  add_action( 'amp_post_template_head', 'ampforwp_rel_next_prev' );
5987
 
5988
  function ampforwp_rel_next_prev(){
5989
  global $paged;
 
 
 
5990
  if ( get_previous_posts_link() ) { ?>
5991
  <link rel="prev" href="<?php echo esc_url(get_pagenum_link( $paged - 1 )); ?>" /><?php
5992
  }
@@ -6052,7 +6027,9 @@ function ampforwp_sneak_peek_scripts($data) {
6052
  add_action('amp_init','ampforwp_thrive_architect_content');
6053
  function ampforwp_thrive_architect_content(){
6054
  if(function_exists('tve_wp_action') && !function_exists('et_setup_theme')){
6055
- add_filter( 'ampforwp_modify_the_content','ampforwp_thrive_content');
 
 
6056
  }
6057
  }
6058
  function ampforwp_thrive_content($content){
@@ -6426,6 +6403,18 @@ function ampforwp_bulktool_takeover($data){
6426
  }
6427
  }
6428
 
 
 
 
 
 
 
 
 
 
 
 
 
6429
  // Multiple Images #2259
6430
  // Moved to structured-data-functions.php
6431
 
@@ -6684,7 +6673,7 @@ function ampforwp_webp_featured_image() {
6684
  $image_output = "<amp-img src='".esc_url($image[0])."' width='".esc_attr($image[1])."' height='".esc_attr($image[2])."' layout='responsive' ></amp-img>";?>
6685
  <figure class="amp-wp-article-featured-image">
6686
  <?php
6687
- if(4 != ampforwp_get_setting('amp-design-selector')){
6688
  echo $image_output;
6689
  }
6690
  ?>
400
  }
401
  }
402
  }
403
+ }else{
404
+ $amp_url = ampforwp_url_purifier($amp_url);
405
  }
406
  }
407
  }
1097
  ampforwp_remove_filters_for_class( 'the_content', 'A3_Lazy_Load', 'filter_content_images', 100 );
1098
  //optimole plugin images get removed in AMP #3073
1099
  ampforwp_remove_filters_for_class( 'optml_content_url', 'Optml_Url_Replacer', 'build_image_url', 1, 2 );
1100
+ // Yoast Schema Compatibility #3332
1101
+ if( ampforwp_get_setting('ampforwp-seo-selection') != "yoast"){
1102
+ ampforwp_remove_filters_for_class( 'amp_post_template_head', 'WPSEO_Schema', 'json_ld', 9 );
1103
+ }
1104
  //SiteOrigin Page builder compatibilty with AMP Frontpage
1105
  if ( ampforwp_is_front_page() ) {
1106
  ampforwp_remove_filters_for_class( 'the_content', 'SiteOrigin_Panels', 'generate_post_content', 10 );
1170
  remove_filter( 'wp_calculate_image_srcset', 'rocket_protocol_rewrite_srcset', PHP_INT_MAX );
1171
  }
1172
  }
1173
+ //remove filter for Impreza theme lazyload feature
1174
+ remove_filter( 'the_content', 'us_filter_content_for_lazy_load', 99, 1 );
1175
+
1176
  // Publisher theme lazy load #3063
1177
  if( class_exists('Publisher') ){
1178
  remove_filter( 'post_thumbnail_html', 'publisher_lazy_loading_img_tags', 6 );
2054
 
2055
  if ( $redux_builder_amp['ampforwp-disqus-comments-support'] && 4 != $redux_builder_amp['amp-design-selector'] && $display_comments_on ) {
2056
  if( $redux_builder_amp['ampforwp-disqus-comments-name'] !== '' ) {
2057
+ global $post; $post_slug = rawurlencode($post->post_name);
2058
 
2059
  $disqus_script_host_url = "https://ampforwp.appspot.com/?api=". AMPFORWP_DISQUS_URL;
2060
 
2062
  $disqus_script_host_url = esc_url( $redux_builder_amp['ampforwp-disqus-host-file'] );
2063
  }
2064
 
2065
+ $disqus_url = $disqus_script_host_url.'?disqus_title='.$post_slug.'&url='.rawurlencode(get_permalink()).'&disqus_name='. esc_url( $redux_builder_amp['ampforwp-disqus-comments-name'] ) ."/embed.js" ;
2066
  ?>
2067
  <section class="amp-wp-content post-comments amp-wp-article-content amp-disqus-comments" id="comments">
2068
  <amp-iframe
4368
  }
4369
 
4370
 
4371
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4372
  // 84. Inline Related Posts
4373
 
4374
  function ampforwp_inline_related_posts(){
5954
  }
5955
  }
5956
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5957
  // rel="next" & rel="prev" pagination meta tags #2343
5958
  add_action( 'amp_post_template_head', 'ampforwp_rel_next_prev' );
5959
 
5960
  function ampforwp_rel_next_prev(){
5961
  global $paged;
5962
+ if(ampforwp_is_front_page()){
5963
+ return ;
5964
+ }
5965
  if ( get_previous_posts_link() ) { ?>
5966
  <link rel="prev" href="<?php echo esc_url(get_pagenum_link( $paged - 1 )); ?>" /><?php
5967
  }
6027
  add_action('amp_init','ampforwp_thrive_architect_content');
6028
  function ampforwp_thrive_architect_content(){
6029
  if(function_exists('tve_wp_action') && !function_exists('et_setup_theme')){
6030
+ if(checkAMPforPageBuilderStatus(ampforwp_get_the_ID())){
6031
+ add_filter( 'ampforwp_modify_the_content','ampforwp_thrive_content');
6032
+ }
6033
  }
6034
  }
6035
  function ampforwp_thrive_content($content){
6403
  }
6404
  }
6405
 
6406
+ add_filter('ampforwp_is_amp_endpoint_takeover','ampforwp_disable_takovr_elementor_preview');
6407
+ function ampforwp_disable_takovr_elementor_preview($data){
6408
+ if ( did_action( 'elementor/loaded' ) ) {
6409
+ if( \Elementor\Plugin::$instance->preview->is_preview_mode() ){
6410
+ return false;
6411
+ }else{
6412
+ return $data;
6413
+ }
6414
+ }
6415
+ return $data;
6416
+ }
6417
+
6418
  // Multiple Images #2259
6419
  // Moved to structured-data-functions.php
6420
 
6673
  $image_output = "<amp-img src='".esc_url($image[0])."' width='".esc_attr($image[1])."' height='".esc_attr($image[2])."' layout='responsive' ></amp-img>";?>
6674
  <figure class="amp-wp-article-featured-image">
6675
  <?php
6676
+ if(1 == ampforwp_get_setting('amp-design-selector') || 2 == ampforwp_get_setting('amp-design-selector') || 3 == ampforwp_get_setting('amp-design-selector')){
6677
  echo $image_output;
6678
  }
6679
  ?>