AMP for WP – Accelerated Mobile Pages - Version 1.0.77.53

Version Description

(25th October 2022) = * Fixed: Backslash in custom css error #5329 * Fixed: If we enable the Responsive ad option then no need to show size option. #5302 * Fixed: TikTok embed video is not working in AMP #5325 * Fixed: lightbox for Youtube feature is not working properly #5327

Download this release

Release Info

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

Code changes from version 1.0.77.52 to 1.0.77.53

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: 6.0
7
- Stable tag: 1.0.77.52
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -197,6 +197,12 @@ Device testing done through [BrowserStack](https://www.browserstack.com)
197
 
198
  == Changelog ==
199
 
 
 
 
 
 
 
200
  = 1.0.77.52 (14th October 2022) =
201
  * Fixed: Duplicate canonical URL when AIOSEO Pro is active. #5320
202
  * Fixed: Youtube embedded videos via elementor is not displaying in the AMP version #5322
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 6.0
7
+ Stable tag: 1.0.77.53
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
197
 
198
  == Changelog ==
199
 
200
+ = 1.0.77.53 (25th October 2022) =
201
+ * Fixed: Backslash in custom css error #5329
202
+ * Fixed: If we enable the Responsive ad option then no need to show size option. #5302
203
+ * Fixed: TikTok embed video is not working in AMP #5325
204
+ * Fixed: lightbox for Youtube feature is not working properly #5327
205
+
206
  = 1.0.77.52 (14th October 2022) =
207
  * Fixed: Duplicate canonical URL when AIOSEO Pro is active. #5320
208
  * Fixed: Youtube embedded videos via elementor is not displaying in the AMP version #5322
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.77.52
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.77.52');
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.77.53
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.77.53');
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,11 @@
1
  == Changelog ==
2
 
 
 
 
 
 
 
3
  = 1.0.77.52 (14th October 2022) =
4
  * Fixed: Duplicate canonical URL when AIOSEO Pro is active. #5320
5
  * Fixed: Youtube embedded videos via elementor is not displaying in the AMP version #5322
1
  == Changelog ==
2
 
3
+ = 1.0.77.53 (25th October 2022) =
4
+ * Fixed: Backslash in custom css error #5329
5
+ * Fixed: If we enable the Responsive ad option then no need to show size option. #5302
6
+ * Fixed: TikTok embed video is not working in AMP #5325
7
+ * Fixed: lightbox for Youtube feature is not working properly #5327
8
+
9
  = 1.0.77.52 (14th October 2022) =
10
  * Fixed: Duplicate canonical URL when AIOSEO Pro is active. #5320
11
  * Fixed: Youtube embedded videos via elementor is not displaying in the AMP version #5322
includes/options/redux-core/assets/js/redux.js CHANGED
@@ -1948,4 +1948,33 @@ function redux_hook( object, functionName, callback, before ) {
1948
  return returnValue;
1949
  };
1950
  }( object[functionName] ));
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1951
  }
1948
  return returnValue;
1949
  };
1950
  }( object[functionName] ));
1951
+ }
1952
+
1953
+ jQuery('.checkbox-input').change(function(){
1954
+ var id=jQuery(this).attr('id');
1955
+ var val=jQuery('#'+id).val();
1956
+ let cusregex = /enable-amp-ads-resp-\d+/;
1957
+ if(cusregex.test(id))
1958
+ {
1959
+ let ad_id=id.match(/(\d+)/);
1960
+ if(val==1)
1961
+ {
1962
+ jQuery('#enable-amp-ads-select-'+ad_id[0]+'-select').parent().parent().parent().hide();
1963
+ }
1964
+ else{
1965
+ jQuery('#enable-amp-ads-select-'+ad_id[0]+'-select').parent().parent().parent().show();
1966
+ }
1967
+
1968
+ }
1969
+ })
1970
+ if(jQuery('#enable-amp-ads-resp-1').length)
1971
+ {
1972
+ for(var i=1;i<=8;i++)
1973
+ {
1974
+ if(jQuery('#enable-amp-ads-resp-'+i).length && jQuery('#enable-amp-ads-resp-'+i).val()==1)
1975
+ {
1976
+ jQuery('#enable-amp-ads-select-'+i+'-select').parent().parent().parent().hide();
1977
+ }
1978
+
1979
+ }
1980
  }
includes/options/redux-core/framework.php CHANGED
@@ -2846,8 +2846,12 @@
2846
 
2847
  $values = $values[ $redux->args['opt_name'] ];
2848
 
 
 
2849
  $values = array_map( 'stripslashes_deep', $values );
2850
 
 
 
2851
  if ( ! empty ( $values ) ) {
2852
 
2853
  try {
2846
 
2847
  $values = $values[ $redux->args['opt_name'] ];
2848
 
2849
+ // Saving a copy of global css
2850
+ $tmp_css_editor = $values['css_editor'];
2851
  $values = array_map( 'stripslashes_deep', $values );
2852
 
2853
+ // fixing backslash not saving in global css #5329
2854
+ $values['css_editor'] = $tmp_css_editor;
2855
  if ( ! empty ( $values ) ) {
2856
 
2857
  try {
includes/vendor/amp/includes/class-amp-post-template.php CHANGED
@@ -42,6 +42,7 @@ require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-pinterest-embed.p
42
  require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-wistia-embed.php' );
43
  require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-core-block-handler.php' );
44
  require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-playlist-embed-handler.php' );
 
45
 
46
  if ( file_exists( AMPFORWP_PLUGIN_DIR .'includes/vendor/css-parser/autoload.php' ) ) {
47
  require_once AMPFORWP_PLUGIN_DIR .'includes/vendor/css-parser/autoload.php';
@@ -290,7 +291,6 @@ class AMP_Post_Template {
290
  $new_post_content = '';
291
  // #2001 Filter to remove the unused JS from the paginated post
292
  $new_post_content = apply_filters( 'ampforwp_post_content_filter', $new_post_content );
293
- $new_post_content .= $this->ampforwp_tiktok_video_support($new_post_content);
294
 
295
  $amp_content = new AMP_Content( $new_post_content,
296
  apply_filters( 'amp_content_embed_handlers', array(
@@ -308,6 +308,7 @@ class AMP_Post_Template {
308
  'AMP_Gallery_Embed_Handler' => array(),
309
  'AMP_Playlist_Embed_Handler' => array(),
310
  'AMP_Wistia_Embed_Handler' => array(),
 
311
  ), $this->post ),
312
  apply_filters( 'amp_content_sanitizers', array(
313
  'AMP_Style_Sanitizer' => array(),
@@ -348,16 +349,6 @@ class AMP_Post_Template {
348
  $this->add_data_by_key( 'post_amp_styles', array() );
349
  }
350
  }
351
- public function ampforwp_tiktok_video_support($content){
352
- if(preg_match('/<blockquote(.*?)(https?:\/\/(?:www\.)?(?:tiktok\.com\/@(.*?)\/video\/\d+))(.*?)data-video-id="(.*?)"(.*?)<\/blockquote>/i', $content,$matches)){
353
- if(isset($matches[5])){
354
- $src = 'https://www.tiktok.com/embed/v2/'.$matches[5].'?lang=en-US';
355
- $iframe = '<iframe src="'.esc_url_raw($src).'" width="375" height="820" allow="fullscreen"></iframe>';
356
- $content = preg_replace('/<blockquote(.*?)(https?:\/\/(?:www\.)?(?:tiktok\.com\/@(.*?)\/video\/\d+))(.*?)data-video-id="(.*?)"(.*?)<\/blockquote>/i', $iframe, $content);
357
- }
358
- return $content;
359
- }
360
- }
361
 
362
  private function build_post_featured_image() {
363
  $post_id = $this->ID;
42
  require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-wistia-embed.php' );
43
  require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-core-block-handler.php' );
44
  require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-playlist-embed-handler.php' );
45
+ require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-tiktok-embed.php' );
46
 
47
  if ( file_exists( AMPFORWP_PLUGIN_DIR .'includes/vendor/css-parser/autoload.php' ) ) {
48
  require_once AMPFORWP_PLUGIN_DIR .'includes/vendor/css-parser/autoload.php';
291
  $new_post_content = '';
292
  // #2001 Filter to remove the unused JS from the paginated post
293
  $new_post_content = apply_filters( 'ampforwp_post_content_filter', $new_post_content );
 
294
 
295
  $amp_content = new AMP_Content( $new_post_content,
296
  apply_filters( 'amp_content_embed_handlers', array(
308
  'AMP_Gallery_Embed_Handler' => array(),
309
  'AMP_Playlist_Embed_Handler' => array(),
310
  'AMP_Wistia_Embed_Handler' => array(),
311
+ 'AMP_Tiktok_Embed_Handler'=>array(),
312
  ), $this->post ),
313
  apply_filters( 'amp_content_sanitizers', array(
314
  'AMP_Style_Sanitizer' => array(),
349
  $this->add_data_by_key( 'post_amp_styles', array() );
350
  }
351
  }
 
 
 
 
 
 
 
 
 
 
352
 
353
  private function build_post_featured_image() {
354
  $post_id = $this->ID;
includes/vendor/amp/includes/embeds/class-amp-tiktok-embed.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ namespace AMPforWP\AMPVendor;
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+ require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-base-embed-handler.php' );
7
+
8
+ class AMP_Tiktok_Embed_Handler extends AMP_Base_Embed_Handler {
9
+ const URL_PATTERN = '#https?://(www\.)?tiktok\.com\/@.*?\/video\/(\d+)#i';
10
+
11
+ protected $DEFAULT_WIDTH = 325;
12
+ protected $DEFAULT_HEIGHT = 575;
13
+
14
+ private static $script_slug = 'amp-tiktok-page';
15
+ private static $script_src = 'https://cdn.ampproject.org/v0/amp-tiktok-0.1.js';
16
+
17
+ public function register_embed() {
18
+ wp_embed_register_handler( 'amp-tiktok-page', self::URL_PATTERN, array( $this, 'oembed' ), -1 );
19
+ }
20
+
21
+ public function unregister_embed() {
22
+ wp_embed_unregister_handler( 'amp-tiktok-page', -1 );
23
+ }
24
+
25
+ public function get_scripts() {
26
+ if ( ! $this->did_convert_elements ) {
27
+ return array();
28
+ }
29
+
30
+ return array( self::$script_slug => self::$script_src );
31
+ }
32
+
33
+ public function oembed( $matches, $attr, $url, $rawattr ) {
34
+ $src=isset($matches[2])?$matches[2]:'';
35
+ return $this->render( array( 'src' => $src ) );
36
+ }
37
+
38
+ public function render( $args ) {
39
+ $args = wp_parse_args( $args, array(
40
+ 'src' => false,
41
+ ) );
42
+
43
+ if ( empty( $args['src'] ) ) {
44
+ return '';
45
+ }
46
+
47
+ $this->did_convert_elements = true;
48
+ $attrs = array(
49
+ 'data-src' => $args['src'],
50
+ 'width' => $this->args['width'],
51
+ 'height' => $this->args['height'],
52
+ );
53
+ $attrs = ampforwp_amp_consent_check( $attrs );
54
+ return AMP_HTML_Utils::build_tag('amp-tiktok',$attrs);
55
+ }
56
+ }
includes/vendor/vendor-changelog.txt CHANGED
@@ -97,4 +97,5 @@ Reason: To extend the functionality of sidebars and Pagebuilder
97
  67. Whitelisted Picture tag #4051
98
  68. Improvement in input type #4289
99
  69. Fixed $url to render function in class-amp-Dailymotion-embed.php line 72
100
- 70. Checking for $post->ID and $post->post_type since dynamically generated pages does not have these value set (amp-helper-functions.php from line 27) #5323
 
97
  67. Whitelisted Picture tag #4051
98
  68. Improvement in input type #4289
99
  69. Fixed $url to render function in class-amp-Dailymotion-embed.php line 72
100
+ 70. Checking for $post->ID and $post->post_type since dynamically generated pages does not have these value set (amp-helper-functions.php from line 27) #5323
101
+ 71. Added new file for tiktok embeds class-amp-tikok-embed.php and removed old code for tiktok bed #5325
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: 6.0
7
- Stable tag: 1.0.77.52
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -194,6 +194,12 @@ You can contact us from [here](https://ampforwp.com/contact/)
194
 
195
  == Changelog ==
196
 
 
 
 
 
 
 
197
  = 1.0.77.52 (14th October 2022) =
198
  * Fixed: Duplicate canonical URL when AIOSEO Pro is active. #5320
199
  * Fixed: Youtube embedded videos via elementor is not displaying in the AMP version #5322
4
  Donate link: https://www.paypal.me/Kaludi/25
5
  Requires at least: 3.0
6
  Tested up to: 6.0
7
+ Stable tag: 1.0.77.53
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
194
 
195
  == Changelog ==
196
 
197
+ = 1.0.77.53 (25th October 2022) =
198
+ * Fixed: Backslash in custom css error #5329
199
+ * Fixed: If we enable the Responsive ad option then no need to show size option. #5302
200
+ * Fixed: TikTok embed video is not working in AMP #5325
201
+ * Fixed: lightbox for Youtube feature is not working properly #5327
202
+
203
  = 1.0.77.52 (14th October 2022) =
204
  * Fixed: Duplicate canonical URL when AIOSEO Pro is active. #5320
205
  * Fixed: Youtube embedded videos via elementor is not displaying in the AMP version #5322
templates/custom-amp-content.php CHANGED
@@ -55,6 +55,7 @@ function ampforwp_custom_post_content_sanitizer( $data, $post ) {
55
  'AMP_Pinterest_Embed_Handler' => array(),
56
  'AMP_Gallery_Embed_Handler' => array(),
57
  'AMP_Playlist_Embed_Handler' => array(),
 
58
  ) ),
59
  apply_filters( 'amp_content_sanitizers', array(
60
  'AMP_Style_Sanitizer' => array(),
55
  'AMP_Pinterest_Embed_Handler' => array(),
56
  'AMP_Gallery_Embed_Handler' => array(),
57
  'AMP_Playlist_Embed_Handler' => array(),
58
+ 'AMP_Tiktok_Embed_Handler'=>array(),
59
  ) ),
60
  apply_filters( 'amp_content_sanitizers', array(
61
  'AMP_Style_Sanitizer' => array(),
templates/features.php CHANGED
@@ -3328,6 +3328,7 @@ function ampforwp_content_sanitizer( $content ) {
3328
  'AMP_Vine_Embed_Handler' => array(),
3329
  'AMP_Facebook_Embed_Handler' => array(),
3330
  'AMP_Gallery_Embed_Handler' => array(),
 
3331
  ) ),
3332
  apply_filters( 'amp_content_sanitizers', array(
3333
  'AMP_Style_Sanitizer' => array(),
@@ -3848,6 +3849,7 @@ function ampforwp_generate_pagebuilder_data() {
3848
  'AMP_Vine_Embed_Handler' => array(),
3849
  'AMP_Facebook_Embed_Handler' => array(),
3850
  'AMP_Gallery_Embed_Handler' => array(),
 
3851
  ) ),
3852
  apply_filters( 'amp_content_sanitizers', array(
3853
  'AMP_Style_Sanitizer' => array(),
@@ -4115,6 +4117,7 @@ function ampforwp_post_pagination( $args = '' ) {
4115
  'AMP_Pinterest_Embed_Handler' => array(),
4116
  'AMP_Gallery_Embed_Handler' => array(),
4117
  'AMP_Playlist_Embed_Handler' => array(),
 
4118
  ) ),
4119
  apply_filters( 'amp_content_sanitizers', array(
4120
  'AMP_Style_Sanitizer' => array(),
@@ -4311,6 +4314,7 @@ function ampforwp_post_paginated_content($content){
4311
  'AMP_Pinterest_Embed_Handler' => array(),
4312
  'AMP_Gallery_Embed_Handler' => array(),
4313
  'AMP_Playlist_Embed_Handler' => array(),
 
4314
  ) ),
4315
  apply_filters( 'amp_content_sanitizers', array(
4316
  'AMP_Style_Sanitizer' => array(),
@@ -7261,6 +7265,7 @@ function ampforwp_comments_sanitizer(){
7261
  'AMP_Facebook_Embed_Handler' => array(),
7262
  'AMP_Pinterest_Embed_Handler' => array(),
7263
  'AMP_Gallery_Embed_Handler' => array(),
 
7264
  ) ), apply_filters( 'amp_sidebar_sanitizers', array(
7265
  'AMP_Style_Sanitizer' => array(),
7266
  'AMP_Blacklist_Sanitizer' => array(),
@@ -8847,6 +8852,8 @@ if(!function_exists('ampforwp_add_fallback_element')){
8847
  return $content;
8848
  }
8849
  }
 
 
8850
  // added fix for youtube video not displaying on AMP using Elementor #5322
8851
  add_filter('ampforwp_modify_the_content','amp_youtube_the_content');
8852
 
@@ -8858,10 +8865,24 @@ function amp_youtube_the_content($content){
8858
  $video_attr = json_decode($video);
8859
  $get_url = $video_attr->youtube_url;
8860
  $get_id = get_video_id_from_url($get_url);
8861
- $content_html = preg_replace('/<div\s+class="(.*?)elementor-widget-video"(.*?)data-settings=\'(.*?)\'\sdata-widget_type="video.default">/','<amp-youtube
8862
- data-videoid="'.esc_attr($get_id).'"
8863
- layout="responsive"
8864
- width="480" height="270"></amp-youtube>', $content);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8865
  return $content_html;
8866
  }
8867
  }
@@ -8910,7 +8931,6 @@ function amp_youtube_the_content($content){
8910
  return $video_id;
8911
  }
8912
 
8913
-
8914
  if(!function_exists('ampforwp_imagify_webp_compatibility')){
8915
  function ampforwp_imagify_webp_compatibility($content){
8916
  if(function_exists('_imagify_init')){
3328
  'AMP_Vine_Embed_Handler' => array(),
3329
  'AMP_Facebook_Embed_Handler' => array(),
3330
  'AMP_Gallery_Embed_Handler' => array(),
3331
+ 'AMP_Tiktok_Embed_Handler'=>array(),
3332
  ) ),
3333
  apply_filters( 'amp_content_sanitizers', array(
3334
  'AMP_Style_Sanitizer' => array(),
3849
  'AMP_Vine_Embed_Handler' => array(),
3850
  'AMP_Facebook_Embed_Handler' => array(),
3851
  'AMP_Gallery_Embed_Handler' => array(),
3852
+ 'AMP_Tiktok_Embed_Handler'=>array(),
3853
  ) ),
3854
  apply_filters( 'amp_content_sanitizers', array(
3855
  'AMP_Style_Sanitizer' => array(),
4117
  'AMP_Pinterest_Embed_Handler' => array(),
4118
  'AMP_Gallery_Embed_Handler' => array(),
4119
  'AMP_Playlist_Embed_Handler' => array(),
4120
+ 'AMP_Tiktok_Embed_Handler'=>array(),
4121
  ) ),
4122
  apply_filters( 'amp_content_sanitizers', array(
4123
  'AMP_Style_Sanitizer' => array(),
4314
  'AMP_Pinterest_Embed_Handler' => array(),
4315
  'AMP_Gallery_Embed_Handler' => array(),
4316
  'AMP_Playlist_Embed_Handler' => array(),
4317
+ 'AMP_Tiktok_Embed_Handler'=>array(),
4318
  ) ),
4319
  apply_filters( 'amp_content_sanitizers', array(
4320
  'AMP_Style_Sanitizer' => array(),
7265
  'AMP_Facebook_Embed_Handler' => array(),
7266
  'AMP_Pinterest_Embed_Handler' => array(),
7267
  'AMP_Gallery_Embed_Handler' => array(),
7268
+ 'AMP_Tiktok_Embed_Handler'=>array(),
7269
  ) ), apply_filters( 'amp_sidebar_sanitizers', array(
7270
  'AMP_Style_Sanitizer' => array(),
7271
  'AMP_Blacklist_Sanitizer' => array(),
8852
  return $content;
8853
  }
8854
  }
8855
+
8856
+
8857
  // added fix for youtube video not displaying on AMP using Elementor #5322
8858
  add_filter('ampforwp_modify_the_content','amp_youtube_the_content');
8859
 
8865
  $video_attr = json_decode($video);
8866
  $get_url = $video_attr->youtube_url;
8867
  $get_id = get_video_id_from_url($get_url);
8868
+ if(ampforwp_get_setting('ampforwp-amp-video-lightbox')==true)
8869
+ {
8870
+ $content_html=preg_replace('/<div\s+class="(.*?)elementor-widget-video"(.*?)data-settings=\'(.*?)\'\sdata-widget_type="video.default">/','<amp-lightbox id="open-video'.esc_attr($get_id).'" layout="nodisplay">
8871
+ <div class="amp-lightbox-video" on="tap:open-video'.esc_attr($get_id).'.close,btn-play'.esc_attr($get_id).'.show" role="button" aria-label="Close Video">
8872
+ <div class="amp-video-box"><amp-youtube data-videoid="'.esc_attr($get_id).'" layout="responsive" width="480" height="270"></amp-youtube></div></div></amp-lightbox>
8873
+ <div class="amp-video-img" id="btn-play'.esc_attr($get_id).'" on="tap:video.show, video.play, btn-play'.esc_attr($get_id).'.hide,open-video'.esc_attr($get_id).'" role="button" aria-label="Play Video">
8874
+ <amp-img alt="Video" src="http://i3.ytimg.com/vi/'.esc_attr($get_id).'/hqdefault.jpg" width="480" height="270" layout="responsive"></amp-img>
8875
+ <div class="amp-video-play-on-image"></div>
8876
+ </div>', $content);
8877
+
8878
+ }
8879
+ else
8880
+ {
8881
+ $content_html = preg_replace('/<div\s+class="(.*?)elementor-widget-video"(.*?)data-settings=\'(.*?)\'\sdata-widget_type="video.default">/','<amp-youtube
8882
+ data-videoid="'.esc_attr($get_id).'"
8883
+ layout="responsive"
8884
+ width="480" height="270"></amp-youtube>', $content);
8885
+ }
8886
  return $content_html;
8887
  }
8888
  }
8931
  return $video_id;
8932
  }
8933
 
 
8934
  if(!function_exists('ampforwp_imagify_webp_compatibility')){
8935
  function ampforwp_imagify_webp_compatibility($content){
8936
  if(function_exists('_imagify_init')){
templates/template-mode/template-mode.php CHANGED
@@ -627,6 +627,7 @@ Class AMPforWP_theme_mode{
627
  'AMP_Gallery_Embed_Handler' => array(),
628
  'AMP_Playlist_Embed_Handler' => array(),
629
  'AMP_Wistia_Embed_Handler' => array(),
 
630
  ) ),
631
  apply_filters( 'amp_content_sanitizers_template_mode', array(
632
  'AMP_Style_Sanitizer' => array(),
627
  'AMP_Gallery_Embed_Handler' => array(),
628
  'AMP_Playlist_Embed_Handler' => array(),
629
  'AMP_Wistia_Embed_Handler' => array(),
630
+ 'AMP_Tiktok_Embed_Handler'=>array(),
631
  ) ),
632
  apply_filters( 'amp_content_sanitizers_template_mode', array(
633
  'AMP_Style_Sanitizer' => array(),