AMP for WP – Accelerated Mobile Pages - Version 0.9.97.49

Version Description

(26th April 2019) = * Added: Addthis Support integrated #2416 * Added: A3 Lazy Load compatibility #2872 * Added: Add support for AMP Linker #2546 * Fixed: Getting validation Error when using the Ivory Search Plugin #2497 * Fixed: Featured images or article images not showing in latest version #3063 * Fixed: Condition improved for author box hook #2608 * Fixed: After Update all AMP Pages Do Not Load and are Not Validated #3062 [ WP Rocket] * Fixed: PHP notice Undefined variable wp #3085 * Fixed: PHP notice Undefined variable wp_query #2803 * Fixed: Warning message while on WP customizes #3070 * Fixed: Tag meta name 'viewport' appear more than once when Zox news theme is activate #2971 * Fixed: PHP notice errors after activating amp-woocommerce plugin #3054 * Fixed: Fatal error - can't use function return value in write context #3087 * Fixed: AMP Frontpage: The mandatory tag link rel=canonical is missing or incorrect with Rank Math #3061 * Fixed: Fatal error - is_amp_endpoint issue #3055

Full changelog available in changelog.txt

Download this release

Release Info

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

Code changes from version 0.9.97.48 to 0.9.97.49

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.1.1
7
- Stable tag: 0.9.97.48
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -183,6 +183,23 @@ Device testing done through [BrowserStack](https://www.browserstack.com)
183
 
184
  == Changelog ==
185
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
186
  = 0.9.97.48 (23th April 2019) =
187
  * Added: Meta genertor #2543
188
  * Added: Bridge Qode SEO Compatibility integrated #2538
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.1.1
7
+ Stable tag: 0.9.97.49
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
183
 
184
  == Changelog ==
185
 
186
+ = 0.9.97.49 (26th April 2019) =
187
+ * Added: Addthis Support integrated #2416
188
+ * Added: A3 Lazy Load compatibility #2872
189
+ * Added: Add support for AMP Linker #2546
190
+ * Fixed: Getting validation Error when using the Ivory Search Plugin #2497
191
+ * Fixed: Featured images or article images not showing in latest version #3063
192
+ * Fixed: Condition improved for author box hook #2608
193
+ * Fixed: After Update all AMP Pages Do Not Load and are Not Validated #3062 [ WP Rocket]
194
+ * Fixed: PHP notice Undefined variable wp #3085
195
+ * Fixed: PHP notice Undefined variable wp_query #2803
196
+ * Fixed: Warning message while on WP customizes #3070
197
+ * Fixed: Tag meta name 'viewport' appear more than once when Zox news theme is activate #2971
198
+ * Fixed: PHP notice errors after activating amp-woocommerce plugin #3054
199
+ * Fixed: Fatal error - can't use function return value in write context #3087
200
+ * Fixed: AMP Frontpage: The mandatory tag ‘link rel=canonical’ is missing or incorrect with Rank Math #3061
201
+ * Fixed: Fatal error - is_amp_endpoint issue #3055
202
+
203
  = 0.9.97.48 (23th April 2019) =
204
  * Added: Meta genertor #2543
205
  * Added: Bridge Qode SEO Compatibility integrated #2538
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.48
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.48');
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(){
@@ -990,4 +990,23 @@ function ampforwp_sanitizers_loader(){
990
  class AMP_Blacklist_Sanitizer extends AMPforWP\AMPVendor\AMP_Blacklist_Sanitizer{}
991
  }
992
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
993
  }
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.49
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.49');
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(){
990
  class AMP_Blacklist_Sanitizer extends AMPforWP\AMPVendor\AMP_Blacklist_Sanitizer{}
991
  }
992
  }
993
+ }
994
+ // is_amp_endpoint Fallback #2287 #3055
995
+ add_action('parse_query','ampforwp_vendor_is_amp_endpoint');
996
+ function ampforwp_vendor_is_amp_endpoint(){
997
+ if ( ! function_exists('amp_activate') && ! function_exists('is_amp_endpoint' ) ) {
998
+ function is_amp_endpoint(){
999
+ _doing_it_wrong(
1000
+ __FUNCTION__,
1001
+ sprintf(
1002
+ /* translators: 1: is_amp_endpoint(), 2: ampforwp_is_amp_endpoint */
1003
+ esc_html__( '%1$s is deprecated from AMPforWP, please use %2$s instead. Check %3$s for more info', 'accelerated-mobile-pages' ),
1004
+ 'is_amp_endpoint()',
1005
+ 'ampforwp_is_amp_endpoint','https://ampforwp.com/tutorials/article/detect-amp-page-function/'
1006
+ ),
1007
+ '5.1.1'
1008
+ );
1009
+ return false !== get_query_var( AMP_QUERY_VAR, false );
1010
+ }
1011
+ }
1012
  }
changelog.txt CHANGED
@@ -1,5 +1,22 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 0.9.97.48 (23th April 2019) =
4
  * Added: Meta genertor #2543
5
  * Added: Bridge Qode SEO Compatibility integrated #2538
1
  == Changelog ==
2
 
3
+ = 0.9.97.49 (26th April 2019) =
4
+ * Added: Addthis Support integrated #2416
5
+ * Added: A3 Lazy Load compatibility #2872
6
+ * Added: Add support for AMP Linker #2546
7
+ * Fixed: Getting validation Error when using the Ivory Search Plugin #2497
8
+ * Fixed: Featured images or article images not showing in latest version #3063
9
+ * Fixed: Condition improved for author box hook #2608
10
+ * Fixed: After Update all AMP Pages Do Not Load and are Not Validated #3062 [ WP Rocket]
11
+ * Fixed: PHP notice Undefined variable wp #3085
12
+ * Fixed: PHP notice Undefined variable wp_query #2803
13
+ * Fixed: Warning message while on WP customizes #3070
14
+ * Fixed: Tag meta name 'viewport' appear more than once when Zox news theme is activate #2971
15
+ * Fixed: PHP notice errors after activating amp-woocommerce plugin #3054
16
+ * Fixed: Fatal error - can't use function return value in write context #3087
17
+ * Fixed: AMP Frontpage: The mandatory tag ‘link rel=canonical’ is missing or incorrect with Rank Math #3061
18
+ * Fixed: Fatal error - is_amp_endpoint issue #3055
19
+
20
  = 0.9.97.48 (23th April 2019) =
21
  * Added: Meta genertor #2543
22
  * Added: Bridge Qode SEO Compatibility integrated #2538
components/author-box/author-box.php CHANGED
@@ -105,7 +105,7 @@ if ( isset($args['show_time']) ) {
105
  </div>
106
  </div>
107
  <?php
108
- if(is_singular() && ( isset($args['ads_below_the_author']) && true == $args['ads_below_the_author'] ) && 1 == ampforwp_get_setting('ampforwp-standard-ads-7')){
109
  do_action('ampforwp_below_author_box');
110
  }
111
  }
105
  </div>
106
  </div>
107
  <?php
108
+ if(is_singular() && ( isset($args['ads_below_the_author']) && true == $args['ads_below_the_author'] )){
109
  do_action('ampforwp_below_author_box');
110
  }
111
  }
components/components-core.php CHANGED
@@ -668,4 +668,22 @@ if ( !function_exists('amp_call_now') ) {
668
  function amp_call_now(){
669
  ampforwp_call_button_html_output();
670
  }
671
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
668
  function amp_call_now(){
669
  ampforwp_call_button_html_output();
670
  }
671
+ }
672
+ // AddThis Support #2416
673
+ function ampforwp_addThis_support(){
674
+ $data_pub_id = ampforwp_get_setting('add-this-pub-id');
675
+ $data_widget_id = ampforwp_get_setting('add-this-widget-id');
676
+ if ( is_single() || (is_page() && ampforwp_get_setting('ampforwp-page-social')) ) {
677
+ if( ampforwp_get_setting('enable-add-this-option') ) {
678
+ if( 4 == ampforwp_get_setting('amp-design-selector')){
679
+ $amp_addthis = '<amp-addthis width="290" height="92" data-pub-id="'.esc_html($data_pub_id).'" data-widget-id="'. esc_html($data_widget_id).'"></amp-addthis>';
680
+ }
681
+ else{
682
+ $amp_addthis = '<amp-addthis width="320" height="92" data-pub-id="'.esc_html($data_pub_id).'" data-widget-id="'.esc_html($data_widget_id).'"></amp-addthis>';
683
+ }
684
+ do_action('ampforwp_before_social_icons_hook');
685
+ return $amp_addthis;
686
+ do_action('ampforwp_after_social_icons_hook');
687
+ }
688
+ }
689
+ }
components/menu/menu.php CHANGED
@@ -53,6 +53,6 @@ function amp_menu_styles(){
53
 
54
  <?php
55
  }?>
56
- // AMP theme framework and AMP layouts and this is required
57
  aside{width:150px}.amp-menu{list-style-type:none;margin:0;padding:0}.amp-menu li{position:relative;display:block}.amp-menu li.menu-item-has-children ul{display:none}.amp-menu li.menu-item-has-children:hover>ul{display:}.amp-menu li.menu-item-has-children>ul>li{padding-left:10px}.amp-menu>li a{padding:7px;display:block;margin-bottom:1px}.amp-menu>li ul{list-style-type:none;margin:0;padding:0;position:relative}.amp-menu input{display:none;}<?php
58
  }
53
 
54
  <?php
55
  }?>
56
+ <?php /*AMP theme framework and AMP layouts and this is required*/ ?>
57
  aside{width:150px}.amp-menu{list-style-type:none;margin:0;padding:0}.amp-menu li{position:relative;display:block}.amp-menu li.menu-item-has-children ul{display:none}.amp-menu li.menu-item-has-children:hover>ul{display:}.amp-menu li.menu-item-has-children>ul>li{padding-left:10px}.amp-menu>li a{padding:7px;display:block;margin-bottom:1px}.amp-menu>li ul{list-style-type:none;margin:0;padding:0;position:relative}.amp-menu input{display:none;}<?php
58
  }
includes/features/analytics/analytics-options.php CHANGED
@@ -1,9 +1,8 @@
1
  <?php
2
  use ReduxCore\ReduxFramework\Redux;
3
  function ampforwp_get_default_analytics($param=""){
4
- $options = $default = '';
5
- $options = (array) get_option('redux_builder_amp', true);
6
- $default = $options['amp-analytics-select-option'];
7
  if($param == $default){
8
  return true;
9
  }
@@ -100,6 +99,15 @@ function ampforwp_analytics_options($opt_name){
100
  ),
101
  'default' => 1,
102
  ),
 
 
 
 
 
 
 
 
 
103
  array(
104
  'class' => 'child_opt',
105
  'id' => 'ampforwp-ga-field-advance',
1
  <?php
2
  use ReduxCore\ReduxFramework\Redux;
3
  function ampforwp_get_default_analytics($param=""){
4
+ $default = '';
5
+ $default = ampforwp_get_setting('amp-analytics-select-option');
 
6
  if($param == $default){
7
  return true;
8
  }
99
  ),
100
  'default' => 1,
101
  ),
102
+ array(
103
+ 'class' => 'child_opt',
104
+ 'id' => 'ampforwp-ga-field-linker',
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(
112
  'class' => 'child_opt',
113
  'id' => 'ampforwp-ga-field-advance',
includes/features/functions.php CHANGED
@@ -35,13 +35,13 @@ function ampforwp_is_front_page(){
35
  $get_front_page_reading_settings = get_option('page_on_front');
36
 
37
  // Homepage support on
38
- $get_amp_homepage_settings = $redux_builder_amp['ampforwp-homepage-on-off-support'];
39
 
40
  // AMP Custom front page from AMP panel
41
- $get_custom_frontpage_settings = $redux_builder_amp['amp-frontpage-select-option'];
42
 
43
  // Frontpage id should be assigned
44
- if ( isset($redux_builder_amp['amp-frontpage-select-option-pages'])) {
45
  $get_amp_custom_frontpage_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
46
  }
47
 
@@ -595,7 +595,7 @@ function ampforwp_url_purifier($url){
595
  else{
596
  $query_name = isset($wp_query->query['pagename'])?$wp_query->query['pagename']:'';
597
  }
598
- if( ampforwp_is_query_post_same( $_SERVER['QUERY_STRING'],$query_name) && isset( $query_arg['q'] ) ){
599
  unset($query_arg['q']);
600
  }
601
  else if ( $query_name && isset( $query_arg['q'] ) ){
35
  $get_front_page_reading_settings = get_option('page_on_front');
36
 
37
  // Homepage support on
38
+ $get_amp_homepage_settings = ampforwp_get_setting('ampforwp-homepage-on-off-support');
39
 
40
  // AMP Custom front page from AMP panel
41
+ $get_custom_frontpage_settings = ampforwp_get_setting('amp-frontpage-select-option');
42
 
43
  // Frontpage id should be assigned
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
 
595
  else{
596
  $query_name = isset($wp_query->query['pagename'])?$wp_query->query['pagename']:'';
597
  }
598
+ if( $query_name && ampforwp_is_query_post_same( $_SERVER['QUERY_STRING'],$query_name) && isset( $query_arg['q'] ) ){
599
  unset($query_arg['q']);
600
  }
601
  else if ( $query_name && isset( $query_arg['q'] ) ){
includes/options/admin-config.php CHANGED
@@ -505,7 +505,9 @@ foreach ($extension_listing_array as $key => $extension) {
505
  $amplicense = $selectedOption['amp-license'][$pathExploded]['license'];
506
  }
507
  $verify = '<button type="button" id="'.$pathExploded.'" class="redux-ampforwp-ext-activate">Activate</button>';
 
508
  if(isset($selectedOption['amp-license'][$pathExploded]['status']) && $selectedOption['amp-license'][$pathExploded]['status']==='valid'){
 
509
  $currentStatus = 'active valid';
510
  $verify = '<button type="button" id="'.$pathExploded.'" class="redux-ampforwp-ext-deactivate">Deactivate</button>';
511
  if($ampforwp_nameOfUser=="" && isset($selectedOption['amp-license'][$pathExploded]['all_data']['customer_name'])){
@@ -529,7 +531,7 @@ foreach ($extension_listing_array as $key => $extension) {
529
  }
530
  $pluginReview .= '<input name="redux_builder_amp[amp-license]['.$pathExploded.'][plugin_active_path]" type="hidden" value="'.$extension['plugin_active_path'].'">
531
  <input name="redux_builder_amp[amp-license]['.$pathExploded.'][name]" type="hidden" value="'.$extension['name'].'">
532
- <input name="redux_builder_amp[amp-license]['.$pathExploded.'][status]" type="hidden" value="'.$selectedOption['amp-license'][$pathExploded]['status'].'">';
533
  $pluginReview .= '<input name="redux_builder_amp[amp-license]['.$pathExploded.'][all_data][success]" type="hidden" value="'.$allResponseData['success'].'">
534
  <input name="redux_builder_amp[amp-license]['.$pathExploded.'][all_data][license]" type="hidden" value="'.$allResponseData['license'].'">
535
  <input name="redux_builder_amp[amp-license]['.$pathExploded.'][all_data][item_name]" type="hidden" value="'.$allResponseData['item_name'].'">
@@ -3322,8 +3324,11 @@ Redux::setSection( $opt_name, array(
3322
 
3323
  // Header Elements default Color
3324
  function ampforwp_get_element_default_color() {
3325
- $default_value = (array) get_option('redux_builder_amp', true);
3326
- $default_value = $default_value['amp-opt-color-rgba-colorscheme']['color'];
 
 
 
3327
  if ( empty( $default_value ) ) {
3328
  $default_value = '#333';
3329
  }
@@ -5225,6 +5230,55 @@ else{
5225
  'desc' => esc_html__('All the Social sharing and the social profile related settings are here','accelerated-mobile-pages'),
5226
  'subsection' => true,
5227
  'fields' => array(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5228
  array(
5229
  'id' => 'social-shre',
5230
  'type' => 'section',
505
  $amplicense = $selectedOption['amp-license'][$pathExploded]['license'];
506
  }
507
  $verify = '<button type="button" id="'.$pathExploded.'" class="redux-ampforwp-ext-activate">Activate</button>';
508
+ $license_status = '';
509
  if(isset($selectedOption['amp-license'][$pathExploded]['status']) && $selectedOption['amp-license'][$pathExploded]['status']==='valid'){
510
+ $license_status = $selectedOption['amp-license'][$pathExploded]['status'];
511
  $currentStatus = 'active valid';
512
  $verify = '<button type="button" id="'.$pathExploded.'" class="redux-ampforwp-ext-deactivate">Deactivate</button>';
513
  if($ampforwp_nameOfUser=="" && isset($selectedOption['amp-license'][$pathExploded]['all_data']['customer_name'])){
531
  }
532
  $pluginReview .= '<input name="redux_builder_amp[amp-license]['.$pathExploded.'][plugin_active_path]" type="hidden" value="'.$extension['plugin_active_path'].'">
533
  <input name="redux_builder_amp[amp-license]['.$pathExploded.'][name]" type="hidden" value="'.$extension['name'].'">
534
+ <input name="redux_builder_amp[amp-license]['.$pathExploded.'][status]" type="hidden" value="'.$license_status.'">';
535
  $pluginReview .= '<input name="redux_builder_amp[amp-license]['.$pathExploded.'][all_data][success]" type="hidden" value="'.$allResponseData['success'].'">
536
  <input name="redux_builder_amp[amp-license]['.$pathExploded.'][all_data][license]" type="hidden" value="'.$allResponseData['license'].'">
537
  <input name="redux_builder_amp[amp-license]['.$pathExploded.'][all_data][item_name]" type="hidden" value="'.$allResponseData['item_name'].'">
3324
 
3325
  // Header Elements default Color
3326
  function ampforwp_get_element_default_color() {
3327
+ $option = $default_value = '';
3328
+ $option = ampforwp_get_setting('amp-opt-color-rgba-colorscheme');
3329
+ if ( !empty($option['color']) ) {
3330
+ $default_value = $option['color'];
3331
+ }
3332
  if ( empty( $default_value ) ) {
3333
  $default_value = '#333';
3334
  }
5230
  'desc' => esc_html__('All the Social sharing and the social profile related settings are here','accelerated-mobile-pages'),
5231
  'subsection' => true,
5232
  'fields' => array(
5233
+ // AddThis Support
5234
+ array(
5235
+ 'id' => 'add-this-support',
5236
+ 'type' => 'section',
5237
+ 'title' => esc_html__('AddThis Support', 'accelerated-mobile-pages'),
5238
+ 'indent' => true,
5239
+ 'layout_type' => 'accordion',
5240
+ 'accordion-open'=> 1,
5241
+ ),
5242
+
5243
+ array(
5244
+ 'id' => 'enable-add-this-option',
5245
+ 'type' => 'switch',
5246
+ 'title' => esc_html__('Enable AddThis', 'accelerated-mobile-pages'),
5247
+ 'desc' =>sprintf('<a href="https://www.addthis.com/academy/how-to-install-addthis-inline-share-buttons-on-amp-accelerated-mobile-pages/" target="_blank">%s</a> %s',esc_html__('Click Here','accelerated-mobile-pages'),esc_html__('to know how to Install AddThis Share Buttons on AMP','accelerated-mobile-pages')),
5248
+ 'default' => false,
5249
+ ),
5250
+ array(
5251
+ 'id' => 'swift-add-this-position',
5252
+ 'type' => 'select',
5253
+ 'title' => esc_html__( 'Position', 'accelerated-mobile-pages' ),
5254
+ 'options' => array(
5255
+ 'default' => 'Single Sidebar (left side)',
5256
+ 'above-content' => 'Above Content',
5257
+ 'below-content' => 'Below Content'
5258
+ ),
5259
+ 'default' => 'default',
5260
+ 'required' => array(
5261
+ array('amp-design-selector', '=', '4'),
5262
+ array('enable-add-this-option', '=', '1') )
5263
+ ),
5264
+ array(
5265
+ 'id' => 'add-this-pub-id',
5266
+ 'title' => esc_html__('Enter Pub ID', 'accelerated-mobile-pages'),
5267
+ 'type' => 'text',
5268
+ 'required' => array('enable-add-this-option', '=' , '1'),
5269
+ 'placeholder' => esc_html__('ra-xxxxxxxxxx','accelerated-mobile-pages'),
5270
+ 'default' => '',
5271
+ ),
5272
+ array(
5273
+ 'id' => 'add-this-widget-id',
5274
+ 'title' => esc_html__('Enter Widget ID', 'accelerated-mobile-pages'),
5275
+ 'type' => 'text',
5276
+ 'required' => array('enable-add-this-option', '=' , '1'),
5277
+ 'placeholder' => esc_html__('xxxx','accelerated-mobile-pages'),
5278
+ 'default' => '',
5279
+ ),
5280
+
5281
+ //End AddThis Support
5282
  array(
5283
  'id' => 'social-shre',
5284
  'type' => 'section',
includes/redirect.php CHANGED
@@ -314,6 +314,7 @@ function ampforwp_custom_query_var($vars) {
314
  add_filter( 'query_vars', 'ampforwp_custom_query_var' );
315
  add_action( 'template_redirect', 'ampforwp_redirect_to_orginal_url' );
316
  function ampforwp_redirect_to_orginal_url(){
 
317
  $go_to_url = "";
318
  $url = "";
319
  $url = ampforwp_amphtml_generator();
314
  add_filter( 'query_vars', 'ampforwp_custom_query_var' );
315
  add_action( 'template_redirect', 'ampforwp_redirect_to_orginal_url' );
316
  function ampforwp_redirect_to_orginal_url(){
317
+ global $wp;
318
  $go_to_url = "";
319
  $url = "";
320
  $url = ampforwp_amphtml_generator();
includes/thirdparty-compatibility.php CHANGED
@@ -31,6 +31,10 @@ function ampforwp_schema_lazy_load_remover(){
31
  //Remove CSS header from the GoodLife Theme #2673
32
  remove_filter('amp_post_template_file', 'thb_custom_amp_templates');
33
  remove_action( 'amp_post_template_css', 'thb_amp_additional_css_styles' );
 
 
 
 
34
  }
35
 
36
  //Updater to check license
31
  //Remove CSS header from the GoodLife Theme #2673
32
  remove_filter('amp_post_template_file', 'thb_custom_amp_templates');
33
  remove_action( 'amp_post_template_css', 'thb_amp_additional_css_styles' );
34
+ // Viewport appear more than once in Zox news theme. #2971
35
+ if ( function_exists( 'mvp_setup' ) && ampforwp_get_setting('amp-design-selector') != 4 ) {
36
+ remove_action( 'amp_post_template_head','ampforwp_add_meta_viewport');
37
+ }
38
  }
39
 
40
  //Updater to check license
includes/vendor/amp/includes/admin/class-amp-customizer.php CHANGED
@@ -166,6 +166,6 @@ class AMP_Template_Customizer {
166
  }
167
 
168
  public static function is_amp_customizer() {
169
- return ! empty( $_REQUEST[ AMP_CUSTOMIZER_QUERY_VAR ] );
170
  }
171
  }
166
  }
167
 
168
  public static function is_amp_customizer() {
169
+ return ! empty( $_REQUEST[ 'AMP_CUSTOMIZER_QUERY_VAR' ] );
170
  }
171
  }
includes/vendor/amp/includes/amp-post-template-actions.php CHANGED
@@ -8,8 +8,9 @@ function amp_post_template_add_title( $amp_template ) {
8
  <title><?php echo esc_html( $amp_template->get( 'document_title' ) ); ?></title>
9
  <?php
10
  }
11
-
12
  add_action( 'amp_post_template_head', 'AMPforWP\\AMPVendor\\amp_post_template_add_canonical' );
 
13
  function amp_post_template_add_canonical( $amp_template ) {
14
  ?>
15
  <link rel="canonical" href="<?php echo esc_url( apply_filters('ampforwp_modify_rel_url',$amp_template->get( 'canonical_url' ) ) ); ?>" />
8
  <title><?php echo esc_html( $amp_template->get( 'document_title' ) ); ?></title>
9
  <?php
10
  }
11
+ if ( !defined('RANK_MATH_FILE') || (class_exists('RankMath\\Helper') && \RankMath\Helper::is_module_active( 'amp' ) == false) ) {
12
  add_action( 'amp_post_template_head', 'AMPforWP\\AMPVendor\\amp_post_template_add_canonical' );
13
+ }
14
  function amp_post_template_add_canonical( $amp_template ) {
15
  ?>
16
  <link rel="canonical" href="<?php echo esc_url( apply_filters('ampforwp_modify_rel_url',$amp_template->get( 'canonical_url' ) ) ); ?>" />
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.1.1
7
- Stable tag: 0.9.97.48
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -184,23 +184,21 @@ You can contact us from [here](https://ampforwp.com/contact/)
184
 
185
  == Changelog ==
186
 
187
- = 0.9.97.48 (23th April 2019) =
188
- * Added: Meta genertor #2543
189
- * Added: Bridge Qode SEO Compatibility integrated #2538
190
- * Added: Lazy Load of Smush and Smush Pro plugin Compatibility integrated #2990
191
- * Fixed: Blank page with WP-Rocket
192
- * Fixed: Validation errors occur when Wordpress Comments Option is enabled #2989
193
- * Fixed: Home page displays latest posts instead of custom page when enfold theme activate #2943
194
- * Fixed: API URL conflict with Mobile redirection #2917
195
- * Fixed: Instant Article fatal error #2968
196
- * Fixed: Undefined index fb-instant-page-id PHP notice #2570
197
- * Fixed: All media queries load in single media query only code updated #2711
198
- * Fixed: Instant Article feed code updated #3018
199
- * Fixed: Space after the "data:image/png" part of the base64 encoded CSS background image #2974
200
- * Fixed: GDPR consent is not working on ios #2876
201
- * Fixed: PHP Errors in latest v0.9.97.46.1 after activation on fresh WP installation #3028
202
- * Fixed: Issue with moblie redirection with non-amp link #3021
203
- * Fixed: Cntr class automatically removed after activating elementor plugin in swift theme #3025
204
- * Fixed: Javascript Console errors after the v0.9.97.47 update #3079
205
 
206
  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.1.1
7
+ Stable tag: 0.9.97.49
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.49 (26th April 2019) =
188
+ * Added: Addthis Support integrated #2416
189
+ * Added: A3 Lazy Load compatibility #2872
190
+ * Added: Add support for AMP Linker #2546
191
+ * Fixed: Getting validation Error when using the Ivory Search Plugin #2497
192
+ * Fixed: Featured images or article images not showing in latest version #3063
193
+ * Fixed: Condition improved for author box hook #2608
194
+ * Fixed: After Update all AMP Pages Do Not Load and are Not Validated #3062 [ WP Rocket]
195
+ * Fixed: PHP notice Undefined variable wp #3085
196
+ * Fixed: PHP notice Undefined variable wp_query #2803
197
+ * Fixed: Warning message while on WP customizes #3070
198
+ * Fixed: Tag meta name 'viewport' appear more than once when Zox news theme is activate #2971
199
+ * Fixed: PHP notice errors after activating amp-woocommerce plugin #3054
200
+ * Fixed: Fatal error - can't use function return value in write context #3087
201
+ * Fixed: AMP Frontpage: The mandatory tag ‘link rel=canonical’ is missing or incorrect with Rank Math #3061
202
+ * Fixed: Fatal error - is_amp_endpoint issue #3055
 
 
203
 
204
  Full changelog available in changelog.txt
templates/design-manager.php CHANGED
@@ -22,7 +22,7 @@ if ( is_customize_preview() ) {
22
 
23
  // Adding default Value
24
  if ($data['elements'] == '') {
25
- $data['elements'] = "bread_crumbs:1,meta_info:1,title:1,featured_image:1,content:1,meta_taxonomy:1,social_icons:1,comments:1,related_posts:1";
26
  }
27
 
28
  if( isset( $data['elements'] ) || ! empty( $data['elements'] ) ){
@@ -54,6 +54,9 @@ if ( is_customize_preview() ) {
54
  add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_social_icons' );
55
  define('AMPFORWP_DM_SOCIAL_CHECK','true');
56
  break;
 
 
 
57
  case 'comments:1':
58
  add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_comments' );
59
  break;
@@ -259,6 +262,18 @@ function ampforwp_design_element_related_posts( $file, $type, $post ) {
259
  }
260
  return $file;
261
  }
 
 
 
 
 
 
 
 
 
 
 
 
262
  // Empty meta parts when Pagebuilder is enabled
263
  add_filter('ampforwp_design_elements', 'ampforwp_empty_design_elements');
264
  function ampforwp_empty_design_elements($meta_parts) {
22
 
23
  // Adding default Value
24
  if ($data['elements'] == '') {
25
+ $data['elements'] = "bread_crumbs:1,meta_info:1,title:1,featured_image:1,content:1,meta_taxonomy:1,social_icons:1,addthis:1,comments:1,related_posts:1";
26
  }
27
 
28
  if( isset( $data['elements'] ) || ! empty( $data['elements'] ) ){
54
  add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_social_icons' );
55
  define('AMPFORWP_DM_SOCIAL_CHECK','true');
56
  break;
57
+ case 'addthis:1':
58
+ add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_addthis' );
59
+ break;
60
  case 'comments:1':
61
  add_filter( 'ampforwp_design_elements', 'ampforwp_add_element_comments' );
62
  break;
262
  }
263
  return $file;
264
  }
265
+ //Addthis
266
+ function ampforwp_add_element_addthis( $meta_parts ) {
267
+ $meta_parts[] = 'ampforwp-addthis';
268
+ return $meta_parts;
269
+ }
270
+ add_filter( 'amp_post_template_file', 'ampforwp_design_element_addthis', 10, 3 );
271
+ function ampforwp_design_element_addthis( $file, $type, $post ) {
272
+ if ( 'ampforwp-addthis' === $type ) {
273
+ $file = AMPFORWP_PLUGIN_DIR . 'templates/design-manager/design-'. ampforwp_design_selector() .'/elements/addthis.php' ;
274
+ }
275
+ return $file;
276
+ }
277
  // Empty meta parts when Pagebuilder is enabled
278
  add_filter('ampforwp_design_elements', 'ampforwp_empty_design_elements');
279
  function ampforwp_empty_design_elements($meta_parts) {
templates/design-manager/design-1/elements/addthis.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+ echo ampforwp_addThis_support();
3
+ ?>
templates/design-manager/design-1/style.php CHANGED
@@ -18,6 +18,7 @@ use AMPforWP\AMPVendor\AMP_Post_Template;
18
  ?>
19
 
20
  #statcounter{width: 1px;height:1px;}
 
21
  <?php if ( true == ampforwp_get_setting('ampforwp-d1-font') ): ?>
22
  @font-face {
23
  font-family: 'Merriweather';
18
  ?>
19
 
20
  #statcounter{width: 1px;height:1px;}
21
+ .amp-wp-article amp-addthis{margin-top: -68px;}
22
  <?php if ( true == ampforwp_get_setting('ampforwp-d1-font') ): ?>
23
  @font-face {
24
  font-family: 'Merriweather';
templates/design-manager/design-2/elements/addthis.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+ echo ampforwp_addThis_support();
3
+ ?>
templates/design-manager/design-2/style.php CHANGED
@@ -30,6 +30,7 @@ a { color: #312C7E; text-decoration: none }
30
  .clearfix, .cb { clear: both }
31
  amp-iframe{ max-width: 100%; margin-bottom : 20px; }
32
  amp-anim { max-width: 100%; }
 
33
  amp-wistia-player {margin:5px 0px;}
34
  .alignleft{ margin-right: 12px; margin-bottom:5px; float: left; }
35
  .alignright{ float:right; margin-left: 12px; margin-bottom:5px; }
30
  .clearfix, .cb { clear: both }
31
  amp-iframe{ max-width: 100%; margin-bottom : 20px; }
32
  amp-anim { max-width: 100%; }
33
+ .amp-wp-article amp-addthis{display: inherit;margin-top: -44px;}
34
  amp-wistia-player {margin:5px 0px;}
35
  .alignleft{ margin-right: 12px; margin-bottom:5px; float: left; }
36
  .alignright{ float:right; margin-left: 12px; margin-bottom:5px; }
templates/design-manager/design-3/elements/addthis.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <?php
2
+ echo ampforwp_addThis_support();
3
+ ?>
templates/design-manager/design-3/style.php CHANGED
@@ -32,6 +32,10 @@ a{ color: #312C7E; text-decoration: none }
32
  amp-anim { max-width: 100%; }
33
  amp-wistia-player {margin:5px 0px;}
34
  .amp-wp-content amp-iframe{max-width:100%}
 
 
 
 
35
  .hide{display:none}
36
  @font-face {
37
  font-family: 'Roboto Slab';
32
  amp-anim { max-width: 100%; }
33
  amp-wistia-player {margin:5px 0px;}
34
  .amp-wp-content amp-iframe{max-width:100%}
35
+ .amp-wp-article amp-addthis{margin-bottom: -89px;top: -113px;}
36
+ @media screen and (min-width: 1025px){
37
+ .amp-wp-article amp-addthis{margin-left: 150px;}
38
+ }
39
  .hide{display:none}
40
  @font-face {
41
  font-family: 'Roboto Slab';
templates/design-manager/swift/page.php CHANGED
@@ -18,6 +18,9 @@ amp_header(); ?>
18
  <div class="pg">
19
  <?php if ( is_page() && true == ampforwp_get_setting('ampforwp-page-social') && 'above-content' == ampforwp_get_setting('swift-social-position') ){
20
  ampforwp_swift_social_icons();
 
 
 
21
  } ?>
22
  <div class="cntn-wrp">
23
  <?php if( ampforwp_get_setting('gbl-sidebar') == '1' && ampforwp_is_front_page() ){ ?>
@@ -42,7 +45,10 @@ amp_header(); ?>
42
  </div>
43
  <?php if(!checkAMPforPageBuilderStatus(get_the_ID())){
44
  if( is_page() && true == ampforwp_get_setting('ampforwp-page-social') && 'above-content' != ampforwp_get_setting('swift-social-position') ) { ?>
45
- <div class="ss-ic">
 
 
 
46
  <span class="shr-txt"><?php echo esc_attr(ampforwp_translation($redux_builder_amp['amp-translator-share-text'], 'Share' )); ?></span>
47
  <ul>
48
  <?php if($redux_builder_amp['enable-single-facebook-share']){?>
18
  <div class="pg">
19
  <?php if ( is_page() && true == ampforwp_get_setting('ampforwp-page-social') && 'above-content' == ampforwp_get_setting('swift-social-position') ){
20
  ampforwp_swift_social_icons();
21
+ }
22
+ if ( is_page() && true == ampforwp_get_setting('ampforwp-page-social') && 'above-content' == ampforwp_get_setting('swift-add-this-position') ){
23
+ echo ampforwp_addThis_support();
24
  } ?>
25
  <div class="cntn-wrp">
26
  <?php if( ampforwp_get_setting('gbl-sidebar') == '1' && ampforwp_is_front_page() ){ ?>
45
  </div>
46
  <?php if(!checkAMPforPageBuilderStatus(get_the_ID())){
47
  if( is_page() && true == ampforwp_get_setting('ampforwp-page-social') && 'above-content' != ampforwp_get_setting('swift-social-position') ) { ?>
48
+ <div class="ss-ic"><?php
49
+ if( ampforwp_get_setting('enable-add-this-option') && 'above-content' != ampforwp_get_setting('swift-add-this-position')) {
50
+ echo ampforwp_addThis_support();
51
+ } ?>
52
  <span class="shr-txt"><?php echo esc_attr(ampforwp_translation($redux_builder_amp['amp-translator-share-text'], 'Share' )); ?></span>
53
  <ul>
54
  <?php if($redux_builder_amp['enable-single-facebook-share']){?>
templates/design-manager/swift/single.php CHANGED
@@ -27,13 +27,19 @@
27
  <div class="sp-rt">
28
  <?php if (isset($redux_builder_amp['swift-social-position']) && 'above-content' == $redux_builder_amp['swift-social-position']){
29
  ampforwp_swift_social_icons();
30
- } ?>
 
 
 
31
  <div class="cntn-wrp artl-cnt">
32
  <?php amp_content(); ?>
33
  </div>
34
  <?php if (isset($redux_builder_amp['swift-social-position']) && 'below-content' == $redux_builder_amp['swift-social-position']){
35
  ampforwp_swift_social_icons();
36
- } ?>
 
 
 
37
  <?php if(!checkAMPforPageBuilderStatus(get_the_ID())){ ?>
38
  <?php if( $redux_builder_amp['amp-author-description'] ) { ?>
39
  <?php amp_author_box(
@@ -54,7 +60,10 @@
54
  <div class="sp-lt">
55
  <?php if (isset($redux_builder_amp['swift-social-position']) && 'default' == $redux_builder_amp['swift-social-position']){
56
  ampforwp_swift_social_icons();
57
- } ?>
 
 
 
58
  <?php if( isset($redux_builder_amp['amp-author-name']) && $redux_builder_amp['amp-author-name'] ) { ?>
59
  <div class="sp-athr">
60
  <span class="athr-tx"><?php echo esc_attr(ampforwp_translation($redux_builder_amp['amp-translator-published-by'], 'Published by' )); ?></span>
27
  <div class="sp-rt">
28
  <?php if (isset($redux_builder_amp['swift-social-position']) && 'above-content' == $redux_builder_amp['swift-social-position']){
29
  ampforwp_swift_social_icons();
30
+ }
31
+ if ( 'above-content' == ampforwp_get_setting('swift-add-this-position') ){
32
+ echo ampforwp_addThis_support();
33
+ } ?>
34
  <div class="cntn-wrp artl-cnt">
35
  <?php amp_content(); ?>
36
  </div>
37
  <?php if (isset($redux_builder_amp['swift-social-position']) && 'below-content' == $redux_builder_amp['swift-social-position']){
38
  ampforwp_swift_social_icons();
39
+ }
40
+ if ( 'below-content' == ampforwp_get_setting('swift-add-this-position') ){
41
+ echo ampforwp_addThis_support();
42
+ } ?>
43
  <?php if(!checkAMPforPageBuilderStatus(get_the_ID())){ ?>
44
  <?php if( $redux_builder_amp['amp-author-description'] ) { ?>
45
  <?php amp_author_box(
60
  <div class="sp-lt">
61
  <?php if (isset($redux_builder_amp['swift-social-position']) && 'default' == $redux_builder_amp['swift-social-position']){
62
  ampforwp_swift_social_icons();
63
+ }
64
+ if ( 'default' == ampforwp_get_setting('swift-add-this-position') ){
65
+ echo ampforwp_addThis_support();
66
+ } ?>
67
  <?php if( isset($redux_builder_amp['amp-author-name']) && $redux_builder_amp['amp-author-name'] ) { ?>
68
  <div class="sp-athr">
69
  <span class="athr-tx"><?php echo esc_attr(ampforwp_translation($redux_builder_amp['amp-translator-published-by'], 'Published by' )); ?></span>
templates/design-manager/swift/style.php CHANGED
@@ -1,4 +1,7 @@
1
- <?php global $redux_builder_amp; ?>
 
 
 
2
  <?php if(!isset($redux_builder_amp['amp_font_selector']) || $redux_builder_amp['amp_font_selector'] == 1 || empty($redux_builder_amp['amp_font_selector'])){
3
  if(!ampforwp_levelup_compatibility('levelup_theme_and_elementor')){ // Level up Condition starts ?>
4
  @font-face {font-family: 'Poppins';font-display: swap;font-style: normal;font-weight: 300;src: local('Poppins Light'), local('Poppins-Light'), url('<?php echo plugin_dir_url(__FILE__) ?>fonts/Poppins-Light.ttf');}
@@ -290,8 +293,8 @@ if( ampforwp_is_home() || is_archive() || is_search() || (function_exists('is_sh
290
  font-size:18px;color:#000;line-height:1.7;word-wrap: break-word;
291
  <?php
292
  if(1==ampforwp_get_setting('ampforwp-google-font-switch')){
293
- if(ampforwp_get_setting('amp_font_selector_content_single') != 1 && !empty(ampforwp_get_setting('amp_font_selector_content_single')) ){
294
- $fontFamily = "font-family: '".ampforwp_get_setting('amp_font_selector_content_single')."';";
295
  }
296
  }
297
  echo $fontFamily;
@@ -409,9 +412,8 @@ pre {padding: 30px 15px;background: #f7f7f7;white-space: pre-wrap;;font-size: 14
409
  <?php
410
 
411
  if(1==ampforwp_get_setting('ampforwp-google-font-switch') && 1 == ampforwp_get_setting('content-font-family-enable')){
412
-
413
- if( ampforwp_get_setting('amp_font_selector_content_single') != 1 && !empty(ampforwp_get_setting('amp_font_selector_content_single')) ){
414
- $fontFamily = "font-family: '".esc_attr(ampforwp_get_setting('amp_font_selector_content_single'))."';";
415
  }
416
  }
417
  echo $fontFamily;
1
+ <?php global $redux_builder_amp;
2
+ $font_content = '';
3
+ $font_content = ampforwp_get_setting('amp_font_selector_content_single');
4
+ ?>
5
  <?php if(!isset($redux_builder_amp['amp_font_selector']) || $redux_builder_amp['amp_font_selector'] == 1 || empty($redux_builder_amp['amp_font_selector'])){
6
  if(!ampforwp_levelup_compatibility('levelup_theme_and_elementor')){ // Level up Condition starts ?>
7
  @font-face {font-family: 'Poppins';font-display: swap;font-style: normal;font-weight: 300;src: local('Poppins Light'), local('Poppins-Light'), url('<?php echo plugin_dir_url(__FILE__) ?>fonts/Poppins-Light.ttf');}
293
  font-size:18px;color:#000;line-height:1.7;word-wrap: break-word;
294
  <?php
295
  if(1==ampforwp_get_setting('ampforwp-google-font-switch')){
296
+ if(!empty($font_content) && $font_content != 1){
297
+ $fontFamily = "font-family: '".esc_attr($font_content)."';";
298
  }
299
  }
300
  echo $fontFamily;
412
  <?php
413
 
414
  if(1==ampforwp_get_setting('ampforwp-google-font-switch') && 1 == ampforwp_get_setting('content-font-family-enable')){
415
+ if(!empty($font_content) && $font_content != 1){
416
+ $fontFamily = "font-family: '".esc_attr($font_content)."';";
 
417
  }
418
  }
419
  echo $fontFamily;
templates/features.php CHANGED
@@ -230,7 +230,7 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
230
  }
231
  // #872 no-amphtml if selected as hide from settings
232
  if(is_archive() && $redux_builder_amp['ampforwp-archive-support']){
233
- if(is_tag() && is_array($redux_builder_amp['hide-amp-tags-bulk-option'])) {
234
  $all_tags = get_the_tags();
235
  $tagsOnPost = array();
236
  if ( $all_tags ) {
@@ -246,7 +246,7 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
246
  }//tags area closed
247
 
248
  $selected_cats = $current_cats_ids = array();
249
- $get_categories_from_checkbox = $redux_builder_amp['hide-amp-categories'];
250
  // Check if $get_categories_from_checkbox has some cats then only show
251
  if ( $get_categories_from_checkbox ) {
252
  $get_selected_cats = array_filter($get_categories_from_checkbox);
@@ -1087,6 +1087,7 @@ add_action( 'amp_post_template_head', 'ampforwp_amp_remove_actions', 9 );
1087
  // 21. Remove Schema data from All In One Schema.org Rich Snippets Plugin
1088
  add_action( 'pre_amp_render_post', 'ampforwp_remove_schema_data' );
1089
  function ampforwp_remove_schema_data() {
 
1090
  remove_filter('the_content','display_rich_snippet');
1091
  // Ultimate Social Media PLUS Compatiblity Added
1092
  remove_filter('the_content','sfsi_plus_beforaftereposts');
@@ -1143,6 +1144,8 @@ function ampforwp_remove_schema_data() {
1143
  ampforwp_remove_filters_for_class( 'wp_nav_menu_args', 'BF_Menus', 'walker_front', 10 );
1144
  // Removing Smush Pro Lazy Load plugin #2990
1145
  ampforwp_remove_filters_for_class( 'the_content', 'WP_Smush_Lazy_Load', 'set_lazy_load_attributes', 100 );
 
 
1146
  //SiteOrigin Page builder compatibilty with AMP Frontpage
1147
  if ( ampforwp_is_front_page() ) {
1148
  ampforwp_remove_filters_for_class( 'the_content', 'SiteOrigin_Panels', 'generate_post_content', 10 );
@@ -1195,8 +1198,7 @@ function ampforwp_remove_schema_data() {
1195
  remove_filter( 'wp_get_attachment_image_attributes', 'thb_lazy_low_quality', 10, 3 );
1196
  //Custom Frontpage not working when we select the option to display blog in enfold theme #2943
1197
  remove_filter('pre_option_page_for_posts', 'avia_page_for_posts_filter');
1198
-
1199
- // WP Rocket #3062
1200
  if ( function_exists('rocket_init') ) {
1201
  global $wp_filter;
1202
  remove_filter( 'wp_resource_hints', 'rocket_dns_prefetch', 10, 2 );
@@ -1204,13 +1206,16 @@ function ampforwp_remove_schema_data() {
1204
  unset( $wp_filter['rocket_buffer'] );
1205
  // this filter is documented in inc/front/protocol.php.
1206
  $do_rocket_protocol_rewrite = apply_filters( 'do_rocket_protocol_rewrite', false );
1207
-
1208
- if ( ( get_rocket_option( 'do_cloudflare', 0 ) && get_rocket_option( 'cloudflare_protocol_rewrite', 0 ) || $do_rocket_protocol_rewrite ) ) {
1209
  remove_filter( 'rocket_buffer', 'rocket_protocol_rewrite', PHP_INT_MAX );
1210
  remove_filter( 'wp_calculate_image_srcset', 'rocket_protocol_rewrite_srcset', PHP_INT_MAX );
1211
  }
1212
- }
1213
-
 
 
 
 
1214
  }
1215
 
1216
  // 22. Removing author links from comments Issue #180
@@ -4053,7 +4058,7 @@ function ampforwp_rel_canonical_home_archive(){
4053
  // RankMath canonical copatibility #2975
4054
  if ( defined('RANK_MATH_FILE') ) {
4055
  $show_canonical = false;
4056
- if( $_SERVER['SERVER_NAME'] === '127.0.0.1' || $_SERVER['SERVER_NAME'] === 'localhost' ) {
4057
  $show_canonical = true;
4058
  }
4059
  }
@@ -4162,26 +4167,28 @@ function is_category_amp_disabled(){
4162
  return false;
4163
  }
4164
  }//tags check area closed
4165
- $categories = get_the_category();
4166
- if ( $categories) {
4167
- $get_categories_from_checkbox = ampforwp_get_setting('hide-amp-categories2');
4168
- // Check if $get_categories_from_checkbox has some cats then only show
4169
- if ( $get_categories_from_checkbox ) {
4170
- $get_selected_cats = array_filter($get_categories_from_checkbox);
4171
- foreach ($get_selected_cats as $key => $value) {
4172
- $selected_cats[] = $value;
4173
- }
4174
- foreach ($categories as $key => $cats) {
4175
- $current_cats_ids[] =$cats->cat_ID;
4176
- }
4177
- if($selected_cats && $current_cats_ids){
4178
- if( count(array_intersect($selected_cats,$current_cats_ids))>0 ){
4179
- return true;
4180
- }
4181
- else
4182
- return false;
4183
- }
4184
- }
 
 
4185
  }
4186
  }
4187
  }
@@ -4384,51 +4391,8 @@ if (! function_exists( 'ampforwp_get_body_class' ) ) {
4384
  function ampforwp_the_body_class(){ return ;}
4385
 
4386
  // 77. AMP Blog Details
4387
- if( !function_exists('ampforwp_get_blog_details') ) {
4388
- function ampforwp_get_blog_details( $param = "" ) {
4389
- global $redux_builder_amp;
4390
- $current_url = '';
4391
- $output = '';
4392
- $slug = '';
4393
- $title = '';
4394
- $blog_id = '';
4395
- $current_url_in_pieces = array();
4396
- if(is_home() && get_option('show_on_front') == 'page' ) {
4397
- $current_url = home_url( $GLOBALS['wp']->request );
4398
- $current_url_in_pieces = explode( '/', $current_url );
4399
- $page_for_posts = get_option( 'page_for_posts' );
4400
- if( $page_for_posts ){
4401
- $post = get_post($page_for_posts);
4402
- if ( $post ) {
4403
- $slug = $post->post_name;
4404
- $title = $post->post_title;
4405
- $blog_id = $post->ID;
4406
- }
4407
- switch ($param) {
4408
- case 'title':
4409
- $output = $title;
4410
- break;
4411
- case 'name':
4412
- $output = $slug;
4413
- break;
4414
- case 'id':
4415
- $output = $blog_id;
4416
- break;
4417
- default:
4418
- if( in_array( $slug , $current_url_in_pieces , true ) || get_query_var('page_id') == $blog_id ) {
4419
- $output = true;
4420
- }
4421
- else
4422
- $output = false;
4423
- break;
4424
- }
4425
- }
4426
- else
4427
- $output = false;
4428
- }
4429
- return $output;
4430
- }
4431
- }
4432
  // 78. Saved Custom Post Types for AMP in Options for Structured Data
4433
  add_action("redux/options/redux_builder_amp/saved",'ampforwp_save_custom_post_types_sd', 10, 1);
4434
  if(! function_exists('ampforwp_save_custom_post_types_sd') ) {
@@ -5697,9 +5661,11 @@ function ampforwp_is_non_amp( $type="" ) {
5697
  if ( is_page() && false == $redux_builder_amp['amp-on-off-for-all-pages'] ) {
5698
  return;
5699
  }
5700
- $ampforwp_amp_post_on_off_meta = get_post_meta( $post_id,'ampforwp-amp-on-off',true);
5701
- if($ampforwp_amp_post_on_off_meta == 'hide-amp'){
5702
- return false;
 
 
5703
  }
5704
  // Removing the AMP on login register etc of Theme My Login plugin
5705
 
@@ -6704,4 +6670,71 @@ function ampforwp_generator(){
6704
  <meta name="generator" content="AMP for WP <?php echo esc_attr(AMPFORWP_VERSION)?>" />
6705
  <?php }
6706
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6707
  }
230
  }
231
  // #872 no-amphtml if selected as hide from settings
232
  if(is_archive() && $redux_builder_amp['ampforwp-archive-support']){
233
+ if(is_tag() && is_array(ampforwp_get_setting('hide-amp-tags-bulk-option')) ) {
234
  $all_tags = get_the_tags();
235
  $tagsOnPost = array();
236
  if ( $all_tags ) {
246
  }//tags area closed
247
 
248
  $selected_cats = $current_cats_ids = array();
249
+ $get_categories_from_checkbox = ampforwp_get_setting('hide-amp-categories');
250
  // Check if $get_categories_from_checkbox has some cats then only show
251
  if ( $get_categories_from_checkbox ) {
252
  $get_selected_cats = array_filter($get_categories_from_checkbox);
1087
  // 21. Remove Schema data from All In One Schema.org Rich Snippets Plugin
1088
  add_action( 'pre_amp_render_post', 'ampforwp_remove_schema_data' );
1089
  function ampforwp_remove_schema_data() {
1090
+ $amp_custom_content_enable = '';
1091
  remove_filter('the_content','display_rich_snippet');
1092
  // Ultimate Social Media PLUS Compatiblity Added
1093
  remove_filter('the_content','sfsi_plus_beforaftereposts');
1144
  ampforwp_remove_filters_for_class( 'wp_nav_menu_args', 'BF_Menus', 'walker_front', 10 );
1145
  // Removing Smush Pro Lazy Load plugin #2990
1146
  ampforwp_remove_filters_for_class( 'the_content', 'WP_Smush_Lazy_Load', 'set_lazy_load_attributes', 100 );
1147
+ // Removing A3 Lazy Load plugin #2872
1148
+ ampforwp_remove_filters_for_class( 'the_content', 'A3_Lazy_Load', 'filter_content_images', 100 );
1149
  //SiteOrigin Page builder compatibilty with AMP Frontpage
1150
  if ( ampforwp_is_front_page() ) {
1151
  ampforwp_remove_filters_for_class( 'the_content', 'SiteOrigin_Panels', 'generate_post_content', 10 );
1198
  remove_filter( 'wp_get_attachment_image_attributes', 'thb_lazy_low_quality', 10, 3 );
1199
  //Custom Frontpage not working when we select the option to display blog in enfold theme #2943
1200
  remove_filter('pre_option_page_for_posts', 'avia_page_for_posts_filter');
1201
+ // WP Rocket #3062
 
1202
  if ( function_exists('rocket_init') ) {
1203
  global $wp_filter;
1204
  remove_filter( 'wp_resource_hints', 'rocket_dns_prefetch', 10, 2 );
1206
  unset( $wp_filter['rocket_buffer'] );
1207
  // this filter is documented in inc/front/protocol.php.
1208
  $do_rocket_protocol_rewrite = apply_filters( 'do_rocket_protocol_rewrite', false );
1209
+ if ( ( get_rocket_option( 'do_cloudflare', 0 ) && get_rocket_option( 'cloudflare_protocol_rewrite', 0 ) || $do_rocket_protocol_rewrite ) ) {
 
1210
  remove_filter( 'rocket_buffer', 'rocket_protocol_rewrite', PHP_INT_MAX );
1211
  remove_filter( 'wp_calculate_image_srcset', 'rocket_protocol_rewrite_srcset', PHP_INT_MAX );
1212
  }
1213
+ }
1214
+ // Publisher theme lazy load #3063
1215
+ if( class_exists('Publisher') ){
1216
+ remove_filter( 'post_thumbnail_html', 'publisher_lazy_loading_img_tags', 6 );
1217
+ remove_filter( 'the_content', 'publisher_lazy_loading_img_tags', 6 );
1218
+ }
1219
  }
1220
 
1221
  // 22. Removing author links from comments Issue #180
4058
  // RankMath canonical copatibility #2975
4059
  if ( defined('RANK_MATH_FILE') ) {
4060
  $show_canonical = false;
4061
+ if (class_exists('RankMath\\Helper') && \RankMath\Helper::is_module_active( 'amp' ) == false){
4062
  $show_canonical = true;
4063
  }
4064
  }
4167
  return false;
4168
  }
4169
  }//tags check area closed
4170
+ if ( is_category() ) {
4171
+ $categories = get_the_category();
4172
+ if ( $categories) {
4173
+ $get_categories_from_checkbox = ampforwp_get_setting('hide-amp-categories2');
4174
+ // Check if $get_categories_from_checkbox has some cats then only show
4175
+ if ( $get_categories_from_checkbox ) {
4176
+ $get_selected_cats = array_filter($get_categories_from_checkbox);
4177
+ foreach ($get_selected_cats as $key => $value) {
4178
+ $selected_cats[] = $value;
4179
+ }
4180
+ foreach ($categories as $key => $cats) {
4181
+ $current_cats_ids[] =$cats->cat_ID;
4182
+ }
4183
+ if($selected_cats && $current_cats_ids){
4184
+ if( count(array_intersect($selected_cats,$current_cats_ids))>0 ){
4185
+ return true;
4186
+ }
4187
+ else
4188
+ return false;
4189
+ }
4190
+ }
4191
+ }
4192
  }
4193
  }
4194
  }
4391
  function ampforwp_the_body_class(){ return ;}
4392
 
4393
  // 77. AMP Blog Details
4394
+ // Moved to functions.php
4395
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4396
  // 78. Saved Custom Post Types for AMP in Options for Structured Data
4397
  add_action("redux/options/redux_builder_amp/saved",'ampforwp_save_custom_post_types_sd', 10, 1);
4398
  if(! function_exists('ampforwp_save_custom_post_types_sd') ) {
5661
  if ( is_page() && false == $redux_builder_amp['amp-on-off-for-all-pages'] ) {
5662
  return;
5663
  }
5664
+ if ( is_singular() || ampforwp_is_front_page() || ampforwp_is_blog() ) {
5665
+ $ampforwp_amp_post_on_off_meta = get_post_meta( $post_id,'ampforwp-amp-on-off',true);
5666
+ if($ampforwp_amp_post_on_off_meta == 'hide-amp'){
5667
+ return false;
5668
+ }
5669
  }
5670
  // Removing the AMP on login register etc of Theme My Login plugin
5671
 
6670
  <meta name="generator" content="AMP for WP <?php echo esc_attr(AMPFORWP_VERSION)?>" />
6671
  <?php }
6672
  }
6673
+ }
6674
+
6675
+ // #2497 Ivory Search Compatibility Added
6676
+ add_filter('ampforwp_menu_content','ampforwp_modify_ivory_search');
6677
+ if( ! function_exists(' ampforwp_modify_ivory_search ') ){
6678
+ function ampforwp_modify_ivory_search($menu){
6679
+ $dom = '';
6680
+ $nodes = '';
6681
+ $num_nodes = '';
6682
+ if( !empty( $menu ) ){
6683
+ // Create a new document
6684
+ $dom = new DOMDocument();
6685
+ if( function_exists( 'mb_convert_encoding' ) ){
6686
+ $menu = mb_convert_encoding($menu, 'HTML-ENTITIES', 'UTF-8');
6687
+ }
6688
+ else{
6689
+ $menu = preg_replace( '/&.*?;/', 'x', $menu ); // multi-byte characters converted to X
6690
+ }
6691
+ // To Suppress Warnings
6692
+ libxml_use_internal_errors(true);
6693
+ $dom->loadHTML($menu);
6694
+ libxml_use_internal_errors(false);
6695
+ // get all the forms
6696
+ $nodes = $dom->getElementsByTagName( 'form' );
6697
+ $num_nodes = $nodes->length;
6698
+ for ( $i = $num_nodes - 1; $i >= 0; $i-- ) {
6699
+ $node = $nodes->item( $i );
6700
+ // Set The Width and Height if there in none
6701
+ if ( '' === $node->getAttribute( 'target' ) ) {
6702
+ $node->setAttribute('target', '_top');
6703
+ }
6704
+ if ( $node->getAttribute('action')){
6705
+ $action_url = '';
6706
+ $action_url = $node->getAttribute('action');
6707
+ $action_url = preg_replace('#^http?:#', '', $action_url);
6708
+ $node->setAttribute('action', $action_url);
6709
+ }
6710
+ }
6711
+ $menu = $dom->saveHTML();
6712
+ }
6713
+ return $menu;
6714
+ }
6715
+ }
6716
+ add_action('amp_post_template_css','ampforwp_ivory_search_css');
6717
+ function ampforwp_ivory_search_css(){
6718
+ if(class_exists('Ivory_Search')){?>
6719
+ svg.icon.icon-search {
6720
+ display: none;
6721
+ }
6722
+ input.search-field {
6723
+ display: inline-block;
6724
+ }
6725
+ svg.search-icon {
6726
+ display: none;
6727
+ }
6728
+ <?php } }
6729
+ // AddThis Support
6730
+ add_filter('amp_post_template_data','ampforwp_register_addthis_script', 20);
6731
+ function ampforwp_register_addthis_script( $data ){
6732
+ global $redux_builder_amp;
6733
+ if( ampforwp_get_setting('enable-add-this-option') ) {
6734
+
6735
+ if ( empty( $data['amp_component_scripts']['amp-addthis'] ) ) {
6736
+ $data['amp_component_scripts']['amp-addthis'] = 'https://cdn.ampproject.org/v0/amp-addthis-0.1.js';
6737
+ }
6738
+ }
6739
+ return $data;
6740
  }