AMP for WP – Accelerated Mobile Pages - Version 1.0.77.50

Version Description

(24th August 2022) = * Fixed: "Back to Top link" option adds amp-animation & amp-position-observer script without its usage on page #5305 * Fixed: AMPforWP is creating "/amp" as an endpoint in Addon mode. #5303 * Improvements: Strange Exclamation mark . #5304

Download this release

Release Info

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

Code changes from version 1.0.77.49 to 1.0.77.50

README.md CHANGED
@@ -4,7 +4,7 @@ Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, go
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 6.0
7
- Stable tag: 1.0.77.49
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -197,6 +197,11 @@ Device testing done through [BrowserStack](https://www.browserstack.com)
197
 
198
  == Changelog ==
199
 
 
 
 
 
 
200
  = 1.0.77.49 (22nd August 2022) =
201
  * Fixed: There is a compatibility issue with the latest version of the All in One SEO Plugin. #5306
202
 
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 6.0
7
+ Stable tag: 1.0.77.50
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
197
 
198
  == Changelog ==
199
 
200
+ = 1.0.77.50 (24th August 2022) =
201
+ * Fixed: "Back to Top link" option adds amp-animation & amp-position-observer script without its usage on page #5305
202
+ * Fixed: AMPforWP is creating "/amp" as an endpoint in Addon mode. #5303
203
+ * Improvements: Strange Exclamation mark . #5304
204
+
205
  = 1.0.77.49 (22nd August 2022) =
206
  * Fixed: There is a compatibility issue with the latest version of the All in One SEO Plugin. #5306
207
 
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.77.49
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.77.49');
24
  define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
25
  if(!defined('AMPFROWP_HOST_NAME')){
26
  $urlinfo = get_bloginfo('url');
@@ -42,6 +42,10 @@ define('AMPFORWP_AMP_QUERY_VAR', apply_filters( 'amp_query_var', ampforwp_genera
42
 
43
  // Rewrite the Endpoints after the plugin is activate, as priority is set to 11
44
  function ampforwp_add_custom_post_support() {
 
 
 
 
45
  global $redux_builder_amp;
46
  add_rewrite_endpoint( AMPFORWP_AMP_QUERY_VAR, EP_PAGES | EP_PERMALINK | EP_AUTHORS | EP_ALL_ARCHIVES | EP_ROOT );
47
  // Pages
@@ -88,6 +92,11 @@ function ampforwp_get_the_page_id_blog_page(){
88
 
89
  // Add Custom Rewrite Rule to make sure pagination & redirection is working correctly
90
  function ampforwp_add_custom_rewrite_rules() {
 
 
 
 
 
91
  global $redux_builder_amp, $wp_rewrite;
92
  // For Homepage
93
  add_rewrite_rule(
@@ -338,6 +347,11 @@ function ampforwp_update_option_permalink_structure(){
338
  add_action( 'init', 'ampforwp_custom_rewrite_rules_for_product_category' );
339
  if ( ! function_exists('ampforwp_custom_rewrite_rules_for_product_category') ) {
340
  function ampforwp_custom_rewrite_rules_for_product_category(){
 
 
 
 
 
341
  if ( class_exists('WooCommerce') ) {
342
  $permalinks = wp_parse_args( (array) get_option( 'woocommerce_permalinks', array() ), array(
343
  'product_base' => '',
@@ -721,8 +735,11 @@ if ( ! function_exists('ampforwp_init') ) {
721
  do_action( 'amp_init' );
722
 
723
  load_plugin_textdomain( 'accelerated-mobile-pages', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
724
-
 
 
725
  add_rewrite_endpoint( AMP_QUERY_VAR, EP_PERMALINK );
 
726
  add_post_type_support( 'post', AMP_QUERY_VAR );
727
 
728
  add_filter( 'request', 'AMPforWP\\AMPVendor\\amp_force_query_var_value' );
@@ -1570,4 +1587,19 @@ if(!function_exists('ampforwp_save_local_font')){
1570
  add_action("amp_init", "ampforwp_amp_optimizer");
1571
  function ampforwp_amp_optimizer(){
1572
  require_once AMPFORWP_PLUGIN_DIR."/includes/amp-optimizer-addon.php";
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1573
  }
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.77.50
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.77.50');
24
  define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
25
  if(!defined('AMPFROWP_HOST_NAME')){
26
  $urlinfo = get_bloginfo('url');
42
 
43
  // Rewrite the Endpoints after the plugin is activate, as priority is set to 11
44
  function ampforwp_add_custom_post_support() {
45
+ // Adding rewrite rules only when we are in standard mode
46
+ if (is_amp_plugin_active()) {
47
+ return;
48
+ }
49
  global $redux_builder_amp;
50
  add_rewrite_endpoint( AMPFORWP_AMP_QUERY_VAR, EP_PAGES | EP_PERMALINK | EP_AUTHORS | EP_ALL_ARCHIVES | EP_ROOT );
51
  // Pages
92
 
93
  // Add Custom Rewrite Rule to make sure pagination & redirection is working correctly
94
  function ampforwp_add_custom_rewrite_rules() {
95
+
96
+ // Adding rewrite rules only when we are in standard mode
97
+ if (is_amp_plugin_active()) {
98
+ return;
99
+ }
100
  global $redux_builder_amp, $wp_rewrite;
101
  // For Homepage
102
  add_rewrite_rule(
347
  add_action( 'init', 'ampforwp_custom_rewrite_rules_for_product_category' );
348
  if ( ! function_exists('ampforwp_custom_rewrite_rules_for_product_category') ) {
349
  function ampforwp_custom_rewrite_rules_for_product_category(){
350
+
351
+ // Adding rewrite rules only when we are in standard mode
352
+ if (is_amp_plugin_active()) {
353
+ return;
354
+ }
355
  if ( class_exists('WooCommerce') ) {
356
  $permalinks = wp_parse_args( (array) get_option( 'woocommerce_permalinks', array() ), array(
357
  'product_base' => '',
735
  do_action( 'amp_init' );
736
 
737
  load_plugin_textdomain( 'accelerated-mobile-pages', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
738
+
739
+ // Adding rewrite rules only when we are in standard mode
740
+ if (!is_amp_plugin_active()) {
741
  add_rewrite_endpoint( AMP_QUERY_VAR, EP_PERMALINK );
742
+ }
743
  add_post_type_support( 'post', AMP_QUERY_VAR );
744
 
745
  add_filter( 'request', 'AMPforWP\\AMPVendor\\amp_force_query_var_value' );
1587
  add_action("amp_init", "ampforwp_amp_optimizer");
1588
  function ampforwp_amp_optimizer(){
1589
  require_once AMPFORWP_PLUGIN_DIR."/includes/amp-optimizer-addon.php";
1590
+ }
1591
+
1592
+ if(!function_exists('is_amp_plugin_active')){
1593
+ function is_amp_plugin_active()
1594
+ {
1595
+ if (!function_exists('is_plugin_active')) {
1596
+ include_once(ABSPATH . 'wp-admin/includes/plugin.php');
1597
+ }
1598
+
1599
+ if (is_plugin_active('amp/amp.php')) {
1600
+ return true;
1601
+ }
1602
+ return false;
1603
+ }
1604
+
1605
  }
changelog.txt CHANGED
@@ -1,5 +1,10 @@
1
  == Changelog ==
2
 
 
 
 
 
 
3
  = 1.0.77.49 (22nd August 2022) =
4
  * Fixed: There is a compatibility issue with the latest version of the All in One SEO Plugin. #5306
5
 
1
  == Changelog ==
2
 
3
+ = 1.0.77.50 (24th August 2022) =
4
+ * Fixed: "Back to Top link" option adds amp-animation & amp-position-observer script without its usage on page #5305
5
+ * Fixed: AMPforWP is creating "/amp" as an endpoint in Addon mode. #5303
6
+ * Improvements: Strange Exclamation mark . #5304
7
+
8
  = 1.0.77.49 (22nd August 2022) =
9
  * Fixed: There is a compatibility issue with the latest version of the All in One SEO Plugin. #5306
10
 
includes/admin-style.css CHANGED
@@ -2388,9 +2388,18 @@ a#ampforwp-close-ad-notice {
2388
  }
2389
 
2390
  span.exclamation {
2391
- display: inline-block!important;
2392
- color: #ed1d24;
2393
- font-size: 20px;
2394
  float: right;
2395
- margin: 0px 20px;
2396
- }
 
 
 
 
 
 
 
 
 
2388
  }
2389
 
2390
  span.exclamation {
2391
+ /*display: inline-block!important;*/
2392
+ color: #ffffff;
2393
+ font-size: 14px;
2394
  float: right;
2395
+ margin: -2px 15px;
2396
+ background: red;
2397
+ padding: 1px 8px;
2398
+ border-radius: 50%;
2399
+ }
2400
+
2401
+ .wp-submenu .exclamation {
2402
+ font-size: 10px;
2403
+ padding: 1px 7px;
2404
+ margin: 2px 5px;
2405
+ }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, go
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 6.0
7
- Stable tag: 1.0.77.49
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -194,6 +194,11 @@ You can contact us from [here](https://ampforwp.com/contact/)
194
 
195
  == Changelog ==
196
 
 
 
 
 
 
197
  = 1.0.77.49 (22nd August 2022) =
198
  * Fixed: There is a compatibility issue with the latest version of the All in One SEO Plugin. #5306
199
 
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 6.0
7
+ Stable tag: 1.0.77.50
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
194
 
195
  == Changelog ==
196
 
197
+ = 1.0.77.50 (24th August 2022) =
198
+ * Fixed: "Back to Top link" option adds amp-animation & amp-position-observer script without its usage on page #5305
199
+ * Fixed: AMPforWP is creating "/amp" as an endpoint in Addon mode. #5303
200
+ * Improvements: Strange Exclamation mark . #5304
201
+
202
  = 1.0.77.49 (22nd August 2022) =
203
  * Fixed: There is a compatibility issue with the latest version of the All in One SEO Plugin. #5306
204
 
templates/features.php CHANGED
@@ -7133,12 +7133,17 @@ add_filter( 'amp_post_template_data', 'ampforwp_backtotop' );
7133
  function ampforwp_backtotop( $data ) {
7134
  global $redux_builder_amp;
7135
  if(true == ampforwp_get_setting('ampforwp-footer-top')){
 
 
7136
  if ( empty( $data['amp_component_scripts']['amp-position-observer'] ) ) {
7137
  $data['amp_component_scripts']['amp-position-observer'] = 'https://cdn.ampproject.org/v0/amp-position-observer-0.1.js';
7138
  }
 
 
7139
  if ( empty( $data['amp_component_scripts']['amp-animation'] ) ) {
7140
  $data['amp_component_scripts']['amp-animation'] = 'https://cdn.ampproject.org/v0/amp-animation-0.1.js';
7141
  }
 
7142
 
7143
  }
7144
  return $data;
7133
  function ampforwp_backtotop( $data ) {
7134
  global $redux_builder_amp;
7135
  if(true == ampforwp_get_setting('ampforwp-footer-top')){
7136
+ $dom = AMP_DOM_Utils::get_dom_from_content($data['post_amp_content']);
7137
+ if ( 0 !== $dom->getElementsByTagName( 'amp-position-observer' )->length ) {
7138
  if ( empty( $data['amp_component_scripts']['amp-position-observer'] ) ) {
7139
  $data['amp_component_scripts']['amp-position-observer'] = 'https://cdn.ampproject.org/v0/amp-position-observer-0.1.js';
7140
  }
7141
+ }
7142
+ if ( 0 !== $dom->getElementsByTagName( 'amp-animation' )->length ) {
7143
  if ( empty( $data['amp_component_scripts']['amp-animation'] ) ) {
7144
  $data['amp_component_scripts']['amp-animation'] = 'https://cdn.ampproject.org/v0/amp-animation-0.1.js';
7145
  }
7146
+ }
7147
 
7148
  }
7149
  return $data;