Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/accelera.../classes
File: class-ampforwp-rev-slider.php
<?php
[0] Fix | Delete
if ( ! defined( 'ABSPATH' ) ) {
[1] Fix | Delete
exit;
[2] Fix | Delete
}
[3] Fix | Delete
/*
[4] Fix | Delete
Most of the code is taken from class-amp-gallery-embed.php and Slider Revolution https://revolution.themepunch.com/
[5] Fix | Delete
*/
[6] Fix | Delete
require_once( AMP__VENDOR__DIR__ . '/includes/embeds/class-amp-base-embed-handler.php' );
[7] Fix | Delete
[8] Fix | Delete
class AMP_Rev_Slider_Embed_Handler extends AMPforWP\AMPVendor\AMP_Base_Embed_Handler {
[9] Fix | Delete
private static $script_slug = 'amp-carousel';
[10] Fix | Delete
private static $script_src = 'https://cdn.ampproject.org/v0/amp-carousel-0.2.js';
[11] Fix | Delete
[12] Fix | Delete
public function register_embed() {
[13] Fix | Delete
add_shortcode( 'rev_slider', array( $this, 'shortcode' ) );
[14] Fix | Delete
}
[15] Fix | Delete
[16] Fix | Delete
public function unregister_embed() {
[17] Fix | Delete
remove_shortcode( 'rev_slider' );
[18] Fix | Delete
}
[19] Fix | Delete
[20] Fix | Delete
public function get_scripts() {
[21] Fix | Delete
if ( ! $this->did_convert_elements ) {
[22] Fix | Delete
return array();
[23] Fix | Delete
}
[24] Fix | Delete
[25] Fix | Delete
return array( self::$script_slug => self::$script_src );
[26] Fix | Delete
}
[27] Fix | Delete
[28] Fix | Delete
public function shortcode( $args, $mid_content = null ) {
[29] Fix | Delete
global $post,$revSliderVersion;
[30] Fix | Delete
extract(shortcode_atts(array('alias' => ''), $args, 'rev_slider'));
[31] Fix | Delete
extract(shortcode_atts(array('settings' => ''), $args, 'rev_slider'));
[32] Fix | Delete
extract(shortcode_atts(array('order' => ''), $args, 'rev_slider'));
[33] Fix | Delete
// Below version 6.0
[34] Fix | Delete
if( !empty($revSliderVersion) && 6 > $revSliderVersion ){
[35] Fix | Delete
if($settings !== '') $settings = json_decode(str_replace(array('({', '})', "'"), array('[', ']', '"'), $settings) ,true);
[36] Fix | Delete
if($order !== '') $order = explode(',', $order);
[37] Fix | Delete
[38] Fix | Delete
$sliderAlias = ($alias != '') ? $alias : RevSliderFunctions::getVal($args,0);
[39] Fix | Delete
$gal_ids = RevSliderFunctionsWP::check_for_shortcodes($mid_content);
[40] Fix | Delete
ob_start();
[41] Fix | Delete
if(!empty($gal_ids)){ //add a gallery based slider
[42] Fix | Delete
$slider = RevSliderOutput::putSlider($sliderAlias, '', $gal_ids);
[43] Fix | Delete
}else{
[44] Fix | Delete
$slider = RevSliderOutput::putSlider($sliderAlias, '', array(), $settings, $order);
[45] Fix | Delete
}
[46] Fix | Delete
$content = ob_get_contents();
[47] Fix | Delete
ob_clean();
[48] Fix | Delete
ob_end_clean();
[49] Fix | Delete
$ids = array();
[50] Fix | Delete
$slides = $slider->getSlidesForOutput(true,'',$gal_ids);
[51] Fix | Delete
foreach ($slides as $slide) {
[52] Fix | Delete
$bgtype = $slide->getParam('background_type', 'image');
[53] Fix | Delete
$img_data = wp_get_attachment_metadata( $slide->getImageID() );
[54] Fix | Delete
[55] Fix | Delete
if($bgtype == 'external'){
[56] Fix | Delete
$url = esc_url($slide->getParam('slide_bg_external', ''));
[57] Fix | Delete
$imgalt = esc_attr($slide->getParam('alt_attr', ''));
[58] Fix | Delete
$img_title = esc_attr($slide->getParam('title_attr', ''));
[59] Fix | Delete
$img_w = $slide->getParam('ext_width', '1920');
[60] Fix | Delete
$img_h = $slide->getParam('ext_height', '1080');
[61] Fix | Delete
$urls[] = apply_filters('amp_gallery_image_params', array(
[62] Fix | Delete
'url' => $url,
[63] Fix | Delete
'width' => intval($img_w),
[64] Fix | Delete
'height' => intval($img_h),
[65] Fix | Delete
'bgtype' => esc_attr($bgtype)
[66] Fix | Delete
),$attachment_id);
[67] Fix | Delete
}elseif( $bgtype == 'image'){
[68] Fix | Delete
$img_data = wp_get_attachment_metadata( $slide->getImageID() );
[69] Fix | Delete
$url = $slide->getImageUrl();
[70] Fix | Delete
$attachment_id = $slide->getImageID();
[71] Fix | Delete
$width = 480;
[72] Fix | Delete
$height = 270;
[73] Fix | Delete
if(isset($img_data['width'])){
[74] Fix | Delete
$width = $img_data['width'];
[75] Fix | Delete
}
[76] Fix | Delete
if(isset($img_data['height'])){
[77] Fix | Delete
$height = $img_data['height'];
[78] Fix | Delete
}
[79] Fix | Delete
$urls[] = apply_filters('amp_gallery_image_params', array(
[80] Fix | Delete
'url' => $url,
[81] Fix | Delete
'width' => intval($width),
[82] Fix | Delete
'height' => intval($height),
[83] Fix | Delete
'bgtype' => esc_attr($bgtype)
[84] Fix | Delete
),$attachment_id);
[85] Fix | Delete
}elseif( $bgtype == 'youtube' ){
[86] Fix | Delete
$youtube_id = $slide->getParam('slide_bg_youtube', '');
[87] Fix | Delete
$cover_img = $slide->getImageUrl();
[88] Fix | Delete
$urls[] = apply_filters('amp_gallery_image_params', array(
[89] Fix | Delete
'url' => $youtube_id,
[90] Fix | Delete
'width' => '480',
[91] Fix | Delete
'height' => '270',
[92] Fix | Delete
'bgtype' => esc_attr($bgtype),
[93] Fix | Delete
'cover_img' => $cover_img
[94] Fix | Delete
),$attachment_id);
[95] Fix | Delete
}
[96] Fix | Delete
}
[97] Fix | Delete
}
[98] Fix | Delete
// Version 6.0+
[99] Fix | Delete
elseif ( defined('RS_REVISION') && 6.0 <= RS_REVISION ) {
[100] Fix | Delete
extract(shortcode_atts(array('alias' => ''), $args, 'rev_slider'));
[101] Fix | Delete
extract(shortcode_atts(array('settings' => ''), $args, 'rev_slider'));
[102] Fix | Delete
extract(shortcode_atts(array('order' => ''), $args, 'rev_slider'));
[103] Fix | Delete
extract(shortcode_atts(array('usage' => ''), $args, 'rev_slider'));
[104] Fix | Delete
$output = new RevSliderOutput();
[105] Fix | Delete
$slider_alias = ($alias != '') ? $alias : $output->get_val($args, 0); //backwards compatibility
[106] Fix | Delete
[107] Fix | Delete
$output->set_custom_order($order);
[108] Fix | Delete
$output->set_custom_settings($settings);
[109] Fix | Delete
[110] Fix | Delete
$gallery_ids = $output->check_for_shortcodes($mid_content); //check for example on gallery shortcode and do stuff
[111] Fix | Delete
if($gallery_ids !== false) $output->set_gallery_ids($gallery_ids);
[112] Fix | Delete
[113] Fix | Delete
ob_start();
[114] Fix | Delete
$slider = $output->add_slider_to_stage($slider_alias, $usage);
[115] Fix | Delete
$content = ob_get_contents();
[116] Fix | Delete
ob_clean();
[117] Fix | Delete
ob_end_clean();
[118] Fix | Delete
$slides = $slider->get_slides_for_output(true,'',$gallery_ids);
[119] Fix | Delete
foreach ($slides as $slide) {
[120] Fix | Delete
$bgtype = $slide->get_param(array('bg', 'type'),'');
[121] Fix | Delete
$layers = $slide->getLayers();
[122] Fix | Delete
$image_id = $slide->image_id;
[123] Fix | Delete
$url = $slide->image_url;
[124] Fix | Delete
if ( $image_id ) {
[125] Fix | Delete
$img_data = wp_get_attachment_metadata( $image_id );
[126] Fix | Delete
}
[127] Fix | Delete
if( $bgtype == 'image' && !empty($layers) ){
[128] Fix | Delete
$width = 480;
[129] Fix | Delete
$height = 270;
[130] Fix | Delete
if(isset($img_data['width'])){
[131] Fix | Delete
$width = $img_data['width'];
[132] Fix | Delete
}
[133] Fix | Delete
if(isset($img_data['height'])){
[134] Fix | Delete
$height = $img_data['height'];
[135] Fix | Delete
}
[136] Fix | Delete
if(empty($layers)){
[137] Fix | Delete
$urls[] = apply_filters('amp_gallery_image_params', array(
[138] Fix | Delete
'url' => $url,
[139] Fix | Delete
'width' => intval($width),
[140] Fix | Delete
'height' => intval($height),
[141] Fix | Delete
'bgtype' => esc_attr($bgtype)
[142] Fix | Delete
),$image_id);
[143] Fix | Delete
}elseif(!empty($layers)){
[144] Fix | Delete
foreach ($layers as $key => $layer) {
[145] Fix | Delete
if($layer['type'] == 'text'){
[146] Fix | Delete
$text = $layer['text'];
[147] Fix | Delete
if(!empty($text)){
[148] Fix | Delete
$urls[] = apply_filters('amp_gallery_image_params', array(
[149] Fix | Delete
'url' => esc_attr($url),
[150] Fix | Delete
'width' => intval($width),
[151] Fix | Delete
'height' => intval($height),
[152] Fix | Delete
'caption' => $text,
[153] Fix | Delete
'bgtype' => esc_attr($bgtype)
[154] Fix | Delete
),$image_id);
[155] Fix | Delete
}
[156] Fix | Delete
}else{
[157] Fix | Delete
$urls[] = apply_filters('amp_gallery_image_params', array(
[158] Fix | Delete
'url' => $url,
[159] Fix | Delete
'width' => intval($width),
[160] Fix | Delete
'height' => intval($height),
[161] Fix | Delete
'bgtype' => esc_attr($bgtype)
[162] Fix | Delete
),$image_id);
[163] Fix | Delete
}
[164] Fix | Delete
}
[165] Fix | Delete
}
[166] Fix | Delete
}elseif($bgtype == 'external' || !empty($layers)){
[167] Fix | Delete
$url = esc_url($slide->get_param(array('bg','externalSrc'), ''));
[168] Fix | Delete
$imgalt = esc_attr($slide->get_param('alt_attr', ''));
[169] Fix | Delete
$img_title = esc_attr($slide->get_param('title_attr', ''));
[170] Fix | Delete
$img_w = $slide->get_param('ext_width', '1920');
[171] Fix | Delete
$img_h = $slide->get_param('ext_height', '1080');
[172] Fix | Delete
$urls[] = apply_filters('amp_gallery_image_params', array(
[173] Fix | Delete
'url' => $url,
[174] Fix | Delete
'width' => intval($img_w),
[175] Fix | Delete
'height' => intval($img_h),
[176] Fix | Delete
'bgtype' => esc_attr($bgtype)
[177] Fix | Delete
),$image_id);
[178] Fix | Delete
if(!empty($layers)){
[179] Fix | Delete
foreach ($layers as $key => $layer) {
[180] Fix | Delete
if($layer['type'] == 'video'){
[181] Fix | Delete
$video_url = esc_attr($layer['media']['mp4Url']);;
[182] Fix | Delete
$video_url = str_replace('http:','https:',$video_url);
[183] Fix | Delete
$cover_img = esc_attr($layer['media']['posterUrl']);
[184] Fix | Delete
$urls[] = apply_filters('amp_gallery_image_params', array(
[185] Fix | Delete
'url' => esc_url($video_url),
[186] Fix | Delete
'width' => '480',
[187] Fix | Delete
'height' => '270',
[188] Fix | Delete
'bgtype' => esc_attr($layer['type']),
[189] Fix | Delete
'cover_img' => esc_url($cover_img)
[190] Fix | Delete
),$image_id);
[191] Fix | Delete
}
[192] Fix | Delete
}
[193] Fix | Delete
}
[194] Fix | Delete
}elseif( $bgtype == 'image' || !empty($layers) ){
[195] Fix | Delete
$width = 480;
[196] Fix | Delete
$height = 270;
[197] Fix | Delete
if(isset($img_data['width'])){
[198] Fix | Delete
$width = $img_data['width'];
[199] Fix | Delete
}
[200] Fix | Delete
if(isset($img_data['height'])){
[201] Fix | Delete
$height = $img_data['height'];
[202] Fix | Delete
}
[203] Fix | Delete
$urls[] = apply_filters('amp_gallery_image_params', array(
[204] Fix | Delete
'url' => $url,
[205] Fix | Delete
'width' => intval($width),
[206] Fix | Delete
'height' => intval($height),
[207] Fix | Delete
'bgtype' => esc_attr($bgtype)
[208] Fix | Delete
),$image_id);
[209] Fix | Delete
if(!empty($layers)){
[210] Fix | Delete
foreach ($layers as $key => $layer) {
[211] Fix | Delete
if($layer['type'] == 'video'){
[212] Fix | Delete
$video_url = esc_attr($layer['media']['mp4Url']);;
[213] Fix | Delete
$video_url = str_replace('http:','https:',$video_url);
[214] Fix | Delete
$cover_img = esc_attr($layer['media']['posterUrl']);
[215] Fix | Delete
$urls[] = apply_filters('amp_gallery_image_params', array(
[216] Fix | Delete
'url' => esc_url($video_url),
[217] Fix | Delete
'width' => '480',
[218] Fix | Delete
'height' => '270',
[219] Fix | Delete
'bgtype' => esc_attr($layer['type']),
[220] Fix | Delete
'cover_img' => esc_url($cover_img)
[221] Fix | Delete
),$image_id);
[222] Fix | Delete
}
[223] Fix | Delete
}
[224] Fix | Delete
}
[225] Fix | Delete
}elseif( $bgtype == 'youtube' || !empty($layers) ){
[226] Fix | Delete
$youtube_id = $slide->get_param(array('bg','youtube'), '');
[227] Fix | Delete
$cover_img = $slide->get_param(array('bg','image'), '');
[228] Fix | Delete
$urls[] = apply_filters('amp_gallery_image_params', array(
[229] Fix | Delete
'url' => esc_attr($youtube_id),
[230] Fix | Delete
'width' => '480',
[231] Fix | Delete
'height' => '270',
[232] Fix | Delete
'bgtype' => esc_attr($bgtype),
[233] Fix | Delete
'cover_img' => esc_attr($cover_img)
[234] Fix | Delete
),$image_id);
[235] Fix | Delete
if(!empty($layers)){
[236] Fix | Delete
foreach ($layers as $key => $layer) {
[237] Fix | Delete
if($layer['type'] == 'video'){
[238] Fix | Delete
$video_url = esc_attr($layer['media']['mp4Url']);;
[239] Fix | Delete
$video_url = str_replace('http:','https:',$video_url);
[240] Fix | Delete
$cover_img = esc_attr($layer['media']['posterUrl']);
[241] Fix | Delete
$urls[] = apply_filters('amp_gallery_image_params', array(
[242] Fix | Delete
'url' => esc_url($video_url),
[243] Fix | Delete
'width' => '480',
[244] Fix | Delete
'height' => '270',
[245] Fix | Delete
'bgtype' => esc_attr($layer['type']),
[246] Fix | Delete
'cover_img' => esc_url($cover_img)
[247] Fix | Delete
),$image_id);
[248] Fix | Delete
}
[249] Fix | Delete
}
[250] Fix | Delete
}
[251] Fix | Delete
}elseif( $bgtype == 'vimeo' || !empty($layers) ){
[252] Fix | Delete
$vimeo_id = $slide->get_param(array('bg','vimeo'), '');
[253] Fix | Delete
$cover_img = $slide->get_param(array('bg','image'), '');
[254] Fix | Delete
$urls[] = apply_filters('amp_gallery_image_params', array(
[255] Fix | Delete
'url' => esc_attr($vimeo_id),
[256] Fix | Delete
'width' => '480',
[257] Fix | Delete
'height' => '270',
[258] Fix | Delete
'bgtype' => esc_attr($bgtype),
[259] Fix | Delete
'cover_img' => esc_attr($cover_img)
[260] Fix | Delete
),$image_id);
[261] Fix | Delete
if(!empty($layers)){
[262] Fix | Delete
foreach ($layers as $key => $layer) {
[263] Fix | Delete
if($layer['type'] == 'video'){
[264] Fix | Delete
$video_url = esc_attr($layer['media']['mp4Url']);;
[265] Fix | Delete
$video_url = str_replace('http:','https:',$video_url);
[266] Fix | Delete
$cover_img = esc_attr($layer['media']['posterUrl']);
[267] Fix | Delete
$urls[] = apply_filters('amp_gallery_image_params', array(
[268] Fix | Delete
'url' => esc_url($video_url),
[269] Fix | Delete
'width' => '480',
[270] Fix | Delete
'height' => '270',
[271] Fix | Delete
'bgtype' => esc_attr($layer['type']),
[272] Fix | Delete
'cover_img' => esc_url($cover_img)
[273] Fix | Delete
),$image_id);
[274] Fix | Delete
}
[275] Fix | Delete
}
[276] Fix | Delete
}
[277] Fix | Delete
}elseif($bgtype == 'html5' || !empty($layers)){
[278] Fix | Delete
$html5_url = $slide->get_param(array('bg','mpeg'), '');
[279] Fix | Delete
$html5_url = str_replace('http:','https:',$html5_url);
[280] Fix | Delete
$cover_img = $slide->get_param(array('bg','image'), '');
[281] Fix | Delete
$urls[] = apply_filters('amp_gallery_image_params', array(
[282] Fix | Delete
'url' => esc_url($html5_url),
[283] Fix | Delete
'width' => '480',
[284] Fix | Delete
'height' => '270',
[285] Fix | Delete
'bgtype' => esc_attr($bgtype),
[286] Fix | Delete
'cover_img' => esc_url($cover_img)
[287] Fix | Delete
),$image_id);
[288] Fix | Delete
if(!empty($layers)){
[289] Fix | Delete
foreach ($layers as $key => $layer) {
[290] Fix | Delete
if($layer['type'] == 'video'){
[291] Fix | Delete
$video_url = esc_attr($layer['media']['mp4Url']);;
[292] Fix | Delete
$video_url = str_replace('http:','https:',$video_url);
[293] Fix | Delete
$cover_img = esc_attr($layer['media']['posterUrl']);
[294] Fix | Delete
$urls[] = apply_filters('amp_gallery_image_params', array(
[295] Fix | Delete
'url' => esc_url($video_url),
[296] Fix | Delete
'width' => '480',
[297] Fix | Delete
'height' => '270',
[298] Fix | Delete
'bgtype' => esc_attr($layer['type']),
[299] Fix | Delete
'cover_img' => esc_url($cover_img)
[300] Fix | Delete
),$image_id);
[301] Fix | Delete
}
[302] Fix | Delete
}
[303] Fix | Delete
}
[304] Fix | Delete
}
[305] Fix | Delete
}
[306] Fix | Delete
}
[307] Fix | Delete
[308] Fix | Delete
$new_urls = array();
[309] Fix | Delete
[310] Fix | Delete
if(is_array($urls)){
[311] Fix | Delete
foreach ($urls as $k => $v) {
[312] Fix | Delete
$new_urls[implode($v)] = $v;
[313] Fix | Delete
}
[314] Fix | Delete
}
[315] Fix | Delete
[316] Fix | Delete
$new_urls = array_values($new_urls);
[317] Fix | Delete
[318] Fix | Delete
return $this->render( array(
[319] Fix | Delete
'images' => $new_urls,
[320] Fix | Delete
) );
[321] Fix | Delete
}
[322] Fix | Delete
[323] Fix | Delete
public function render( $args ) {
[324] Fix | Delete
global $redux_builder_amp,$carousel_markup_all;
[325] Fix | Delete
$this->did_convert_elements = true;
[326] Fix | Delete
[327] Fix | Delete
$args = wp_parse_args( $args, array(
[328] Fix | Delete
'images' => false,
[329] Fix | Delete
) );
[330] Fix | Delete
[331] Fix | Delete
if ( empty( $args['images'] ) ) {
[332] Fix | Delete
return '';
[333] Fix | Delete
}
[334] Fix | Delete
[335] Fix | Delete
/*Filter*/
[336] Fix | Delete
$carousel_markup = $amp_image_lightbox = '';
[337] Fix | Delete
[338] Fix | Delete
$carousel_markup_all = array(
[339] Fix | Delete
'1'=>array(
[340] Fix | Delete
'main-html'=>'{{with_carousel}}
[341] Fix | Delete
{{amp_image_lightbox}}',
[342] Fix | Delete
'image-with-caption-html'=>'<figure><div class="ampforwp-gallery-item amp-carousel-container">{{main_images}} </div><figcaption {{openbrack}}class{{closebrack}}="expanded? \'expanded\' : \'\'" on="tap:AMP.setState({expanded: !expanded})" tabindex="0" role="button" >{{main_images_caption}}<span {{openbrack}}text{{closebrack}}="expanded ? \'less\' : \'more\'">more</span> </figcaption></figure>',
[343] Fix | Delete
'image-without-caption-html' =>'<div class="ampforwp-gallery-item amp-carousel-container">{{main_images}} </div>',
[344] Fix | Delete
'gallery_css' => '.cls-btn{background:#0d0d0d;border:none;position: absolute;right: 10px;}
[345] Fix | Delete
.cls-btn:after{content:"X";display:inline-block;color:#fff;font-size:20px;padding:20px;}',
[346] Fix | Delete
[347] Fix | Delete
'scripts' => array()
[348] Fix | Delete
),
[349] Fix | Delete
'2' => array(
[350] Fix | Delete
'main-html'=>'{{with_carousel}}
[351] Fix | Delete
{{with_carousel_thumbnail}}
[352] Fix | Delete
{{amp_image_lightbox}}',
[353] Fix | Delete
'image-with-caption-html'=>'<figure><div class="ampforwp-gallery-item amp-carousel-container">{{main_images}} </div><figcaption {{openbrack}}class{{closebrack}}="expanded? \'expanded\' : \'\'" on="tap:AMP.setState({expanded: !expanded})" tabindex="0" role="button" >{{main_images_caption}}<span {{openbrack}}text{{closebrack}}="expanded ? \'less\' : \'more\'">more</span> </figcaption></figure>',
[354] Fix | Delete
'image-without-caption-html' =>'<div class="ampforwp-gallery-item amp-carousel-container">{{main_images}} </div>',
[355] Fix | Delete
'carousel_with_thumbnail_html'=>'<button on="tap:carousel-with-carousel-preview-{{unique_id}}.goToSlide(index={{unique_index}})" class="amp-carousel-slide amp-scrollable-carousel-slide">{{thumbnail}}</button>',
[356] Fix | Delete
'gallery_css' => '
[357] Fix | Delete
.cls-btn{background:#0d0d0d;border:none;position: absolute;right: 10px;}
[358] Fix | Delete
.cls-btn:after{content:"X";display:inline-block;color:#fff;font-size:20px;padding:20px;}
[359] Fix | Delete
.carousel-preview button{padding:0;}
[360] Fix | Delete
.carousel-preview amp-img{height:40px;width:60px;position:relative;}
[361] Fix | Delete
.carousel-preview {width: 100%;display: inline-block;text-align: center;margin: 20px 0px;}
[362] Fix | Delete
',
[363] Fix | Delete
'scripts' => array()
[364] Fix | Delete
),
[365] Fix | Delete
'3' => array(
[366] Fix | Delete
'main-html'=>'<div class="gal_w">{{with_images}}</div>
[367] Fix | Delete
{{amp_image_lightbox}}',
[368] Fix | Delete
'image-with-caption-html'=>'',
[369] Fix | Delete
'image-without-caption-html' =>'{{main_images}}',
[370] Fix | Delete
'gallery_css' => '
[371] Fix | Delete
.gal_w{display:inline-block;width:100%}
[372] Fix | Delete
.gal_w amp-img{background:#f1f1f1;height:134px;width:150px;position: relative;float:left;margin:10px;}
[373] Fix | Delete
.cls-btn{background:#0d0d0d;border:none;position: absolute;right: 10px;}
[374] Fix | Delete
.cls-btn:after{content:"X";display:inline-block;color:#fff;font-size:20px;padding:20px;}
[375] Fix | Delete
',
[376] Fix | Delete
'scripts' => array()
[377] Fix | Delete
),
[378] Fix | Delete
);
[379] Fix | Delete
[380] Fix | Delete
$carousel_markup_all = apply_filters("ampforwp_manage_gallery_markup", $carousel_markup_all);
[381] Fix | Delete
//Default markup
[382] Fix | Delete
$markup = $carousel_markup_all[1];
[383] Fix | Delete
[384] Fix | Delete
if( isset($redux_builder_amp['ampforwp-gallery-design-type']) && isset($carousel_markup_all[$redux_builder_amp['ampforwp-gallery-design-type'] ] ) ){
[385] Fix | Delete
$markup = $carousel_markup_all[$redux_builder_amp['ampforwp-gallery-design-type']];
[386] Fix | Delete
}
[387] Fix | Delete
[388] Fix | Delete
$amp_images = array();
[389] Fix | Delete
$tag_type = '';
[390] Fix | Delete
foreach ( $args['images'] as $key => $image ) {
[391] Fix | Delete
[392] Fix | Delete
$amp_img_arr = array();
[393] Fix | Delete
[394] Fix | Delete
if($image['bgtype'] =="image" || $image['bgtype'] =="external" ){
[395] Fix | Delete
$amp_img_arr = array(
[396] Fix | Delete
'src' => $image['url'],
[397] Fix | Delete
'width' => $image['width'],
[398] Fix | Delete
'height' => $image['height'],
[399] Fix | Delete
'layout' => 'fill',
[400] Fix | Delete
'class' => 'amp-carousel-img',
[401] Fix | Delete
);
[402] Fix | Delete
$tag_type = 'amp-img';
[403] Fix | Delete
}elseif( $image['bgtype'] =="youtube"){
[404] Fix | Delete
$amp_img_arr = array(
[405] Fix | Delete
'data-videoid'=> $image['url'],
[406] Fix | Delete
'width' => $image['width'],
[407] Fix | Delete
'height' => $image['height'],
[408] Fix | Delete
'layout'=>'responsive',
[409] Fix | Delete
'class' => 'amp-carousel-img',
[410] Fix | Delete
'data-param-playlist'=> $image['url'],
[411] Fix | Delete
'data-param-modestbranding'=> '1',
[412] Fix | Delete
'autoplay' => '',
[413] Fix | Delete
);
[414] Fix | Delete
$tag_type = 'amp-youtube';
[415] Fix | Delete
}elseif( $image['bgtype'] =="vimeo"){
[416] Fix | Delete
$amp_img_arr = array(
[417] Fix | Delete
'data-videoid'=> $image['url'],
[418] Fix | Delete
'width' => $image['width'],
[419] Fix | Delete
'height' => $image['height'],
[420] Fix | Delete
'layout'=>'responsive',
[421] Fix | Delete
'class' => 'amp-carousel-img',
[422] Fix | Delete
'autoplay' => '',
[423] Fix | Delete
);
[424] Fix | Delete
$tag_type = 'amp-vimeo';
[425] Fix | Delete
}elseif( $image['bgtype'] =="html5"){
[426] Fix | Delete
$amp_img_arr = array(
[427] Fix | Delete
'src'=> $image['url'],
[428] Fix | Delete
'width' => $image['width'],
[429] Fix | Delete
'height' => $image['height'],
[430] Fix | Delete
'layout'=>'responsive',
[431] Fix | Delete
'class' => 'amp-carousel-img',
[432] Fix | Delete
'poster' => $image['cover_img'],
[433] Fix | Delete
'controls' => '',
[434] Fix | Delete
'autoplay' => '',
[435] Fix | Delete
);
[436] Fix | Delete
$tag_type = 'amp-video';
[437] Fix | Delete
}
[438] Fix | Delete
elseif( $image['bgtype'] =="video"){
[439] Fix | Delete
$amp_img_arr = array(
[440] Fix | Delete
'src'=> $image['url'],
[441] Fix | Delete
'width' => $image['width'],
[442] Fix | Delete
'height' => $image['height'],
[443] Fix | Delete
'layout'=>'responsive',
[444] Fix | Delete
'class' => 'amp-carousel-img',
[445] Fix | Delete
'poster' => $image['cover_img'],
[446] Fix | Delete
'controls' => '',
[447] Fix | Delete
'autoplay' => '',
[448] Fix | Delete
);
[449] Fix | Delete
$tag_type = 'amp-video';
[450] Fix | Delete
}
[451] Fix | Delete
if( 3 == ampforwp_get_setting('ampforwp-gallery-design-type') || true == ampforwp_get_setting('ampforwp-gallery-lightbox') ){
[452] Fix | Delete
$design3_additional_attr = array('on'=> 'tap:gallery-lightbox', 'role'=>'button',
[453] Fix | Delete
'tabindex'=>$key);
[454] Fix | Delete
if( is_array($amp_img_arr) && !empty($amp_img_arr) ){
[455] Fix | Delete
$amp_img_arr = array_merge($amp_img_arr, $design3_additional_attr);
[456] Fix | Delete
}
[457] Fix | Delete
$amp_image_lightbox = '<amp-image-lightbox id="gallery-lightbox" layout="nodisplay">
[458] Fix | Delete
<div on="tap:gallery-lightbox.close" role="button"
[459] Fix | Delete
tabindex="0">
[460] Fix | Delete
<button class="cls-btn" on="tap:gallery-lightbox.close"
[461] Fix | Delete
role="button" tabindex="0"></button>
[462] Fix | Delete
</div>
[463] Fix | Delete
</amp-image-lightbox>';
[464] Fix | Delete
}
[465] Fix | Delete
$amp_images[$key] = AMP_HTML_Utils::build_tag(
[466] Fix | Delete
$tag_type,
[467] Fix | Delete
$amp_img_arr
[468] Fix | Delete
);
[469] Fix | Delete
[470] Fix | Delete
$upload_dir = wp_upload_dir();
[471] Fix | Delete
$upload_url = $upload_dir['baseurl'];
[472] Fix | Delete
if( $tag_type == 'amp-img'){
[473] Fix | Delete
if ( false === strpos( $image['url'], $upload_url ) ) {
[474] Fix | Delete
$smallimage = $image['url'];
[475] Fix | Delete
$smallwidth = 120;
[476] Fix | Delete
$smallheight = 60;
[477] Fix | Delete
}else{
[478] Fix | Delete
//Small Thumbnail Images
[479] Fix | Delete
$thumb_url = ampforwp_aq_resize( $image['url'], 120, 60, true, false ); //resize & crop the image
[480] Fix | Delete
if($thumb_url!=false){
[481] Fix | Delete
$smallimage = $thumb_url[0];
[482] Fix | Delete
$smallwidth = $thumb_url[1];
[483] Fix | Delete
$smallheight = $thumb_url[2];
[484] Fix | Delete
}else{
[485] Fix | Delete
$smallimage = $image['url'];
[486] Fix | Delete
$smallwidth = $image['width'];
[487] Fix | Delete
$smallheight = $image['height'];
[488] Fix | Delete
}
[489] Fix | Delete
}
[490] Fix | Delete
}elseif( $tag_type == 'amp-youtube'){
[491] Fix | Delete
$smallimage = $image['cover_img'];
[492] Fix | Delete
$smallwidth = 120;
[493] Fix | Delete
$smallheight = 60;
[494] Fix | Delete
}
[495] Fix | Delete
[496] Fix | Delete
$amp_images_small[$key] = AMP_HTML_Utils::build_tag(
[497] Fix | Delete
'amp-img',
[498] Fix | Delete
array(
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function