* @link https://www.themepunch.com/ * @copyright 2019 ThemePunch */ if(!defined('ABSPATH')) exit(); class RevSliderSliderExportHtml extends RevSliderSliderExport { public $path_fonts = 'fonts/'; public $path_css = 'css/'; public $path_js = 'js/'; public $path_assets = 'assets'; public $path_assets_raw = 'assets'; public $path_assets_vid = 'assets'; public $path_assets_raw_vid = 'assets'; public $export_real = true; public $slider_html = ''; public $export_font = ''; public $export_scripts = ''; public $export_styles = ''; private $slider_title = ''; private $layouttype = ''; public function __construct(){ parent::__construct(); if(!$this->export_real){ //set all different file path's here $this->path_fonts = '../../revolution/fonts/'; $this->path_css = '../../revolution/css/'; $this->path_js = '../../revolution/js/'; $this->path_assets = '../../assets/images'; $this->path_assets_raw = 'assets/images'; $this->path_assets_vid = '../../assets/videos'; $this->path_assets_raw_vid = 'assets/videos'; } } /** * export slider HTML as a zip file **/ public function export_slider_html($slider_id){ if($slider_id == 'empty_output'){ echo __('Wrong request!', 'revslider'); exit; } $this->create_export_zip(); $slider = new RevSliderSlider(); $slider->init_by_id($slider_id); //check if an update is needed if(version_compare($slider->get_param(array('settings', 'version')), get_option('revslider_update_version', '6.0.0'), '<')){ $upd = new RevSliderPluginUpdate(); $upd->upgrade_slider_to_latest($slider); $slider->init_by_id($slider_id); } $this->slider_title = $slider->get_title(); $this->slider_alias = $slider->get_alias(); $this->layouttype = $slider->get_param('layouttype'); $output = new RevSliderOutput(); ob_start(); $output->set_slider_id($slider_id); $output->set_markup_export(true); $output->add_slider_base(); $this->slider_html = ob_get_contents(); ob_clean(); ob_end_clean(); $this->create_font_html(); $this->create_script_html(); $this->create_style_html(); ob_start(); $this->write_header_html(); $head = ob_get_contents(); ob_clean(); ob_end_clean(); ob_start(); $this->write_body_html(); $body = ob_get_contents(); ob_clean(); ob_end_clean(); ob_start(); $this->write_footer_html(); $footer = ob_get_contents(); ob_clean(); ob_end_clean(); $this->slider_html = $head."\n". $this->slider_html."\n". $this->export_scripts."\n". $body."\n". $footer; $this->replace_export_html_urls(); $this->add_export_html_to_zip(); $this->push_zip_to_client(); $this->delete_export_zip(); exit; } /** * replace the URLs in the HTML to local URLs for exporting, this will also push the files into the zip file **/ public function replace_export_html_urls(){ $added = array(); $upload_dir = $this->get_upload_path(); $upload_dir_multi = wp_upload_dir(); $cont_url = $this->get_val($upload_dir_multi, 'baseurl'); $cont_url_no_www = str_replace('www.', '', $cont_url); $upload_dir_multi = $this->get_val($upload_dir_multi, 'basedir').'/'; $search = array($cont_url, $cont_url_no_www, RS_PLUGIN_URL); if(defined('WHITEBOARD_PLUGIN_URL')){ $search[] = WHITEBOARD_PLUGIN_URL; } $search = apply_filters('revslider_html_export_replace_urls', $search); if(!empty($search)){ foreach($search as $s){ $s = $this->remove_http($s); preg_match_all("/(\"|')".str_replace('/', '\/', $s)."\S+(\"|')/", $this->slider_html, $_files); if(!empty($_files) && isset($_files[0]) && !empty($_files[0])){ //go through all files, check for existance and add to the zip file foreach($_files[0] as $_file){ $o = $_file; $_file = str_replace(array('"', "'", $s), '', $_file); //check if video or image $use_path = $this->path_assets; $use_path_raw = $this->path_assets_raw; preg_match('/.*?.(?:jpg|jpeg|gif|png|svg)/i', $_file, $match); preg_match('/.*?.(?:ogv|webm|mp4|mp3)/i', $_file, $match2); $f = false; if(!empty($match) && isset($match[0]) && !empty($match[0])){ //image $use_path = $this->path_assets; $use_path_raw = $this->path_assets_raw; $f = true; } if(!empty($match2) && isset($match2[0]) && !empty($match2[0])){ //video $use_path = $this->path_assets_vid; $use_path_raw = $this->path_assets_raw_vid; $f = true; } if($f == false){ //no file, just a location. So change the location accordingly by removing base and add ../../revolution if(strpos($o, 'public/assets/js/') !== false){ //this will be the jsFileLocation script part $this->slider_html = str_replace($o, '"'.$this->path_js.'"', $this->slider_html); } continue; //no correct file, nothing to add } if(isset($added[$_file])) continue; $add = ''; $__file = ''; $repl_to = explode('/', $_file); $repl_to = end($repl_to); $remove = false; if(is_file($upload_dir.$_file)){ $mf = str_replace('//', '/', $upload_dir.$_file); if(!$this->usepcl){ $this->zip->addFile($mf, $use_path_raw.'/'.$repl_to); }else{ $v_list = $this->pclzip->add($mf, PCLZIP_OPT_REMOVE_PATH, str_replace(basename($mf), '', $mf), PCLZIP_OPT_ADD_PATH, $use_path_raw.'/'); } $remove = true; }elseif(is_file($upload_dir_multi.$_file)){ $mf = str_replace('//', '/', $upload_dir_multi.$_file); if(!$this->usepcl){ $this->zip->addFile($mf, $use_path_raw.'/'.$repl_to); }else{ $v_list = $this->pclzip->add($mf, PCLZIP_OPT_REMOVE_PATH, str_replace(basename($mf), '', $mf), PCLZIP_OPT_ADD_PATH, $use_path_raw.'/'); } $remove = true; }elseif(is_file(RS_PLUGIN_PATH.$_file)){ $mf = str_replace('//', '/', RS_PLUGIN_PATH.$_file); //we need to be special with svg files $__file = basename($_file); //remove admin/assets/ //$__file = str_replace('admin/assets/images/', '', $_file); if(!$this->usepcl){ $this->zip->addFile($mf, $use_path_raw.'/'.$__file); }else{ $v_list = $this->pclzip->add($mf, PCLZIP_OPT_REMOVE_PATH, str_replace(basename($mf), '', $mf), PCLZIP_OPT_ADD_PATH, $use_path_raw.'/'); } $remove = true; $add = '/'; }else{ if(defined('WHITEBOARD_PLUGIN_PATH')){ if(is_file(WHITEBOARD_PLUGIN_PATH.$_file)){ $mf = str_replace('//', '/', WHITEBOARD_PLUGIN_PATH.$_file); //we need to be special with svg files $__file = basename($_file); if(!$this->usepcl){ $this->zip->addFile($mf, $use_path_raw.'/'.$__file); }else{ $v_list = $this->pclzip->add($mf, PCLZIP_OPT_REMOVE_PATH, str_replace(basename($mf), '', $mf), PCLZIP_OPT_ADD_PATH, $use_path_raw.'/'); } $remove = true; $add = '/'; } } } if($remove == true){ $added[$_file] = true; //set as added //replace file with new path if($add !== '') $_file = $__file; //set the different path here $re = (strpos($o, "'") !== false) ? "'" : '"'; $this->slider_html = str_replace($o, $re.$use_path.'/'.$repl_to.$re, $this->slider_html); } } } } } if($this->export_real){ //only include if real export //add common files to the zip if(!$this->usepcl){ $this->zip->addFile(RS_PLUGIN_PATH.'/public/assets/js/rs6.min.js', 'js/rs6.min.js'); $this->zip->addFile(RS_PLUGIN_PATH.'/public/assets/js/revolution.tools.min.js', 'js/revolution.tools.min.js'); $this->zip->addFile(RS_PLUGIN_PATH.'/public/assets/css/rs6.css', 'css/rs6.css'); $this->zip->addFile(RS_PLUGIN_PATH.'/public/assets/fonts/pe-icon-7-stroke/css/pe-icon-7-stroke.css', 'fonts/pe-icon-7-stroke/css/pe-icon-7-stroke.css'); $this->zip->addFile(RS_PLUGIN_PATH.'/public/assets/fonts/pe-icon-7-stroke/css/helper.css', 'fonts/pe-icon-7-stroke/css/helper.css'); $this->zip->addFile(RS_PLUGIN_PATH.'/public/assets/fonts/pe-icon-7-stroke/fonts/Pe-icon-7-stroke.eot', 'fonts/pe-icon-7-stroke/fonts/Pe-icon-7-stroke.eot'); $this->zip->addFile(RS_PLUGIN_PATH.'/public/assets/fonts/pe-icon-7-stroke/fonts/Pe-icon-7-stroke.svg', 'fonts/pe-icon-7-stroke/fonts/Pe-icon-7-stroke.svg'); $this->zip->addFile(RS_PLUGIN_PATH.'/public/assets/fonts/pe-icon-7-stroke/fonts/Pe-icon-7-stroke.ttf', 'fonts/pe-icon-7-stroke/fonts/Pe-icon-7-stroke.ttf'); $this->zip->addFile(RS_PLUGIN_PATH.'/public/assets/fonts/pe-icon-7-stroke/fonts/Pe-icon-7-stroke.woff', 'fonts/pe-icon-7-stroke/fonts/Pe-icon-7-stroke.woff'); $this->zip->addFile(RS_PLUGIN_PATH.'/public/assets/fonts/font-awesome/css/font-awesome.css', 'fonts/font-awesome/css/font-awesome.css'); $this->zip->addFile(RS_PLUGIN_PATH.'/public/assets/fonts/font-awesome/fonts/FontAwesome.otf', 'fonts/font-awesome/fonts/FontAwesome.otf'); $this->zip->addFile(RS_PLUGIN_PATH.'/public/assets/fonts/font-awesome/fonts/fontawesome-webfont.eot', 'fonts/font-awesome/fonts/fontawesome-webfont.eot'); $this->zip->addFile(RS_PLUGIN_PATH.'/public/assets/fonts/font-awesome/fonts/fontawesome-webfont.svg', 'fonts/font-awesome/fonts/fontawesome-webfont.svg'); $this->zip->addFile(RS_PLUGIN_PATH.'/public/assets/fonts/font-awesome/fonts/fontawesome-webfont.ttf', 'fonts/font-awesome/fonts/fontawesome-webfont.ttf'); $this->zip->addFile(RS_PLUGIN_PATH.'/public/assets/fonts/font-awesome/fonts/fontawesome-webfont.woff', 'fonts/font-awesome/fonts/fontawesome-webfont.woff'); $this->zip->addFile(RS_PLUGIN_PATH.'/public/assets/fonts/revicons/revicons.eot', 'fonts/revicons/revicons.eot'); $this->zip->addFile(RS_PLUGIN_PATH.'/public/assets/fonts/revicons/revicons.svg', 'fonts/revicons/revicons.svg'); $this->zip->addFile(RS_PLUGIN_PATH.'/public/assets/fonts/revicons/revicons.ttf', 'fonts/revicons/revicons.ttf'); $this->zip->addFile(RS_PLUGIN_PATH.'/public/assets/fonts/revicons/revicons.woff', 'fonts/revicons/revicons.woff'); }else{ $this->pclzip->add(RS_PLUGIN_PATH.'public/assets/js/rs6.min.js', PCLZIP_OPT_REMOVE_PATH, RS_PLUGIN_PATH.'public/assets/js/', PCLZIP_OPT_ADD_PATH, 'js/'); $this->pclzip->add(RS_PLUGIN_PATH.'public/assets/js/revolution.tools.min.js', PCLZIP_OPT_REMOVE_PATH, RS_PLUGIN_PATH.'public/assets/js/', PCLZIP_OPT_ADD_PATH, 'js/'); $this->pclzip->add(RS_PLUGIN_PATH.'public/assets/css/rs6.css', PCLZIP_OPT_REMOVE_PATH, RS_PLUGIN_PATH.'public/assets/css/', PCLZIP_OPT_ADD_PATH, 'css/'); $this->pclzip->add(RS_PLUGIN_PATH.'public/assets/fonts/pe-icon-7-stroke/css/pe-icon-7-stroke.css', PCLZIP_OPT_REMOVE_PATH, RS_PLUGIN_PATH.'public/assets/'); $this->pclzip->add(RS_PLUGIN_PATH.'public/assets/fonts/pe-icon-7-stroke/css/helper.css', PCLZIP_OPT_REMOVE_PATH, RS_PLUGIN_PATH.'public/assets/'); $this->pclzip->add(RS_PLUGIN_PATH.'public/assets/fonts/pe-icon-7-stroke/fonts/Pe-icon-7-stroke.eot', PCLZIP_OPT_REMOVE_PATH, RS_PLUGIN_PATH.'public/assets/'); $this->pclzip->add(RS_PLUGIN_PATH.'public/assets/fonts/pe-icon-7-stroke/fonts/Pe-icon-7-stroke.svg', PCLZIP_OPT_REMOVE_PATH, RS_PLUGIN_PATH.'public/assets/'); $this->pclzip->add(RS_PLUGIN_PATH.'public/assets/fonts/pe-icon-7-stroke/fonts/Pe-icon-7-stroke.ttf', PCLZIP_OPT_REMOVE_PATH, RS_PLUGIN_PATH.'public/assets/'); $this->pclzip->add(RS_PLUGIN_PATH.'public/assets/fonts/pe-icon-7-stroke/fonts/Pe-icon-7-stroke.woff', PCLZIP_OPT_REMOVE_PATH, RS_PLUGIN_PATH.'public/assets/'); $this->pclzip->add(RS_PLUGIN_PATH.'public/assets/fonts/font-awesome/css/font-awesome.css', PCLZIP_OPT_REMOVE_PATH, RS_PLUGIN_PATH.'public/assets/'); $this->pclzip->add(RS_PLUGIN_PATH.'public/assets/fonts/font-awesome/fonts/FontAwesome.otf', PCLZIP_OPT_REMOVE_PATH, RS_PLUGIN_PATH.'public/assets/'); $this->pclzip->add(RS_PLUGIN_PATH.'public/assets/fonts/font-awesome/fonts/fontawesome-webfont.eot', PCLZIP_OPT_REMOVE_PATH, RS_PLUGIN_PATH.'public/assets/'); $this->pclzip->add(RS_PLUGIN_PATH.'public/assets/fonts/font-awesome/fonts/fontawesome-webfont.svg', PCLZIP_OPT_REMOVE_PATH, RS_PLUGIN_PATH.'public/assets/'); $this->pclzip->add(RS_PLUGIN_PATH.'public/assets/fonts/font-awesome/fonts/fontawesome-webfont.ttf', PCLZIP_OPT_REMOVE_PATH, RS_PLUGIN_PATH.'public/assets/'); $this->pclzip->add(RS_PLUGIN_PATH.'public/assets/fonts/font-awesome/fonts/fontawesome-webfont.woff', PCLZIP_OPT_REMOVE_PATH, RS_PLUGIN_PATH.'public/assets/'); $this->pclzip->add(RS_PLUGIN_PATH.'public/assets/fonts/revicons/revicons.eot', PCLZIP_OPT_REMOVE_PATH, RS_PLUGIN_PATH.'public/assets/'); $this->pclzip->add(RS_PLUGIN_PATH.'public/assets/fonts/revicons/revicons.svg', PCLZIP_OPT_REMOVE_PATH, RS_PLUGIN_PATH.'public/assets/'); $this->pclzip->add(RS_PLUGIN_PATH.'public/assets/fonts/revicons/revicons.ttf', PCLZIP_OPT_REMOVE_PATH, RS_PLUGIN_PATH.'public/assets/'); $this->pclzip->add(RS_PLUGIN_PATH.'public/assets/fonts/revicons/revicons.woff', PCLZIP_OPT_REMOVE_PATH, RS_PLUGIN_PATH.'public/assets/'); } $notice_text = __('Using this data is only allowed with a valid licence of the jQuery Slider Revolution Plugin, which can be found at: https://www.themepunch.com/links/slider_revolution_jquery', 'revslider'); if(!$this->usepcl){ $this->zip->addFromString('NOTICE.txt', $notice_text); //add slider settings }else{ $this->pclzip->add(array(array(PCLZIP_ATT_FILE_NAME => 'NOTICE.txt', PCLZIP_ATT_FILE_CONTENT => $notice_text))); } } } /** * Add the export HTML file to the zip file **/ public function add_export_html_to_zip(){ if(!$this->usepcl){ $this->zip->addFromString('slider.html', $this->slider_html); //add slider settings $this->zip->close(); }else{ $this->pclzip->add(array(array(PCLZIP_ATT_FILE_NAME => 'slider.html', PCLZIP_ATT_FILE_CONTENT => $this->slider_html))); } } /** * create the Font HTML needed for the HTML Export * this will also remove the part out of the slider markup **/ public function create_font_html(){ $fonts = ''; while(strpos($this->slider_html, '') !== false){ $fonts .= substr($this->slider_html, strpos($this->slider_html, ''), strpos($this->slider_html, '') + 14 - strpos($this->slider_html, ''))."\n"; $starthtml = substr($this->slider_html, 0, strpos($this->slider_html, '')); $endhtml = substr($this->slider_html, strpos($this->slider_html, '') + 14); $this->slider_html = $starthtml.$endhtml; //remove from html markup } $fonts = str_replace(array('', ''), '', $fonts); //remove the tags $fonts = str_replace('/>','/>'."\n", $fonts); $this->export_font = $fonts; } /** * create the Scripts HTML needed for the HTML Export * this will also remove the part out of the slider markup **/ public function create_script_html(){ $scripts = ''; while(strpos($this->slider_html, '') !== false){ $scripts .= substr($this->slider_html, strpos($this->slider_html, ''), strpos($this->slider_html, '') + 16 - strpos($this->slider_html, ''))."\n";; $starthtml = substr($this->slider_html, 0, strpos($this->slider_html, '')); $endhtml = substr($this->slider_html, strpos($this->slider_html, '') + 16); $this->slider_html = $starthtml.$endhtml; //remove from html markup } $this->export_scripts = str_replace(array('', ''), '', $scripts); //remove the tags } /** * create the Styles HTML needed for the HTML Export * this will also remove the part out of the slider markup **/ public function create_style_html(){ $styles = ''; while(strpos($this->slider_html, '') !== false){ $styles .= substr($this->slider_html, strpos($this->slider_html, ''), strpos($this->slider_html, '') + 15 - strpos($this->slider_html, ''))."\n"; $starthtml = substr($this->slider_html, 0, strpos($this->slider_html, '')); $endhtml = substr($this->slider_html, strpos($this->slider_html, '') + 15); $this->slider_html = $starthtml.$endhtml; //remove from html markup } $this->export_styles = str_replace(array('', ''), '', $styles); //remove the tags } /** * create Header HTML for HTML export **/ public function write_header_html(){ ?>
Slider Revolution is an innovative, responsive Slider Plugin that displays your content the beautiful way. Whether it's a Slider, Carousel, Hero Scene or even a whole Front Page.
The visual drag & drop editor will help you to create your Sliders and tell your own stories in no time!
Slider Revolution is an innovative, responsive Slider Plugin that displays your content the beautiful way. Whether it's a Slider, Carousel, Hero Scene or even a whole Front Page.
The visual drag & drop editor will help you to create your Sliders and tell your own stories in no time!
We would always recommend to use our online documentation however you can find also our embeded local documentation zipped in the Documentation folder. Online Documentation and FAQ Page is regulary updated. You will find More examples, Visit us also at http://themepunch.com !
You find many Examples for All Skins and Positions of Navigation examples in the examples/Navigation folder. Based on these prepared examples you can build your own navigation skins. Feel free to copy and paste the markups after your requests in your own documents.
We prepared a small List of Transition and a light weight Markup Builder in the examples/Transitions folder. This will help you to get an overview how the Slider and Layer Transitions works. Copy the Markups of the generated Slide and Layer Animation Examples and paste it into your own Documents.