Edit File by line
/home/zeestwma/ajeebong.../wp-conte.../plugins/revslide.../admin/includes
File: export-html.sr7.class.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* @author ThemePunch <info@themepunch.com>
[2] Fix | Delete
* @link https://www.themepunch.com/
[3] Fix | Delete
* @copyright 2024 ThemePunch
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
if(!defined('ABSPATH')) exit();
[7] Fix | Delete
[8] Fix | Delete
class RevSliderSliderExportHtml extends RevSliderSliderExport {
[9] Fix | Delete
public $path_fonts = 'fonts/';
[10] Fix | Delete
public $path_css = 'public/css/';
[11] Fix | Delete
public $path_js = 'public/js/';
[12] Fix | Delete
public $path_assets = 'assets';
[13] Fix | Delete
public $path_assets_raw = 'assets';
[14] Fix | Delete
public $path_assets_vid = 'assets';
[15] Fix | Delete
public $path_assets_raw_vid = 'assets';
[16] Fix | Delete
public $json = '';
[17] Fix | Delete
public $slider;
[18] Fix | Delete
public $html_id;
[19] Fix | Delete
[20] Fix | Delete
public function __construct(){
[21] Fix | Delete
parent::__construct();
[22] Fix | Delete
}
[23] Fix | Delete
[24] Fix | Delete
[25] Fix | Delete
public function export_slider_html($slider_id){
[26] Fix | Delete
if($slider_id == 'empty_output'){
[27] Fix | Delete
echo __('Wrong request!', 'revslider');
[28] Fix | Delete
exit;
[29] Fix | Delete
}
[30] Fix | Delete
[31] Fix | Delete
$this->create_export_zip();
[32] Fix | Delete
[33] Fix | Delete
global $SR_GLOBALS;
[34] Fix | Delete
$SR_GLOBALS['use_table_version'] = 7;
[35] Fix | Delete
[36] Fix | Delete
$this->slider = new RevSliderSlider();
[37] Fix | Delete
$this->slider->init_by_id($slider_id);
[38] Fix | Delete
[39] Fix | Delete
if($this->slider->v7 === false){
[40] Fix | Delete
echo __('Not yet migrated to V7!', 'revslider');
[41] Fix | Delete
exit;
[42] Fix | Delete
}
[43] Fix | Delete
[44] Fix | Delete
if($this->slider->get_param('prem', false) === true && $this->_truefalse(get_option('revslider-valid', 'false')) === false){
[45] Fix | Delete
echo __('Wrong request!', 'revslider');
[46] Fix | Delete
exit;
[47] Fix | Delete
}
[48] Fix | Delete
[49] Fix | Delete
$this->slider = apply_filters('revslider_doing_html_export', $this->slider, $slider_id, $this);
[50] Fix | Delete
[51] Fix | Delete
$this->slider_title = $this->slider->get_title();
[52] Fix | Delete
$this->slider_alias = $this->slider->get_alias();
[53] Fix | Delete
$this->layouttype = $this->slider->get_param('layouttype');
[54] Fix | Delete
$this->slider_output = new RevSlider7Output();
[55] Fix | Delete
[56] Fix | Delete
ob_start();
[57] Fix | Delete
$this->slider_output->set_slider_id($slider_id);
[58] Fix | Delete
$this->slider_output->set_markup_export(true);
[59] Fix | Delete
$this->slider_output->add_slider_base();
[60] Fix | Delete
$this->slider_html = ob_get_contents();
[61] Fix | Delete
ob_clean();
[62] Fix | Delete
ob_end_clean();
[63] Fix | Delete
[64] Fix | Delete
ob_start();
[65] Fix | Delete
$this->write_header_html();
[66] Fix | Delete
$head = ob_get_contents();
[67] Fix | Delete
ob_clean();
[68] Fix | Delete
ob_end_clean();
[69] Fix | Delete
[70] Fix | Delete
ob_start();
[71] Fix | Delete
$this->write_footer_html();
[72] Fix | Delete
$footer = ob_get_contents();
[73] Fix | Delete
ob_clean();
[74] Fix | Delete
ob_end_clean();
[75] Fix | Delete
[76] Fix | Delete
ob_start();
[77] Fix | Delete
$this->slider_output->add_js();
[78] Fix | Delete
$additions = ob_get_contents();
[79] Fix | Delete
ob_clean();
[80] Fix | Delete
ob_end_clean();
[81] Fix | Delete
[82] Fix | Delete
$this->slider_html = $head . "\n" . $this->slider_html . "\n" . $additions . "\n" . $footer;
[83] Fix | Delete
[84] Fix | Delete
$this->add_json_to_html();
[85] Fix | Delete
$this->replace_export_html_urls();
[86] Fix | Delete
$this->remove_json_from_html();
[87] Fix | Delete
$this->add_export_json_to_zip();
[88] Fix | Delete
$this->add_export_html_to_zip();
[89] Fix | Delete
$this->push_zip_to_client();
[90] Fix | Delete
$this->delete_export_zip();
[91] Fix | Delete
exit;
[92] Fix | Delete
}
[93] Fix | Delete
[94] Fix | Delete
/**
[95] Fix | Delete
* create Header HTML for HTML export
[96] Fix | Delete
**/
[97] Fix | Delete
public function write_header_html(){
[98] Fix | Delete
global $SR_GLOBALS;
[99] Fix | Delete
$global = $this->get_global_settings();
[100] Fix | Delete
//JSON needs to be added here
[101] Fix | Delete
?>
[102] Fix | Delete
<!DOCTYPE html>
[103] Fix | Delete
<html lang="en-US" class="no-js">
[104] Fix | Delete
<head>
[105] Fix | Delete
<meta charset="UTF-8">
[106] Fix | Delete
<meta name="viewport" content="width=device-width">
[107] Fix | Delete
<meta name="viewport" content="width=device-width, initial-scale=1" />
[108] Fix | Delete
<title>SR7 - EXPORT</title>
[109] Fix | Delete
[110] Fix | Delete
<link rel="preconnect" href="https://fonts.googleapis.com">
[111] Fix | Delete
<link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin>
[112] Fix | Delete
<link rel='stylesheet' id='sr7css-css' href='<?php echo $this->path_css; ?>sr7.css' media='all' />
[113] Fix | Delete
[114] Fix | Delete
<script src="<?php echo $this->path_js; ?>libs/tptools.js" id="_tpt-js" async></script>
[115] Fix | Delete
<script src="<?php echo $this->path_js; ?>sr7.js" id="sr7-js" async></script>
[116] Fix | Delete
<script src="<?php echo $this->path_js; ?>page.js" id="sr7-page-js" async></script>
[117] Fix | Delete
[118] Fix | Delete
<?php
[119] Fix | Delete
//JSON is not created, so manually add it to the RevSliderFront instance
[120] Fix | Delete
$sid = $this->slider->get_id();
[121] Fix | Delete
$slider_id = $this->slider->get_param('id', '');
[122] Fix | Delete
$this->html_id = (trim($slider_id) !== '') ? $slider_id : 'SR7_'.$sid.'_'.$SR_GLOBALS['serial'];
[123] Fix | Delete
[124] Fix | Delete
$sr_front = RevSliderGlobals::instance()->get('RevSliderFront');
[125] Fix | Delete
[126] Fix | Delete
$data = $this->slider->get_full_slider_JSON();
[127] Fix | Delete
$data = apply_filters('sr_load_slider_json', $data, $this);
[128] Fix | Delete
$this->json = json_encode($data);
[129] Fix | Delete
[130] Fix | Delete
echo $sr_front->js_add_header_scripts();
[131] Fix | Delete
[132] Fix | Delete
do_action('revslider_export_html_write_header', $this);
[133] Fix | Delete
?>
[134] Fix | Delete
</head>
[135] Fix | Delete
[136] Fix | Delete
<body><?php
[137] Fix | Delete
}
[138] Fix | Delete
[139] Fix | Delete
/**
[140] Fix | Delete
* create Footer HTML for HTML export
[141] Fix | Delete
**/
[142] Fix | Delete
public function write_footer_html(){
[143] Fix | Delete
global $SR_GLOBALS;
[144] Fix | Delete
if(!empty($SR_GLOBALS['collections']['css'])){
[145] Fix | Delete
$custom_css = implode("\n".RS_T2, $SR_GLOBALS['collections']['css']);
[146] Fix | Delete
$css = RevSliderGlobals::instance()->get('RevSliderCssParser');
[147] Fix | Delete
echo '<style>';
[148] Fix | Delete
echo $css->compress_css($custom_css);
[149] Fix | Delete
echo '</style>'."\n";
[150] Fix | Delete
}
[151] Fix | Delete
[152] Fix | Delete
do_action('revslider_export_html_write_footer', $this);
[153] Fix | Delete
?>
[154] Fix | Delete
</body>
[155] Fix | Delete
</html>
[156] Fix | Delete
<?php
[157] Fix | Delete
}
[158] Fix | Delete
[159] Fix | Delete
/**
[160] Fix | Delete
* JSON needs tobe added as only slider_html will be checked for images and so on.
[161] Fix | Delete
* After that image and so on process, remove it again
[162] Fix | Delete
*/
[163] Fix | Delete
public function add_json_to_html(){
[164] Fix | Delete
$this->slider_html .= '<!-- TEMPJSON -->'.$this->json.'<!-- /TEMPJSON -->';
[165] Fix | Delete
}
[166] Fix | Delete
[167] Fix | Delete
public function remove_json_from_html(){
[168] Fix | Delete
$json = substr($this->slider_html, strpos($this->slider_html, '<!-- TEMPJSON -->'), strpos($this->slider_html, '<!-- /TEMPJSON -->') + 18 - strpos($this->slider_html, '<!-- TEMPJSON -->'))."\n";
[169] Fix | Delete
$json = str_replace(array('<!-- TEMPJSON -->', '<!-- /TEMPJSON -->'), '', $json);
[170] Fix | Delete
$starthtml = substr($this->slider_html, 0, strpos($this->slider_html, '<!-- TEMPJSON -->'));
[171] Fix | Delete
$endhtml = substr($this->slider_html, strpos($this->slider_html, '<!-- /TEMPJSON -->') + 18);
[172] Fix | Delete
$this->slider_html = $starthtml.$endhtml; //remove from html markup
[173] Fix | Delete
$this->json = $json;
[174] Fix | Delete
}
[175] Fix | Delete
[176] Fix | Delete
/**
[177] Fix | Delete
* replace the URLs in the HTML to local URLs for exporting, this will also push the files into the zip file
[178] Fix | Delete
**/
[179] Fix | Delete
public function replace_export_html_urls(){
[180] Fix | Delete
$added = array();
[181] Fix | Delete
$replace = array();
[182] Fix | Delete
$upload_dir = $this->get_upload_path();
[183] Fix | Delete
$upload_dir_multi = wp_upload_dir();
[184] Fix | Delete
$cont_url = $this->get_val($upload_dir_multi, 'baseurl');
[185] Fix | Delete
$cont_url_no_www = str_replace('www.', '', $cont_url);
[186] Fix | Delete
$upload_dir_multi = $this->get_val($upload_dir_multi, 'basedir').'/';
[187] Fix | Delete
[188] Fix | Delete
//remove header path
[189] Fix | Delete
$urls = array(
[190] Fix | Delete
admin_url('admin-ajax.php'),
[191] Fix | Delete
get_rest_url(),
[192] Fix | Delete
str_replace(array("\n", "\r"), '', RS_PLUGIN_URL),
[193] Fix | Delete
str_replace(array("\n", "\r"), '', WP_PLUGIN_URL)."/"
[194] Fix | Delete
);
[195] Fix | Delete
[196] Fix | Delete
foreach($urls as $url){
[197] Fix | Delete
$this->slider_html = str_replace("'".$url."'", "''", $this->slider_html);
[198] Fix | Delete
}
[199] Fix | Delete
[200] Fix | Delete
$search = array($cont_url, $cont_url_no_www, RS_PLUGIN_URL);
[201] Fix | Delete
if(defined('WHITEBOARD_PLUGIN_URL')){
[202] Fix | Delete
$search[] = WHITEBOARD_PLUGIN_URL;
[203] Fix | Delete
}
[204] Fix | Delete
[205] Fix | Delete
$search = apply_filters('revslider_html_export_replace_urls', $search);
[206] Fix | Delete
$replace = apply_filters('revslider_html_export_path_replace_urls', $replace);
[207] Fix | Delete
[208] Fix | Delete
foreach($search ?? [] as $s){
[209] Fix | Delete
$found = array();
[210] Fix | Delete
$_s = array(
[211] Fix | Delete
$s,
[212] Fix | Delete
str_replace(array('http:', 'https:'), '', $s),
[213] Fix | Delete
str_replace('/', '\\\/', $s),
[214] Fix | Delete
);
[215] Fix | Delete
//$s = str_replace(array('http:', 'https:'), '', $s);
[216] Fix | Delete
foreach($_s as $pattern){
[217] Fix | Delete
$pattern = str_replace('/', '\/', $pattern); // Escapes slashes
[218] Fix | Delete
//preg_match_all("/(\"|')".$pattern."\S*(\"|')/", $this->slider_html, $_files);
[219] Fix | Delete
preg_match_all("/(\"|')".$pattern."[^\"'\s]*?(\"|')/", $this->slider_html, $_files);
[220] Fix | Delete
if(empty($_files) || !isset($_files[0]) || empty($_files[0])) continue;
[221] Fix | Delete
foreach($_files[0] ?? [] as $_file){
[222] Fix | Delete
if(in_array($_file, $found)) continue;
[223] Fix | Delete
$found[] = $_file;
[224] Fix | Delete
}
[225] Fix | Delete
}
[226] Fix | Delete
[227] Fix | Delete
if(empty($found)) continue;
[228] Fix | Delete
[229] Fix | Delete
//go through all files, check for existance and add to the zip file
[230] Fix | Delete
foreach($found ?? [] as $_file){
[231] Fix | Delete
$o = $_file;
[232] Fix | Delete
$_file = str_replace(array('"', "'", str_replace('/', '\/', $s)), '', $_file);
[233] Fix | Delete
$_file = str_replace($_s, '', $_file);
[234] Fix | Delete
$_file = str_replace('\/', '/', $_file);
[235] Fix | Delete
[236] Fix | Delete
//check if video or image
[237] Fix | Delete
preg_match('/.*?.(?:jpg|jpeg|gif|png|svg)/i', $_file, $match); //image
[238] Fix | Delete
preg_match('/.*?.(?:ogv|webm|mp4|mp3)/i', $_file, $match2); //video
[239] Fix | Delete
[240] Fix | Delete
$f = false;
[241] Fix | Delete
if(!empty($match) && isset($match[0]) && !empty($match[0])){
[242] Fix | Delete
$use_path = $this->path_assets;
[243] Fix | Delete
$use_path_raw = $this->path_assets_raw;
[244] Fix | Delete
$f = true;
[245] Fix | Delete
}
[246] Fix | Delete
if(!empty($match2) && isset($match2[0]) && !empty($match2[0])){
[247] Fix | Delete
$use_path = $this->path_assets_vid;
[248] Fix | Delete
$use_path_raw = $this->path_assets_raw_vid;
[249] Fix | Delete
$f = true;
[250] Fix | Delete
}
[251] Fix | Delete
[252] Fix | Delete
if($f == false){ //no file, just a location. So change the location accordingly by removing base
[253] Fix | Delete
$this->slider_html = str_replace($o, '"'.$this->path_js.'"', $this->slider_html);
[254] Fix | Delete
continue; //no correct file, nothing to add
[255] Fix | Delete
}
[256] Fix | Delete
if(isset($added[$_file])) continue;
[257] Fix | Delete
[258] Fix | Delete
$add = '';
[259] Fix | Delete
$__file = '';
[260] Fix | Delete
$repl_to = explode('/', $_file);
[261] Fix | Delete
$repl_to = end($repl_to);
[262] Fix | Delete
$remove = false;
[263] Fix | Delete
[264] Fix | Delete
if(is_file($upload_dir.$_file)){
[265] Fix | Delete
$this->add_file_to_zip($upload_dir.$_file, $use_path_raw);
[266] Fix | Delete
$remove = true;
[267] Fix | Delete
}elseif(is_file($upload_dir_multi.$_file)){
[268] Fix | Delete
$this->add_file_to_zip($upload_dir_multi.$_file, $use_path_raw);
[269] Fix | Delete
$remove = true;
[270] Fix | Delete
}elseif(is_file(RS_PLUGIN_PATH.$_file)){
[271] Fix | Delete
//we need to be special with internal files
[272] Fix | Delete
$__file = basename($_file);
[273] Fix | Delete
$this->add_file_to_zip($use_path_raw.'/'.$__file, $use_path_raw);
[274] Fix | Delete
$remove = true;
[275] Fix | Delete
$add = '/';
[276] Fix | Delete
}else{
[277] Fix | Delete
if(defined('WHITEBOARD_PLUGIN_PATH') && is_file(WHITEBOARD_PLUGIN_PATH.$_file)){
[278] Fix | Delete
//we need to be special with svg files
[279] Fix | Delete
$__file = basename($_file);
[280] Fix | Delete
$this->add_file_to_zip(WHITEBOARD_PLUGIN_PATH.$__file, $use_path_raw);
[281] Fix | Delete
$remove = true;
[282] Fix | Delete
$add = '/';
[283] Fix | Delete
}
[284] Fix | Delete
foreach($replace ?? [] as $_path){
[285] Fix | Delete
if(!is_file($_path.$_file)) continue;
[286] Fix | Delete
//we need to be special with svg files
[287] Fix | Delete
$mf = str_replace('//', '/', $_path.$_file);
[288] Fix | Delete
$__file = basename($_file);
[289] Fix | Delete
$this->add_file_to_zip($_path.$__file, $use_path_raw);
[290] Fix | Delete
$remove = true;
[291] Fix | Delete
$add = '/';
[292] Fix | Delete
}
[293] Fix | Delete
}
[294] Fix | Delete
[295] Fix | Delete
if($remove !== true) continue; //replace file with new path
[296] Fix | Delete
[297] Fix | Delete
$added[$_file] = true; //set as added
[298] Fix | Delete
if($add !== '') $_file = $__file; //set the different path here
[299] Fix | Delete
$re = (strpos($o, "'") !== false) ? "'" : '"';
[300] Fix | Delete
[301] Fix | Delete
$o = str_replace('\/', '/', $o);
[302] Fix | Delete
$o = $this->remove_http(str_replace($re, '', $o));
[303] Fix | Delete
$to = $re.$use_path.'/'.$repl_to.$re;
[304] Fix | Delete
$_o = str_replace('/', '\/', $o);
[305] Fix | Delete
$_to = $re.$use_path.'\/'.$repl_to.$re;
[306] Fix | Delete
[307] Fix | Delete
$this->slider_html = str_replace(array($re.$o.$re, $re.'http:'.$o.$re, $re.'https:'.$o.$re), $to, $this->slider_html);
[308] Fix | Delete
$this->slider_html = str_replace(array($re.$_o.$re, $re.'http:'.$_o.$re, $re.'https:'.$_o.$re), $_to, $this->slider_html);
[309] Fix | Delete
}
[310] Fix | Delete
}
[311] Fix | Delete
[312] Fix | Delete
$css_files = array(
[313] Fix | Delete
'sr7.css',
[314] Fix | Delete
'sr7.btns.css',
[315] Fix | Delete
'sr7.filters.css',
[316] Fix | Delete
'sr7.lp.css',
[317] Fix | Delete
'sr7.media.css',
[318] Fix | Delete
'sr7.nav.css',
[319] Fix | Delete
'sr7.nav.css',
[320] Fix | Delete
'fonts/font-awesome/css/font-awesome.css',
[321] Fix | Delete
'fonts/font-awesome/fonts/FontAwesome.otf',
[322] Fix | Delete
'fonts/font-awesome/fonts/fontawesome-webfont.eot',
[323] Fix | Delete
'fonts/font-awesome/fonts/fontawesome-webfont.svg',
[324] Fix | Delete
'fonts/font-awesome/fonts/fontawesome-webfont.ttf',
[325] Fix | Delete
'fonts/font-awesome/fonts/fontawesome-webfont.woff',
[326] Fix | Delete
'fonts/font-awesome/fonts/fontawesome-webfont.woff2',
[327] Fix | Delete
'fonts/material/codepoints',
[328] Fix | Delete
'fonts/material/codepoints.json',
[329] Fix | Delete
'fonts/material/codepoints.scss',
[330] Fix | Delete
'fonts/material/material-icons.css',
[331] Fix | Delete
'fonts/material/MaterialIcons-Regular.eot',
[332] Fix | Delete
'fonts/material/MaterialIcons-Regular.ijmap.txt',
[333] Fix | Delete
'fonts/material/MaterialIcons-Regular.svg',
[334] Fix | Delete
'fonts/material/MaterialIcons-Regular.ttf',
[335] Fix | Delete
'fonts/material/MaterialIcons-Regular.woff',
[336] Fix | Delete
'fonts/material/MaterialIcons-Regular.woff2',
[337] Fix | Delete
'fonts/pe-icon-7-stroke/css/helper.css',
[338] Fix | Delete
'fonts/pe-icon-7-stroke/css/pe-icon-7-stroke.css',
[339] Fix | Delete
'fonts/pe-icon-7-stroke/fonts/Pe-icon-7-stroke.eot',
[340] Fix | Delete
'fonts/pe-icon-7-stroke/fonts/Pe-icon-7-stroke.svg',
[341] Fix | Delete
'fonts/pe-icon-7-stroke/fonts/Pe-icon-7-stroke.ttf',
[342] Fix | Delete
'fonts/pe-icon-7-stroke/fonts/Pe-icon-7-stroke.woff',
[343] Fix | Delete
'fonts/revicons/css/revicons.css',
[344] Fix | Delete
'fonts/revicons/fonts/revicons.eot',
[345] Fix | Delete
'fonts/revicons/fonts/revicons.svg',
[346] Fix | Delete
'fonts/revicons/fonts/revicons.ttf',
[347] Fix | Delete
'fonts/revicons/fonts/revicons.woff',
[348] Fix | Delete
'fonts/revicons/fonts/revicons.woff',
[349] Fix | Delete
'preloaders/t0.css',
[350] Fix | Delete
'preloaders/t1.css',
[351] Fix | Delete
'preloaders/t2.css',
[352] Fix | Delete
'preloaders/t3.css',
[353] Fix | Delete
'preloaders/t4.css',
[354] Fix | Delete
'preloaders/t5.css',
[355] Fix | Delete
'preloaders/t6.css',
[356] Fix | Delete
'preloaders/t7.css',
[357] Fix | Delete
'preloaders/t8.css',
[358] Fix | Delete
'preloaders/t9.css',
[359] Fix | Delete
'preloaders/t10.css',
[360] Fix | Delete
'preloaders/t11.css',
[361] Fix | Delete
'preloaders/t12.css',
[362] Fix | Delete
'preloaders/t13.css',
[363] Fix | Delete
'preloaders/t14.css',
[364] Fix | Delete
'preloaders/t15.css',
[365] Fix | Delete
);
[366] Fix | Delete
$js_files = array(
[367] Fix | Delete
'animate.js',
[368] Fix | Delete
'canvas.js',
[369] Fix | Delete
'carousel.js',
[370] Fix | Delete
'defaults.js',
[371] Fix | Delete
'draw.js',
[372] Fix | Delete
'layer.js',
[373] Fix | Delete
'media.js',
[374] Fix | Delete
//'migration.js',
[375] Fix | Delete
'modifiers.js',
[376] Fix | Delete
'module.js',
[377] Fix | Delete
'navigation.js',
[378] Fix | Delete
'page.js',
[379] Fix | Delete
'save.js',
[380] Fix | Delete
'slide.js',
[381] Fix | Delete
'sr7.js',
[382] Fix | Delete
'srtools.js',
[383] Fix | Delete
'libs/three.js',
[384] Fix | Delete
'libs/tpgsap.js',
[385] Fix | Delete
'libs/tptools.js',
[386] Fix | Delete
'libs/webgl.js',
[387] Fix | Delete
);
[388] Fix | Delete
[389] Fix | Delete
foreach($js_files ?? [] as $js_file){
[390] Fix | Delete
if(!file_exists(RS_PLUGIN_PATH.'public/js/'.$js_file)) continue;
[391] Fix | Delete
[392] Fix | Delete
if(!$this->usepcl){
[393] Fix | Delete
$this->zip->addFile(RS_PLUGIN_PATH.'public/js/'.$js_file, $this->path_js.$js_file);
[394] Fix | Delete
}else{
[395] Fix | Delete
$this->pclzip->add(RS_PLUGIN_PATH.'public/js/'.$js_file, PCLZIP_OPT_REMOVE_PATH, RS_PLUGIN_PATH.'assets/js/', PCLZIP_OPT_ADD_PATH, $this->path_js);
[396] Fix | Delete
}
[397] Fix | Delete
}
[398] Fix | Delete
[399] Fix | Delete
foreach($css_files ?? [] as $css_file){
[400] Fix | Delete
if(!file_exists(RS_PLUGIN_PATH.'public/css/'.$css_file)) continue;
[401] Fix | Delete
[402] Fix | Delete
if(!$this->usepcl){
[403] Fix | Delete
$this->zip->addFile(RS_PLUGIN_PATH.'public/css/'.$css_file, $this->path_css.$css_file);
[404] Fix | Delete
}else{
[405] Fix | Delete
$this->pclzip->add(RS_PLUGIN_PATH.'public/css/'.$css_file, PCLZIP_OPT_REMOVE_PATH, RS_PLUGIN_PATH.'assets/css/', PCLZIP_OPT_ADD_PATH, $this->path_css);
[406] Fix | Delete
}
[407] Fix | Delete
}
[408] Fix | Delete
[409] Fix | Delete
$this->slider_html = apply_filters('revslider_export_html_file_inclusion', $this->slider_html, $this);
[410] Fix | Delete
[411] Fix | Delete
$notice_text = __('Using this data is only allowed with a valid licence of the WordPress Slider Revolution Plugin, which can be found at: https://www.themepunch.com/links/slider_revolution_wordpress_regular_license', 'revslider');
[412] Fix | Delete
[413] Fix | Delete
if(!$this->usepcl){
[414] Fix | Delete
$this->zip->addFromString('NOTICE.txt', $notice_text); //add slider settings
[415] Fix | Delete
}else{
[416] Fix | Delete
$this->pclzip->add(array(array(PCLZIP_ATT_FILE_NAME => 'NOTICE.txt', PCLZIP_ATT_FILE_CONTENT => $notice_text)));
[417] Fix | Delete
}
[418] Fix | Delete
}
[419] Fix | Delete
[420] Fix | Delete
public function add_export_json_to_zip(){
[421] Fix | Delete
if(!$this->usepcl){
[422] Fix | Delete
$this->zip->addFromString("assets/".$this->html_id.".json", $this->json); //add slider settings
[423] Fix | Delete
}else{
[424] Fix | Delete
$this->pclzip->add(array(array(PCLZIP_ATT_FILE_NAME => "assets/".$this->html_id.".json", PCLZIP_ATT_FILE_CONTENT => $this->json)));
[425] Fix | Delete
}
[426] Fix | Delete
}
[427] Fix | Delete
[428] Fix | Delete
/**
[429] Fix | Delete
* Add the export HTML file to the zip file
[430] Fix | Delete
**/
[431] Fix | Delete
public function add_export_html_to_zip(){
[432] Fix | Delete
if(!$this->usepcl){
[433] Fix | Delete
$this->zip->addFromString('index.html', $this->slider_html); //add slider settings
[434] Fix | Delete
$this->zip->close();
[435] Fix | Delete
}else{
[436] Fix | Delete
$this->pclzip->add(array(array(PCLZIP_ATT_FILE_NAME => 'index.html', PCLZIP_ATT_FILE_CONTENT => $this->slider_html)));
[437] Fix | Delete
}
[438] Fix | Delete
}
[439] Fix | Delete
[440] Fix | Delete
public function add_file_to_zip($file, $path){
[441] Fix | Delete
$file_name = explode('/', $file);
[442] Fix | Delete
$file_name = end($file_name);
[443] Fix | Delete
$file = str_replace('//', '/', $file);
[444] Fix | Delete
if(!$this->usepcl){
[445] Fix | Delete
$this->zip->addFile($file, $path.'/'.$file_name);
[446] Fix | Delete
}else{
[447] Fix | Delete
$this->pclzip->add($file, PCLZIP_OPT_REMOVE_PATH, str_replace(basename($file), '', $file), PCLZIP_OPT_ADD_PATH, $path.'/');
[448] Fix | Delete
}
[449] Fix | Delete
}
[450] Fix | Delete
}
[451] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function