AMP for WP – Accelerated Mobile Pages - Version 0.9.51.1

Version Description

(12th June 2017) = * Redirection issue after 0.9.51 Update. * Improved compatibility with plugins.

Download this release

Release Info

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

Code changes from version 0.9.51 to 0.9.51.1

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.51
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
@@ -17,7 +17,7 @@ define('AMPFORWP_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
17
  define('AMPFORWP_PLUGIN_DIR_URI', plugin_dir_url(__FILE__));
18
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.php');
19
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
20
- define('AMPFORWP_VERSION','0.9.51');
21
  // any changes to AMP_QUERY_VAR should be refelected here
22
  define('AMPFORWP_AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) );
23
 
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.51.1
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
17
  define('AMPFORWP_PLUGIN_DIR_URI', plugin_dir_url(__FILE__));
18
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.php');
19
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
20
+ define('AMPFORWP_VERSION','0.9.51.1');
21
  // any changes to AMP_QUERY_VAR should be refelected here
22
  define('AMPFORWP_AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) );
23
 
includes/redirect.php CHANGED
@@ -22,7 +22,7 @@ function ampforwp_page_template_redirect() {
22
 
23
  if($redux_builder_amp['amp-mobile-redirection']){
24
 
25
- if($post_type='forum'){
26
  return;
27
  }
28
  session_start();
22
 
23
  if($redux_builder_amp['amp-mobile-redirection']){
24
 
25
+ if($post_type == 'forum'){
26
  return;
27
  }
28
  session_start();
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/5
5
  Requires at least: 3.0
6
  Tested up to: 4.7.5
7
- Stable tag: 0.9.51
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -134,6 +134,11 @@ You can contact me using this url: http://ampforwp.com/contact/
134
 
135
  == Changelog ==
136
 
 
 
 
 
 
137
  = 0.9.51 (8th June 2017) =
138
  * View more details on https://ampforwp.com/page-builder-released-in-amp/
139
  * Page Builder Support added ( See Tutorial at https://ampforwp.com/tutorials/page-builder/ )
4
  Donate link: https://www.paypal.me/Kaludi/5
5
  Requires at least: 3.0
6
  Tested up to: 4.7.5
7
+ Stable tag: 0.9.51.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
134
 
135
  == Changelog ==
136
 
137
+
138
+ = 0.9.51.1 (12th June 2017) =
139
+ * Redirection issue after 0.9.51 Update.
140
+ * Improved compatibility with plugins.
141
+
142
  = 0.9.51 (8th June 2017) =
143
  * View more details on https://ampforwp.com/page-builder-released-in-amp/
144
  * Page Builder Support added ( See Tutorial at https://ampforwp.com/tutorials/page-builder/ )
templates/features.php CHANGED
@@ -74,8 +74,7 @@
74
  62. Adding Meta viewport via hook instead of direct #878
75
  63. Frontpage Comments #682
76
  64. PageBuilder
77
-
78
-
79
  */
80
  // Adding AMP-related things to the main theme
81
  global $redux_builder_amp;
@@ -1226,15 +1225,20 @@ function ampforwp_remove_schema_data() {
1226
 
1227
  // Remove Popups and other elements added by Slider-in Plugin
1228
  define('WDSI_BOX_RENDERED', true, true);
1229
-
 
 
 
 
 
1230
  }
1231
 
1232
  // 22. Removing author links from comments Issue #180
1233
- if( ! function_exists( "disable_comment_author_links" ) ) {
1234
  function ampforwp_disable_comment_author_links( $author_link ){
1235
  $ampforwp_is_amp_endpoint = ampforwp_is_amp_endpoint();
1236
  if ( $ampforwp_is_amp_endpoint ) {
1237
- return strip_tags( $author_link );
1238
  } else {
1239
  return $author_link;
1240
  }
@@ -2799,6 +2803,32 @@ function ampforwp_pagebuilder_styling() { ?>
2799
  @media (max-width: 430px) { .flex-grid {display: block;} }
2800
  <?php }
2801
 
2802
-
2803
-
2804
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  62. Adding Meta viewport via hook instead of direct #878
75
  63. Frontpage Comments #682
76
  64. PageBuilder
77
+ 65. Remove Filters code added through Class by other plugins
 
78
  */
79
  // Adding AMP-related things to the main theme
80
  global $redux_builder_amp;
1225
 
1226
  // Remove Popups and other elements added by Slider-in Plugin
1227
  define('WDSI_BOX_RENDERED', true, true);
1228
+
1229
+ // Remove Filters added by third party plugin through class
1230
+ if ( function_exists('ampforwp_remove_filters_for_class')) {
1231
+ //Remove Disallowed 'like' tag from facebook Like button by Ultimate Facebook
1232
+ ampforwp_remove_filters_for_class( 'the_content', 'Wdfb_UniversalWorker', 'inject_facebook_button', 10 );
1233
+ }
1234
  }
1235
 
1236
  // 22. Removing author links from comments Issue #180
1237
+ if( ! function_exists( 'ampforwp_disable_comment_author_links' ) ) {
1238
  function ampforwp_disable_comment_author_links( $author_link ){
1239
  $ampforwp_is_amp_endpoint = ampforwp_is_amp_endpoint();
1240
  if ( $ampforwp_is_amp_endpoint ) {
1241
+ return strip_tags( $author_link );
1242
  } else {
1243
  return $author_link;
1244
  }
2803
  @media (max-width: 430px) { .flex-grid {display: block;} }
2804
  <?php }
2805
 
2806
+ /**
2807
+ * 65. Remove Filters code added through Class by other plugins
2808
+ *
2809
+ * Allow to remove method for an hook when, it's a class method used and class don't have variable, but you know the class name :)
2810
+ * Code from https://github.com/herewithme/wp-filters-extras
2811
+ */
2812
+ function ampforwp_remove_filters_for_class( $hook_name = '', $class_name ='', $method_name = '', $priority = 0 ) {
2813
+ global $wp_filter;
2814
+ // Take only filters on right hook name and priority
2815
+ if ( !isset($wp_filter[$hook_name][$priority]) || !is_array($wp_filter[$hook_name][$priority]) )
2816
+ return false;
2817
+ // Loop on filters registered
2818
+ foreach( (array) $wp_filter[$hook_name][$priority] as $unique_id => $filter_array ) {
2819
+ // Test if filter is an array ! (always for class/method)
2820
+ if ( isset($filter_array['function']) && is_array($filter_array['function']) ) {
2821
+ // Test if object is a class, class and method is equal to param !
2822
+ if ( is_object($filter_array['function'][0]) && get_class($filter_array['function'][0]) && get_class($filter_array['function'][0]) == $class_name && $filter_array['function'][1] == $method_name ) {
2823
+ // Test for WordPress >= 4.7 WP_Hook class (https://make.wordpress.org/core/2016/09/08/wp_hook-next-generation-actions-and-filters/)
2824
+ if( is_a( $wp_filter[$hook_name], 'WP_Hook' ) ) {
2825
+ unset( $wp_filter[$hook_name]->callbacks[$priority][$unique_id] );
2826
+ }
2827
+ else {
2828
+ unset($wp_filter[$hook_name][$priority][$unique_id]);
2829
+ }
2830
+ }
2831
+ }
2832
+ }
2833
+ return false;
2834
+ }