AMP for WP – Accelerated Mobile Pages - Version 0.9.97.28

Version Description

(29th January 2019) = * Added: Lightbox feature for Carousel #2731 * Added: Specific filters to modify the analytics code #2653 * Fixed: Homepage Blog CSS is loading on the custom frontpage in swift theme #2754 * Fixed: Reset all & Reset section issue for redux framework #2722 * Fixed: Transable redux fields for other plugins like wpml #2737 * Fixed: Proper condition for Ads css #2758 * Fixed: Jetpack stats pixel inserted twice since Jetpack v6.9 #2812 * Fixed: AMP pagebuilder full width for posts #2765 * Fixed: Undefined non-content in blacklist-sanitizer #2842 * Fixed: Blog title is displaying on Homepage when static front page is selected in All in one SEO & Yoast #2816

Full changelog available in changelog.txt

Download this release

Release Info

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

Code changes from version 0.9.97.27 to 0.9.97.28

README.md CHANGED
@@ -4,7 +4,7 @@ Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, go
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.0.3
7
- Stable tag: 0.9.97.27
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -184,6 +184,18 @@ You can contact us from [here](https://ampforwp.com/contact/)
184
 
185
  == Changelog ==
186
 
 
 
 
 
 
 
 
 
 
 
 
 
187
  = 0.9.97.27 (23rd January 2019) =
188
  * Added: ampforwp_is_amp_endpoint_takeover filter added
189
  * Fixed: The attribute 'action' may not appear in tag 'FORM [method=POST]' #2835
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.0.3
7
+ Stable tag: 0.9.97.28
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
184
 
185
  == Changelog ==
186
 
187
+ = 0.9.97.28 (29th January 2019) =
188
+ * Added: Lightbox feature for Carousel #2731
189
+ * Added: Specific filters to modify the analytics code #2653
190
+ * Fixed: Homepage Blog CSS is loading on the custom frontpage in swift theme #2754
191
+ * Fixed: Reset all & Reset section issue for redux framework #2722
192
+ * Fixed: Transable redux fields for other plugins like wpml #2737
193
+ * Fixed: Proper condition for Ads css #2758
194
+ * Fixed: Jetpack stats pixel inserted twice since Jetpack v6.9 #2812
195
+ * Fixed: AMP pagebuilder full width for posts #2765
196
+ * Fixed: Undefined “non-content” in blacklist-sanitizer #2842
197
+ * Fixed: Blog title is displaying on Homepage when static front page is selected in All in one SEO & Yoast #2816
198
+
199
  = 0.9.97.27 (23rd January 2019) =
200
  * Added: ampforwp_is_amp_endpoint_takeover filter added
201
  * Fixed: The attribute 'action' may not appear in tag 'FORM [method=POST]' #2835
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.27
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.27');
24
  // any changes to AMP_QUERY_VAR should be refelected here
25
  function ampforwp_generate_endpoint(){
26
  $ampforwp_slug = '';
@@ -650,7 +650,7 @@ if ( ! function_exists('ampforwp_init') ) {
650
  // Redirect the old url of amp page to the updated url. #1033 (Vendor Update)
651
  add_filter( 'old_slug_redirect_url', 'ampforwp_redirect_old_slug_to_new_url' );
652
 
653
- if ( class_exists( 'Jetpack' ) && ! (defined( 'IS_WPCOM' ) && IS_WPCOM) ) {
654
  require_once( AMP__DIR__ . '/jetpack-helper.php' );
655
  }
656
  }
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.28
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.28');
24
  // any changes to AMP_QUERY_VAR should be refelected here
25
  function ampforwp_generate_endpoint(){
26
  $ampforwp_slug = '';
650
  // Redirect the old url of amp page to the updated url. #1033 (Vendor Update)
651
  add_filter( 'old_slug_redirect_url', 'ampforwp_redirect_old_slug_to_new_url' );
652
 
653
+ if ( class_exists( 'Jetpack' ) && ! (defined( 'IS_WPCOM' ) && IS_WPCOM) && ( defined('JETPACK__VERSION') && JETPACK__VERSION < 6.9 ) ) {
654
  require_once( AMP__DIR__ . '/jetpack-helper.php' );
655
  }
656
  }
changelog.txt CHANGED
@@ -1,5 +1,17 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 0.9.97.27 (23rd January 2019) =
4
  * Added: ampforwp_is_amp_endpoint_takeover filter added
5
  * Fixed: The attribute 'action' may not appear in tag 'FORM [method=POST]' #2835
1
  == Changelog ==
2
 
3
+ = 0.9.97.28 (29th January 2019) =
4
+ * Added: Lightbox feature for Carousel #2731
5
+ * Added: Specific filters to modify the analytics code #2653
6
+ * Fixed: Homepage Blog CSS is loading on the custom frontpage in swift theme #2754
7
+ * Fixed: Reset all & Reset section issue for redux framework #2722
8
+ * Fixed: Transable redux fields for other plugins like wpml #2737
9
+ * Fixed: Proper condition for Ads css #2758
10
+ * Fixed: Jetpack stats pixel inserted twice since Jetpack v6.9 #2812
11
+ * Fixed: AMP pagebuilder full width for posts #2765
12
+ * Fixed: Undefined “non-content” in blacklist-sanitizer #2842
13
+ * Fixed: Blog title is displaying on Homepage when static front page is selected in All in one SEO & Yoast #2816
14
+
15
  = 0.9.97.27 (23rd January 2019) =
16
  * Added: ampforwp_is_amp_endpoint_takeover filter added
17
  * Fixed: The attribute 'action' may not appear in tag 'FORM [method=POST]' #2835
includes/options/admin-config.php CHANGED
@@ -6117,6 +6117,14 @@ $single_page_options = array(
6117
 
6118
  ),
6119
  ),
 
 
 
 
 
 
 
 
6120
  array(
6121
  'id' => 'single-sneakp-section',
6122
  'type' => 'section',
6117
 
6118
  ),
6119
  ),
6120
+ array(
6121
+ 'id' => 'ampforwp-gallery-lightbox',
6122
+ 'type' => 'switch',
6123
+ 'title' => esc_html__('Lightbox for Gallery', 'accelerated-mobile-pages'),
6124
+ 'class' => 'child_opt child_opt_arrow',
6125
+ 'default' => 1,
6126
+ 'required' => array('ampforwp-gallery-design-type' , '!=' , '3'),
6127
+ ),
6128
  array(
6129
  'id' => 'single-sneakp-section',
6130
  'type' => 'section',
includes/vendor/amp/includes/embeds/class-amp-gallery-embed.php CHANGED
@@ -114,19 +114,23 @@ class AMP_Gallery_Embed_Handler extends AMP_Base_Embed_Handler {
114
 
115
  /*Filter*/
116
  $carousel_markup = '';
 
117
 
118
  $carousel_markup_all = array(
119
  '1'=>array(
120
- 'main-html'=>'{{with_carousel}}',
121
- '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>',
 
122
  'image-without-caption-html' =>'<div class="ampforwp-gallery-item amp-carousel-container">{{main_images}} </div>',
123
  'gallery_css' => '',
124
 
125
  'scripts' => array()
126
  ),
127
  '2' => array(
128
- 'main-html'=>'{{with_carousel}} {{with_carousel_thumbnail}}',
129
- '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>',
 
 
130
  'image-without-caption-html' =>'<div class="ampforwp-gallery-item amp-carousel-container">{{main_images}} </div>',
131
  'carousel_with_thumbnail_html'=>'<button on="tap:carousel-with-carousel-preview-{{unique_id}}.goToSlide(index={{unique_index}})" class="amp-carousel-slide amp-scrollable-carousel-slide">{{thumbnail}}</button>',
132
  'gallery_css' => '
@@ -137,14 +141,8 @@ class AMP_Gallery_Embed_Handler extends AMP_Base_Embed_Handler {
137
  'scripts' => array()
138
  ),
139
  '3' => array(
140
- 'main-html'=>'<div class="wrapper">{{with_images}}</div>
141
- <amp-image-lightbox id="gallery-lightbox" layout="nodisplay">
142
- <div on="tap:gallery-lightbox.close" role="button"
143
- tabindex="0">
144
- <button class="cls-btn" on="tap:gallery-lightbox.close"
145
- role="button" tabindex="0"></button>
146
- </div>
147
- </amp-image-lightbox>',
148
  'image-with-caption-html'=>'',
149
  'image-without-caption-html' =>'{{main_images}}',
150
  'gallery_css' => '
@@ -177,10 +175,17 @@ class AMP_Gallery_Embed_Handler extends AMP_Base_Embed_Handler {
177
  'layout' => 'fill',
178
  'class' => 'amp-carousel-img',
179
  );
180
- if( isset($redux_builder_amp['ampforwp-gallery-design-type']) && $redux_builder_amp['ampforwp-gallery-design-type'] == 3 ){
181
  $design3_additional_attr = array('on'=> 'tap:gallery-lightbox', 'role'=>'button',
182
  'tabindex'=>$key);
183
  $amp_img_arr = array_merge($amp_img_arr, $design3_additional_attr);
 
 
 
 
 
 
 
184
  }
185
  $amp_images[$key] = AMP_HTML_Utils::build_tag(
186
  'amp-img',
@@ -248,6 +253,7 @@ class AMP_Gallery_Embed_Handler extends AMP_Base_Embed_Handler {
248
  //last changes
249
  $returnCompleteHtml = str_replace('{{with_carousel}}', $amp_carousel, $returnCompleteHtml);
250
  $returnCompleteHtml = str_replace('{{with_carousel_thumbnail}}', $amp_carousel_thumbnail, $returnCompleteHtml);
 
251
  $returnCompleteHtml = str_replace('{{with_images}}', implode( PHP_EOL, $images ), $returnCompleteHtml);
252
  return $returnCompleteHtml;
253
  }
114
 
115
  /*Filter*/
116
  $carousel_markup = '';
117
+ $carousel_markup = $amp_image_lightbox = '';
118
 
119
  $carousel_markup_all = array(
120
  '1'=>array(
121
+ 'main-html'=>'{{with_carousel}}
122
+ {{amp_image_lightbox}}',
123
+ '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>',
124
  'image-without-caption-html' =>'<div class="ampforwp-gallery-item amp-carousel-container">{{main_images}} </div>',
125
  'gallery_css' => '',
126
 
127
  'scripts' => array()
128
  ),
129
  '2' => array(
130
+ 'main-html'=>'{{with_carousel}}
131
+ {{with_carousel_thumbnail}}
132
+ {{amp_image_lightbox}}',
133
+ '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>',
134
  'image-without-caption-html' =>'<div class="ampforwp-gallery-item amp-carousel-container">{{main_images}} </div>',
135
  'carousel_with_thumbnail_html'=>'<button on="tap:carousel-with-carousel-preview-{{unique_id}}.goToSlide(index={{unique_index}})" class="amp-carousel-slide amp-scrollable-carousel-slide">{{thumbnail}}</button>',
136
  'gallery_css' => '
141
  'scripts' => array()
142
  ),
143
  '3' => array(
144
+ 'main-html'=>'<div class="gal_w">{{with_images}}</div>
145
+ {{amp_image_lightbox}}',
 
 
 
 
 
 
146
  'image-with-caption-html'=>'',
147
  'image-without-caption-html' =>'{{main_images}}',
148
  'gallery_css' => '
175
  'layout' => 'fill',
176
  'class' => 'amp-carousel-img',
177
  );
178
+ if( 3 == ampforwp_get_setting('ampforwp-gallery-design-type') || true == ampforwp_get_setting('ampforwp-gallery-lightbox') ){
179
  $design3_additional_attr = array('on'=> 'tap:gallery-lightbox', 'role'=>'button',
180
  'tabindex'=>$key);
181
  $amp_img_arr = array_merge($amp_img_arr, $design3_additional_attr);
182
+ $amp_image_lightbox = '<amp-image-lightbox id="gallery-lightbox" layout="nodisplay">
183
+ <div on="tap:gallery-lightbox.close" role="button"
184
+ tabindex="0">
185
+ <button class="cls-btn" on="tap:gallery-lightbox.close"
186
+ role="button" tabindex="0"></button>
187
+ </div>
188
+ </amp-image-lightbox>';
189
  }
190
  $amp_images[$key] = AMP_HTML_Utils::build_tag(
191
  'amp-img',
253
  //last changes
254
  $returnCompleteHtml = str_replace('{{with_carousel}}', $amp_carousel, $returnCompleteHtml);
255
  $returnCompleteHtml = str_replace('{{with_carousel_thumbnail}}', $amp_carousel_thumbnail, $returnCompleteHtml);
256
+ $returnCompleteHtml = str_replace('{{amp_image_lightbox}}', $amp_image_lightbox, $returnCompleteHtml);
257
  $returnCompleteHtml = str_replace('{{with_images}}', implode( PHP_EOL, $images ), $returnCompleteHtml);
258
  return $returnCompleteHtml;
259
  }
includes/vendor/amp/includes/sanitizers/class-amp-blacklist-sanitizer.php CHANGED
@@ -20,7 +20,7 @@ class AMP_Blacklist_Sanitizer extends AMP_Base_Sanitizer {
20
  public function sanitize() {
21
  $blacklisted_tags = $this->get_blacklisted_tags();
22
  // Blacklisted tags for non-content #2835
23
- if ( true === $this->args['non-content'] ) {
24
  $blacklisted_tags = ampforwp_sidebar_blacklist_tags($blacklisted_tags);
25
  }
26
  $blacklisted_attributes = $this->get_blacklisted_attributes();
20
  public function sanitize() {
21
  $blacklisted_tags = $this->get_blacklisted_tags();
22
  // Blacklisted tags for non-content #2835
23
+ if ( isset($this->args['non-content']) && true === $this->args['non-content'] ) {
24
  $blacklisted_tags = ampforwp_sidebar_blacklist_tags($blacklisted_tags);
25
  }
26
  $blacklisted_attributes = $this->get_blacklisted_attributes();
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, go
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.0.3
7
- Stable tag: 0.9.97.27
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -185,9 +185,16 @@ You can contact us from [here](https://ampforwp.com/contact/)
185
 
186
  == Changelog ==
187
 
188
- = 0.9.97.27 (23rd January 2019) =
189
- * Added: ampforwp_is_amp_endpoint_takeover filter added
190
- * Fixed: The attribute 'action' may not appear in tag 'FORM [method=POST]' #2835
191
- * Fixed: Image size smaller than recommended size Warning in Search console #2838
 
 
 
 
 
 
 
192
 
193
  Full changelog available in changelog.txt
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.0.3
7
+ Stable tag: 0.9.97.28
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
185
 
186
  == Changelog ==
187
 
188
+ = 0.9.97.28 (29th January 2019) =
189
+ * Added: Lightbox feature for Carousel #2731
190
+ * Added: Specific filters to modify the analytics code #2653
191
+ * Fixed: Homepage Blog CSS is loading on the custom frontpage in swift theme #2754
192
+ * Fixed: Reset all & Reset section issue for redux framework #2722
193
+ * Fixed: Transable redux fields for other plugins like wpml #2737
194
+ * Fixed: Proper condition for Ads css #2758
195
+ * Fixed: Jetpack stats pixel inserted twice since Jetpack v6.9 #2812
196
+ * Fixed: AMP pagebuilder full width for posts #2765
197
+ * Fixed: Undefined “non-content” in blacklist-sanitizer #2842
198
+ * Fixed: Blog title is displaying on Homepage when static front page is selected in All in one SEO & Yoast #2816
199
 
200
  Full changelog available in changelog.txt
templates/design-manager/swift/style.php CHANGED
@@ -224,7 +224,7 @@ padding: <?php echo $redux_builder_amp['primary-menu-padding-control']['padding-
224
  <?php } ?>
225
  <?php //Home and Archive
226
 
227
- if( is_home() || is_archive() || is_search() || (function_exists('is_shop') && is_shop()) ) { ?>
228
  .hmp{margin-top:34px;display:inline-block;width:100%; }
229
  .fbp{width:100%;display:inline-block;clear:both;margin:15px 15px 20px 15px;}
230
  .fbp-img a{display:block;line-height:0;}
@@ -398,10 +398,11 @@ p.nocomments {padding: 10px;color: #fff;}
398
  .sf-img figure{margin:0;}
399
  .sf-img .wp-caption-text{width: 1100px;text-align: left;margin: 0 auto;color: #a1a1a1;font-size: 14px;line-height:20px;font-weight: 500;border-bottom: 1px solid #ccc;padding: 15px 0px;}
400
  .sf-img .wp-caption-text:before{content:"\e412";font-family: 'icomoon';position: relative;top: 4px;opacity: 0.4;font-size:24pxmargin-right: 5px;}
 
401
  .sp-cnt{margin-top: 40px;clear: both;width: 100%;display: inline-block; }
402
  .sp-rl{display:inline-flex;width:100%;}
 
403
  .sp-lt{display: flex;flex-direction: column;flex: 1 0 20%;order: 0;max-width:237px;}
404
- .sp-rt{width: 72%;margin-left: 60px;flex-direction: column;justify-content: space-around;order: 1;}
405
  .ss-ic, .sp-athr, .amp-tags, .post-date{padding-bottom:20px;border-bottom:1px dotted #ccc;}
406
  .shr-txt, .athr-tx, .amp-tags > span:nth-child(1), .amp-related-posts-title, .related-title, .r-pf h3{margin-bottom: 12px;}
407
  .shr-txt, .athr-tx, .r-pf h3, .amp-tags > span:nth-child(1), .amp-related-posts-title, .post-date, .related-title{display: block;}
@@ -659,8 +660,10 @@ if ( isset($redux_builder_amp['ampforwp-disqus-comments-support']) && $redux_bui
659
  } ?>
660
 
661
  @media(max-width:1110px){
 
662
  .cntr{width:100%;padding:0px 20px;}
663
  .sp-rt {margin-left: 30px;}
 
664
  }
665
  @media(max-width:768px){
666
  .tl-exc {font-size: 14px;margin-top: 3px;line-height: 22px;}
@@ -687,6 +690,9 @@ if ( isset($redux_builder_amp['ampforwp-disqus-comments-support']) && $redux_bui
687
  .srp li .rlp-image{width:40%;float:left;margin-right:20px;}
688
  .srp li .rlp-cnt{width:54%;float:left;}
689
  <?php } //Related post Design 2 CSS Ends?>
 
 
 
690
  }
691
  @media(max-width:480px){
692
  .loop-wrapper{margin:0;}
@@ -1400,15 +1406,16 @@ if(isset($redux_builder_amp['enable-single-pocket-share']) && $redux_builder_amp
1400
  <?php } ?>
1401
  .content-wrapper a, .breadcrumb ul li a, .srp ul li, .rr a{transition: all 0.3s ease-in-out 0s;}
1402
  [class^="icon-"], [class*=" icon-"] {font-family: 'icomoon';speak: none;font-style: normal;font-weight: normal;font-variant: normal;text-transform: none;line-height: 1;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;}
1403
- .amp-ad-wrapper{width:100%;text-align:center;}
 
1404
  .amp-ad-wrapper span { display: inherit; font-size: 12px; line-height: 1;}
 
1405
  <?php if( isset($redux_builder_amp['enable-amp-ads-1'] ) && $redux_builder_amp['enable-amp-ads-1'] ) { ?>.amp_ad_1{margin: -2px 0px -17px 0px;}<?php }
1406
  if( isset($redux_builder_amp['enable-amp-ads-2'] ) && $redux_builder_amp['enable-amp-ads-2'] ) { ?>.amp_ad_2{margin: 20px 0px -23px 0px; }<?php }
1407
  if( isset($redux_builder_amp['enable-amp-ads-3'] ) && $redux_builder_amp['enable-amp-ads-3'] ) { ?>.amp-ad-3{margin: 0px 0px -4px 0px;}<?php }
1408
  if( isset($redux_builder_amp['enable-amp-ads-4'] ) && $redux_builder_amp['enable-amp-ads-4'] ) { ?>.amp_ad_4{margin: 20px 0px 20px 0px;}<?php }
1409
  if( isset($redux_builder_amp['enable-amp-ads-5'] ) && $redux_builder_amp['enable-amp-ads-5'] ) { ?>.amp_ad_5{margin: 10px 0px -17px 0px;}<?php }
1410
  if( isset($redux_builder_amp['enable-amp-ads-6'] ) && $redux_builder_amp['enable-amp-ads-6'] ) { ?>.amp-ad-6{ margin: 0px 0px 20px 0px;}<?php } ?>
1411
- .amp-ad-wrapper {margin-top: 10px; margin-bottom: 10px}
1412
  <?php if( true == $redux_builder_amp['amp-enable-notifications'] ) {?>
1413
  #amp-user-notification1{padding: 5px;text-align: center;background: #fff;border-top: 1px solid #005be2;}
1414
  #amp-user-notification1 p {display: inline-block;margin: 20px 0px;}
@@ -1581,4 +1588,7 @@ if (ampforwp_get_setting('enable-amp-ads-resp-6')){?>
1581
  line-height: 1;
1582
  }
1583
  .rr a#scrollToTopButton{color:#fff;}
1584
- <?php } ?>
 
 
 
224
  <?php } ?>
225
  <?php //Home and Archive
226
 
227
+ if( ampforwp_is_home() || is_archive() || is_search() || (function_exists('is_shop') && is_shop()) || ampforwp_is_blog() ) { ?>
228
  .hmp{margin-top:34px;display:inline-block;width:100%; }
229
  .fbp{width:100%;display:inline-block;clear:both;margin:15px 15px 20px 15px;}
230
  .fbp-img a{display:block;line-height:0;}
398
  .sf-img figure{margin:0;}
399
  .sf-img .wp-caption-text{width: 1100px;text-align: left;margin: 0 auto;color: #a1a1a1;font-size: 14px;line-height:20px;font-weight: 500;border-bottom: 1px solid #ccc;padding: 15px 0px;}
400
  .sf-img .wp-caption-text:before{content:"\e412";font-family: 'icomoon';position: relative;top: 4px;opacity: 0.4;font-size:24pxmargin-right: 5px;}
401
+ <?php if (!checkAMPforPageBuilderStatus(get_the_ID()) ){ ?>
402
  .sp-cnt{margin-top: 40px;clear: both;width: 100%;display: inline-block; }
403
  .sp-rl{display:inline-flex;width:100%;}
404
+ .sp-rt{width: 72%;margin-left: 60px;flex-direction: column;justify-content: space-around;order: 1;} <?php } ?>
405
  .sp-lt{display: flex;flex-direction: column;flex: 1 0 20%;order: 0;max-width:237px;}
 
406
  .ss-ic, .sp-athr, .amp-tags, .post-date{padding-bottom:20px;border-bottom:1px dotted #ccc;}
407
  .shr-txt, .athr-tx, .amp-tags > span:nth-child(1), .amp-related-posts-title, .related-title, .r-pf h3{margin-bottom: 12px;}
408
  .shr-txt, .athr-tx, .r-pf h3, .amp-tags > span:nth-child(1), .amp-related-posts-title, .post-date, .related-title{display: block;}
660
  } ?>
661
 
662
  @media(max-width:1110px){
663
+ <?php if (!checkAMPforPageBuilderStatus(get_the_ID())){ ?>
664
  .cntr{width:100%;padding:0px 20px;}
665
  .sp-rt {margin-left: 30px;}
666
+ <?php } ?>
667
  }
668
  @media(max-width:768px){
669
  .tl-exc {font-size: 14px;margin-top: 3px;line-height: 22px;}
690
  .srp li .rlp-image{width:40%;float:left;margin-right:20px;}
691
  .srp li .rlp-cnt{width:54%;float:left;}
692
  <?php } //Related post Design 2 CSS Ends?>
693
+ <?php if (checkAMPforPageBuilderStatus(get_the_ID())){ ?>
694
+ .sp-cnt{margin-top: 0;}
695
+ <?php } ?>
696
  }
697
  @media(max-width:480px){
698
  .loop-wrapper{margin:0;}
1406
  <?php } ?>
1407
  .content-wrapper a, .breadcrumb ul li a, .srp ul li, .rr a{transition: all 0.3s ease-in-out 0s;}
1408
  [class^="icon-"], [class*=" icon-"] {font-family: 'icomoon';speak: none;font-style: normal;font-weight: normal;font-variant: normal;text-transform: none;line-height: 1;-webkit-font-smoothing: antialiased;-moz-osx-font-smoothing: grayscale;}
1409
+ <?php if(true == ampforwp_get_setting('enable-amp-ads-1')||true == ampforwp_get_setting('enable-amp-ads-2')||true == ampforwp_get_setting('enable-amp-ads-3')||true == ampforwp_get_setting('enable-amp-ads-4')||true == ampforwp_get_setting('enable-amp-ads-5')||true == ampforwp_get_setting('enable-amp-ads-6')){?>
1410
+ body .amp-ad-wrapper{width:100%;text-align:center;margin: 10px 0;}
1411
  .amp-ad-wrapper span { display: inherit; font-size: 12px; line-height: 1;}
1412
+ <?php } ?>
1413
  <?php if( isset($redux_builder_amp['enable-amp-ads-1'] ) && $redux_builder_amp['enable-amp-ads-1'] ) { ?>.amp_ad_1{margin: -2px 0px -17px 0px;}<?php }
1414
  if( isset($redux_builder_amp['enable-amp-ads-2'] ) && $redux_builder_amp['enable-amp-ads-2'] ) { ?>.amp_ad_2{margin: 20px 0px -23px 0px; }<?php }
1415
  if( isset($redux_builder_amp['enable-amp-ads-3'] ) && $redux_builder_amp['enable-amp-ads-3'] ) { ?>.amp-ad-3{margin: 0px 0px -4px 0px;}<?php }
1416
  if( isset($redux_builder_amp['enable-amp-ads-4'] ) && $redux_builder_amp['enable-amp-ads-4'] ) { ?>.amp_ad_4{margin: 20px 0px 20px 0px;}<?php }
1417
  if( isset($redux_builder_amp['enable-amp-ads-5'] ) && $redux_builder_amp['enable-amp-ads-5'] ) { ?>.amp_ad_5{margin: 10px 0px -17px 0px;}<?php }
1418
  if( isset($redux_builder_amp['enable-amp-ads-6'] ) && $redux_builder_amp['enable-amp-ads-6'] ) { ?>.amp-ad-6{ margin: 0px 0px 20px 0px;}<?php } ?>
 
1419
  <?php if( true == $redux_builder_amp['amp-enable-notifications'] ) {?>
1420
  #amp-user-notification1{padding: 5px;text-align: center;background: #fff;border-top: 1px solid #005be2;}
1421
  #amp-user-notification1 p {display: inline-block;margin: 20px 0px;}
1588
  line-height: 1;
1589
  }
1590
  .rr a#scrollToTopButton{color:#fff;}
1591
+ <?php } ?>
1592
+ <?php if (checkAMPforPageBuilderStatus(get_the_ID())){ ?>
1593
+ .sp-cnt .cntr {max-width: 100%;margin:0;width:100%;padding:0}
1594
+ <?php } ?>
templates/features.php CHANGED
@@ -1152,12 +1152,12 @@ function ampforwp_new_dir( $dir ) {
1152
 
1153
  // 10.1 Analytics Support added for Google Analytics
1154
  global $redux_builder_amp;
1155
- if( false == $redux_builder_amp['amp-use-gtm-option'] ) {
1156
- if ( true == $redux_builder_amp['ampforwp-ga-switch'] ){
1157
  $ga_fields = array();
1158
  $ampforwp_ga_fields = array();
1159
  $ga_account = '';
1160
- $ga_account = $redux_builder_amp['ga-feild'];
1161
  $ga_account = str_replace(' ', '', $ga_account);
1162
  $ga_fields = array(
1163
  'vars'=>array(
@@ -1170,7 +1170,7 @@ function ampforwp_new_dir( $dir ) {
1170
  )
1171
  )
1172
  );
1173
- if ( isset($redux_builder_amp['ampforwp-ga-field-anonymizeIP']) && true == $redux_builder_amp['ampforwp-ga-field-anonymizeIP'] ) {
1174
  $ga_fields['vars']['anonymizeIP'] = 'set';
1175
  }
1176
  $ampforwp_ga_fields = json_encode( $ga_fields);
@@ -1185,142 +1185,176 @@ function ampforwp_new_dir( $dir ) {
1185
  }//code ends for supporting Google Analytics
1186
 
1187
  // 10.2 Analytics Support added for segment.com
1188
- if ( true == $redux_builder_amp['ampforwp-Segment-switch'] ) { ?>
1189
- <amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="segment">
1190
- <script type="application/json">
1191
- {
1192
- "vars": {
1193
- "writeKey": "<?php echo esc_attr($redux_builder_amp['sa-feild']); ?>",
1194
- "name": "<?php the_title(); ?>"
1195
- }
 
 
 
 
 
 
 
 
 
1196
  }
1197
- </script>
1198
- </amp-analytics>
1199
- <?php
1200
- }
1201
 
1202
  // 10.3 Analytics Support added for Piwik
1203
- if( true == $redux_builder_amp['ampforwp-Piwik-switch'] ) { ?>
1204
- <amp-pixel <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> src="<?php echo esc_url($redux_builder_amp['pa-feild']); ?>"></amp-pixel>
1205
  <?php }
1206
 
1207
  // 10.4 Analytics Support added for quantcast
1208
- if ( true == $redux_builder_amp['ampforwp-Quantcast-switch'] ) { ?>
 
 
 
 
 
 
 
 
 
 
1209
  <amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="quantcast">
1210
  <script type="application/json">
1211
- {
1212
- "vars": {
1213
- "pcode": "<?php echo esc_attr($redux_builder_amp['amp-quantcast-analytics-code']); ?>",
1214
- "labels": [ "AMPProject" ]
1215
- }
1216
- }
1217
  </script>
1218
  </amp-analytics>
1219
  <?php
1220
  }
1221
 
1222
  // 10.5 Analytics Support added for comscore
1223
- if ( true == $redux_builder_amp['ampforwp-comScore-switch'] ) { ?>
1224
- <amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="comscore">
1225
- <script type="application/json">
1226
- {
1227
- "vars": {
1228
- "c1": "<?php echo esc_attr($redux_builder_amp['amp-comscore-analytics-code-c1']); ?>",
1229
- "c2": "<?php echo esc_attr($redux_builder_amp['amp-comscore-analytics-code-c2']); ?>"
1230
- }
 
 
 
 
 
 
 
 
 
1231
  }
1232
- </script>
1233
- </amp-analytics>
1234
- <?php
1235
- }
1236
 
1237
  // 10.6 Analytics Support added for Effective Measure
1238
- if( true == $redux_builder_amp['ampforwp-Effective-switch'] ) { ?>
1239
  <!-- BEGIN EFFECTIVE MEASURE CODE -->
1240
- <amp-pixel <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> src="<?php echo esc_url($redux_builder_amp['eam-feild']); ?>" />
1241
  <!--END EFFECTIVE MEASURE CODE -->
1242
  <?php }
1243
 
1244
  // 10.7 Analytics Support added for StatCounter
1245
- if( true == $redux_builder_amp['ampforwp-StatCounter-switch'] ) { ?>
1246
  <!-- BEGIN StatCounter CODE -->
1247
  <div id="statcounter">
1248
- <amp-pixel <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> src="<?php echo esc_url($redux_builder_amp['sc-feild']); ?>" >
1249
  </amp-pixel>
1250
  </div>
1251
  <!--END StatCounter CODE -->
1252
  <?php }
1253
 
1254
  // 10.8 Analytics Support added for Histats Analytics
1255
- if( true == $redux_builder_amp['ampforwp-Histats-switch'] ) { ?>
1256
  <!-- BEGIN Histats CODE -->
1257
  <div id="histats">
1258
- <amp-pixel <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> src="//sstatic1.histats.com/0.gif?<?php echo esc_url($redux_builder_amp['histats-feild']); ?>&101" >
1259
  </amp-pixel>
1260
  </div>
1261
  <!--END Histats CODE -->
1262
  <?php }
1263
 
1264
  // 10.9 Analytics Support added for Yandex Metrika Analytics
1265
- if ( true == $redux_builder_amp['ampforwp-Yandex-switch'] ){ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1266
  <amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="metrika">
1267
  <script type="application/json">
1268
- {
1269
- "vars": {
1270
- "counterId": "<?php echo esc_attr($redux_builder_amp['amp-Yandex-Metrika-analytics-code']); ?>"
1271
- },
1272
- "triggers": {
1273
- "notBounce": {
1274
- "on": "timer",
1275
- "timerSpec": {
1276
- "immediate": false,
1277
- "interval": 15,
1278
- "maxTimerLength": 16
1279
- },
1280
- "request": "notBounce"
1281
- }
1282
- }
1283
- }
1284
  </script>
1285
  </amp-analytics>
1286
  <?php }//code ends for supporting Yandex Metrika Analytics
1287
 
1288
  // 10.10 Analytics Support added for Chartbeat Analytics
1289
- if ( true == $redux_builder_amp['ampforwp-Chartbeat-switch'] ){ ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
1290
  <amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="chartbeat">
1291
  <script type="application/json">
1292
- {
1293
- 'vars': {
1294
- 'accountId':"<?php echo $redux_builder_amp['amp-Chartbeat-analytics-code']; ?>",
1295
- 'title': "<?php the_title(); ?>",
1296
- 'authors': "<?php the_author_meta('display_name');?>",
1297
- 'dashboardDomain': "<?php echo site_url();?>"
1298
- }
1299
- }
1300
  </script>
1301
  </amp-analytics>
1302
  <?php
1303
  }//code ends for supporting Chartbeat Analytics
1304
 
1305
  // 10.11 Analytics Support added for Alexa Metrics
1306
- if ( true == $redux_builder_amp['ampforwp-Alexa-switch'] ) { ?>
 
 
 
 
 
 
 
 
 
 
 
 
1307
  <!-- Start Alexa AMP Certify Javascript -->
1308
  <amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="alexametrics">
1309
  <script type="application/json">
1310
- {
1311
- "vars": {
1312
- "atrk_acct": "<?php echo esc_attr($redux_builder_amp['ampforwp-alexa-account']); ?>",
1313
- "domain": "<?php echo esc_attr($redux_builder_amp['ampforwp-alexa-domain']); ?>"
1314
- }
1315
- }
1316
  </script>
1317
  </amp-analytics>
1318
  <!-- End Alexa AMP Certify Javascript -->
1319
  <?php
1320
  }
1321
  // 10.12 Analytics Support added for AFS Analytics
1322
- if ( isset($redux_builder_amp['ampforwp-afs-analytics-switch']) && true == $redux_builder_amp['ampforwp-afs-analytics-switch'] ) {
1323
- $afs_account = $redux_builder_amp['ampforwp-afs-siteid'];
1324
  $afs_server = "www";
1325
  if ($afs_account > 99999)
1326
  $afs_server = 'www1';
@@ -1341,18 +1375,23 @@ function ampforwp_new_dir( $dir ) {
1341
  if ($afs_account > 899999)
1342
  $afs_server = 'www9';
1343
  if ($afs_account > 999999)
1344
- $afs_server = 'www10'; ?>
 
 
 
 
 
 
 
 
 
 
 
 
1345
  <!-- Start AFS Analytics Javascript -->
1346
  <amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="afsanalytics">
1347
  <script type="application/json">
1348
- {
1349
- "vars": {
1350
- "server": "<?php echo esc_attr($afs_server); ?>",
1351
- "websiteid": "<?php echo esc_attr($afs_account); ?>"
1352
- "title": "<?php echo esc_attr(get_the_title()); ?>"
1353
- "url": "<?php echo esc_url(get_the_permalink()); ?>"
1354
- }
1355
- }
1356
  </script>
1357
  </amp-analytics>
1358
  <!-- End AFS Analytics Javascript -->
@@ -2370,15 +2409,22 @@ function ampforwp_replace_title_tags() {
2370
  add_filter( 'wp_title', 'ampforwp_add_custom_title_tag', 10, 3 );
2371
 
2372
  function ampforwp_add_custom_title_tag( $title = '', $sep = '', $seplocation = '' ) {
2373
- global $redux_builder_amp;
2374
  $site_title = '';
2375
  $genesis_title = '';
 
 
 
 
 
 
 
 
2376
 
2377
  //* We can filter this later if needed:
2378
  $sep = ' | ';
2379
 
2380
  if ( is_singular() ) {
2381
- global $post;
2382
  $title = ! empty( $post->post_title ) ? $post->post_title : $title;
2383
  $site_title = $title . $sep . get_option( 'blogname' );
2384
  } elseif ( is_archive() && $redux_builder_amp['ampforwp-archive-support'] ) {
@@ -2392,14 +2438,13 @@ function ampforwp_replace_title_tags() {
2392
  if ( ampforwp_is_front_page() ) {
2393
  //WPML Static Front Page Support for title and description with Yoast #1143
2394
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
2395
- if ( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' ) ) {
2396
-
2397
  $ID = get_option( 'page_on_front' );
2398
- }
2399
  else {
2400
- $ID = ampforwp_get_frontpage_id();
2401
  }
2402
- $site_title = get_the_title( $ID ) . $sep . get_option( 'blogname' );
2403
  }
2404
  // Blog page
2405
  if ( ampforwp_is_blog() ) {
@@ -2474,34 +2519,20 @@ function ampforwp_replace_title_tags() {
2474
  $site_title = $genesis_title;
2475
  }
2476
  }
2477
- return esc_html( convert_chars( wptexturize( trim( $site_title ) ) ) );
2478
- }
2479
- }
2480
-
2481
-
2482
- add_action('amp_post_template_include_single','ampforwp_update_title_for_frontpage');
2483
- function ampforwp_update_title_for_frontpage() {
2484
- $check_custom_front_page = get_option('show_on_front');
2485
-
2486
- if ( $check_custom_front_page == 'page' && ampforwp_is_home() ) {
2487
-
2488
- remove_action( 'amp_post_template_head', 'amp_post_template_add_title' );
2489
- add_action('amp_post_template_head','ampforwp_frontpage_title_markup');
2490
 
2491
  add_filter('aioseop_title','ampforwp_aioseop_front_page_title');
 
 
 
 
 
 
 
 
 
 
2492
  }
2493
  }
2494
- // Custom Frontpage title for ALL in one SEO.
2495
- function ampforwp_aioseop_front_page_title() {
2496
- $sep = ' | ';
2497
- return $site_title = get_bloginfo( 'name' ) . $sep . get_option( 'blogdescription' );
2498
- }
2499
-
2500
- function ampforwp_frontpage_title_markup () {
2501
- $front_page_title = ampforwp_add_custom_title_tag();
2502
- $front_page_title = apply_filters('ampforwp_frontpage_title_filter', $front_page_title);
2503
- ?><title><?php echo esc_html( $front_page_title ); ?></title><?php
2504
- }
2505
 
2506
  // 27. Clean the Defer issue
2507
  // TODO : Get back to this issue. #407
@@ -4390,7 +4421,7 @@ function ampforwp_view_nonamp(){
4390
  $non_amp_url = add_query_arg('nonamp','1',$non_amp_url);
4391
  }
4392
 
4393
- if ( $ampforwp_backto_nonamp ) { ?><a class="view-non-amp" href="<?php echo user_trailingslashit( esc_url($non_amp_url) ) ?>" <?php echo esc_attr($nofollow); ?>><?php echo esc_html( $redux_builder_amp['amp-translator-non-amp-page-text'] ) ;?></a> <?php
4394
  }
4395
  }
4396
 
1152
 
1153
  // 10.1 Analytics Support added for Google Analytics
1154
  global $redux_builder_amp;
1155
+ if( false == ampforwp_get_setting('amp-use-gtm-option')) {
1156
+ if ( true == ampforwp_get_setting('ampforwp-ga-switch')){
1157
  $ga_fields = array();
1158
  $ampforwp_ga_fields = array();
1159
  $ga_account = '';
1160
+ $ga_account = ampforwp_get_setting('ga-feild');
1161
  $ga_account = str_replace(' ', '', $ga_account);
1162
  $ga_fields = array(
1163
  'vars'=>array(
1170
  )
1171
  )
1172
  );
1173
+ if ( true == ampforwp_get_setting('ampforwp-ga-field-anonymizeIP')) {
1174
  $ga_fields['vars']['anonymizeIP'] = 'set';
1175
  }
1176
  $ampforwp_ga_fields = json_encode( $ga_fields);
1185
  }//code ends for supporting Google Analytics
1186
 
1187
  // 10.2 Analytics Support added for segment.com
1188
+ if ( true == ampforwp_get_setting('ampforwp-Segment-switch')) {
1189
+ $segment = ampforwp_get_setting('sa-feild');
1190
+ $segment_fields = array(
1191
+ 'vars'=>array(
1192
+ 'writeKey'=>$segment,
1193
+ 'name'=>get_the_title()
1194
+ ),
1195
+ );
1196
+ $ampforwp_segment_fields = apply_filters('ampforwp_segment_analytics', $ampforwp_segment_fields );
1197
+ $ampforwp_segment_fields = json_encode( $segment_fields);
1198
+ ?>
1199
+ <amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="segment">
1200
+ <script type="application/json">
1201
+ <?php echo $ampforwp_segment_fields ?>
1202
+ </script>
1203
+ </amp-analytics>
1204
+ <?php
1205
  }
 
 
 
 
1206
 
1207
  // 10.3 Analytics Support added for Piwik
1208
+ if( true == ampforwp_get_setting('ampforwp-Piwik-switch')) { ?>
1209
+ <amp-pixel <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> src="<?php echo esc_url(ampforwp_get_setting('pa-feild')); ?>"></amp-pixel>
1210
  <?php }
1211
 
1212
  // 10.4 Analytics Support added for quantcast
1213
+ if ( true == ampforwp_get_setting('ampforwp-Quantcast-switch')) {
1214
+ $quantcast = ampforwp_get_setting('amp-quantcast-analytics-code');
1215
+ $quantcast_fields = array(
1216
+ 'vars'=>array(
1217
+ 'pcode'=>$quantcast,
1218
+ 'labels'=>[ "AMPProject" ]
1219
+ ),
1220
+ );
1221
+ $ampforwp_quantcast_fields = apply_filters('ampforwp_quantcast_analytics', $ampforwp_quantcast_fields );
1222
+ $ampforwp_quantcast_fields = json_encode( $quantcast_fields);
1223
+ ?>
1224
  <amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="quantcast">
1225
  <script type="application/json">
1226
+ <?php echo $ampforwp_quantcast_fields ?>
 
 
 
 
 
1227
  </script>
1228
  </amp-analytics>
1229
  <?php
1230
  }
1231
 
1232
  // 10.5 Analytics Support added for comscore
1233
+ if ( true == ampforwp_get_setting('ampforwp-comScore-switch')) {
1234
+ $comscore_c1 = ampforwp_get_setting('amp-comscore-analytics-code-c1');
1235
+ $comscore_c2 = ampforwp_get_setting('amp-comscore-analytics-code-c2');
1236
+ $comscore_fields = array(
1237
+ 'vars'=>array(
1238
+ 'c1'=>$comscore_c1,
1239
+ 'c2'=>$comscore_c2
1240
+ ),
1241
+ );
1242
+ $ampforwp_comscore_fields = apply_filters('ampforwp_comscore_analytics', $ampforwp_comscore_fields );
1243
+ $ampforwp_comscore_fields = json_encode( $comscore_fields);
1244
+ ?> <amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="comscore">
1245
+ <script type="application/json">
1246
+ <?php echo $ampforwp_comscore_fields ?>
1247
+ </script>
1248
+ </amp-analytics>
1249
+ <?php
1250
  }
 
 
 
 
1251
 
1252
  // 10.6 Analytics Support added for Effective Measure
1253
+ if( true == ampforwp_get_setting('ampforwp-Effective-switch')) { ?>
1254
  <!-- BEGIN EFFECTIVE MEASURE CODE -->
1255
+ <amp-pixel <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> src="<?php echo esc_url(ampforwp_get_setting('eam-feild')); ?>" ></amp-pixel>
1256
  <!--END EFFECTIVE MEASURE CODE -->
1257
  <?php }
1258
 
1259
  // 10.7 Analytics Support added for StatCounter
1260
+ if( true == ampforwp_get_setting('ampforwp-StatCounter-switch')) { ?>
1261
  <!-- BEGIN StatCounter CODE -->
1262
  <div id="statcounter">
1263
+ <amp-pixel <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> src="<?php echo esc_url(ampforwp_get_setting('sc-feild')); ?>" >
1264
  </amp-pixel>
1265
  </div>
1266
  <!--END StatCounter CODE -->
1267
  <?php }
1268
 
1269
  // 10.8 Analytics Support added for Histats Analytics
1270
+ if( true == ampforwp_get_setting('ampforwp-Histats-switch')) { ?>
1271
  <!-- BEGIN Histats CODE -->
1272
  <div id="histats">
1273
+ <amp-pixel <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> src="//sstatic1.histats.com/0.gif?<?php echo esc_url(ampforwp_get_setting('histats-feild')); ?>&101" >
1274
  </amp-pixel>
1275
  </div>
1276
  <!--END Histats CODE -->
1277
  <?php }
1278
 
1279
  // 10.9 Analytics Support added for Yandex Metrika Analytics
1280
+ if ( true == ampforwp_get_setting('ampforwp-Yandex-switch')){
1281
+ $yandex = ampforwp_get_setting('amp-Yandex-Metrika-analytics-code');
1282
+ $yandex_fields = array(
1283
+ 'vars'=>array(
1284
+ 'counterId'=>$yandex,
1285
+ ),
1286
+ 'triggers'=> array(
1287
+ 'notBounce'=> array(
1288
+ 'on'=>'timer',
1289
+ 'timerSpec'=> array(
1290
+ 'immediate'=>'false',
1291
+ 'interval'=>'15',
1292
+ 'maxTimerLength'=>'16',
1293
+ ),
1294
+ 'request'=>'notBounce'
1295
+ )
1296
+
1297
+ )
1298
+ );
1299
+ $ampforwp_yandex_fields = apply_filters('ampforwp_yandex_analytics', $ampforwp_yandex_fields );
1300
+ $ampforwp_yandex_fields = json_encode( $yandex_fields);
1301
+ ?>
1302
  <amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="metrika">
1303
  <script type="application/json">
1304
+ <?php echo $ampforwp_yandex_fields ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1305
  </script>
1306
  </amp-analytics>
1307
  <?php }//code ends for supporting Yandex Metrika Analytics
1308
 
1309
  // 10.10 Analytics Support added for Chartbeat Analytics
1310
+ if ( true == ampforwp_get_setting('ampforwp-Chartbeat-switch')){
1311
+ $chartbeat = ampforwp_get_setting('amp-Chartbeat-analytics-code');
1312
+ $chartbeat_fields = array(
1313
+ 'vars'=>array(
1314
+ 'accountId'=>$chartbeat,
1315
+ 'title'=>get_the_title(),
1316
+ 'authors'=>get_the_author_meta('display_name'),
1317
+ 'dashboardDomain'=>site_url()
1318
+ ),
1319
+
1320
+ );
1321
+ $ampforwp_chartbeat_fields = apply_filters('ampforwp_chartbeat_analytics', $ampforwp_chartbeat_fields );
1322
+ $ampforwp_chartbeat_fields = json_encode( $chartbeat_fields);
1323
+ ?>
1324
  <amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="chartbeat">
1325
  <script type="application/json">
1326
+ <?php echo $ampforwp_chartbeat_fields ?>
 
 
 
 
 
 
 
1327
  </script>
1328
  </amp-analytics>
1329
  <?php
1330
  }//code ends for supporting Chartbeat Analytics
1331
 
1332
  // 10.11 Analytics Support added for Alexa Metrics
1333
+ if ( true == ampforwp_get_setting('ampforwp-Alexa-switch')) {
1334
+ $alexa = ampforwp_get_setting('ampforwp-alexa-account');
1335
+ $domain = ampforwp_get_setting('ampforwp-alexa-domain');
1336
+ $alexa_fields = array(
1337
+ 'vars'=>array(
1338
+ 'atrk_acct'=>$alexa,
1339
+ 'domain'=>$domain
1340
+ ),
1341
+
1342
+ );
1343
+ $ampforwp_alexa_fields = apply_filters('ampforwp_alexa_analytics', $ampforwp_alexa_fields );
1344
+ $ampforwp_alexa_fields = json_encode( $alexa_fields);
1345
+ ?>
1346
  <!-- Start Alexa AMP Certify Javascript -->
1347
  <amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="alexametrics">
1348
  <script type="application/json">
1349
+ <?php echo $ampforwp_alexa_fields ?>
 
 
 
 
 
1350
  </script>
1351
  </amp-analytics>
1352
  <!-- End Alexa AMP Certify Javascript -->
1353
  <?php
1354
  }
1355
  // 10.12 Analytics Support added for AFS Analytics
1356
+ if ( true == ampforwp_get_setting('ampforwp-afs-analytics-switch')) {
1357
+ $afs_account = ampforwp_get_setting('ampforwp-afs-siteid');
1358
  $afs_server = "www";
1359
  if ($afs_account > 99999)
1360
  $afs_server = 'www1';
1375
  if ($afs_account > 899999)
1376
  $afs_server = 'www9';
1377
  if ($afs_account > 999999)
1378
+ $afs_server = 'www10';
1379
+ $afs_fields = array(
1380
+ 'vars'=>array(
1381
+ 'server'=>$afs_server,
1382
+ 'websiteid'=>$afs_account,
1383
+ 'title'=>get_the_title(),
1384
+ 'url'=>site_url()
1385
+ ),
1386
+
1387
+ );
1388
+ $ampforwp_afs_fields = apply_filters('ampforwp_afs_analytics', $ampforwp_afs_fields );
1389
+ $ampforwp_afs_fields = json_encode( $afs_fields);
1390
+ ?>
1391
  <!-- Start AFS Analytics Javascript -->
1392
  <amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="afsanalytics">
1393
  <script type="application/json">
1394
+ <?php echo $ampforwp_afs_fields ?>
 
 
 
 
 
 
 
1395
  </script>
1396
  </amp-analytics>
1397
  <!-- End AFS Analytics Javascript -->
2409
  add_filter( 'wp_title', 'ampforwp_add_custom_title_tag', 10, 3 );
2410
 
2411
  function ampforwp_add_custom_title_tag( $title = '', $sep = '', $seplocation = '' ) {
2412
+ global $redux_builder_amp, $post;
2413
  $site_title = '';
2414
  $genesis_title = '';
2415
+ if ( ampforwp_is_front_page() ) {
2416
+ $post_id = ampforwp_get_frontpage_id();
2417
+ $post = get_post($post_id);
2418
+ }
2419
+ if ( !$post ) {
2420
+ return;
2421
+ }
2422
+ $post_id = $post->ID;
2423
 
2424
  //* We can filter this later if needed:
2425
  $sep = ' | ';
2426
 
2427
  if ( is_singular() ) {
 
2428
  $title = ! empty( $post->post_title ) ? $post->post_title : $title;
2429
  $site_title = $title . $sep . get_option( 'blogname' );
2430
  } elseif ( is_archive() && $redux_builder_amp['ampforwp-archive-support'] ) {
2438
  if ( ampforwp_is_front_page() ) {
2439
  //WPML Static Front Page Support for title and description with Yoast #1143
2440
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
2441
+ if ( is_plugin_active( 'sitepress-multilingual-cms/sitepress.php' ) ) {
 
2442
  $ID = get_option( 'page_on_front' );
2443
+ }
2444
  else {
2445
+ $ID = ampforwp_get_frontpage_id();
2446
  }
2447
+ $site_title = get_the_title( $ID ) . $sep . get_option( 'blogname' );
2448
  }
2449
  // Blog page
2450
  if ( ampforwp_is_blog() ) {
2519
  $site_title = $genesis_title;
2520
  }
2521
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
2522
 
2523
  add_filter('aioseop_title','ampforwp_aioseop_front_page_title');
2524
+ // All in One SEO #2816
2525
+ if ( class_exists('All_in_One_SEO_Pack') && ampforwp_is_front_page() ) {
2526
+ $aiseop_title = $post = '';
2527
+ $aiseop_title = get_post_meta( $post_id, '_aioseop_title', true );
2528
+ if ( !empty($aiseop_title) ) {
2529
+ $site_title = $aiseop_title;
2530
+ }
2531
+ add_filter('aioseop_title', '__return_false');
2532
+ }
2533
+ return esc_html( convert_chars( wptexturize( trim( $site_title ) ) ) );
2534
  }
2535
  }
 
 
 
 
 
 
 
 
 
 
 
2536
 
2537
  // 27. Clean the Defer issue
2538
  // TODO : Get back to this issue. #407
4421
  $non_amp_url = add_query_arg('nonamp','1',$non_amp_url);
4422
  }
4423
 
4424
+ if ( $ampforwp_backto_nonamp ) { ?><a class="view-non-amp" href="<?php echo user_trailingslashit( esc_url($non_amp_url) ) ?>" <?php echo esc_attr($nofollow); ?>><?php echo esc_html__( $redux_builder_amp['amp-translator-non-amp-page-text'], 'accelerated-mobile-pages');?></a> <?php
4425
  }
4426
  }
4427