AMP for WP – Accelerated Mobile Pages - Version 0.9.97.7

Version Description

(18th July 2018) = * Fixed: PageBuilder not loading on frontpage #2360 * Fixed: 500 error on somepages due to open wp_query by other plugins * Fixed: License key reupdating #2261 * Fixed: AMP renders with ?q after the /amp #2361

Download this release

Release Info

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

Code changes from version 0.9.97.6 to 0.9.97.7

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: 4.9.5
7
- Stable tag: 0.9.97.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -183,9 +183,16 @@ You can contact us from [here](https://ampforwp.com/contact/)
183
 
184
  == Changelog ==
185
 
 
 
 
 
 
 
 
186
  = 0.9.97.6 (14th July 2018) =
187
  * Fixed: Error and Warning on Structured Data for Logo. #2360
188
- * Fixed: Category Bilk tool breaking meta boxes #2335
189
 
190
  = 0.9.97.5 (11th July 2018) =
191
  * Fixed: Title disappearing in Design 1,2,3 when legacy pagebuilder is enabled #2341
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 4.9.5
7
+ Stable tag: 0.9.97.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
183
 
184
  == Changelog ==
185
 
186
+ = 0.9.97.7 (18th July 2018) =
187
+ * Fixed: PageBuilder not loading on frontpage #2360
188
+ * Fixed: 500 error on somepages due to open wp_query by other plugins
189
+ * Fixed: License key reupdating #2261
190
+ * Fixed: AMP renders with ?q after the /amp #2361
191
+
192
+
193
  = 0.9.97.6 (14th July 2018) =
194
  * Fixed: Error and Warning on Structured Data for Logo. #2360
195
+ * Fixed: Category Bulk tool breaking meta boxes #2335
196
 
197
  = 0.9.97.5 (11th July 2018) =
198
  * Fixed: Title disappearing in Design 1,2,3 when legacy pagebuilder is enabled #2341
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.6
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
@@ -19,7 +19,7 @@ define('AMPFORWP_PLUGIN_DIR_URI', plugin_dir_url(__FILE__));
19
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.html');
20
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
21
  define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
22
- define('AMPFORWP_VERSION','0.9.97.6');
23
  // any changes to AMP_QUERY_VAR should be refelected here
24
  function ampforwp_generate_endpoint(){
25
  $ampforwp_slug = '';
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.7
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
19
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.html');
20
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
21
  define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
22
+ define('AMPFORWP_VERSION','0.9.97.7');
23
  // any changes to AMP_QUERY_VAR should be refelected here
24
  function ampforwp_generate_endpoint(){
25
  $ampforwp_slug = '';
includes/admin-script.js CHANGED
@@ -433,16 +433,16 @@ var reduxOptionTab = function(){
433
  //reduxOptionTab();
434
 
435
  $(".redux-ampforwp-ext-activate").click(function(){
436
- var currentThis = $(this);
437
  var plugin_id = currentThis.attr("id");
 
438
  var license = $('input[name="redux_builder_amp[amp-license]['+plugin_id+'][license]"]').val();
439
- if(license==""){
440
- var newlicense = $('#redux_builder_amp_amp-license_'+plugin_id+'_license').val();
441
- if(newlicense!=''){
442
- license = newlicense;
443
- $('input[name="redux_builder_amp[amp-license]['+plugin_id+'][license]"]').val(license);
444
- }
445
  }
 
446
  var item_name = $('input[name="redux_builder_amp[amp-license]['+plugin_id+'][item_name]"]').val();
447
  var store_url = $('input[name="redux_builder_amp[amp-license]['+plugin_id+'][store_url]"]').val();
448
  var plugin_active_path = $('input[name="redux_builder_amp[amp-license]['+plugin_id+'][plugin_active_path]"]').val();
433
  //reduxOptionTab();
434
 
435
  $(".redux-ampforwp-ext-activate").click(function(){
436
+ var currentThis = $(this);
437
  var plugin_id = currentThis.attr("id");
438
+ var newlicense = $('#redux_builder_amp_amp-license_'+plugin_id+'_license').val();
439
  var license = $('input[name="redux_builder_amp[amp-license]['+plugin_id+'][license]"]').val();
440
+
441
+ if(newlicense!='' && newlicense.indexOf("**")<0){
442
+ license = newlicense;
443
+ $('input[name="redux_builder_amp[amp-license]['+plugin_id+'][license]"]').val(license);
 
 
444
  }
445
+
446
  var item_name = $('input[name="redux_builder_amp[amp-license]['+plugin_id+'][item_name]"]').val();
447
  var store_url = $('input[name="redux_builder_amp[amp-license]['+plugin_id+'][store_url]"]').val();
448
  var plugin_active_path = $('input[name="redux_builder_amp[amp-license]['+plugin_id+'][plugin_active_path]"]').val();
includes/thirdparty-compatibility.php CHANGED
@@ -384,7 +384,6 @@ if(!function_exists('ampforwp_isexternal')){
384
  if(!function_exists('ampforwp_findInternalUrl')){
385
  function ampforwp_findInternalUrl($url){
386
  global $redux_builder_amp;
387
-
388
  if(isset($redux_builder_amp['convert-internal-nonamplinks-to-amp']) && ! $redux_builder_amp['convert-internal-nonamplinks-to-amp']){
389
  return $url;
390
  }
@@ -410,7 +409,16 @@ if(!function_exists('ampforwp_findInternalUrl')){
410
  $url = explode("#",$url);
411
  $url = trailingslashit($url[0]).user_trailingslashit(AMPFORWP_AMP_QUERY_VAR).'#'.$url[1];
412
  }else{
413
- $url = trailingslashit($url).user_trailingslashit(AMPFORWP_AMP_QUERY_VAR);
 
 
 
 
 
 
 
 
 
414
  }
415
  return $url;
416
  }
384
  if(!function_exists('ampforwp_findInternalUrl')){
385
  function ampforwp_findInternalUrl($url){
386
  global $redux_builder_amp;
 
387
  if(isset($redux_builder_amp['convert-internal-nonamplinks-to-amp']) && ! $redux_builder_amp['convert-internal-nonamplinks-to-amp']){
388
  return $url;
389
  }
409
  $url = explode("#",$url);
410
  $url = trailingslashit($url[0]).user_trailingslashit(AMPFORWP_AMP_QUERY_VAR).'#'.$url[1];
411
  }else{
412
+ if ( get_option('permalink_structure') ) {
413
+ if ( strpos($url, "?") && strpos($url, "=") ){
414
+ $url = explode('?', $url);
415
+ $url = ampforwp_url_controller($url[0]).'?'.$url[1];
416
+ }
417
+ else
418
+ $url = ampforwp_url_controller($url);
419
+ }
420
+ else
421
+ $url = add_query_arg( 'amp', '1', $url );
422
  }
423
  return $url;
424
  }
pagebuilder/inc/viewShowFrontData.php CHANGED
@@ -8,7 +8,6 @@ function amp_pagebuilder_content(){
8
  global $post, $redux_builder_amp;
9
 
10
  $postId = (is_object($post) ? $post->ID : '');
11
- if( empty( $postId ) ) return;
12
 
13
  if( ampforwp_is_front_page() ){
14
  $postId = ampforwp_get_frontpage_id();
@@ -19,6 +18,7 @@ function amp_pagebuilder_content(){
19
  $postId = pll_get_post($front_page_id);
20
  }
21
  }
 
22
  $ampforwp_pagebuilder_enable = get_post_meta($postId,'ampforwp_page_builder_enable', true);
23
 
24
  if (ampforwp_empty_content(get_post($postId)->post_content) && $ampforwp_pagebuilder_enable=='yes') {
8
  global $post, $redux_builder_amp;
9
 
10
  $postId = (is_object($post) ? $post->ID : '');
 
11
 
12
  if( ampforwp_is_front_page() ){
13
  $postId = ampforwp_get_frontpage_id();
18
  $postId = pll_get_post($front_page_id);
19
  }
20
  }
21
+ if( empty( $postId ) ) return;
22
  $ampforwp_pagebuilder_enable = get_post_meta($postId,'ampforwp_page_builder_enable', true);
23
 
24
  if (ampforwp_empty_content(get_post($postId)->post_content) && $ampforwp_pagebuilder_enable=='yes') {
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: 4.9.5
7
- Stable tag: 0.9.97.6
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -183,9 +183,16 @@ You can contact us from [here](https://ampforwp.com/contact/)
183
 
184
  == Changelog ==
185
 
 
 
 
 
 
 
 
186
  = 0.9.97.6 (14th July 2018) =
187
  * Fixed: Error and Warning on Structured Data for Logo. #2360
188
- * Fixed: Category Bilk tool breaking meta boxes #2335
189
 
190
  = 0.9.97.5 (11th July 2018) =
191
  * Fixed: Title disappearing in Design 1,2,3 when legacy pagebuilder is enabled #2341
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 4.9.5
7
+ Stable tag: 0.9.97.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
183
 
184
  == Changelog ==
185
 
186
+ = 0.9.97.7 (18th July 2018) =
187
+ * Fixed: PageBuilder not loading on frontpage #2360
188
+ * Fixed: 500 error on somepages due to open wp_query by other plugins
189
+ * Fixed: License key reupdating #2261
190
+ * Fixed: AMP renders with ?q after the /amp #2361
191
+
192
+
193
  = 0.9.97.6 (14th July 2018) =
194
  * Fixed: Error and Warning on Structured Data for Logo. #2360
195
+ * Fixed: Category Bulk tool breaking meta boxes #2335
196
 
197
  = 0.9.97.5 (11th July 2018) =
198
  * Fixed: Title disappearing in Design 1,2,3 when legacy pagebuilder is enabled #2341
templates/features.php CHANGED
@@ -4539,51 +4539,44 @@ function ampforwp_posts_to_remove () {
4539
  $post_id_array = array();
4540
  $current_cats_ids = array();
4541
  if(isset($redux_builder_amp['hide-amp-categories'])){
4542
- $get_categories_from_checkbox = $redux_builder_amp['hide-amp-categories'];
4543
- }
4544
- if($get_categories_from_checkbox){
4545
- $get_selected_cats = array_filter($get_categories_from_checkbox);
4546
- foreach ($get_selected_cats as $key => $value) {
4547
- $selected_cats[] = $key;
4548
- }
 
 
 
 
 
 
 
 
 
4549
  }
4550
-
4551
- $current_cats = get_the_category(get_the_ID());
4552
- foreach ($current_cats as $key => $cats) {
4553
- $current_cats_ids[] =$cats->cat_ID;
 
 
 
 
 
 
 
 
4554
  }
4555
- if( count(array_intersect($selected_cats,$current_cats_ids))>0 ){
4556
- return true;
4557
- }
4558
  return false;
4559
-
4560
- /* $new_selected_cats = implode(',' , $selected_cats);
4561
- if(!empty($get_selected_cats)){
4562
- $the_query = new WP_Query(
4563
- array(
4564
- 'ignore_sticky_posts' => 1,
4565
- 'posts_per_page' => -1,
4566
- 'cat' => $new_selected_cats ,
4567
- 'post_type' => 'post',
4568
- 'post_status' => 'publish',
4569
- )
4570
- );
4571
- // Get the IDs of posts
4572
- if ( $the_query->have_posts() ) {
4573
- while ( $the_query->have_posts() ) {
4574
- $the_query->the_post();
4575
- $post_id_array[] = get_the_ID();
4576
- }
4577
- }
4578
- }
4579
- wp_reset_postdata();
4580
- return $post_id_array;*/
4581
  }
4582
 
4583
  add_filter( 'amp_skip_post', 'ampforwp_cat_specific_skip_amp_post', 10, 3 );
4584
  function ampforwp_cat_specific_skip_amp_post( $skip, $post_id, $post ) {
4585
  $skip_this_post = '';
4586
  $skip_this_post = ampforwp_posts_to_remove();
 
4587
  if ( $skip_this_post ) {
4588
  $skip = true;
4589
  remove_action( 'wp_head', 'ampforwp_home_archive_rel_canonical', 1 );
@@ -5826,6 +5819,7 @@ function ampforwp_url_purifier($url){
5826
  $endpointq = "";
5827
  $queried_var = "";
5828
  $quried_value = "";
 
5829
  $endpoint = AMPFORWP_AMP_QUERY_VAR;
5830
  $get_permalink_structure = get_option('permalink_structure');
5831
  $checker = $redux_builder_amp['amp-core-end-point'];
@@ -5894,7 +5888,8 @@ function ampforwp_url_purifier($url){
5894
  }
5895
  }
5896
  if ( is_singular() && !empty($_SERVER['QUERY_STRING']) ) {
5897
- $url = add_query_arg( $_SERVER['QUERY_STRING'], '', $url);
 
5898
  }
5899
  return $url;
5900
  }
4539
  $post_id_array = array();
4540
  $current_cats_ids = array();
4541
  if(isset($redux_builder_amp['hide-amp-categories'])){
4542
+ $get_categories_from_checkbox = $redux_builder_amp['hide-amp-categories'];
4543
+ if($get_categories_from_checkbox){
4544
+ $get_selected_cats = array_filter($get_categories_from_checkbox);
4545
+ foreach ($get_selected_cats as $key => $value) {
4546
+ $selected_cats[] = $key;
4547
+ }
4548
+ }
4549
+ $current_cats = get_the_category(get_the_ID());
4550
+ if ( $current_cats ) {
4551
+ foreach ($current_cats as $key => $cats) {
4552
+ $current_cats_ids[] =$cats->cat_ID;
4553
+ }
4554
+ }
4555
+ if( count(array_intersect($selected_cats,$current_cats_ids))>0 ){
4556
+ return true;
4557
+ }
4558
  }
4559
+ if( is_array($redux_builder_amp['hide-amp-tags-bulk-option']) ) {
4560
+ $get_tags_checkbox = array_keys(array_filter($redux_builder_amp['hide-amp-tags-bulk-option']));
4561
+ $all_tags = get_the_tags(get_the_ID());
4562
+ $tagsOnPost = array();
4563
+ if ( $all_tags ) {
4564
+ foreach ($all_tags as $tagskey => $tagsvalue) {
4565
+ $tagsOnPost[] = $tagsvalue->term_id;
4566
+ }
4567
+ }
4568
+ if( count(array_intersect($get_tags_checkbox,$tagsOnPost))>0 ){
4569
+ return true;
4570
+ }
4571
  }
 
 
 
4572
  return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4573
  }
4574
 
4575
  add_filter( 'amp_skip_post', 'ampforwp_cat_specific_skip_amp_post', 10, 3 );
4576
  function ampforwp_cat_specific_skip_amp_post( $skip, $post_id, $post ) {
4577
  $skip_this_post = '';
4578
  $skip_this_post = ampforwp_posts_to_remove();
4579
+ wp_reset_postdata();
4580
  if ( $skip_this_post ) {
4581
  $skip = true;
4582
  remove_action( 'wp_head', 'ampforwp_home_archive_rel_canonical', 1 );
5819
  $endpointq = "";
5820
  $queried_var = "";
5821
  $quried_value = "";
5822
+ $query_arg = "";
5823
  $endpoint = AMPFORWP_AMP_QUERY_VAR;
5824
  $get_permalink_structure = get_option('permalink_structure');
5825
  $checker = $redux_builder_amp['amp-core-end-point'];
5888
  }
5889
  }
5890
  if ( is_singular() && !empty($_SERVER['QUERY_STRING']) ) {
5891
+ $query_arg = wp_parse_args($_SERVER['QUERY_STRING']);
5892
+ $url = add_query_arg( $query_arg, $url);
5893
  }
5894
  return $url;
5895
  }