AMP for WP – Accelerated Mobile Pages - Version 1.0.58

Version Description

(7th July 2020) = * Improvement: Added before and after comment hooks #4537 * Fixed: WPRocket CDN is not working properly with the amp pages #4342 * Fixed: Two galleries not working with Photo gallery plugin #4421 * Fixed: Arrows not getting aligned in Breadcrumbs in Arabic with Swift theme #4593 * Fixed: Customize font size not applying in the post title #4592 * Fixed: Validation errors when adding 2 columns in AMP pagebuilder #4383 * Fixed: Category pages are not working properly #4579 * Fixed: Autoptimize is causing validation for logged in users #4586 * Fixed: Changed gtag type in googleanalytics #4585 * Fixed: Changed the sub-title tag to h2 with subtitles and jannah theme #4599 * Fixed: The entire post content appearing in the excerpt #4603 * Fixed: Updated the condition for amp ninja activation extension #4606

Download this release

Release Info

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

Code changes from version 1.0.57 to 1.0.58

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.4.2
7
- Stable tag: 1.0.57
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -193,6 +193,20 @@ Device testing done through [BrowserStack](https://www.browserstack.com)
193
 
194
  == Changelog ==
195
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  = 1.0.57 (3rd July 2020) =
197
  * Fixed: Issue with external link with Rank Math #4584
198
  * Fixed: Incorrect yoast title with TagDiv's themes #4595
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.4.2
7
+ Stable tag: 1.0.58
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
193
 
194
  == Changelog ==
195
 
196
+ = 1.0.58 (7th July 2020) =
197
+ * Improvement: Added before and after comment hooks #4537
198
+ * Fixed: WPRocket CDN is not working properly with the amp pages #4342
199
+ * Fixed: Two galleries not working with Photo gallery plugin #4421
200
+ * Fixed: Arrows not getting aligned in Breadcrumbs in Arabic with Swift theme #4593
201
+ * Fixed: Customize font size not applying in the post title #4592
202
+ * Fixed: Validation errors when adding 2 columns in AMP pagebuilder #4383
203
+ * Fixed: Category pages are not working properly #4579
204
+ * Fixed: Autoptimize is causing validation for logged in users #4586
205
+ * Fixed: Changed gtag type in googleanalytics #4585
206
+ * Fixed: Changed the sub-title tag to h2 with subtitles and jannah theme #4599
207
+ * Fixed: The entire post content appearing in the excerpt #4603
208
+ * Fixed: Updated the condition for amp ninja activation extension #4606
209
+
210
  = 1.0.57 (3rd July 2020) =
211
  * Fixed: Issue with external link with Rank Math #4584
212
  * Fixed: Incorrect yoast title with TagDiv's themes #4595
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: 1.0.57
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','1.0.57');
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: 1.0.58
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','1.0.58');
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,19 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 1.0.57 (3rd July 2020) =
4
  * Fixed: Issue with external link with Rank Math #4584
5
  * Fixed: Incorrect yoast title with TagDiv's themes #4595
1
  == Changelog ==
2
 
3
+ = 1.0.58 (7th July 2020) =
4
+ * Improvement: Added before and after comment hooks #4537
5
+ * Fixed: WPRocket CDN is not working properly with the amp pages #4342
6
+ * Fixed: Two galleries not working with Photo gallery plugin #4421
7
+ * Fixed: Arrows not getting aligned in Breadcrumbs in Arabic with Swift theme #4593
8
+ * Fixed: Customize font size not applying in the post title #4592
9
+ * Fixed: Validation errors when adding 2 columns in AMP pagebuilder #4383
10
+ * Fixed: Category pages are not working properly #4579
11
+ * Fixed: Autoptimize is causing validation for logged in users #4586
12
+ * Fixed: Changed gtag type in googleanalytics #4585
13
+ * Fixed: Changed the sub-title tag to h2 with subtitles and jannah theme #4599
14
+ * Fixed: The entire post content appearing in the excerpt #4603
15
+ * Fixed: Updated the condition for amp ninja activation extension #4606
16
+
17
  = 1.0.57 (3rd July 2020) =
18
  * Fixed: Issue with external link with Rank Math #4584
19
  * Fixed: Incorrect yoast title with TagDiv's themes #4595
classes/class-ampforwp-photo-gallery-embed.php CHANGED
@@ -30,7 +30,11 @@ class AMPforWP_Photo_Gallery_Embed_Handler extends AMPforWP\AMPVendor\AMP_Base_E
30
  public function shortcode( $args ) {
31
 
32
  $params = array();
33
- $params['id'] = WDWLibrary::get('shortcode_id', 0);
 
 
 
 
34
  // Get values for elementor widget.
35
  $params['gallery_type'] = WDWLibrary::get('gallery_type', 'thumbnails');
36
  $params['gallery_id'] = WDWLibrary::get('gallery_id', 0);
30
  public function shortcode( $args ) {
31
 
32
  $params = array();
33
+ $param_id = 0;
34
+ if(isset($args['id'])){
35
+ $param_id = $args['id'];
36
+ }
37
+ $params['id'] = WDWLibrary::get('shortcode_id', $param_id);
38
  // Get values for elementor widget.
39
  $params['gallery_type'] = WDWLibrary::get('gallery_type', 'thumbnails');
40
  $params['gallery_id'] = WDWLibrary::get('gallery_id', 0);
components/comments/comments.php CHANGED
@@ -6,6 +6,7 @@ function ampforwp_framework_get_comments(){
6
  global $redux_builder_amp;
7
  $display_comments_on = "";
8
  $display_comments_on = ampforwp_get_comments_status();
 
9
  if ( $display_comments_on ) {
10
  if ( $redux_builder_amp['ampforwp-facebook-comments-support'] ) {
11
  echo ampforwp_framework_get_facebook_comments();
@@ -133,6 +134,7 @@ function ampforwp_framework_get_comments(){
133
  <?php do_action('ampforwp_after_comment_hook');
134
  }
135
  } // end $display_comments_on
 
136
  }
137
 
138
  //Facebook Comments
6
  global $redux_builder_amp;
7
  $display_comments_on = "";
8
  $display_comments_on = ampforwp_get_comments_status();
9
+ do_action('ampforwp_comment_start_hook');
10
  if ( $display_comments_on ) {
11
  if ( $redux_builder_amp['ampforwp-facebook-comments-support'] ) {
12
  echo ampforwp_framework_get_facebook_comments();
134
  <?php do_action('ampforwp_after_comment_hook');
135
  }
136
  } // end $display_comments_on
137
+ do_action('ampforwp_comment_end_hook');
138
  }
139
 
140
  //Facebook Comments
includes/features/analytics/analytics-functions.php CHANGED
@@ -43,7 +43,7 @@ function ampforwp_analytics() {
43
  $ampforwp_ga_fields = preg_replace('!/\*.*?\*/!s', '', $ampforwp_ga_fields);
44
  $ampforwp_ga_fields = preg_replace('/\n\s*\n/', '', $ampforwp_ga_fields);
45
  ?>
46
- <amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="googleanalytics" id="analytics1">
47
  <script type="application/json">
48
  <?php echo $ampforwp_ga_fields; ?>
49
  </script>
43
  $ampforwp_ga_fields = preg_replace('!/\*.*?\*/!s', '', $ampforwp_ga_fields);
44
  $ampforwp_ga_fields = preg_replace('/\n\s*\n/', '', $ampforwp_ga_fields);
45
  ?>
46
+ <amp-analytics <?php if(ampforwp_get_data_consent()){?>data-block-on-consent <?php } ?> type="gtag" id="analytics1">
47
  <script type="application/json">
48
  <?php echo $ampforwp_ga_fields; ?>
49
  </script>
includes/features/analytics/analytics-options.php CHANGED
@@ -127,8 +127,11 @@ function ampforwp_analytics_options($opt_name){
127
  'theme' => 'monokai',
128
  'desc' => '',
129
  'default' => ('{
130
- "vars": {
131
- "account": "UA-xxxxxxx-x"
 
 
 
132
  },
133
  "triggers": {
134
  "trackPageview": {
127
  'theme' => 'monokai',
128
  'desc' => '',
129
  'default' => ('{
130
+ "vars" : {
131
+ "gtag_id": "UA-xxxxxxx-x",
132
+ "config" : {
133
+ "UA-xxxxxxx-x": { "groups": "default" }
134
+ }
135
  },
136
  "triggers": {
137
  "trackPageview": {
includes/features/contact-form/contact-form-options.php CHANGED
@@ -75,7 +75,7 @@ if ( ! defined( 'ABSPATH' ) ) {
75
  'false' => 'Disabled',
76
  );
77
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
78
- if(!is_plugin_active( 'amp-gravity-forms/amp-ninja-forms.php' ) ){
79
  $forms_support[]= array(
80
  'id' => 'info_normal_2',
81
  'type' => 'info',
75
  'false' => 'Disabled',
76
  );
77
  include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
78
+ if(!function_exists('ampforwp_ninja_initiate_plugin') ){
79
  $forms_support[]= array(
80
  'id' => 'info_normal_2',
81
  'type' => 'info',
includes/features/performance/performance-functions.php CHANGED
@@ -26,6 +26,8 @@ function ampforwp_minify_html_output($content_buffer){
26
  if(class_exists('Cli_Optimizer') && preg_match('/<style type="text\/css">@font-face(.*?)<\/style>/s', $content_buffer)!=0){
27
  $content_buffer = preg_replace('/<style type="text\/css">@font-face(.*?)<\/style>/s', '', $content_buffer);
28
  }
 
 
29
  global $redux_builder_amp;
30
  if(!$redux_builder_amp['ampforwp_cache_minimize_mode']){
31
  return $content_buffer;
26
  if(class_exists('Cli_Optimizer') && preg_match('/<style type="text\/css">@font-face(.*?)<\/style>/s', $content_buffer)!=0){
27
  $content_buffer = preg_replace('/<style type="text\/css">@font-face(.*?)<\/style>/s', '', $content_buffer);
28
  }
29
+ $content_buffer = preg_replace('/percentage="(.*?)"/', '', $content_buffer);
30
+ $content_buffer = preg_replace('/<div(.*?)target="(.*?)"(.*?)>(.*?)<\/div>/', '<div$1$3>$4</div>', $content_buffer);
31
  global $redux_builder_amp;
32
  if(!$redux_builder_amp['ampforwp_cache_minimize_mode']){
33
  return $content_buffer;
pagebuilder/inc/viewShowFrontData.php CHANGED
@@ -497,7 +497,6 @@ function amppb_validateCss($css){
497
  $css = str_replace(array('.amppb-fluid','.amppb-fixed','.accordion-mod'), array('.ap-fl','.ap-fi','.apac'), $css);
498
  $css = preg_replace('/(([a-z -]*:(\s)*;))/', "", $css);
499
  $css = preg_replace('/((;[\s\n;]*;))/', ";", $css);
500
- $css = preg_replace('/(?:[^\r\n,{}]+)(?:,(?=[^}]*{,)|\s*{[\s]*})/', "", $css);
501
  $css = preg_replace('/\s\n+/', "", $css);
502
  return ampforwp_pb_autoCompileLess($css);
503
  }
497
  $css = str_replace(array('.amppb-fluid','.amppb-fixed','.accordion-mod'), array('.ap-fl','.ap-fi','.apac'), $css);
498
  $css = preg_replace('/(([a-z -]*:(\s)*;))/', "", $css);
499
  $css = preg_replace('/((;[\s\n;]*;))/', ";", $css);
 
500
  $css = preg_replace('/\s\n+/', "", $css);
501
  return ampforwp_pb_autoCompileLess($css);
502
  }
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.4.2
7
- Stable tag: 1.0.57
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -190,6 +190,20 @@ You can contact us from [here](https://ampforwp.com/contact/)
190
 
191
  == Changelog ==
192
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  = 1.0.57 (3rd July 2020) =
194
  * Fixed: Issue with external link with Rank Math #4584
195
  * Fixed: Incorrect yoast title with TagDiv's themes #4595
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 5.4.2
7
+ Stable tag: 1.0.58
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
190
 
191
  == Changelog ==
192
 
193
+ = 1.0.58 (7th July 2020) =
194
+ * Improvement: Added before and after comment hooks #4537
195
+ * Fixed: WPRocket CDN is not working properly with the amp pages #4342
196
+ * Fixed: Two galleries not working with Photo gallery plugin #4421
197
+ * Fixed: Arrows not getting aligned in Breadcrumbs in Arabic with Swift theme #4593
198
+ * Fixed: Customize font size not applying in the post title #4592
199
+ * Fixed: Validation errors when adding 2 columns in AMP pagebuilder #4383
200
+ * Fixed: Category pages are not working properly #4579
201
+ * Fixed: Autoptimize is causing validation for logged in users #4586
202
+ * Fixed: Changed gtag type in googleanalytics #4585
203
+ * Fixed: Changed the sub-title tag to h2 with subtitles and jannah theme #4599
204
+ * Fixed: The entire post content appearing in the excerpt #4603
205
+ * Fixed: Updated the condition for amp ninja activation extension #4606
206
+
207
  = 1.0.57 (3rd July 2020) =
208
  * Fixed: Issue with external link with Rank Math #4584
209
  * Fixed: Incorrect yoast title with TagDiv's themes #4595
templates/design-manager/swift/single.php CHANGED
@@ -15,7 +15,7 @@ global $redux_builder_amp; ?>
15
  <?php amp_title(); ?>
16
  <?php if( true == $redux_builder_amp['enable-excerpt-single'] ){ ?>
17
  <div class="tl-exc">
18
- <?php amp_excerpt(250); ?>
19
  </div>
20
  <?php } ?>
21
  </div>
15
  <?php amp_title(); ?>
16
  <?php if( true == $redux_builder_amp['enable-excerpt-single'] ){ ?>
17
  <div class="tl-exc">
18
+ <?php amp_excerpt(25); ?>
19
  </div>
20
  <?php } ?>
21
  </div>
templates/design-manager/swift/style.php CHANGED
@@ -629,7 +629,12 @@ p.nocomments {padding: 10px;color: #fff;}
629
  .amp-category span:after{content:"/";display:inline-block;margin:0px 5px 0px 5px;position:relative;top:1px;color:rgba(0, 0, 0, 0.25);}
630
  .amp-category span:last-child:after{display:none;}
631
  .sp{width:100%;margin-top:20px;display:inline-block;}
632
- .amp-post-title{font-size:48px;line-height:58px;color: #333;margin:0;padding-top:15px;}
 
 
 
 
 
633
  .sf-img {text-align: center;width: 100%;display: inline-block;height: auto;
634
  <?php if ( ampforwp_get_setting('swift-featued-image-type') == 1) { ?>
635
  margin-top: 33px;
@@ -1750,6 +1755,7 @@ font-family:"Font Awesome 5 Brands";
1750
  <?php }
1751
  if ( $ampforwp_font_icon == 'fontawesome-icons' ){ ?>
1752
  content:"\f099";
 
1753
  <?php } ?>
1754
  }
1755
  <?php }
@@ -2288,6 +2294,8 @@ if(true == ampforwp_get_setting('signin-button') && '2' == ampforwp_get_setting(
2288
  if(true == ampforwp_get_setting('amp-rtl-select-option')){?>
2289
  .breadcrumbs li a:after, .breadcrumbs span a:after{
2290
  content: "\e314";
 
 
2291
  }
2292
  <?php }
2293
  if(ampforwp_get_setting('ampforwp-gallery-design-type')==3){?>
629
  .amp-category span:after{content:"/";display:inline-block;margin:0px 5px 0px 5px;position:relative;top:1px;color:rgba(0, 0, 0, 0.25);}
630
  .amp-category span:last-child:after{display:none;}
631
  .sp{width:100%;margin-top:20px;display:inline-block;}
632
+ .amp-post-title{font-size:48px;line-height:58px;color: #333;margin:0;padding-top:15px;
633
+ <?php if ( ampforwp_get_setting('swift_cnt_h2') && ampforwp_get_setting('swift_h2_sz') && ampforwp_get_setting('opt-media','url')=='') { ?>
634
+ font-size:<?php echo esc_html( ampforwp_get_setting('swift_h2_sz') )?>;<?php }?>
635
+ <?php if ( ampforwp_get_setting('swift_cnt_h1') && ampforwp_get_setting('swift_h1_sz') && ampforwp_get_setting('opt-media','url')!='') { ?>
636
+ font-size:<?php echo esc_html( ampforwp_get_setting('swift_h1_sz') )?>;
637
+ <?php }?>}
638
  .sf-img {text-align: center;width: 100%;display: inline-block;height: auto;
639
  <?php if ( ampforwp_get_setting('swift-featued-image-type') == 1) { ?>
640
  margin-top: 33px;
1755
  <?php }
1756
  if ( $ampforwp_font_icon == 'fontawesome-icons' ){ ?>
1757
  content:"\f099";
1758
+ color:#fff;
1759
  <?php } ?>
1760
  }
1761
  <?php }
2294
  if(true == ampforwp_get_setting('amp-rtl-select-option')){?>
2295
  .breadcrumbs li a:after, .breadcrumbs span a:after{
2296
  content: "\e314";
2297
+ padding-left: 0px;
2298
+ padding-right: 5px;
2299
  }
2300
  <?php }
2301
  if(ampforwp_get_setting('ampforwp-gallery-design-type')==3){?>
templates/features.php CHANGED
@@ -398,7 +398,13 @@ define('AMPFORWP_COMMENTS_PER_PAGE', ampforwp_define_comments_number() );
398
  }
399
  }
400
  }
401
- }
 
 
 
 
 
 
402
  return esc_url_raw($amp_url);
403
  }
404
  }
@@ -753,7 +759,7 @@ function ampforwp_title_custom_meta() {
753
  }
754
  // Posts
755
  if( ampforwp_get_setting('amp-on-off-for-all-posts') && $post_type == 'post' ) {
756
- add_meta_box( 'ampforwp_title_meta', esc_html__( 'Show AMP for Current Page?','accelerated-mobile-pages' ), 'ampforwp_title_callback', 'post','side' );
757
  }
758
  // Pages
759
  $frontpage_id = ampforwp_get_the_ID();
@@ -6819,7 +6825,7 @@ function ampforwp_backtotop( $data ) {
6819
  add_action('ampforwp_below_the_title','ampforwp_jannah_subtitle');
6820
  function ampforwp_jannah_subtitle(){
6821
  if (function_exists('jannah_theme_name') && function_exists('tie_get_postdata')){?>
6822
- <h4 class="amp-wp-content"><?php echo esc_html(tie_get_postdata( 'tie_post_sub_title' ))?></h4>
6823
  <?php
6824
  }
6825
  }
@@ -6881,7 +6887,7 @@ if (class_exists('Subtitles')){
6881
  $subtitle = "";
6882
  $subtitle = get_post_meta( $post_id, Subtitles::SUBTITLE_META_KEY, true );
6883
  ?>
6884
- <h4 class="amp-wp-content"><?php echo esc_html($subtitle) ?></h4>
6885
  <?php
6886
  }
6887
  }
@@ -8401,7 +8407,9 @@ if(!function_exists('ampforwp_add_fallback_element')){
8401
  $m1_content = str_replace($swidth, $width_rep, $m1_content);
8402
  $m1_content = str_replace($sheight, $height_rep, $m1_content);
8403
  $m1_content = str_replace($salt, $alt_rep, $m1_content);
8404
- $m1_content = preg_replace('/srcset="(.*?)"/', '', $m1_content);
 
 
8405
  $fallback_img = "<amp-img ".$m_content."<amp-img fallback ".$m1_content."</amp-img></amp-img>";//$m_content, $m1_content escaped above.
8406
  $content = str_replace("$match", $fallback_img, $content);
8407
  }
@@ -8537,26 +8545,15 @@ if(class_exists('RankMath')){
8537
  function ampforwp_rank_math_external_link_newtab($content){
8538
  $rank_math_external_link = RankMath\Helper::get_settings( 'general.new_window_external_links' );
8539
  if($rank_math_external_link){
8540
- $comp_dom = new DOMDocument();
8541
- if(function_exists('mb_convert_encoding')){
8542
- @$comp_dom->loadHTML(mb_convert_encoding($content, 'HTML-ENTITIES', 'UTF-8'),LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
8543
- }else{
8544
- $content = htmlspecialchars_decode(utf8_decode(htmlentities($content, ENT_COMPAT, 'utf-8', false)));
8545
- @$comp_dom->loadHTML($content,LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
8546
- }
8547
- $xpath = new DOMXPath( $comp_dom );
8548
- $count = 0;
8549
- $nodes = $xpath->query('//a[@href]');
8550
- foreach ($nodes as $node) {
8551
- $url = $node->getAttribute('href');
8552
- $is_external = ampforwp_isexternal($url);
8553
- if($is_external){
8554
- if(!$node->hasAttribute('target')){
8555
- $node->setAttribute('target','_blank');
8556
- }
8557
  }
8558
- }
8559
- $content = $comp_dom->saveHTML();
8560
  }
8561
  return $content;
8562
  }
398
  }
399
  }
400
  }
401
+ }
402
+ if (is_category() && class_exists('WPSEO_Options') && WPSEO_Options::get( 'stripcategorybase' ) == true && false == ampforwp_get_setting('ampforwp-category-base-removel-link')) {
403
+ return;
404
+ }
405
+ if (is_category() && class_exists('RankMath') && RankMath\Helper::get_settings( 'general.strip_category_base' ) == true && false == ampforwp_get_setting('ampforwp-category-base-removel-link')) {
406
+ return;
407
+ }
408
  return esc_url_raw($amp_url);
409
  }
410
  }
759
  }
760
  // Posts
761
  if( ampforwp_get_setting('amp-on-off-for-all-posts') && $post_type == 'post' ) {
762
+ add_meta_box( 'ampforwp_title_meta', esc_html__( 'Show AMP for Current Post?','accelerated-mobile-pages' ), 'ampforwp_title_callback', 'post','side' );
763
  }
764
  // Pages
765
  $frontpage_id = ampforwp_get_the_ID();
6825
  add_action('ampforwp_below_the_title','ampforwp_jannah_subtitle');
6826
  function ampforwp_jannah_subtitle(){
6827
  if (function_exists('jannah_theme_name') && function_exists('tie_get_postdata')){?>
6828
+ <h2 class="amp-wp-content"><?php echo esc_html(tie_get_postdata( 'tie_post_sub_title' ))?></h2>
6829
  <?php
6830
  }
6831
  }
6887
  $subtitle = "";
6888
  $subtitle = get_post_meta( $post_id, Subtitles::SUBTITLE_META_KEY, true );
6889
  ?>
6890
+ <h2 class="amp-wp-content"><?php echo esc_html($subtitle) ?></h2>
6891
  <?php
6892
  }
6893
  }
8407
  $m1_content = str_replace($swidth, $width_rep, $m1_content);
8408
  $m1_content = str_replace($sheight, $height_rep, $m1_content);
8409
  $m1_content = str_replace($salt, $alt_rep, $m1_content);
8410
+ if(function_exists('rocket_activation')){
8411
+ $m1_content = preg_replace('/srcset="(.*?)"/', '', $m1_content);
8412
+ }
8413
  $fallback_img = "<amp-img ".$m_content."<amp-img fallback ".$m1_content."</amp-img></amp-img>";//$m_content, $m1_content escaped above.
8414
  $content = str_replace("$match", $fallback_img, $content);
8415
  }
8545
  function ampforwp_rank_math_external_link_newtab($content){
8546
  $rank_math_external_link = RankMath\Helper::get_settings( 'general.new_window_external_links' );
8547
  if($rank_math_external_link){
8548
+ preg_match_all('/<a(.*?)href="(.*?)"/s', $content, $matches);
8549
+ for($i=0;$i<count($matches[2]);$i++){
8550
+ $url = $matches[2][$i];
8551
+ if(ampforwp_isexternal($url)){
8552
+ $url = esc_url($url);
8553
+ $url = str_replace("/", "\/", $url);
8554
+ $content = preg_replace('/(<a(.*?)href="'.$url.'.*")/', '$1 target="_blank"', $content);
 
 
 
 
 
 
 
 
 
 
8555
  }
8556
+ }
 
8557
  }
8558
  return $content;
8559
  }