AMP for WP – Accelerated Mobile Pages - Version 0.9.47.1

Version Description

(11 April 2017) = * Meta description option improved in SEO section #766 * Fatal error: require_once report-bugs.php #747

Download this release

Release Info

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

Code changes from version 0.9.47 to 0.9.47.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.47
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/5
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) exit;
16
  define('AMPFORWP_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
17
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.php');
18
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
19
- define('AMPFORWP_VERSION','0.9.47');
20
  // any changes to AMP_QUERY_VAR should be refelected here
21
  define('AMPFORWP_AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) );
22
 
@@ -129,7 +129,7 @@ function ampforwp_parent_plugin_check() {
129
  }
130
  // Register all the main options
131
  require_once dirname( __FILE__ ).'/includes/options/admin-config.php';
132
- require_once AMPFORWP_PLUGIN_DIR .'templates/report-bugs.php';
133
 
134
 
135
  /*
@@ -140,7 +140,7 @@ if ( is_admin() ) {
140
 
141
  // Include Welcome page only on Admin pages
142
  require AMPFORWP_PLUGIN_DIR .'/includes/welcome.php';
143
-
144
  add_action('init','ampforwp_plugin_notice');
145
  function ampforwp_plugin_notice() {
146
 
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.47.1
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/5
16
  define('AMPFORWP_PLUGIN_DIR', plugin_dir_path( __FILE__ ));
17
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.php');
18
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
19
+ define('AMPFORWP_VERSION','0.9.47.1');
20
  // any changes to AMP_QUERY_VAR should be refelected here
21
  define('AMPFORWP_AMP_QUERY_VAR', apply_filters( 'amp_query_var', 'amp' ) );
22
 
129
  }
130
  // Register all the main options
131
  require_once dirname( __FILE__ ).'/includes/options/admin-config.php';
132
+ require_once dirname( __FILE__ ).'/templates/report-bugs.php';
133
 
134
 
135
  /*
140
 
141
  // Include Welcome page only on Admin pages
142
  require AMPFORWP_PLUGIN_DIR .'/includes/welcome.php';
143
+
144
  add_action('init','ampforwp_plugin_notice');
145
  function ampforwp_plugin_notice() {
146
 
includes/options/admin-config.php CHANGED
@@ -650,7 +650,7 @@ Redux::setArgs( "redux_builder_amp", $args );
650
  array('ampforwp-callnow-button', '=' , '1')
651
  )
652
  ),
653
-
654
  array(
655
  'id' => 'amp-design-3-credit-link',
656
  'type' => 'switch',
@@ -701,22 +701,14 @@ Redux::setArgs( "redux_builder_amp", $args );
701
  'title' => __( 'SEO', 'redux-framework-demo' ),
702
  'desc' => __( '', 'redux-framework-demo'),
703
  'id' => 'amp-seo',
704
- 'desc' => '<strong>Note : <br/> This section only works if Yoast SEO Plugin is Activated (Exception : Additional Meta Tags Section) </strong>',
705
  'subsection' => true,
706
  'fields' => array(
707
 
708
  array(
709
- 'id' => 'ampforwp-seo-yoast-meta',
710
  'type' => 'switch',
711
- 'subtitle' => __('Adds Social and Open Graph Meta Tags from Yoast', 'redux-framework-demo'),
712
- 'title' => __( 'Add Meta Tags from Yoast', 'redux-framework-demo' ),
713
- 'default' => '1'
714
- ),
715
- array(
716
- 'id' => 'ampforwp-seo-yoast-description',
717
- 'type' => 'switch',
718
- 'subtitle' => __('Adds Yoast Custom description to ld+json for AMP page and also meta="description"', 'redux-framework-demo'),
719
- 'title' => __( 'Yoast Custom Description for AMP page', 'redux-framework-demo' ),
720
  'default' => 0
721
  ),
722
 
@@ -729,6 +721,29 @@ Redux::setArgs( "redux_builder_amp", $args );
729
  'placeholder' => "<!-- Paste your Additional HTML , that goes between <head> </head> tags -->"
730
  ),
731
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
732
  array(
733
  'id' => 'ampforwp-seo-index-noindex-sub-section',
734
  'type' => 'section',
@@ -1850,4 +1865,4 @@ Redux::setSection( $opt_name, array(
1850
  ) );
1851
  /*
1852
  * <--- END SECTIONS
1853
- */
650
  array('ampforwp-callnow-button', '=' , '1')
651
  )
652
  ),
653
+
654
  array(
655
  'id' => 'amp-design-3-credit-link',
656
  'type' => 'switch',
701
  'title' => __( 'SEO', 'redux-framework-demo' ),
702
  'desc' => __( '', 'redux-framework-demo'),
703
  'id' => 'amp-seo',
 
704
  'subsection' => true,
705
  'fields' => array(
706
 
707
  array(
708
+ 'id' => 'ampforwp-seo-meta-description',
709
  'type' => 'switch',
710
+ 'title' => __('Meta Description', 'redux-framework-demo'),
711
+ 'subtitle' => __('The meta tag that displays in head', 'redux-framework-demo'),
 
 
 
 
 
 
 
712
  'default' => 0
713
  ),
714
 
721
  'placeholder' => "<!-- Paste your Additional HTML , that goes between <head> </head> tags -->"
722
  ),
723
 
724
+
725
+ array(
726
+ 'id' => 'ampforwp-yoast-seo-sub-section',
727
+ 'type' => 'section',
728
+ 'title' => __('Yoast SEO Options', 'redux-framework-demo'),
729
+ 'indent' => true
730
+ ),
731
+
732
+ array(
733
+ 'id' => 'ampforwp-seo-yoast-meta',
734
+ 'type' => 'switch',
735
+ 'subtitle' => __('Adds Social and Open Graph Meta Tags from Yoast', 'redux-framework-demo'),
736
+ 'title' => __( 'Meta Tags from Yoast', 'redux-framework-demo' ),
737
+ 'default' => '1'
738
+ ),
739
+ array(
740
+ 'id' => 'ampforwp-seo-yoast-description',
741
+ 'type' => 'switch',
742
+ 'subtitle' => __('Adds Yoast Custom description to ld+json for AMP page', 'redux-framework-demo'),
743
+ 'title' => __( 'Yoast Description in ld+json', 'redux-framework-demo' ),
744
+ 'default' => 0
745
+ ),
746
+
747
  array(
748
  'id' => 'ampforwp-seo-index-noindex-sub-section',
749
  'type' => 'section',
1865
  ) );
1866
  /*
1867
  * <--- END SECTIONS
1868
+ */
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.3
7
- Stable tag: 0.9.47
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -129,6 +129,10 @@ You can contact me using this url: http://ampforwp.com/contact/
129
 
130
  == Changelog ==
131
 
 
 
 
 
132
  = 0.9.47 (10 April 2017) =
133
  * View more details at https://ampforwp.com/0-9-47-released-54th-update/
134
  * Meta saving method updated for customAMP content editor checkbox was causing some conflict.
4
  Donate link: https://www.paypal.me/Kaludi/5
5
  Requires at least: 3.0
6
  Tested up to: 4.7.3
7
+ Stable tag: 0.9.47.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
129
 
130
  == Changelog ==
131
 
132
+ = 0.9.47.1 (11 April 2017) =
133
+ * Meta description option improved in SEO section #766
134
+ * Fatal error: require_once report-bugs.php #747
135
+
136
  = 0.9.47 (10 April 2017) =
137
  * View more details at https://ampforwp.com/0-9-47-released-54th-update/
138
  * Meta saving method updated for customAMP content editor checkbox was causing some conflict.
templates/features.php CHANGED
@@ -1892,7 +1892,7 @@ Examples:
1892
  // initializing these to avoid debug errors
1893
  global $redux_builder_amp;
1894
  global $woocommerce;
1895
-
1896
  if( !class_exists( 'WooCommerce' ) ){
1897
  return;
1898
  }
@@ -2020,6 +2020,10 @@ function ampforwp_change_default_amp_page_meta() {
2020
  add_action('amp_post_template_head','ampforwp_meta_description');
2021
  function ampforwp_meta_description() {
2022
  global $redux_builder_amp;
 
 
 
 
2023
  global $post;
2024
  $desc = "" ;
2025
 
@@ -2027,29 +2031,29 @@ function ampforwp_meta_description() {
2027
  if ( class_exists('WPSEO_Frontend') ) {
2028
  // general Description of everywhere
2029
  $front = WPSEO_Frontend::get_instance();
2030
- $desc = $front->metadesc( false );
2031
 
2032
  // Static front page
2033
  // Code for Custom Frontpage Yoast SEO Description
2034
  $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
2035
  if ( class_exists('WPSEO_Meta') ) {
2036
  if ( is_home() && $redux_builder_amp['amp-frontpage-select-option'] ) {
2037
- $desc = WPSEO_Meta::get_value('metadesc', $post_id );
2038
  }
2039
  }
2040
  }
2041
  // for search
2042
  if( is_search() ) {
2043
- $desc = $redux_builder_amp['amp-translator-search-text'] . ' ' . get_search_query();
2044
  }
2045
  } else {
2046
  if( is_home() ) {
2047
  // normal home page
2048
- $desc= get_bloginfo( 'description' );
2049
  }
2050
 
2051
  if( is_archive() ) {
2052
- $desc= get_the_archive_description();
2053
  }
2054
 
2055
  if( is_single() || is_page() ) {
@@ -2060,19 +2064,26 @@ function ampforwp_meta_description() {
2060
  $id = $post->ID;
2061
  $desc = get_post($id)->post_content;
2062
  }
2063
- $desc = wp_trim_words( strip_tags( strip_shortcodes( $desc ) ) , '15' );
2064
  }
2065
 
2066
  if( is_search() ) {
2067
- $desc = $redux_builder_amp['amp-translator-search-text'] . ' ' . get_search_query();
2068
  }
2069
 
2070
  if( is_home() && $redux_builder_amp['amp-frontpage-select-option'] ) {
2071
- $post_id = get_the_excerpt( $redux_builder_amp['amp-frontpage-select-option-pages'] );
2072
- $desc = strip_shortcodes( strip_tags( get_post_field('post_content', $post_id) ) );
2073
  }
2074
- }
2075
- echo '<meta name="description" content="'. $desc .'"/>';
 
 
 
 
 
 
 
2076
  }
2077
  // Call Feature
2078
  add_action('ampforwp_call_button','ampforwp_call_button_html_output');
1892
  // initializing these to avoid debug errors
1893
  global $redux_builder_amp;
1894
  global $woocommerce;
1895
+
1896
  if( !class_exists( 'WooCommerce' ) ){
1897
  return;
1898
  }
2020
  add_action('amp_post_template_head','ampforwp_meta_description');
2021
  function ampforwp_meta_description() {
2022
  global $redux_builder_amp;
2023
+ if( !$redux_builder_amp['ampforwp-seo-meta-description'] ){
2024
+ return;
2025
+ }
2026
+
2027
  global $post;
2028
  $desc = "" ;
2029
 
2031
  if ( class_exists('WPSEO_Frontend') ) {
2032
  // general Description of everywhere
2033
  $front = WPSEO_Frontend::get_instance();
2034
+ $desc = addslashes( strip_tags( $front->metadesc( false ) ) );
2035
 
2036
  // Static front page
2037
  // Code for Custom Frontpage Yoast SEO Description
2038
  $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'];
2039
  if ( class_exists('WPSEO_Meta') ) {
2040
  if ( is_home() && $redux_builder_amp['amp-frontpage-select-option'] ) {
2041
+ $desc = addslashes( strip_tags( WPSEO_Meta::get_value('metadesc', $post_id ) ) );
2042
  }
2043
  }
2044
  }
2045
  // for search
2046
  if( is_search() ) {
2047
+ $desc = addslashes( $redux_builder_amp['amp-translator-search-text'] . ' ' . get_search_query() );
2048
  }
2049
  } else {
2050
  if( is_home() ) {
2051
  // normal home page
2052
+ $desc= addslashes( strip_tags( get_bloginfo( 'description' ) ) );
2053
  }
2054
 
2055
  if( is_archive() ) {
2056
+ $desc= addslashes( strip_tags( get_the_archive_description() ) );
2057
  }
2058
 
2059
  if( is_single() || is_page() ) {
2064
  $id = $post->ID;
2065
  $desc = get_post($id)->post_content;
2066
  }
2067
+ $desc = addslashes( wp_trim_words( strip_tags( $desc ) , '15' ) );
2068
  }
2069
 
2070
  if( is_search() ) {
2071
+ $desc = addslashes( $redux_builder_amp['amp-translator-search-text'] . ' ' . get_search_query() );
2072
  }
2073
 
2074
  if( is_home() && $redux_builder_amp['amp-frontpage-select-option'] ) {
2075
+ $post_id = $redux_builder_amp['amp-frontpage-select-option-pages'] ;
2076
+ $desc = addslashes( wp_trim_words( strip_tags( get_post_field('post_content', $post_id) ) , '15' ) );
2077
  }
2078
+ }
2079
+
2080
+ // strip_shortcodes strategy not working here so had to do this way
2081
+ // strips shortcodes
2082
+ $desc= preg_replace('/\[(.*)?\]/','',$desc);
2083
+
2084
+ if( $desc ) {
2085
+ echo '<meta name="description" content="'. $desc .'"/>';
2086
+ }
2087
  }
2088
  // Call Feature
2089
  add_action('ampforwp_call_button','ampforwp_call_button_html_output');