AMP for WP – Accelerated Mobile Pages - Version 1.0.77.3

Version Description

(27th May 2021) = * Improvements: Added Compatibility with WebP Express plugin #4357 * Improvements: Added an option to allow users to upload and use local fonts on AMP #4264 * Improvements: Added Muffin builder Pagebuilder Support in AMP Pagebuilder Extension #5015 * Fixed: Fatal error when both Sassy Social Share and Optimize CSS are enabled #5032
* Fixed: Issues with Megashop theme #5010 * Fixed: Images not sanitized when added using Muffin Pagebuilder #5013 * Fixed: Hide featured images on a single post if this is older than certain date #5018 * Fixed: Getting AMP validation Error in Add Widget After Content plugin #5027 * Fixed: Query Monitor not working on AMP pages #5025 * Fixed: Full-size image is always preloaded for the featured image in Swift theme #5038

Download this release

Release Info

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

Code changes from version 1.0.77.2 to 1.0.77.3

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.77.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -193,6 +193,18 @@ Device testing done through [BrowserStack](https://www.browserstack.com)
193
 
194
  == Changelog ==
195
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  = 1.0.77.2 (20th May 2021) =
197
  * Fixed: Some issues with style on normal version after update #3844
198
 
@@ -204,15 +216,4 @@ Device testing done through [BrowserStack](https://www.browserstack.com)
204
  * Fixed: Validation error in image lightbox for gallery #5021
205
  * Fixed: Fatal error on AMP pages after updating WP User Avatar plugin #5029
206
 
207
- = 1.0.77 (17th May 2021) =
208
- * Fixed: Related posts doesn't show more than 3-4 #4300
209
-
210
- = 1.0.76.17 (7th May 2021) =
211
- * Improvements: Added Beaver builder Pagebuilder Support in AMP Pagebuilder Extension #5009
212
- * Fixed: Title on Static Front Page is not displaying #5007
213
- * Fixed: The attribute 'height' in tag 'amp-img' is set to the invalid value. #5005
214
- * Fixed: ?amp doesn’t removing from view non-amp text #5006
215
- * Fixed: Errors in Schema Pro FAQ #4956
216
- * Fixed: PHP Warning error when enable Breadcrumbs option #5008
217
-
218
  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.77.3
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.77.3 (27th May 2021) =
197
+ * Improvements: Added Compatibility with WebP Express plugin #4357
198
+ * Improvements: Added an option to allow users to upload and use local fonts on AMP #4264
199
+ * Improvements: Added Muffin builder Pagebuilder Support in AMP Pagebuilder Extension #5015
200
+ * Fixed: Fatal error when both Sassy Social Share and Optimize CSS are enabled #5032
201
+ * Fixed: Issues with Megashop theme #5010
202
+ * Fixed: Images not sanitized when added using Muffin Pagebuilder #5013
203
+ * Fixed: Hide featured images on a single post if this is older than certain date #5018
204
+ * Fixed: Getting AMP validation Error in Add Widget After Content plugin #5027
205
+ * Fixed: Query Monitor not working on AMP pages #5025
206
+ * Fixed: Full-size image is always preloaded for the featured image in Swift theme #5038
207
+
208
  = 1.0.77.2 (20th May 2021) =
209
  * Fixed: Some issues with style on normal version after update #3844
210
 
216
  * Fixed: Validation error in image lightbox for gallery #5021
217
  * Fixed: Fatal error on AMP pages after updating WP User Avatar plugin #5029
218
 
 
 
 
 
 
 
 
 
 
 
 
219
  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.77.2
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.2');
24
  define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
25
  if(!defined('AMPFROWP_HOST_NAME')){
26
  $urlinfo = get_bloginfo('url');
@@ -838,6 +838,7 @@ if(is_admin()){
838
  add_action( "redux/options/redux_builder_amp/saved", 'ampforwp_update_data_when_saved', 10, 2 );
839
  add_action( "redux/options/redux_builder_amp/reset", 'ampforwp_update_data_when_reset' );
840
  add_action( "redux/options/redux_builder_amp/section/reset", 'ampforwp_update_data_when_reset' );
 
841
  }
842
 
843
  /**
@@ -1513,4 +1514,50 @@ if(!function_exists('ampforwp_delete_transient_on_update')){
1513
  }
1514
  }
1515
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1516
  }
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.3
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.3');
24
  define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
25
  if(!defined('AMPFROWP_HOST_NAME')){
26
  $urlinfo = get_bloginfo('url');
838
  add_action( "redux/options/redux_builder_amp/saved", 'ampforwp_update_data_when_saved', 10, 2 );
839
  add_action( "redux/options/redux_builder_amp/reset", 'ampforwp_update_data_when_reset' );
840
  add_action( "redux/options/redux_builder_amp/section/reset", 'ampforwp_update_data_when_reset' );
841
+ add_action( "redux/options/redux_builder_amp/saved", 'ampforwp_save_local_font', 10, 2 );
842
  }
843
 
844
  /**
1514
  }
1515
  }
1516
  }
1517
+ }
1518
+ if(!function_exists('ampforwp_save_local_font')){
1519
+ function ampforwp_save_local_font(){
1520
+ if(ampforwp_get_setting('ampforwp-local-font-switch') && ampforwp_get_setting('ampforwp-local-font-upload','url')!=""){
1521
+ $upload_dir = wp_upload_dir();
1522
+ $user_dirname = $upload_dir['basedir'] . '/' . 'ampforwp-local-fonts';
1523
+ if(!file_exists($user_dirname)) wp_mkdir_p($user_dirname);
1524
+ $font_url = ampforwp_get_setting('ampforwp-local-font-upload','url');
1525
+ $abs_path = explode("wp-content", $font_url);
1526
+ if(isset($abs_path[1])){
1527
+ $permfile = ABSPATH.'wp-content'.$abs_path[1];
1528
+ $files = explode('/', $abs_path[1]);
1529
+ $file_name = end($files);
1530
+ $copy_to = esc_attr($user_dirname).'/'.esc_attr($file_name);
1531
+ if(!file_exists($copy_to)){
1532
+ $files = glob( $user_dirname . '/*' );
1533
+ foreach ( $files as $file ) {
1534
+ unlink( $file );
1535
+ }
1536
+ copy($permfile, $copy_to);
1537
+ unzip_file($permfile, $user_dirname );
1538
+ $files = glob( $user_dirname . '/*' );
1539
+ foreach ( $files as $file ) {
1540
+ if(is_dir($file)){
1541
+ rmdir($file);
1542
+ }
1543
+ $fonts = explode("/", $file);
1544
+ $font_names = end($fonts);
1545
+ $ext = end(explode(".", $font_names));
1546
+ if($ext!='ttf' && $ext!='eot' && $ext!='svg'){
1547
+ unlink( $file );
1548
+ }
1549
+ }
1550
+ }
1551
+ }
1552
+ }else if(ampforwp_get_setting('ampforwp-local-font-switch') && ampforwp_get_setting('ampforwp-local-font-upload','url')==""){
1553
+ $upload_dir = wp_upload_dir();
1554
+ $user_dirname = esc_attr($upload_dir['basedir']) . '/' . 'ampforwp-local-fonts';
1555
+ if ( file_exists( $user_dirname ) ) {
1556
+ $files = glob( $user_dirname . '/*' );
1557
+ foreach ( $files as $file ) {
1558
+ unlink( $file );
1559
+ }
1560
+ }
1561
+ }
1562
+ }
1563
  }
changelog.txt CHANGED
@@ -1,5 +1,17 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 1.0.77.2 (20th May 2021) =
4
  * Fixed: Some issues with style on normal version after update #3844
5
 
1
  == Changelog ==
2
 
3
+ = 1.0.77.3 (27th May 2021) =
4
+ * Improvements: Added Compatibility with WebP Express plugin #4357
5
+ * Improvements: Added an option to allow users to upload and use local fonts on AMP #4264
6
+ * Improvements: Added Muffin builder Pagebuilder Support in AMP Pagebuilder Extension #5015
7
+ * Fixed: Fatal error when both Sassy Social Share and Optimize CSS are enabled #5032
8
+ * Fixed: Issues with Megashop theme #5010
9
+ * Fixed: Images not sanitized when added using Muffin Pagebuilder #5013
10
+ * Fixed: Hide featured images on a single post if this is older than certain date #5018
11
+ * Fixed: Getting AMP validation Error in Add Widget After Content plugin #5027
12
+ * Fixed: Query Monitor not working on AMP pages #5025
13
+ * Fixed: Full-size image is always preloaded for the featured image in Swift theme #5038
14
+
15
  = 1.0.77.2 (20th May 2021) =
16
  * Fixed: Some issues with style on normal version after update #3844
17
 
components/components-core.php CHANGED
@@ -395,6 +395,11 @@ function amp_header_core(){
395
  <?php $custom_css = ampforwp_get_setting('css_editor');
396
  if (function_exists('heateor_sss_run') && ampforwp_get_setting('ampforwp_css_tree_shaking') ) {
397
  global $wp_filesystem;
 
 
 
 
 
398
  $custom_css .= $wp_filesystem->get_contents(AMPFORWP_PLUGIN_DIR."/includes/sassy-style-optimized.css");
399
  }
400
  $custom_css = str_replace(array('.accordion-mod'), array('.apac'), $custom_css);
@@ -561,7 +566,7 @@ function amp_content($post_id= ''){
561
  $ampforwp_the_content = $thisTemplate->get( 'ampforwp_amp_content' );
562
  }
563
  // Muffin Builder Compatibility #1455 #1893 #4983
564
- if ( class_exists('Mfn_Builder_Front') && ! $amp_custom_content_enable ) {
565
  $mfn_builder = $content = '';
566
  $mfn_builder = new Mfn_Builder_Front(ampforwp_get_the_ID());
567
  if (! empty($mfn_builder) ) {
395
  <?php $custom_css = ampforwp_get_setting('css_editor');
396
  if (function_exists('heateor_sss_run') && ampforwp_get_setting('ampforwp_css_tree_shaking') ) {
397
  global $wp_filesystem;
398
+ if(!is_object($wp_filesystem)){
399
+ require_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-base.php';
400
+ require_once ABSPATH . '/wp-admin/includes/class-wp-filesystem-direct.php';
401
+ $wp_filesystem = new WP_Filesystem_Direct( array() );
402
+ }
403
  $custom_css .= $wp_filesystem->get_contents(AMPFORWP_PLUGIN_DIR."/includes/sassy-style-optimized.css");
404
  }
405
  $custom_css = str_replace(array('.accordion-mod'), array('.apac'), $custom_css);
566
  $ampforwp_the_content = $thisTemplate->get( 'ampforwp_amp_content' );
567
  }
568
  // Muffin Builder Compatibility #1455 #1893 #4983
569
+ if ( class_exists('Mfn_Builder_Front') && ! $amp_custom_content_enable && !empty(get_post_field( 'mfn-page-items-seo', ampforwp_get_the_ID())) ) {
570
  $mfn_builder = $content = '';
571
  $mfn_builder = new Mfn_Builder_Front(ampforwp_get_the_ID());
572
  if (! empty($mfn_builder) ) {
components/featured-image/featured-image.php CHANGED
@@ -86,6 +86,7 @@ function ampforwp_framework_get_featured_image(){
86
  $amp_html = ampforwp_get_featured_image_from_content();
87
  $amp_html = preg_replace('#sizes="(.*)"#', "layout='responsive'", $amp_html);
88
  }
 
89
  if( $amp_html ){ ?>
90
  <figure class="amp-featured-image <?php echo esc_html($f_vid); ?>"> <?php
91
  if(function_exists('ampforwp_add_fallback_element')){
86
  $amp_html = ampforwp_get_featured_image_from_content();
87
  $amp_html = preg_replace('#sizes="(.*)"#', "layout='responsive'", $amp_html);
88
  }
89
+ $amp_html = apply_filters('ampforwp_modify_featured_image',$amp_html);
90
  if( $amp_html ){ ?>
91
  <figure class="amp-featured-image <?php echo esc_html($f_vid); ?>"> <?php
92
  if(function_exists('ampforwp_add_fallback_element')){
includes/features/functions.php CHANGED
@@ -47,6 +47,9 @@ function ampforwp_add_admin_styling($hook_suffix){
47
  if(function_exists('html5blank_header_scripts')){
48
  wp_dequeue_script( 'jquery-js' );
49
  }
 
 
 
50
  remove_all_actions('admin_notices');
51
  remove_all_actions('all_admin_notices');
52
  if(class_exists('WC_Ecpay_Apple_Pay')){
47
  if(function_exists('html5blank_header_scripts')){
48
  wp_dequeue_script( 'jquery-js' );
49
  }
50
+ if(function_exists('megashop_setup')){
51
+ wp_dequeue_script( 'adminjs' );
52
+ }
53
  remove_all_actions('admin_notices');
54
  remove_all_actions('all_admin_notices');
55
  if(class_exists('WC_Ecpay_Apple_Pay')){
includes/features/pagebuilders-support/pagebuilders_support.php CHANGED
@@ -4,7 +4,7 @@ if ( ! defined( 'ABSPATH' ) ) {
4
  exit;
5
  }
6
  function ampforwp_page_builders_support_options($opt_name){
7
- $divi_pb_for_ampchecker = $elemntr_pb_for_ampchecker = $avada_pb_for_ampchecker = $avia_pb_for_ampchecker = $oxygen_pb_for_ampchecker = $ux_pb_for_ampchecker = $beaver_builder_pb_for_ampchecker = array();
8
  if(!function_exists('amp_pagebuilder_compatibility_init')){
9
  $divi_pb_for_ampchecker = array(
10
  'id' => 'divi_pb_for_amp_info_normal',
@@ -66,6 +66,14 @@ if(!function_exists('amp_pagebuilder_compatibility_init')){
66
  ),
67
  'desc' => sprintf('<div style="background: #FFF9C4;padding: 12px;line-height: 1.6;margin: -45px -14px -18px -17px;"><b>%s</b> %s <a href="https://ampforwp.com/page-builder-compatibility-for-amp/" target="_blank">%s</a> extension.<br /> <div style="margin-top:4px;">(<a href="https://ampforwp.com/page-builder-compatibility-for-amp/" target="_blank">%s</a>)</div></div>',esc_html__( 'ONE LAST STEP REQUIRED:','accelerated-mobile-pages'),esc_html__( 'This feature requires', 'accelerated-mobile-pages' ),esc_html__( 'Page Builder compatibility For AMP', 'accelerated-mobile-pages'),esc_html__( 'Click here for more info', 'accelerated-mobile-pages' )),
68
  );
 
 
 
 
 
 
 
 
69
  }
70
  $pb_for_amp[] = array(
71
  'id' => 'ampforwp-pagebuilder-accor',
@@ -209,6 +217,25 @@ if(!function_exists('amp_pagebuilder_compatibility_init')){
209
  );
210
  }
211
  $pb_for_amp[] = $beaver_builder_pb_for_ampchecker;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
  $pb_title = 'Page Builder';
213
  $theme = wp_get_theme(); // gets the current theme
214
  if( class_exists('ET_Builder_Plugin') || 'Divi' == $theme->name || 'Divi' == $theme->parent_theme ){
@@ -226,6 +253,12 @@ if(!function_exists('amp_pagebuilder_compatibility_init')){
226
  if(function_exists('flatsome_setup')){
227
  $pb_title = 'UX Builder Support';
228
  }
 
 
 
 
 
 
229
  Redux::setSection( $opt_name, array(
230
  'title' => esc_html__( $pb_title, 'accelerated-mobile-pages' ),
231
  'id' => 'amp-content-builder',
4
  exit;
5
  }
6
  function ampforwp_page_builders_support_options($opt_name){
7
+ $divi_pb_for_ampchecker = $elemntr_pb_for_ampchecker = $avada_pb_for_ampchecker = $avia_pb_for_ampchecker = $oxygen_pb_for_ampchecker = $ux_pb_for_ampchecker = $beaver_builder_pb_for_ampchecker = $muffin_builder_pb_for_ampchecker = array();
8
  if(!function_exists('amp_pagebuilder_compatibility_init')){
9
  $divi_pb_for_ampchecker = array(
10
  'id' => 'divi_pb_for_amp_info_normal',
66
  ),
67
  'desc' => sprintf('<div style="background: #FFF9C4;padding: 12px;line-height: 1.6;margin: -45px -14px -18px -17px;"><b>%s</b> %s <a href="https://ampforwp.com/page-builder-compatibility-for-amp/" target="_blank">%s</a> extension.<br /> <div style="margin-top:4px;">(<a href="https://ampforwp.com/page-builder-compatibility-for-amp/" target="_blank">%s</a>)</div></div>',esc_html__( 'ONE LAST STEP REQUIRED:','accelerated-mobile-pages'),esc_html__( 'This feature requires', 'accelerated-mobile-pages' ),esc_html__( 'Page Builder compatibility For AMP', 'accelerated-mobile-pages'),esc_html__( 'Click here for more info', 'accelerated-mobile-pages' )),
68
  );
69
+ $muffin_builder_pb_for_ampchecker = array(
70
+ 'id' => 'muffin_b_pb_for_amp_info_normal',
71
+ 'type' => 'info',
72
+ 'required' => array(
73
+ array('ampforwp-muffin-pb-for-amp', '=' , true),
74
+ ),
75
+ 'desc' => sprintf('<div style="background: #FFF9C4;padding: 12px;line-height: 1.6;margin: -45px -14px -18px -17px;"><b>%s</b> %s <a href="https://ampforwp.com/page-builder-compatibility-for-amp/" target="_blank">%s</a> extension.<br /> <div style="margin-top:4px;">(<a href="https://ampforwp.com/page-builder-compatibility-for-amp/" target="_blank">%s</a>)</div></div>',esc_html__( 'ONE LAST STEP REQUIRED:','accelerated-mobile-pages'),esc_html__( 'This feature requires', 'accelerated-mobile-pages' ),esc_html__( 'Page Builder compatibility For AMP', 'accelerated-mobile-pages'),esc_html__( 'Click here for more info', 'accelerated-mobile-pages' )),
76
+ );
77
  }
78
  $pb_for_amp[] = array(
79
  'id' => 'ampforwp-pagebuilder-accor',
217
  );
218
  }
219
  $pb_for_amp[] = $beaver_builder_pb_for_ampchecker;
220
+ $theme = wp_get_theme();
221
+ if ( 'Betheme' == $theme->name || 'Betheme Child' == $theme) {
222
+ $pb_for_amp[] = array(
223
+ 'id' => 'ampforwp-muffin-pb-for-amp-accor',
224
+ 'type' => 'section',
225
+ 'title' => esc_html__('Muffin Compatibility', 'accelerated-mobile-pages'),
226
+ 'indent' => true,
227
+ 'layout_type' => 'accordion',
228
+ 'accordion-open'=> 1,
229
+ );
230
+ $pb_for_amp[] = array(
231
+ 'id' => 'ampforwp-muffin-pb-for-amp',
232
+ 'type' => 'switch',
233
+ 'title' => esc_html__('Muffin Builder Support','accelerated-mobile-pages'),
234
+ 'tooltip-subtitle' => esc_html__('Enable or Disable the Muffin support for AMP', 'accelerated-mobile-pages'),
235
+ 'default' => false
236
+ );
237
+ }
238
+ $pb_for_amp[] = $muffin_builder_pb_for_ampchecker;
239
  $pb_title = 'Page Builder';
240
  $theme = wp_get_theme(); // gets the current theme
241
  if( class_exists('ET_Builder_Plugin') || 'Divi' == $theme->name || 'Divi' == $theme->parent_theme ){
253
  if(function_exists('flatsome_setup')){
254
  $pb_title = 'UX Builder Support';
255
  }
256
+ if(class_exists('FLBuilderAdminPointers')){
257
+ $pb_title = 'Beaver Builder Support';
258
+ }
259
+ if ( 'Betheme' == $theme->name || 'Betheme Child' == $theme) {
260
+ $pb_title = 'Muffin Builder Support';
261
+ }
262
  Redux::setSection( $opt_name, array(
263
  'title' => esc_html__( $pb_title, 'accelerated-mobile-pages' ),
264
  'id' => 'amp-content-builder',
includes/features/performance/performance-functions.php CHANGED
@@ -27,7 +27,7 @@ function ampforwp_minify_html_output($content_buffer){
27
  if(class_exists('Cli_Optimizer') && preg_match('/<style type="text\/css">@font-face(.*?)<\/style>/s', $content_buffer)!=0){
28
  $content_buffer = preg_replace('/<style type="text\/css">@font-face(.*?)<\/style>/s', '', $content_buffer);
29
  }
30
- if(preg_match('/<script(.*?)type="text\/javascript"(.*?)>[\s\S]*?<\/script>/', $content_buffer)){
31
  $content_buffer = preg_replace('/<script(.*?)type="text\/javascript"(.*?)>[\s\S]*?<\/script>/', '', $content_buffer);
32
  }
33
  if(preg_match('/<amp-story-player(.*?)<\/amp-story-player>/s', $content_buffer)){
@@ -59,11 +59,16 @@ function ampforwp_minify_html_output($content_buffer){
59
  $content_buffer = preg_replace('/<div(.*?)id="v-(.*?)-(.*?)"(.*?)class="video-player">(.*?)<\/div>/', '<div$1id="v-$2-$3"$4class="video-player"><amp-iframe width="300" height="150" sandbox="allow-scripts allow-same-origin" layout="responsive" src="https://videopress.com/embed/$2"></amp-iframe></div>', $content_buffer);
60
  }
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;
27
  if(class_exists('Cli_Optimizer') && preg_match('/<style type="text\/css">@font-face(.*?)<\/style>/s', $content_buffer)!=0){
28
  $content_buffer = preg_replace('/<style type="text\/css">@font-face(.*?)<\/style>/s', '', $content_buffer);
29
  }
30
+ if(preg_match('/<script(.*?)type="text\/javascript"(.*?)>[\s\S]*?<\/script>/', $content_buffer) && !ampforwp_get_setting('ampforwp-query-monitor') ){
31
  $content_buffer = preg_replace('/<script(.*?)type="text\/javascript"(.*?)>[\s\S]*?<\/script>/', '', $content_buffer);
32
  }
33
  if(preg_match('/<amp-story-player(.*?)<\/amp-story-player>/s', $content_buffer)){
59
  $content_buffer = preg_replace('/<div(.*?)id="v-(.*?)-(.*?)"(.*?)class="video-player">(.*?)<\/div>/', '<div$1id="v-$2-$3"$4class="video-player"><amp-iframe width="300" height="150" sandbox="allow-scripts allow-same-origin" layout="responsive" src="https://videopress.com/embed/$2"></amp-iframe></div>', $content_buffer);
60
  }
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" target="_top"><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
+ if(class_exists('Mfn_Builder_Front') && preg_match_all('/<div\sclass="section mcb-section(.*?)<div class="amp-wp-content">/s', $content_buffer, $matches)){
68
+ $match = $matches[0][0];
69
+ $mfn_content = str_replace("img", 'amp-img', $match);
70
+ $content_buffer = preg_replace('/<div\sclass="section mcb-section(.*?)<div class="amp-wp-content">/s', $mfn_content , $content_buffer);
71
+ }
72
  global $redux_builder_amp;
73
  if(!$redux_builder_amp['ampforwp_cache_minimize_mode']){
74
  return $content_buffer;
includes/options/admin-config.php CHANGED
@@ -4181,7 +4181,25 @@ Redux::setSection( $opt_name, array(
4181
  'required' => array(
4182
  array('ampforwp-google-font-switch', '=', '1'),
4183
  )
4184
- )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4185
  );
4186
  $amp_fontparts = array_merge($amp_fontparts ,$fonts_settings);
4187
  }
4181
  'required' => array(
4182
  array('ampforwp-google-font-switch', '=', '1'),
4183
  )
4184
+ ),
4185
+ array(
4186
+ 'id' => 'ampforwp-local-font-switch',
4187
+ 'type' => 'switch',
4188
+ 'title' => esc_html__('Local Fonts', 'accelerated-mobile-pages'),
4189
+ 'tooltip-subtitle' => esc_html__('Enable/Disable Local Font','accelerated-mobile-pages'),
4190
+ 'default' => '',
4191
+ ),
4192
+ array(
4193
+ 'id' => 'ampforwp-local-font-upload',
4194
+ 'type' => 'media',
4195
+ 'url' => true,
4196
+ 'mode' => 'zip',
4197
+ 'class' => 'child_opt child_opt_arrow',
4198
+ 'title' => esc_html__('Upload Local Font', 'accelerated-mobile-pages'),
4199
+ 'tooltip-subtitle' => esc_html__('Upload Local Font','accelerated-mobile-pages'),
4200
+ 'required' => array('ampforwp-local-font-switch', '=', '1'),
4201
+ 'default' => '',
4202
+ ),
4203
  );
4204
  $amp_fontparts = array_merge($amp_fontparts ,$fonts_settings);
4205
  }
includes/thirdparty-compatibility.php CHANGED
@@ -75,6 +75,9 @@ function ampforwp_thirdparty_compatibility(){
75
  add_filter( 'embed_oembed_html', 'ampforwp_get_gitty_image_embed',10,4);
76
  add_filter( 'ampforwp_the_content_last_filter','ampforwp_getty_image_compatibility',10);
77
  }
 
 
 
78
  $yoast_canonical = $yoast_canonical_post = $yoast_canonical_page = '';
79
  $yoast_canonical = get_option( 'wpseo_titles' );
80
  if(isset($yoast_canonical['noindex-post'])){
75
  add_filter( 'embed_oembed_html', 'ampforwp_get_gitty_image_embed',10,4);
76
  add_filter( 'ampforwp_the_content_last_filter','ampforwp_getty_image_compatibility',10);
77
  }
78
+ if(function_exists('megashop_setup')){
79
+ remove_filter( 'wp_nav_menu_args', 'TT_nav_menu_args' );
80
+ }
81
  $yoast_canonical = $yoast_canonical_post = $yoast_canonical_page = '';
82
  $yoast_canonical = get_option( 'wpseo_titles' );
83
  if(isset($yoast_canonical['noindex-post'])){
includes/vendor/amp/includes/amp-post-template-actions.php CHANGED
@@ -56,9 +56,14 @@ function amp_post_template_add_cached_link($amp_template) {
56
  ?>
57
  <link rel="preload" as="script" href="https://cdn.ampproject.org/v0.js">
58
  <?php
59
- $image = get_the_post_thumbnail_url();
60
- if($image!=""){?>
61
- <link rel="preload" href="<?php echo esc_url($image); ?>" as="image">
 
 
 
 
 
62
  <?php } ?>
63
  <?php
64
  $scripts = $amp_template->get( 'amp_component_scripts', array() );
56
  ?>
57
  <link rel="preload" as="script" href="https://cdn.ampproject.org/v0.js">
58
  <?php
59
+ $thumb_id = get_post_thumbnail_id(ampforwp_get_the_ID());
60
+ $image_size = ampforwp_get_setting('swift-featued-image-size');
61
+ $image = wp_get_attachment_image_src( $thumb_id, $image_size );
62
+ if($image!="" && isset($image[0])){
63
+ if(function_exists('_imagify_init')){
64
+ $image[0] = esc_url($image[0]).".webp";
65
+ }?>
66
+ <link rel="preload" href="<?php echo esc_url($image[0]);?>" as="image">
67
  <?php } ?>
68
  <?php
69
  $scripts = $amp_template->get( 'amp_component_scripts', array() );
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.77.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -190,6 +190,18 @@ You can contact us from [here](https://ampforwp.com/contact/)
190
 
191
  == Changelog ==
192
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  = 1.0.77.2 (20th May 2021) =
194
  * Fixed: Some issues with style on normal version after update #3844
195
 
@@ -201,15 +213,4 @@ You can contact us from [here](https://ampforwp.com/contact/)
201
  * Fixed: Validation error in image lightbox for gallery #5021
202
  * Fixed: Fatal error on AMP pages after updating WP User Avatar plugin #5029
203
 
204
- = 1.0.77 (17th May 2021) =
205
- * Fixed: Related posts doesn't show more than 3-4 #4300
206
-
207
- = 1.0.76.17 (7th May 2021) =
208
- * Improvements: Added Beaver builder Pagebuilder Support in AMP Pagebuilder Extension #5009
209
- * Fixed: Title on Static Front Page is not displaying #5007
210
- * Fixed: The attribute 'height' in tag 'amp-img' is set to the invalid value. #5005
211
- * Fixed: ?amp doesn’t removing from view non-amp text #5006
212
- * Fixed: Errors in Schema Pro FAQ #4956
213
- * Fixed: PHP Warning error when enable Breadcrumbs option #5008
214
-
215
  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.77.3
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.77.3 (27th May 2021) =
194
+ * Improvements: Added Compatibility with WebP Express plugin #4357
195
+ * Improvements: Added an option to allow users to upload and use local fonts on AMP #4264
196
+ * Improvements: Added Muffin builder Pagebuilder Support in AMP Pagebuilder Extension #5015
197
+ * Fixed: Fatal error when both Sassy Social Share and Optimize CSS are enabled #5032
198
+ * Fixed: Issues with Megashop theme #5010
199
+ * Fixed: Images not sanitized when added using Muffin Pagebuilder #5013
200
+ * Fixed: Hide featured images on a single post if this is older than certain date #5018
201
+ * Fixed: Getting AMP validation Error in Add Widget After Content plugin #5027
202
+ * Fixed: Query Monitor not working on AMP pages #5025
203
+ * Fixed: Full-size image is always preloaded for the featured image in Swift theme #5038
204
+
205
  = 1.0.77.2 (20th May 2021) =
206
  * Fixed: Some issues with style on normal version after update #3844
207
 
213
  * Fixed: Validation error in image lightbox for gallery #5021
214
  * Fixed: Fatal error on AMP pages after updating WP User Avatar plugin #5029
215
 
 
 
 
 
 
 
 
 
 
 
 
216
  Full changelog available [ at changelog.txt](https://plugins.svn.wordpress.org/accelerated-mobile-pages/trunk/changelog.txt)
templates/features.php CHANGED
@@ -8747,7 +8747,7 @@ if(!function_exists('ampforwp_add_fallback_element')){
8747
  $m_content = $matches[1][$i];
8748
  $m_content = ampforwp_imagify_webp_compatibility($m_content);
8749
  $m_content = ampforwp_ewww_webp_compatibility($m_content);
8750
-
8751
  $m1_content = ampforwp_set_default_fallback_image($matches[1][$i]);
8752
  preg_match_all('/src="(.*?)"/', $m1_content,$fimgsrc);
8753
  preg_match_all('/width="(.*?)"/', $m1_content,$fimgwidth);
@@ -9548,4 +9548,59 @@ function ampforwp_wp_block_cover_image($content_buffer){
9548
  window.location = "<?php echo esc_url($url_to_redirect); ?>";
9549
  }
9550
  </script>
9551
- <?php }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8747
  $m_content = $matches[1][$i];
8748
  $m_content = ampforwp_imagify_webp_compatibility($m_content);
8749
  $m_content = ampforwp_ewww_webp_compatibility($m_content);
8750
+ $m_content = ampforwp_webp_express_compatibility($m_content);
8751
  $m1_content = ampforwp_set_default_fallback_image($matches[1][$i]);
8752
  preg_match_all('/src="(.*?)"/', $m1_content,$fimgsrc);
8753
  preg_match_all('/width="(.*?)"/', $m1_content,$fimgwidth);
9548
  window.location = "<?php echo esc_url($url_to_redirect); ?>";
9549
  }
9550
  </script>
9551
+ <?php }
9552
+ function ampforwp_webp_express_compatibility($content){
9553
+ if(function_exists('webp_express_process_post')){
9554
+ preg_match_all('/src="(.*?)"/', $content,$src);
9555
+ if(isset($src[1][0])){
9556
+ $img_url = esc_url($src[1][0]);
9557
+ if(preg_match('/http(.*?)\/wp-content\/uploads/', $img_url)){
9558
+ $img_url_webp = preg_replace('/http(.*?)\/wp-content(.*?)/', 'http$1/wp-content/webp-express/webp-images/doc-root/wp-content$2', $img_url);
9559
+ if(!preg_match('/\.webp/', $img_url)){
9560
+ $img_url_webp = esc_url($img_url_webp).".webp";
9561
+ $content = str_replace($img_url, $img_url_webp, $content);
9562
+ }
9563
+ }
9564
+ }
9565
+ }
9566
+ return $content;
9567
+ }
9568
+ add_action('amp_post_template_css','ampforwp_set_local_font',33);
9569
+ if(!function_exists('ampforwp_set_local_font')){
9570
+ function ampforwp_set_local_font(){
9571
+ if(ampforwp_get_setting('ampforwp-local-font-switch') && ampforwp_get_setting('ampforwp-local-font-upload','url')!=""){
9572
+ $upload_dir = wp_upload_dir();
9573
+ $user_dirname = $upload_dir['basedir'] . '/' . 'ampforwp-local-fonts';
9574
+ if ( file_exists( $user_dirname ) ) {
9575
+ $files = glob( $user_dirname . '/*' );
9576
+ $font_css = '@font-face {';
9577
+ $i = 0;
9578
+ foreach ( $files as $file ) {
9579
+ $fonts = explode("/", $file);
9580
+ $font_name = end($fonts);
9581
+ $ext = end(explode(".", $font_name));
9582
+ if($ext!='zip'){
9583
+ $font_arr = explode('-', $font_name);
9584
+ $font_family = $font_arr[0];
9585
+ if($i==0){
9586
+ $font_css .= "font-family: '".esc_attr(ucfirst($font_family))."'; font-style: normal; font-weight: 400;";
9587
+ }
9588
+ $font_path = $upload_dir['baseurl'].'/'.'ampforwp-local-fonts/'.$font_name;
9589
+ if($ext=='eot'){
9590
+ $font_css .= "src: url('".esc_url($font_path)."'); src: url('".esc_url($font_path)."?#iefix') format('embedded-opentype'),";
9591
+ }else if($ext=='svg'){
9592
+ $font_css .= "src: url('".esc_url($font_path)."?#".esc_attr(ucfirst($font_family))."') format('svg'),";
9593
+ }else if($ext=='ttf'){
9594
+ $font_css .= "src: url('".esc_url($font_path)."') format('truetype'),";
9595
+ }else{
9596
+ $font_css .= "src: url('".esc_url($font_path)."') format('".esc_attr($ext)."'),";
9597
+ }
9598
+ $i++;
9599
+ }
9600
+ }
9601
+ $font_css .= '}';
9602
+ echo $font_css;
9603
+ }
9604
+ }
9605
+ }
9606
+ }