AMP for WP – Accelerated Mobile Pages - Version 0.9.37.5

Version Description

Download this release

Release Info

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

Code changes from version 0.9.37 to 0.9.37.5

accelerated-moblie-pages.php CHANGED
@@ -3,9 +3,9 @@
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.37
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
- Author URI: http://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/5
10
  License: GPL2
11
  */
@@ -17,7 +17,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
17
  function ampforwp_add_custom_post_support() {
18
  global $redux_builder_amp;
19
  if( $redux_builder_amp['amp-on-off-for-all-pages'] ) {
20
- add_rewrite_endpoint( AMP_QUERY_VAR, EP_PERMALINK | EP_PAGES | EP_ROOT | EP_ALL );
21
  add_post_type_support( 'page', AMP_QUERY_VAR );
22
  }
23
  }
@@ -25,7 +25,7 @@ add_action( 'init', 'ampforwp_add_custom_post_support',11);
25
 
26
  define('AMPFORWP_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
27
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
28
- define('AMPFORWP_VERSION','0.9.37');
29
 
30
  // Redux panel inclusion code
31
  if ( !class_exists( 'ReduxFramework' ) ) {
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.37.5
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
+ Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/5
10
  License: GPL2
11
  */
17
  function ampforwp_add_custom_post_support() {
18
  global $redux_builder_amp;
19
  if( $redux_builder_amp['amp-on-off-for-all-pages'] ) {
20
+ add_rewrite_endpoint( AMP_QUERY_VAR, EP_PERMALINK | EP_PAGES | EP_ROOT | EP_ALL_ARCHIVES | EP_CATEGORIES | EP_TAGS | EP_AUTHORS | EP_SEARCH );
21
  add_post_type_support( 'page', AMP_QUERY_VAR );
22
  }
23
  }
25
 
26
  define('AMPFORWP_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
27
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
28
+ define('AMPFORWP_VERSION','0.9.37.5');
29
 
30
  // Redux panel inclusion code
31
  if ( !class_exists( 'ReduxFramework' ) ) {
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: mohammed_kaludi, ahmedkaludi, ampforwp
3
  Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin
4
  Donate link: https://www.paypal.me/Kaludi/5
5
  Requires at least: 3.0
6
- Tested up to: 4.7
7
- Stable tag: 0.9.37
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
3
  Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google, plugin
4
  Donate link: https://www.paypal.me/Kaludi/5
5
  Requires at least: 3.0
6
+ Tested up to: 4.7.2
7
+ Stable tag: 0.9.37.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
templates/custom-amp-content.php CHANGED
@@ -10,7 +10,6 @@ function ampforwp_custom_post_content_sanitizer( $data, $post ) {
10
  return $data;
11
  }
12
 
13
- global $post;
14
  $amp_custom_post_content_input = get_post_meta($post->ID, 'ampforwp_custom_content_editor', true);
15
  $amp_custom_post_content_check = get_post_meta($post->ID, 'ampforwp_custom_content_editor_checkbox', true);
16
 
10
  return $data;
11
  }
12
 
 
13
  $amp_custom_post_content_input = get_post_meta($post->ID, 'ampforwp_custom_content_editor', true);
14
  $amp_custom_post_content_check = get_post_meta($post->ID, 'ampforwp_custom_content_editor_checkbox', true);
15
 
templates/design-manager/design-1/archive.php CHANGED
@@ -10,6 +10,7 @@ if ( is_home() || is_front_page() || is_archive() ){
10
  global $wp;
11
  $current_archive_url = home_url( $wp->request );
12
  $amp_url = trailingslashit($current_archive_url);
 
13
  } ?>
14
  <link rel="canonical" href="<?php echo $amp_url ?>">
15
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
@@ -32,7 +33,7 @@ if ( is_home() || is_front_page() || is_archive() ){
32
  the_archive_title( '<h3 class="page-title">', '</h3>' );
33
  the_archive_description( '<div class="taxonomy-description">', '</div>' );
34
  } ?>
35
-
36
  <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
37
  <div class="amp-wp-content amp-wp-article-header amp-loop-list">
38
 
@@ -41,11 +42,7 @@ if ( is_home() || is_front_page() || is_archive() ){
41
  <a href="<?php echo trailingslashit($ampforwp_post_url) . AMP_QUERY_VAR ;?>"><?php the_title() ?></a>
42
  </h1>
43
 
44
- <div class="amp-wp-content-loop">
45
- <div class="amp-wp-meta">
46
- <?php $this->load_parts( apply_filters( 'amp_post_template_meta_parts', array( 'meta-author', 'meta-time' ) ) ); ?>
47
- </div>
48
-
49
 
50
  <?php if ( has_post_thumbnail() ) { ?>
51
  <?php
10
  global $wp;
11
  $current_archive_url = home_url( $wp->request );
12
  $amp_url = trailingslashit($current_archive_url);
13
+ $amp_url = dirname($amp_url);
14
  } ?>
15
  <link rel="canonical" href="<?php echo $amp_url ?>">
16
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
33
  the_archive_title( '<h3 class="page-title">', '</h3>' );
34
  the_archive_description( '<div class="taxonomy-description">', '</div>' );
35
  } ?>
36
+
37
  <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
38
  <div class="amp-wp-content amp-wp-article-header amp-loop-list">
39
 
42
  <a href="<?php echo trailingslashit($ampforwp_post_url) . AMP_QUERY_VAR ;?>"><?php the_title() ?></a>
43
  </h1>
44
 
45
+ <div class="amp-wp-content-loop">
 
 
 
 
46
 
47
  <?php if ( has_post_thumbnail() ) { ?>
48
  <?php
templates/design-manager/design-1/index.php CHANGED
@@ -4,13 +4,12 @@
4
  <head>
5
  <meta charset="utf-8">
6
  <link rel="dns-prefetch" href="https://cdn.ampproject.org">
7
- <?php
8
- global $redux_builder_amp;
9
- if ( is_home() || is_front_page() || ( is_archive() && $redux_builder_amp['ampforwp-archive-support'] ) ){
10
- global $wp;
11
- $current_archive_url = home_url( $wp->request );
12
- $amp_url = trailingslashit($current_archive_url);
13
- } ?>
14
  <link rel="canonical" href="<?php echo $amp_url ?>">
15
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
16
  <?php do_action( 'amp_post_template_head', $this ); ?>
4
  <head>
5
  <meta charset="utf-8">
6
  <link rel="dns-prefetch" href="https://cdn.ampproject.org">
7
+ <?php global $redux_builder_amp;
8
+ if ( is_home() || is_front_page() || ( is_archive() && $redux_builder_amp['ampforwp-archive-support'] ) ){
9
+ global $wp;
10
+ $current_archive_url = home_url( $wp->request );
11
+ $amp_url = trailingslashit($current_archive_url);
12
+ } ?>
 
13
  <link rel="canonical" href="<?php echo $amp_url ?>">
14
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
15
  <?php do_action( 'amp_post_template_head', $this ); ?>
templates/design-manager/design-2/archive.php CHANGED
@@ -10,6 +10,7 @@
10
  global $wp;
11
  $current_archive_url = home_url( $wp->request );
12
  $amp_url = trailingslashit($current_archive_url);
 
13
  } ?>
14
  <link rel="canonical" href="<?php echo $amp_url ?>">
15
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
@@ -29,11 +30,11 @@
29
 
30
  <?php if ( is_archive() ) { ?>
31
  <div class="amp-wp-content amp-archive-heading">
32
- <?php
33
  the_archive_title( '<h3 class="page-title">', '</h3>' );
34
  the_archive_description( '<div class="taxonomy-description">', '</div>' ); ?>
35
  </div>
36
- <?php
37
  } ?>
38
 
39
  <?php if ( have_posts() ) : while ( have_posts() ) : the_post();
10
  global $wp;
11
  $current_archive_url = home_url( $wp->request );
12
  $amp_url = trailingslashit($current_archive_url);
13
+ $amp_url = dirname($amp_url);
14
  } ?>
15
  <link rel="canonical" href="<?php echo $amp_url ?>">
16
  <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
30
 
31
  <?php if ( is_archive() ) { ?>
32
  <div class="amp-wp-content amp-archive-heading">
33
+ <?php
34
  the_archive_title( '<h3 class="page-title">', '</h3>' );
35
  the_archive_description( '<div class="taxonomy-description">', '</div>' ); ?>
36
  </div>
37
+ <?php
38
  } ?>
39
 
40
  <?php if ( have_posts() ) : while ( have_posts() ) : the_post();
templates/features.php CHANGED
@@ -136,15 +136,11 @@
136
  // Custom Homepage and Archive file
137
 
138
  global $redux_builder_amp;
139
-
140
  if($redux_builder_amp['amp-frontpage-select-option'] == 0) {
141
- if ( is_home() || ( is_archive() && $redux_builder_amp['ampforwp-archive-support'] ) ) {
142
  if ( 'single' === $type ) {
143
- if(is_archive()){
144
- $file = AMPFORWP_PLUGIN_DIR . '/templates/design-manager/design-'. ampforwp_design_selector() .'/archive.php';
145
- }else {
146
- $file = AMPFORWP_PLUGIN_DIR . '/templates/design-manager/design-'. ampforwp_design_selector() .'/index.php';
147
- }
148
  }
149
  }
150
  } elseif ($redux_builder_amp['amp-frontpage-select-option'] == 1) {
@@ -155,6 +151,13 @@
155
  }
156
 
157
  }
 
 
 
 
 
 
 
158
  // Custom Single file
159
  if ( is_single() || is_page() ) {
160
 
@@ -182,7 +185,7 @@
182
  }
183
  return $file;
184
  }
185
-
186
  // 4. Custom Header files
187
  add_filter( 'amp_post_template_file', 'ampforwp_custom_header', 10, 3 );
188
  function ampforwp_custom_header( $file, $type, $post ) {
@@ -996,6 +999,7 @@ function ampforwp_remove_title_tags(){
996
  $ampforwp_is_amp_endpoint = ampforwp_is_amp_endpoint();
997
  if ( $ampforwp_is_amp_endpoint ) {
998
  $content_buffer = preg_replace("/' defer='defer/", "", $content_buffer);
 
999
  $content_buffer = preg_replace("/onclick=[^>]*/", "", $content_buffer);
1000
  $content_buffer = preg_replace("/<\\/?thrive_headline(.|\\s)*?>/",'',$content_buffer);
1001
  // Remove Extra styling added by other Themes/ Plugins
@@ -1004,7 +1008,6 @@ function ampforwp_remove_title_tags(){
1004
  $content_buffer = preg_replace("/<\\/?g(.|\\s)*?>/",'',$content_buffer);
1005
  $content_buffer = preg_replace('/(<[^>]+) spellcheck="false"/', '$1', $content_buffer);
1006
  $content_buffer = preg_replace('/(<[^>]+) spellcheck="true"/', '$1', $content_buffer);
1007
- $content_buffer = preg_replace('/ defer onload=\'/', '', $content_buffer);
1008
  //$content_buffer = preg_replace('/<style type=(.*?)>|\[.*?\]\s\{(.*)\}|<\/style>(?!(<\/noscript>)|(\n<\/head>)|(<noscript>))/','',$content_buffer);
1009
 
1010
  }
136
  // Custom Homepage and Archive file
137
 
138
  global $redux_builder_amp;
139
+ // Homepage and FrontPage
140
  if($redux_builder_amp['amp-frontpage-select-option'] == 0) {
141
+ if ( is_home() ) {
142
  if ( 'single' === $type ) {
143
+ $file = AMPFORWP_PLUGIN_DIR . '/templates/design-manager/design-'. ampforwp_design_selector() .'/index.php';
 
 
 
 
144
  }
145
  }
146
  } elseif ($redux_builder_amp['amp-frontpage-select-option'] == 1) {
151
  }
152
 
153
  }
154
+
155
+ // Archive Pages
156
+ if ( is_archive() && $redux_builder_amp['ampforwp-archive-support'] ) {
157
+
158
+ $file = AMPFORWP_PLUGIN_DIR . '/templates/design-manager/design-'. ampforwp_design_selector() .'/archive.php';
159
+ }
160
+
161
  // Custom Single file
162
  if ( is_single() || is_page() ) {
163
 
185
  }
186
  return $file;
187
  }
188
+
189
  // 4. Custom Header files
190
  add_filter( 'amp_post_template_file', 'ampforwp_custom_header', 10, 3 );
191
  function ampforwp_custom_header( $file, $type, $post ) {
999
  $ampforwp_is_amp_endpoint = ampforwp_is_amp_endpoint();
1000
  if ( $ampforwp_is_amp_endpoint ) {
1001
  $content_buffer = preg_replace("/' defer='defer/", "", $content_buffer);
1002
+ $content_buffer = preg_replace("/' defer onload='/", "", $content_buffer);
1003
  $content_buffer = preg_replace("/onclick=[^>]*/", "", $content_buffer);
1004
  $content_buffer = preg_replace("/<\\/?thrive_headline(.|\\s)*?>/",'',$content_buffer);
1005
  // Remove Extra styling added by other Themes/ Plugins
1008
  $content_buffer = preg_replace("/<\\/?g(.|\\s)*?>/",'',$content_buffer);
1009
  $content_buffer = preg_replace('/(<[^>]+) spellcheck="false"/', '$1', $content_buffer);
1010
  $content_buffer = preg_replace('/(<[^>]+) spellcheck="true"/', '$1', $content_buffer);
 
1011
  //$content_buffer = preg_replace('/<style type=(.*?)>|\[.*?\]\s\{(.*)\}|<\/style>(?!(<\/noscript>)|(\n<\/head>)|(<noscript>))/','',$content_buffer);
1012
 
1013
  }