AMP for WP – Accelerated Mobile Pages - Version 0.8.5.1

Version Description

  • Proper Details at http://ampforwp.com/new/
  • Validation issue fixed: 'Value' tag
  • Validation issue fixed: The attribute 'contenteditable' may not appear in tag 'a'.
  • Validation issue fixed: Table markup
  • Validation issue fixed: nowrap and misc tags
  • New Relic Support
  • Tags on off option
  • Canonical and correct AMP html Redirect issues Solved
  • NextGEN Gallery Validation Support Added
Download this release

Release Info

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

Code changes from version 0.8.5 to 0.8.5.1

README.md CHANGED
@@ -6,7 +6,7 @@ Contributors: mohammed_kaludi, ahmedkaludi
6
  Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google
7
  Requires at least: 3.0
8
  Tested up to: 4.6.1
9
- Stable tag: 0.8.5
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
@@ -112,6 +112,17 @@ Please check if you have "Pretty Permalinks" enabled. If not then activate it. F
112
 
113
 
114
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
115
  = 0.8.5 =
116
  * Proper Details at http://ampforwp.com/the-0-4-compatibility/
117
  * AMP 0.4 Compatibility Check
6
  Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google
7
  Requires at least: 3.0
8
  Tested up to: 4.6.1
9
+ Stable tag: 0.8.5.1
10
  License: GPLv2 or later
11
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
12
 
112
 
113
 
114
  == Changelog ==
115
+ = 0.8.5.1 =
116
+ * Proper Details at http://ampforwp.com/new/
117
+ * Validation issue fixed: 'Value' tag
118
+ * Validation issue fixed: The attribute 'contenteditable' may not appear in tag 'a'.
119
+ * Validation issue fixed: Table markup
120
+ * Validation issue fixed: nowrap and misc tags
121
+ * New Relic Support
122
+ * Tags on off option
123
+ * Canonical and correct AMP html Redirect issues Solved
124
+ * NextGEN Gallery Validation Support Added
125
+
126
  = 0.8.5 =
127
  * Proper Details at http://ampforwp.com/the-0-4-compatibility/
128
  * AMP 0.4 Compatibility Check
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 Toolbox - Accelerated Mobile Pages for WordPress
6
- Version: 0.8.5
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: http://ampforwp.com/
9
  License: GPL2
3
  Plugin Name: Accelerated Mobile Pages
4
  Plugin URI: https://wordpress.org/plugins/accelerated-mobile-pages/
5
  Description: AMP Toolbox - Accelerated Mobile Pages for WordPress
6
+ Version: 0.8.5.1
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: http://ampforwp.com/
9
  License: GPL2
includes/options/options-init.php CHANGED
@@ -574,6 +574,16 @@
574
  'subtitle' => __('Enable Next / Previous in the single post', 'redux-framework-demo'),
575
  'true' => 'Enabled',
576
  'false' => 'Disabled',
 
 
 
 
 
 
 
 
 
 
577
  ),
578
  // Social Icons ON/OFF
579
  array(
574
  'subtitle' => __('Enable Next / Previous in the single post', 'redux-framework-demo'),
575
  'true' => 'Enabled',
576
  'false' => 'Disabled',
577
+ ),
578
+ // Tags ON/OFF
579
+ array(
580
+ 'id' => 'ampforwp-single-tags-on-off',
581
+ 'type' => 'switch',
582
+ 'title' => __('Tags', 'redux-framework-demo'),
583
+ 'default' => 1,
584
+ 'subtitle' => __('Enable / Disable Tags in the single post', 'redux-framework-demo'),
585
+ 'true' => 'Enabled',
586
+ 'false' => 'Disabled',
587
  ),
588
  // Social Icons ON/OFF
589
  array(
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: mohammed_kaludi, ahmedkaludi
3
  Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google
4
  Requires at least: 3.0
5
  Tested up to: 4.6.1
6
- Stable tag: 0.8.5
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -109,6 +109,17 @@ Please check if you have "Pretty Permalinks" enabled. If not then activate it. F
109
 
110
 
111
  == Changelog ==
 
 
 
 
 
 
 
 
 
 
 
112
  = 0.8.5 =
113
  * Proper Details at http://ampforwp.com/the-0-4-compatibility/
114
  * AMP 0.4 Compatibility Check
3
  Tags: AMP, accelerated mobile pages, mobile, amp project, google amp, amp wp, google
4
  Requires at least: 3.0
5
  Tested up to: 4.6.1
6
+ Stable tag: 0.8.5.1
7
  License: GPLv2 or later
8
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
9
 
109
 
110
 
111
  == Changelog ==
112
+ = 0.8.5.1 =
113
+ * Proper Details at http://ampforwp.com/new/
114
+ * Validation issue fixed: 'Value' tag
115
+ * Validation issue fixed: The attribute 'contenteditable' may not appear in tag 'a'.
116
+ * Validation issue fixed: Table markup
117
+ * Validation issue fixed: nowrap and misc tags
118
+ * New Relic Support
119
+ * Tags on off option
120
+ * Canonical and correct AMP html Redirect issues Solved
121
+ * NextGEN Gallery Validation Support Added
122
+
123
  = 0.8.5 =
124
  * Proper Details at http://ampforwp.com/the-0-4-compatibility/
125
  * AMP 0.4 Compatibility Check
templates/features.php CHANGED
@@ -15,8 +15,12 @@
15
  12. Add Logo URL in the structured metadata
16
  13. Add Custom Placeholder Image for Structured Data.
17
  14. Adds a meta box to the post editing screen for AMP on-off on specific pages.
 
 
 
 
 
18
  */
19
-
20
  // Adding AMP-related things to the main theme
21
  global $redux_builder_amp;
22
 
@@ -29,7 +33,7 @@
29
  }
30
 
31
  function ampforwp_add_endpoint_actions() {
32
- if ( is_home() || is_archive() ) {
33
 
34
  $is_amp_endpoint = is_amp_endpoint();
35
 
@@ -48,7 +52,13 @@
48
 
49
  if ( is_home() || is_front_page() ){
50
  $amp_url = home_url('/?amp');
51
- } else {
 
 
 
 
 
 
52
  $amp_url = trailingslashit( get_permalink().'amp' );
53
  }
54
 
@@ -368,12 +378,24 @@
368
  function ampforwp_the_content_filter( $content ) {
369
  $content = preg_replace('/property=[^>]*/', '', $content);
370
  $content = preg_replace('/vocab=[^>]*/', '', $content);
 
 
 
 
 
 
 
371
  $content = preg_replace('/style=[^>]*/', '', $content);
 
372
  $content = preg_replace('#<comments-count.*?>(.*?)</comments-count>#i', '', $content);
 
 
 
373
  $content = preg_replace('/href="javascript:void*/', ' ', $content);
374
  return $content;
375
  }
376
-
 
377
  // 12. Add Logo URL in the structured metadata
378
  add_filter( 'amp_post_template_metadata', 'ampforwp_update_metadata', 10, 2 );
379
  function ampforwp_update_metadata( $metadata, $post ) {
@@ -487,3 +509,77 @@ function ampforwp_hide_amp_for_specific_pages($input){
487
  }
488
  return $input;
489
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
15
  12. Add Logo URL in the structured metadata
16
  13. Add Custom Placeholder Image for Structured Data.
17
  14. Adds a meta box to the post editing screen for AMP on-off on specific pages.
18
+ 15. Disable New Relic's extra script that its adds in AMP pages.
19
+ 16. Remove Unwanted Scripts
20
+ 17. Archives Canonical in AMP version
21
+ 18. Custom Canonical for Homepage
22
+ 19. Remove Canonical tags
23
  */
 
24
  // Adding AMP-related things to the main theme
25
  global $redux_builder_amp;
26
 
33
  }
34
 
35
  function ampforwp_add_endpoint_actions() {
36
+ if ( is_home() || is_archive() ) {
37
 
38
  $is_amp_endpoint = is_amp_endpoint();
39
 
52
 
53
  if ( is_home() || is_front_page() ){
54
  $amp_url = home_url('/?amp');
55
+ }
56
+ elseif( is_archive()){
57
+ global $wp;
58
+ $archive_current_url = add_query_arg( '', '', home_url( $wp->request ) );
59
+ $amp_url = $archive_current_url . '/?amp';
60
+ }
61
+ else {
62
  $amp_url = trailingslashit( get_permalink().'amp' );
63
  }
64
 
378
  function ampforwp_the_content_filter( $content ) {
379
  $content = preg_replace('/property=[^>]*/', '', $content);
380
  $content = preg_replace('/vocab=[^>]*/', '', $content);
381
+ $content = preg_replace('/value=[^>]*/', '', $content);
382
+ $content = preg_replace('/contenteditable=[^>]*/', '', $content);
383
+ $content = preg_replace('/time=[^>]*/', '', $content);
384
+ $content = preg_replace('/non-refundable=[^>]*/', '', $content);
385
+ $content = preg_replace('/security=[^>]*/', '', $content);
386
+ $content = preg_replace('/deposit=[^>]*/', '', $content);
387
+ $content = preg_replace('/for=[^>]*/', '', $content);
388
  $content = preg_replace('/style=[^>]*/', '', $content);
389
+ $content = preg_replace('/nowrap="nowrap"/', '', $content);
390
  $content = preg_replace('#<comments-count.*?>(.*?)</comments-count>#i', '', $content);
391
+ $content = preg_replace('#<col.*?>#i', '', $content);
392
+ $content = preg_replace('#<table.*?>#i', '<table width="100%">', $content);
393
+ $content = preg_replace('#<style scoped.*?>(.*?)</style>#i', '', $content);
394
  $content = preg_replace('/href="javascript:void*/', ' ', $content);
395
  return $content;
396
  }
397
+
398
+
399
  // 12. Add Logo URL in the structured metadata
400
  add_filter( 'amp_post_template_metadata', 'ampforwp_update_metadata', 10, 2 );
401
  function ampforwp_update_metadata( $metadata, $post ) {
509
  }
510
  return $input;
511
  }
512
+
513
+ // 15. Disable New Relic's extra script that its adds in AMP pages.
514
+ add_action( 'amp_post_template_data', 'ampforwp_disable_new_relic_scripts' );
515
+ if ( ! function_exists('ampforwp_disable_new_relic_scripts') ) {
516
+ function ampforwp_disable_new_relic_scripts( $data ) {
517
+ if ( ! function_exists( 'newrelic_disable_autorum' ) ) {
518
+ return $data;
519
+ }
520
+ if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
521
+ newrelic_disable_autorum();
522
+ }
523
+ return $data;
524
+ }
525
+ }
526
+
527
+ // 16. Remove Unwanted Scripts
528
+ if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
529
+ add_action( 'wp_enqueue_scripts', 'ampforwp_remove_unwanted_scripts',20 );
530
+ }
531
+ function ampforwp_remove_unwanted_scripts() {
532
+ wp_dequeue_script('jquery');
533
+ }
534
+ // Remove Print Scripts and styles
535
+ function ampforwp_remove_print_scripts() {
536
+ if ( is_amp_endpoint() ) {
537
+
538
+ function ampforwp_remove_all_scripts() {
539
+ global $wp_scripts;
540
+ $wp_scripts->queue = array();
541
+ }
542
+ add_action('wp_print_scripts', 'ampforwp_remove_all_scripts', 100);
543
+ function ampforwp_remove_all_styles() {
544
+ global $wp_styles;
545
+ $wp_styles->queue = array();
546
+ }
547
+ add_action('wp_print_styles', 'ampforwp_remove_all_styles', 100);
548
+
549
+ // Remove Print Emoji for Nextgen Gallery support
550
+ remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
551
+ remove_action( 'wp_print_styles', 'print_emoji_styles' );
552
+
553
+ }
554
+ }
555
+ add_action( 'template_redirect', 'ampforwp_remove_print_scripts' );
556
+
557
+
558
+ // 17. Archives Canonical in AMP version
559
+ function ampforwp_rel_canonical_archive() {
560
+ if ( !is_archive() )
561
+ return;
562
+ global $wp;
563
+ $current_archive_url = home_url( $wp->request );
564
+ // $archivelink = esc_url( get_permalink( $id ) . AMP_QUERY_VAR . '/' );
565
+ echo "<link rel='canonical' href='$current_archive_url' />\n";
566
+ }
567
+ add_action( 'amp_post_template_head', 'ampforwp_rel_canonical_archive' );
568
+
569
+ // 18. Custom Canonical for Homepage
570
+ function ampforwp_rel_canonical() {
571
+ if ( !is_home() || !is_front_page() )
572
+ return;
573
+ // $link = esc_url( get_permalink( $id ) . AMP_QUERY_VAR . '/' );
574
+ $homelink = get_home_url();
575
+ echo "<link rel='canonical' href='$homelink' />\n";
576
+ }
577
+ add_action( 'amp_post_template_head', 'ampforwp_rel_canonical' );
578
+
579
+ // 19. Remove Canonical tags
580
+ function ampforwp_amp_remove_actions() {
581
+ if ( is_home() || is_front_page() || is_archive() ) {
582
+ remove_action( 'amp_post_template_head', 'amp_post_template_add_canonical' );
583
+ }
584
+ }
585
+ add_action( 'amp_post_template_head', 'ampforwp_amp_remove_actions', 9 );
templates/single.php CHANGED
@@ -51,7 +51,10 @@
51
  </div>
52
 
53
  <div class="amp-wp-content post-pagination-meta">
54
- <?php $this->load_parts( apply_filters( 'amp_post_template_meta_parts', array( 'meta-taxonomy' ) ) ); ?>
 
 
 
55
 
56
 
57
  <?php if($redux_builder_amp['enable-next-previous-pagination'] == true) { ?>
@@ -89,4 +92,4 @@
89
 
90
  <?php do_action( 'amp_post_template_footer', $this ); ?>
91
  </body>
92
- </html>
51
  </div>
52
 
53
  <div class="amp-wp-content post-pagination-meta">
54
+ <?php if($redux_builder_amp['ampforwp-single-tags-on-off'] == true) {
55
+ $this->load_parts( apply_filters( 'amp_post_template_meta_parts', array( 'meta-taxonomy' ) ) );
56
+
57
+ } ?>
58
 
59
 
60
  <?php if($redux_builder_amp['enable-next-previous-pagination'] == true) { ?>
92
 
93
  <?php do_action( 'amp_post_template_footer', $this ); ?>
94
  </body>
95
+ </html>