AMP for WP – Accelerated Mobile Pages - Version 0.9.97.27

Version Description

(23rd January 2019) = * Added: ampforwp_is_amp_endpoint_takeover filter added * Fixed: The attribute 'action' may not appear in tag 'FORM [method=POST]' #2835 * Fixed: Image size smaller than recommended size Warning in Search console #2838

Full changelog available in changelog.txt

Download this release

Release Info

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

Code changes from version 0.9.97.26 to 0.9.97.27

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.0.3
7
- Stable tag: 0.9.97.26
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -184,6 +184,11 @@ You can contact us from [here](https://ampforwp.com/contact/)
184
 
185
  == Changelog ==
186
 
 
 
 
 
 
187
  = 0.9.97.26 (21st January 2019) =
188
  * Added: Improve the Extension array code #2822
189
  * Fixed: WP_Widget_Text conflict after v0.9.97.24 #2821
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.0.3
7
+ Stable tag: 0.9.97.27
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
184
 
185
  == Changelog ==
186
 
187
+ = 0.9.97.27 (23rd January 2019) =
188
+ * Added: ampforwp_is_amp_endpoint_takeover filter added
189
+ * Fixed: The attribute 'action' may not appear in tag 'FORM [method=POST]' #2835
190
+ * Fixed: Image size smaller than recommended size Warning in Search console #2838
191
+
192
  = 0.9.97.26 (21st January 2019) =
193
  * Added: Improve the Extension array code #2822
194
  * Fixed: WP_Widget_Text conflict after v0.9.97.24 #2821
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: 0.9.97.26
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','0.9.97.26');
24
  // any changes to AMP_QUERY_VAR should be refelected here
25
  function ampforwp_generate_endpoint(){
26
  $ampforwp_slug = '';
@@ -519,7 +519,7 @@ if ( is_admin() ) {
519
  // AMP endpoint Verifier
520
  function ampforwp_is_amp_endpoint() {
521
  if ( ampforwp_is_non_amp() && ! is_admin()) {
522
- return ampforwp_is_non_amp();
523
  }
524
  else {
525
  return apply_filters('ampforwp_is_amp_endpoint', false !== get_query_var( 'amp', false ) );
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: 0.9.97.27
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','0.9.97.27');
24
  // any changes to AMP_QUERY_VAR should be refelected here
25
  function ampforwp_generate_endpoint(){
26
  $ampforwp_slug = '';
519
  // AMP endpoint Verifier
520
  function ampforwp_is_amp_endpoint() {
521
  if ( ampforwp_is_non_amp() && ! is_admin()) {
522
+ return apply_filters('ampforwp_is_amp_endpoint_takeover', ampforwp_is_non_amp() );
523
  }
524
  else {
525
  return apply_filters('ampforwp_is_amp_endpoint', false !== get_query_var( 'amp', false ) );
changelog.txt CHANGED
@@ -1,5 +1,10 @@
1
  == Changelog ==
2
 
 
 
 
 
 
3
  = 0.9.97.26 (21st January 2019) =
4
  * Added: Improve the Extension array code #2822
5
  * Fixed: WP_Widget_Text conflict after v0.9.97.24 #2821
1
  == Changelog ==
2
 
3
+ = 0.9.97.27 (23rd January 2019) =
4
+ * Added: ampforwp_is_amp_endpoint_takeover filter added
5
+ * Fixed: The attribute 'action' may not appear in tag 'FORM [method=POST]' #2835
6
+ * Fixed: Image size smaller than recommended size Warning in Search console #2838
7
+
8
  = 0.9.97.26 (21st January 2019) =
9
  * Added: Improve the Extension array code #2822
10
  * Fixed: WP_Widget_Text conflict after v0.9.97.24 #2821
includes/vendor/amp/includes/sanitizers/class-amp-blacklist-sanitizer.php CHANGED
@@ -19,6 +19,10 @@ class AMP_Blacklist_Sanitizer extends AMP_Base_Sanitizer {
19
 
20
  public function sanitize() {
21
  $blacklisted_tags = $this->get_blacklisted_tags();
 
 
 
 
22
  $blacklisted_attributes = $this->get_blacklisted_attributes();
23
  $blacklisted_protocols = $this->get_blacklisted_protocols();
24
 
19
 
20
  public function sanitize() {
21
  $blacklisted_tags = $this->get_blacklisted_tags();
22
+ // Blacklisted tags for non-content #2835
23
+ if ( true === $this->args['non-content'] ) {
24
+ $blacklisted_tags = ampforwp_sidebar_blacklist_tags($blacklisted_tags);
25
+ }
26
  $blacklisted_attributes = $this->get_blacklisted_attributes();
27
  $blacklisted_protocols = $this->get_blacklisted_protocols();
28
 
includes/vendor/vendor-changelog.txt CHANGED
@@ -56,4 +56,5 @@ Reason: To extend the functionality of sidebars and Pagebuilder
56
  29. Converted the space into %20 on anchor links which have spaces on line number 166 and here is the github ticket #2465
57
  30. FTP protocol has been whitelisted in anchor tags #2477
58
  31. Class AMP_Img_Sanitizer Updated #2748
59
- 32. Widgets folder added in Vendor amp/includes #1400
 
56
  29. Converted the space into %20 on anchor links which have spaces on line number 166 and here is the github ticket #2465
57
  30. FTP protocol has been whitelisted in anchor tags #2477
58
  31. Class AMP_Img_Sanitizer Updated #2748
59
+ 32. Widgets folder added in Vendor amp/includes #1400
60
+ 33. Class AMP_Blacklist_Sanitizer updated #2835
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.0.3
7
- Stable tag: 0.9.97.26
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -185,8 +185,9 @@ You can contact us from [here](https://ampforwp.com/contact/)
185
 
186
  == Changelog ==
187
 
188
- = 0.9.97.26 (21st January 2019) =
189
- * Added: Improve the Extension array code #2822
190
- * Fixed: WP_Widget_Text conflict after v0.9.97.24 #2821
 
191
 
192
  Full changelog available in changelog.txt
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.0.3
7
+ Stable tag: 0.9.97.27
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
185
 
186
  == Changelog ==
187
 
188
+ = 0.9.97.27 (23rd January 2019) =
189
+ * Added: ampforwp_is_amp_endpoint_takeover filter added
190
+ * Fixed: The attribute 'action' may not appear in tag 'FORM [method=POST]' #2835
191
+ * Fixed: Image size smaller than recommended size Warning in Search console #2838
192
 
193
  Full changelog available in changelog.txt
templates/features.php CHANGED
@@ -119,6 +119,7 @@ if ( ! defined( 'ABSPATH' ) ) {
119
  99. Merriweather Font Management
120
  100. Flags compatibility in Menu
121
  101. Function for Logo attributes
 
122
  */
123
  // AMP Components
124
  // AMP LOGO
@@ -3176,14 +3177,19 @@ function ampforwp_sidebar_content_sanitizer($sidebar){
3176
  global $redux_builder_amp;
3177
  $sanitized_sidebar = "";
3178
  $non_sanitized_sidebar = "";
3179
- $sidebar_data = array();
 
 
 
 
 
3180
  ob_start();
3181
  dynamic_sidebar( $sidebar );
3182
  $non_sanitized_sidebar = ob_get_contents();
3183
  ob_end_clean();
3184
 
3185
  if ( $non_sanitized_sidebar ) {
3186
- $sanitized_sidebar = new AMPFORWP_Content( $non_sanitized_sidebar,
3187
  apply_filters( 'amp_content_embed_handlers', array(
3188
  'AMP_Twitter_Embed_Handler' => array(),
3189
  'AMP_YouTube_Embed_Handler' => array(),
@@ -3198,7 +3204,7 @@ function ampforwp_sidebar_content_sanitizer($sidebar){
3198
  ) ),
3199
  apply_filters( 'amp_sidebar_sanitizers', array(
3200
  'AMP_Style_Sanitizer' => array(),
3201
- 'AMP_Blacklist_Sanitizer' => array(),
3202
  'AMP_Img_Sanitizer' => array(),
3203
  'AMP_Video_Sanitizer' => array(),
3204
  'AMP_Audio_Sanitizer' => array(),
@@ -3209,9 +3215,8 @@ function ampforwp_sidebar_content_sanitizer($sidebar){
3209
  ) ), array('non-content'=>'non-content')
3210
  );
3211
  }
3212
- // Allow some blacklisted tags #1400
3213
- add_filter('amp_blacklisted_tags','ampforwp_sidebar_blacklist_tags');
3214
  if ( is_active_widget(false,false,'search') && $sanitized_sidebar) {
 
3215
  add_filter('ampforwp_modify_sidebars_content','ampforwp_modified_search_sidebar');
3216
  }
3217
  return $sanitized_sidebar;
@@ -7710,3 +7715,20 @@ function ampforwp_jannah_subtitle(){
7710
  <?php
7711
  }
7712
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  99. Merriweather Font Management
120
  100. Flags compatibility in Menu
121
  101. Function for Logo attributes
122
+ 102. SD Feature Image Guidlines #2838
123
  */
124
  // AMP Components
125
  // AMP LOGO
3177
  global $redux_builder_amp;
3178
  $sanitized_sidebar = "";
3179
  $non_sanitized_sidebar = "";
3180
+ $sidebar_data = array();
3181
+ $blacklist_array = array();
3182
+ // Remove some blacklist tags from sidebars only when search,archives and categories widgets are active #2835
3183
+ if ( is_active_widget(false,false,'search') || is_active_widget(false,false,'archives') || is_active_widget(false,false,'categories') ) {
3184
+ $blacklist_array['non-content'] = true;
3185
+ }
3186
  ob_start();
3187
  dynamic_sidebar( $sidebar );
3188
  $non_sanitized_sidebar = ob_get_contents();
3189
  ob_end_clean();
3190
 
3191
  if ( $non_sanitized_sidebar ) {
3192
+ $sanitized_sidebar = new AMPforWP_Content( $non_sanitized_sidebar,
3193
  apply_filters( 'amp_content_embed_handlers', array(
3194
  'AMP_Twitter_Embed_Handler' => array(),
3195
  'AMP_YouTube_Embed_Handler' => array(),
3204
  ) ),
3205
  apply_filters( 'amp_sidebar_sanitizers', array(
3206
  'AMP_Style_Sanitizer' => array(),
3207
+ 'AMP_Blacklist_Sanitizer' => $blacklist_array,
3208
  'AMP_Img_Sanitizer' => array(),
3209
  'AMP_Video_Sanitizer' => array(),
3210
  'AMP_Audio_Sanitizer' => array(),
3215
  ) ), array('non-content'=>'non-content')
3216
  );
3217
  }
 
 
3218
  if ( is_active_widget(false,false,'search') && $sanitized_sidebar) {
3219
+ // Allow some blacklisted tags #1400
3220
  add_filter('ampforwp_modify_sidebars_content','ampforwp_modified_search_sidebar');
3221
  }
3222
  return $sanitized_sidebar;
7715
  <?php
7716
  }
7717
  }
7718
+
7719
+ // SD Feature Image Guidlines #2838
7720
+ add_filter( 'amp_post_template_metadata', 'ampforwp_sd_feature_image_guidlines', 22, 1 );
7721
+ if ( ! function_exists('ampforwp_sd_feature_image_guidlines') ) {
7722
+ function ampforwp_sd_feature_image_guidlines($metadata){
7723
+ if ( isset($metadata['image']['width']) && $metadata['image']['width'] <= 1200 ){
7724
+ $image_width = 1280;
7725
+ $image_height = 720;
7726
+ $image = ampforwp_aq_resize( $metadata['image']['url'], $image_width, $image_height, true, false, true );
7727
+ $image_url = $image[0];
7728
+ $metadata['image']['url'] = $image_url;
7729
+ $metadata['image']['width'] = $image_width;
7730
+ $metadata['image']['height'] = $image_height;
7731
+ }
7732
+ return $metadata;
7733
+ }
7734
+ }