From af03a734f06090bf08f5d5bf314691c5e3f4bd82 Mon Sep 17 00:00:00 2001 From: Ahmed Kaludi Date: Wed, 12 Oct 2016 18:37:39 +0530 Subject: [PATCH 01/12] Validation issue: 'Value' tag The attribute 'value' in tag 'li' is set to the invalid value 'embrace'. --- accelerated-moblie-pages.php | 2 +- templates/features.php | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/accelerated-moblie-pages.php b/accelerated-moblie-pages.php index ae7c3158e..80533091e 100644 --- a/accelerated-moblie-pages.php +++ b/accelerated-moblie-pages.php @@ -3,7 +3,7 @@ Plugin Name: Accelerated Mobile Pages Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/ Description: AMP Toolbox - Accelerated Mobile Pages for WordPress -Version: 0.8.5 +Version: 0.8.6 BETA Author: Ahmed Kaludi, Mohammed Kaludi Author URI: http://ampforwp.com/ License: GPL2 diff --git a/templates/features.php b/templates/features.php index acc89c46a..3de286d2c 100644 --- a/templates/features.php +++ b/templates/features.php @@ -368,12 +368,15 @@ function ampforwp_strip_invalid_content(){ function ampforwp_the_content_filter( $content ) { $content = preg_replace('/property=[^>]*/', '', $content); $content = preg_replace('/vocab=[^>]*/', '', $content); + $content = preg_replace('/value=[^>]*/', '', $content); $content = preg_replace('/style=[^>]*/', '', $content); $content = preg_replace('#(.*?)#i', '', $content); + $content = preg_replace('##i', '', $content); $content = preg_replace('/href="javascript:void*/', ' ', $content); return $content; } + // 12. Add Logo URL in the structured metadata add_filter( 'amp_post_template_metadata', 'ampforwp_update_metadata', 10, 2 ); function ampforwp_update_metadata( $metadata, $post ) { From 7922c5f78960d56f8e3c2b736bdc99e38c69b37a Mon Sep 17 00:00:00 2001 From: Ahmed Kaludi Date: Wed, 12 Oct 2016 18:39:24 +0530 Subject: [PATCH 02/12] Validation Issue: The attribute 'contenteditable' may not appear in tag 'a'. Validation Issue: The attribute 'contenteditable' may not appear in tag 'a'. --- templates/features.php | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/features.php b/templates/features.php index 3de286d2c..81f090b12 100644 --- a/templates/features.php +++ b/templates/features.php @@ -369,6 +369,7 @@ function ampforwp_the_content_filter( $content ) { $content = preg_replace('/property=[^>]*/', '', $content); $content = preg_replace('/vocab=[^>]*/', '', $content); $content = preg_replace('/value=[^>]*/', '', $content); + $content = preg_replace('/contenteditable=[^>]*/', '', $content); $content = preg_replace('/style=[^>]*/', '', $content); $content = preg_replace('#(.*?)#i', '', $content); $content = preg_replace('##i', '', $content); From be394898290ae99e7ab52d537b0804656c71ed5d Mon Sep 17 00:00:00 2001 From: Ahmed Kaludi Date: Wed, 12 Oct 2016 18:56:17 +0530 Subject: [PATCH 03/12] Validation issue: Table issue The attribute 'width' may not appear in tag 'col'. --- templates/features.php | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/features.php b/templates/features.php index 81f090b12..004f60c4f 100644 --- a/templates/features.php +++ b/templates/features.php @@ -372,6 +372,7 @@ function ampforwp_the_content_filter( $content ) { $content = preg_replace('/contenteditable=[^>]*/', '', $content); $content = preg_replace('/style=[^>]*/', '', $content); $content = preg_replace('#(.*?)#i', '', $content); + $content = preg_replace('##i', '', $content); $content = preg_replace('##i', '', $content); $content = preg_replace('/href="javascript:void*/', ' ', $content); return $content; From 644599053bf7a3fa45abaacc4c175d561658ac21 Mon Sep 17 00:00:00 2001 From: Ahmed Kaludi Date: Wed, 12 Oct 2016 19:01:37 +0530 Subject: [PATCH 04/12] Validation: Height in Table The attribute 'height' may not appear in tag 'table'. --- templates/features.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/features.php b/templates/features.php index 004f60c4f..1fb94dd52 100644 --- a/templates/features.php +++ b/templates/features.php @@ -373,11 +373,12 @@ function ampforwp_the_content_filter( $content ) { $content = preg_replace('/style=[^>]*/', '', $content); $content = preg_replace('#(.*?)#i', '', $content); $content = preg_replace('##i', '', $content); + $content = preg_replace('##i', '', $content); $content = preg_replace('##i', '', $content); $content = preg_replace('/href="javascript:void*/', ' ', $content); return $content; } - + // 12. Add Logo URL in the structured metadata add_filter( 'amp_post_template_metadata', 'ampforwp_update_metadata', 10, 2 ); From b79f2b8cfa6ccfbc26014f69a352fce1fca1dc14 Mon Sep 17 00:00:00 2001 From: Mohammed Kaludi Date: Wed, 12 Oct 2016 21:07:36 +0530 Subject: [PATCH 05/12] Tags on off option created fixed #126 Tags on off option created fixed #126 --- includes/options/options-init.php | 10 ++++++++++ templates/single.php | 7 +++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/includes/options/options-init.php b/includes/options/options-init.php index 3a472fec7..211045c67 100644 --- a/includes/options/options-init.php +++ b/includes/options/options-init.php @@ -574,6 +574,16 @@ 'subtitle' => __('Enable Next / Previous in the single post', 'redux-framework-demo'), 'true' => 'Enabled', 'false' => 'Disabled', + ), + // Tags ON/OFF + array( + 'id' => 'ampforwp-single-tags-on-off', + 'type' => 'switch', + 'title' => __('Tags', 'redux-framework-demo'), + 'default' => 1, + 'subtitle' => __('Enable / Disable Tags in the single post', 'redux-framework-demo'), + 'true' => 'Enabled', + 'false' => 'Disabled', ), // Social Icons ON/OFF array( diff --git a/templates/single.php b/templates/single.php index 81cee0d29..6619d2df2 100644 --- a/templates/single.php +++ b/templates/single.php @@ -51,7 +51,10 @@
- load_parts( apply_filters( 'amp_post_template_meta_parts', array( 'meta-taxonomy' ) ) ); ?> + load_parts( apply_filters( 'amp_post_template_meta_parts', array( 'meta-taxonomy' ) ) ); + + } ?> @@ -89,4 +92,4 @@ - \ No newline at end of file + From 249993d59ae4a64da7ef439eb1bb6a2e777fbd73 Mon Sep 17 00:00:00 2001 From: Ahmed Kaludi Date: Wed, 12 Oct 2016 21:17:01 +0530 Subject: [PATCH 06/12] Validation issue fixed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit V: time="" non-refundable="" security="" deposit="" for=“” ( https://goo.gl/4ZP1js ) --- templates/features.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/templates/features.php b/templates/features.php index 1fb94dd52..bd10f35d7 100644 --- a/templates/features.php +++ b/templates/features.php @@ -370,7 +370,13 @@ function ampforwp_the_content_filter( $content ) { $content = preg_replace('/vocab=[^>]*/', '', $content); $content = preg_replace('/value=[^>]*/', '', $content); $content = preg_replace('/contenteditable=[^>]*/', '', $content); + $content = preg_replace('/time=[^>]*/', '', $content); + $content = preg_replace('/non-refundable=[^>]*/', '', $content); + $content = preg_replace('/security=[^>]*/', '', $content); + $content = preg_replace('/deposit=[^>]*/', '', $content); + $content = preg_replace('/for=[^>]*/', '', $content); $content = preg_replace('/style=[^>]*/', '', $content); + $content = preg_replace('/nowrap="nowrap"/', '', $content); $content = preg_replace('#(.*?)#i', '', $content); $content = preg_replace('##i', '', $content); $content = preg_replace('##i', '
', $content); From 17a538db73183e35d377f3b31a586db66bd303cb Mon Sep 17 00:00:00 2001 From: Mohammed Kaludi Date: Wed, 12 Oct 2016 21:32:25 +0530 Subject: [PATCH 07/12] Disable New Relic's extra scripts Fixed #142 Disable New Relic's extra scripts Fixed #142 --- templates/features.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/templates/features.php b/templates/features.php index bd10f35d7..13bd26abb 100644 --- a/templates/features.php +++ b/templates/features.php @@ -15,6 +15,7 @@ 12. Add Logo URL in the structured metadata 13. Add Custom Placeholder Image for Structured Data. 14. Adds a meta box to the post editing screen for AMP on-off on specific pages. +15. Disable New Relic's extra script that its adds in AMP pages. */ // Adding AMP-related things to the main theme @@ -499,3 +500,17 @@ function ampforwp_hide_amp_for_specific_pages($input){ } return $input; } + +// 15. Disable New Relic's extra script that its adds in AMP pages. +add_action( 'amp_post_template_data', 'ampforwp_disable_new_relic_scripts' ); +if ( ! function_exists('ampforwp_disable_new_relic_scripts') ) { + function ampforwp_disable_new_relic_scripts( $data ) { + if ( ! function_exists( 'newrelic_disable_autorum' ) ) { + return $data; + } + if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) { + newrelic_disable_autorum(); + } + return $data; + } +} From 727b08a4bd54e10cc938f9f48973932843d4cc13 Mon Sep 17 00:00:00 2001 From: Mohammed Kaludi Date: Wed, 12 Oct 2016 23:20:53 +0530 Subject: [PATCH 08/12] Remove Unwanted Scripts Remove Unwanted Scripts --- templates/features.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/templates/features.php b/templates/features.php index 13bd26abb..7018e0270 100644 --- a/templates/features.php +++ b/templates/features.php @@ -16,6 +16,7 @@ 13. Add Custom Placeholder Image for Structured Data. 14. Adds a meta box to the post editing screen for AMP on-off on specific pages. 15. Disable New Relic's extra script that its adds in AMP pages. +16. Remove Unwanted Scripts */ // Adding AMP-related things to the main theme @@ -514,3 +515,11 @@ function ampforwp_disable_new_relic_scripts( $data ) { return $data; } } + +// 16. Remove Unwanted Scripts +if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) { + add_action( 'wp_enqueue_scripts', 'ampforwp_remove_unwanted_scripts',20 ); +} +function ampforwp_remove_unwanted_scripts() { + wp_dequeue_script('jquery'); +} From 671d8d47216a4bea0f23220b6b24e56faddbdd46 Mon Sep 17 00:00:00 2001 From: Ahmed Kaludi Date: Fri, 14 Oct 2016 01:25:02 +0530 Subject: [PATCH 09/12] Canonical and correct AMP html Redirect issues Solved Canonical and correct AMP html Redirect issues Solved --- templates/features.php | 43 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/templates/features.php b/templates/features.php index 7018e0270..b55f1009f 100644 --- a/templates/features.php +++ b/templates/features.php @@ -17,8 +17,10 @@ 14. Adds a meta box to the post editing screen for AMP on-off on specific pages. 15. Disable New Relic's extra script that its adds in AMP pages. 16. Remove Unwanted Scripts +17. Archives Canonical in AMP version +18. Custom Canonical for Homepage +19. Remove Canonical tags */ - // Adding AMP-related things to the main theme global $redux_builder_amp; @@ -31,7 +33,7 @@ function ampforwp_allow_homepage(){ } function ampforwp_add_endpoint_actions() { - if ( is_home() || is_archive() ) { + if ( is_home() || is_archive() ) { $is_amp_endpoint = is_amp_endpoint(); @@ -50,7 +52,13 @@ function ampforwp_home_archive_rel_canonical() { if ( is_home() || is_front_page() ){ $amp_url = home_url('/?amp'); - } else { + } + elseif( is_archive()){ + global $wp; + $archive_current_url = add_query_arg( '', '', home_url( $wp->request ) ); + $amp_url = $archive_current_url . '/?amp'; + } + else { $amp_url = trailingslashit( get_permalink().'amp' ); } @@ -523,3 +531,32 @@ function ampforwp_disable_new_relic_scripts( $data ) { function ampforwp_remove_unwanted_scripts() { wp_dequeue_script('jquery'); } + +// 17. Archives Canonical in AMP version +function ampforwp_rel_canonical_archive() { + if ( !is_archive() ) + return; +global $wp; +$current_archive_url = home_url( $wp->request ); +// $archivelink = esc_url( get_permalink( $id ) . AMP_QUERY_VAR . '/' ); + echo "\n"; +} +add_action( 'amp_post_template_head', 'ampforwp_rel_canonical_archive' ); + +// 18. Custom Canonical for Homepage +function ampforwp_rel_canonical() { + if ( !is_home() || !is_front_page() ) + return; +// $link = esc_url( get_permalink( $id ) . AMP_QUERY_VAR . '/' ); + $homelink = get_home_url(); + echo "\n"; +} +add_action( 'amp_post_template_head', 'ampforwp_rel_canonical' ); + +// 19. Remove Canonical tags +function ampforwp_amp_remove_actions() { + if ( is_home() || is_front_page() || is_archive() ) { + remove_action( 'amp_post_template_head', 'amp_post_template_add_canonical' ); + } +} + add_action( 'amp_post_template_head', 'ampforwp_amp_remove_actions', 9 ); \ No newline at end of file From 0d5b442fd89812f30687c52efe2ab8a1859ad3c4 Mon Sep 17 00:00:00 2001 From: Ahmed Kaludi Date: Fri, 14 Oct 2016 02:39:45 +0530 Subject: [PATCH 10/12] NextGen Gallery AMP Support NextGen Gallery AMP Support --- accelerated-moblie-pages.php | 2 +- readme.txt | 9 +++++++++ templates/features.php | 25 ++++++++++++++++++++++++- 3 files changed, 34 insertions(+), 2 deletions(-) diff --git a/accelerated-moblie-pages.php b/accelerated-moblie-pages.php index 80533091e..8b66a1683 100644 --- a/accelerated-moblie-pages.php +++ b/accelerated-moblie-pages.php @@ -3,7 +3,7 @@ Plugin Name: Accelerated Mobile Pages Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/ Description: AMP Toolbox - Accelerated Mobile Pages for WordPress -Version: 0.8.6 BETA +Version: 0.8.5.1 Author: Ahmed Kaludi, Mohammed Kaludi Author URI: http://ampforwp.com/ License: GPL2 diff --git a/readme.txt b/readme.txt index c79120c65..34e9a78fb 100644 --- a/readme.txt +++ b/readme.txt @@ -109,6 +109,15 @@ Please check if you have "Pretty Permalinks" enabled. If not then activate it. F == Changelog == += 0.8.5.1 = +* Validation issue fixed: 'Value' tag +* Validation issue fixed: The attribute 'contenteditable' may not appear in tag 'a'. +* Validation issue fixed: Table markup +* Validation issue fixed: nowrap and misc tags +* New Relic Support +* Tags on off option +* Canonical and correct AMP html Redirect issues Solved
 + = 0.8.5 = * Proper Details at http://ampforwp.com/the-0-4-compatibility/ * AMP 0.4 Compatibility Check diff --git a/templates/features.php b/templates/features.php index b55f1009f..2f0ef7f0e 100644 --- a/templates/features.php +++ b/templates/features.php @@ -531,6 +531,29 @@ function ampforwp_disable_new_relic_scripts( $data ) { function ampforwp_remove_unwanted_scripts() { wp_dequeue_script('jquery'); } +// Remove Print Scripts and styles +function ampforwp_remove_print_scripts() { + if ( is_amp_endpoint() ) { + + function ampforwp_remove_all_scripts() { + global $wp_scripts; + $wp_scripts->queue = array(); + } + add_action('wp_print_scripts', 'ampforwp_remove_all_scripts', 100); + function ampforwp_remove_all_styles() { + global $wp_styles; + $wp_styles->queue = array(); + } + add_action('wp_print_styles', 'ampforwp_remove_all_styles', 100); + +// Remove Print Emoji for Nextgen Gallery support +remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); +remove_action( 'wp_print_styles', 'print_emoji_styles' ); + + } +} +add_action( 'template_redirect', 'ampforwp_remove_print_scripts' ); + // 17. Archives Canonical in AMP version function ampforwp_rel_canonical_archive() { @@ -559,4 +582,4 @@ function ampforwp_amp_remove_actions() { remove_action( 'amp_post_template_head', 'amp_post_template_add_canonical' ); } } - add_action( 'amp_post_template_head', 'ampforwp_amp_remove_actions', 9 ); \ No newline at end of file +add_action( 'amp_post_template_head', 'ampforwp_amp_remove_actions', 9 ); \ No newline at end of file From cfa86ae005509b67f822f7bc0836cfd99311a336 Mon Sep 17 00:00:00 2001 From: Ahmed Kaludi Date: Fri, 14 Oct 2016 02:43:36 +0530 Subject: [PATCH 11/12] Change log and version bump Change log and version bump --- README.md | 12 +++++++++++- readme.txt | 5 +++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index d3be5a028..8ee943333 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Contributors: mohammed_kaludi, ahmedkaludi Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google Requires at least: 3.0 Tested up to: 4.6.1 -Stable tag: 0.8.5 +Stable tag: 0.8.5.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -112,6 +112,16 @@ Please check if you have "Pretty Permalinks" enabled. If not then activate it. F == Changelog == += 0.8.5.1 = +* Validation issue fixed: 'Value' tag +* Validation issue fixed: The attribute 'contenteditable' may not appear in tag 'a'. +* Validation issue fixed: Table markup +* Validation issue fixed: nowrap and misc tags +* New Relic Support +* Tags on off option +* Canonical and correct AMP html Redirect issues Solved +* NextGEN Gallery Validation Support Added + = 0.8.5 = * Proper Details at http://ampforwp.com/the-0-4-compatibility/ * AMP 0.4 Compatibility Check diff --git a/readme.txt b/readme.txt index 34e9a78fb..981b2c6b7 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ Contributors: mohammed_kaludi, ahmedkaludi Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google Requires at least: 3.0 Tested up to: 4.6.1 -Stable tag: 0.8.5 +Stable tag: 0.8.5.1 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html @@ -116,7 +116,8 @@ Please check if you have "Pretty Permalinks" enabled. If not then activate it. F * Validation issue fixed: nowrap and misc tags * New Relic Support * Tags on off option -* Canonical and correct AMP html Redirect issues Solved
 +* Canonical and correct AMP html Redirect issues Solved +* NextGEN Gallery Validation Support Added = 0.8.5 = * Proper Details at http://ampforwp.com/the-0-4-compatibility/ From d27955d88c2d23cf41d72d3165ead69c99eef906 Mon Sep 17 00:00:00 2001 From: Ahmed Kaludi Date: Fri, 14 Oct 2016 02:52:17 +0530 Subject: [PATCH 12/12] Link added Link added --- README.md | 1 + readme.txt | 1 + 2 files changed, 2 insertions(+) diff --git a/README.md b/README.md index 8ee943333..b607774d2 100644 --- a/README.md +++ b/README.md @@ -113,6 +113,7 @@ Please check if you have "Pretty Permalinks" enabled. If not then activate it. F == Changelog == = 0.8.5.1 = +* Proper Details at http://ampforwp.com/new/ * Validation issue fixed: 'Value' tag * Validation issue fixed: The attribute 'contenteditable' may not appear in tag 'a'. * Validation issue fixed: Table markup diff --git a/readme.txt b/readme.txt index 981b2c6b7..7c37b6044 100644 --- a/readme.txt +++ b/readme.txt @@ -110,6 +110,7 @@ Please check if you have "Pretty Permalinks" enabled. If not then activate it. F == Changelog == = 0.8.5.1 = +* Proper Details at http://ampforwp.com/new/ * Validation issue fixed: 'Value' tag * Validation issue fixed: The attribute 'contenteditable' may not appear in tag 'a'. * Validation issue fixed: Table markup