AMP for WP – Accelerated Mobile Pages - Version 1.0.18

Version Description

(27th January 2020) = * Fixed: Debug warnings with Imagify plugin #3908

Download this release

Release Info

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

Code changes from version 1.0.17 to 1.0.18

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.3.2
7
- Stable tag: 1.0.17
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -194,6 +194,9 @@ Device testing done through [BrowserStack](https://www.browserstack.com)
194
 
195
  == Changelog ==
196
 
 
 
 
197
  = 1.0.17 (27th January 2020) =
198
  * Improvement: Compatibility with the Imagify plugin #3908
199
  * Improvement: EWWW Image Optimizer plugin Compatibility #3984
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.3.2
7
+ Stable tag: 1.0.18
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.18 (27th January 2020) =
198
+ * Fixed: Debug warnings with Imagify plugin #3908
199
+
200
  = 1.0.17 (27th January 2020) =
201
  * Improvement: Compatibility with the Imagify plugin #3908
202
  * Improvement: EWWW Image Optimizer plugin Compatibility #3984
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.17
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.17');
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.18
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.18');
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,8 @@
1
  == Changelog ==
2
 
 
 
 
3
  = 1.0.17 (27th January 2020) =
4
  * Improvement: Compatibility with the Imagify plugin #3908
5
  * Improvement: EWWW Image Optimizer plugin Compatibility #3984
1
  == Changelog ==
2
 
3
+ = 1.0.18 (27th January 2020) =
4
+ * Fixed: Debug warnings with Imagify plugin #3908
5
+
6
  = 1.0.17 (27th January 2020) =
7
  * Improvement: Compatibility with the Imagify plugin #3908
8
  * Improvement: EWWW Image Optimizer plugin Compatibility #3984
components/featured-image/featured-image.php CHANGED
@@ -76,7 +76,10 @@ function ampforwp_framework_get_featured_image(){
76
  }
77
  if( $amp_html ){ ?>
78
  <figure class="amp-featured-image <?php echo esc_html($f_vid); ?>"> <?php
79
- echo $amp_html; // escaped above
 
 
 
80
  if ( $caption ) : ?>
81
  <p class="wp-caption-text">
82
  <?php echo wp_kses_data( $caption ); ?>
76
  }
77
  if( $amp_html ){ ?>
78
  <figure class="amp-featured-image <?php echo esc_html($f_vid); ?>"> <?php
79
+ if(function_exists('ampforwp_add_fallback_element')){
80
+ $amp_html = ampforwp_add_fallback_element($amp_html,'amp-img');
81
+ }
82
+ echo $amp_html; // escaped above
83
  if ( $caption ) : ?>
84
  <p class="wp-caption-text">
85
  <?php echo wp_kses_data( $caption ); ?>
includes/vendor/amp/templates/featured-image.php CHANGED
@@ -12,7 +12,11 @@ $amp_html = $featured_image['amp_html'];
12
  $caption = $featured_image['caption'];
13
  ?>
14
  <figure class="amp-wp-article-featured-image wp-caption">
15
- <?php echo $amp_html; // amphtml content; no kses ?>
 
 
 
 
16
  <?php if ( $caption ) : ?>
17
  <p class="wp-caption-text">
18
  <?php echo wp_kses_data( $caption ); ?>
12
  $caption = $featured_image['caption'];
13
  ?>
14
  <figure class="amp-wp-article-featured-image wp-caption">
15
+ <?php
16
+ if(function_exists('ampforwp_add_fallback_element')){
17
+ $amp_html = ampforwp_add_fallback_element($amp_html,'amp-img');
18
+ }
19
+ echo $amp_html; // amphtml content; no kses ?>
20
  <?php if ( $caption ) : ?>
21
  <p class="wp-caption-text">
22
  <?php echo wp_kses_data( $caption ); ?>
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.3.2
7
- Stable tag: 1.0.17
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -191,6 +191,9 @@ You can contact us from [here](https://ampforwp.com/contact/)
191
 
192
  == Changelog ==
193
 
 
 
 
194
  = 1.0.17 (27th January 2020) =
195
  * Improvement: Compatibility with the Imagify plugin #3908
196
  * Improvement: EWWW Image Optimizer plugin Compatibility #3984
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.3.2
7
+ Stable tag: 1.0.18
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.18 (27th January 2020) =
195
+ * Fixed: Debug warnings with Imagify plugin #3908
196
+
197
  = 1.0.17 (27th January 2020) =
198
  * Improvement: Compatibility with the Imagify plugin #3908
199
  * Improvement: EWWW Image Optimizer plugin Compatibility #3984
templates/design-manager/design-1/elements/featured-image.php CHANGED
@@ -48,7 +48,11 @@ if($featured_image || ( ampforwp_is_custom_field_featured_image() && ampforwp_cf
48
  if( $amp_html ) {
49
  ?>
50
  <figure class="amp-wp-article-featured-image wp-caption">
51
- <?php echo $amp_html; // amphtml content; no kses ?>
 
 
 
 
52
  <?php if ( $caption ) : ?>
53
  <p class="wp-caption-text">
54
  <?php echo wp_kses_data( $caption ); ?>
48
  if( $amp_html ) {
49
  ?>
50
  <figure class="amp-wp-article-featured-image wp-caption">
51
+ <?php
52
+ if(function_exists('ampforwp_add_fallback_element')){
53
+ $amp_html = ampforwp_add_fallback_element($amp_html,'amp-img');
54
+ }
55
+ echo $amp_html; // amphtml content; no kses ?>
56
  <?php if ( $caption ) : ?>
57
  <p class="wp-caption-text">
58
  <?php echo wp_kses_data( $caption ); ?>
templates/design-manager/design-2/elements/featured-image.php CHANGED
@@ -48,7 +48,10 @@ if( $featured_image || ( ampforwp_is_custom_field_featured_image() && ampforwp_c
48
  ?>
49
  <div class="amp-wp-article-featured-image amp-wp-content featured-image-content">
50
  <figure class="amp-wp-article-featured-image wp-caption">
51
- <?php echo $amp_html; // amphtml content; no kses ?>
 
 
 
52
  <?php if ( $caption ) : ?>
53
  <p class="wp-caption-text">
54
  <?php echo wp_kses_data( $caption ); ?>
48
  ?>
49
  <div class="amp-wp-article-featured-image amp-wp-content featured-image-content">
50
  <figure class="amp-wp-article-featured-image wp-caption">
51
+ <?php if(function_exists('ampforwp_add_fallback_element')){
52
+ $amp_html = ampforwp_add_fallback_element($amp_html,'amp-img');
53
+ }
54
+ echo $amp_html; // amphtml content; no kses ?>
55
  <?php if ( $caption ) : ?>
56
  <p class="wp-caption-text">
57
  <?php echo wp_kses_data( $caption ); ?>
templates/design-manager/design-3/elements/featured-image.php CHANGED
@@ -50,7 +50,10 @@ if($featured_image || ( ampforwp_is_custom_field_featured_image() && ampforwp_cf
50
  <div class="amp-wp-article-featured-image amp-wp-content featured-image-content">
51
  <div class="post-featured-img">
52
  <figure class="amp-wp-article-featured-image wp-caption">
53
- <?php echo $amp_html; // amphtml content; no kses ?>
 
 
 
54
  <?php if ( $caption ) : ?>
55
  <p class="wp-caption-text">
56
  <?php echo wp_kses_data( $caption ); ?>
50
  <div class="amp-wp-article-featured-image amp-wp-content featured-image-content">
51
  <div class="post-featured-img">
52
  <figure class="amp-wp-article-featured-image wp-caption">
53
+ <?php if(function_exists('ampforwp_add_fallback_element')){
54
+ $amp_html = ampforwp_add_fallback_element($amp_html,'amp-img');
55
+ }
56
+ echo $amp_html; // amphtml content; no kses ?>
57
  <?php if ( $caption ) : ?>
58
  <p class="wp-caption-text">
59
  <?php echo wp_kses_data( $caption ); ?>
templates/features.php CHANGED
@@ -7848,11 +7848,17 @@ if(!function_exists('ampforwp_imagify_webp_compatibility')){
7848
  if($convert_to_webp && $display_webp){
7849
  $img_url = esc_url($src[1][0]);
7850
  $rep_url = esc_url($src[1][0]).".webp";
7851
- $headers = get_headers($rep_url);
7852
- if(isset($headers[0])){
7853
- $is_webp = stripos($headers[0], "200 OK") ? TRUE : FALSE;
7854
- if($is_webp){
7855
- $content = str_replace($img_url, $rep_url, $content);
 
 
 
 
 
 
7856
  }
7857
  }
7858
  }
@@ -7880,10 +7886,18 @@ function ampforwp_ewww_webp_compatibility($content){
7880
  if(isset($src[1][0])){
7881
  $img_url = esc_url($src[1][0]);
7882
  $rep_url = esc_url($src[1][0]).".webp";
7883
- $headers = get_headers($rep_url);
7884
- $is_webp = stripos($headers[0], "200 OK") ? TRUE : FALSE;
7885
- if($is_webp){
7886
  $content = str_replace($img_url, $rep_url, $content);
 
 
 
 
 
 
 
 
7887
  }
7888
  }
7889
  }
7848
  if($convert_to_webp && $display_webp){
7849
  $img_url = esc_url($src[1][0]);
7850
  $rep_url = esc_url($src[1][0]).".webp";
7851
+ $upload_dir = wp_upload_dir()['basedir'];
7852
+ $img_file = preg_replace('/http(.*)\/wp-content\/uploads/', $upload_dir, $rep_url);
7853
+ if(file_exists($img_file)){
7854
+ $content = str_replace($img_url, $rep_url, $content);
7855
+ }else{
7856
+ $headers = get_headers($rep_url);
7857
+ if(isset($headers[0])){
7858
+ $is_webp = stripos($headers[0], "200 OK") ? TRUE : FALSE;
7859
+ if($is_webp){
7860
+ $content = str_replace($img_url, $rep_url, $content);
7861
+ }
7862
  }
7863
  }
7864
  }
7886
  if(isset($src[1][0])){
7887
  $img_url = esc_url($src[1][0]);
7888
  $rep_url = esc_url($src[1][0]).".webp";
7889
+ $upload_dir = wp_upload_dir()['basedir'];
7890
+ $img_file = preg_replace('/http(.*)\/wp-content\/uploads/', $upload_dir, $rep_url);
7891
+ if(file_exists($img_file)){
7892
  $content = str_replace($img_url, $rep_url, $content);
7893
+ }else{
7894
+ $headers = get_headers($rep_url);
7895
+ if(isset($headers[0])){
7896
+ $is_webp = stripos($headers[0], "200 OK") ? TRUE : FALSE;
7897
+ if($is_webp){
7898
+ $content = str_replace($img_url, $rep_url, $content);
7899
+ }
7900
+ }
7901
  }
7902
  }
7903
  }