AMP for WP – Accelerated Mobile Pages - Version 0.7.1

Version Description

  • Bug #24 (Github) fixed
  • Strip Style tags for faster & better validation
  • Bug #21 (Github) fixed
Download this release

Release Info

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

Code changes from version 0.7 to 0.7.1

README.md CHANGED
@@ -6,8 +6,8 @@ https://wordpress.org/plugins/accelerated-mobile-pages/
6
  Contributors: mohammed_kaludi, ahmedkaludi
7
  Tags: accelerated mobile pages, amp, mobile, amp project, google amp, amp wp
8
  Requires at least: 3.0
9
- Tested up to: 4.5.2
10
- Stable tag: 0.7
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
@@ -30,7 +30,7 @@ Automatically add Accelerated Mobile Pages (Google AMP Project) functionality on
30
  * Separate WordPress Menu for AMP version
31
 
32
 
33
- **NOTE: Next Update of this plugin will be released on 4 August 2016.** [Here is the list of things](https://goo.gl/jDTPyg) that will be updated in the next update
34
 
35
 
36
  **How to test if AMP is working or not?**
@@ -111,4 +111,13 @@ Please check if you have "Pretty Permalinks" enabled. If not then activate it. F
111
  * Improved Navigation Menu, Search Console errors fixed, Social Sharing option, Pages support, Force redirection for mobile users removed and many other bug fixes
112
 
113
  = 0.7 =
114
- * Canonical Improved, Navigation Validation bug fixed, Two more validation bugs fixed ('role' and 'tabindex' attribute), Featured image automatically hides if it is not present, Validation issues in the images of the post's the_content
 
 
 
 
 
 
 
 
 
6
  Contributors: mohammed_kaludi, ahmedkaludi
7
  Tags: accelerated mobile pages, amp, mobile, amp project, google amp, amp wp
8
  Requires at least: 3.0
9
+ Tested up to: 4.5.3
10
+ Stable tag: 0.7.1
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
30
  * Separate WordPress Menu for AMP version
31
 
32
 
33
+ **NOTE: Next Big Update of this plugin will be released on 7th September 2016.
34
 
35
 
36
  **How to test if AMP is working or not?**
111
  * Improved Navigation Menu, Search Console errors fixed, Social Sharing option, Pages support, Force redirection for mobile users removed and many other bug fixes
112
 
113
  = 0.7 =
114
+ * Canonical Improved
115
+ * Navigation Validation bug fixed
116
+ * Two more validation bugs fixed ('role' and 'tabindex' attribute)
117
+ * Featured image automatically hides if it is not present
118
+ * Validation issues in the images of the post's the_content
119
+
120
+ = 0.7.1 =
121
+ * Bug #24 (Github) fixed
122
+ * Strip Style tags for faster & better validation
123
+ * Bug #21 (Github) fixed
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: Accelerated Mobile Pages for WordPress
6
- Version: 0.7
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: http://AhmedKaludi.com/
9
  License: GPL2
@@ -35,8 +35,10 @@ if ( class_exists( 'Ampwp_core' ) ) {
35
  * Add "amphtml" in the main theme to target it to the AMP page
36
  */
37
 
38
- function add_rel_info() { ?>
39
- <link rel="amphtml" href="<?php the_permalink(); ?>/?amp" />
 
 
40
  <?php }
41
  add_action( 'wp_head', 'add_rel_info' );
42
 
3
  Plugin Name: Accelerated Mobile Pages
4
  Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/
5
  Description: Accelerated Mobile Pages for WordPress
6
+ Version: 0.7.1
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: http://AhmedKaludi.com/
9
  License: GPL2
35
  * Add "amphtml" in the main theme to target it to the AMP page
36
  */
37
 
38
+ function add_rel_info() {
39
+ $amp_url = trailingslashit( get_permalink() );
40
+ ?>
41
+ <link rel="amphtml" href="<?php echo $amp_url; ?>?amp" />
42
  <?php }
43
  add_action( 'wp_head', 'add_rel_info' );
44
 
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: mohammed_kaludi, ahmedkaludi
3
  Tags: accelerated mobile pages, amp, mobile, amp project, google amp, amp wp
4
  Requires at least: 3.0
5
- Tested up to: 4.5.2
6
- Stable tag: 0.7
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -26,7 +26,7 @@ Automatically add Accelerated Mobile Pages (Google AMP Project) functionality on
26
  * Separate WordPress Menu for AMP version
27
 
28
 
29
- **NOTE: Next Update of this plugin will be released on 4 August 2016.** [Here is the list of things](https://goo.gl/jDTPyg) that will be updated in the next update
30
 
31
 
32
  **How to test if AMP is working or not?**
@@ -115,4 +115,9 @@ Please check if you have "Pretty Permalinks" enabled. If not then activate it. F
115
  * Navigation Validation bug fixed
116
  * Two more validation bugs fixed ('role' and 'tabindex' attribute)
117
  * Featured image automatically hides if it is not present
118
- * Validation issues in the images of the post's the_content
 
 
 
 
 
2
  Contributors: mohammed_kaludi, ahmedkaludi
3
  Tags: accelerated mobile pages, amp, mobile, amp project, google amp, amp wp
4
  Requires at least: 3.0
5
+ Tested up to: 4.5.3
6
+ Stable tag: 0.7.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
26
  * Separate WordPress Menu for AMP version
27
 
28
 
29
+ **NOTE: Next Big Update of this plugin will be released on 7th September 2016.
30
 
31
 
32
  **How to test if AMP is working or not?**
115
  * Navigation Validation bug fixed
116
  * Two more validation bugs fixed ('role' and 'tabindex' attribute)
117
  * Featured image automatically hides if it is not present
118
+ * Validation issues in the images of the post's the_content
119
+
120
+ = 0.7.1 =
121
+ * Bug #24 (Github) fixed
122
+ * Strip Style tags for faster & better validation
123
+ * Bug #21 (Github) fixed
themes/default/functions.php CHANGED
@@ -368,8 +368,20 @@ function amp_image_tag($content) {
368
  $content = strtr($content, $replace);
369
  return $content;
370
  }
371
-
372
  add_filter('the_content','amp_image_tag');
373
 
374
 
 
 
 
 
 
 
 
 
 
 
 
 
 
375
  ?>
368
  $content = strtr($content, $replace);
369
  return $content;
370
  }
 
371
  add_filter('the_content','amp_image_tag');
372
 
373
 
374
+ // Strip the styles
375
+ add_filter( 'the_content', 'the_content_filter', 20 );
376
+ function the_content_filter( $content ) {
377
+ $content = preg_replace('#<p.*?>(.*?)</p>#i', '<p>\1</p>', $content);
378
+ $content = preg_replace('#<span.*?>(.*?)</span>#i', '<span>\1</span>', $content);
379
+ $content = preg_replace('#<ol.*?>(.*?)</ol>#i', '<ol>\1</ol>', $content);
380
+ $content = preg_replace('#<ul.*?>(.*?)</ul>#i', '<ul>\1</ul>', $content);
381
+ $content = preg_replace('#<li.*?>(.*?)</li>#i', '<li>\1</li>', $content);
382
+ $content = preg_replace('#<div.*?>(.*?)</div>#i', '<div>\1</div>', $content);
383
+ $content = preg_replace('#<td.*?>(.*?)</td>#i', '<td>\1</td>', $content);
384
+ $content = preg_replace('#<a style=".*?" href="(.*?)">(.*?)</a>#i', '<a href="\1">\1</a>', $content);
385
+ return $content;
386
+ }
387
  ?>
themes/default/index.php CHANGED
@@ -18,14 +18,14 @@
18
  <?php if ( have_posts() ): while ( have_posts() ): the_post(); ?>
19
 
20
  <div class="post">
21
- <?php
22
- $thumb_id = get_post_thumbnail_id();
23
- $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumbnail', true);
24
- $thumb_url = $thumb_url_array[0];
25
- ?>
26
-
27
- <?php if ( has_post_thumbnail() ) { ?><div class="post_image"><a href="<?php the_permalink(); ?>"><amp-img src=<?php echo $thumb_url ?> width=100 height=75></amp-img></a></div><?php } ?>
28
-
29
 
30
  <h2 class="title"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" accesskey="<?php echo $access_key; $access_key++; ?>"><?php the_title(); ?></a></h2>
31
  <?php $content = get_the_content();?>
18
  <?php if ( have_posts() ): while ( have_posts() ): the_post(); ?>
19
 
20
  <div class="post">
21
+ <?php if ( has_post_thumbnail() ) { ?>
22
+ <?php
23
+ $thumb_id = get_post_thumbnail_id();
24
+ $thumb_url_array = wp_get_attachment_image_src($thumb_id, 'thumbnail', true);
25
+ $thumb_url = $thumb_url_array[0];
26
+ ?>
27
+ <div class="post_image"><a href="<?php the_permalink(); ?>"><amp-img src=<?php echo $thumb_url ?> width=100 height=75></amp-img></a></div>
28
+ <?php } ?>
29
 
30
  <h2 class="title"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" accesskey="<?php echo $access_key; $access_key++; ?>"><?php the_title(); ?></a></h2>
31
  <?php $content = get_the_content();?>