Version Description
(8th January 2020) = * Fixed: Odd behaviour of Optimize CSS (Treeshaking),when turned off resolves the validation errors and when turned on adding unnecessary wp-block CSS. #4036 * Fixed: After enable the Tree shaking feature the CSS not loading properly #4034 * Fixed: fallback feature is not working on SVG images #4033 * Fixed: Need to update the Form Sanitizer to allow only the required from #4010 * Fixed: 404 error in console with Images having webp extension. #3983
Download this release
Release Info
Developer | mohammed_kaludi |
Plugin | AMP for WP – Accelerated Mobile Pages |
Version | 1.0.9 |
Comparing to | |
See all releases |
Code changes from version 1.0.8 to 1.0.9
- README.md +8 -1
- accelerated-moblie-pages.php +2 -2
- changelog.txt +7 -0
- includes/features/performance/performance-functions.php +29 -3
- includes/vendor/amp/includes/class-amp-post-template.php +7 -2
- includes/vendor/amp/includes/sanitizers/class-amp-blacklist-sanitizer.php +25 -0
- readme.txt +8 -19
- templates/features.php +0 -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.3.2
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -191,6 +191,13 @@ You can contact us from [here](https://ampforwp.com/contact/)
|
|
191 |
|
192 |
== Changelog ==
|
193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
= 1.0.8 (2nd January 2020) =
|
195 |
* Fixed: Need to add Rankmath's "Nofollow External Links" feature. #3970 (updated the code)
|
196 |
|
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.9
|
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.9 (8th January 2020) =
|
195 |
+
* Fixed: Odd behaviour of Optimize CSS (Treeshaking),when turned off resolves the validation errors and when turned on adding unnecessary wp-block CSS. #4036
|
196 |
+
* Fixed: After enable the Tree shaking feature the CSS not loading properly #4034
|
197 |
+
* Fixed: fallback feature is not working on SVG images #4033
|
198 |
+
* Fixed: Need to update the Form Sanitizer to allow only the required from #4010
|
199 |
+
* Fixed: 404 error in console with Images having webp extension. #3983
|
200 |
+
|
201 |
= 1.0.8 (2nd January 2020) =
|
202 |
* Fixed: Need to add Rankmath's "Nofollow External Links" feature. #3970 (updated the code)
|
203 |
|
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.
|
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.
|
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.9
|
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.9');
|
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.8 (2nd January 2020) =
|
4 |
* Fixed: Need to add Rankmath's "Nofollow External Links" feature. #3970 (updated the code)
|
5 |
|
1 |
== Changelog ==
|
2 |
|
3 |
+
= 1.0.9 (8th January 2020) =
|
4 |
+
* Fixed: Odd behaviour of Optimize CSS (Treeshaking),when turned off resolves the validation errors and when turned on adding unnecessary wp-block CSS. #4036
|
5 |
+
* Fixed: After enable the Tree shaking feature the CSS not loading properly #4034
|
6 |
+
* Fixed: fallback feature is not working on SVG images #4033
|
7 |
+
* Fixed: Need to update the Form Sanitizer to allow only the required from #4010
|
8 |
+
* Fixed: 404 error in console with Images having webp extension. #3983
|
9 |
+
|
10 |
= 1.0.8 (2nd January 2020) =
|
11 |
* Fixed: Need to add Rankmath's "Nofollow External Links" feature. #3970 (updated the code)
|
12 |
|
includes/features/performance/performance-functions.php
CHANGED
@@ -255,11 +255,13 @@ if( !function_exists("ampforwp_tree_shaking_purify_amphtml") ){
|
|
255 |
if(strpos($sheet, '-keyframes')!==false){
|
256 |
$sheet = preg_replace("/@(-o-|-moz-|-webkit-|-ms-)*keyframes\s(.*?){([0-9%a-zA-Z,\s.]*{(.*?)})*[\s\n]*}/s", "", $sheet);
|
257 |
}
|
258 |
-
preg_match('/<style\samp-custom>(
|
259 |
-
|
|
|
260 |
$completeContent = preg_replace("/<style\samp-custom>(.*)<\/style>/s", "".$comment."<style amp-custom>".$sheet."</style>", $completeContent);
|
|
|
|
|
261 |
}
|
262 |
-
|
263 |
}
|
264 |
}
|
265 |
//for fonts
|
@@ -302,6 +304,30 @@ if( !function_exists("ampforwp_clear_tree_shaking") ) {
|
|
302 |
}
|
303 |
}
|
304 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
305 |
add_action( 'save_post', 'ampforwp_clear_tree_shaking_post');
|
306 |
if( !function_exists("ampforwp_clear_tree_shaking_post") ) {
|
307 |
function ampforwp_clear_tree_shaking_post() {
|
255 |
if(strpos($sheet, '-keyframes')!==false){
|
256 |
$sheet = preg_replace("/@(-o-|-moz-|-webkit-|-ms-)*keyframes\s(.*?){([0-9%a-zA-Z,\s.]*{(.*?)})*[\s\n]*}/s", "", $sheet);
|
257 |
}
|
258 |
+
if(preg_match('/<style\samp-custom>(.*?)<\/style>/s', $completeContent,$matches)){
|
259 |
+
$completeContent = preg_replace("/<style\samp-custom>(.*?)<\/style>/s", "".$comment."<style amp-custom>".$sheet."</style>", $completeContent);
|
260 |
+
}else if(preg_match('/<style\samp-custom>(.*)<\/style>/s', $completeContent,$matches)){
|
261 |
$completeContent = preg_replace("/<style\samp-custom>(.*)<\/style>/s", "".$comment."<style amp-custom>".$sheet."</style>", $completeContent);
|
262 |
+
}else if(preg_match('/<style\samp-custom>.*<\/style>/s', $completeContent,$matches)){
|
263 |
+
$completeContent = preg_replace("/<style\samp-custom>.*<\/style>/s", "".$comment."<style amp-custom>".$sheet."</style>", $completeContent);
|
264 |
}
|
|
|
265 |
}
|
266 |
}
|
267 |
//for fonts
|
304 |
}
|
305 |
}
|
306 |
}
|
307 |
+
if ( is_admin() && ampforwp_get_setting( 'ampforwp_css_tree_shaking' ) ){
|
308 |
+
register_activation_hook( 'amp-newspaper-theme/ampforwp-custom-theme.php', 'ampforwp_clear_tree_shaking_on_activity' );
|
309 |
+
register_deactivation_hook( 'amp-newspaper-theme/ampforwp-custom-theme.php', 'ampforwp_clear_tree_shaking_on_activity' );
|
310 |
+
register_activation_hook( 'amp-layouts/amp-layouts.php', 'ampforwp_clear_tree_shaking_on_activity' );
|
311 |
+
register_deactivation_hook( 'amp-layouts/amp-layouts.php', 'ampforwp_clear_tree_shaking_on_activity' );
|
312 |
+
}
|
313 |
+
function ampforwp_clear_tree_shaking_on_activity(){
|
314 |
+
if ( is_admin() && ampforwp_get_setting( 'ampforwp_css_tree_shaking' ) ){
|
315 |
+
$upload_dir = wp_upload_dir();
|
316 |
+
$user_dirname = $upload_dir['basedir'] . '/' . 'ampforwp-tree-shaking';
|
317 |
+
if ( file_exists( $user_dirname ) ) {
|
318 |
+
$files = glob( $user_dirname . '/*' );
|
319 |
+
//Loop through the file list.
|
320 |
+
foreach ( $files as $file ) {
|
321 |
+
//Make sure that this is a file and not a directory.
|
322 |
+
if ( is_file( $file ) && strpos( $file, '_transient' ) !== false ) {
|
323 |
+
//Use the unlink function to delete the file.
|
324 |
+
unlink( $file );
|
325 |
+
}
|
326 |
+
}
|
327 |
+
}
|
328 |
+
}
|
329 |
+
}
|
330 |
+
|
331 |
add_action( 'save_post', 'ampforwp_clear_tree_shaking_post');
|
332 |
if( !function_exists("ampforwp_clear_tree_shaking_post") ) {
|
333 |
function ampforwp_clear_tree_shaking_post() {
|
includes/vendor/amp/includes/class-amp-post-template.php
CHANGED
@@ -342,7 +342,12 @@ class AMP_Post_Template {
|
|
342 |
if($convert_to_webp && $display_webp){
|
343 |
$img_url = esc_url($src[1][0]);
|
344 |
$rep_url = esc_url($src[1][0]).".webp";
|
345 |
-
|
|
|
|
|
|
|
|
|
|
|
346 |
}
|
347 |
}
|
348 |
return $content;
|
@@ -374,7 +379,7 @@ class AMP_Post_Template {
|
|
374 |
preg_match_all('/width="(.*?)"/', $m1_content,$fimgwidth);
|
375 |
preg_match_all('/height="(.*?)"/', $m1_content,$fimgheight);
|
376 |
preg_match_all('/alt="(.*?)"/', $m1_content,$fimgalt);
|
377 |
-
if(isset($fimgsrc[1][0]) && isset($fimgwidth[1][0]) && isset($fimgheight[1][0])){
|
378 |
$data['src'] = $fimgsrc[1][0];
|
379 |
$data['width'] = $fimgwidth[1][0];
|
380 |
$data['height'] = $fimgheight[1][0];
|
342 |
if($convert_to_webp && $display_webp){
|
343 |
$img_url = esc_url($src[1][0]);
|
344 |
$rep_url = esc_url($src[1][0]).".webp";
|
345 |
+
if(isset($headers[0])){
|
346 |
+
$is_webp = stripos($headers[0], "200 OK") ? TRUE : FALSE;
|
347 |
+
if($is_webp){
|
348 |
+
$content = str_replace($img_url, $rep_url, $content);
|
349 |
+
}
|
350 |
+
}
|
351 |
}
|
352 |
}
|
353 |
return $content;
|
379 |
preg_match_all('/width="(.*?)"/', $m1_content,$fimgwidth);
|
380 |
preg_match_all('/height="(.*?)"/', $m1_content,$fimgheight);
|
381 |
preg_match_all('/alt="(.*?)"/', $m1_content,$fimgalt);
|
382 |
+
if((isset($fimgsrc[1][0]) && preg_match_all('/http/', $fimgsrc[1][0],$fbi)) && isset($fimgwidth[1][0]) && isset($fimgheight[1][0])){
|
383 |
$data['src'] = $fimgsrc[1][0];
|
384 |
$data['width'] = $fimgwidth[1][0];
|
385 |
$data['height'] = $fimgheight[1][0];
|
includes/vendor/amp/includes/sanitizers/class-amp-blacklist-sanitizer.php
CHANGED
@@ -123,6 +123,31 @@ class AMP_Blacklist_Sanitizer extends AMP_Base_Sanitizer {
|
|
123 |
$checkAllowedFlag = 1 ;
|
124 |
}
|
125 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
126 |
if( $parent_node->tagName != 'amp-state' && $checkAllowedFlag == 0){
|
127 |
$parent_node->removeChild( $element );
|
128 |
}
|
123 |
$checkAllowedFlag = 1 ;
|
124 |
}
|
125 |
}
|
126 |
+
|
127 |
+
//white listing form element #4010
|
128 |
+
$form_classes = '';
|
129 |
+
$form_method = '';
|
130 |
+
if($element->tagName=='form'){
|
131 |
+
$form_classes = $element->getAttribute('class');
|
132 |
+
$form_method = $element->getAttribute('method');
|
133 |
+
}else if($parent_node->tagName=='form'){
|
134 |
+
$form_classes = $parent_node->getAttribute('class');
|
135 |
+
$form_method = $parent_node->getAttribute('method');
|
136 |
+
}
|
137 |
+
$allow_form = 0;
|
138 |
+
$allow_form = apply_filters('ampforwp_whitelist_form_element',$allow_form,$element);
|
139 |
+
if((strpos($form_classes, 'ampforwp-form-allow') !== false || $allow_form==1) && strtolower($form_method)=='post'){
|
140 |
+
$checkAllowedFlag = 1;
|
141 |
+
}
|
142 |
+
|
143 |
+
if($form_method!=''){
|
144 |
+
if(strtolower($form_method)=='get'){
|
145 |
+
$checkAllowedFlag = 1;
|
146 |
+
}
|
147 |
+
}
|
148 |
+
//white listing form element close #4010
|
149 |
+
|
150 |
+
|
151 |
if( $parent_node->tagName != 'amp-state' && $checkAllowedFlag == 0){
|
152 |
$parent_node->removeChild( $element );
|
153 |
}
|
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.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -191,6 +191,13 @@ You can contact us from [here](https://ampforwp.com/contact/)
|
|
191 |
|
192 |
== Changelog ==
|
193 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
194 |
= 1.0.8 (2nd January 2020) =
|
195 |
* Fixed: Need to add Rankmath's "Nofollow External Links" feature. #3970 (updated the code)
|
196 |
|
@@ -202,22 +209,4 @@ You can contact us from [here](https://ampforwp.com/contact/)
|
|
202 |
* Fixed: amp-auto-ads script is loading in AMP-pages when Google site kit plugin is enable. #4009
|
203 |
* Fixed: wp-block CSS is heavily loading even when tree shaking is enabled in core. (Page builder is enabled) #4014
|
204 |
|
205 |
-
= 1.0.6 (31th December 2019) =
|
206 |
-
* Improvement: Allow users to add custom script in amp by using amp theme frame work plugin or without plugin #3865
|
207 |
-
* Improvement: Allow users to register scripts in proper way in AMP Theme Framework #3257
|
208 |
-
* Improvement: Need to add filter to modify mobile redirection #3987
|
209 |
-
* Improvement: Need to update Sabberworm/CSS folder. #4012
|
210 |
-
* Improvement: Need to make compatibility with "Transposh WordPress Translation" plugin #3895
|
211 |
-
* Fixed: Warning issue with "$amp_emplate->get('metadata')" undefined metadata #3967
|
212 |
-
* Fixed: GDPR popup appears once agin after accepting it #3957
|
213 |
-
* Fixed: AMP Page apears blank after adding script tag in Head Section of AMP Page Builder #3834
|
214 |
-
* Fixed: when user is not an admin and the admin bar is getting displayed as gap on the site #3918
|
215 |
-
* Fixed: Option Panel not saving in AMP FOR WP, it is giving 404 error #3768
|
216 |
-
* Fixed: Page Builder Latest Posts Category Module #3927
|
217 |
-
* Fixed: Error amp-iframe extension .js appears more than once #3810
|
218 |
-
* Fixed: Query monitor is not working in our latest version. #4008
|
219 |
-
* Fixed: Google Tag manager not firing properly #3826
|
220 |
-
* Fixed: Undefined variable block_css #4021
|
221 |
-
|
222 |
-
|
223 |
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.3.2
|
7 |
+
Stable tag: 1.0.9
|
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.9 (8th January 2020) =
|
195 |
+
* Fixed: Odd behaviour of Optimize CSS (Treeshaking),when turned off resolves the validation errors and when turned on adding unnecessary wp-block CSS. #4036
|
196 |
+
* Fixed: After enable the Tree shaking feature the CSS not loading properly #4034
|
197 |
+
* Fixed: fallback feature is not working on SVG images #4033
|
198 |
+
* Fixed: Need to update the Form Sanitizer to allow only the required from #4010
|
199 |
+
* Fixed: 404 error in console with Images having webp extension. #3983
|
200 |
+
|
201 |
= 1.0.8 (2nd January 2020) =
|
202 |
* Fixed: Need to add Rankmath's "Nofollow External Links" feature. #3970 (updated the code)
|
203 |
|
209 |
* Fixed: amp-auto-ads script is loading in AMP-pages when Google site kit plugin is enable. #4009
|
210 |
* Fixed: wp-block CSS is heavily loading even when tree shaking is enabled in core. (Page builder is enabled) #4014
|
211 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
Full changelog available [ at changelog.txt](https://plugins.svn.wordpress.org/accelerated-mobile-pages/trunk/changelog.txt)
|
templates/features.php
CHANGED
@@ -2747,9 +2747,6 @@ function ampforwp_sidebar_blacklist_tags($tags) {
|
|
2747 |
$textarea = array_search('textarea', $tags);
|
2748 |
$select = array_search('select', $tags);
|
2749 |
$option = array_search('option', $tags);
|
2750 |
-
if ( $form ) {
|
2751 |
-
unset($tags[$form]);
|
2752 |
-
}
|
2753 |
if ( $input ) {
|
2754 |
unset($tags[$input]);
|
2755 |
}
|
2747 |
$textarea = array_search('textarea', $tags);
|
2748 |
$select = array_search('select', $tags);
|
2749 |
$option = array_search('option', $tags);
|
|
|
|
|
|
|
2750 |
if ( $input ) {
|
2751 |
unset($tags[$input]);
|
2752 |
}
|