AMP for WP – Accelerated Mobile Pages - Version 1.0.76.16

Version Description

(4th May 2021) = * Fixed: Incorrent height in anchor.fm audio embed from the Pennews Theme #4576 * Fixed: Slide Anything Plugin text slider not working in AMP #4999 * Fixed: Backend button translation #4717 * Fixed: Alignment issue with Gutenberg image block #4997 * Fixed: Undefined variable $q / Attempt to read property max_num_pages on null #5004

Download this release

Release Info

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

Code changes from version 1.0.76.15 to 1.0.76.16

README.md CHANGED
@@ -4,7 +4,7 @@ Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, go
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.7
7
- Stable tag: 1.0.76.15
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -193,6 +193,13 @@ Device testing done through [BrowserStack](https://www.browserstack.com)
193
 
194
  == Changelog ==
195
 
 
 
 
 
 
 
 
196
  = 1.0.76.15 (28th April 2021) =
197
  * Improvements: Added an option to add one signal notification on the desktop #4377
198
  * Improvements: Added an option to set Target for CTA button in swift theme #4995
@@ -214,16 +221,4 @@ Device testing done through [BrowserStack](https://www.browserstack.com)
214
  * Fixed: AMP menu automatically scrolls down to bottom in Design three #4967
215
  * Fixed: Single post content not showing when using AMP on subdomain #4996
216
 
217
- = 1.0.76.13 (19th April 2021) =
218
- * Improvements: Added an option to preserve original permalinks in mobile redirection #4207
219
- * Improvements: Added an option to add moderation tool for the Facebook comments #4485
220
- * Improvements: Added an option to make buttons side by side in the mobile with AMP pagebuilder #4472
221
- * Improvements: Added an option to add UTM souce parameters in URLs to both related & incontent related posts #4237
222
- * Improvements: Added Quantcast CMP (consent management platform) support in AMP 4951
223
- * Fixed: Alt tag not appearing in sticky social sharing icons #4984
224
- * Fixed: Debug Warning in edit tag page when using PHP8 #4990
225
-
226
- = 1.0.76.12(14th April 2021) =
227
- * Fixed: Fatal error occuring with the recent update Version 1.0.76.11 #4986
228
-
229
  Full changelog available [ at changelog.txt](https://plugins.svn.wordpress.org/accelerated-mobile-pages/trunk/changelog.txt)
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.7
7
+ Stable tag: 1.0.76.16
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
193
 
194
  == Changelog ==
195
 
196
+ = 1.0.76.16 (4th May 2021) =
197
+ * Fixed: Incorrent height in anchor.fm audio embed from the Pennews Theme #4576
198
+ * Fixed: Slide Anything Plugin text slider not working in AMP #4999
199
+ * Fixed: Backend button translation #4717
200
+ * Fixed: Alignment issue with Gutenberg image block #4997
201
+ * Fixed: Undefined variable $q / Attempt to read property max_num_pages on null #5004
202
+
203
  = 1.0.76.15 (28th April 2021) =
204
  * Improvements: Added an option to add one signal notification on the desktop #4377
205
  * Improvements: Added an option to set Target for CTA button in swift theme #4995
221
  * Fixed: AMP menu automatically scrolls down to bottom in Design three #4967
222
  * Fixed: Single post content not showing when using AMP on subdomain #4996
223
 
 
 
 
 
 
 
 
 
 
 
 
 
224
  Full changelog available [ at changelog.txt](https://plugins.svn.wordpress.org/accelerated-mobile-pages/trunk/changelog.txt)
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.76.15
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.76.15');
24
  define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
25
  if(!defined('AMPFROWP_HOST_NAME')){
26
  $urlinfo = get_bloginfo('url');
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.76.16
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.76.16');
24
  define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
25
  if(!defined('AMPFROWP_HOST_NAME')){
26
  $urlinfo = get_bloginfo('url');
changelog.txt CHANGED
@@ -1,5 +1,12 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
3
  = 1.0.76.15 (28th April 2021) =
4
  * Improvements: Added an option to add one signal notification on the desktop #4377
5
  * Improvements: Added an option to set Target for CTA button in swift theme #4995
1
  == Changelog ==
2
 
3
+ = 1.0.76.16 (4th May 2021) =
4
+ * Fixed: Incorrent height in anchor.fm audio embed from the Pennews Theme #4576
5
+ * Fixed: Slide Anything Plugin text slider not working in AMP #4999
6
+ * Fixed: Backend button translation #4717
7
+ * Fixed: Alignment issue with Gutenberg image block #4997
8
+ * Fixed: Undefined variable $q / Attempt to read property max_num_pages on null #5004
9
+
10
  = 1.0.76.15 (28th April 2021) =
11
  * Improvements: Added an option to add one signal notification on the desktop #4377
12
  * Improvements: Added an option to set Target for CTA button in swift theme #4995
classes/class-ampforwp-slide-anything-embed.php CHANGED
@@ -48,6 +48,7 @@ class AMPFORWP_Slide_Anything_Embed_Handler extends AMPforWP\AMPVendor\AMP_Base_
48
  $id = intval( $atts['id'] );
49
  $post_status = get_post_status($id);
50
  if ($post_status == 'publish') {
 
51
  $metadata = get_metadata('post', $id);
52
  }
53
 
@@ -199,10 +200,23 @@ class AMPFORWP_Slide_Anything_Embed_Handler extends AMPforWP\AMPVendor\AMP_Base_
199
  </div>
200
  </amp-image-lightbox>';
201
  }
202
- $amp_images[$key] = AMP_HTML_Utils::build_tag(
203
- 'amp-img',
204
- $amp_img_arr
205
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
206
 
207
  //Small Thumbnail Images
208
  $thumb_url = ampforwp_aq_resize( $image['url'], 120, 60, true, false ); //resize & crop the image
@@ -291,6 +305,9 @@ class AMPFORWP_Slide_Anything_Embed_Handler extends AMPforWP\AMPVendor\AMP_Base_
291
  $returnCompleteHtml = str_replace('{{with_carousel_thumbnail}}', $amp_carousel_thumbnail, $returnCompleteHtml);
292
  $returnCompleteHtml = str_replace('{{amp_image_lightbox}}', $amp_image_lightbox, $returnCompleteHtml);
293
  $returnCompleteHtml = str_replace('{{with_images}}', implode( PHP_EOL, $images ), $returnCompleteHtml);
 
 
 
294
  return $returnCompleteHtml;
295
  }
296
  }// Class closed
48
  $id = intval( $atts['id'] );
49
  $post_status = get_post_status($id);
50
  if ($post_status == 'publish') {
51
+ global $metadata;
52
  $metadata = get_metadata('post', $id);
53
  }
54
 
200
  </div>
201
  </amp-image-lightbox>';
202
  }
203
+ if(!preg_match('/default.png/', $amp_img_arr['src'])){
204
+ $amp_images[$key] = AMP_HTML_Utils::build_tag(
205
+ 'amp-img',
206
+ $amp_img_arr
207
+ );
208
+ }else{
209
+ global $metadata;
210
+ $slide_data = array();
211
+ $slide_data['num_slides'] = $metadata['sa_num_slides'][0];
212
+ for ($i = 1; $i <= $slide_data['num_slides']; $i++) {
213
+ if (isset($metadata["sa_slide".$i."_content"][0])) {
214
+ $amp_images[$i-1] = AMP_HTML_Utils::build_tag(
215
+ 'div', array( 'slideampcontent' => esc_attr($metadata["sa_slide".$i."_content"][0]))
216
+ );
217
+ }
218
+ }
219
+ }
220
 
221
  //Small Thumbnail Images
222
  $thumb_url = ampforwp_aq_resize( $image['url'], 120, 60, true, false ); //resize & crop the image
305
  $returnCompleteHtml = str_replace('{{with_carousel_thumbnail}}', $amp_carousel_thumbnail, $returnCompleteHtml);
306
  $returnCompleteHtml = str_replace('{{amp_image_lightbox}}', $amp_image_lightbox, $returnCompleteHtml);
307
  $returnCompleteHtml = str_replace('{{with_images}}', implode( PHP_EOL, $images ), $returnCompleteHtml);
308
+ $returnCompleteHtml = preg_replace('/<div slideampcontent="(.*?)"><\/div>/', '<div>$1</div>', $returnCompleteHtml);
309
+ $returnCompleteHtml = str_replace('&lt;', '<', $returnCompleteHtml);
310
+ $returnCompleteHtml = str_replace('&gt;', '>', $returnCompleteHtml);
311
  return $returnCompleteHtml;
312
  }
313
  }// Class closed
includes/features/functions.php CHANGED
@@ -31,7 +31,9 @@ function ampforwp_add_admin_styling($hook_suffix){
31
  wp_enqueue_style( 'ampforwp_admin_css' );
32
 
33
  // Admin area scripts file
34
- wp_register_script( 'ampforwp_admin_js', untrailingslashit(AMPFORWP_PLUGIN_DIR_URI) . '/includes/admin-script.js', array('wp-color-picker'), AMPFORWP_VERSION );
 
 
35
 
36
  // Localize the script with new data
37
  $redux_data = array();
31
  wp_enqueue_style( 'ampforwp_admin_css' );
32
 
33
  // Admin area scripts file
34
+ $dep = array('wp-color-picker');
35
+ $dep = apply_filters('ampforwp_modify_script_dependency', $dep);
36
+ wp_register_script( 'ampforwp_admin_js', untrailingslashit(AMPFORWP_PLUGIN_DIR_URI) . '/includes/admin-script.js', $dep , AMPFORWP_VERSION );
37
 
38
  // Localize the script with new data
39
  $redux_data = array();
includes/features/performance/performance-functions.php CHANGED
@@ -61,6 +61,9 @@ function ampforwp_minify_html_output($content_buffer){
61
  if (class_exists('AddWidgetAfterContent') && preg_match('/<form(.*?)><label(.*?)for="cat"(.*?)name="cat"(.*?)<\/form>/s', $content_buffer)) {
62
  $content_buffer = preg_replace('/<form(.*?)><label(.*?)for="cat"(.*?)name="cat"(.*?)<\/form>/s', '<form$1 id="amp-wp-widget-categories-1" on="change:amp-wp-widget-categories-1.submit"><label$2for="cat"$3name="cat"$4</form>', $content_buffer);
63
  }
 
 
 
64
  global $redux_builder_amp;
65
  if(!$redux_builder_amp['ampforwp_cache_minimize_mode']){
66
  return $content_buffer;
61
  if (class_exists('AddWidgetAfterContent') && preg_match('/<form(.*?)><label(.*?)for="cat"(.*?)name="cat"(.*?)<\/form>/s', $content_buffer)) {
62
  $content_buffer = preg_replace('/<form(.*?)><label(.*?)for="cat"(.*?)name="cat"(.*?)<\/form>/s', '<form$1 id="amp-wp-widget-categories-1" on="change:amp-wp-widget-categories-1.submit"><label$2for="cat"$3name="cat"$4</form>', $content_buffer);
63
  }
64
+ if(function_exists('vp_pfui_admin_init') && function_exists('penci_setup') && preg_match('/<amp-iframe src="(.*?)anchor.fm(.*?)"(.*?)<\/amp-iframe>/', $content_buffer)){
65
+ $content_buffer = preg_replace('/<amp-iframe src="(.*?)anchor.fm(.*?)"(.*?)<\/amp-iframe>/', '<amp-iframe src="$1anchor.fm$2" scrolling="no" $3</amp-iframe>', $content_buffer);
66
+ }
67
  global $redux_builder_amp;
68
  if(!$redux_builder_amp['ampforwp_cache_minimize_mode']){
69
  return $content_buffer;
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, go
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.7
7
- Stable tag: 1.0.76.15
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -190,6 +190,13 @@ You can contact us from [here](https://ampforwp.com/contact/)
190
 
191
  == Changelog ==
192
 
 
 
 
 
 
 
 
193
  = 1.0.76.15 (28th April 2021) =
194
  * Improvements: Added an option to add one signal notification on the desktop #4377
195
  * Improvements: Added an option to set Target for CTA button in swift theme #4995
@@ -211,16 +218,4 @@ You can contact us from [here](https://ampforwp.com/contact/)
211
  * Fixed: AMP menu automatically scrolls down to bottom in Design three #4967
212
  * Fixed: Single post content not showing when using AMP on subdomain #4996
213
 
214
- = 1.0.76.13 (19th April 2021) =
215
- * Improvements: Added an option to preserve original permalinks in mobile redirection #4207
216
- * Improvements: Added an option to add moderation tool for the Facebook comments #4485
217
- * Improvements: Added an option to make buttons side by side in the mobile with AMP pagebuilder #4472
218
- * Improvements: Added an option to add UTM souce parameters in URLs to both related & incontent related posts #4237
219
- * Improvements: Added Quantcast CMP (consent management platform) support in AMP 4951
220
- * Fixed: Alt tag not appearing in sticky social sharing icons #4984
221
- * Fixed: Debug Warning in edit tag page when using PHP8 #4990
222
-
223
- = 1.0.76.12 (14th April 2021) =
224
- * Fixed: Fatal error occuring with the recent update Version 1.0.76.11 #4986
225
-
226
  Full changelog available [ at changelog.txt](https://plugins.svn.wordpress.org/accelerated-mobile-pages/trunk/changelog.txt)
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.7
7
+ Stable tag: 1.0.76.16
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
190
 
191
  == Changelog ==
192
 
193
+ = 1.0.76.16 (4th May 2021) =
194
+ * Fixed: Incorrent height in anchor.fm audio embed from the Pennews Theme #4576
195
+ * Fixed: Slide Anything Plugin text slider not working in AMP #4999
196
+ * Fixed: Backend button translation #4717
197
+ * Fixed: Alignment issue with Gutenberg image block #4997
198
+ * Fixed: Undefined variable $q / Attempt to read property max_num_pages on null #5004
199
+
200
  = 1.0.76.15 (28th April 2021) =
201
  * Improvements: Added an option to add one signal notification on the desktop #4377
202
  * Improvements: Added an option to set Target for CTA button in swift theme #4995
218
  * Fixed: AMP menu automatically scrolls down to bottom in Design three #4967
219
  * Fixed: Single post content not showing when using AMP on subdomain #4996
220
 
 
 
 
 
 
 
 
 
 
 
 
 
221
  Full changelog available [ at changelog.txt](https://plugins.svn.wordpress.org/accelerated-mobile-pages/trunk/changelog.txt)
templates/design-manager/design-2/archive.php CHANGED
@@ -157,7 +157,7 @@ if ( ! defined( 'ABSPATH' ) ) {
157
  <?php do_action('ampforwp_loop_before_pagination') ?>
158
  <div class="amp-wp-content pagination-holder">
159
  <div id="pagination">
160
- <?php if ( get_next_posts_link('next', $q->max_num_pages) ){ ?><div class="next"><?php echo apply_filters('ampforwp_next_posts_link',get_next_posts_link( ampforwp_translation($redux_builder_amp['amp-translator-next-text'], 'Next' ).'&raquo;', 0), $paged);?></div><?php }?>
161
  <?php if ( get_previous_posts_link() ){ ?><div class="prev"><?php echo apply_filters( 'ampforwp_previous_posts_link', get_previous_posts_link( '&laquo; '. ampforwp_translation($redux_builder_amp['amp-translator-previous-text'], 'Previous' )), $paged ); ?></div><?php }?>
162
  <div class="clearfix"></div>
163
  </div>
157
  <?php do_action('ampforwp_loop_before_pagination') ?>
158
  <div class="amp-wp-content pagination-holder">
159
  <div id="pagination">
160
+ <?php $paged = get_query_var('paged'); if ( get_next_posts_link() ){ ?><div class="next"><?php echo apply_filters('ampforwp_next_posts_link',get_next_posts_link( ampforwp_translation($redux_builder_amp['amp-translator-next-text'], 'Next' ).'&raquo;', 0), $paged);?></div><?php }?>
161
  <?php if ( get_previous_posts_link() ){ ?><div class="prev"><?php echo apply_filters( 'ampforwp_previous_posts_link', get_previous_posts_link( '&laquo; '. ampforwp_translation($redux_builder_amp['amp-translator-previous-text'], 'Previous' )), $paged ); ?></div><?php }?>
162
  <div class="clearfix"></div>
163
  </div>
templates/features.php CHANGED
@@ -9528,4 +9528,21 @@ function ampforwp_pennews_audio_embed(){
9528
  ) ) );
9529
  $sanitized_html = $sanitizer->get_amp_content();
9530
  echo $sanitized_html;
9531
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9528
  ) ) );
9529
  $sanitized_html = $sanitizer->get_amp_content();
9530
  echo $sanitized_html;
9531
+ }
9532
+
9533
+ //Alignment issue with Gutenberg image block #4997
9534
+ add_filter('ampforwp_modify_the_content','ampforwp_wp_block_cover_image');
9535
+ function ampforwp_wp_block_cover_image($content_buffer){
9536
+ if(ampforwp_get_setting('ampforwp_css_tree_shaking') && ampforwp_is_gutenberg_active()){
9537
+ preg_match_all('/<amp-img(.*?)class="wp-block-cover__image-background(.*?)"(.*?)src="(.*?)"(.*?)<\/amp-img>/', $content_buffer, $matches);
9538
+ if(is_array($matches) && isset($matches[4][0])){
9539
+ $img_url = $matches[4][0];
9540
+ if (!empty($img_url)) {
9541
+ $content_buffer = preg_replace('/<div(.*?)class="wp-block-cover(.*?)"><amp-img(.*?)<\/amp-img>/', '<div$1style="background-image:url('.$img_url.');" class="wp-block-cover$2"><amp-img$3</amp-img>', $content_buffer);
9542
+ $content_buffer = preg_replace('/<amp-img(.*?)class="wp-block-cover__image-background(.*?)"(.*?)src="(.*?)"(.*?)<\/amp-img>/', '', $content_buffer);
9543
+ return $content_buffer;
9544
+ }
9545
+ }
9546
+ }
9547
+ return $content_buffer;
9548
+ }