AMP for WP – Accelerated Mobile Pages - Version 0.9.98.11

Version Description

(20th SEPTEMBER 2019) = * Improvements: Improved AMP Advertisement option panel * Fixed: Mobile redirection causing extra redirects from /amp to /amp/ #3660 * Fixed: The lightbox should not work for the image if any external link is added in its anchor tag. #3599

Download this release

Release Info

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

Code changes from version 0.9.98.10 to 0.9.98.11

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: 5.2.3
7
- Stable tag: 0.9.98.10
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -191,6 +191,11 @@ You can contact us from [here](https://ampforwp.com/contact/)
191
 
192
  == Changelog ==
193
 
 
 
 
 
 
194
  = 0.9.98.10 (18th SEPTEMBER 2019) =
195
 
196
  * Improvements: Upgrade the analtyics integration with gtag.js #3538
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.2.3
7
+ Stable tag: 0.9.98.11
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
191
 
192
  == Changelog ==
193
 
194
+ = 0.9.98.11 (20th SEPTEMBER 2019) =
195
+ * Improvements: Improved AMP Advertisement option panel
196
+ * Fixed: Mobile redirection causing extra redirects from /amp to /amp/ #3660
197
+ * Fixed: The lightbox should not work for the image if any external link is added in its anchor tag. #3599
198
+
199
  = 0.9.98.10 (18th SEPTEMBER 2019) =
200
 
201
  * Improvements: Upgrade the analtyics integration with gtag.js #3538
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.98.10
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
@@ -20,7 +20,7 @@ define('AMPFORWP_PLUGIN_DIR_URI', plugin_dir_url(__FILE__));
20
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.html');
21
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
22
  define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
23
- define('AMPFORWP_VERSION','0.9.98.10');
24
  define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
25
  if(!defined('AMPFROWP_HOST_NAME')){
26
  $urlinfo = get_bloginfo('url');
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.98.11
7
  Author: Ahmed Kaludi, Mohammed Kaludi
8
  Author URI: https://ampforwp.com/
9
  Donate link: https://www.paypal.me/Kaludi/25
20
  define('AMPFORWP_DISQUS_URL',plugin_dir_url(__FILE__).'includes/disqus.html');
21
  define('AMPFORWP_IMAGE_DIR',plugin_dir_url(__FILE__).'images');
22
  define('AMPFORWP_MAIN_PLUGIN_DIR', plugin_dir_path( __DIR__ ) );
23
+ define('AMPFORWP_VERSION','0.9.98.11');
24
  define('AMPFORWP_EXTENSION_DIR',plugin_dir_path(__FILE__).'includes/options/extensions');
25
  if(!defined('AMPFROWP_HOST_NAME')){
26
  $urlinfo = get_bloginfo('url');
changelog.txt CHANGED
@@ -1,5 +1,10 @@
1
  == Changelog ==
2
 
 
 
 
 
 
3
  = 0.9.98.10 (18th SEPTEMBER 2019) =
4
 
5
  * Improvements: Upgrade the analtyics integration with gtag.js #3538
1
  == Changelog ==
2
 
3
+ = 0.9.98.11 (20th SEPTEMBER 2019) =
4
+ * Improvements: Improved AMP Advertisement option panel
5
+ * Fixed: Mobile redirection causing extra redirects from /amp to /amp/ #3660
6
+ * Fixed: The lightbox should not work for the image if any external link is added in its anchor tag. #3599
7
+
8
  = 0.9.98.10 (18th SEPTEMBER 2019) =
9
 
10
  * Improvements: Upgrade the analtyics integration with gtag.js #3538
includes/admin-style.css CHANGED
@@ -875,6 +875,25 @@ div#section-ampforwp-ads-section h3:before{
875
  font-size: 10px;
876
  line-height: 10px;
877
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
878
  .redux-main .redux-field-container{
879
  padding: 18px 10px 18px 0;
880
  }
@@ -949,4 +968,10 @@ font-weight: normal;
949
  #admin-import-file-name{
950
  color:red;
951
  font-weight: bold;
 
 
 
 
 
 
952
  }
875
  font-size: 10px;
876
  line-height: 10px;
877
  }
878
+ @media only screen and (max-width: 1400px) and (min-width: 1191px) {
879
+ div#section-ampforwp-ads-section h3 {
880
+ font-size: 12px;
881
+ }
882
+ div#section-ampforwp-ads-section h3:before {
883
+ content: "";
884
+ display: none;
885
+ }
886
+ }
887
+ @media only screen and (max-width: 1190px) {
888
+ div#section-ampforwp-ads-section{
889
+ margin-top: 20px;
890
+ }
891
+ div#section-amp-ads_1, table#section-table-amp-ads_1,
892
+ div#section-ampforwp-ads-section, table#section-table-ampforwp-ads-section {
893
+ max-width: 100%;
894
+ float:none;
895
+ }
896
+ }
897
  .redux-main .redux-field-container{
898
  padding: 18px 10px 18px 0;
899
  }
968
  #admin-import-file-name{
969
  color:red;
970
  font-weight: bold;
971
+ }
972
+ #ampforwp-adsforwp-activation-call a{
973
+ color: #fff;
974
+ }
975
+ #ampforwp-adsforwp-activation-call {
976
+ max-width:170px;
977
  }
includes/features/advertisement/ads-options.php CHANGED
@@ -1039,10 +1039,10 @@
1039
  <div>
1040
  '.(!is_plugin_active('ads-for-wp/ads-for-wp.php')?
1041
  '
1042
- <div class="install-now ampforwp-activation-call-module-upgrade button " id="ampforwp-adsforwp-activation-call" data-secure="'.wp_create_nonce('verify_module').'">
1043
  <p>' . esc_html__('Upgrade for Free','accelerated-mobile-pages') .'</p>
1044
  </div>' :
1045
- '<a href="'.admin_url('admin.php?page=adsforwp&tab=general&reference=ampforwp').'"><div class="ampforwp-recommendation-btn updated-message"><p>Go to Ads for WP settings</p></div></a>'
1046
  )
1047
  .'
1048
  &nbsp;<br/><a href="https://ampforwp.com/tutorials/article/what-is-ads-for-wp-update-all-about/" class="amp_recommend_learnmore" target="_blank">Learn more</a>
1039
  <div>
1040
  '.(!is_plugin_active('ads-for-wp/ads-for-wp.php')?
1041
  '
1042
+ <div class="install-now ampforwp-activation-call-module-upgrade button button-primary" id="ampforwp-adsforwp-activation-call" data-secure="'.wp_create_nonce('verify_module').'">
1043
  <p>' . esc_html__('Upgrade for Free','accelerated-mobile-pages') .'</p>
1044
  </div>' :
1045
+ '<a href="'.admin_url('edit.php?post_type=adsforwp').'"><div class="ampforwp-recommendation-btn updated-message"><p>Go to Ads for WP settings</p></div></a>'
1046
  )
1047
  .'
1048
  &nbsp;<br/><a href="https://ampforwp.com/tutorials/article/what-is-ads-for-wp-update-all-about/" class="amp_recommend_learnmore" target="_blank">Learn more</a>
includes/features/functions.php CHANGED
@@ -647,7 +647,7 @@ function ampforwp_url_purifier($url){
647
  if($found == ''){
648
  array_splice( $explode_url, count($explode_url), 0, $append_amp );
649
  $impode_url = implode('/', $explode_url);
650
- $url = untrailingslashit($impode_url);
651
  }
652
  }
653
  if ( is_home() || is_archive() ){
@@ -672,7 +672,7 @@ function ampforwp_url_purifier($url){
672
  if($found == ''){
673
  array_splice( $explode_path, count($explode_path), 0, $inserted );
674
  $impode_url = implode('/', $explode_path);
675
- $url = $impode_url;
676
 
677
  }
678
  }
647
  if($found == ''){
648
  array_splice( $explode_url, count($explode_url), 0, $append_amp );
649
  $impode_url = implode('/', $explode_url);
650
+ $url = user_trailingslashit($impode_url);
651
  }
652
  }
653
  if ( is_home() || is_archive() ){
672
  if($found == ''){
673
  array_splice( $explode_path, count($explode_path), 0, $inserted );
674
  $impode_url = implode('/', $explode_path);
675
+ $url = user_trailingslashit($impode_url);
676
 
677
  }
678
  }
includes/module-upgrade.js CHANGED
@@ -85,7 +85,7 @@ jQuery(document).ready(function($){
85
  type: 'post',
86
  data: 'action=ampforwp_import_modules_ads&verify_nonce='+nonce,
87
  success: function () {
88
- self.html('<a href="'+response.redirect_url+'" style="text-decoration: none;color: #555;">Installed! - Let\'s Go to '+msgplug+' Settings</a>')
89
  self.removeClass('ampforwp-activation-call-module-upgrade');
90
  }
91
  });
85
  type: 'post',
86
  data: 'action=ampforwp_import_modules_ads&verify_nonce='+nonce,
87
  success: function () {
88
+ self.html('<a href="'+response.redirect_url+'" style="text-decoration: none;">Go to Ads Settings</a>')
89
  self.removeClass('ampforwp-activation-call-module-upgrade');
90
  }
91
  });
includes/modules-upgrade.php CHANGED
@@ -87,7 +87,7 @@ function ampforwp_enable_modules_upgread(){
87
  ),
88
  'install' => 'ads-for-wp/ads-for-wp.php',
89
  );
90
- $redirectSettingsUrl = admin_url('admin.php?page=adsforwp&tab=general&reference=ampforwp');
91
  break;
92
  default:
93
  $plugins = array();
87
  ),
88
  'install' => 'ads-for-wp/ads-for-wp.php',
89
  );
90
+ $redirectSettingsUrl = admin_url('edit.php?post_type=adsforwp');
91
  break;
92
  default:
93
  $plugins = array();
includes/options/admin-config.php CHANGED
@@ -5622,15 +5622,6 @@ $single_page_options = array(
5622
  esc_html__('Enable this option to show lightbox for images in AMP and', 'accelerated-mobile-pages'), esc_url('https://ampforwp.com/tutorials/article/how-to-enable-lightbox-in-amp/'),esc_html__('Click Here','accelerated-mobile-pages'), esc_html__('for more info','accelerated-mobile-pages')),
5623
 
5624
  ),
5625
- array(
5626
- 'id' => 'ampforwp-lightbox-external-links',
5627
- 'class' => 'child_opt',
5628
- 'type' => 'switch',
5629
- 'title' => esc_html__('External Links', 'accelerated-mobile-pages'),
5630
- 'tooltip-subtitle' => esc_html__('This will show lightbox on your external links also', 'accelerated-mobile-pages'),
5631
- 'default' => '1',
5632
- 'required' => array('ampforwp-amp-img-lightbox','=', '1'),
5633
- ),
5634
  // Dropcap
5635
  array(
5636
  'id' => 'ampforwp-dropcap',
5622
  esc_html__('Enable this option to show lightbox for images in AMP and', 'accelerated-mobile-pages'), esc_url('https://ampforwp.com/tutorials/article/how-to-enable-lightbox-in-amp/'),esc_html__('Click Here','accelerated-mobile-pages'), esc_html__('for more info','accelerated-mobile-pages')),
5623
 
5624
  ),
 
 
 
 
 
 
 
 
 
5625
  // Dropcap
5626
  array(
5627
  'id' => 'ampforwp-dropcap',
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: 5.2.3
7
- Stable tag: 0.9.98.10
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -191,6 +191,11 @@ You can contact us from [here](https://ampforwp.com/contact/)
191
 
192
  == Changelog ==
193
 
 
 
 
 
 
194
  = 0.9.98.10 (18th SEPTEMBER 2019) =
195
 
196
  * Improvements: Upgrade the analtyics integration with gtag.js #3538
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.2.3
7
+ Stable tag: 0.9.98.11
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
191
 
192
  == Changelog ==
193
 
194
+ = 0.9.98.11 (20th SEPTEMBER 2019) =
195
+ * Improvements: Improved AMP Advertisement option panel
196
+ * Fixed: Mobile redirection causing extra redirects from /amp to /amp/ #3660
197
+ * Fixed: The lightbox should not work for the image if any external link is added in its anchor tag. #3599
198
+
199
  = 0.9.98.10 (18th SEPTEMBER 2019) =
200
 
201
  * Improvements: Upgrade the analtyics integration with gtag.js #3538
templates/features.php CHANGED
@@ -5748,14 +5748,23 @@ function ampforwp_coauthors_links($args){
5748
  //remove anchor from the image when lightbox option is enabled #2695
5749
  add_action('pre_amp_render_post','ampforwp_remove_ahref_lightbox');
5750
  function ampforwp_remove_ahref_lightbox(){
5751
- if(true == ampforwp_get_setting('ampforwp-amp-img-lightbox') && true == ampforwp_get_setting('ampforwp-lightbox-external-links')){
5752
  add_filter( 'the_content', 'ampforwp_remove_ahref_lightbox_in_amp' );
5753
  add_filter('tablepress_table_render_data','amforwp_remove_tp_image_href');
5754
  }
5755
  }
5756
  function ampforwp_remove_ahref_lightbox_in_amp( $content ) {
5757
- $updated_content = preg_replace("/<a[^>]+\>(<img[^>]+\>)<\/a>/i", '$1', $content);
5758
- return $updated_content;
 
 
 
 
 
 
 
 
 
5759
  }
5760
  function amforwp_remove_tp_image_href( $orig_table){
5761
  $tablepressData = array();
5748
  //remove anchor from the image when lightbox option is enabled #2695
5749
  add_action('pre_amp_render_post','ampforwp_remove_ahref_lightbox');
5750
  function ampforwp_remove_ahref_lightbox(){
5751
+ if(true == ampforwp_get_setting('ampforwp-amp-img-lightbox') ){
5752
  add_filter( 'the_content', 'ampforwp_remove_ahref_lightbox_in_amp' );
5753
  add_filter('tablepress_table_render_data','amforwp_remove_tp_image_href');
5754
  }
5755
  }
5756
  function ampforwp_remove_ahref_lightbox_in_amp( $content ) {
5757
+ preg_match_all('/(<a(.*?)href=\"(.*?)\">(.*?)<img(.*?)src=\"(.*?)\"(.*?)\/>)/', $content, $matches);
5758
+ if( count($matches[3])){
5759
+ for( $i=0;$i<count($matches[3]);$i++){
5760
+ if($matches[3][$i] == $matches[6][$i]){
5761
+ $href = $matches[3][$i];
5762
+ $href_src = str_replace( '/', '\/', $href );
5763
+ $content = preg_replace('/<a(.*?)href=\"'.$href_src.'\"(.*?)>(<img(.*?)src=\"'.$href_src.'\"(.*?)\/>)<\/a>/i', '$3', $content);
5764
+ }
5765
+ }
5766
+ }
5767
+ return $content;
5768
  }
5769
  function amforwp_remove_tp_image_href( $orig_table){
5770
  $tablepressData = array();