first commit

This commit is contained in:
2024-12-17 13:43:22 +01:00
commit 8e6cd8b410
21292 changed files with 3514826 additions and 0 deletions

View File

@@ -0,0 +1,302 @@
<?php
/**
* @author ThemePunch <info@themepunch.com>
* @link https://www.themepunch.com/
* @copyright 2019 ThemePunch
*/
if(!defined('ABSPATH')) exit();
class RevSliderAddons extends RevSliderFunctions { //before: Rev_addon_Admin
//private $addon_version_required = '2.0.0'; //this holds the globally needed addon version for the current RS version
private $addon_version_required = array(
'revslider-whiteboard-addon' => '2.2.0',
'revslider-backup-addon' => '2.0.0',
'revslider-gallery-addon' => '2.0.0',
'revslider-rel-posts-addon' => '2.0.0',
'revslider-typewriter-addon' => '2.0.0',
'revslider-sharing-addon' => '2.0.0',
'revslider-maintenance-addon' => '2.0.0',
'revslider-snow-addon' => '2.0.0',
'revslider-particles-addon' => '2.0.0',
'revslider-polyfold-addon' => '2.0.0',
'revslider-404-addon' => '2.0.0',
'revslider-prevnext-posts-addon' => '2.0.0',
'revslider-filmstrip-addon' => '2.0.0',
'revslider-login-addon' => '2.0.0',
'revslider-featured-addon' => '2.0.0',
'revslider-slicey-addon' => '2.0.0',
'revslider-beforeafter-addon' => '2.0.0',
'revslider-weather-addon' => '2.0.0',
'revslider-panorama-addon' => '2.0.0',
'revslider-duotonefilters-addon' => '2.0.0',
'revslider-revealer-addon' => '2.0.0',
'revslider-refresh-addon' => '2.0.0',
'revslider-bubblemorph-addon' => '2.0.0',
'revslider-liquideffect-addon' => '2.0.0',
'revslider-explodinglayers-addon' => '2.0.0',
'revslider-paintbrush-addon' => '2.0.0'
);
public function __construct(){
//include_once(ABSPATH . 'wp-admin/includes/plugin.php');
}
/**
* get all the addons with information
**/
public function get_addon_list(){
RevLoader::update_addon_json();
$addons = RevLoader::get_option('revslider-addons');
$addons = (array)$addons;
$addons = array_reverse($addons, true);
//$plugins = get_plugins();
$plugins = array();
if(!empty($addons)){
foreach($addons as $k => $addon){
if(!is_object($addon)) continue;
$addon_file_path = RS_PLUGIN_PATH .'addons/'. $addon->slug.'/'.$addon->slug.'.php';
$is_active = RevLoader::get_option($addon->slug);
if($is_active && $is_active != '0'){
$is_active = true;
}else{
$is_active = false;
}
if(file_exists($addon_file_path)){
//if(array_key_exists($addon->slug.'/'.$addon->slug.'.php', $plugins)){
//$addons[$k]->full_title = $plugins[$addon->slug.'/'.$addon->slug.'.php']['Name'];
$addons[$k]->full_title = $addon->slug;
//$addons[$k]->active = (is_plugin_active($addon->slug.'/'.$addon->slug.'.php')) ? true : false;
$addons[$k]->active = ($is_active) ? true : false;
//$addons[$k]->installed = $plugins[$addon->slug.'/'.$addon->slug.'.php']['Version'];
$addons[$k]->installed = '6.0';
}else{
$addons[$k]->active = false;
$addons[$k]->installed = false;
}
}
}
return $addons;
}
/**
* check if any addon is below version x (for RS6.0 this is version 2.0)
* if yes give a message that tells to update
**/
public function check_addon_version(){
$rs_addons = $this->get_addon_list();
$update = array();
if(!empty($rs_addons)){
foreach($rs_addons as $handle => $addon){
$installed = $this->get_val($addon, 'installed');
if(trim($installed) === '') continue;
if($this->get_val($addon, 'active', false) === false) continue;
$version = $this->get_val($this->addon_version_required, $handle, false);
if($version !== false && version_compare($installed, $version, '<')){
$update[$handle] = array(
'title' => $this->get_val($addon, 'full_title'),
'old' => $installed,
'new' => $this->get_val($addon, 'available'),
'status'=> '1' //1 is mandatory to use it
);
}
}
}
return $update;
}
/**
* Install Add-On/Plugin
*
* @since 6.0
*/
public function install_addon($addon, $force = false){
if(RevLoader::get_option('revslider-valid', 'false') !== 'true') return RevLoader::__('Please activate Slider Revolution', 'revslider');
//check if downloaded already
//$plugins = get_plugins();
//$addon_path = $addon.'/'.$addon.'.php';
//if(!array_key_exists($addon_path, $plugins) || $force == true){
$addon_file_path = RS_PLUGIN_PATH .'addons/'. $addon.'/'.$addon.'.php';
if(! file_exists($addon_file_path)){
//download if nessecary
//RevLoader::update_option($addon, true);
return $this->download_addon($addon);
}
// $addon_path = $addon.'/'.$addon.'.php';
// $filename = './addons/'.$addon_path;
// if (! file_exists($filename)) {
// //download if nessecary
// return $this->download_addon($addon);
// }
//activate
$activate = $this->activate_addon($addon);
return $activate;
}
/**
* Download Add-On/Plugin
*
* @since 1.0.0
*/
public function download_addon($addon){
//global $wp_version, $rslb;
$rslb = new RevSliderLoadBalancer();
if(RevLoader::get_option('revslider-valid', 'false') !== 'true') return RevLoader::__('Please activate Slider Revolution', 'revslider');
$plugin_slug = basename($addon);
$plugin_result = false;
$plugin_message = 'UNKNOWN';
$code = RevLoader::get_option('revslider-code', '');
if(0 !== strpos($plugin_slug, 'revslider-')) die( '-1' );
$done = false;
$count = 0;
$download_url = RevLoader::url();
//track
//$url = $download_url .'/download.php?code='.$code.'&type='.$plugin_slug;
$url = 'http://revapi.smartdatasoft.net/v6/call/index.php?code='.$code.'&type='.$plugin_slug.'&ps_base_url_ssl='. _PS_BASE_URL_SSL_;
$get = RevLoader::wp_remote_post($url, array(
'user-agent' => 'php/; '. RevLoader::get_bloginfo('url'),
'body' => '',
'timeout' => 400
));
if($get["info"]["http_code"] != "200" ){
die("FAILED TO DOWNLOAD");
}else{
$upload_dir = RevLoader::wp_upload_dir();
$file = $upload_dir['basedir']. '/revslider/templates/' . $plugin_slug . '.zip';
@mkdir(dirname($file), 0777, true);
$ret = @file_put_contents($file, $get['body']);
//$dis_path = './addons';
$dis_path = RS_PLUGIN_PATH . '/addons/';
$zip = new ZipArchive;
$res = $zip->open($file);
if ($res === TRUE) {
$zip->extractTo($dis_path);
$zip->close();
return true;
}else{
die("There was a problem. Please try again!");
}
@unlink($file);
return true;
}
//$result = activate_plugin( $plugin_slug.'/'.$plugin_slug.'.php' );
// $rattr = array(
// 'code' => urlencode($code),
// 'version' => urlencode(RS_REVISION),
// 'product' => urlencode(RS_PLUGIN_SLUG),
// 'type' => urlencode($plugin_slug)
// );
// do{
// $url = 'addons/'.$plugin_slug.'/download.php';
// $get = $rslb->call_url($url, $rattr, 'updates');
// if(RevLoader::wp_remote_retrieve_response_code($get) == 200){
// $done = true;
// }else{
// $rslb->move_server_list();
// }
// $count++;
// }while($done == false && $count < 5);
// if(!$get || RevLoader::wp_remote_retrieve_response_code($get) != 200){
// }else{
// $upload_dir = RevLoader::wp_upload_dir();
// $file = $upload_dir['basedir']. '/revslider/templates/' . $plugin_slug . '.zip';
// @mkdir(dirname($file), 0777, true);
// $ret = @file_put_contents($file, $get['body']);
// WP_Filesystem();
// global $wp_filesystem;
// $upload_dir = RevLoader::wp_upload_dir();
// $d_path = WP_PLUGIN_DIR;
// $unzipfile = unzip_file($file, $d_path);
// if(is_wp_error($unzipfile)){
// define('FS_METHOD', 'direct'); //lets try direct.
// WP_Filesystem(); //WP_Filesystem() needs to be called again since now we use direct !
// //@chmod($file, 0775);
// $unzipfile = unzip_file($file, $d_path);
// if(is_wp_error($unzipfile)){
// $d_path = WP_PLUGIN_DIR;
// $unzipfile = unzip_file($file, $d_path);
// if(is_wp_error($unzipfile)){
// $f = basename($file);
// $d_path = str_replace($f, '', $file);
// $unzipfile = unzip_file($file, $d_path);
// }
// }
// }
// @unlink($file);
// return true;
// }
//$result = activate_plugin( $plugin_slug.'/'.$plugin_slug.'.php' );
return false;
}
/**
* Activates Installed Add-On/Plugin
*
* @since 1.0.0
*/
public function activate_addon($addon){
// Verify that the incoming request is coming with the security nonce
if(isset($addon)){
RevLoader::update_option($addon, true);
}else{
return false;
}
return true;
}
/**
* Deactivates Installed Add-On/Plugin
*
* @since 1.0.0
*/
public function deactivate_addon($addon){
RevLoader::update_option($addon, false);
return true;
// Verify that the incoming request is coming with the security nonce
// $result = deactivate_plugins($addon);
// return (is_wp_error($result)) ? false : true;
}
}
class Rev_addon_Admin extends RevSliderAddons {}
?>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,104 @@
<?php
if( !defined( 'ABSPATH') ) exit();
class RevSliderMemoryUsageInformation
{
private $real_usage;
private $statistics = array();
// Memory Usage Information constructor
public function __construct($real_usage = false)
{
$this->real_usage = $real_usage;
}
// Returns current memory usage with or without styling
public function getCurrentMemoryUsage($with_style = true)
{
$mem = memory_get_usage($this->real_usage);
return ($with_style) ? $this->byteFormat($mem) : $mem;
}
// Returns peak of memory usage
public function getPeakMemoryUsage($with_style = true)
{
$mem = memory_get_peak_usage($this->real_usage);
return ($with_style) ? $this->byteFormat($mem) : $mem;
}
// Set memory usage with info
public function setMemoryUsage($info = '')
{
$this->statistics[] = array(
'time' => microtime(), //time(),
'info' => $info,
'memory_usage' => $this->getCurrentMemoryUsage());
}
// Print all memory usage info and memory limit and
public function printMemoryUsageInformation()
{
//return true;
echo '<pre>';
foreach ($this->statistics as $satistic)
{
echo "Time: " . $satistic['time'] .
" | Memory Usage: " . $satistic['memory_usage'] .
" | Info: " . $satistic['info'];
echo "\n";
}
echo "\n\n";
echo "Peak of memory usage: " . $this->getPeakMemoryUsage();
echo "\n\n";
echo '</pre>';
}
// Set start with default info or some custom info
public function setStart($info = 'Initial Memory Usage')
{
$this->setMemoryUsage($info);
}
// Set end with default info or some custom info
public function setEnd($info = 'Memory Usage at the End')
{
$this->setMemoryUsage($info);
}
// Byte formatting
private function byteFormat($bytes, $unit = "", $decimals = 2)
{
$units = array('B' => 0, 'KB' => 1, 'MB' => 2, 'GB' => 3, 'TB' => 4,
'PB' => 5, 'EB' => 6, 'ZB' => 7, 'YB' => 8);
$value = 0;
if ($bytes > 0)
{
// Generate automatic prefix by bytes
// If wrong prefix given
if (!array_key_exists($unit, $units))
{
$pow = floor(log($bytes) / log(1024));
$unit = array_search($pow, $units);
}
// Calculate byte value by prefix
$value = ($bytes / pow(1024, floor($units[$unit])));
}
// If decimals is not numeric or decimals is less than 0
// then set default value
if (!is_numeric($decimals) || $decimals < 0)
{
$decimals = 2;
}
// Format output
return sprintf('%.' . $decimals . 'f ' . $unit, $value);
}
}
?>

View File

@@ -0,0 +1,579 @@
<?php
/**
* @author ThemePunch <info@themepunch.com>
* @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 RevLoader::__('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')), RevLoader::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 = RevLoader::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 = RevLoader::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/rbtools.min.js', 'js/rbtools.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/rbtools.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 = RevLoader::__('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, '<!-- FONT -->') !== false){
$fonts .= substr($this->slider_html, strpos($this->slider_html, '<!-- FONT -->'), strpos($this->slider_html, '<!-- /FONT -->') + 14 - strpos($this->slider_html, '<!-- FONT -->'))."\n";
$starthtml = substr($this->slider_html, 0, strpos($this->slider_html, '<!-- FONT -->'));
$endhtml = substr($this->slider_html, strpos($this->slider_html, '<!-- /FONT -->') + 14);
$this->slider_html = $starthtml.$endhtml; //remove from html markup
}
$fonts = str_replace(array('<!-- FONT -->', '<!-- /FONT -->'), '', $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, '<!-- SCRIPT -->') !== false){
$scripts .= substr($this->slider_html, strpos($this->slider_html, '<!-- SCRIPT -->'), strpos($this->slider_html, '<!-- /SCRIPT -->') + 16 - strpos($this->slider_html, '<!-- SCRIPT -->'))."\n";;
$starthtml = substr($this->slider_html, 0, strpos($this->slider_html, '<!-- SCRIPT -->'));
$endhtml = substr($this->slider_html, strpos($this->slider_html, '<!-- /SCRIPT -->') + 16);
$this->slider_html = $starthtml.$endhtml; //remove from html markup
}
$this->export_scripts = str_replace(array('<!-- SCRIPT -->', '<!-- /SCRIPT -->'), '', $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, '<!-- STYLE -->') !== false){
$styles .= substr($this->slider_html, strpos($this->slider_html, '<!-- STYLE -->'), strpos($this->slider_html, '<!-- /STYLE -->') + 15 - strpos($this->slider_html, '<!-- STYLE -->'))."\n";
$starthtml = substr($this->slider_html, 0, strpos($this->slider_html, '<!-- STYLE -->'));
$endhtml = substr($this->slider_html, strpos($this->slider_html, '<!-- /STYLE -->') + 15);
$this->slider_html = $starthtml.$endhtml; //remove from html markup
}
$this->export_styles = str_replace(array('<!-- STYLE -->', '<!-- /STYLE -->'), '', $styles); //remove the tags
}
/**
* create Header HTML for HTML export
**/
public function write_header_html(){
?><!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title><?php echo $this->slider_title; ?> - Slider Revolution</title>
<meta name="description" content="Slider Revolution Example" />
<meta name="keywords" content="fullscreen image, grid layout, flexbox grid, transition" />
<meta name="author" content="ThemePunch" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- LOAD JQUERY LIBRARY -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.js"></script>
<!-- LOADING FONTS AND ICONS -->
<?php echo $this->export_font; ?>
<link rel="stylesheet" type="text/css" href="<?php echo $this->path_fonts; ?>pe-icon-7-stroke/css/pe-icon-7-stroke.css">
<link rel="stylesheet" type="text/css" href="<?php echo $this->path_fonts; ?>font-awesome/css/font-awesome.css">
<!-- REVOLUTION STYLE SHEETS -->
<link rel="stylesheet" type="text/css" href="<?php echo $this->path_css; ?>rs6.css">
<!-- REVOLUTION LAYERS STYLES -->
<?php
if($this->export_real){
echo $this->export_styles;
$static_css = $this->get_static_css();
if($static_css !== ''){
$css = new RevSliderCssParser();
echo '<style type="text/css">';
echo $css->compress_css($static_css);
echo '</style>'."\n";
}
}else{
?>
<link rel="stylesheet" type="text/css" href="<?php echo $this->path_css; ?>layers.css">
<!-- REVOLUTION NAVIGATION STYLES -->
<link rel="stylesheet" type="text/css" href="<?php echo $this->path_css; ?>navigation.css">
<!-- FONT AND STYLE FOR BASIC DOCUMENTS, NO NEED FOR FURTHER USAGE IN YOUR PROJECTS-->
<link href="http://fonts.googleapis.com/css?family=Roboto%3A700%2C300" rel="stylesheet" property="stylesheet" type="text/css" media="all" />
<link rel="stylesheet" type="text/css" href="../../assets/css/noneed.css">
<?php
}
?>
<!-- REVOLUTION JS FILES -->
<script type="text/javascript" src="<?php echo $this->path_js; ?>rbtools.min.js"></script>
<script type="text/javascript" src="<?php echo $this->path_js; ?>rs6.min.js"></script>
<?php echo RevSliderFront::js_set_start_size(); ?>
</head>
<?php
}
/**
* create Body HTML for HTML export
**/
public function write_body_html(){
?>
<body>
<?php
if(!$this->export_real){
?>
<!-- HEADER -->
<article class="content">
<!-- Add your site or application content here -->
<section class="header">
<span class="logo" style="float:left"></span>
<a class="button" style="float:right" target="_blank" href="https://www.themepunch.com/revsliderjquery-doc/slider-revolution-jquery-5-x-documentation/"><i class="pe-7s-help2"></i>Online Documentation</a>
<div class="clearfix"></div>
</section>
</article>
<?php
if($this->layouttype != 'fullscreen'){
?>
<article class="small-history">
<h2 class="textaligncenter" style="margin-bottom:25px;">Your Slider Revolution jQuery Plugin</h2>
<p>Slider Revolution is an innovative, responsive Slider Plugin that displays your content the beautiful way. Whether it's a <strong>Slider, Carousel, Hero Scene</strong> or even a whole <strong>Front Page</strong>.<br>The <a href="https://www.themepunch.com/links/slider_revolution_jquery_visual_editor" target="_blank">visual drag &amp; drop editor</a> will help you to create your Sliders and tell your own stories in no time!</p>
</article>
<?php
}
?>
<!-- SLIDER EXAMPLE -->
<section class="example">
<article class="content">
<?php
}
if(!$this->export_real){
?>
</article>
</section>
<div class="bottom-history-wrap" style="margin-top:150px">
<?php
if($this->layouttype == 'fullscreen'){
?>
<article class="small-history bottom-history" style="background:#f5f7f9;">
<h2 class="textaligncenter" style="margin-bottom:25px;">Your Slider Revolution jQuery Plugin</h2>
<p>Slider Revolution is an innovative, responsive Slider Plugin that displays your content the beautiful way. Whether it's a <strong>Slider, Carousel, Hero Scene</strong> or even a whole <strong>Front Page</strong>.<br>The <a href="https://www.themepunch.com/links/slider_revolution_jquery_visual_editor" target="_blank">visual drag &amp; drop editor</a> will help you to create your Sliders and tell your own stories in no time!</p>
</article>
<?php
}
?>
<article class="small-history bottom-history">
<i class="fa-icon-question tp-headicon"></i>
<h2 class="textaligncenter" style="margin-bottom:25px;">Find the Documentation ?</h2>
<p>We would always recommend to use our<a target="_blank" href="https://www.themepunch.com/revsliderjquery-doc/slider-revolution-jquery-5-x-documentation/"> online documentation</a> 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 <a href="http://themepunch.com">http://themepunch.com</a> ! </p>
<div class="tp-smallinfo">Learn how to build your Slider!</div>
</article>
<article class="small-history bottom-history" style="background:#f5f7f9;">
<i class="fa-icon-arrows tp-headicon"></i>
<h2 class="textaligncenter" style="margin-bottom:25px;">Navigation Examples !</h2>
<p>You find many Examples for All Skins and Positions of Navigation examples in the <a target="_blank" href="file:../Navigation">examples/Navigation folder</a>. 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.</p>
<div class="tp-smallinfo">Customize the interaction with your visitor!</div>
</article>
<article class="small-history bottom-history">
<i class="fa-icon-cog tp-headicon"></i>
<h2 class="textaligncenter" style="margin-bottom:25px;">Layer and Slide Transitions</h2>
<p>We prepared a small List of Transition and a light weight Markup Builder in the <a target="_blank" href="file:../Transitions"> examples/Transitions folder</a>. 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.</p>
<div class="tp-smallinfo">Eye Catching Effects!</div>
</article>
</div>
<div class="clearfix"></div>
<footer>
<div class="footer_inner">
<div class="footerwidget">
<h3>Slider Revolution</h3>
<a href="https://revolution.themepunch.com/jquery/#features" target="_self">Features</a>
<a href="https://revolution.themepunch.com/examples-jquery/" target="_self">Usage Examples</a>
<a href="https://www.themepunch.com/revsliderjquery-doc/slider-revolution-jquery-5-x-documentation/" target="_blank">Online Documentation</a>
</div>
<div class="footerwidget">
<h3>Resources</h3>
<a href="https://www.classydevs.com/support/" target="_blank">FAQ Database</a>
<a href="https://themepunch.com" target="_blank">ThemePunch.com</a>
<a href="https://themepunch.us9.list-manage.com/subscribe?u=a5738148e5ec630766e28de16&amp;id=3e718acc63" target="_blank">Newsletter</a>
<a href="https://www.themepunch.com/products/" target="_blank">Plugins</a>
<a href="https://www.themepunch.com/products/" target="_blank">Themes</a>
</div>
<div class="footerwidget">
<h3>More Versions</h3>
<a href="https://revolution.themepunch.com" target="_blank">WordPress</a>
<a href="https://www.themepunch.com/links/slider_revolution_prestashop" target="_blank">Prestashop</a>
<a href="https://www.themepunch.com/links/slider_revolution_magento" target="_blank">Magento</a>
<a href="https://www.themepunch.com/links/slider_revolution_opencart" target="_blank">OpenCart</a>
</div>
<div class="footerwidget social">
<h3>Follow Us</h3>
<ul>
<li><a href="https://www.facebook.com/wordpress.slider.revolution" target="_blank" class="so_facebook" data-rel="tooltip" data-animation="false" data-placement="bottom" data-original-title="Facebook"><i class="s_icon fa-icon-facebook "></i></a>
</li>
<li><a href="https://twitter.com/revslider" target="_blank" class="so_twitter" data-rel="tooltip" data-animation="false" data-placement="bottom" data-original-title="Twitter"><i class="s_icon fa-icon-twitter"></i></a>
</li>
</ul>
</div>
<div class="clearfix"></div>
</div>
</footer>
<script type="text/javascript" src="../../assets/warning.js"></script>
<?php
}
?>
</body>
<?php
}
/**
* create Footer HTML for HTML export
**/
public function write_footer_html(){
?>
</html>
<?php
}
}
?>

View File

@@ -0,0 +1,813 @@
<?php
/**
* @author ThemePunch <info@themepunch.com>
* @link https://www.themepunch.com/
* @copyright 2019 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 = RevLoader::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')), RevLoader::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;
}elseif(!in_array($this->get_val($layer, array('media', 'mediaType')), array('html5', 'audio'))){ //video cover image
if($this->get_val($layer, array('media', 'audioUrl')) != '') $this->used_videos[$this->get_val($layer, array('media', 'audioUrl'))] = true;
}
if($this->get_val($layer, array('media', 'mediaType')) != 'html5'){
$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 = RevLoader::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;
$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){
$this->fill_animations();
foreach($this->animations as $animation){
if($animation['id'] == $id){
return array(
'id' => $animation['id'],
'handle' => $animation['handle'],
'params' => json_decode(str_replace("'", '"', $this->get_val($animation, 'params', array())), true),
'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(RevLoader::__("Can't create zip file: ", 'revslider').$this->export_path_zip);
}else{
//fallback to pclzip
//track
$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)){
$c_url = RevLoader::content_url();
$c_path = ABSPATH . 'wp-content';
$ud = RevLoader::wp_upload_dir();
$up_dir = $this->get_val($ud, 'baseurl');
foreach($this->used_svg as $file => $val){
if(strpos($file, 'http') !== false){ //remove all up to wp-content folder
$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;
}
$file = str_replace('/', '\/', $file);
$checkpath2 = str_replace('/', '\/', str_replace('/revslider/assets/svg', '', $checkpath2));
if(is_file($c_path.$checkpath)){
$this->export_data = str_replace($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 = RevLoader::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(RevLoader::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-Description: File Transfer');
header("Content-Type: application/zip");
header('Content-Disposition: attachment; filename="'.$exportname.'"');
header('Expires: 0');
header('Cache-Control: must-revalidate');
header('Pragma: public');
header('Content-Length: ' . filesize($this->export_path_zip));
ob_clean();
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;
}
}
?>

View File

@@ -0,0 +1,159 @@
<?php
/**
* @author ThemePunch <info@themepunch.com>
* @link https://www.themepunch.com/
* @copyright 2019 ThemePunch
* @since 6.0
*/
if(!defined('ABSPATH')) exit();
class RevSliderFolder extends RevSliderSlider {
public $folder = false;
/**
* Initialize A slider as a Folder
**/
public function init_folder_by_id($id){
global $wpdb;
$folder = $wpdb->get_row($wpdb->prepare("SELECT * FROM ". $wpdb->prefix . RevSliderFront::TABLE_SLIDER ." WHERE `id` = %s AND `type` = 'folder'", $id), ARRAY_A);
if(!empty($folder)){
$this->id = $this->get_val($folder, 'id');
$this->title = $this->get_val($folder, 'title');
$this->alias = $this->get_val($folder, 'alias');
$this->settings = (array)json_decode($this->get_val($folder, 'settings', ''));
$this->params = (array)json_decode($this->get_val($folder, 'params', ''));
$this->folder = true;
return true;
}else{
return false;
}
}
/**
* Get all Folders from the Slider Table
**/
public function get_folders(){
global $wpdb;
$folders = array();
$entries = $wpdb->get_results("SELECT `id` FROM ". $wpdb->prefix . RevSliderFront::TABLE_SLIDER ." WHERE `type` = 'folder'", ARRAY_A);
if(!empty($entries)){
foreach($entries as $folder){
$slider = new RevSliderFolder();
$folder_id = $this->get_val($folder, 'id');
$slider->init_folder_by_id($folder_id);
$folders[] = $slider;
}
}
return $folders;
}
/**
* Get all Folders from the Slider Table
**/
public function get_folder_by_id($id){
global $wpdb;
$folder = $wpdb->get_row($wpdb->prepare("SELECT * FROM ". $wpdb->prefix . RevSliderFront::TABLE_SLIDER ." WHERE `type` = 'folder' AND `id` = %s", $id), ARRAY_A);
return $folder;
}
/**
* Create a new Slider as a Folder
**/
public function create_folder($alias = 'New Folder', $parent = 0){
global $wpdb;
$title = RevLoader::esc_html($alias);
$alias = RevLoader::sanitize_title($title);
$temp = $title;
$folder = false;
$ti = 1;
while($this->alias_exists($alias)){ //set a new alias and title if its existing in database
$title = $temp . ' ' . $ti;
$alias = RevLoader::sanitize_title($title);
$ti++;
}
//check if Slider with title and/or alias exists, if yes change both to stay unique
//commented
//$done = $wpdb->insert($wpdb->prefix . RevSliderFront::TABLE_SLIDER, array('title' => $title, 'alias' => $alias, 'type' => 'folder'));
$done = $wpdb->insert($wpdb->prefix . RevSliderFront::TABLE_SLIDER, array('title' => $title, 'alias' => $alias, 'params' => '', 'settings'=>'', 'type' => 'folder'));
if($done !== false){
$this->init_folder_by_id($wpdb->insert_id);
$folder = $this;
if(intval($parent) > 0){
$slider = new RevSliderFolder();
$slider->init_folder_by_id($parent);
$children = $slider->get_children();
$children = (!is_array($children)) ? array() : $children;
$children[] = $this->get_id();
$slider->add_slider_to_folder($children, $parent);
}
}
return $folder;
}
/**
* Add a Slider ID to a Folder
**/
public function add_slider_to_folder($children, $folder_id, $replace_all = true){
global $wpdb;
$response = false;
$folder = $wpdb->get_row($wpdb->prepare("SELECT * FROM ". $wpdb->prefix . RevSliderFront::TABLE_SLIDER ." WHERE `id` = %s AND `type` = 'folder'", $folder_id), ARRAY_A);
if(!empty($folder)){
$settings = json_decode($this->get_val($folder, 'settings'), true);
if(!isset($settings['children'])){
$settings['children'] = array();
}
if($replace_all){
$settings['children'] = $children;
}else{
$children = (array)$children;
if(!empty($children)){
foreach($children as $child){
if(!in_array($child, $settings['children'])){
$settings['children'][] = $child;
}
}
}
}
$response = $wpdb->update($wpdb->prefix . RevSliderFront::TABLE_SLIDER, array('settings' => json_encode($settings)), array('id' => $folder_id));
$response = ($response == false && empty($wpdb->last_error)) ? true : $response;
}
return $response;
}
/**
* Get the Children of the folder (if any exist)
**/
public function get_children(){
return $this->get_val($this->settings, 'children', array());
}
/**
* Get the Children of the folder (if any exist)
* @since: 6.1.4
**/
public function set_children($children){
return $this->set_val($this->settings, 'children', $children);
}
}
?>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,223 @@
<?php
/**
* @author ThemePunch <info@themepunch.com>
* @link https://www.themepunch.com/
* @copyright 2020 ThemePunch
* @since 6.2.0
*/
if ( ! defined( 'ABSPATH' ) ) {
exit();
}
class RevSliderLicense extends RevSliderFunctions {
private static $licence_url = 'https://classydevs.com/';
private static $item_id = '13738';
private static $current = '';
private static $licence_status = 'rs6_licence_status';
private static $licence_data = 'rs6_licence_dataset';
private static $licence_ex = 'rs6_licence_expires';
/**
* Activate the Plugin through the ThemePunch Servers
*
* @before 6.0.0: RevSliderOperations::checkPurchaseVerification();
* @before 6.2.0: RevSliderAdmin::activate_plugin();
**/
public function activate_plugin( $code, $auto = false ) {
$rs6_licence_date = RevLoader::get_option( 'rs6_licence_date', '' );
$first_install = false;
if ( $rs6_licence_date == '' ) {
$today = date( 'Y-m-d' );
$rs6_licence_date = RevLoader::update_option( 'rs6_licence_date', $today );
$first_install = true;
}
if ( $rs6_licence_date != '' ) {
$today = date( 'Y-m-d' );
if ( $auto == true ) {
if ( ( strtotime( $today ) == strtotime( $rs6_licence_date ) ) && ! $first_install ) {
return false;
}
}
}
$array = array(
'edd_action' => 'activate_license',
'license' => $code,
'item_id' => self::$item_id, // The ID of the item in EDD
'url' => _PS_BASE_URL_SSL_,
);
$url = self::$licence_url . '?' . http_build_query( $array );
if ( $code ) {
$response = self::wp_remote_get(
$url,
array(
'timeout' => 15,
'headers' => '',
'header' => false,
'json' => true,
)
);
$responsearray = Tools::jsonDecode( $response, true );
if ( $responsearray['success'] == 'true' && $responsearray['license'] == 'valid' ) {
RevLoader::update_option( 'revslider-valid', 'true' );
RevLoader::update_option( 'revslider-code', $code );
RevLoader::update_option( self::$licence_data, $response );
RevLoader::update_option( self::$licence_ex, $responsearray['expires'] );
$rs6_licence_date = RevLoader::update_option( 'rs6_licence_date', $today );
return true;
} else {
RevLoader::update_option( 'revslider-valid', $responsearray['license'] );
RevLoader::update_option( 'revslider-code', '' );
RevLoader::update_option( self::$licence_data, $response );
RevLoader::update_option( self::$licence_ex, $responsearray['license'] );
$rs6_licence_date = RevLoader::update_option( 'rs6_licence_date', $today );
return false;
}
} else {
RevLoader::update_option( 'revslider-code', '' );
RevLoader::update_option( 'revslider-valid', 'false' );
RevLoader::update_option( self::$licence_data, 'false' );
RevLoader::update_option( self::$licence_ex, 'false' );
return false;
}
}
/**
* Deactivate the Plugin through the ThemePunch Servers
*
* @before 6.0.0: RevSliderOperations::doPurchaseDeactivation();
* @before 6.2.0: RevSliderAdmin::deactivate_plugin();
**/
public function deactivate_plugin() {
$code = RevLoader::get_option( 'revslider-code', '' );
$array = array(
'edd_action' => 'deactivate_license',
'license' => $code,
'item_id' => self::$item_id,
'url' => _PS_BASE_URL_SSL_,
);
$url = self::$licence_url . '?' . http_build_query( $array );
if ( $code ) {
$response = self::wp_remote_get(
$url,
array(
'timeout' => 15,
'headers' => '',
'header' => false,
'json' => true,
)
);
$responsearray = Tools::jsonDecode( $response, true );
if ( $responsearray['success'] == true ) {
RevLoader::update_option( self::$licence_data, $response );
RevLoader::update_option( self::$licence_ex, $responsearray['expires'] );
RevLoader::update_option( 'revslider-valid', 'false' );
RevLoader::update_option( 'revslider-code', '' );
$today = date( 'Y-m-d' );
$ce_licence_date = RevLoader::update_option( 'ce_licence_date', $today );
return true;
}
}
return false;
}
public static function wp_remote_get( $url, $args = array() ) {
return self::getHttpCurl( $url, $args );
}
public static function getHttpCurl( $url, $args ) {
global $wp_version;
if ( function_exists( 'curl_init' ) ) {
$defaults = array(
'method' => 'GET',
'timeout' => 30,
'redirection' => 5,
'httpversion' => '1.0',
'blocking' => true,
'headers' => array(
'Authorization' => 'Basic ',
'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8',
'Accept-Encoding' => 'x-gzip,gzip,deflate',
),
'body' => array(),
'cookies' => array(),
'user-agent' => 'Prestashop' . $wp_version,
'header' => true,
'sslverify' => false,
'json' => false,
);
$args = array_merge( $defaults, $args );
$curl_timeout = ceil( $args['timeout'] );
$curl = curl_init();
if ( $args['httpversion'] == '1.0' ) {
curl_setopt( $curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0 );
} else {
curl_setopt( $curl, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1 );
}
curl_setopt( $curl, CURLOPT_USERAGENT, $args['user-agent'] );
curl_setopt( $curl, CURLOPT_URL, $url );
curl_setopt( $curl, CURLOPT_CONNECTTIMEOUT, $curl_timeout );
curl_setopt( $curl, CURLOPT_TIMEOUT, $curl_timeout );
curl_setopt( $curl, CURLOPT_POST, 1 );
curl_setopt( $curl, CURLOPT_POSTFIELDS, 'api=true' );
$ssl_verify = $args['sslverify'];
curl_setopt( $curl, CURLOPT_SSL_VERIFYPEER, $ssl_verify );
curl_setopt( $curl, CURLOPT_SSL_VERIFYHOST, ( $ssl_verify === true ) ? 2 : false );
$http_headers = array();
if ( $args['header'] ) {
curl_setopt( $curl, CURLOPT_HEADER, $args['header'] );
foreach ( $args['headers'] as $key => $value ) {
$http_headers[] = "{$key}: {$value}";
}
}
curl_setopt( $curl, CURLOPT_FOLLOWLOCATION, false );
if ( defined( 'CURLOPT_PROTOCOLS' ) ) { // PHP 5.2.10 / cURL 7.19.4
curl_setopt( $curl, CURLOPT_PROTOCOLS, CURLPROTO_HTTP | CURLPROTO_HTTPS );
}
if ( is_array( $args['body'] ) || is_object( $args['body'] ) ) {
$args['body'] = http_build_query( $args['body'] );
}
$http_headers[] = 'Content-Length: ' . strlen( $args['body'] );
curl_setopt( $curl, CURLOPT_RETURNTRANSFER, 1 );
$response = curl_exec( $curl );
if ( $args['json'] ) {
return $response;
}
$header_size = curl_getinfo( $curl, CURLINFO_HEADER_SIZE );
$responseHeader = substr( $response, 0, $header_size );
$responseBody = substr( $response, $header_size );
$error = curl_error( $curl );
$errorcode = curl_errno( $curl );
$info = curl_getinfo( $curl );
curl_close( $curl );
$info_as_response = $info;
$info_as_response['code'] = $info['http_code'];
$info_as_response['message'] = 'OK';
$response = array(
'body' => $responseBody,
'headers' => $responseHeader,
'info' => $info,
'response' => $info_as_response,
'error' => $error,
'errno' => $errorcode,
);
return $response;
}
return false;
}
}

View File

@@ -0,0 +1,130 @@
<?php
/**
* @author ThemePunch <info@themepunch.com>
* @link https://www.themepunch.com/
* @copyright 2019 ThemePunch
*/
if(!defined('ABSPATH')) exit();
class RevSliderLoadBalancer {
public $servers = array();
/**
* set the server list on construct
**/
public function __construct(){
$this->servers = RevLoader::get_option('revslider_servers', array());
$this->servers = (empty($this->servers)) ? array('themepunch.tools') : $this->servers;
}
/**
* get the url depending on the purpose, here with key, you can switch do a different server
**/
public function get_url($purpose, $key = 0, $force_http = false){
$url = ($force_http ) ? 'http://' : 'https://';
$use_url = (!isset($this->servers[$key])) ? reset($this->servers) : $this->servers[$key];
switch($purpose){
case 'updates':
$url .= 'updates.';
break;
case 'templates':
$url .= 'templates.';
break;
case 'library':
$url .= 'library.';
break;
default:
return false;
}
$url .= $use_url;
return $url;
}
/**
* refresh the server list to be used, will be done once in a month
**/
public function refresh_server_list($force = false){
global $wp_version;
$rs_rsl = (isset($_GET['rs_refresh_server'])) ? true : false;
$last_check = RevLoader::get_option('revslider_server_refresh', false);
if($force === true || $rs_rsl == true || $last_check === false || time() - $last_check > 60 * 60 * 24 * 14){
//$url = $this->get_url('updates');
$url = 'https://updates.themepunch.tools';
$request = RevLoader::wp_remote_post($url.'/get_server_list.php', array(
'user-agent' => 'revphp; '. RevLoader::get_bloginfo('url'),
'body' => array(
'item' => urlencode(RS_PLUGIN_SLUG),
'version' => urlencode(RS_REVISION)
),
'timeout' => 45
));
if(! RevLoader::is_wp_error($request)){
if($response = RevLoader::maybe_unserialize($request['body'])){
$list = json_decode($response, true);
RevLoader::update_option('revslider_servers', $list);
}
}
RevLoader::update_option('revslider_server_refresh', time());
}
}
/**
* move the server list, to take the next server as the one currently seems unavailable
**/
public function move_server_list(){
$servers = $this->servers;
$a = array_shift($servers);
$servers[] = $a;
$this->servers = $servers;
RevLoader::update_option('revslider_servers', $servers);
}
/**
* call an themepunch URL and retrieve data
**/
public function call_url($url, $data, $subdomain = 'updates', $force_http = false){
global $wp_version;
//add version if not passed
$data['version'] = (!isset($data['version'])) ? urlencode(RS_REVISION) : $data['version'];
$done = false;
$count = 0;
do{
$server = $this->get_url($subdomain, 0, $force_http);
$request = RevLoader::wp_remote_post($server.'/'.$url, array(
'user-agent' => 'revphp;'.RevLoader::get_bloginfo('url'),
'body' => $data,
'timeout' => 45
));
$response_code = RevLoader::wp_remote_retrieve_response_code($request);
if($response_code == 200){
$done = true;
}else{
$this->move_server_list();
}
$count++;
}while($done == false && $count < 5);
return $request;
}
}
?>

View File

@@ -0,0 +1,84 @@
<?php
/**
* @author ThemePunch <info@themepunch.com>
* @link https://www.themepunch.com/
* @copyright 2019 ThemePunch
* @version 1.0.0
*/
if(!defined('ABSPATH')) exit();
if(!class_exists('ThemePunch_Newsletter')) {
class ThemePunch_Newsletter {
protected static $remote_url = 'http://newsletter.themepunch.com/';
protected static $subscribe = 'subscribe.php';
protected static $unsubscribe = 'unsubscribe.php';
public function __construct(){
}
/**
* Subscribe to the ThemePunch Newsletter
* @since: 1.0.0
**/
public static function subscribe($email){
global $wp_version;
$request = wp_remote_post(self::$remote_url.self::$subscribe, array(
'user-agent' => 'WordPress/'.$wp_version.'; '.get_bloginfo('url'),
'timeout' => 15,
'body' => array(
'email' => urlencode($email)
)
));
if(!RevLoader::is_wp_error($request)) {
if($response = json_decode($request['body'], true)) {
if(is_array($response)) {
$data = $response;
return $data;
}else{
return false;
}
}
}
}
/**
* Unsubscribe to the ThemePunch Newsletter
* @since: 1.0.0
**/
public static function unsubscribe($email){
global $wp_version;
$request = wp_remote_post(self::$remote_url.self::$unsubscribe, array(
'user-agent' => 'WordPress/'.$wp_version.'; '.get_bloginfo('url'),
'timeout' => 15,
'body' => array(
'email' => urlencode($email)
)
));
if(!RevLoader::is_wp_error($request)) {
if($response = json_decode($request['body'], true)) {
if(is_array($response)) {
$data = $response;
return $data;
}else{
return false;
}
}
}
}
}
}
?>

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,925 @@
<?php
/**
* @author ThemePunch <info@themepunch.com>
* @link https://www.themepunch.com/
* @copyright 2019 ThemePunch
*/
if(!defined('ABSPATH')) exit();
class RevSliderTooltips {
public static function getTooltips() {
$translations = array(
'docs' => RevLoader::__('Docs', 'revslider'),
'next_tip' => RevLoader::__('Next Tip'),
'got_it' => RevLoader::__('Got It'),
'hide_tips' => RevLoader::__("Don't show tooltips again")
);
$tooltips = array(
'help_mode' => array(
'title' => 'Help Mode',
'target' => '.help_wrap',
'alignment' => 'bottom',
'margin' => '20px 0 0 0',
'text' => 'Get information about the different options available for your Slider',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/support/'
),
'slides' => array(
'title' => 'Add Slide',
'target' => '#add_slide_toolbar_wrap',
'alignment' => 'bottom',
'margin' => '20px 0 0 0',
'text' => "Add new Slides, reorder your current Slides and manage the Module's global content",
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/slide-management/'
),
'add_layer' => array(
'title' => 'Add Layer',
'target' => '#add_layer_toolbar_wrap',
'alignment' => 'bottom',
'margin' => '20px 0 0 0',
'text' => 'Add new content to the currently active Slide'
),
'tooltip_button' => array(
'title' => 'Tooltip Button',
'target' => '.tooltip_wrap',
'alignment' => 'bottom',
'margin' => '20px 0 0 0',
'text' => 'Enable the tooltip wizard for a quick overview of the editor'
),
'undo_redo' => array(
'title' => 'Undo Redo',
'target' => '.undo_redo_wrap',
'alignment' => 'bottom',
'margin' => '20px 0 0 0',
'text' => "Undo or redo changes you've made while using the editor"
),
'quick_style' => array(
'title' => 'Quick Style Layer',
'target' => '#quick_style_trigger',
'alignment' => 'bottom',
'margin' => '20px 0 0 0',
'text' => 'Add pre-styled headlines, paragraph text and buttons to the current Slide'
),
'device_switcher' => array(
'title' => 'Device View Switcher',
'target' => '#main_screenselector',
'alignment' => 'bottom',
'margin' => '20px 0 0 0',
'trigger' => '#main_screenselector:visible',
'text' => "Adjust your content's size and position for different screen sizes"
),
'layer_selections' => array(
'title' => 'Layer Selections',
'target' => '#toolkit_selector_wrap',
'alignment' => 'bottom',
'margin' => '20px 0 0 0',
'text' => 'Choose the way you would like to select multiple Layers on the stage'
),
'slider_settings' => array(
'title' => 'Slider Settings',
'target' => '#module_settings_trigger',
'alignment' => 'bottom',
'margin' => '20px 0 0 0',
'elementcss' => 'width: 80px',
'focus' => 'none',
'trigger' => array('#module_settings_trigger'),
'text' => "Adjust the module's Layout and set its Slideshow behavior"
),
'slider_navigation' => array(
'title' => 'Slider Navigation',
'target' => '#module_navigation_trigger',
'alignment' => 'bottom',
'margin' => '20px 0 0 0',
'elementcss' => 'width: 80px',
'focus' => 'none',
'trigger' => array('#module_navigation_trigger'),
'text' => 'Add a variety of navigation elements to your Slider'
),
'slide_settings' => array(
'title' => 'Slide Settings',
'target' => '#module_slide_trigger',
'alignment' => 'bottom-left',
'margin' => '20px 0 0 78px',
'elementcss' => 'width: 80px',
'focus' => 'none',
'trigger' => array('#module_slide_trigger'),
'text' => "Set the Slide's main background and slide-change animation"
),
'layer_settings' => array(
'title' => 'Layer Settings',
'target' => '#module_layers_trigger',
'alignment' => 'bottom-left',
'margin' => '20px 0 0 78px',
'elementcss' => 'width: 80px',
'focus' => 'none',
'trigger' => array('#module_layers_trigger'),
'text' => "Adjust the size and position for your Slide's content"
),
'shortcode' => array(
'title' => 'Title/Shortcode',
'target' => '#sr_shortcode',
'placer' => '#rs_shortcode_label',
'alignment' => 'left',
'margin' => '-4px 0 0 -17px',
'trigger' => array('#module_settings_trigger', '#gst_sl_1'),
'section' => 'Module General Options -> Title',
'text' => 'The shortcode for the module is located here.'
),
'back' => array(
'title' => 'Back to Plugin Admin Page',
'target' => '#back_to_overview',
'alignment' => 'bottom-right',
'margin' => '20px 0 0 -90px',
'text' => "Click here to go back to the plugin's main admin page"
),
'add_slide' => array(
'title' => 'Add Slide',
'target' => '#add_slide_toolbar_wrap',
'focus' => '.toolbar_dd_subdrop_wrap',
'alignment' => 'top-right',
'margin' => '-5px 0 0 20px',
'cssClass' => 'tip-hover',
'text' => 'Add a new Slide to the Slider',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/slide-management/'
),
'global_layers' => array(
'title' => 'Global Layers',
'target' => '#add_slide_toolbar_wrap',
'focus' => '.static-slide-btn',
'alignment' => 'top-right',
'margin' => '-5px 0 0 20px',
'cssClass' => 'tip-hover tip-hover-staticlayers',
'text' => 'Content that should always be visible throughout the life-cycle of your Slider exists here',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/global-layers/'
),
'slide_order' => array(
'title' => 'Change Slide Order',
'target' => '#add_slide_toolbar_wrap',
'focus' => '.slide_list_element.selected',
'alignment' => 'top-right',
'margin' => '-5px 0 0 20px',
'cssClass' => 'tip-hover tip-hover-slideorder',
'text' => 'Drag these menu items on top of one another to change the order of your Slides',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/slide-management/#switch-reorder-slides'
),
'add_layer_text' => array(
'title' => 'Add Text Layer',
'target' => '#add_layer_toolbar_wrap',
'focus' => '#toolbar_add_layer_text',
'alignment' => 'top-right',
'margin' => '-5px 0 0 20px',
'cssClass' => 'tip-hover tip-hover-text',
'text' => 'Add a text element to the current Slide',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/layer-content/'
),
'add_layer_image' => array(
'title' => 'Add Image Layer',
'target' => '#add_layer_toolbar_wrap',
'focus' => '#toolbar_add_layer_image',
'alignment' => 'top-right',
'margin' => '-5px 0 0 20px',
'cssClass' => 'tip-hover tip-hover-image',
'text' => 'Add an image to the current Slide',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/layer-content/'
),
'add_layer_button' => array(
'title' => 'Add Button Layer',
'target' => '#add_layer_toolbar_wrap',
'focus' => '#toolbar_add_layer_button',
'alignment' => 'top-right',
'margin' => '-5px 0 0 20px',
'cssClass' => 'tip-hover tip-hover-button',
'text' => 'Add a pre-styled button to the current Slide',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/layer-content/'
),
'add_layer_shape' => array(
'title' => 'Add Shape Layer',
'target' => '#add_layer_toolbar_wrap',
'focus' => '#toolbar_add_layer_shape',
'alignment' => 'top-right',
'margin' => '-5px 0 0 20px',
'cssClass' => 'tip-hover tip-hover-shape',
'text' => 'Shapes are elements with a background colors but not content',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/layer-content/'
),
'add_layer_video' => array(
'title' => 'Add Video Layer',
'target' => '#add_layer_toolbar_wrap',
'focus' => '#toolbar_add_layer_video',
'alignment' => 'top-right',
'margin' => '-5px 0 0 20px',
'cssClass' => 'tip-hover tip-hover-video',
'text' => 'Add a YouTube, Vimeo or HTML5 video to the current Slide',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/layer-content/'
),
'add_layer_audio' => array(
'title' => 'Add Audio Layer',
'target' => '#add_layer_toolbar_wrap',
'focus' => '#toolbar_add_layer_audio',
'alignment' => 'top-right',
'margin' => '-5px 0 0 20px',
'cssClass' => 'tip-hover tip-hover-audio',
'text' => 'Add sound to the current Slide',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/layer-content/'
),
'add_layer_object' => array(
'title' => 'Add Object Layer',
'target' => '#add_layer_toolbar_wrap',
'focus' => '#toolbar_add_layer_object',
'alignment' => 'top-right',
'margin' => '-5px 0 0 20px',
'cssClass' => 'tip-hover tip-hover-object',
'text' => 'Add a simple icon or SVG element to the current Slide',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/layer-content/'
),
'add_layer_row' => array(
'title' => 'Add Row',
'target' => '#add_layer_toolbar_wrap',
'focus' => '#toolbar_add_layer_row',
'alignment' => 'top-right',
'margin' => '-5px 0 0 20px',
'cssClass' => 'tip-hover tip-hover-row',
'text' => 'Add a new Row to the current Slide to allow for Rows/Column-based content',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/rows-columns/'
),
'add_layer_group' => array(
'title' => 'Add Group',
'target' => '#add_layer_toolbar_wrap',
'focus' => '#toolbar_add_layer_group',
'alignment' => 'top-right',
'margin' => '-5px 0 0 20px',
'cssClass' => 'tip-hover tip-hover-group',
'text' => 'Add a special container to the Slide that can then include multiple Layers grouped together',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/layer-groups/'
),
'add_layer_layerlibrary' => array(
'title' => 'Layer Library',
'target' => '#add_layer_toolbar_wrap',
'focus' => '#add_from_layerlibrary',
'alignment' => 'top-right',
'margin' => '-5px 0 0 20px',
'cssClass' => 'tip-hover tip-hover-layerlibrary',
'text' => 'Add a text-based template that includes a predefined style and animation',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/layer-content/'
),
'add_layer_importlayer' => array(
'title' => 'Import Layer',
'target' => '#add_layer_toolbar_wrap',
'focus' => '#import_layers',
'alignment' => 'top-right',
'margin' => '-5px 0 0 20px',
'cssClass' => 'tip-hover tip-hover-importlayer',
'text' => 'Import a Layer from another Slider or Slide',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/layer-content/'
),
'delete_layer' => array(
'title' => 'Delete Layer',
'target' => '#do_delete_layer',
'alignment' => 'bottom',
'margin' => '20px 0 0 0',
'trigger' => array('#module_layers_trigger'),
'text' => 'Delete the currently selected Layer',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/editor-overview/'
),
'duplicate_layer' => array(
'title' => 'Duplicate Layer',
'target' => '#duplicate_btn_icon',
'focus' => '#do_duplicate_layer',
'alignment' => 'top-left',
'margin' => '-5px 0 0 -20px',
'trigger' => array('#module_layers_trigger'),
'cssClass' => 'tip-hover tip-hover-duplicate',
'text' => 'Duplicate the currently selected Layer',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/editor-overview/'
),
'copy_layer' => array(
'title' => 'Copy Layer',
'target' => '#duplicate_btn_icon',
'focus' => '#do_copy_layer',
'alignment' => 'top-left',
'margin' => '-5px 0 0 -20px',
'trigger' => array('#module_layers_trigger'),
'cssClass' => 'tip-hover tip-hover-copy',
'text' => 'Copy the current Layer and paste it into another Slide',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/editor-overview/'
),
'paste_layer' => array(
'title' => 'Paste Layer',
'target' => '#duplicate_btn_icon',
'focus' => '#do_paste_layer',
'alignment' => 'top-left',
'margin' => '-5px 0 0 -20px',
'trigger' => array('#module_layers_trigger'),
'cssClass' => 'tip-hover tip-hover-paste',
'text' => 'Paste a copied Layer into the current Slide',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/editor-overview/'
),
'lock_layers' => array(
'title' => 'Lock Layers',
'target' => '#do_lock_layer',
'focus' => '#toggle_lock_layer',
'alignment' => 'top-left',
'margin' => '-5px 0 0 -20px',
'trigger' => array('#module_layers_trigger'),
'cssClass' => 'tip-hover tip-hover-lock',
'text' => 'Lock the currently selected Layer(s) from being edited',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/editor-overview/'
),
'unlock_layers' => array(
'title' => 'Unlock Layers',
'target' => '#do_lock_layer',
'focus' => '#unlock_all_layer',
'alignment' => 'top-left',
'margin' => '-5px 0 0 -20px',
'trigger' => array('#module_layers_trigger'),
'cssClass' => 'tip-hover tip-hover-unlock',
'text' => 'Unlock the currently selected Layers so they can be edited',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/editor-overview/'
),
'hide_highlight_boxes' => array(
'title' => 'Hide Highlight Boxes',
'target' => '#do_show_layer',
'focus' => '#hide_highlight_boxes',
'alignment' => 'top-left',
'margin' => '-5px 0 0 -20px',
'trigger' => array('#module_layers_trigger'),
'cssClass' => 'tip-hover tip-hover-highlightboxes',
'text' => "Hide the editor's outline guide markers",
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/editor-overview/'
),
'show_hide_selected' => array(
'title' => 'Show/Hide Selected',
'target' => '#do_show_layer',
'focus' => '#toggle_visible_layer',
'alignment' => 'top-left',
'margin' => '-5px 0 0 -20px',
'trigger' => array('#module_layers_trigger'),
'cssClass' => 'tip-hover tip-hover-showhide',
'text' => "Show the editor's outline guide markers for the selected Layers",
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/editor-overview/'
),
'set_all_visible' => array(
'title' => 'Set All Visible',
'target' => '#do_show_layer',
'focus' => '#visible_all_layer',
'alignment' => 'top-left',
'margin' => '-5px 0 0 -20px',
'trigger' => array('#module_layers_trigger'),
'cssClass' => 'tip-hover tip-hover-setallvisible',
'text' => "Show all outline guide markers for the editor",
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/editor-overview/'
),
'change_layer_order' => array(
'title' => 'Change Layer Order',
'target' => '#do_background_layer',
'alignment' => 'bottom',
'margin' => '20px 0 0 0',
'trigger' => array('#module_layers_trigger'),
'text' => 'Use these arrows to adjust the z-index/stacking order of the currently selected Layer',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/editor-overview/'
),
'layout_type' => array(
'title' => 'Layout Type',
'target' => '#rs-layout-type',
'placer' => '#rs-layout-type label_a',
'focus' => 'none',
'alignment' => 'top-left',
'margin' => '-4px 0 0 -20px',
'trigger' => array('#module_settings_trigger', '#gst_sl_2'),
'section' => 'Module General Options -> Layout',
'scrollTo' => '#form_slider_layout_layout',
'text' => "Optionally set your Slider to display as a carousel or a Hero Scene",
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/module-layout/'
),
'layout_sizing' => array(
'title' => 'Layout Sizing',
'target' => '#rs-layout-sizing',
'placer' => '#rs-layout-sizing label_a',
'focus' => 'none',
'alignment' => 'top-left',
'margin' => '-4px 0 0 -20px',
'trigger' => array('#module_settings_trigger', '#gst_sl_2'),
'section' => 'Module General Options -> Layout',
'scrollTo' => '#form_slider_layout_layout',
'text' => 'Choose how the Slider should be displayed on your web page',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/module-layout/'
),
'breakpoints' => array(
'title' => 'Enable Breakpoints',
'target' => '#rs-laptop-breakpoint',
'placer' => '#rs-laptop-breakpoint',
'focus' => '.tponoffwrap',
'alignment' => 'top-left',
'margin' => '-5px 0 0 -20px',
'trigger' => array('#module_settings_trigger', '#gst_sl_2'),
'section' => 'Module General Options -> Layout',
'scrollTo' => '#form_slider_layout_bpoints',
'text' => "Enable device breakpoints and edit your content's size and position for each viewport",
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/module-layout/'
),
'module_content' => array(
'title' => 'Module Content Source',
'target' => '#rs-module-source-wrap',
'focus' => 'none',
'alignment' => 'top-left',
'margin' => '-4px 0 0 -20px',
'trigger' => array('#module_settings_trigger', '#gst_sl_4'),
'section' => 'Module General Options -> Content',
'text' => 'Choose if your Slider should be auto-populated with content from your blog or a social channel',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/module-content/'
),
'auto_rotate' => array(
'title' => 'Module Content Source',
'target' => '#rs-autorotate-wrap',
'placer' => '#rs-autorotate-wrap',
'focus' => '.tponoffwrap',
'alignment' => 'top-left',
'margin' => '-4px 0 0 -20px',
'trigger' => array('#module_settings_trigger', '#gst_sl_6'),
'section' => 'Module General Options -> General',
'scrollTo' => '#form_slidergeneral_general',
'text' => 'Enable/disable autoplay for the Slider',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/module-general-settings/'
),
'lazy_loading' => array(
'title' => 'Lazy Loading',
'target' => '#form_slidergeneral_advanced_loading .collapsable',
'placer' => '#form_slidergeneral_advanced_loading label_a',
'focus' => '.select2RS-selection',
'alignment' => 'top-left',
'margin' => '-4px 0 0 -15px',
'trigger' => array('#module_settings_trigger', '#gst_sl_10'),
'section' => 'Module General Options -> Advanced',
'scrollTo' => '#form_module_advanced',
'text' => "Enable LazyLoading for your Slider's images for faster page loading",
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/advanced-module-settings/'
),
'progress_bar' => array(
'title' => 'Progress Bar',
'target' => '#form_nav_pbara',
'placer' => '#form_nav_pbara .form_inner_header',
'focus' => '.tponoffwrap',
'alignment' => 'left',
'margin' => '-4px 0 0 -15px',
'cssClass' => 'form_collector nav_collector',
'trigger' => array('#module_navigation_trigger', '#gst_nav_1'),
'section' => 'Navigation Options -> Progress',
'text' => "Display the Slider's progress with an animated horizontal bar",
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/progress-bar/'
),
'navigation_arrows' => array(
'title' => 'Navigation Arrows',
'target' => '#form_nav_arrows',
'placer' => '#form_nav_arrows .form_inner_header',
'focus' => '.tponoffwrap',
'alignment' => 'left',
'margin' => '-4px 0 0 -15px',
'cssClass' => 'form_collector nav_collector form_menu_inside',
'trigger' => array('#module_navigation_trigger', '#gst_nav_2'),
'section' => 'Navigation Options -> Arrows',
'text' => "Switch between Slides with navigation Arrows",
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/navigation-arrows/'
),
'navigation_bullets' => array(
'title' => 'Navigation Bullets',
'target' => '#form_nav_bullets',
'placer' => '#form_nav_bullets .form_inner_header',
'focus' => '.tponoffwrap',
'alignment' => 'left',
'margin' => '-4px 0 0 -15px',
'cssClass' => 'form_collector nav_collector',
'trigger' => array('#module_navigation_trigger', '#gst_nav_3'),
'section' => 'Navigation Options -> Bullets',
'text' => 'Switch between Slides with navigation Bullets',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/navigation-bullets/'
),
'navigation_tabs' => array(
'title' => 'Navigation Tabs',
'target' => '#form_nav_tabs',
'placer' => '#form_nav_tabs .form_inner_header',
'focus' => '.tponoffwrap',
'alignment' => 'left',
'margin' => '-4px 0 0 -15px',
'cssClass' => 'form_collector nav_collector',
'trigger' => array('#module_navigation_trigger', '#gst_nav_4'),
'section' => 'Navigation Options -> Tabs',
'text' => 'Switch between Slides with navigation Tabs',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/navigation-tabs/'
),
'navigation_thumbs' => array(
'title' => 'Navigation Thumbs',
'target' => '#form_nav_thumbs',
'placer' => '#form_nav_thumbs .form_inner_header',
'focus' => '.tponoffwrap',
'alignment' => 'left',
'margin' => '-4px 0 0 -15px',
'cssClass' => 'form_collector nav_collector',
'trigger' => array('#module_navigation_trigger', '#gst_nav_5'),
'section' => 'Navigation Options -> Thumbs',
'text' => 'Switch between Slides with navigation Thumbnails',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/navigation-thumbnails/'
),
'slide_background' => array(
'title' => 'Slide Background',
'target' => '#form_slidebg',
'placer' => '#form_slidebg label_a',
'focus' => '.select2RS-selection',
'alignment' => 'left',
'margin' => '0 0 0 -20px',
'cssClass' => 'form_collector slide_settings_collector',
'trigger' => array('#module_slide_trigger', '#gst_slide_1'),
'section' => 'Slide Options -> Background',
'text' => "Set/change the current Slide's main background to an image, video or color",
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/slide-background/'
),
'slide_animation' => array(
'title' => 'Slide Animation',
'target' => '#form_slide_transition',
'placer' => '#active_transitions_innerwrap',
'focus' => '.rightbutton',
'alignment' => 'left',
'margin' => '-3px 0 0 -20px',
'cssClass' => 'form_collector slide_settings_collector',
'trigger' => array('#module_slide_trigger', '#gst_slide_2'),
'section' => 'Slide Options -> Title',
'text' => "Set the animation for the Slide's main background image when the Slides change",
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/slide-animation/'
),
'background_filter' => array(
'title' => 'Background Filter',
'target' => '#form_slidebg_filters',
'placer' => '#form_slidebg_filters label_a',
'focus' => '.select2RS-selection',
'alignment' => 'left',
'margin' => '-4px 0 0 -20px',
'elementcss' => 'margin-top: -40px',
'cssClass' => 'form_collector slide_settings_collector',
'trigger' => array('#module_slide_trigger', '#gst_slide_5'),
'section' => 'Slide Options -> Title',
'text' => "Add a CSS image filter to the Slide's main background",
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/slide-filters/'
),
'slide_duration' => array(
'title' => 'Slide Duration',
'target' => '#form_slide_progress',
'placer' => '#form_slide_progress label_a',
'focus' => '#slide_length',
'alignment' => 'left',
'margin' => '-3px 0 0 -20px',
'elementcss' => 'margin-top: -40px',
'cssClass' => 'form_collector slide_settings_collector',
'trigger' => array('#module_slide_trigger', '#gst_slide_8'),
'section' => 'Slide Options -> Title',
'text' => 'Adjust the total duration for the current Slide',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/slide-progress/'
),
'slide_link' => array(
'title' => 'Slide Link',
'target' => '#form_slidegeneral_linkseo',
'placer' => '#form_slidegeneral_linkseo label_a',
'focus' => '.tponoffwrap',
'alignment' => 'top-left',
'margin' => '-3px 0 0 -20px',
'cssClass' => 'form_collector slide_settings_collector',
'trigger' => array('#module_slide_trigger', '#gst_slide_4'),
'section' => 'Slide Options -> Title',
'scrollTo' => '#form_slidegeneral_linkseo',
'text' => 'Add a link to the entire Slide',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/tags-link/'
),
'edit_text' => array(
'title' => 'Edit Text',
'target' => '#form_layercontent_content_text',
'focus' => '#ta_layertext',
'alignment' => 'left',
'margin' => '-3px 0 0 -20px',
'cssClass' => 'form_collector layer_settings_collector',
'trigger' => array('._lc_type_text, ._lc_type_button', '#module_layers_trigger', '#gst_layer_1'),
'section' => 'Layer Options -> Title',
'text' => 'Edit the content of your text Layers here',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/layer-content/#edit-set-content'
),
'font_size' => array(
'title' => 'Font Size',
'target' => '#form_layerstyle_font',
'focus' => '#layer_font_size_idle',
'alignment' => 'top-left',
'margin' => '-3px 0 0 -115px',
'cssClass' => 'form_collector layer_settings_collector',
'trigger' => array('._lc_type_text, ._lc_type_button', '#module_layers_trigger', '#gst_layer_3'),
'section' => 'Layer Options -> Title',
'scrollTo' => '#form_layer_style',
'text' => 'Set the font-size for your text Layers here',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/font-colors-styling/'
),
'font_family' => array(
'title' => 'Font Family',
'target' => '#form_layerstyle_font',
'focus' => '.select2RS-container--fontfamily .select2RS-selection',
'alignment' => 'top-left',
'margin' => '-3px 0 0 -115px',
'cssClass' => 'form_collector layer_settings_collector',
'trigger' => array('._lc_type_text, ._lc_type_button', '#module_layers_trigger', '#gst_layer_3'),
'section' => 'Layer Options -> Title',
'scrollTo' => '#form_layer_style',
'text' => 'Set the font-family for your text Layers here',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/font-colors-styling/'
),
'font_color' => array(
'title' => 'Font Color',
'target' => '#form_layerstyle_font',
'focus' => '.rev-colorpicker',
'alignment' => 'top-left',
'margin' => '-3px 0 0 -115px',
'cssClass' => 'form_collector layer_settings_collector',
'trigger' => array('._lc_type_text, ._lc_type_button', '#module_layers_trigger', '#gst_layer_3'),
'section' => 'Layer Options -> Title',
'scrollTo' => '#form_layer_style',
'text' => 'Set the text color for your Layers here',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/font-colors-styling/'
),
'layer_position' => array(
'title' => 'Layer Position',
'target' => '#rs-align-buttons',
'alignment' => 'left',
'focus' => 'none',
'margin' => '-3px 0 0 -20px',
'cssClass' => 'form_collector layer_settings_collector',
'trigger' => array('._lc_type_text, ._lc_type_button, ._lc_type_video, ._lc_type_shape, ._lc_type_image, ._lc_type_audio, ._lc_type_object', '#module_layers_trigger', '#gst_layer_2'),
'section' => 'Layer Options -> Title',
'text' => "Adjust the Layer's position inside the current Slide",
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/size-position/'
),
'layer_animations' => array(
'title' => 'Layer Animations',
'target' => '#form_animation_sframes_keyframes',
'alignment' => 'left',
'focus' => 'none',
'placer' => '#form_animation_sframes_keyframes',
'margin' => '-26px 0 0 0',
'cssClass' => 'form_collector layer_settings_collector',
'trigger' => array('._lc_', '#module_layers_trigger', '#gst_layer_4'),
'section' => 'Layer Options -> Title',
'text' => 'Set the in/out animations for your Layer content here',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/layer-animations/'
),
'layer_hover' => array(
'title' => 'Layer Hover',
'target' => '#form_layer_hover',
'alignment' => 'left',
'focus' => '.tponoffwrap',
'placer' => '#form_layer_hover label_a',
'margin' => '57px 0 0 0',
'cssClass' => 'form_collector layer_settings_collector',
'trigger' => array('._lc_', '#module_layers_trigger', '#gst_layer_9'),
'section' => 'Layer Options -> Title',
'text' => 'Apply hover styles to your Layers',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/mouse-hover-settings/'
),
'edit_layer_name' => array(
'title' => 'Edit Layer Name',
'target' => '#do_title_layer',
'alignment' => 'bottom',
'margin' => '20px 0 0 0',
'trigger' => array('._lc_'),
'section' => 'Layer Options -> Title',
'text' => 'Change the name of your Layers here to help organize your content'
),
'responsive_behavior' => array(
'title' => 'Responsive Behavior',
'target' => '#form_layerposition_basic',
'alignment' => 'left',
'focus' => '.tponoffwrap',
'placer' => '#form_layerposition_basic label_a',
'margin' => '57px 0 0 0',
'cssClass' => 'form_collector layer_settings_collector',
'trigger' => array('._lc_', '#module_layers_trigger', '#gst_layer_13'),
'section' => 'Layer Options -> Title',
'text' => 'Adjust the responsive behavior of your content here',
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/responsive-settings/'
),
'timeline_preview' => array(
'title' => 'Timeline Preview',
'target' => '.tl_playstop_wrap',
'focus' => '#timline_process',
'alignment' => 'top',
'margin' => '15px 0 0 -3px',
'cssClass' => 'rb-tooltip-timeline',
'text' => "Preview the current Slide's animations",
'linkText' => 'Learn More',
'link' => 'http://docs.themepunch.com/slider-revolution/slide-timeline/'
),
'save_module' => array(
'title' => 'Save Module',
'target' => '#save_slider',
'focus' => 'none',
'alignment' => 'right-top',
'margin' => '25px 0px 0px 55px',
'hidePrevSave' => true,
'text' => 'Click this button to save your changes'
),
'preview_module' => array(
'title' => 'Preview Module',
'target' => '#preview_slider',
'focus' => 'none',
'alignment' => 'right-top',
'margin' => '25px 0px 0px 70px',
'hidePrevSave' => true,
'text' => 'Click this button to preview the current Slide'
)
);
return array('translations' => $translations, 'tooltips' => $tooltips);
}
}

View File

@@ -0,0 +1,144 @@
<?php
/**
* @author ThemePunch <info@themepunch.com>
* @link https://www.themepunch.com/
* @copyright 2019 ThemePunch
*/
if(!defined('ABSPATH')) exit();
class RevSliderWidget extends WP_Widget {
public function __construct(){
//actual widget process
parent::__construct('rev-slider-widget', RevLoader::__('Slider Revolution', 'revslider'), array('classname' => 'widget_revslider', 'description' => RevLoader::__('Displays a Slider Revolution Module on the page', 'revslider')));
}
public static function register_widget(){
register_widget('RevSliderWidget');
}
/**
* the form
*/
public function form($instance){
$sliders = array();
$_slider = new RevSliderSlider();
try {
$sliders = $_slider->get_sliders_short();
}catch(Exception $e){}
if(empty($sliders)){
echo RevLoader::__('No Sliders found, Please create a Slider first', 'revslider');
}else{
$sliderID = $_slider->get_val($instance, 'rev_slider');
$homepage = $_slider->get_val($instance, 'rev_slider_homepage');
$pagesValue = $_slider->get_val($instance, 'rev_slider_pages');
$title = $_slider->get_val($instance, 'rev_slider_title');
$checked = ($homepage == 'on') ? "checked='checked'" : '';
$fieldID_check = $this->get_field_id('rev_slider_homepage');
$fieldName_check = $this->get_field_name('rev_slider_homepage');
$fieldPages_ID = $this->get_field_id('rev_slider_pages');
$fieldPages_Name = $this->get_field_name('rev_slider_pages');
$fieldTitle_ID = $this->get_field_id('rev_slider_title');
$fieldTitle_Name = $this->get_field_name('rev_slider_title');
?>
<p>
<span style="display: inline-block; width: 130px"><label for="<?php echo $fieldTitle_ID; ?>"><?php RevLoader::_e('Title', 'revslider')?>:</label></span>
<input type="text" style="display: inline-block; width: auto;" name="<?php echo $fieldTitle_Name; ?>" id="<?php echo $fieldTitle_ID; ?>" value="<?php echo $title; ?>" class="widefat">
</p>
<p>
<span style="display: inline-block; width: 130px"><?php RevLoader::_e('Choose Slider', 'revslider'); ?>:</span>
<select name="<?php echo $this->get_field_name('rev_slider'); ?>" id="<?php echo $this->get_field_id('rev_slider'); ?>">
<?php
foreach($sliders as $key => $item){
$selected = (trim($key) == trim($sliderID)) ? ' selected ' : '';
echo '<option '.$selected.' value="'.$key.'">'.$item.'</option>';
}
?>
</select>
</p>
<p>
<span style="display: inline-block; width: 130px"><label for="<?php echo $fieldID_check; ?>"><?php RevLoader::_e('Home Page Only', 'revslider'); ?>:</label></span>
<input type="checkbox" name="<?php echo $fieldName_check; ?>" id="<?php echo $fieldID_check; ?>" <?php echo $checked; ?>>
</p>
<p>
<span style="display: inline-block; width: 130px"><label for="<?php echo $fieldPages_ID; ?>"><?php RevLoader::_e('Pages (example: 2,10):', 'revslider'); ?></label></span>
<input type="text" name="<?php echo $fieldPages_Name; ?>" id="<?php echo $fieldPages_ID; ?>" value="<?php echo $pagesValue; ?>">
</p>
<?php
} //else
}
/**
* update
*/
public function update($new_instance, $old_instance){
return $new_instance;
}
/**
* widget output
*/
public function widget($args, $instance){
try {
$_slider = new RevSliderSlider();
$sid = $_slider->get_val($instance, 'rev_slider');
if(empty($sid)) return(false);
$output = new RevSliderOutput();
$title = $_slider->get_val($instance, 'rev_slider_title');
$homepage = ($_slider->get_val($instance, 'rev_slider_homepage') == 'on') ? 'homepage' : '';
$pages = $_slider->get_val($instance, 'rev_slider_pages');
if(!empty($pages)){
$homepage .= (!empty($homepage)) ? ',' : '';
$homepage .= $pages;
}
$_slider->init_by_id($sid);
if($_slider->get_param(array('general', 'disableOnMobile'), false) == true && wp_is_mobile()) return false;
//widget output
echo $_slider->get_val($args, 'before_widget');
if(!empty($title)){
echo $_slider->get_val($args, 'before_title');
echo $title;
echo $_slider->get_val($args, 'after_title');
}
$output->set_add_to($homepage);
$slider = $output->add_slider_to_stage($sid);
RevLoader::add_action('wp_head', array($this, 'write_css'));
echo $_slider->get_val($args, 'after_widget');
}catch(Exception $e){
$message = $e->getMessage();
$output->print_error_message($message);
}
}
public function write_css(){
}
}
/**
* old classname extends new one (old classnames will be obsolete soon)
* @since: 5.0
**/
class RevSlider_Widget extends RevSliderWidget {}
?>