AMP for WP – Accelerated Mobile Pages - Version 1.0.2

Version Description

(19th December 2019) = * Improvement: Need to add wordpress default Gutenburg editor 'Block' settings Compatibility in AMP #3320 * Improvement: Need to make compatibility with the Imagify plugin #3908 * Improvement: Taxonomy support in AMP Page Builder category module #3310 * Improvement: Add support of fallback images in AMP #3790 * Improvement: General code improvements part 3 #3941 * Improvement: Drop down support in Alternative Menu in Mobile view. #2768 * Fixed: The Alternate Menu does not redirecting to the AMP for the product category in menu items #3915 * Fixed: Sub-Category Archives on AMP page should be connected to Change internal links to AMP option. #3924 * Fixed: Debug warning : Undefined index element #3958 * Fixed: MGID Ads are not loading when the Flexible AMP widget option is enabled in the AMP #3864 * Fixed: The Close bar is not appearing menu check in mobile iPhone #3964

Download this release

Release Info

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

Code changes from version 1.0.1 to 1.0.2

README.md CHANGED
@@ -3,8 +3,8 @@ Contributors: mohammed_kaludi, ahmedkaludi, ampforwp
3
  Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin, SEO
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
- Tested up to: 5.3
7
- Stable tag: 1.0.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -191,6 +191,19 @@ You can contact us from [here](https://ampforwp.com/contact/)
191
 
192
  == Changelog ==
193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  = 1.0.1 (14th December 2019) =
195
  * Fixed: Telegram as social profile #3754
196
  * Fixed: Give default styling for `<small>` tag. #3879
3
  Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin, SEO
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
+ Tested up to: 5.3.1
7
+ Stable tag: 1.0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
191
 
192
  == Changelog ==
193
 
194
+ = 1.0.2 (19th December 2019) =
195
+ * Improvement: Need to add wordpress default Gutenburg editor 'Block' settings Compatibility in AMP #3320
196
+ * Improvement: Need to make compatibility with the Imagify plugin #3908
197
+ * Improvement: Taxonomy support in AMP Page Builder category module #3310
198
+ * Improvement: Add support of fallback images in AMP #3790
199
+ * Improvement: General code improvements part 3 #3941
200
+ * Improvement: Drop down support in Alternative Menu in Mobile view. #2768
201
+ * Fixed: The Alternate Menu does not redirecting to the AMP for the product category in menu items #3915
202
+ * Fixed: Sub-Category Archives on AMP page should be connected to Change internal links to AMP option. #3924
203
+ * Fixed: Debug warning : Undefined index element #3958
204
+ * Fixed: MGID Ads are not loading when the Flexible AMP widget option is enabled in the AMP #3864
205
+ * Fixed: The Close bar is not appearing menu check in mobile iPhone #3964
206
+
207
  = 1.0.1 (14th December 2019) =
208
  * Fixed: Telegram as social profile #3754
209
  * Fixed: Give default styling for `<small>` tag. #3879
accelerated-moblie-pages.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Accelerated Mobile Pages
4
  Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/
5
  Description: AMP for WP - Accelerated Mobile Pages for WordPress
6
- Version: 1.0.1
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
@@ -20,7 +20,7 @@ define('AMPFORWP_PLUGIN_DIR_URI', plugin_dir_url(__FILE__));
20
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.html');
21
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
22
  define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
23
- define('AMPFORWP_VERSION','1.0.1');
24
  define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
25
  if(!defined('AMPFROWP_HOST_NAME')){
26
  $urlinfo = get_bloginfo('url');
@@ -1432,6 +1432,7 @@ function ampforwp_update_data_when_saved($options, $changed_values) {
1432
  'hide-amp-tags-bulk-option2',
1433
  'amp-design-3-tag-selector'
1434
  );
 
1435
  foreach ( $changed_values as $key => $value ) {
1436
  if ( in_array( $key, $updatedDataForTransient ) ) {
1437
  delete_transient( $key );
@@ -1455,3 +1456,18 @@ function ampforwp_update_data_when_reset($rest_object = '') {
1455
  }
1456
  }
1457
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  Plugin Name: Accelerated Mobile Pages
4
  Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/
5
  Description: AMP for WP - Accelerated Mobile Pages for WordPress
6
+ Version: 1.0.2
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
20
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.html');
21
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
22
  define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
23
+ define('AMPFORWP_VERSION','1.0.2');
24
  define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
25
  if(!defined('AMPFROWP_HOST_NAME')){
26
  $urlinfo = get_bloginfo('url');
1432
  'hide-amp-tags-bulk-option2',
1433
  'amp-design-3-tag-selector'
1434
  );
1435
+ ampforwp_delete_transient_on_update($changed_values);
1436
  foreach ( $changed_values as $key => $value ) {
1437
  if ( in_array( $key, $updatedDataForTransient ) ) {
1438
  delete_transient( $key );
1456
  }
1457
  }
1458
  }
1459
+
1460
+ if(!function_exists('ampforwp_delete_transient_on_update')){
1461
+ function ampforwp_delete_transient_on_update($changed_values){
1462
+ $key_for_trans = array('ampforwp-custom-taxonomies');
1463
+ $del_trans_arr = array('ampforwp-custom-taxonomies'=>array('ampforwp_header_menu','ampforwp_footer_menu'));
1464
+ foreach($changed_values as $key => $value ){
1465
+ if(in_array($key,$key_for_trans)){
1466
+ $trans_arr = $del_trans_arr[$key];
1467
+ for($i=0;$i<count($trans_arr);$i++){
1468
+ delete_transient( $trans_arr[$i] );
1469
+ }
1470
+ }
1471
+ }
1472
+ }
1473
+ }
changelog.txt CHANGED
@@ -1,5 +1,18 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 1.0.1 (14th December 2019) =
4
  * Fixed: Telegram as social profile #3754
5
  * Fixed: Give default styling for <small> tag. #3879
1
  == Changelog ==
2
 
3
+ = 1.0.2 (19th December 2019) =
4
+ * Improvement: Need to add wordpress default Gutenburg editor 'Block' settings Compatibility in AMP #3320
5
+ * Improvement: Need to make compatibility with the Imagify plugin #3908
6
+ * Improvement: Taxonomy support in AMP Page Builder category module #3310
7
+ * Improvement: Add support of fallback images in AMP #3790
8
+ * Improvement: General code improvements part 3 #3941
9
+ * Improvement: Drop down support in Alternative Menu in Mobile view. #2768
10
+ * Fixed: The Alternate Menu does not redirecting to the AMP for the product category in menu items #3915
11
+ * Fixed: Sub-Category Archives on AMP page should be connected to Change internal links to AMP option. #3924
12
+ * Fixed: Debug warning : Undefined index element #3958
13
+ * Fixed: MGID Ads are not loading when the Flexible AMP widget option is enabled in the AMP #3864
14
+ * Fixed: The Close bar is not appearing menu check in mobile iPhone #3964
15
+
16
  = 1.0.1 (14th December 2019) =
17
  * Fixed: Telegram as social profile #3754
18
  * Fixed: Give default styling for <small> tag. #3879
components/loop/loop.php CHANGED
@@ -64,7 +64,11 @@ function amp_archive_title(){
64
  if( !empty( $cat_childs ) ){
65
  echo "<div class='amp-sub-archives'><ul>";
66
  foreach ($cat_childs as $cat_child ) {
67
- echo '<li><a href="' . esc_url(get_term_link( $cat_child )) . '">' . esc_attr($cat_child->name) . '</a></li>';
 
 
 
 
68
  }
69
  echo "</ul></div>";
70
  }
64
  if( !empty( $cat_childs ) ){
65
  echo "<div class='amp-sub-archives'><ul>";
66
  foreach ($cat_childs as $cat_child ) {
67
+ $cat_child_url = get_term_link( $cat_child );
68
+ if(true == ampforwp_get_setting('convert-internal-nonamplinks-to-amp')){
69
+ $cat_child_url = ampforwp_url_controller($cat_child_url);
70
+ }
71
+ echo '<li><a href="' . esc_url($cat_child_url) . '">' . esc_attr($cat_child->name) . '</a></li>';
72
  }
73
  echo "</ul></div>";
74
  }
includes/features/advertisement/ads-options.php CHANGED
@@ -179,17 +179,17 @@ if ( ! defined( 'ABSPATH' ) ) {
179
  ),
180
  'placeholder'=> 'MXXScriptRootCXXXXXX'
181
  );
182
- $fields[] = array(
183
- 'class' => 'child_opt',
184
- 'id' => 'enable-amp-ads-mgid-flexible',
185
- 'type' => 'switch',
186
- 'title' => esc_html__('Flexible AMP widget', 'accelerated-mobile-pages'),
187
- 'tooltip-subtitle' => esc_html__('It will look like usual "fixed size AMP widget", without any specific width-and-height values.', 'accelerated-mobile-pages'),
188
- 'default' => 0,
189
- 'required' => array(
190
- array('enable-amp-ads-1', '=' , '1'),
191
- array('enable-amp-ads-type-1', '=' , 'mgid'),
192
- ),
193
  );
194
  // Ad 1 ends
195
 
@@ -339,19 +339,19 @@ if ( ! defined( 'ABSPATH' ) ) {
339
  array('enable-amp-ads-type-2', '=' , 'mgid'),
340
  ),
341
  'placeholder'=> 'MXXScriptRootCXXXXXX'
342
- );
343
- $fields[] = array(
344
- 'class' => 'child_opt',
345
- 'id' => 'enable-amp-ads-mgid-flexible-2',
346
- 'type' => 'switch',
347
- 'title' => esc_html__('Flexible AMP widget', 'accelerated-mobile-pages'),
348
- 'tooltip-subtitle' => esc_html__('It will look like usual "fixed size AMP widget", without any specific width-and-height values.', 'accelerated-mobile-pages'),
349
- 'default' => 0,
350
- 'required' => array(
351
- array('enable-amp-ads-2', '=' , '1'),
352
- array('enable-amp-ads-type-2', '=' , 'mgid'),
353
- ),
354
  );
 
 
 
 
 
 
 
 
 
 
 
 
355
  // Ad 2 ends
356
 
357
  // Ad 3 starts
@@ -517,17 +517,17 @@ if ( ! defined( 'ABSPATH' ) ) {
517
  ),
518
  'placeholder'=> 'MXXScriptRootCXXXXXX'
519
  );
520
- $fields[] = array(
521
- 'class' => 'child_opt',
522
- 'id' => 'enable-amp-ads-mgid-flexible-3',
523
- 'type' => 'switch',
524
- 'title' => esc_html__('Flexible AMP widget', 'accelerated-mobile-pages'),
525
- 'tooltip-subtitle' => esc_html__('It will look like usual "fixed size AMP widget", without any specific width-and-height values.', 'accelerated-mobile-pages'),
526
- 'default' => 0,
527
- 'required' => array(
528
- array('enable-amp-ads-3', '=' , '1'),
529
- array('enable-amp-ads-type-3', '=' , 'mgid'),
530
- ),
531
  );
532
  // Ad 3 ends
533
 
@@ -678,17 +678,17 @@ if ( ! defined( 'ABSPATH' ) ) {
678
  ),
679
  'placeholder'=> 'MXXScriptRootCXXXXXX'
680
  );
681
- $fields[] = array(
682
- 'class' => 'child_opt',
683
- 'id' => 'enable-amp-ads-mgid-flexible-4',
684
- 'type' => 'switch',
685
- 'title' => esc_html__('Flexible AMP widget', 'accelerated-mobile-pages'),
686
- 'tooltip-subtitle' => esc_html__('It will look like usual "fixed size AMP widget", without any specific width-and-height values.', 'accelerated-mobile-pages'),
687
- 'default' => 0,
688
- 'required' => array(
689
- array('enable-amp-ads-4', '=' , '1'),
690
- array('enable-amp-ads-type-4', '=' , 'mgid'),
691
- ),
692
  );
693
  // Ad 4 ends
694
 
@@ -839,19 +839,18 @@ if ( ! defined( 'ABSPATH' ) ) {
839
  ),
840
  'placeholder'=> 'MXXScriptRootCXXXXXX'
841
  );
842
- $fields[] = array(
843
- 'class' => 'child_opt',
844
- 'id' => 'enable-amp-ads-mgid-flexible-5',
845
- 'type' => 'switch',
846
- 'title' => esc_html__('Flexible AMP widget', 'accelerated-mobile-pages'),
847
- 'tooltip-subtitle' => esc_html__('It will look like usual "fixed size AMP widget", without any specific width-and-height values.', 'accelerated-mobile-pages'),
848
- 'default' => 0,
849
- 'required' => array(
850
- array('enable-amp-ads-5', '=' , '1'),
851
- array('enable-amp-ads-type-5', '=' , 'mgid'),
852
- ),
853
  );
854
-
855
  //Ad 6 Starts
856
  if ( ! function_exists('amp_activate') ) {
857
  $fields[] =array(
@@ -1000,17 +999,17 @@ if ( ! defined( 'ABSPATH' ) ) {
1000
  ),
1001
  'placeholder'=> 'MXXScriptRootCXXXXXX'
1002
  );
1003
- $fields[] = array(
1004
- 'class' => 'child_opt',
1005
- 'id' => 'enable-amp-ads-mgid-flexible-6',
1006
- 'type' => 'switch',
1007
- 'title' => esc_html__('Flexible AMP widget', 'accelerated-mobile-pages'),
1008
- 'tooltip-subtitle' => esc_html__('It will look like usual "fixed size AMP widget", without any specific width-and-height values.', 'accelerated-mobile-pages'),
1009
- 'default' => 0,
1010
- 'required' => array(
1011
- array('enable-amp-ads-6', '=' , '1'),
1012
- array('enable-amp-ads-type-6', '=' , 'mgid'),
1013
- ),
1014
  );
1015
  }
1016
  }
179
  ),
180
  'placeholder'=> 'MXXScriptRootCXXXXXX'
181
  );
182
+ $fields[] = array(
183
+ 'class' => 'child_opt',
184
+ 'id' => 'enable-amp-ads-mgid-flexible',
185
+ 'type' => 'switch',
186
+ 'title' => esc_html__('Flexible AMP widget', 'accelerated-mobile-pages'),
187
+ 'tooltip-subtitle' => esc_html__('It will look like usual "fixed size AMP widget", without any specific width-and-height values.', 'accelerated-mobile-pages'),
188
+ 'default' => 0,
189
+ 'required' => array(
190
+ array('enable-amp-ads-1', '=' , '1'),
191
+ array('enable-amp-ads-type-1', '=' , 'mgid'),
192
+ ),
193
  );
194
  // Ad 1 ends
195
 
339
  array('enable-amp-ads-type-2', '=' , 'mgid'),
340
  ),
341
  'placeholder'=> 'MXXScriptRootCXXXXXX'
 
 
 
 
 
 
 
 
 
 
 
 
342
  );
343
+ $fields[] = array(
344
+ 'class' => 'child_opt',
345
+ 'id' => 'enable-amp-ads-mgid-flexible-2',
346
+ 'type' => 'switch',
347
+ 'title' => esc_html__('Flexible AMP widget', 'accelerated-mobile-pages'),
348
+ 'tooltip-subtitle' => esc_html__('It will look like usual "fixed size AMP widget", without any specific width-and-height values.', 'accelerated-mobile-pages'),
349
+ 'default' => 0,
350
+ 'required' => array(
351
+ array('enable-amp-ads-2', '=' , '1'),
352
+ array('enable-amp-ads-type-2', '=' , 'mgid'),
353
+ ),
354
+ );
355
  // Ad 2 ends
356
 
357
  // Ad 3 starts
517
  ),
518
  'placeholder'=> 'MXXScriptRootCXXXXXX'
519
  );
520
+ $fields[] = array(
521
+ 'class' => 'child_opt',
522
+ 'id' => 'enable-amp-ads-mgid-flexible-3',
523
+ 'type' => 'switch',
524
+ 'title' => esc_html__('Flexible AMP widget', 'accelerated-mobile-pages'),
525
+ 'tooltip-subtitle' => esc_html__('It will look like usual "fixed size AMP widget", without any specific width-and-height values.', 'accelerated-mobile-pages'),
526
+ 'default' => 0,
527
+ 'required' => array(
528
+ array('enable-amp-ads-3', '=' , '1'),
529
+ array('enable-amp-ads-type-3', '=' , 'mgid'),
530
+ ),
531
  );
532
  // Ad 3 ends
533
 
678
  ),
679
  'placeholder'=> 'MXXScriptRootCXXXXXX'
680
  );
681
+ $fields[] = array(
682
+ 'class' => 'child_opt',
683
+ 'id' => 'enable-amp-ads-mgid-flexible-4',
684
+ 'type' => 'switch',
685
+ 'title' => esc_html__('Flexible AMP widget', 'accelerated-mobile-pages'),
686
+ 'tooltip-subtitle' => esc_html__('It will look like usual "fixed size AMP widget", without any specific width-and-height values.', 'accelerated-mobile-pages'),
687
+ 'default' => 0,
688
+ 'required' => array(
689
+ array('enable-amp-ads-4', '=' , '1'),
690
+ array('enable-amp-ads-type-4', '=' , 'mgid'),
691
+ ),
692
  );
693
  // Ad 4 ends
694
 
839
  ),
840
  'placeholder'=> 'MXXScriptRootCXXXXXX'
841
  );
842
+ $fields[] = array(
843
+ 'class' => 'child_opt',
844
+ 'id' => 'enable-amp-ads-mgid-flexible-5',
845
+ 'type' => 'switch',
846
+ 'title' => esc_html__('Flexible AMP widget', 'accelerated-mobile-pages'),
847
+ 'tooltip-subtitle' => esc_html__('It will look like usual "fixed size AMP widget", without any specific width-and-height values.', 'accelerated-mobile-pages'),
848
+ 'default' => 0,
849
+ 'required' => array(
850
+ array('enable-amp-ads-5', '=' , '1'),
851
+ array('enable-amp-ads-type-5', '=' , 'mgid'),
852
+ ),
853
  );
 
854
  //Ad 6 Starts
855
  if ( ! function_exists('amp_activate') ) {
856
  $fields[] =array(
999
  ),
1000
  'placeholder'=> 'MXXScriptRootCXXXXXX'
1001
  );
1002
+ $fields[] = array(
1003
+ 'class' => 'child_opt',
1004
+ 'id' => 'enable-amp-ads-mgid-flexible-6',
1005
+ 'type' => 'switch',
1006
+ 'title' => esc_html__('Flexible AMP widget', 'accelerated-mobile-pages'),
1007
+ 'tooltip-subtitle' => esc_html__('It will look like usual "fixed size AMP widget", without any specific width-and-height values.', 'accelerated-mobile-pages'),
1008
+ 'default' => 0,
1009
+ 'required' => array(
1010
+ array('enable-amp-ads-6', '=' , '1'),
1011
+ array('enable-amp-ads-type-6', '=' , 'mgid'),
1012
+ ),
1013
  );
1014
  }
1015
  }
includes/features/advertisement/mgid-ads-functions.php CHANGED
@@ -22,9 +22,17 @@ function ampforwp_mgid_markup_ad_1($output){
22
  $data_pub = ampforwp_get_setting('enable-amp-ads-mgid-field-data-pub');
23
  $data_wid = ampforwp_get_setting('enable-amp-ads-mgid-field-data-widget');
24
  $data_cont = ampforwp_get_setting('enable-amp-ads-mgid-field-data-con');
 
 
 
 
 
 
25
  $output = '<div class="amp-ad-wrapper amp_ad_1">
26
  <amp-ad class="amp-ad-1"
27
- '.(!ampforwp_get_setting('enable-amp-ads-mgid-flexible')? 'width="'.esc_attr( $width ).'" height="'.esc_attr( $height ).'"' : '' ).'
 
 
28
  type="mgid"
29
  data-publisher="'.esc_attr( $data_pub ).'"
30
  data-widget="'.esc_attr( $data_wid ).'"
@@ -43,9 +51,17 @@ function ampforwp_mgid_markup_ad_2($output){
43
  $data_pub = ampforwp_get_setting('enable-amp-ads-mgid-field-data-pub-2');
44
  $data_wid = ampforwp_get_setting('enable-amp-ads-mgid-field-data-widget-2');
45
  $data_cont = ampforwp_get_setting('enable-amp-ads-mgid-field-data-con-2');
 
 
 
 
 
 
46
  $output = '<div class="amp-ad-wrapper amp_ad_2">
47
  <amp-ad class="amp-ad-2"
48
- '.(!ampforwp_get_setting('enable-amp-ads-mgid-flexible-2')? 'width="'.esc_attr( $width ).'" height="'.esc_attr( $height ).'"' : '' ).'
 
 
49
  type="mgid"
50
  data-publisher="'.esc_attr( $data_pub ).'"
51
  data-widget="'.esc_attr( $data_wid ).'"
@@ -64,9 +80,17 @@ function ampforwp_mgid_markup_ad_3($output){
64
  $data_pub = ampforwp_get_setting('enable-amp-ads-mgid-field-data-pub-3');
65
  $data_wid = ampforwp_get_setting('enable-amp-ads-mgid-field-data-widget-3');
66
  $data_cont = ampforwp_get_setting('enable-amp-ads-mgid-field-data-con-3');
 
 
 
 
 
 
67
  $output = '<div class="amp-ad-wrapper amp_ad_3">
68
  <amp-ad class="amp-ad-3"
69
- '.(!ampforwp_get_setting('enable-amp-ads-mgid-flexible-3')? 'width="'.esc_attr( $width ).'" height="'.esc_attr( $height ).'"' : '' ).'
 
 
70
  type="mgid"
71
  data-publisher="'.esc_attr( $data_pub ).'"
72
  data-widget="'.esc_attr( $data_wid ).'"
@@ -85,9 +109,17 @@ function ampforwp_mgid_markup_ad_4($output){
85
  $data_pub = ampforwp_get_setting('enable-amp-ads-mgid-field-data-pub-4');
86
  $data_wid = ampforwp_get_setting('enable-amp-ads-mgid-field-data-widget-4');
87
  $data_cont = ampforwp_get_setting('enable-amp-ads-mgid-field-data-con-4');
 
 
 
 
 
 
88
  $output = '<div class="amp-ad-wrapper amp_ad_4">
89
  <amp-ad class="amp-ad-4"
90
- '.(!ampforwp_get_setting('enable-amp-ads-mgid-flexible-4')? 'width="'.esc_attr( $width ).'" height="'.esc_attr( $height ).'"' : '' ).'
 
 
91
  type="mgid"
92
  data-publisher="'.esc_attr( $data_pub ).'"
93
  data-widget="'.esc_attr( $data_wid ).'"
@@ -106,9 +138,17 @@ function ampforwp_mgid_markup_ad_5($output){
106
  $data_pub = ampforwp_get_setting('enable-amp-ads-mgid-field-data-pub-5');
107
  $data_wid = ampforwp_get_setting('enable-amp-ads-mgid-field-data-widget-5');
108
  $data_cont = ampforwp_get_setting('enable-amp-ads-mgid-field-data-con-5');
 
 
 
 
 
 
109
  $output = '<div class="amp-ad-wrapper amp_ad_5">
110
  <amp-ad class="amp-ad-5"
111
- '.(!ampforwp_get_setting('enable-amp-ads-mgid-flexible-5')? 'width="'.esc_attr( $width ).'" height="'.esc_attr( $height ).'"' : '' ).'
 
 
112
  type="mgid"
113
  data-publisher="'.esc_attr( $data_pub ).'"
114
  data-widget="'.esc_attr( $data_wid ).'"
@@ -127,9 +167,17 @@ function ampforwp_mgid_markup_ad_6($output){
127
  $data_pub = ampforwp_get_setting('enable-amp-ads-mgid-field-data-pub-6');
128
  $data_wid = ampforwp_get_setting('enable-amp-ads-mgid-field-data-widget-6');
129
  $data_cont = ampforwp_get_setting('enable-amp-ads-mgid-field-data-con-6');
 
 
 
 
 
 
130
  $output = '<div class="amp-ad-wrapper amp_ad_6">
131
  <amp-ad class="amp-ad-6"
132
- '.(!ampforwp_get_setting('enable-amp-ads-mgid-flexible-6')? 'width="'.esc_attr( $width ).'" height="'.esc_attr( $height ).'"' : '' ).'
 
 
133
  type="mgid"
134
  data-publisher="'.esc_attr( $data_pub ).'"
135
  data-widget="'.esc_attr( $data_wid ).'"
@@ -148,9 +196,16 @@ function ampforwp_mgid_markup_ad_7($output){
148
  $data_pub = ampforwp_get_setting('enable-amp-ads-mgid-field-data-pub-7');
149
  $data_wid = ampforwp_get_setting('enable-amp-ads-mgid-field-data-widget-7');
150
  $data_cont = ampforwp_get_setting('enable-amp-ads-mgid-field-data-con-7');
 
 
 
 
 
151
  $output = '<div class="amp-ad-wrapper amp_ad_7">
152
  <amp-ad class="amp-ad-7"
153
- '.(!ampforwp_get_setting('enable-amp-ads-mgid-flexible-7')? 'width="'.esc_attr( $width ).'" height="'.esc_attr( $height ).'"' : '' ).'
 
 
154
  type="mgid"
155
  data-publisher="'.esc_attr( $data_pub ).'"
156
  data-widget="'.esc_attr( $data_wid ).'"
@@ -169,9 +224,16 @@ function ampforwp_mgid_markup_ad_8($output){
169
  $data_pub = ampforwp_get_setting('enable-amp-ads-mgid-field-data-pub-8');
170
  $data_wid = ampforwp_get_setting('enable-amp-ads-mgid-field-data-widget-8');
171
  $data_cont = ampforwp_get_setting('enable-amp-ads-mgid-field-data-con-8');
 
 
 
 
 
172
  $output = '<div class="amp-ad-wrapper amp_ad_8">
173
  <amp-ad class="amp-ad-8"
174
- '.(!ampforwp_get_setting('enable-amp-ads-mgid-flexible-8')? 'width="'.esc_attr( $width ).'" height="'.esc_attr( $height ).'"' : '' ).'
 
 
175
  type="mgid"
176
  data-publisher="'.esc_attr( $data_pub ).'"
177
  data-widget="'.esc_attr( $data_wid ).'"
22
  $data_pub = ampforwp_get_setting('enable-amp-ads-mgid-field-data-pub');
23
  $data_wid = ampforwp_get_setting('enable-amp-ads-mgid-field-data-widget');
24
  $data_cont = ampforwp_get_setting('enable-amp-ads-mgid-field-data-con');
25
+ $flexible = '';
26
+ if(true == ampforwp_get_setting('enable-amp-ads-mgid-flexible')){
27
+ $width = '600';
28
+ $height = '600';
29
+ $flexible = 'layout=responsive';
30
+ }
31
  $output = '<div class="amp-ad-wrapper amp_ad_1">
32
  <amp-ad class="amp-ad-1"
33
+ width="'.esc_attr( $width ).'"
34
+ height="'.esc_attr( $height ).'"
35
+ '.esc_html($flexible).'
36
  type="mgid"
37
  data-publisher="'.esc_attr( $data_pub ).'"
38
  data-widget="'.esc_attr( $data_wid ).'"
51
  $data_pub = ampforwp_get_setting('enable-amp-ads-mgid-field-data-pub-2');
52
  $data_wid = ampforwp_get_setting('enable-amp-ads-mgid-field-data-widget-2');
53
  $data_cont = ampforwp_get_setting('enable-amp-ads-mgid-field-data-con-2');
54
+ $flexible = '';
55
+ if(true == ampforwp_get_setting('enable-amp-ads-mgid-flexible-2')){
56
+ $width = '600';
57
+ $height = '600';
58
+ $flexible = 'layout=responsive';
59
+ }
60
  $output = '<div class="amp-ad-wrapper amp_ad_2">
61
  <amp-ad class="amp-ad-2"
62
+ width="'.esc_attr( $width ).'"
63
+ height="'.esc_attr( $height ).'"
64
+ '.esc_html($flexible).'
65
  type="mgid"
66
  data-publisher="'.esc_attr( $data_pub ).'"
67
  data-widget="'.esc_attr( $data_wid ).'"
80
  $data_pub = ampforwp_get_setting('enable-amp-ads-mgid-field-data-pub-3');
81
  $data_wid = ampforwp_get_setting('enable-amp-ads-mgid-field-data-widget-3');
82
  $data_cont = ampforwp_get_setting('enable-amp-ads-mgid-field-data-con-3');
83
+ $flexible = '';
84
+ if(true == ampforwp_get_setting('enable-amp-ads-mgid-flexible-3')){
85
+ $width = '600';
86
+ $height = '600';
87
+ $flexible = 'layout=responsive';
88
+ }
89
  $output = '<div class="amp-ad-wrapper amp_ad_3">
90
  <amp-ad class="amp-ad-3"
91
+ width="'.esc_attr( $width ).'"
92
+ height="'.esc_attr( $height ).'"
93
+ '.esc_html($flexible).'
94
  type="mgid"
95
  data-publisher="'.esc_attr( $data_pub ).'"
96
  data-widget="'.esc_attr( $data_wid ).'"
109
  $data_pub = ampforwp_get_setting('enable-amp-ads-mgid-field-data-pub-4');
110
  $data_wid = ampforwp_get_setting('enable-amp-ads-mgid-field-data-widget-4');
111
  $data_cont = ampforwp_get_setting('enable-amp-ads-mgid-field-data-con-4');
112
+ $flexible = '';
113
+ if(true == ampforwp_get_setting('enable-amp-ads-mgid-flexible-4')){
114
+ $width = '600';
115
+ $height = '600';
116
+ $flexible = 'layout=responsive';
117
+ }
118
  $output = '<div class="amp-ad-wrapper amp_ad_4">
119
  <amp-ad class="amp-ad-4"
120
+ width="'.esc_attr( $width ).'"
121
+ height="'.esc_attr( $height ).'"
122
+ '.esc_html($flexible).'
123
  type="mgid"
124
  data-publisher="'.esc_attr( $data_pub ).'"
125
  data-widget="'.esc_attr( $data_wid ).'"
138
  $data_pub = ampforwp_get_setting('enable-amp-ads-mgid-field-data-pub-5');
139
  $data_wid = ampforwp_get_setting('enable-amp-ads-mgid-field-data-widget-5');
140
  $data_cont = ampforwp_get_setting('enable-amp-ads-mgid-field-data-con-5');
141
+ $flexible = '';
142
+ if(true == ampforwp_get_setting('enable-amp-ads-mgid-flexible-5')){
143
+ $width = '600';
144
+ $height = '600';
145
+ $flexible = 'layout=responsive';
146
+ }
147
  $output = '<div class="amp-ad-wrapper amp_ad_5">
148
  <amp-ad class="amp-ad-5"
149
+ width="'.esc_attr( $width ).'"
150
+ height="'.esc_attr( $height ).'"
151
+ '.esc_html($flexible).'
152
  type="mgid"
153
  data-publisher="'.esc_attr( $data_pub ).'"
154
  data-widget="'.esc_attr( $data_wid ).'"
167
  $data_pub = ampforwp_get_setting('enable-amp-ads-mgid-field-data-pub-6');
168
  $data_wid = ampforwp_get_setting('enable-amp-ads-mgid-field-data-widget-6');
169
  $data_cont = ampforwp_get_setting('enable-amp-ads-mgid-field-data-con-6');
170
+ $flexible = '';
171
+ if(true == ampforwp_get_setting('enable-amp-ads-mgid-flexible-6')){
172
+ $width = '600';
173
+ $height = '600';
174
+ $flexible = 'layout=responsive';
175
+ }
176
  $output = '<div class="amp-ad-wrapper amp_ad_6">
177
  <amp-ad class="amp-ad-6"
178
+ width="'.esc_attr( $width ).'"
179
+ height="'.esc_attr( $height ).'"
180
+ '.esc_html($flexible).'
181
  type="mgid"
182
  data-publisher="'.esc_attr( $data_pub ).'"
183
  data-widget="'.esc_attr( $data_wid ).'"
196
  $data_pub = ampforwp_get_setting('enable-amp-ads-mgid-field-data-pub-7');
197
  $data_wid = ampforwp_get_setting('enable-amp-ads-mgid-field-data-widget-7');
198
  $data_cont = ampforwp_get_setting('enable-amp-ads-mgid-field-data-con-7');
199
+ if(true == ampforwp_get_setting('enable-amp-ads-mgid-flexible-7')){
200
+ $width = '600';
201
+ $height = '600';
202
+ $flexible = 'layout=responsive';
203
+ }
204
  $output = '<div class="amp-ad-wrapper amp_ad_7">
205
  <amp-ad class="amp-ad-7"
206
+ width="'.esc_attr( $width ).'"
207
+ height="'.esc_attr( $height ).'"
208
+ '.esc_html($flexible).'
209
  type="mgid"
210
  data-publisher="'.esc_attr( $data_pub ).'"
211
  data-widget="'.esc_attr( $data_wid ).'"
224
  $data_pub = ampforwp_get_setting('enable-amp-ads-mgid-field-data-pub-8');
225
  $data_wid = ampforwp_get_setting('enable-amp-ads-mgid-field-data-widget-8');
226
  $data_cont = ampforwp_get_setting('enable-amp-ads-mgid-field-data-con-8');
227
+ if(true == ampforwp_get_setting('enable-amp-ads-mgid-flexible-8')){
228
+ $width = '600';
229
+ $height = '600';
230
+ $flexible = 'layout=responsive';
231
+ }
232
  $output = '<div class="amp-ad-wrapper amp_ad_8">
233
  <amp-ad class="amp-ad-8"
234
+ width="'.esc_attr( $width ).'"
235
+ height="'.esc_attr( $height ).'"
236
+ '.esc_html($flexible).'
237
  type="mgid"
238
  data-publisher="'.esc_attr( $data_pub ).'"
239
  data-widget="'.esc_attr( $data_wid ).'"
includes/options/admin-config.php CHANGED
@@ -4005,7 +4005,7 @@ Redux::setSection( $opt_name, array(
4005
  'title' => esc_html__('Alt Menu Background', 'accelerated-mobile-pages'),
4006
  'type' => 'color_rgba',
4007
  'default' => array(
4008
- 'rgba' => 'rgb(239, 239, 239)',
4009
  ),
4010
  'required' => array(
4011
  array('primary-menu','=',1)
4005
  'title' => esc_html__('Alt Menu Background', 'accelerated-mobile-pages'),
4006
  'type' => 'color_rgba',
4007
  'default' => array(
4008
+ 'rgba' => 'rgba(239, 239, 239,1)',
4009
  ),
4010
  'required' => array(
4011
  array('primary-menu','=',1)
includes/options/redux-core/framework.php CHANGED
@@ -333,11 +333,6 @@
333
  // Grab database values
334
  $this->get_options();
335
 
336
- // Tracking
337
- if ( isset( $this->args['allow_tracking'] ) && $this->args['allow_tracking'] && Redux_Helpers::isTheme( __FILE__ ) ) {
338
- $this->_tracking();
339
- }
340
-
341
  // Options page
342
  add_action( 'admin_menu', array( $this, '_options_page' ) );
343
 
@@ -652,15 +647,6 @@
652
 
653
  // get_instance()
654
 
655
- private function _tracking() {
656
- if ( file_exists( dirname( __FILE__ ) . '/inc/tracking.php' ) ) {
657
- require_once dirname( __FILE__ ) . '/inc/tracking.php';
658
- $tracking = Redux_Tracking::get_instance();
659
- $tracking->load( $this );
660
- }
661
- }
662
- // _tracking()
663
-
664
  /**
665
  * ->_get_default(); This is used to return the default value if default_show is set
666
  *
@@ -1760,15 +1746,18 @@
1760
  }
1761
 
1762
  // Make URL
1763
- $url = '<a class="redux_hint_status" href="?dismiss=' . $dismiss . '&amp;id=hints&amp;page=' . $curPage . '&amp;tab=' . $curTab . '">' . $s . ' hints</a>';
1764
-
 
 
 
1765
  $event = __( 'moving the mouse over', 'accelerated-mobile-pages' );
1766
  if ( 'click' == $this->args['hints']['tip_effect']['show']['event'] ) {
1767
  $event = __( 'clicking', 'accelerated-mobile-pages' );
1768
  }
1769
 
1770
  // Construct message
1771
- $msg = sprintf( __( 'Hints are tooltips that popup when %d the hint icon, offering addition information about the field in which they appear. They can be %d d by using the link below.', 'accelerated-mobile-pages' ), $event, strtolower( $s ) ) . '<br/><br/>' . $url;
1772
 
1773
  // Construct hint tab
1774
  $tab = array(
333
  // Grab database values
334
  $this->get_options();
335
 
 
 
 
 
 
336
  // Options page
337
  add_action( 'admin_menu', array( $this, '_options_page' ) );
338
 
647
 
648
  // get_instance()
649
 
 
 
 
 
 
 
 
 
 
650
  /**
651
  * ->_get_default(); This is used to return the default value if default_show is set
652
  *
1746
  }
1747
 
1748
  // Make URL
1749
+ $hrefUrl = add_query_arg( 'dismiss', esc_attr($dismiss), '' );
1750
+ $hrefUrl = add_query_arg( 'id', 'hints', $hrefUrl );
1751
+ $hrefUrl = add_query_arg( 'page', esc_attr($curPage), $hrefUrl );
1752
+ $hrefUrl = add_query_arg( 'tab', esc_attr($curTab), $hrefUrl );
1753
+ $url = '<a class="redux_hint_status" href="'.esc_url_raw($hrefUrl).'">' . esc_html($s) . ' hints</a>';
1754
  $event = __( 'moving the mouse over', 'accelerated-mobile-pages' );
1755
  if ( 'click' == $this->args['hints']['tip_effect']['show']['event'] ) {
1756
  $event = __( 'clicking', 'accelerated-mobile-pages' );
1757
  }
1758
 
1759
  // Construct message
1760
+ $msg = sprintf( __( 'Hints are tooltips that popup when %d the hint icon, offering addition information about the field in which they appear. They can be %d d by using the link below.', 'accelerated-mobile-pages' ), $event, strtolower( $s ) ) . '<br/><br/>' . $url;// url escaped above
1761
 
1762
  // Construct hint tab
1763
  $tab = array(
includes/options/redux-core/inc/class.p.php CHANGED
@@ -13,7 +13,7 @@ if ( ! defined( 'ABSPATH' ) ) {
13
 
14
  public function proxy() {
15
 
16
- if ( ! isset( $_GET['nonce'] ) || ( isset( $_GET['nonce'] ) && ! wp_verify_nonce( $_GET['nonce'], "redux-ads-nonce" ) ) ) {
17
  die();
18
  }
19
 
13
 
14
  public function proxy() {
15
 
16
+ if ( ! isset( $_GET['nonce'] ) || ( isset( $_GET['nonce'] ) && ! wp_verify_nonce( $_GET['nonce'], "redux-ads-nonce" ) ) && ! current_user_can( 'manage_options' )) {
17
  die();
18
  }
19
 
includes/options/redux-core/inc/class.redux_admin_notices.php CHANGED
@@ -153,9 +153,12 @@
153
  // Get the notice id
154
  $id = esc_attr( $_GET['id'] );
155
  $val = esc_attr( $_GET['dismiss'] );
156
-
 
 
157
  // Add the dismiss request to the user meta.
158
  update_user_meta( $userid, 'ignore_' . $id, $val );
 
159
  }
160
  }
161
  }
153
  // Get the notice id
154
  $id = esc_attr( $_GET['id'] );
155
  $val = esc_attr( $_GET['dismiss'] );
156
+ if ( ! wp_verify_nonce( $_POST['nonce'], $id . $userid . 'nonce' ) ) {
157
+ die( 0 );
158
+ } else {
159
  // Add the dismiss request to the user meta.
160
  update_user_meta( $userid, 'ignore_' . $id, $val );
161
+ }
162
  }
163
  }
164
  }
includes/options/redux-core/inc/class.redux_instances.php CHANGED
@@ -61,99 +61,6 @@
61
  private function __construct() {
62
 
63
  add_action( 'redux/construct', array( $this, 'capture' ), 5, 1 );
64
-
65
- $hash = md5( trailingslashit( network_site_url() ) . '-redux' );
66
- add_action( 'wp_ajax_nopriv_' . $hash, array( $this, 'tracking_arg' ) );
67
- add_action( 'wp_ajax_' . $hash, array( $this, 'tracking_arg' ) );
68
-
69
- if (!class_exists('ReduxCore\\ReduxFramework\\Redux_Tracking') || !method_exists('ReduxCore\\ReduxFramework\\Redux_Tracking', 'trackingObject')) {
70
- $hash = md5( md5( AUTH_KEY . SECURE_AUTH_KEY . '-redux' ) . '-support' );
71
- add_action( 'wp_ajax_nopriv_' . $hash, array( $this, 'support_args' ) );
72
- add_action( 'wp_ajax_' . $hash, array( $this, 'support_args' ) );
73
- }
74
-
75
-
76
- }
77
-
78
- function tracking_arg() {
79
- echo md5( AUTH_KEY . SECURE_AUTH_KEY . '-redux' );
80
- die();
81
- }
82
-
83
- function support_args() {
84
-
85
- $this->options = get_option( 'redux-framework-tracking' );
86
- $this->options['dev_mode'] = false;
87
-
88
- if ( ! isset( $this->options['hash'] ) || ! $this->options['hash'] || empty( $this->options['hash'] ) ) {
89
- $this->options['hash'] = md5( network_site_url() . '-' . $_SERVER['REMOTE_ADDR'] );
90
- update_option( 'redux-framework-tracking', $this->options );
91
- }
92
-
93
- if ( isset( $_GET['redux_framework_disable_tracking'] ) && ! empty( $_GET['redux_framework_disable_tracking'] ) ) {
94
- $this->options['allow_tracking'] = false;
95
- update_option( 'redux-framework-tracking', $this->options );
96
- }
97
-
98
- if ( isset( $_GET['redux_framework_enable_tracking'] ) && ! empty( $_GET['redux_framework_enable_tracking'] ) ) {
99
- $this->options['allow_tracking'] = true;
100
- update_option( 'redux-framework-tracking', $this->options );
101
- }
102
-
103
- header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
104
- header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
105
- header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
106
- header( 'Cache-Control: no-store, no-cache, must-revalidate' );
107
- header( 'Cache-Control: post-check=0, pre-check=0', false );
108
- header( 'Pragma: no-cache' );
109
- $instances = ReduxFrameworkInstances::get_all_instances();
110
-
111
- if ( isset( $_REQUEST['i'] ) && ! empty( $_REQUEST['i'] ) ) {
112
- if ( is_array( $instances ) && ! empty( $instances ) ) {
113
- foreach ( $instances as $opt_name => $data ) {
114
- if ( md5( $opt_name . '-debug' ) == $_REQUEST['i'] ) {
115
- $array = $instances[ $opt_name ];
116
- }
117
- if ($data->args['dev_mode']) {
118
- $this->options['dev_mode'] = $data->args['dev_mode'];
119
- }
120
- }
121
- }
122
- if ( isset( $array ) ) {
123
- if ( isset( $array->extensions ) && is_array( $array->extensions ) && ! empty( $array->extensions ) ) {
124
- foreach ( $array->extensions as $key => $extension ) {
125
- if ( isset( $extension->$version ) ) {
126
- $array->extensions[ $key ] = $extension->$version;
127
- } else {
128
- $array->extensions[ $key ] = true;
129
- }
130
- }
131
- }
132
-
133
- if ( isset( $array->import_export ) ) {
134
- unset( $array->import_export );
135
- }
136
-
137
- if ( isset( $array->debug ) ) {
138
- unset( $array->debug );
139
- }
140
- } else {
141
- die();
142
- }
143
-
144
- } else {
145
- $array = Redux_Helpers::trackingObject();
146
- if ( is_array( $instances ) && ! empty( $instances ) ) {
147
- $array['instances'] = array();
148
- foreach ( $instances as $opt_name => $data ) {
149
- $array['instances'][] = $opt_name;
150
- }
151
- }
152
- $array['key'] = md5( AUTH_KEY . SECURE_AUTH_KEY );
153
- }
154
-
155
- echo @json_encode( $array, true );
156
- die();
157
  }
158
 
159
  function capture( $ReduxFramework ) {
61
  private function __construct() {
62
 
63
  add_action( 'redux/construct', array( $this, 'capture' ), 5, 1 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  }
65
 
66
  function capture( $ReduxFramework ) {
includes/options/redux-core/inc/themecheck/checks/embedded.php CHANGED
@@ -18,16 +18,7 @@ if ( ! defined( 'ABSPATH' ) ) {
18
  $ret = false;
19
  } else {
20
  // TODO Granular WP.org tests!!!
21
-
22
- // Check for Tracking
23
  checkcount();
24
- $tracking = $redux['dir'] . 'inc/tracking.php';
25
- if ( file_exists( $tracking ) ) {
26
- $this->error[] = '<div class="redux-error">' . sprintf( __('<span class="tc-lead tc-required">REQUIRED</span>: You MUST delete <strong> %s </strong>, or your theme will be rejected by WP.org theme submission because of Redux.', 'redux-framework'), $tracking ) . '</div>';
27
- $ret = false;
28
- }
29
-
30
-
31
  // Embedded CDN package
32
  //use_cdn
33
 
18
  $ret = false;
19
  } else {
20
  // TODO Granular WP.org tests!!!
 
 
21
  checkcount();
 
 
 
 
 
 
 
22
  // Embedded CDN package
23
  //use_cdn
24
 
includes/options/redux-core/inc/tracking.php DELETED
@@ -1,504 +0,0 @@
1
- <?php
2
- namespace ReduxCore\ReduxFramework;
3
- if ( ! defined( 'ABSPATH' ) ) {
4
- exit;
5
- }
6
- /**
7
- * @package Redux_Tracking
8
- */
9
- if ( ! class_exists( 'ReduxCore\\ReduxFramework\\ReduxFramework' ) ) {
10
- return;
11
- }
12
-
13
- /**
14
- * Class that creates the tracking functionality for Redux, as the core class might be used in more plugins,
15
- * it's checked for existence first.
16
- * NOTE: this functionality is opt-in. Disabling the tracking in the settings or saying no when asked will cause
17
- * this file to not even be loaded.
18
- */
19
- if ( ! class_exists( 'Redux_Tracking' ) ) {
20
-
21
- /**
22
- * Class Redux_Tracking
23
- */
24
- class Redux_Tracking {
25
-
26
- public $options = array();
27
- public $parent;
28
-
29
- /** Refers to a single instance of this class. */
30
- private static $instance = null;
31
-
32
- /**
33
- * Creates or returns an instance of this class.
34
- *
35
- * @return Redux_Tracking A single instance of this class.
36
- */
37
- public static function get_instance() {
38
-
39
- if ( null == self::$instance ) {
40
- self::$instance = new self;
41
- }
42
-
43
- return self::$instance;
44
- }
45
- // end get_instance;
46
-
47
- /**
48
- * Class constructor
49
- */
50
-
51
- function __construct() {
52
-
53
-
54
- }
55
-
56
- /**
57
- * @param ReduxFramework $parent
58
- */
59
- public function load( $parent ) {
60
- $this->parent = $parent;
61
-
62
-
63
- $this->options = get_option( 'redux-framework-tracking' );
64
- $this->options['dev_mode'] = $parent->args['dev_mode'];
65
-
66
-
67
- if ( ! isset( $this->options['hash'] ) || ! $this->options['hash'] || empty( $this->options['hash'] ) ) {
68
- $this->options['hash'] = md5( network_site_url() . '-' . $_SERVER['REMOTE_ADDR'] );
69
- update_option( 'redux-framework-tracking', $this->options );
70
- }
71
-
72
- if ( isset( $_GET['redux_framework_disable_tracking'] ) && ! empty( $_GET['redux_framework_disable_tracking'] ) ) {
73
- $this->options['allow_tracking'] = 'no';
74
- update_option( 'redux-framework-tracking', $this->options );
75
- }
76
-
77
- if ( isset( $_GET['redux_framework_enable_tracking'] ) && ! empty( $_GET['redux_framework_enable_tracking'] ) ) {
78
- $this->options['allow_tracking'] = 'yes';
79
- update_option( 'redux-framework-tracking', $this->options );
80
- }
81
-
82
- if ( isset( $_GET['page'] ) && $_GET['page'] == $this->parent->args['page_slug'] ) {
83
- if ( ! isset( $this->options['allow_tracking'] ) ) {
84
- add_action( 'admin_enqueue_scripts', array( $this, '_enqueue_tracking' ) );
85
- } else if ( ! isset( $this->options['tour'] ) && ( $this->parent->args['dev_mode'] == "true" || $this->parent->args['page_slug'] == "redux_demo" ) ) {
86
- add_action( 'admin_enqueue_scripts', array( $this, '_enqueue_newsletter' ) );
87
- }
88
- }
89
-
90
- $hash = md5( trailingslashit( network_site_url() ) . '-redux' );
91
- add_action( 'wp_ajax_nopriv_' . $hash, array( $this, 'tracking_arg' ) );
92
- add_action( 'wp_ajax_' . $hash, array( $this, 'tracking_arg' ) );
93
-
94
- $hash = md5( md5( AUTH_KEY . SECURE_AUTH_KEY . '-redux' ) . '-support' );
95
- add_action( 'wp_ajax_nopriv_' . $hash, array( $this, 'support_args' ) );
96
- add_action( 'wp_ajax_' . $hash, array( $this, 'support_args' ) );
97
-
98
- if ( isset( $this->options['allow_tracking'] ) && $this->options['allow_tracking'] == 'yes' ) {
99
- // The tracking checks daily, but only sends new data every 7 days.
100
- if ( ! wp_next_scheduled( 'redux_tracking' ) ) {
101
- wp_schedule_event( time(), 'daily', 'redux_tracking' );
102
- }
103
- add_action( 'redux_tracking', array( $this, 'tracking' ) );
104
- }
105
- }
106
-
107
- function _enqueue_tracking() {
108
- wp_enqueue_style( 'wp-pointer' );
109
- wp_enqueue_script( 'jquery' );
110
- wp_enqueue_script( 'jquery-ui' );
111
- wp_enqueue_script( 'wp-pointer' );
112
- wp_enqueue_script( 'utils' );
113
- add_action( 'admin_print_footer_scripts', array( $this, 'tracking_request' ) );
114
- }
115
-
116
- function _enqueue_newsletter() {
117
- wp_enqueue_style( 'wp-pointer' );
118
- wp_enqueue_script( 'jquery' );
119
- wp_enqueue_script( 'jquery-ui' );
120
- wp_enqueue_script( 'wp-pointer' );
121
- wp_enqueue_script( 'utils' );
122
- add_action( 'admin_print_footer_scripts', array( $this, 'newsletter_request' ) );
123
- }
124
-
125
- /**
126
- * Shows a popup that asks for permission to allow tracking.
127
- */
128
- function tracking_request() {
129
- $id = '#wpadminbar';
130
- $nonce = wp_create_nonce( 'redux_activate_tracking' );
131
-
132
- $content = '<h3>' . esc_html__( 'Help improve Our Panel', 'redux-framework' ) . '</h3>';
133
- $content .= '<p>' . esc_html__( 'Please helps us improve our panel by allowing us to gather anonymous usage stats so we know which configurations, plugins and themes to test to ensure compatibility.', 'redux-framework' ) . '</p>';
134
- $opt_arr = array(
135
- 'content' => $content,
136
- 'position' => array( 'edge' => 'top', 'align' => 'center' )
137
- );
138
- $button2 = esc_html__( 'Allow tracking', 'redux-framework' );
139
-
140
- $function2 = 'redux_store_answer("yes","' . $nonce . '")';
141
- $function1 = 'redux_store_answer("no","' . $nonce . '")';
142
-
143
- $this->print_scripts( $id, $opt_arr, esc_html__( 'Do not allow tracking', 'redux-framework' ), $button2, $function2, $function1 );
144
- }
145
-
146
- /**
147
- * Shows a popup that asks for permission to allow tracking.
148
- */
149
- function newsletter_request() {
150
- $id = '#wpadminbar';
151
- $nonce = wp_create_nonce( 'redux_activate_tracking' );
152
-
153
-
154
- $content = '<h3>' . esc_html__( 'Welcome to the Redux Demo Panel', 'redux-framework' ) . '</h3>';
155
- $content .= '<p><strong>' . esc_html__( 'Getting Started', 'redux-framework' ) . '</strong><br>' . sprintf( __( 'This panel demonstrates the many features of Redux. Before digging in, we suggest you get up to speed by reviewing %1$s.', 'redux-framework' ), '<a href="' . 'http://' . 'docs.reduxframework.com/redux-framework/getting-started/" target="_blank">' . esc_html__( 'our documentation', 'redux-framework' ) . '</a>' );
156
- $content .= '<p><strong>' . esc_html__( 'Redux Generator', 'redux-framework' ) . '</strong><br>' . sprintf( __( 'Want to get a head start? Use the %1$s. It will create a customized boilerplate theme or a standalone admin folder complete with all things Redux (with the help of Underscores and TGM). Save yourself a headache and try it today.', 'redux-framework' ), '<a href="' . 'http://' . 'generate.reduxframework.com/" target="_blank">' . esc_html__( 'Redux Generator', 'redux-framework' ) . '</a>' );
157
- $content .= '<p><strong>' . esc_html__( 'Redux Extensions', 'redux-framework' ) . '</strong><br>' . sprintf( __( 'Did you know we have extensions, which greatly enhance the features of Redux? Visit our %1$s to learn more!', 'redux-framework' ), '<a href="' . 'http://' . 'reduxframework.com/extensions/" target="_blank">' . esc_html__( 'extensions directory', 'redux-framework' ) . '</a>' );
158
- $content .= '<p><strong>' . esc_html__( 'Like Redux?', 'redux-framework' ) . '</strong><br>' . sprintf( __( 'If so, please %1$s and consider making a %2$s to keep development of Redux moving forward.', 'redux-framework' ), '<a target="_blank" href="' . 'http://' . 'wordpress.org/support/view/plugin-reviews/redux-framework">' . esc_html__( 'leave us a favorable review on WordPress.org', 'redux-framework' ) . '</a>', '<a href="' . 'https://' . 'www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=N5AD7TSH8YA5U" target="_blank">' . esc_html__( 'donation', 'redux-framework' ) . '</a>' );
159
- $content .= '<p><strong>' . esc_html__( 'Newsletter', 'redux-framework' ) . '</strong><br>' . esc_html__( 'If you\'d like to keep up to with all things Redux, please subscribe to our newsletter', 'redux-framework' ) . ':</p>';
160
- $content .= '<form action="' . 'http://' . 'reduxframework.us7.list-manage2.com/subscribe/post?u=564f5178f6cc288064f332efd&amp;id=ace5bbc1f9&SOURCE=panel" method="post" id="mc-embedded-subscribe-form" name="mc-embedded-subscribe-form" class="validate" target="_blank" novalidate><p style="text-align: center;"><label for="mce-EMAIL">' . esc_html__( 'Email address', 'redux-framework' ) . ' </label><input type="email" value="" name="EMAIL" class="required email" id="mce-EMAIL"><input type="hidden" value="panel" name="SOURCE">&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="' . esc_html__( 'Subscribe', 'redux-framework' ) . '" name="subscribe" id="mc-embedded-subscribe" class="button button-primary"></p></form>';
161
- $opt_arr = array(
162
- 'content' => $content,
163
- 'position' => array( 'edge' => 'top', 'align' => 'center' ),
164
- 'pointerWidth' => 450
165
- );
166
-
167
- $function1 = 'redux_store_answer("tour","' . $nonce . '")';
168
-
169
- $this->print_scripts( $id, $opt_arr, esc_html__( 'Close', 'redux-framework' ), false, '', $function1 );
170
- }
171
-
172
- /**
173
- * Prints the pointer script
174
- *
175
- * @param string $selector The CSS selector the pointer is attached to.
176
- * @param array $options The options for the pointer.
177
- * @param string $button1 Text for button 1
178
- * @param string|bool $button2 Text for button 2 (or false to not show it, defaults to false)
179
- * @param string $button2_function The JavaScript function to attach to button 2
180
- * @param string $button1_function The JavaScript function to attach to button 1
181
- */
182
- function print_scripts( $selector, $options, $button1, $button2 = false, $button2_function = '', $button1_function = '' ) {
183
- ?>
184
- <script type="text/javascript">
185
- //<![CDATA[
186
- //
187
- (function( $ ) {
188
- $( document ).ready(
189
- function() {
190
- var redux_pointer_options = <?php echo json_encode($options); ?>, setup;
191
-
192
- function redux_store_answer( input, nonce ) {
193
- var redux_tracking_data = {
194
- action: 'redux_allow_tracking',
195
- allow_tracking: input,
196
- nonce: nonce
197
- }
198
- jQuery.post(
199
- ajaxurl, redux_tracking_data, function() {
200
- jQuery( '#wp-pointer-0' ).remove();
201
- }
202
- );
203
- }
204
-
205
- redux_pointer_options = $.extend(
206
- redux_pointer_options, {
207
- buttons: function( event, t ) {
208
- button = jQuery( '<a id="pointer-close" style="margin-left:5px" class="button-secondary">' + '<?php echo esc_js($button1); ?>' + '</a>' );
209
- button.bind(
210
- 'click.pointer', function() {
211
- t.element.pointer( 'close' );
212
- //console.log( 'close button' );
213
- }
214
- );
215
- return button;
216
- },
217
- close: function() {
218
- }
219
- }
220
- );
221
-
222
- setup = function() {
223
- $( '<?php echo esc_js($selector); ?>' ).pointer( redux_pointer_options ).pointer( 'open' );
224
- <?php if ($button2) { ?>
225
- jQuery( '#pointer-close' ).after( '<a id="pointer-primary" class="button-primary">' + '<?php echo esc_js($button2); ?>' + '</a>' );
226
- jQuery( '#pointer-primary' ).click(
227
- function() {
228
- <?php echo esc_js($button2_function); ?>
229
- }
230
- );
231
- jQuery( '#pointer-close' ).click(
232
- function() {
233
- <?php if ($button1_function == '') { ?>
234
- redux_store_answer( input, nonce )
235
- //redux_setIgnore("tour", "wp-pointer-0", "<?php echo esc_js(wp_create_nonce('redux-ignore')); ?>");
236
- <?php } else { ?>
237
- <?php echo esc_js($button1_function); ?>
238
- <?php } ?>
239
- }
240
- );
241
- <?php } else if ($button1 && !$button2) { ?>
242
- jQuery( '#pointer-close' ).click(
243
- function() {
244
- <?php if ($button1_function != '') { ?>
245
- <?php echo esc_js($button1_function); ?>
246
- <?php } ?>
247
- }
248
- );
249
- <?php } ?>
250
- };
251
-
252
- if ( redux_pointer_options.position && redux_pointer_options.position.defer_loading )
253
- $( window ).bind( 'load.wp-pointers', setup );
254
- else
255
- $( document ).ready( setup );
256
- }
257
- );
258
- })( jQuery );
259
- //]]>
260
- </script>
261
- <?php
262
- }
263
-
264
- function trackingObject() {
265
- global $blog_id, $wpdb;
266
- $pts = array();
267
-
268
- foreach ( get_post_types( array( 'public' => true ) ) as $pt ) {
269
- $count = wp_count_posts( $pt );
270
- $pts[ $pt ] = $count->publish;
271
- }
272
-
273
- $comments_count = wp_count_comments();
274
- $theme_data = wp_get_theme();
275
- $theme = array(
276
- 'version' => $theme_data->Version,
277
- 'name' => $theme_data->Name,
278
- 'author' => $theme_data->Author,
279
- 'template' => $theme_data->Template,
280
- );
281
-
282
- if ( ! function_exists( 'get_plugin_data' ) ) {
283
- require_once ABSPATH . 'wp-admin/includes/admin.php';
284
- }
285
-
286
- $plugins = array();
287
- foreach ( get_option( 'active_plugins', array() ) as $plugin_path ) {
288
- $plugin_info = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin_path );
289
-
290
- $slug = str_replace( '/' . basename( $plugin_path ), '', $plugin_path );
291
- $plugins[ $slug ] = array(
292
- 'version' => $plugin_info['Version'],
293
- 'name' => $plugin_info['Name'],
294
- 'plugin_uri' => $plugin_info['PluginURI'],
295
- 'author' => $plugin_info['AuthorName'],
296
- 'author_uri' => $plugin_info['AuthorURI'],
297
- );
298
- }
299
- if ( is_multisite() ) {
300
- foreach ( get_option( 'active_sitewide_plugins', array() ) as $plugin_path ) {
301
- $plugin_info = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin_path );
302
- $slug = str_replace( '/' . basename( $plugin_path ), '', $plugin_path );
303
- $plugins[ $slug ] = array(
304
- 'version' => $plugin_info['Version'],
305
- 'name' => $plugin_info['Name'],
306
- 'plugin_uri' => $plugin_info['PluginURI'],
307
- 'author' => $plugin_info['AuthorName'],
308
- 'author_uri' => $plugin_info['AuthorURI'],
309
- );
310
- }
311
- }
312
-
313
-
314
- $version = explode( '.', PHP_VERSION );
315
- $version = array(
316
- 'major' => $version[0],
317
- 'minor' => $version[0] . '.' . $version[1],
318
- 'release' => PHP_VERSION
319
- );
320
-
321
- $user_query = new \WP_User_Query( array( 'blog_id' => $blog_id, 'count_total' => true, ) );
322
- $comments_query = new \WP_Comment_Query();
323
- $data = array(
324
- '_id' => $this->options['hash'],
325
- 'localhost' => ( $_SERVER['REMOTE_ADDR'] === '127.0.0.1' ) ? 1 : 0,
326
- 'php' => $version,
327
- 'site' => array(
328
- 'hash' => $this->options['hash'],
329
- 'version' => get_bloginfo( 'version' ),
330
- 'multisite' => is_multisite(),
331
- 'users' => $user_query->get_total(),
332
- 'lang' => get_locale(),
333
- 'wp_debug' => ( defined( 'WP_DEBUG' ) ? WP_DEBUG ? true : false : false ),
334
- 'memory' => WP_MEMORY_LIMIT,
335
- ),
336
- 'pts' => $pts,
337
- 'comments' => array(
338
- 'total' => $comments_count->total_comments,
339
- 'approved' => $comments_count->approved,
340
- 'spam' => $comments_count->spam,
341
- 'pings' => $comments_query->query( array( 'count' => true, 'type' => 'pingback' ) ),
342
- ),
343
- 'options' => apply_filters( 'redux/tracking/options', array() ),
344
- 'theme' => $theme,
345
- 'redux' => array(
346
- 'mode' => ReduxFramework::$_is_plugin ? 'plugin' : 'theme',
347
- 'version' => ReduxFramework::$_version,
348
- 'demo_mode' => get_option( 'ReduxFrameworkPlugin' ),
349
- ),
350
- 'developer' => apply_filters( 'redux/tracking/developer', array() ),
351
- 'plugins' => $plugins,
352
- );
353
-
354
- $parts = explode( ' ', $_SERVER['SERVER_SOFTWARE'] );
355
- $software = array();
356
- foreach ( $parts as $part ) {
357
- if ( $part[0] == "(" ) {
358
- continue;
359
- }
360
- if ( strpos( $part, '/' ) !== false ) {
361
- $chunk = explode( "/", $part );
362
- $software[ strtolower( $chunk[0] ) ] = $chunk[1];
363
- }
364
- }
365
- $software['full'] = $_SERVER['SERVER_SOFTWARE'];
366
- $data['environment'] = $software;
367
- //if ( function_exists( 'mysql_get_server_info' ) ) {
368
- // $data['environment']['mysql'] = mysql_get_server_info();
369
- //}
370
- $data['environment']['mysql'] = $wpdb->db_version();
371
-
372
- if ( empty( $data['developer'] ) ) {
373
- unset( $data['developer'] );
374
- }
375
-
376
- return $data;
377
- }
378
-
379
- /**
380
- * Main tracking function.
381
- */
382
- function tracking() {
383
- // Start of Metrics
384
- global $blog_id, $wpdb;
385
-
386
- $data = get_transient( 'redux_tracking_cache' );
387
- if ( ! $data ) {
388
-
389
- $args = array(
390
- 'body' => $this->trackingObject()
391
- );
392
-
393
- $response = wp_remote_post( 'https://redux-tracking.herokuapp.com', $args );
394
-
395
- // Store for a week, then push data again.
396
- set_transient( 'redux_tracking_cache', true, WEEK_IN_SECONDS );
397
- }
398
- }
399
-
400
- function tracking_arg() {
401
- echo md5( AUTH_KEY . SECURE_AUTH_KEY . '-redux' );
402
- die();
403
- }
404
-
405
- function support_args() {
406
- header( "Expires: Mon, 26 Jul 1997 05:00:00 GMT" );
407
- header( "Last-Modified: " . gmdate( "D, d M Y H:i:s" ) . "GMT" );
408
- header( 'Expires: Sat, 26 Jul 1997 05:00:00 GMT' );
409
- header( 'Cache-Control: no-store, no-cache, must-revalidate' );
410
- header( 'Cache-Control: post-check=0, pre-check=0', false );
411
- header( 'Pragma: no-cache' );
412
- $instances = ReduxFrameworkInstances::get_all_instances();
413
-
414
- if ( isset( $_REQUEST['i'] ) && ! empty( $_REQUEST['i'] ) ) {
415
- if ( is_array( $instances ) && ! empty( $instances ) ) {
416
- foreach ( $instances as $opt_name => $data ) {
417
- if ( md5( $opt_name . '-debug' ) == $_REQUEST['i'] ) {
418
- $array = $instances[ $opt_name ];
419
- }
420
- }
421
- }
422
- if ( isset( $array ) ) {
423
- if ( isset( $array->extensions ) && is_array( $array->extensions ) && ! empty( $array->extensions ) ) {
424
- foreach ( $array->extensions as $key => $extension ) {
425
- if ( isset( $extension->$version ) ) {
426
- $array->extensions[ $key ] = $extension->$version;
427
- } else {
428
- $array->extensions[ $key ] = true;
429
- }
430
- }
431
- }
432
- if ( isset( $array->import_export ) ) {
433
- unset( $array->import_export );
434
- }
435
- if ( isset( $array->debug ) ) {
436
- unset( $array->debug );
437
- }
438
- } else {
439
- die();
440
- }
441
-
442
- } else {
443
- $array = $this->trackingObject();
444
- if ( is_array( $instances ) && ! empty( $instances ) ) {
445
- $array['instances'] = array();
446
- foreach ( $instances as $opt_name => $data ) {
447
- $array['instances'][] = $opt_name;
448
- }
449
- }
450
- $array['key'] = md5( AUTH_KEY . SECURE_AUTH_KEY );
451
- }
452
-
453
- echo @json_encode( $array, true );
454
- die();
455
- }
456
-
457
- }
458
-
459
- Redux_Tracking::get_instance();
460
-
461
- /**
462
- * Adds tracking parameters for Redux settings. Outside of the main class as the class could also be in use in other ways.
463
- *
464
- * @param array $options
465
- *
466
- * @return array
467
- */
468
- function redux_tracking_additions( $options ) {
469
- $opt = array();
470
-
471
- $options['redux'] = array(
472
- 'demo_mode' => get_option( 'ReduxFrameworkPlugin' ),
473
- );
474
-
475
- return $options;
476
- }
477
-
478
- add_filter( 'redux/tracking/options', 'ReduxCore\\ReduxFramework\\redux_tracking_additions' );
479
-
480
- function redux_allow_tracking_callback() {
481
- // Verify that the incoming request is coming with the security nonce
482
- if ( wp_verify_nonce( $_REQUEST['nonce'], 'redux_activate_tracking' ) ) {
483
- $options = get_option( 'redux-framework-tracking' );
484
-
485
- if ( $_REQUEST['allow_tracking'] == "tour" ) {
486
- $options['tour'] = 1;
487
- } else {
488
- $options['allow_tracking'] = $_REQUEST['allow_tracking'];
489
- }
490
-
491
- if ( update_option( 'redux-framework-tracking', $options ) ) {
492
- die( '1' );
493
- } else {
494
- die( '0' );
495
- }
496
- } else {
497
- // Send -1 if the attempt to save via Ajax was completed invalid.
498
- die( '-1' );
499
- } // end if
500
- }
501
-
502
- add_action( 'wp_ajax_redux_allow_tracking', 'ReduxCore\\ReduxFramework\\redux_allow_tracking_callback' );
503
-
504
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
includes/updater/update.php CHANGED
@@ -233,7 +233,7 @@ function ampforwp_admin_notices() {
233
  $message = urldecode( $_GET['message'] );
234
  ?>
235
  <div class="error">
236
- <p><?php echo wp_kses_post( $message); ?></p>
237
  </div>
238
  <?php
239
  break;
233
  $message = urldecode( $_GET['message'] );
234
  ?>
235
  <div class="error">
236
+ <p><?php echo esc_html($message); ?></p>
237
  </div>
238
  <?php
239
  break;
includes/vendor/amp/includes/class-amp-post-template.php CHANGED
@@ -320,7 +320,9 @@ class AMP_Post_Template {
320
  )
321
  );
322
 
323
- $this->add_data_by_key( 'post_amp_content', $amp_content->get_amp_content() );
 
 
324
  $this->merge_data_for_key( 'amp_component_scripts', $amp_content->get_amp_scripts() );
325
  $this->merge_data_for_key( 'post_amp_styles', $amp_content->get_amp_styles() );
326
  }else{
@@ -330,6 +332,76 @@ class AMP_Post_Template {
330
  }
331
  }
332
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
333
  private function build_post_featured_image() {
334
  $post_id = $this->ID;
335
  $image_size = apply_filters( 'ampforwp_featured_image_size', 'large' );
320
  )
321
  );
322
 
323
+ $amp_con = $amp_content->get_amp_content();
324
+ $amp_con = $this->ampforwp_add_fallback_element($amp_con,'amp-img');
325
+ $this->add_data_by_key( 'post_amp_content', $amp_con);
326
  $this->merge_data_for_key( 'amp_component_scripts', $amp_content->get_amp_scripts() );
327
  $this->merge_data_for_key( 'post_amp_styles', $amp_content->get_amp_styles() );
328
  }else{
332
  }
333
  }
334
 
335
+ private function ampforwp_imagify_webp_compatibility($content){
336
+ if(function_exists('_imagify_init')){
337
+ preg_match_all('/src="(.*?)"/', $content,$src);
338
+ $imageify_opt = get_option( 'imagify_settings' );
339
+ $convert_to_webp = $imageify_opt['convert_to_webp'];
340
+ $display_webp = $imageify_opt['display_webp'];
341
+ if($convert_to_webp && $display_webp){
342
+ $img_url = esc_url($src[1][0]);
343
+ $rep_url = esc_url($src[1][0]).".webp";
344
+ $content = str_replace($img_url, $rep_url, $content);
345
+ }
346
+ }
347
+ return $content;
348
+ }
349
+ private function ampforwp_imagify_fallback_img_src_url($content){
350
+ if(!function_exists('_imagify_init')){
351
+ preg_match_all('/src=\"(.*?)\.(webp)\"/', $content,$cc); // need to check extenstion for fallback.
352
+ if(isset($cc[2][0])){
353
+ $ext = esc_attr($cc[2][0]);
354
+ $content = str_replace($ext, "jpg", $content); // need to change fallback extenstion.
355
+ }
356
+
357
+ }
358
+ return $content;
359
+ }
360
+
361
+
362
+ private function ampforwp_add_fallback_element($content='',$tag=''){
363
+ preg_match_all('/<'.$tag.' (.*?)<\/'.$tag.'>/', $content, $matches);
364
+ if(!empty($matches)){
365
+ if(isset($matches[0])){
366
+ $con = "";
367
+ for($i=0;$i<count($matches[0]);$i++){
368
+ $match = $matches[0][$i];
369
+ $m_content = $matches[1][$i];
370
+ $m_content = $this->ampforwp_imagify_webp_compatibility($m_content);
371
+ $m1_content = $this->ampforwp_imagify_fallback_img_src_url($matches[1][$i]);
372
+ preg_match_all('/src="(.*?)"/', $m1_content,$fimgsrc);
373
+ preg_match_all('/width="(.*?)"/', $m1_content,$fimgwidth);
374
+ preg_match_all('/height="(.*?)"/', $m1_content,$fimgheight);
375
+ preg_match_all('/alt="(.*?)"/', $m1_content,$fimgalt);
376
+
377
+ $data['src'] = $fimgsrc[1][0];
378
+ $data['width'] = $fimgwidth[1][0];
379
+ $data['height'] = $fimgheight[1][0];
380
+ $data['alt'] = ($fimgalt[1][0]?:'');
381
+ $fallback_data = apply_filters('ampforwp_fallback_image_params',$data);
382
+ $fsrc = $fallback_data['src'];
383
+ $fwidth = $fallback_data['width'];
384
+ $fheight= $fallback_data['height'];
385
+ $falt = $fallback_data['alt'];
386
+ $ssrc = $fimgsrc[0][0];
387
+ $swidth = $fimgwidth[0][0];
388
+ $sheight = $fimgheight[0][0];
389
+ $salt = ($fimgalt[0][0]?:'');
390
+ $src_rep = 'src="'.esc_url($fsrc).'"';
391
+ $width_rep = 'width="'.intval($fwidth).'"';
392
+ $height_rep = 'height="'.intval($fheight).'"';
393
+ $alt_rep = 'alt="'.esc_attr($falt).'"';
394
+ $m1_content = str_replace($ssrc, $src_rep, $m1_content);
395
+ $m1_content = str_replace($swidth, $width_rep, $m1_content);
396
+ $m1_content = str_replace($sheight, $height_rep, $m1_content);
397
+ $m1_content = str_replace($salt, $alt_rep, $m1_content);
398
+ $fallback_img = "<amp-img ".$m_content."<amp-img fallback ".$m1_content."</amp-img></amp-img>";//$m_content, $m1_content escaped above.
399
+ $content = str_replace("$match", $fallback_img, $content);
400
+ }
401
+ }
402
+ }
403
+ return $content;
404
+ }
405
  private function build_post_featured_image() {
406
  $post_id = $this->ID;
407
  $image_size = apply_filters( 'ampforwp_featured_image_size', 'large' );
install/index.php CHANGED
@@ -142,7 +142,7 @@ if(isset($redux_builder_amp['opt-media']['url']) && $redux_builder_amp['opt-medi
142
  }
143
 
144
  function ampforwp_instller_admin_init(){
145
- if(isset($_GET['ampforwp_install'], $_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], '_wpnonce') && $_GET['ampforwp_install']=='1' && is_admin()){
146
  ampforwp_steps_call();
147
  }
148
  }
142
  }
143
 
144
  function ampforwp_instller_admin_init(){
145
+ if(isset($_GET['ampforwp_install'], $_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], '_wpnonce') && $_GET['ampforwp_install']=='1'){
146
  ampforwp_steps_call();
147
  }
148
  }
pagebuilder/components/fieldsTemplate.php CHANGED
@@ -56,6 +56,7 @@ if ( ! defined( 'ABSPATH' ) ) exit; ?>
56
  </option>
57
  </select>
58
  <div class="help-msg" v-html="field.helpmessage"></div>
 
59
  </div>
60
  <div class="clearfix"></div>
61
  </div>
56
  </option>
57
  </select>
58
  <div class="help-msg" v-html="field.helpmessage"></div>
59
+ <div class="spinner spinner-cat-mod" :id="field.name+1"></div>
60
  </div>
61
  <div class="clearfix"></div>
62
  </div>
pagebuilder/functions.php CHANGED
@@ -108,11 +108,11 @@ function amppbbase_admin_scripts( $hook_suffix ){
108
  );
109
  wp_localize_script( 'amppb-admin', 'amppb_panel_options',$components_options);
110
  wp_enqueue_script('amppb-admin');
111
- add_action( 'admin_footer', 'js_templates',9999);
112
  }
113
  }
114
 
115
- function js_templates() {
116
  global $containerCommonSettings;
117
  global $moduleTemplate;
118
  global $layoutTemplate;
108
  );
109
  wp_localize_script( 'amppb-admin', 'amppb_panel_options',$components_options);
110
  wp_enqueue_script('amppb-admin');
111
+ add_action( 'admin_footer', 'amppb_js_templates',9999);
112
  }
113
  }
114
 
115
+ function amppb_js_templates() {
116
  global $containerCommonSettings;
117
  global $moduleTemplate;
118
  global $layoutTemplate;
pagebuilder/inc/admin-amp-page-builder.css CHANGED
@@ -1412,4 +1412,10 @@ body .modal-footer .del-btn-modal{
1412
  top: 100px;
1413
  left: 170px;
1414
  right: 300px;
1415
- }
 
 
 
 
 
 
1412
  top: 100px;
1413
  left: 170px;
1414
  right: 300px;
1415
+ }
1416
+ .spinner.spinner-cat-mod{
1417
+ visibility: hidden;
1418
+ position: relative;
1419
+ top: -27px;
1420
+ right: -18px;
1421
+ }
pagebuilder/inc/admin-amp-page-builder.js CHANGED
@@ -714,6 +714,11 @@ Vue.component('fields-data',{
714
  var dataAjax = this.field.ajax;//currentSelectfield.getAttribute("data-ajax-dep");
715
  var dataAjaxDep = this.field.ajax_dep;//currentSelectfield.getAttribute("data-ajax-dep");
716
  var ajaxAction = this.field.ajax_action;//currentSelectfield.getAttribute("data-ajax-action");
 
 
 
 
 
717
  if(typeof dataAjax == 'undefined'){ console.log(dataAjax); return ; }//return if Selectbox not allowed ajax
718
  this.$http.post(amppb_panel_options.ajaxUrl+'?action='+ajaxAction,
719
  {
@@ -735,6 +740,9 @@ Vue.component('fields-data',{
735
  app.modalcontent.fields.forEach(function(modaldata, key){
736
  if(modaldata.name==dataAjaxDep){
737
  modaldata.options_details = response.data;
 
 
 
738
  }
739
  });
740
  }else{
714
  var dataAjax = this.field.ajax;//currentSelectfield.getAttribute("data-ajax-dep");
715
  var dataAjaxDep = this.field.ajax_dep;//currentSelectfield.getAttribute("data-ajax-dep");
716
  var ajaxAction = this.field.ajax_action;//currentSelectfield.getAttribute("data-ajax-action");
717
+ if('category_selection'==dataAjaxDep || 'taxonomy_selection'==dataAjaxDep){
718
+ if(document.getElementById(dataAjaxDep+"1")){
719
+ document.getElementById(dataAjaxDep+"1").style.visibility = "visible";
720
+ }
721
+ }
722
  if(typeof dataAjax == 'undefined'){ console.log(dataAjax); return ; }//return if Selectbox not allowed ajax
723
  this.$http.post(amppb_panel_options.ajaxUrl+'?action='+ajaxAction,
724
  {
740
  app.modalcontent.fields.forEach(function(modaldata, key){
741
  if(modaldata.name==dataAjaxDep){
742
  modaldata.options_details = response.data;
743
+ if(document.getElementById(dataAjaxDep+"1")){
744
+ document.getElementById(dataAjaxDep+"1").style.visibility = "hidden";
745
+ }
746
  }
747
  });
748
  }else{
pagebuilder/inc/adminAjaxContents.php CHANGED
@@ -174,9 +174,10 @@ function ampforwp_get_image() {
174
  echo json_encode(array("status"=>300,"message"=>'User not have authority'));
175
  die;
176
  }
177
- if(isset($_GET['id']) ){
178
- if(strpos($_GET['id'],",") !== false){
179
- $get_ids = explode(",", $_GET['id']);
 
180
 
181
  if(count($get_ids)>0){
182
  foreach($get_ids as $id){
@@ -232,27 +233,45 @@ function ampforwp_icons_list_format(){
232
  echo json_encode(array('success'=>true,'data'=>$amp_icons_list));
233
  exit;
234
  }
235
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  add_action( 'wp_ajax_ampforwp_pb_cats', 'ampforwp_pb_cats');
237
  function ampforwp_pb_cats(){
238
  if(!wp_verify_nonce( $_REQUEST['verify_nonce'], 'verify_pb' ) ) {
239
  echo json_encode(array("status"=>300,"message"=>'Request not valid'));
240
  die;
241
  }
242
- $cats = $taxs = array();
243
- $post = '';
244
- $post = sanitize_text_field($_POST['selected_val']);
245
- $taxs = get_object_taxonomies( $post );
246
- if(!empty($taxs)){
247
- $cats = get_terms($taxs['0'],array(
248
- 'orderby' => 'name',
249
  'order' => 'ASC',
250
  'number' => 500
251
  ) );
252
- }
253
  $return = array();
254
- if($cats){
255
- foreach ($cats as $key => $value) {
256
  $return[$value->term_id] = $value->name;
257
  }
258
  }
174
  echo json_encode(array("status"=>300,"message"=>'User not have authority'));
175
  die;
176
  }
177
+ $get_id = intval($_GET['id']);
178
+ if(isset($get_id)){
179
+ if(strpos($get_id,",") !== false){
180
+ $get_ids = explode(",", $get_id);
181
 
182
  if(count($get_ids)>0){
183
  foreach($get_ids as $id){
233
  echo json_encode(array('success'=>true,'data'=>$amp_icons_list));
234
  exit;
235
  }
236
+ add_action( 'wp_ajax_ampforwp_pb_taxonomy', 'ampforwp_pb_taxonomy');
237
+ function ampforwp_pb_taxonomy(){
238
+ if(!wp_verify_nonce( $_REQUEST['verify_nonce'], 'verify_pb' ) ) {
239
+ echo json_encode(array("status"=>300,"message"=>'Request not valid'));
240
+ die;
241
+ }
242
+ $taxs = array();
243
+ $post = '';
244
+ $post = sanitize_text_field($_POST['selected_val']);
245
+ $taxs = get_object_taxonomies( $post );
246
+ $return = array();
247
+ if(!empty($taxs)){
248
+ foreach ($taxs as $taxonomy) {
249
+ $taxonomies = get_taxonomy( $taxonomy );
250
+ $return[esc_attr($taxonomies->name)] = esc_html($taxonomies->labels->singular_name);
251
+ }
252
+ }
253
+ $return['recent_option']= 'Recent Posts';
254
+ echo json_encode(array('success'=>true,'data'=>$return));
255
+ exit;
256
+
257
+ }
258
  add_action( 'wp_ajax_ampforwp_pb_cats', 'ampforwp_pb_cats');
259
  function ampforwp_pb_cats(){
260
  if(!wp_verify_nonce( $_REQUEST['verify_nonce'], 'verify_pb' ) ) {
261
  echo json_encode(array("status"=>300,"message"=>'Request not valid'));
262
  die;
263
  }
264
+ $cats = array();
265
+ $taxonomy = '';
266
+ $taxonomy = sanitize_text_field($_POST['selected_val']);
267
+ $terms = get_terms( $taxonomy, array(
268
+ 'orderby' => 'name',
 
 
269
  'order' => 'ASC',
270
  'number' => 500
271
  ) );
 
272
  $return = array();
273
+ if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){
274
+ foreach ($terms as $key => $value) {
275
  $return[$value->term_id] = $value->name;
276
  }
277
  }
pagebuilder/inc/viewShowFrontData.php CHANGED
@@ -869,10 +869,10 @@ function ampforwp_rowData($container,$col,$moduleTemplate){
869
  'post_status'=> 'publish',
870
  'post_type' => $fieldValues['post_type_selection']
871
  );
872
- if ( isset($fieldValues['category_selection']) && 'recent_option' !== $fieldValues['category_selection'] ) {
873
  $args['tax_query'] = array(
874
  array(
875
- 'taxonomy'=>(isset($fieldValues['category_selection']))?get_term($fieldValues['category_selection'])->taxonomy: '',
876
  'field'=>'id',
877
  'terms'=>$fieldValues['category_selection']));
878
  }
869
  'post_status'=> 'publish',
870
  'post_type' => $fieldValues['post_type_selection']
871
  );
872
+ if ( (isset($fieldValues['taxonomy_selection']) && 'recent_option' !== $fieldValues['taxonomy_selection']) && (isset($fieldValues['category_selection']) && 'recent_option' !== $fieldValues['category_selection'])) {
873
  $args['tax_query'] = array(
874
  array(
875
+ 'taxonomy'=>$fieldValues['taxonomy_selection'],
876
  'field'=>'id',
877
  'terms'=>$fieldValues['category_selection']));
878
  }
pagebuilder/modules/contents-module.php CHANGED
@@ -115,7 +115,7 @@ $categoriesArray = array();
115
  if ( is_admin() ) {
116
  $post_types = get_post_types(array('public'=>true));
117
  $post_types = get_option('ampforwp_cpt_generated_post_types');
118
- $post_types['post'] = 'post';
119
  $categories = get_categories( array(
120
  'orderby' => 'name',
121
  'order' => 'ASC',
@@ -234,6 +234,19 @@ if ( is_admin() ) {
234
  'options_details'=>$post_types ,
235
  'content_type'=>'html',
236
  'ajax' => true,
 
 
 
 
 
 
 
 
 
 
 
 
 
237
  'ajax_dep' => 'category_selection',
238
  'ajax_action' => 'ampforwp_pb_cats'
239
  ),
@@ -542,7 +555,15 @@ if ( is_admin() ) {
542
  if( isset($fieldValues['pagination']) && $fieldValues['pagination'] == 1){
543
 
544
  /*Pagination Sart*/
545
- $total_num_pages = $the_query->max_num_pages;
 
 
 
 
 
 
 
 
546
  if(isset($_GET[$pagination_text]) && $_GET[$pagination_text]!='' ){
547
  $paged = intval($_GET[$pagination_text]);
548
  }else{
@@ -566,11 +587,13 @@ if ( is_admin() ) {
566
  $startPage = max( 1, $paged - $count);
567
  $endPage = min( $total_num_pages, $paged + $count);
568
  for($i = $startPage ; $i <= $endPage ; $i++){
569
- if( $paged == $i){
570
  $pagination_links .= "<a class='active' href='#/' >".esc_html__($i, 'accelerated-mobile-pages')."</a>";
571
  }else{
572
  $allPages = add_query_arg( array( $pagination_text => $i ), $queryUrl );
573
- $pagination_links .= "<a href =".esc_url($allPages)." >".esc_html__($i, 'accelerated-mobile-pages')."</a>";
 
 
574
  }
575
 
576
  }
115
  if ( is_admin() ) {
116
  $post_types = get_post_types(array('public'=>true));
117
  $post_types = get_option('ampforwp_cpt_generated_post_types');
118
+ $post_types['post'] = 'Post';
119
  $categories = get_categories( array(
120
  'orderby' => 'name',
121
  'order' => 'ASC',
234
  'options_details'=>$post_types ,
235
  'content_type'=>'html',
236
  'ajax' => true,
237
+ 'ajax_dep' => 'taxonomy_selection',
238
+ 'ajax_action' => 'ampforwp_pb_taxonomy'
239
+ ),
240
+ array(
241
+ 'type' =>'select',
242
+ 'name' =>"taxonomy_selection",
243
+ 'label' => esc_html__("Select Taxonomy","accelerated-mobile-pages"),
244
+ 'tab' =>'customizer',
245
+ 'default' =>'',
246
+ 'options' => $options,
247
+ 'options_details'=>$categoriesArray ,
248
+ 'content_type'=>'html',
249
+ 'ajax' => true,
250
  'ajax_dep' => 'category_selection',
251
  'ajax_action' => 'ampforwp_pb_cats'
252
  ),
555
  if( isset($fieldValues['pagination']) && $fieldValues['pagination'] == 1){
556
 
557
  /*Pagination Sart*/
558
+ $offset = $fieldValues['posts_offset'];
559
+ $per_page = $the_query->query['posts_per_page'];
560
+ $offset_num = ceil($offset/$per_page);
561
+
562
+ if( $the_query->max_num_pages == $offset_num ){
563
+ $total_num_pages = $the_query->max_num_pages;
564
+ }else{
565
+ $total_num_pages = $the_query->max_num_pages - $offset_num;
566
+ }
567
  if(isset($_GET[$pagination_text]) && $_GET[$pagination_text]!='' ){
568
  $paged = intval($_GET[$pagination_text]);
569
  }else{
587
  $startPage = max( 1, $paged - $count);
588
  $endPage = min( $total_num_pages, $paged + $count);
589
  for($i = $startPage ; $i <= $endPage ; $i++){
590
+ if( $paged == $i && $startPage!=$endPage){
591
  $pagination_links .= "<a class='active' href='#/' >".esc_html__($i, 'accelerated-mobile-pages')."</a>";
592
  }else{
593
  $allPages = add_query_arg( array( $pagination_text => $i ), $queryUrl );
594
+ if($startPage!=$endPage){
595
+ $pagination_links .= "<a href =".esc_url($allPages)." >".esc_html__($i, 'accelerated-mobile-pages')."</a>";
596
+ }
597
  }
598
 
599
  }
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: mohammed_kaludi, ahmedkaludi, ampforwp
3
  Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin, SEO
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
- Tested up to: 5.3
7
- Stable tag: 1.0.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -191,6 +191,19 @@ You can contact us from [here](https://ampforwp.com/contact/)
191
 
192
  == Changelog ==
193
 
 
 
 
 
 
 
 
 
 
 
 
 
 
194
  = 1.0.1 (14th December 2019) =
195
  * Fixed: Telegram as social profile #3754
196
  * Fixed: Give default styling for <small> tag. #3879
@@ -220,18 +233,4 @@ You can contact us from [here](https://ampforwp.com/contact/)
220
  * Fixed: when images are placed along with the anchor tag in gallery module of guntenberg editor the image src is getting unknown in AMP #3923
221
  * Fixed: When RTL is enabled,the menu in header is going to right but the elements in right are not moved to left. #3881
222
 
223
- = 0.9.98.22 (9th December 2019) =
224
- * Improvement: Need to add full short pixel plugin compatibility #3782
225
- * Fixed: Need to improve UI when "Saved" notification displays. #3856
226
- * Fixed: Need to show the Attention message when custom AMP editor box checked but there is no content in it #2866
227
- * Fixed: Issue with AMP page builder tool when images are inserted in slider module. #3780
228
- * Fixed: Hidden posts in AMP should not show in related posts #3839
229
- * Fixed: Make header Unsticky not working when Infinite scrolling is turned on. #3831
230
- * Fixed: The post title appears 2 times: after the parent category and after the child on breadcrumb. #3724
231
- * Fixed: data-block-on-consent missing in GTM code #3911
232
- * Fixed: PHP Warnings from redux filesystem #3901
233
- * Fixed: Debug notice #3913
234
- * Fixed: Sidebar Widgets Default CSS should load on Woo commerce Sidebar #3912
235
- * Fixed: Images get streched in new version of the AMP FOR WP Plugin #3914
236
-
237
  Full changelog available [ at changelog.txt](https://plugins.svn.wordpress.org/accelerated-mobile-pages/trunk/changelog.txt)
3
  Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin, SEO
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
+ Tested up to: 5.3.1
7
+ Stable tag: 1.0.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
191
 
192
  == Changelog ==
193
 
194
+ = 1.0.2 (19th December 2019) =
195
+ * Improvement: Need to add wordpress default Gutenburg editor 'Block' settings Compatibility in AMP #3320
196
+ * Improvement: Need to make compatibility with the Imagify plugin #3908
197
+ * Improvement: Taxonomy support in AMP Page Builder category module #3310
198
+ * Improvement: Add support of fallback images in AMP #3790
199
+ * Improvement: General code improvements part 3 #3941
200
+ * Improvement: Drop down support in Alternative Menu in Mobile view. #2768
201
+ * Fixed: The Alternate Menu does not redirecting to the AMP for the product category in menu items #3915
202
+ * Fixed: Sub-Category Archives on AMP page should be connected to Change internal links to AMP option. #3924
203
+ * Fixed: Debug warning : Undefined index element #3958
204
+ * Fixed: MGID Ads are not loading when the Flexible AMP widget option is enabled in the AMP #3864
205
+ * Fixed: The Close bar is not appearing menu check in mobile iPhone #3964
206
+
207
  = 1.0.1 (14th December 2019) =
208
  * Fixed: Telegram as social profile #3754
209
  * Fixed: Give default styling for <small> tag. #3879
233
  * Fixed: when images are placed along with the anchor tag in gallery module of guntenberg editor the image src is getting unknown in AMP #3923
234
  * Fixed: When RTL is enabled,the menu in header is going to right but the elements in right are not moved to left. #3881
235
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  Full changelog available [ at changelog.txt](https://plugins.svn.wordpress.org/accelerated-mobile-pages/trunk/changelog.txt)
templates/design-manager.php CHANGED
@@ -19,10 +19,11 @@ if ( is_customize_preview() ) {
19
  }
20
 
21
  $data = get_option( 'ampforwp_design',array());
 
22
  // Adding default Value
23
- if ($data['elements'] == '') {
24
  $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";
25
- }
26
 
27
  if( isset( $data['elements'] ) || ! empty( $data['elements'] ) ){
28
  $options = explode( ',', $data['elements'] );
19
  }
20
 
21
  $data = get_option( 'ampforwp_design',array());
22
+
23
  // Adding default Value
24
+ if (empty($data)){
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'] ) ){
29
  $options = explode( ',', $data['elements'] );
templates/design-manager/swift/style.php CHANGED
@@ -330,52 +330,77 @@ cursor: pointer;border-radius: 35px;color: <?php echo ampforwp_sanitize_color($r
330
  <?php } ?>
331
  .hamb-mnu ::-webkit-scrollbar {display: none;}
332
  <?php //primary menu
333
- if($redux_builder_amp['primary-menu']){?>
334
- .p-m-fl{width:100%;border-bottom: 1px solid rgba(0, 0, 0, 0.05);<?php if(ampforwp_get_setting('primary-menu-background-scheme','rgba') ){?>background:<?php echo ampforwp_get_setting('primary-menu-background-scheme','rgba'); ?><?php } ?>}
335
- .p-menu{width:100%;text-align:center;margin: 0px auto;<?php if($redux_builder_amp['primary-menu-padding-control']){?>padding: <?php echo ' 0px ' .' '.esc_html($redux_builder_amp['primary-menu-padding-control']['padding-right']) .' 0px '.esc_html($redux_builder_amp['primary-menu-padding-control']['padding-left']) ; ?>;<?php } ?>}
336
- .p-menu ul li{display: inline-block;margin-right: 21px;font-size: 12px;line-height: 20px;letter-spacing: 1px;font-weight: 400;}
337
- .p-menu ul li a{<?php if($redux_builder_amp['primary-menu-text-scheme']['rgba']){?>color:<?php echo ampforwp_sanitize_color($redux_builder_amp['primary-menu-text-scheme']['rgba'])?>;<?php } ?>
338
- padding: <?php echo esc_html($redux_builder_amp['primary-menu-padding-control']['padding-top']) .' 0px '.esc_html($redux_builder_amp['primary-menu-padding-control']['padding-bottom']) .' 0px' ; ?>}
 
 
 
 
 
 
 
 
 
 
339
  .p-menu input{display:none}
340
- .p-menu .toggle {display:none }
341
  <?php // Dropdown CSS
342
  if($redux_builder_amp['drp-dwn']){?>
343
- .p-menu ul li:hover>ul{display:block;z-index:9;padding: 7px 0px 7px 7px;
344
  box-shadow: 1px 1px 15px 1px rgba(0, 0, 0, 0.30);border-radius: 4px;}
345
- .p-menu li a{transition: all 0.3s ease-in-out 0s;}
346
- .p-menu .amp-menu li ul{background: <?php echo ampforwp_sanitize_color($redux_builder_amp['primary-menu-background-scheme']['rgba']); ?>;left: 0;min-width: 200px;opacity: 1;position: absolute;top: 100%;transform: translateY(15px);transition: all 0.3s ease-in-out 0s;visibility: hidden;text-align:left;}
 
347
  .p-menu .amp-menu li ul li ul{left: 100%;top: 0;}
348
- .p-menu li:hover > ul{opacity: 1;transform: translateY(0px);visibility: visible;transition: all 0.2s ease-in-out 0s;}
349
  .p-menu li ul li{display: block;position: relative;}
350
- .p-menu ul li.menu-item-has-children .sub-menu li a{padding:7px;}
351
- .p-menu ul li.menu-item-has-children > a:after{
352
- <?php if ( $ampforwp_font_icon == 'swift-icons' ){ ?>
353
- content: "\e313";font-family: 'icomoon';font-size: 16px;right:10px;top: 3px;
354
  <?php }
355
- if ( $ampforwp_font_icon == 'fontawesome-icons' ){ ?>
356
- content:"\f107";font-family: "Font Awesome 5 Free";font-weight:600;font-size:14px;right: 6px;top: 1px;
357
  <?php } ?>
358
- display: inline-block;top: 3px;font-size: 16px;color: rgba(0,41,96,1);position:relative;padding-left: 10px;line-height:0;right:10px;color:<?php echo ampforwp_sanitize_color($redux_builder_amp['primary-menu-text-scheme']['rgba'])?>;}
359
- .p-menu .amp-menu li.menu-item-has-children>ul>li {padding-left: 0px;margin-right:0;}
360
- .p-menu li.menu-item-has-children:hover > a:after{transform:rotate(180deg);
361
- <?php if ( $ampforwp_font_icon == 'swift-icons' ){ ?>
362
- right:0px;
363
- <?php } if ( $ampforwp_font_icon == 'fontawesome-icons' ){ ?>
364
- right:-3px;
365
- <?php } ?>}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
366
  <?php } else { ?>
367
- .p-menu .amp-menu li.menu-item-has-children:hover>ul{display:none;}
368
- .p-menu{overflow-x: auto;overflow-y:hidden;white-space: nowrap;}
369
- <?php } ?>
370
- .p-menu ul li.menu-item-has-children:after{display:none;}
371
- .amp-menu .toggle:after{position:absolute;}
372
- @media(max-width:768px){
373
- .p-menu ul li.menu-item-has-children:hover > ul{display:none;}
374
- .p-menu{overflow-x: auto;overflow-y:hidden;white-space: nowrap;}
375
- .p-menu ul li.menu-item-has-children > a:after{display:none;}
376
- }
377
- <?php } ?>
378
- <?php } // Levelup condition ends ?>
379
 
380
  <?php //Home and Archive
381
 
@@ -721,10 +746,6 @@ line-height: 1.2;top: 6px;}
721
  @supports not (-webkit-overflow-scrolling: touch) {
722
  .m-ctr{overflow:scroll;}
723
  }
724
- .m-ctr {
725
- position: fixed;
726
- overflow: scroll;
727
- }
728
  .m-scrl {
729
  display: inline-block;
730
  width: 100%;
330
  <?php } ?>
331
  .hamb-mnu ::-webkit-scrollbar {display: none;}
332
  <?php //primary menu
333
+ $pmenu_bg_clr = ampforwp_get_setting('primary-menu-background-scheme','rgba');
334
+ $pmenu_text_clr = ampforwp_get_setting('primary-menu-text-scheme','rgba');
335
+ if(empty($pmenu_bg_clr)){
336
+ $pmenu_bg_clr ='rgba(239, 239, 239,1)';
337
+ }
338
+ if(empty($pmenu_text_clr)){
339
+ $pmenu_text_clr ='rgba(53, 53, 53,1)';
340
+ }
341
+ if( ampforwp_get_setting ('primary-menu') ){?>
342
+ .p-m-fl{width:100%;border-bottom: 1px solid rgba(0, 0, 0, 0.05);background:<?php echo ampforwp_sanitize_color($pmenu_bg_clr); ?>;}
343
+ .p-menu{width:100%;text-align:center;margin: 0px auto;
344
+ padding: <?php echo ' 0px ' .' '.esc_html(ampforwp_get_setting('primary-menu-padding-control')['padding-right']) .' 0px '.esc_html(ampforwp_get_setting('primary-menu-padding-control')['padding-left']) ; ?>;}
345
+ .p-menu ul li{display: inline-block;margin-right: 21px;font-size: 12px;line-height: 20px;letter-spacing: 1px;font-weight: 400;position:relative;}
346
+ .p-menu ul li a{
347
+ color:<?php echo ampforwp_sanitize_color($pmenu_text_clr); ?>;
348
+ padding: <?php echo esc_html(ampforwp_get_setting('primary-menu-padding-control')['padding-top']) .' 0px '.esc_html(ampforwp_get_setting('primary-menu-padding-control')['padding-bottom']) .' 0px' ; ?>;display:inline-block;}
349
  .p-menu input{display:none}
350
+ .p-menu .amp-menu .toggle:after{display:none;}
351
  <?php // Dropdown CSS
352
  if($redux_builder_amp['drp-dwn']){?>
353
+ .p-menu ul li ul{display:block;padding: 7px;
354
  box-shadow: 1px 1px 15px 1px rgba(0, 0, 0, 0.30);border-radius: 4px;}
355
+ .p-menu ul li:hover>ul {display: block;z-index: 9;}
356
+ .p-menu li a{transition: all 0s ease-in-out 0s;}
357
+ .p-menu .amp-menu li ul{background:<?php echo ampforwp_sanitize_color($pmenu_bg_clr); ?>;left: 0;min-width: 200px;opacity: 1;position: absolute;top: 100%;text-align:left;}
358
  .p-menu .amp-menu li ul li ul{left: 100%;top: 0;}
359
+ .p-menu li:hover > ul{opacity: 1;transform: translateY(0px);visibility: visible;transition: all 0.1s ease-in-out 0s;}
360
  .p-menu li ul li{display: block;position: relative;}
361
+ .p-menu ul li.menu-item-has-children .sub-menu li a{padding:8px 10px 8px 10px;}
362
+ .p-menu .amp-menu .toggle:after {cursor: pointer;
363
+ <?php if ( ampforwp_get_setting('ampforwp_font_icon') == 'swift-icons' ){ ?>
364
+ content: "\e313";font-family: 'icomoon';font-size: 16px;top: 3px;transform: rotate(360deg);
365
  <?php }
366
+ if ( ampforwp_get_setting('ampforwp_font_icon') == 'fontawesome-icons' ){ ?>
367
+ content:"\f107";font-family: "Font Awesome 5 Free";font-weight:600;font-size:14px;right: 0px;top: 1px;
368
  <?php } ?>
369
+ display: inline-block;position:relative;padding:0px;line-height:0;
370
+ color:<?php echo ampforwp_sanitize_color($pmenu_text_clr); ?>;}
371
+ .p-menu .amp-menu [id^=drop]:checked + .toggle:after {
372
+ transform: rotate(-180deg);
373
+ }
374
+ .p-menu .amp-menu li.menu-item-has-children>ul>li{padding:0;}
375
+ @media(max-width:768px){
376
+ .p-menu ul li:hover>ul {display:none;}
377
+ .p-menu .amp-menu [id^=drop]:checked + label + ul{display:block;z-index:9;}
378
+ .p-m-fl{position:relative;}
379
+ .p-menu{white-space: nowrap;overflow: scroll;}
380
+ .p-menu ul li{position: unset;}
381
+ .p-menu .amp-menu .dropdown-toggle + [id^=drop]:checked + label + ul {position: absolute;left: 20px;top:45px;right: 20px;bottom: auto;}
382
+ .p-menu .toggle{background: #ddd;border-radius: 4px;padding: 0px 1px 1px 0px;}
383
+ .p-menu .amp-menu [id^=drop]:checked + .toggle:after {left:0px;}
384
+ .p-menu .amp-menu .toggle:after{left:1px;}
385
+ .p-menu .amp-menu li ul{border-bottom: 1px solid #ccc;}
386
+ .p-menu .amp-menu li ul li ul {left: 0px;top: 0;position: relative;box-shadow: none;border-top: 1px solid #ccc;padding: 0 0 0 10px;margin: 5px 0px 5px 0px;}
387
+ .p-menu .amp-menu li ul li ul li ul{border-bottom: none;}
388
+ }
389
+ @media(max-width:450px){
390
+ .p-menu .amp-menu .dropdown-toggle + [id^=drop]:checked + label + ul {
391
+ left: 12px;
392
+ right: 12px;
393
+ }
394
+ }
395
  <?php } else { ?>
396
+ .p-menu{white-space: nowrap;}
397
+ @media(max-width:768px){
398
+ .p-menu{overflow: scroll;}
399
+ }
400
+
401
+ <?php } // Dropdown CSS Ends
402
+ } // Primary CSS Ends
403
+ } // Levelup condition ends ?>
 
 
 
 
404
 
405
  <?php //Home and Archive
406
 
746
  @supports not (-webkit-overflow-scrolling: touch) {
747
  .m-ctr{overflow:scroll;}
748
  }
 
 
 
 
749
  .m-scrl {
750
  display: inline-block;
751
  width: 100%;
templates/features.php CHANGED
@@ -6473,15 +6473,24 @@ if ( ! function_exists('ampforwp_sd_feature_image_guidlines') ) {
6473
  }
6474
  }
6475
  // Gutenberg Modules CSS #2707
 
6476
  add_action('amp_post_template_css', 'ampforwp_gutenberg_css');
 
6477
  if ( ! function_exists('ampforwp_gutenberg_css') ) {
6478
- function ampforwp_gutenberg_css(){ ?>
 
6479
  .wp-block-button { color: #fff}
6480
  .wp-block-button a {background-color: #32373c;border-radius: 28px;color: inherit;display: inline-block;padding: 12px 24px;}
6481
  .wp-block-cover{position:relative;background-color: #000;background-size: cover;background-position: center center;min-height: 430px;width: 100%;margin: 1.5em 0 1.5em 0;display: flex;justify-content: center;align-items: center;overflow: hidden;}
6482
  .wp-block-cover-text{color: #fff;font-size: 2em;line-height: 1.25;z-index: 1;}
6483
- .wp-block-cover-image.has-background-dim::before, .wp-block-cover.has-background-dim::before {content: "";position: absolute;top: 0;left: 0;bottom: 0;right: 0;background-color: inherit;opacity: .5;z-index: 1;}
6484
- <?php }
 
 
 
 
 
 
6485
  }
6486
  // Subtitles Plugin Support #2853
6487
  add_action('ampforwp_below_the_title','ampforwp_subtitles_support');
@@ -7364,4 +7373,46 @@ function ampforwp_short_pixel_cdn($content){
7364
  $compress_level .= '+ret_img+to_webp/';
7365
  $content = preg_replace('/<amp-img(.*?)src="(.*?)" width="(.*?)" height="(.*?)"(.*?)srcset="(.*?)"(.*?)<\/amp-img>/', '<amp-img$1 src="'.$api_url.'/w_$3'.$compress_level.'$2"width="$3"height="$4"$7</amp-img>', $content);
7366
  return $content;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7367
  }
6473
  }
6474
  }
6475
  // Gutenberg Modules CSS #2707
6476
+ if(ampforwp_get_setting('ampforwp_css_tree_shaking') == true && ampforwp_is_gutenberg_active()){
6477
  add_action('amp_post_template_css', 'ampforwp_gutenberg_css');
6478
+ }
6479
  if ( ! function_exists('ampforwp_gutenberg_css') ) {
6480
+ function ampforwp_gutenberg_css(){
6481
+ $color_data = get_theme_support('editor-color-palette');?>
6482
  .wp-block-button { color: #fff}
6483
  .wp-block-button a {background-color: #32373c;border-radius: 28px;color: inherit;display: inline-block;padding: 12px 24px;}
6484
  .wp-block-cover{position:relative;background-color: #000;background-size: cover;background-position: center center;min-height: 430px;width: 100%;margin: 1.5em 0 1.5em 0;display: flex;justify-content: center;align-items: center;overflow: hidden;}
6485
  .wp-block-cover-text{color: #fff;font-size: 2em;line-height: 1.25;z-index: 1;}
6486
+ .wp-block-cover-image.has-background-dim::before, .wp-block-cover.has-background-dim::before {content: "";position: absolute;top: 0;left: 0;bottom: 0;right: 0;background-color: inherit;opacity: .5;z-index: 1;} <?php
6487
+ if ( $color_data ) {
6488
+ foreach ($color_data[0] as $key ) { ?>
6489
+ .has-<?php echo esc_attr($key['slug']);?>-color { color: <?php echo ampforwp_sanitize_color($key['color']);?>;} .has-<?php echo esc_attr($key['slug']);?>-background-color { background-color: <?php echo ampforwp_sanitize_color($key['color']);?> }
6490
+ <?php
6491
+ }
6492
+ }
6493
+ }
6494
  }
6495
  // Subtitles Plugin Support #2853
6496
  add_action('ampforwp_below_the_title','ampforwp_subtitles_support');
7373
  $compress_level .= '+ret_img+to_webp/';
7374
  $content = preg_replace('/<amp-img(.*?)src="(.*?)" width="(.*?)" height="(.*?)"(.*?)srcset="(.*?)"(.*?)<\/amp-img>/', '<amp-img$1 src="'.$api_url.'/w_$3'.$compress_level.'$2"width="$3"height="$4"$7</amp-img>', $content);
7375
  return $content;
7376
+ }
7377
+ if(ampforwp_get_setting('ampforwp_css_tree_shaking') == true && ampforwp_is_gutenberg_active()){
7378
+ add_action('amp_post_template_css','ampforwp_gutenberg_block_styles');
7379
+ }
7380
+ if(!function_exists('ampforwp_gutenberg_block_styles')){
7381
+ function ampforwp_gutenberg_block_styles(){
7382
+ $gutenberg_styles = '';
7383
+ ob_start();
7384
+ wp_print_styles('wp-block-library');
7385
+ $block_css .= ob_get_contents();
7386
+ ob_end_clean();
7387
+ preg_match("/href='(.*?)'/", $block_css, $matches);
7388
+ $style_path = explode('?', $matches[1]);
7389
+ $gutenberg_styles = get_transient('ampforwp_gutenberg_styles');
7390
+ if($gutenberg_styles == false){
7391
+ $response = wp_remote_get( $style_path[0] );
7392
+ if( is_array( $response ) && ! is_wp_error( $response ) ){
7393
+ set_transient('ampforwp_gutenberg_styles', $response['body'], 24 * HOUR_IN_SECONDS );
7394
+ }
7395
+ }
7396
+ echo ampforwp_css_sanitizer($gutenberg_styles);
7397
+ }
7398
+ }
7399
+
7400
+ function ampforwp_is_gutenberg_active() {
7401
+ $gutenberg = false;
7402
+ $block_editor = false;
7403
+ $use_block_editor = '';
7404
+ if ( has_filter( 'replace_editor', 'gutenberg_init' ) ) {
7405
+ $gutenberg = true;
7406
+ }
7407
+ if ( version_compare( $GLOBALS['wp_version'], '5.0-beta', '>' ) ) {
7408
+ $block_editor = true;
7409
+ }
7410
+ if ( ! $gutenberg && ! $block_editor ) {
7411
+ return false;
7412
+ }
7413
+ if ( !class_exists('Classic_Editor') ) {
7414
+ return true;
7415
+ }
7416
+ $use_block_editor = ( get_option( 'classic-editor-replace' ) === 'no-replace' );
7417
+ return $use_block_editor;
7418
  }