Beispiel #1
0
 /**
  * 
  * get fields that relevant for the control
  */
 public function getControlFields()
 {
     $arrControls = array();
     //get base elements array
     $arrBase = array();
     $arrBase["parent"] = (string) UniteFunctionsRev::getVal($this->element, 'parent');
     $arrBase["value"] = (string) UniteFunctionsRev::getVal($this->element, 'value');
     $arrBase["ctype"] = (string) UniteFunctionsRev::getVal($this->element, 'ctype');
     //validate fields:
     if (empty($arrBase["parent"])) {
         UniteFunctionsRev::throwError("The parent can't be empty in control");
     }
     if (empty($arrBase["value"])) {
         UniteFunctionsRev::throwError("The value can't be empty in control: {$arrBase['parent']}");
     }
     if (empty($arrBase["ctype"])) {
         UniteFunctionsRev::throwError("The ctype can't be empty in control: {$arrBase['parent']}");
     }
     //get children
     $strchild = (string) UniteFunctionsRev::getVal($this->element, 'child');
     //validate child
     if (empty($strchild)) {
         UniteFunctionsRev::throwError("The child can't be empty in control: {$arrBase['parent']}");
     }
     $strchild = trim($strchild);
     $children = explode(",", $strchild);
     foreach ($children as $child) {
         $arrControl = $arrBase;
         $arrControl["child"] = $child;
         $arrControls[] = $arrControl;
     }
     return $arrControls;
 }
Beispiel #2
0
 /**
  * 
  * get slider id
  */
 public function getSliderID()
 {
     $sliderID = JRequest::getCmd("id");
     if (empty($sliderID)) {
         UniteFunctionsRev::throwError("Slider ID url argument not found (id)");
     }
     return $sliderID;
 }
 /**
  * 
  * check that captions file exists and if not - copy it to it's place.
  */
 private function checkCopyCaptionsCssFile()
 {
     if (file_exists(GlobalsUniteRev::$pathCaptionsCss) == false) {
         copy(GlobalsUniteRev::$pathCaptionsCssOriginal, GlobalsUniteRev::$pathCaptionsCss);
     }
     if (file_exists(GlobalsUniteRev::$pathCaptionsCss) == false) {
         UniteFunctionsRev::throwError("The captions file couldn't be copied to it's place: {GlobalsUniteRev::{$pathCaptionsCss}}, please copy it by hand from captions-original.css from the same folder, or turn to support.");
     }
 }
 public function update($table, $arrItems, $where)
 {
     $response = $this->wpdb->update($table, $arrItems, $where);
     if ($response === false) {
         UniteFunctionsRev::throwError("no update action taken!");
     }
     $this->checkForErrors("Update query error");
     return $response;
 }
 /**
  *
  * get field from db
  */
 public function getFieldFromDB($name)
 {
     $arr = $this->db->fetch(GlobalsRevSlider::$table_settings);
     if (empty($arr)) {
         return "";
     }
     $arr = $arr[0];
     if (array_key_exists($name, $arr) == false) {
         UniteFunctionsRev::throwError("The settings db should cotnain field: {$name}");
     }
     $value = $arr[$name];
     return $value;
 }
 /**
  * 
  * check if some db table exists
  */
 public static function isDBTableExists($tableName)
 {
     global $wpdb;
     if (empty($tableName)) {
         UniteFunctionsRev::throwError("Empty table name!!!");
     }
     $sql = "show tables like '{$tableName}'";
     $table = $wpdb->get_var($sql);
     if ($table == $tableName) {
         return true;
     }
     return false;
 }
 /**
  * 
  * display master template (master.php from tpl folder) 
  */
 private function displayMasterTemplate()
 {
     //each view has self controls
     UniteControlsRev::emptyControls();
     if (isset($this->form)) {
         UniteControlsRev::loadControlsFromForm($this->form);
     }
     $filepath = dirname(__FILE__) . "/tpl/master.php";
     if (!is_file($filepath)) {
         UniteFunctionsRev::throwError("master template not found: {$filepath}");
     }
     $arrControls = UniteControlsRev::getArrayForJsOutput();
     $jsonControls = json_encode($arrControls);
     //prepare content
     ob_start();
     require $filepath;
     $output = ob_get_contents();
     ob_end_clean();
     //output content
     echo $output;
 }
 public function checkPurchaseVerification($data)
 {
     global $wp_version;
     $response = wp_remote_post('http://updates.themepunch.com/activate.php', array('user-agent' => 'WordPress/' . $wp_version . '; ' . get_bloginfo('url'), 'body' => array('name' => urlencode($data['username']), 'api' => urlencode($data['api_key']), 'code' => urlencode($data['code']), 'product' => urlencode('revslider'))));
     $response_code = wp_remote_retrieve_response_code($response);
     $version_info = wp_remote_retrieve_body($response);
     if ($response_code != 200 || is_wp_error($version_info)) {
         return false;
     }
     if ($version_info == 'valid') {
         update_option('revslider-valid', 'true');
         update_option('revslider-api-key', $data['api_key']);
         update_option('revslider-username', $data['username']);
         update_option('revslider-code', $data['code']);
         return true;
     } elseif ($version_info == 'exist') {
         UniteFunctionsRev::throwError(__('Purchase Code already registered!', REVSLIDER_TEXTDOMAIN));
     } else {
         return false;
     }
 }
 /**
  * 
  * validate that the slide is inited and the id exists.
  */
 private function validateInited()
 {
     if (empty($this->id)) {
         UniteFunctionsRev::throwError("The slide is not inited!!!");
     }
 }
 /**
  * 
  * do "trim" operation on all array items.
  */
 public static function trimArrayItems($arr)
 {
     if (gettype($arr) != "array") {
         UniteFunctionsRev::throwError("trimArrayItems error: The type must be array");
     }
     foreach ($arr as $key => $item) {
         if (is_array($item)) {
             foreach ($item as $key => $value) {
                 $arr[$key][$key] = trim($value);
             }
         } else {
             $arr[$key] = trim($item);
         }
     }
     return $arr;
 }
Beispiel #11
0
 /**
  * 
  * Enter description here ...
  */
 protected static function updatePlugin($viewBack = false)
 {
     $linkBack = self::getViewUrl($viewBack);
     $htmlLinkBack = UniteFunctionsRev::getHtmlLink($linkBack, "Go Back");
     //check if css table exist, if not, we need to verify that the current captions.css can be parsed
     if (UniteFunctionsWPRev::isDBTableExists(GlobalsRevSlider::TABLE_CSS_NAME)) {
         $captions = RevOperations::getCaptionsCssContentArray();
         if ($captions === false) {
             $message = "CSS parse error! Please make sure your captions.css is valid CSS before updating the plugin!";
             echo "<div style='color:#B80A0A;font-size:18px;'><b>Update Error: </b> {$message}</div><br>";
             echo $htmlLinkBack;
             exit;
         }
     }
     $zip = new UniteZipRev();
     try {
         if (function_exists("unzip_file") == false) {
             if (UniteZipRev::isZipExists() == false) {
                 UniteFunctionsRev::throwError("The ZipArchive php extension not exists, can't extract the update file. Please turn it on in php ini.");
             }
         }
         dmp("Update in progress...");
         $arrFiles = UniteFunctionsRev::getVal($_FILES, "update_file");
         if (empty($arrFiles)) {
             UniteFunctionsRev::throwError("Update file don't found.");
         }
         $filename = UniteFunctionsRev::getVal($arrFiles, "name");
         if (empty($filename)) {
             UniteFunctionsRev::throwError("Update filename not found.");
         }
         $fileType = UniteFunctionsRev::getVal($arrFiles, "type");
         /*				
         $fileType = strtolower($fileType);
         
         if($fileType != "application/zip")
         	UniteFunctionsRev::throwError("The file uploaded is not zip.");
         */
         $filepathTemp = UniteFunctionsRev::getVal($arrFiles, "tmp_name");
         if (file_exists($filepathTemp) == false) {
             UniteFunctionsRev::throwError("Can't find the uploaded file.");
         }
         //crate temp folder
         UniteFunctionsRev::checkCreateDir(self::$path_temp);
         //create the update folder
         $pathUpdate = self::$path_temp . "update_extract/";
         UniteFunctionsRev::checkCreateDir($pathUpdate);
         //remove all files in the update folder
         if (is_dir($pathUpdate)) {
             $arrNotDeleted = UniteFunctionsRev::deleteDir($pathUpdate, false);
             if (!empty($arrNotDeleted)) {
                 $strNotDeleted = print_r($arrNotDeleted, true);
                 UniteFunctionsRev::throwError("Could not delete those files from the update folder: {$strNotDeleted}");
             }
         }
         //copy the zip file.
         $filepathZip = $pathUpdate . $filename;
         $success = move_uploaded_file($filepathTemp, $filepathZip);
         if ($success == false) {
             UniteFunctionsRev::throwError("Can't move the uploaded file here: " . $filepathZip . ".");
         }
         if (function_exists("unzip_file") == true) {
             WP_Filesystem();
             $response = unzip_file($filepathZip, $pathUpdate);
         } else {
             $zip->extract($filepathZip, $pathUpdate);
         }
         //get extracted folder
         $arrFolders = UniteFunctionsRev::getFoldersList($pathUpdate);
         if (empty($arrFolders)) {
             UniteFunctionsRev::throwError("The update folder is not extracted");
         }
         if (count($arrFolders) > 1) {
             UniteFunctionsRev::throwError("Extracted folders are more then 1. Please check the update file.");
         }
         //get product folder
         $productFolder = $arrFolders[0];
         if (empty($productFolder)) {
             UniteFunctionsRev::throwError("Wrong product folder.");
         }
         if ($productFolder != self::$dir_plugin) {
             UniteFunctionsRev::throwError("The update folder don't match the product folder, please check the update file.");
         }
         $pathUpdateProduct = $pathUpdate . $productFolder . "/";
         //check some file in folder to validate it's the real one:
         $checkFilepath = $pathUpdateProduct . $productFolder . ".php";
         if (file_exists($checkFilepath) == false) {
             UniteFunctionsRev::throwError("Wrong update extracted folder. The file: " . $checkFilepath . " not found.");
         }
         //copy the plugin without the captions file.
         //$pathOriginalPlugin = $pathUpdate."copy/";
         $pathOriginalPlugin = self::$path_plugin;
         $arrBlackList = array();
         $arrBlackList[] = "rs-plugin/css/captions.css";
         $arrBlackList[] = "rs-plugin/css/dynamic-captions.css";
         $arrBlackList[] = "rs-plugin/css/static-captions.css";
         UniteFunctionsRev::copyDir($pathUpdateProduct, $pathOriginalPlugin, "", $arrBlackList);
         //delete the update
         UniteFunctionsRev::deleteDir($pathUpdate);
         dmp("Updated Successfully, redirecting...");
         echo "<script>location.href='{$linkBack}'</script>";
     } catch (Exception $e) {
         $message = $e->getMessage();
         $message .= " <br> Please update the plugin manually via the ftp";
         echo "<div style='color:#B80A0A;font-size:18px;'><b>Update Error: </b> {$message}</div><br>";
         echo $htmlLinkBack;
         exit;
     }
 }
 /**
  * 
  * get meta query
  */
 public static function getWPQuery($filterType, $sortBy)
 {
     $dayMs = 60 * 60 * 24;
     $time = current_time('timestamp');
     $todayStart = strtotime(date('Y-m-d', $time));
     $todayEnd = $todayStart + $dayMs - 1;
     $tomorrowStart = $todayEnd + 1;
     $tomorrowEnd = $tomorrowStart + $dayMs - 1;
     //dmp(UniteFunctionsRev::timestamp2DateTime($tomorrowStart));exit();
     $start_month = strtotime(date('Y-m-1', $time));
     $end_month = strtotime(date('Y-m-t', $time)) + 86399;
     $next_month_middle = strtotime('+1 month', $time);
     //get the end of this month + 1 day
     $start_next_month = strtotime(date('Y-m-1', $next_month_middle));
     $end_next_month = strtotime(date('Y-m-t', $next_month_middle)) + 86399;
     $query = array();
     switch ($filterType) {
         case self::DEFAULT_FILTER:
             //none
             break;
         case "today":
             $query[] = array('key' => '_start_ts', 'value' => $todayEnd, 'compare' => '<=');
             $query[] = array('key' => '_end_ts', 'value' => $todayStart, 'compare' => '>=');
             break;
         case "future":
             $query[] = array('key' => '_start_ts', 'value' => $time, 'compare' => '>');
             break;
         case "tomorrow":
             $query[] = array('key' => '_start_ts', 'value' => $tomorrowEnd, 'compare' => '<=');
             $query[] = array('key' => '_end_ts', 'value' => $todayStart, 'compare' => '>=');
             break;
         case "past":
             $query[] = array('key' => '_end_ts', 'value' => $todayStart, 'compare' => '<');
             break;
         case "month":
             $query[] = array('key' => '_start_ts', 'value' => $end_month, 'compare' => '<=');
             $query[] = array('key' => '_end_ts', 'value' => $start_month, 'compare' => '>=');
             break;
         case "nextmonth":
             $query[] = array('key' => '_start_ts', 'value' => $end_next_month, 'compare' => '<=');
             $query[] = array('key' => '_end_ts', 'value' => $start_next_month, 'compare' => '>=');
             break;
         default:
             UniteFunctionsRev::throwError("Wrong event filter");
             break;
     }
     if (!empty($query)) {
         $response["meta_query"] = $query;
     }
     //convert sortby
     switch ($sortBy) {
         case "event_start_date":
             $response["orderby"] = "meta_value_num";
             $response["meta_key"] = "_start_ts";
             break;
         case "event_end_date":
             $response["orderby"] = "meta_value_num";
             $response["meta_key"] = "_end_ts";
             break;
     }
     return $response;
 }
 /**
  * 
  * draw custom inputs for rev slider
  * @param $setting
  */
 protected function drawCustomInputs($setting)
 {
     $customType = UniteFunctionsRev::getVal($setting, "custom_type");
     switch ($customType) {
         case "slider_size":
             $this->drawSliderSize($setting);
             break;
         case "responsitive_settings":
             $this->drawResponsitiveSettings($setting);
             break;
         default:
             UniteFunctionsRev::throwError("No handler function for type: {$customType}");
             break;
     }
 }
Beispiel #14
0
 /**
  * 
  * valdiate that wpml exists
  */
 private static function validateWpmlExists()
 {
     if (!self::isWpmlExists()) {
         UniteFunctionsRev::throwError("The wpml plugin don't exists");
     }
 }
Beispiel #15
0
 /**
  * 
  * get settings object
  */
 protected static function getSettings($key)
 {
     if (!isset(self::$arrSettings[$key])) {
         UniteFunctionsRev::throwError("Settings {$key} not found");
     }
     $settings = self::$arrSettings[$key];
     return $settings;
 }
Beispiel #16
0
 /**
  * 
  * craete tables
  */
 public static function createTable($tableName)
 {
     //if table exists - don't create it.
     $tableRealName = self::$table_prefix . $tableName;
     if (UniteFunctionsWPRev::isDBTableExists($tableRealName)) {
         return false;
     }
     switch ($tableName) {
         case GlobalsRevSlider::TABLE_SLIDERS_NAME:
             $sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\r\n\t\t\t\t\t\t\t  id int(9) NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t\t\t  title tinytext NOT NULL,\r\n\t\t\t\t\t\t\t  alias tinytext,\r\n\t\t\t\t\t\t\t  params text NOT NULL,\r\n\t\t\t\t\t\t\t  PRIMARY KEY (id)\r\n\t\t\t\t\t\t\t);";
             break;
         case GlobalsRevSlider::TABLE_SLIDES_NAME:
             $sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\r\n\t\t\t\t\t\t\t\t  id int(9) NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t\t\t\t  slider_id int(9) NOT NULL,\r\n\t\t\t\t\t\t\t\t  slide_order int not NULL,\t\t  \r\n\t\t\t\t\t\t\t\t  params text NOT NULL,\r\n\t\t\t\t\t\t\t\t  layers text NOT NULL,\r\n\t\t\t\t\t\t\t\t  PRIMARY KEY (id)\r\n\t\t\t\t\t\t\t\t);";
             break;
         default:
             UniteFunctionsRev::throwError("table: {$tableName} not found");
             break;
     }
     require_once ABSPATH . 'wp-admin/includes/upgrade.php';
     dbDelta($sql);
 }
Beispiel #17
0
 /**
  * 
  * onAjax action handler
  */
 public static function onAjaxAction()
 {
     $actionIndicator = self::getPostGetVar("action");
     if ($actionIndicator != "uniterevolution_ajax_action") {
         return false;
     }
     $action = self::getPostGetVar("client_action");
     $data = self::getPostGetVar("data");
     $nonce = self::getPostGetVar("nonce");
     $slider = new RevSlider();
     $slide = new RevSlide();
     $operations = new RevOperations();
     try {
         //verify the nonce
         $isVerified = wp_verify_nonce($nonce, "revslider_actions");
         if ($isVerified == false) {
             UniteFunctionsRev::throwError("Wrong request");
         }
         switch ($action) {
             case "export_slider":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS);
                 $sliderID = self::getGetVar("sliderid");
                 $dummy = self::getGetVar("dummy");
                 $slider->initByID($sliderID);
                 $slider->exportSlider($dummy);
                 break;
             case "import_slider":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS);
                 $updateAnim = self::getPostGetVar("update_animations");
                 $updateStatic = self::getPostGetVar("update_static_captions");
                 self::importSliderHandle(null, $updateAnim, $updateStatic);
                 break;
             case "import_slider_slidersview":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS);
                 $viewBack = self::getViewUrl(self::VIEW_SLIDERS);
                 $updateAnim = self::getPostGetVar("update_animations");
                 $updateStatic = self::getPostGetVar("update_static_captions");
                 self::importSliderHandle($viewBack, $updateAnim, $updateStatic);
                 break;
             case "create_slider":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS);
                 self::requireSettings("slider_settings");
                 $settingsMain = self::getSettings("slider_main");
                 $settingsParams = self::getSettings("slider_params");
                 $data = $operations->modifyCustomSliderParams($data);
                 $newSliderID = $slider->createSliderFromOptions($data, $settingsMain, $settingsParams);
                 self::ajaxResponseSuccessRedirect(__ug("The slider successfully created", REVSLIDER_TEXTDOMAIN), self::getViewUrl("sliders"));
                 break;
             case "update_slider":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_SETTINGS);
                 self::requireSettings("slider_settings");
                 $settingsMain = self::getSettings("slider_main");
                 $settingsParams = self::getSettings("slider_params");
                 $data = $operations->modifyCustomSliderParams($data);
                 $slider->updateSliderFromOptions($data, $settingsMain, $settingsParams);
                 self::ajaxResponseSuccess(__ug("Slider updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "delete_slider":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS);
                 $isDeleted = $slider->deleteSliderFromData($data);
                 if (is_array($isDeleted)) {
                     $isDeleted = implode(', ', $isDeleted);
                     self::ajaxResponseError("Template can't be deleted, it is still being used by the following Sliders: " . $isDeleted);
                 } else {
                     self::ajaxResponseSuccessRedirect(__ug("The slider deleted", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS));
                 }
                 break;
             case "duplicate_slider":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS);
                 $slider->duplicateSliderFromData($data);
                 self::ajaxResponseSuccessRedirect(__ug("The duplicate successfully, refreshing page...", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS));
                 break;
             case "add_slide":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS);
                 $numSlides = $slider->createSlideFromData($data);
                 $sliderID = $data["sliderid"];
                 if ($numSlides == 1) {
                     $responseText = __ug("Slide Created", REVSLIDER_TEXTDOMAIN);
                 } else {
                     $responseText = $numSlides . " " . __ug("Slides Created", REVSLIDER_TEXTDOMAIN);
                 }
                 $urlRedirect = self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}");
                 self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
                 break;
             case "add_slide_fromslideview":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS);
                 $slideID = $slider->createSlideFromData($data, true);
                 $urlRedirect = self::getViewUrl(self::VIEW_SLIDE, "id={$slideID}");
                 $responseText = __ug("Slide Created, redirecting...", REVSLIDER_TEXTDOMAIN);
                 self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
                 break;
             case "update_slide":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_EDIT_SLIDE);
                 require self::getSettingsFilePath("slide_settings");
                 $slide->updateSlideFromData($data, $slideSettings);
                 self::ajaxResponseSuccess(__ug("Slide updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "delete_slide":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS);
                 $isPost = $slide->deleteSlideFromData($data);
                 if ($isPost) {
                     $message = __ug("Post Deleted Successfully", REVSLIDER_TEXTDOMAIN);
                 } else {
                     $message = __ug("Slide Deleted Successfully", REVSLIDER_TEXTDOMAIN);
                 }
                 $sliderID = UniteFunctionsRev::getVal($data, "sliderID");
                 self::ajaxResponseSuccessRedirect($message, self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "update_static_slide":
                 $slide->updateStaticSlideFromData($data);
                 self::ajaxResponseSuccess(__ug("Static Global Layers updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "duplicate_slide":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS);
                 $sliderID = $slider->duplicateSlideFromData($data);
                 self::ajaxResponseSuccessRedirect(__ug("Slide Duplicated Successfully", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "copy_move_slide":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS);
                 $sliderID = $slider->copyMoveSlideFromData($data);
                 self::ajaxResponseSuccessRedirect(__ug("The operation successfully, refreshing page...", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "get_static_css":
                 $contentCSS = $operations->getStaticCss();
                 self::ajaxResponseData($contentCSS);
                 break;
             case "get_dynamic_css":
                 $contentCSS = $operations->getDynamicCss();
                 self::ajaxResponseData($contentCSS);
                 break;
             case "insert_captions_css":
                 $arrCaptions = $operations->insertCaptionsContentData($data);
                 self::ajaxResponseSuccess(__ug("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
                 break;
             case "update_captions_css":
                 $arrCaptions = $operations->updateCaptionsContentData($data);
                 self::ajaxResponseSuccess(__ug("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
                 break;
             case "delete_captions_css":
                 $arrCaptions = $operations->deleteCaptionsContentData($data);
                 self::ajaxResponseSuccess(__ug("Style deleted succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
                 break;
             case "update_static_css":
                 $staticCss = $operations->updateStaticCss($data);
                 self::ajaxResponseSuccess(__ug("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("css" => $staticCss));
                 break;
             case "insert_custom_anim":
                 $arrAnims = $operations->insertCustomAnim($data);
                 //$arrCaptions =
                 self::ajaxResponseSuccess(__ug("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
                 //,array("arrCaptions"=>$arrCaptions)
                 break;
             case "update_custom_anim":
                 $arrAnims = $operations->updateCustomAnim($data);
                 self::ajaxResponseSuccess(__ug("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
                 //,array("arrCaptions"=>$arrCaptions)
                 break;
             case "delete_custom_anim":
                 $arrAnims = $operations->deleteCustomAnim($data);
                 self::ajaxResponseSuccess(__ug("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
                 //,array("arrCaptions"=>$arrCaptions)
                 break;
             case "update_slides_order":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS);
                 $slider->updateSlidesOrderFromData($data);
                 self::ajaxResponseSuccess(__ug("Order updated successfully", REVSLIDER_TEXTDOMAIN));
                 break;
             case "change_slide_image":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS);
                 $slide->updateSlideImageFromData($data);
                 $sliderID = UniteFunctionsRev::getVal($data, "slider_id");
                 self::ajaxResponseSuccessRedirect(__ug("Slide Changed Successfully", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "preview_slide":
                 $operations->putSlidePreviewByData($data);
                 break;
             case "preview_slider":
                 $sliderID = UniteFunctionsRev::getPostGetVariable("sliderid");
                 $do_markup = UniteFunctionsRev::getPostGetVariable("only_markup");
                 if ($do_markup == 'true') {
                     $operations->previewOutputMarkup($sliderID);
                 } else {
                     $operations->previewOutput($sliderID);
                 }
                 break;
             case "toggle_slide_state":
                 $currentState = $slide->toggleSlideStatFromData($data);
                 self::ajaxResponseData(array("state" => $currentState));
                 break;
             case "slide_lang_operation":
                 $responseData = $slide->doSlideLangOperation($data);
                 self::ajaxResponseData($responseData);
                 break;
             case "update_plugin":
                 self::updatePlugin(self::DEFAULT_VIEW);
                 break;
             case "update_text":
                 self::updateSettingsText();
                 self::ajaxResponseSuccess(__ug("All files successfully updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "update_general_settings":
                 $operations->updateGeneralSettings($data);
                 self::ajaxResponseSuccess(__ug("General settings updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "update_posts_sortby":
                 $slider->updatePostsSortbyFromData($data);
                 self::ajaxResponseSuccess(__ug("Sortby updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "replace_image_urls":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDER_OPERATIONS);
                 $slider->replaceImageUrlsFromData($data);
                 self::ajaxResponseSuccess(__ug("Image urls replaced", REVSLIDER_TEXTDOMAIN));
                 break;
             case "reset_slide_settings":
                 RevOperations::validatePermission(GlobalsRevSlider::PERMISSION_SLIDE_OPERATIONS);
                 $slider->resetSlideSettings($data);
                 self::ajaxResponseSuccess(__ug("Settings in all Slides changed", REVSLIDER_TEXTDOMAIN));
                 break;
             default:
                 self::ajaxResponseError("wrong ajax action: {$action} ");
                 break;
         }
     } catch (Exception $e) {
         $message = $e->getMessage();
         if ($action == "preview_slide" || $action == "preview_slider") {
             echo $message;
             exit;
         }
         self::ajaxResponseError($message);
     }
     //it's an ajax action, so exit
     self::ajaxResponseError("No response output on <b> {$action} </b> action. please check with the developer.");
     exit;
 }
<?php

$operations = new RevOperations();
$sliderID = self::getGetVar("id");
if (empty($sliderID)) {
    UniteFunctionsRev::throwError("Slider ID not found");
}
$slider = new RevSlider();
$slider->initByID($sliderID);
$sliderParams = $slider->getParams();
$arrSliders = $slider->getArrSlidersShort($sliderID);
$selectSliders = UniteFunctionsRev::getHTMLSelect($arrSliders, "", "id='selectSliders'", true);
$numSliders = count($arrSliders);
//set iframe parameters
//$width = $sliderParams["width"];
//$height = $sliderParams["height"];
$width = isset($sliderParams["width"]) ? $sliderParams["width"] : '';
$height = isset($sliderParams["height"]) ? $sliderParams["height"] : '';
$iframeWidth = $width + 60;
$iframeHeight = $height + 50;
$iframeStyle = "width:" . $iframeWidth . "px;height:" . $iframeHeight . "px;";
$arrSlides = $slider->getSlides(false);
$numSlides = count($arrSlides);
$linksSliderSettings = self::getViewUrl(RevSliderAdmin::VIEW_SLIDER, "id={$sliderID}");
$patternViewSlide = self::getViewUrl("slide", "id=[slideid]");
//treat in case of slides from gallery
if ($slider->isSlidesFromPosts() == false) {
    $templateName = "slides_gallery";
    //handle wpml
    $isWpmlExists = UniteWpmlRev::isWpmlExists();
    $useWpml = $slider->getParam("use_wpml", "off");
 /**
  * 
  * put creative layer
  */
 private function putCreativeLayer(RevSlide $slide, $static_slide = false)
 {
     $layers = $slide->getLayers();
     $customAnimations = RevOperations::getCustomAnimations('customin');
     //get all custom animations
     $customEndAnimations = RevOperations::getCustomAnimations('customout');
     //get all custom animations
     $startAnimations = RevOperations::getArrAnimations(false);
     //only get the standard animations
     $endAnimations = RevOperations::getArrEndAnimations(false);
     //only get the standard animations
     $lazyLoad = $this->slider->getParam("lazy_load", "off");
     $isTemplate = $this->slider->getParam("template", "false");
     if (empty($layers)) {
         return false;
     }
     $zIndex = 5;
     foreach ($layers as $layer) {
         $type = UniteFunctionsRev::getVal($layer, "type", "text");
         //set if video full screen
         $videoclass = '';
         $isFullWidthVideo = false;
         if ($type == "video") {
             $videoclass = ' tp-videolayer';
             $videoData = UniteFunctionsRev::getVal($layer, "video_data");
             if (!empty($videoData)) {
                 $videoData = (array) $videoData;
                 $isFullWidthVideo = UniteFunctionsRev::getVal($videoData, "fullwidth");
                 $isFullWidthVideo = UniteFunctionsRev::strToBool($isFullWidthVideo);
             } else {
                 $videoData = array();
             }
         }
         $class = UniteFunctionsRev::getVal($layer, "style");
         if (trim($class) !== '') {
             $this->class_include['.' . trim($class)] = true;
         }
         //add classname for style inclusion
         $animation = UniteFunctionsRev::getVal($layer, "animation", "tp-fade");
         if ($animation == "fade") {
             $animation = "tp-fade";
         }
         $customin = '';
         if (!array_key_exists($animation, $startAnimations) && array_key_exists($animation, $customAnimations)) {
             //if true, add custom animation
             $customin .= 'data-customin="';
             $animArr = RevOperations::getCustomAnimationByHandle($customAnimations[$animation]);
             if ($animArr !== false) {
                 $customin .= RevOperations::parseCustomAnimationByArray($animArr);
             }
             $customin .= '"';
             $animation = 'customin';
         }
         if (strpos($animation, 'customin-') !== false || strpos($animation, 'customout-') !== false) {
             $animation = "tp-fade";
         }
         //set output class:
         $layer_2d_rotation = intval(UniteFunctionsRev::getVal($layer, "2d_rotation", '0'));
         $layer_2d_origin_x = intval(UniteFunctionsRev::getVal($layer, "2d_origin_x", '50'));
         $layer_2d_origin_y = intval(UniteFunctionsRev::getVal($layer, "2d_origin_y", '50'));
         if ($layer_2d_rotation == 0) {
             $outputClass = "tp-caption " . trim($class);
         } else {
             $outputClass = "tp-caption ";
         }
         $outputClass = trim($outputClass) . " ";
         $outputClass .= trim($animation);
         $left = UniteFunctionsRev::getVal($layer, "left", 0);
         $top = UniteFunctionsRev::getVal($layer, "top", 0);
         $speed = UniteFunctionsRev::getVal($layer, "speed", 300);
         $time = UniteFunctionsRev::getVal($layer, "time", 0);
         $easing = UniteFunctionsRev::getVal($layer, "easing", "easeOutExpo");
         $randomRotate = UniteFunctionsRev::getVal($layer, "random_rotation", "false");
         $randomRotate = UniteFunctionsRev::boolToStr($randomRotate);
         $splitin = UniteFunctionsRev::getVal($layer, "split", "none");
         $splitout = UniteFunctionsRev::getVal($layer, "endsplit", "none");
         $elementdelay = intval(UniteFunctionsRev::getVal($layer, "splitdelay", 0));
         $endelementdelay = intval(UniteFunctionsRev::getVal($layer, "endsplitdelay", 0));
         if ($elementdelay > 0) {
             $elementdelay /= 100;
         }
         if ($endelementdelay > 0) {
             $endelementdelay /= 100;
         }
         $text = UniteFunctionsRev::getVal($layer, "text");
         if (function_exists('qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage')) {
             //use qTranslate
             $text = qtrans_useCurrentLanguageIfNotFoundUseDefaultLanguage($text);
         }
         $htmlVideoAutoplay = "";
         $htmlVideoAutoplayOnlyFirstTime = "";
         $htmlVideoNextSlide = "";
         $htmlVideoThumbnail = "";
         $htmlMute = '';
         $htmlCover = '';
         $htmlDotted = '';
         $htmlRatio = '';
         $htmlRewind = '';
         $htmlDisableOnMobile = '';
         $ids = UniteFunctionsRev::getVal($layer, "attrID");
         $classes = UniteFunctionsRev::getVal($layer, "attrClasses");
         $title = UniteFunctionsRev::getVal($layer, "attrTitle");
         $rel = UniteFunctionsRev::getVal($layer, "attrRel");
         $ids = $ids != '' ? ' id="' . $ids . '"' : '';
         $classes = $classes != '' ? ' ' . $classes : '';
         $title = $title != '' ? ' title="' . $title . '"' : '';
         $rel = $rel != '' ? ' rel="' . $rel . '"' : '';
         $max_width = UniteFunctionsRev::getVal($layer, "max_width", 'auto');
         $max_height = UniteFunctionsRev::getVal($layer, "max_height", 'auto');
         $white_space = UniteFunctionsRev::getVal($layer, "whitespace", 'nowrap');
         $inline_styles = '';
         $layer_rotation = '';
         $do_rotation = false;
         $add_data = '';
         $videoType = '';
         $cover = false;
         //set html:
         $html = "";
         switch ($type) {
             default:
             case "text":
                 $html = $text;
                 $inline_styles .= ' max-width: ' . $max_width . '; max-height: ' . $max_height . '; white-space: ' . $white_space . ';';
                 if ($layer_2d_rotation !== 0) {
                     $do_rotation = true;
                 }
                 break;
             case "image":
                 $alt = UniteFunctionsRev::getVal($layer, "alt");
                 if (isset($slide->ignore_alt)) {
                     $alt = '';
                 }
                 $urlImage = UniteFunctionsRev::getVal($layer, "image_url");
                 $additional = "";
                 $scaleX = UniteFunctionsRev::getVal($layer, "scaleX");
                 $scaleY = UniteFunctionsRev::getVal($layer, "scaleY");
                 if ($scaleX != '') {
                     $additional .= ' data-ww="' . $scaleX . '"';
                 }
                 if ($scaleY != '') {
                     $additional .= ' data-hh="' . $scaleY . '"';
                 }
                 if (is_ssl()) {
                     $urlImage = str_replace("http://", "https://", $urlImage);
                 }
                 $imageAddParams = "";
                 if ($lazyLoad == "on") {
                     $imageAddParams .= " data-lazyload=\"{$urlImage}\"";
                     $urlImage = GlobalsRevSlider::$url_media . "assets/images/dummy.png";
                 }
                 $urlImage = UniteFunctionJoomlaRev::urlToFull($urlImage);
                 $html = '<img src="' . $urlImage . '" alt="' . $alt . '"' . $additional . $imageAddParams . '>';
                 $imageLink = UniteFunctionsRev::getVal($layer, "link", "");
                 if (!empty($imageLink)) {
                     $openIn = UniteFunctionsRev::getVal($layer, "link_open_in", "same");
                     $target = "";
                     if ($openIn == "new") {
                         $target = ' target="_blank"';
                     }
                     $linkID = UniteFunctionsRev::getVal($layer, "link_id", "");
                     $linkClass = UniteFunctionsRev::getVal($layer, "link_class", "");
                     $linkTitle = UniteFunctionsRev::getVal($layer, "link_title", "");
                     $linkRel = UniteFunctionsRev::getVal($layer, "link_rel", "");
                     $linkIDHtml = "";
                     $linkClassHtml = "";
                     $linkTitleHtml = "";
                     $linkRelHtml = "";
                     if (!empty($linkID)) {
                         $linkIDHtml = ' id="' . $linkID . '"';
                     }
                     if (!empty($linkClass)) {
                         $linkClassHtml = ' class="' . $linkClass . '"';
                     }
                     if (!empty($linkTitle)) {
                         $linkTitleHtml = ' title="' . $linkTitle . '"';
                     }
                     if (!empty($linkRel)) {
                         $linkRelHtml = ' rel="' . $linkRel . '"';
                     }
                     $html = '<a href="' . $imageLink . '"' . $target . $linkIDHtml . $linkClassHtml . $linkTitleHtml . $linkRelHtml . '>' . $html . '</a>';
                 }
                 if ($layer_2d_rotation !== 0) {
                     $do_rotation = true;
                 }
                 break;
             case "video":
                 $videoType = trim(UniteFunctionsRev::getVal($layer, "video_type"));
                 $videoID = trim(UniteFunctionsRev::getVal($layer, "video_id"));
                 $videoWidth = trim(UniteFunctionsRev::getVal($layer, "video_width"));
                 $videoHeight = trim(UniteFunctionsRev::getVal($layer, "video_height"));
                 $videoArgs = trim(UniteFunctionsRev::getVal($layer, "video_args"));
                 $v_controls = UniteFunctionsRev::getVal($videoData, "controls");
                 $v_controls = UniteFunctionsRev::strToBool($v_controls);
                 $rewind = UniteFunctionsRev::getVal($videoData, "forcerewind");
                 $rewind = UniteFunctionsRev::strToBool($rewind);
                 $htmlRewind = $rewind == true ? ' data-forcerewind="on"' : '';
                 $only_poster_on_mobile = UniteFunctionsRev::getVal($layer, "use_poster_on_mobile");
                 $only_poster_on_mobile = UniteFunctionsRev::strToBool($only_poster_on_mobile);
                 if ($isFullWidthVideo == true) {
                     // || $cover == true
                     $videoWidth = "100%";
                     $videoHeight = "100%";
                 }
                 $setBase = is_ssl() ? "https://" : "http://";
                 $cover = UniteFunctionsRev::getVal($videoData, "cover");
                 $cover = UniteFunctionsRev::strToBool($cover);
                 switch ($videoType) {
                     case "youtube":
                         if (empty($videoArgs)) {
                             $videoArgs = GlobalsRevSlider::DEFAULT_YOUTUBE_ARGUMENTS;
                         }
                         //check if full URL
                         if (strpos($videoID, 'http') !== false) {
                             //we have full URL, split it to ID
                             parse_str(parse_url($videoID, PHP_URL_QUERY), $my_v_ret);
                             $videoID = $my_v_ret['v'];
                         }
                         $videospeed = UniteFunctionsRev::getVal($videoData, "videospeed", '1');
                         //$ytBase = 'https://';
                         //if($v_controls) $videoArgs.='controls=0;';
                         $videoArgs .= ';origin=' . $setBase . $_SERVER['SERVER_NAME'] . ';';
                         $add_data = ' data-ytid="' . $videoID . '" data-videowidth="' . $videoWidth . '" data-videoheight="' . $videoHeight . '" data-videoattributes="version=3&amp;enablejsapi=1&amp;html5=1&amp;' . $videoArgs . '" data-videorate="' . $videospeed . '"';
                         $add_data .= $v_controls ? ' data-videocontrols="none"' : ' data-videocontrols="controls"';
                         //$html = "<iframe src='".$ytBase."www.youtube.com/embed/".$videoID."?enablejsapi=1&amp;html5=1&amp;".$videoArgs."' allowfullscreen='true' width='".$videoWidth."' height='".$videoHeight."' style='width:".$videoWidth."px;height:".$videoHeight."px;'></iframe>";
                         break;
                     case "vimeo":
                         if (empty($videoArgs)) {
                             $videoArgs = GlobalsRevSlider::DEFAULT_VIMEO_ARGUMENTS;
                         }
                         //check if full URL
                         if (strpos($videoID, 'http') !== false) {
                             //we have full URL, split it to ID
                             $videoID = (int) substr(parse_url($videoID, PHP_URL_PATH), 1);
                         }
                         $add_data = ' data-vimeoid="' . $videoID . '" data-videowidth="' . $videoWidth . '" data-videoheight="' . $videoHeight . '" data-videoattributes="' . $videoArgs . '"';
                         //no controls for vimeo $add_data .= ($v_controls) ? ' data-videocontrols="none"' : ' data-videocontrols="controls"';
                         //$html = "<iframe src='".$setBase."player.vimeo.com/video/".$videoID."?".$videoArgs."' width='".$videoWidth."' height='".$videoHeight."' style='width:".$videoWidth."px;height:".$videoHeight."px;'></iframe>";
                         break;
                     case "html5":
                         $urlPoster = UniteFunctionsRev::getVal($videoData, "urlPoster");
                         $urlMp4 = UniteFunctionsRev::getVal($videoData, "urlMp4");
                         $urlWebm = UniteFunctionsRev::getVal($videoData, "urlWebm");
                         $urlOgv = UniteFunctionsRev::getVal($videoData, "urlOgv");
                         $videopreload = UniteFunctionsRev::getVal($videoData, "preload");
                         $videoloop = UniteFunctionsRev::getVal($videoData, "videoloop");
                         $add_data = ' data-videowidth="' . $videoWidth . '" data-videoheight="' . $videoHeight . '"';
                         $add_data .= $v_controls ? ' data-videocontrols="none"' : ' data-videocontrols="controls"';
                         if (!empty($urlPoster)) {
                             $add_data .= ' data-videoposter="' . $urlPoster . '"';
                         }
                         if (!empty($urlOgv)) {
                             $add_data .= ' data-videoogv="' . $urlOgv . '"';
                         }
                         if (!empty($urlWebm)) {
                             $add_data .= ' data-videowebm="' . $urlWebm . '"';
                         }
                         if (!empty($urlMp4)) {
                             $add_data .= ' data-videomp4="' . $urlMp4 . '"';
                         }
                         if (!empty($urlPoster)) {
                             if ($only_poster_on_mobile === true) {
                                 $add_data .= ' data-posterOnMObile="on"';
                             } else {
                                 $add_data .= ' data-posterOnMObile="off"';
                             }
                         }
                         if (!empty($videopreload)) {
                             $add_data .= ' data-videopreload="' . $videopreload . '"';
                         }
                         if (UniteFunctionsRev::strToBool($videoloop) == true) {
                             //fallback
                             $add_data .= ' data-videoloop="loop"';
                         } else {
                             $add_data .= ' data-videoloop="' . $videoloop . '"';
                         }
                         break;
                     default:
                         UniteFunctionsRev::throwError("wrong video type: {$videoType}");
                         break;
                 }
                 if ($cover == true) {
                     $dotted = UniteFunctionsRev::getVal($videoData, "dotted");
                     if ($dotted !== 'none') {
                         $add_data .= ' data-dottedoverlay="' . $dotted . '"';
                     }
                     $add_data .= ' data-forceCover="1"';
                     $ratio = UniteFunctionsRev::getVal($videoData, "ratio");
                     if (!empty($ratio)) {
                         $add_data .= ' data-aspectratio="' . $ratio . '"';
                     }
                 }
                 //set video autoplay, with backward compatability
                 if (array_key_exists("autoplay", $videoData)) {
                     $videoAutoplay = UniteFunctionsRev::getVal($videoData, "autoplay");
                 } else {
                     //backword compatability
                     $videoAutoplay = UniteFunctionsRev::getVal($layer, "video_autoplay");
                 }
                 //set video autoplayonlyfirsttime, with backward compatability
                 if (array_key_exists("autoplayonlyfirsttime", $videoData)) {
                     $videoAutoplayOnlyFirstTime = UniteFunctionsRev::getVal($videoData, "autoplayonlyfirsttime");
                 } else {
                     $videoAutoplayOnlyFirstTime = "";
                 }
                 $videoAutoplay = UniteFunctionsRev::strToBool($videoAutoplay);
                 $videoAutoplayOnlyFirstTime = UniteFunctionsRev::strToBool($videoAutoplayOnlyFirstTime);
                 $mute = UniteFunctionsRev::getVal($videoData, "mute");
                 $mute = UniteFunctionsRev::strToBool($mute);
                 $htmlMute = $mute ? ' data-volume="mute"' : '';
                 if ($videoAutoplay == true) {
                     $htmlVideoAutoplay = '			data-autoplay="true"' . "\n";
                 } else {
                     $htmlVideoAutoplay = '			data-autoplay="false"' . "\n";
                 }
                 if ($videoAutoplayOnlyFirstTime == true && $videoAutoplay == true) {
                     $htmlVideoAutoplayOnlyFirstTime = '			data-autoplayonlyfirsttime="true"' . "\n";
                 } else {
                     $htmlVideoAutoplayOnlyFirstTime = '			data-autoplayonlyfirsttime="false"' . "\n";
                 }
                 $videoNextSlide = UniteFunctionsRev::getVal($videoData, "nextslide");
                 $videoNextSlide = UniteFunctionsRev::strToBool($videoNextSlide);
                 if ($videoNextSlide == true) {
                     $htmlVideoNextSlide = '			data-nextslideatend="true"' . "\n";
                 }
                 $videoThumbnail = @$videoData["previewimage"];
                 if (trim($videoThumbnail) !== '') {
                     $htmlVideoThumbnail = '			data-videoposter="' . $videoThumbnail . '"' . "\n";
                 }
                 if (!empty($videoThumbnail)) {
                     if ($only_poster_on_mobile === true) {
                         $htmlVideoThumbnail .= '			data-posterOnMObile="on"' . " \n";
                     } else {
                         $htmlVideoThumbnail .= '			data-posterOnMObile="off"' . " \n";
                     }
                 }
                 $disable_on_mobile = UniteFunctionsRev::getVal($videoData, "disable_on_mobile");
                 $disable_on_mobile = UniteFunctionsRev::strToBool($disable_on_mobile);
                 $htmlDisableOnMobile = $disable_on_mobile ? '			data-disablevideoonmobile="1"' . "\n" : '';
                 break;
         }
         if ($do_rotation) {
             $layer_rotation = ' -moz-transform: rotate(' . $layer_2d_rotation . 'deg); -ms-transform: rotate(' . $layer_2d_rotation . 'deg); -o-transform: rotate(' . $layer_2d_rotation . 'deg); -webkit-transform: rotate(' . $layer_2d_rotation . 'deg); transform: rotate(' . $layer_2d_rotation . 'deg);';
             $layer_rotation .= ' -moz-transform-origin: ' . $layer_2d_origin_x . '% ' . $layer_2d_origin_y . '%; -ms-transform-origin: ' . $layer_2d_origin_x . '% ' . $layer_2d_origin_y . '%; -o-transform-origin: ' . $layer_2d_origin_x . '% ' . $layer_2d_origin_y . '%; -webkit-transform-origin: ' . $layer_2d_origin_x . '% ' . $layer_2d_origin_y . '%; transform-origin: ' . $layer_2d_origin_x . '% ' . $layer_2d_origin_y . '%;';
         }
         //handle end transitions:
         $endTime = trim(UniteFunctionsRev::getVal($layer, "endtime"));
         $realEndTime = trim(UniteFunctionsRev::getVal($layer, "realEndTime"));
         $endWithSlide = UniteFunctionsRev::getVal($layer, "endWithSlide", false);
         $endSpeed = trim(UniteFunctionsRev::getVal($layer, "endspeed"));
         $calcSpeed = !empty($endSpeed) ? $endSpeed : $speed;
         if (!empty($calcSpeed) && $realEndTime - $calcSpeed !== $endTime) {
             $endTime = $realEndTime - $calcSpeed;
         }
         $htmlEnd = "";
         $customout = '';
         if (!empty($endTime) && $endWithSlide !== true) {
             $htmlEnd = " data-end=\"{$endTime}\"" . "\n";
         }
         if (!empty($endSpeed)) {
             $htmlEnd .= " data-endspeed=\"{$endSpeed}\"" . "\n";
         }
         $endEasing = trim(UniteFunctionsRev::getVal($layer, "endeasing"));
         if (!empty($endSpeed) && $endEasing != "nothing") {
             $htmlEnd .= "\t\t\tdata-endeasing=\"{$endEasing}\"" . "\n";
         }
         //add animation to class
         $endAnimation = trim(UniteFunctionsRev::getVal($layer, "endanimation"));
         if ($endAnimation == "fade") {
             $endAnimation = "tp-fade";
         }
         if (!array_key_exists($endAnimation, $endAnimations) && array_key_exists($endAnimation, $customEndAnimations)) {
             //if true, add custom animation
             $customout = 'data-customout="';
             $animArr = RevOperations::getCustomAnimationByHandle($customEndAnimations[$endAnimation]);
             if ($animArr !== false) {
                 $customout .= RevOperations::parseCustomAnimationByArray($animArr);
             }
             $customout .= '"';
             $endAnimation = 'customout';
         }
         if (strpos($endAnimation, 'customin-') !== false || strpos($endAnimation, 'customout-') !== false) {
             $endAnimation = "";
         }
         if (!empty($endAnimation) && $endAnimation != "auto") {
             $outputClass .= " " . $endAnimation;
         }
         //slide link
         $htmlLink = "";
         $slideLink = UniteFunctionsRev::getVal($layer, "link_slide");
         if (!empty($slideLink) && $slideLink != "nothing" && $slideLink != "scroll_under") {
             //get slide index from id
             if (is_numeric($slideLink)) {
                 $slideLink = UniteFunctionsRev::getVal($this->slidesNumIndex, $slideLink);
             }
             if (!empty($slideLink)) {
                 $htmlLink = "data-linktoslide=\"{$slideLink}\"" . "\n";
             }
         }
         //scroll under the slider
         if ($slideLink == "scroll_under") {
             $outputClass .= " tp-scrollbelowslider";
             $scrollUnderOffset = intval(UniteFunctionsRev::getVal($layer, "scrollunder_offset"));
             $htmlLink .= " data-scrolloffset=\"" . $scrollUnderOffset . "\"" . "\n";
         }
         //hidden under resolution
         $htmlHidden = "";
         $layerHidden = UniteFunctionsRev::getVal($layer, "hiddenunder");
         if ($layerHidden == "true" || $layerHidden == "1") {
             $htmlHidden = '			data-captionhidden="on"' . "\n";
         }
         $htmlParams = $add_data . $htmlEnd . $htmlLink . $htmlVideoAutoplay . $htmlVideoAutoplayOnlyFirstTime . $htmlVideoNextSlide . $htmlVideoThumbnail . $htmlHidden . $htmlMute . $htmlDisableOnMobile . $htmlCover . $htmlDotted . $htmlRatio . $htmlRewind . "\n";
         //set positioning options
         $alignHor = UniteFunctionsRev::getVal($layer, "align_hor", "left");
         $alignVert = UniteFunctionsRev::getVal($layer, "align_vert", "top");
         $htmlPosX = "";
         $htmlPosY = "";
         switch ($alignHor) {
             default:
             case "left":
                 $htmlPosX = "data-x=\"" . $left . "\"";
                 break;
             case "center":
                 $htmlPosX = "data-x=\"center\" data-hoffset=\"" . $left . "\"";
                 break;
             case "right":
                 $left = (int) $left * -1;
                 $htmlPosX = "data-x=\"right\" data-hoffset=\"" . $left . "\"";
                 break;
         }
         switch ($alignVert) {
             default:
             case "top":
                 $htmlPosY = "data-y=\"" . $top . "\" ";
                 break;
             case "middle":
                 $htmlPosY = "data-y=\"center\" data-voffset=\"" . $top . "\"";
                 break;
             case "bottom":
                 $top = (int) $top * -1;
                 $htmlPosY = "data-y=\"bottom\" data-voffset=\"" . $top . "\"";
                 break;
         }
         //set corners
         $htmlCorners = "";
         if ($type == "text") {
             $cornerLeft = UniteFunctionsRev::getVal($layer, "corner_left");
             $cornerRight = UniteFunctionsRev::getVal($layer, "corner_right");
             switch ($cornerLeft) {
                 case "curved":
                     $htmlCorners .= "<div class='frontcorner'></div>";
                     break;
                 case "reverced":
                     $htmlCorners .= "<div class='frontcornertop'></div>";
                     break;
             }
             switch ($cornerRight) {
                 case "curved":
                     $htmlCorners .= "<div class='backcorner'></div>";
                     break;
                 case "reverced":
                     $htmlCorners .= "<div class='backcornertop'></div>";
                     break;
             }
             //add resizeme class
             $resizeme = UniteFunctionsRev::getVal($layer, "resizeme");
             if ($resizeme == "true" || $resizeme == "1") {
                 $outputClass .= ' tp-resizeme';
             }
         }
         //end text related layer
         //make some modifications for the full screen video
         if ($isFullWidthVideo == true) {
             $htmlPosX = "data-x=\"0\"";
             $htmlPosY = "data-y=\"0\"";
             $outputClass .= " fullscreenvideo";
         }
         //parallax part
         $use_parallax = $this->slider->getParam("use_parallax", "off");
         $parallax_class = '';
         if ($use_parallax == 'on') {
             $slide_level = intval(UniteFunctionsRev::getVal($layer, "parallax_level", '-'));
             if ($slide_level !== '-') {
                 $parallax_class = ' rs-parallaxlevel-' . $slide_level;
             }
         }
         //check for loop animation here
         $do_loop = UniteFunctionsRev::getVal($layer, "loop_animation", "none");
         $loop_data = '';
         $loop_class = '';
         if ($do_loop !== 'none') {
             $loop_class = ' ' . $do_loop;
             switch ($do_loop) {
                 case 'rs-pendulum':
                     $loop_data .= ' data-easing="' . UniteFunctionsRev::getVal($layer, "loop_easing", "Power3.easeInOut") . '"';
                     $loop_data .= ' data-startdeg="' . UniteFunctionsRev::getVal($layer, "loop_startdeg", "-20") . '"';
                     $loop_data .= ' data-enddeg="' . UniteFunctionsRev::getVal($layer, "loop_enddeg", "20") . '"';
                     $loop_data .= ' data-speed="' . UniteFunctionsRev::getVal($layer, "loop_speed", "2") . '"';
                     $loop_data .= ' data-origin="' . UniteFunctionsRev::getVal($layer, "loop_xorigin", "50") . '% ' . UniteFunctionsRev::getVal($layer, "loop_yorigin", "50") . '%"';
                     break;
                 case 'rs-rotate':
                     $loop_data .= ' data-easing="' . UniteFunctionsRev::getVal($layer, "loop_easing", "Power3.easeInOut") . '"';
                     $loop_data .= ' data-startdeg="' . UniteFunctionsRev::getVal($layer, "loop_startdeg", "-20") . '"';
                     $loop_data .= ' data-enddeg="' . UniteFunctionsRev::getVal($layer, "loop_enddeg", "20") . '"';
                     $loop_data .= ' data-speed="' . UniteFunctionsRev::getVal($layer, "loop_speed", "2") . '"';
                     $loop_data .= ' data-origin="' . UniteFunctionsRev::getVal($layer, "loop_xorigin", "50") . '% ' . UniteFunctionsRev::getVal($layer, "loop_yorigin", "50") . '%"';
                     break;
                 case 'rs-slideloop':
                     $loop_data .= ' data-easing="' . UniteFunctionsRev::getVal($layer, "loop_easing", "Power3.easeInOut") . '"';
                     $loop_data .= ' data-speed="' . UniteFunctionsRev::getVal($layer, "loop_speed", "1") . '"';
                     $loop_data .= ' data-xs="' . UniteFunctionsRev::getVal($layer, "loop_xstart", "0") . '"';
                     $loop_data .= ' data-xe="' . UniteFunctionsRev::getVal($layer, "loop_xend", "0") . '"';
                     $loop_data .= ' data-ys="' . UniteFunctionsRev::getVal($layer, "loop_ystart", "0") . '"';
                     $loop_data .= ' data-ye="' . UniteFunctionsRev::getVal($layer, "loop_yend", "0") . '"';
                     break;
                 case 'rs-pulse':
                     $loop_data .= ' data-easing="' . UniteFunctionsRev::getVal($layer, "loop_easing", "Power3.easeInOut") . '"';
                     $loop_data .= ' data-speed="' . UniteFunctionsRev::getVal($layer, "loop_speed", "1") . '"';
                     $loop_data .= ' data-zoomstart="' . UniteFunctionsRev::getVal($layer, "loop_zoomstart", "1") . '"';
                     $loop_data .= ' data-zoomend="' . UniteFunctionsRev::getVal($layer, "loop_zoomend", "1") . '"';
                     break;
                 case 'rs-wave':
                     $loop_data .= ' data-speed="' . UniteFunctionsRev::getVal($layer, "loop_speed", "1") . '"';
                     $loop_data .= ' data-angle="' . UniteFunctionsRev::getVal($layer, "loop_angle", "0") . '"';
                     $loop_data .= ' data-radius="' . UniteFunctionsRev::getVal($layer, "loop_radius", "10") . '"';
                     $loop_data .= ' data-origin="' . UniteFunctionsRev::getVal($layer, "loop_xorigin", "50") . '% ' . UniteFunctionsRev::getVal($layer, "loop_yorigin", "50") . '%"';
                     break;
             }
         }
         echo "\n\t\t<!-- LAYER NR. ";
         echo $zIndex - 4;
         echo " -->\n";
         echo "\t\t<div class=\"" . $outputClass;
         echo $classes != '' ? ' ' . $classes : '';
         echo $parallax_class;
         if ($static_slide) {
             echo ' tp-static-layer';
         }
         echo $videoclass;
         echo "\"\n";
         echo $ids != '' ? '			' . $ids . "\n" : '';
         echo $title != '' ? '			' . $title . "\n" : '';
         echo $rel != '' ? '			' . $rel . "\n" : '';
         if ($htmlPosX != "") {
             echo "\t\t\t" . $htmlPosX . "\n";
         }
         if ($htmlPosY != "") {
             echo "\t\t\t" . $htmlPosY . "\n";
         }
         if ($customin != "") {
             echo "\t\t\t" . $customin . "\n";
         }
         if ($customout != "") {
             echo "\t\t\t" . $customout . "\n";
         }
         echo "\t\t\tdata-speed=\"" . $speed . "\"\n";
         echo "\t\t\tdata-start=\"" . $time . "\"\n";
         echo "\t\t\tdata-easing=\"" . $easing . "\"\n";
         if ($type == "text") {
             //only output if we are a text layer
             echo "\t\t\tdata-splitin=\"" . $splitin . "\"\n";
             echo "\t\t\tdata-splitout=\"" . $splitout . "\"\n";
         }
         //check if static layer and if yes, set values for it.
         if ($static_slide) {
             if ($isTemplate != "true") {
                 $start_on_slide = intval(UniteFunctionsRev::getVal($layer, "static_start", 1)) - 1;
                 $end_on_slide = intval(UniteFunctionsRev::getVal($layer, "static_end", 2)) - 1;
             } else {
                 $start_on_slide = '-1';
                 $end_on_slide = '-1';
             }
             echo '			data-startslide="' . $start_on_slide . '"' . "\n";
             echo '			data-endslide="' . $end_on_slide . '"' . "\n";
         }
         echo "\t\t\tdata-elementdelay=\"" . $elementdelay . "\"\n";
         echo "\t\t\tdata-endelementdelay=\"" . $endelementdelay . "\"\n";
         if ($htmlParams != "") {
             echo "\t\t\t" . $htmlParams;
         }
         echo "\t\t\tstyle=\"z-index: " . $zIndex . ";" . $inline_styles . "\"";
         echo ">";
         if ($do_loop !== 'none') {
             echo "\n" . '				<div style="' . $layer_rotation . '" class="tp-layer-inner-rotation ';
             $rotationClass = trim($class);
             $rotationClass = trim($rotationClass) . " ";
             echo $rotationClass;
             echo $loop_class;
             echo '" ';
             echo $loop_data;
             echo '>';
         } elseif ($layer_rotation != '') {
             $rotationClass = trim($class);
             $rotationClass = trim($rotationClass) . " ";
             echo '<div class="tp-layer-inner-rotation ' . $rotationClass . '" style="' . $layer_rotation . '">' . "\n";
         }
         echo stripslashes($html) . "\n";
         if ($htmlCorners != "") {
             echo $htmlCorners . "\n";
         }
         if ($do_loop !== 'none' || $layer_rotation != '') {
             echo "\t\t\t\t</div>\n";
         }
         echo "\t\t</div>\n";
         $zIndex++;
     }
 }
 /**
  * 
  * copy from original css file to the captions css.
  */
 public function restoreCaptionsCss()
 {
     if (!file_exists(GlobalsUniteRev::$pathCaptionsCssOriginal)) {
         UniteFunctionsRev::throwError("The original css file: captions_original.css doesn't exists.");
     }
     $success = @copy(GlobalsUniteRev::$pathCaptionsCssOriginal, GlobalsUniteRev::$pathCaptionsCss);
     if ($success == false) {
         UniteFunctionsRev::throwError("Failed to restore from the original captions file.");
     }
 }
 /**
  * 
  * get slide template 
  * currently it's the first slide in the slider gallery
  */
 private function getSlideTemplates()
 {
     $sliderTemplateID = $this->getParam("slider_template_id");
     if (empty($sliderTemplateID)) {
         UniteFunctionsRev::throwError("You must provide a template for the slider show.");
     }
     $sliderTemplate = new RevSlider();
     $sliderTemplate->initByID($sliderTemplateID);
     if ($sliderTemplate->isSlidesFromPosts()) {
         UniteFunctionsRev::throwError("The slider that is template must be from gallery");
     }
     $arrSlides = $sliderTemplate->getSlides(true);
     return $arrSlides;
 }
 /**
  * 
  * normalize params
  */
 private function normalizeParams($params)
 {
     $urlImage = $params["image_url"];
     if (empty($urlImage)) {
         UniteFunctionsRev::throwError("the image could not be empty in params");
     }
     $params["image"] = $urlImage;
     unset($params["image_url"]);
     if (isset($params["video_description"])) {
         $params["video_description"] = UniteFunctionsRev::normalizeTextareaContent($params["video_description"]);
     }
     return $params;
 }
Beispiel #23
0
 public function updateArrSettingByName($name, $setting)
 {
     foreach ($this->arrSettings as $key => $settingExisting) {
         $settingName = UniteFunctionsRev::getVal($settingExisting, "name");
         if ($settingName == $name) {
             $this->arrSettings[$key] = $setting;
             return false;
         }
     }
     UniteFunctionsRev::throwError("Setting with name: {$name} don't exists");
 }
 /**
  * 
  * get contents of the css file
  */
 public static function getCaptionsCssContentArray()
 {
     if (file_exists(GlobalsRevSlider::$filepath_captions)) {
         $contentCSS = file_get_contents(GlobalsRevSlider::$filepath_captions);
     } else {
         if (file_exists(GlobalsRevSlider::$filepath_captions_original)) {
             $contentCSS = file_get_contents(GlobalsRevSlider::$filepath_captions_original);
         } else {
             if (file_exists(GlobalsRevSlider::$filepath_backup . 'captions.css')) {
                 $contentCSS = file_get_contents(GlobalsRevSlider::$filepath_backup . 'captions.css');
             } else {
                 if (file_exists(GlobalsRevSlider::$filepath_backup . 'captions-original.css')) {
                     $contentCSS = file_get_contents(GlobalsRevSlider::$filepath_backup . 'captions-original.css');
                 } else {
                     UniteFunctionsRev::throwError("No captions.css found! This installation is incorrect, please make sure to reupload the Slider Revolution plugin and try again!");
                 }
             }
         }
     }
     $result = UniteCssParserRev::parseCssToArray($contentCSS);
     return $result;
 }
 public static function createTable($tableName)
 {
     $parseCssToDb = false;
     if (!isset(self::$wpdb)) {
         $wpdb = rev_db_class::rev_db_instance();
     } else {
         $wpdb = self::$wpdb;
     }
     $tableRealName = $wpdb->prefix . $tableName;
     switch ($tableName) {
         case GlobalsRevSlider::TABLE_ATTACHMENT_IMAGES:
             $sql = "CREATE TABLE IF NOT EXISTS {$tableRealName}(\r\n\r\n                                                ID INT(10) NOT NULL AUTO_INCREMENT,\r\n\r\n                                                file_name VARCHAR(100) NOT NULL,                                                \r\n\r\n                                                PRIMARY KEY (ID)\r\n\r\n                                            )DEFAULT CHARSET=utf8;";
             break;
         case GlobalsRevSlider::TABLE_SLIDERS_NAME:
             $sql = "CREATE TABLE IF NOT EXISTS {$tableRealName}(\r\n\r\n\t\t\t\t\t\t\t  id int(9) NOT NULL AUTO_INCREMENT,\r\n\r\n\t\t\t\t\t\t\t  title tinytext NOT NULL,\r\n\r\n\t\t\t\t\t\t\t  alias tinytext,\r\n\r\n\t\t\t\t\t\t\t  params text NOT NULL,\r\n\r\n\t\t\t\t\t\t\t  PRIMARY KEY (id)\r\n\r\n\t\t\t\t\t\t\t)DEFAULT CHARSET=utf8;";
             break;
         case GlobalsRevSlider::TABLE_STATIC_SLIDES_NAME:
             $sql = "CREATE TABLE IF NOT EXISTS {$tableRealName}(\r\n\t\t\t\t\t\t\t\t  id int(9) NOT NULL AUTO_INCREMENT,\r\n\t\t\t\t\t\t\t\t  slider_id int(9) NOT NULL,\r\n\t\t\t\t\t\t\t\t  params text NOT NULL,\r\n\t\t\t\t\t\t\t\t  layers text NOT NULL,\r\n\t\t\t\t\t\t\t\t  PRIMARY KEY (id)\r\n\t\t\t\t\t\t\t\t)DEFAULT CHARSET=utf8;";
             break;
         case GlobalsRevSlider::TABLE_SLIDES_NAME:
             $sql = "CREATE TABLE IF NOT EXISTS {$tableRealName}(\r\n\r\n\t\t\t\t\t\t\t\t  id int(9) NOT NULL AUTO_INCREMENT,\r\n\r\n\t\t\t\t\t\t\t\t  slider_id int(9) NOT NULL,\r\n\r\n\t\t\t\t\t\t\t\t  slide_order int not NULL,\t\r\n\r\n\t\t\t\t\t\t\t\t  params text NOT NULL,\r\n\r\n\t\t\t\t\t\t\t\t  layers text NOT NULL,\r\n\r\n\t\t\t\t\t\t\t\t  PRIMARY KEY (id)\r\n\r\n\t\t\t\t\t\t\t\t)DEFAULT CHARSET=utf8;";
             break;
         case GlobalsRevSlider::TABLE_SETTINGS_NAME:
             $sql = "CREATE TABLE IF NOT EXISTS {$tableRealName}(\r\n\r\n\t\t\t\t\t\t\t\t  id int(9) NOT NULL AUTO_INCREMENT,\r\n\r\n\t\t\t\t\t\t\t\t  general TEXT NOT NULL,\r\n\r\n\t\t\t\t\t\t\t\t  params TEXT NOT NULL,\r\n\r\n\t\t\t\t\t\t\t\t  PRIMARY KEY (id)\r\n\r\n\t\t\t\t\t\t\t\t)DEFAULT CHARSET=utf8;";
             break;
         case GlobalsRevSlider::TABLE_CSS_NAME:
             $sql = "CREATE TABLE IF NOT EXISTS {$tableRealName}(\r\n\r\n\t\t\t\t\t\t\t\t  id int(9) NOT NULL AUTO_INCREMENT,\r\n\r\n\t\t\t\t\t\t\t\t  handle TEXT NOT NULL,\r\n\r\n\t\t\t\t\t\t\t\t  settings TEXT,\r\n\r\n\t\t\t\t\t\t\t\t  hover TEXT,\r\n\r\n\t\t\t\t\t\t\t\t  params TEXT NOT NULL,\r\n\r\n\t\t\t\t\t\t\t\t  PRIMARY KEY (id)\r\n\r\n\t\t\t\t\t\t\t\t)DEFAULT CHARSET=utf8;";
             $parseCssToDb = true;
             break;
         case GlobalsRevSlider::TABLE_LAYER_ANIMS_NAME:
             $sql = "CREATE TABLE IF NOT EXISTS " . $tableRealName . " (\r\n\r\n\t\t\t\t\t\t\t\t  id int(9) NOT NULL AUTO_INCREMENT,\r\n\r\n\t\t\t\t\t\t\t\t  handle TEXT NOT NULL,\r\n\r\n\t\t\t\t\t\t\t\t  params TEXT NOT NULL,\r\n\r\n\t\t\t\t\t\t\t\t  PRIMARY KEY (id)\r\n\r\n\t\t\t\t\t\t\t\t)DEFAULT CHARSET=utf8;";
             break;
         default:
             UniteFunctionsRev::throwError("table: {$tableName} not found");
             break;
     }
     $q = $wpdb->query($sql);
     return $q;
 }
 /**
  * 
  * put creative layer
  */
 private function putCreativeLayer(RevSlide $slide)
 {
     $layers = $slide->getLayers();
     $customAnimations = RevOperations::getCustomAnimations('customin');
     //get all custom animations
     $customEndAnimations = RevOperations::getCustomAnimations('customout');
     //get all custom animations
     $startAnimations = RevOperations::getArrAnimations(false);
     //only get the standard animations
     $endAnimations = RevOperations::getArrEndAnimations(false);
     //only get the standard animations
     $lazyLoad = $this->slider->getParam("lazy_load", "off");
     if (empty($layers)) {
         return false;
     }
     $zIndex = 2;
     foreach ($layers as $layer) {
         $type = UniteFunctionsRev::getVal($layer, "type", "text");
         //set if video full screen
         $isFullWidthVideo = false;
         if ($type == "video") {
             $videoData = UniteFunctionsRev::getVal($layer, "video_data");
             if (!empty($videoData)) {
                 $videoData = (array) $videoData;
                 $isFullWidthVideo = UniteFunctionsRev::getVal($videoData, "fullwidth");
                 $isFullWidthVideo = UniteFunctionsRev::strToBool($isFullWidthVideo);
             } else {
                 $videoData = array();
             }
         }
         $class = UniteFunctionsRev::getVal($layer, "style");
         $animation = UniteFunctionsRev::getVal($layer, "animation", "tp-fade");
         if ($animation == "fade") {
             $animation = "tp-fade";
         }
         $customin = '';
         if (!array_key_exists($animation, $startAnimations) && array_key_exists($animation, $customAnimations)) {
             //if true, add custom animation
             $customin .= 'data-customin="';
             $animArr = RevOperations::getCustomAnimationByHandle($customAnimations[$animation]);
             if ($animArr !== false) {
                 $customin .= RevOperations::parseCustomAnimationByArray($animArr);
             }
             $customin .= '"';
             $animation = 'customin';
         }
         if (strpos($animation, 'customin-') !== false || strpos($animation, 'customout-') !== false) {
             $animation = "tp-fade";
         }
         //set output class:
         $outputClass = "tp-caption " . trim($class);
         $outputClass = trim($outputClass) . " ";
         $outputClass .= trim($animation);
         $left = UniteFunctionsRev::getVal($layer, "left", 0);
         $top = UniteFunctionsRev::getVal($layer, "top", 0);
         $speed = UniteFunctionsRev::getVal($layer, "speed", 300);
         $time = UniteFunctionsRev::getVal($layer, "time", 0);
         $easing = UniteFunctionsRev::getVal($layer, "easing", "easeOutExpo");
         $randomRotate = UniteFunctionsRev::getVal($layer, "random_rotation", "false");
         $randomRotate = UniteFunctionsRev::boolToStr($randomRotate);
         $splitin = UniteFunctionsRev::getVal($layer, "split", "none");
         $splitout = UniteFunctionsRev::getVal($layer, "endsplit", "none");
         $elementdelay = intval(UniteFunctionsRev::getVal($layer, "splitdelay", 0));
         $endelementdelay = intval(UniteFunctionsRev::getVal($layer, "endsplitdelay", 0));
         if ($elementdelay > 0) {
             $elementdelay /= 100;
         }
         if ($endelementdelay > 0) {
             $endelementdelay /= 100;
         }
         $text = UniteFunctionsRev::getVal($layer, "text");
         $htmlVideoAutoplay = "";
         $htmlVideoAutoplayOnlyFirstTime = "";
         $htmlVideoNextSlide = "";
         $htmlVideoThumbnail = "";
         $htmlMute = '';
         $htmlCover = '';
         $htmlDotted = '';
         $htmlRatio = '';
         $htmlRewind = '';
         $ids = UniteFunctionsRev::getVal($layer, "attrID");
         $classes = UniteFunctionsRev::getVal($layer, "attrClasses");
         $title = UniteFunctionsRev::getVal($layer, "attrTitle");
         $rel = UniteFunctionsRev::getVal($layer, "attrRel");
         $ids = $ids != '' ? ' id="' . $ids . '"' : '';
         $classes = $classes != '' ? ' ' . $classes : '';
         $title = $title != '' ? ' title="' . $title . '"' : '';
         $rel = $rel != '' ? ' rel="' . $rel . '"' : '';
         $max_width = UniteFunctionsRev::getVal($layer, "max_width", 'auto');
         $max_height = UniteFunctionsRev::getVal($layer, "max_height", 'auto');
         $white_space = UniteFunctionsRev::getVal($layer, "whitespace", 'nowrap');
         $inline_styles = '';
         //set html:
         $html = "";
         switch ($type) {
             default:
             case "text":
                 $html = $text;
                 $html = do_shortcode($html);
                 $inline_styles .= ' max-width: ' . $max_width . '; max-height: ' . $max_height . '; white-space: ' . $white_space . ';';
                 break;
             case "image":
                 $alt = UniteFunctionsRev::getVal($layer, "alt");
                 $urlImage = UniteFunctionsRev::getVal($layer, "image_url");
                 $additional = "";
                 $scaleX = UniteFunctionsRev::getVal($layer, "scaleX");
                 $scaleY = UniteFunctionsRev::getVal($layer, "scaleY");
                 if ($scaleX != '') {
                     $additional .= ' data-ww="' . $scaleX . '"';
                 }
                 if ($scaleY != '') {
                     $additional .= ' data-hh="' . $scaleY . '"';
                 }
                 if (is_ssl()) {
                     $urlImage = str_replace("http://", "https://", $urlImage);
                 }
                 $imageAddParams = "";
                 if ($lazyLoad == "on") {
                     $imageAddParams .= " data-lazyload=\"{$urlImage}\"";
                     $urlImage = UniteBaseClassRev::$url_plugin . "images/dummy.png";
                 }
                 $html = '<img src="' . $urlImage . '" alt="' . $alt . '"' . $additional . $imageAddParams . '>';
                 $imageLink = UniteFunctionsRev::getVal($layer, "link", "");
                 if (!empty($imageLink)) {
                     $openIn = UniteFunctionsRev::getVal($layer, "link_open_in", "same");
                     $target = "";
                     if ($openIn == "new") {
                         $target = ' target="_blank"';
                     }
                     $linkID = UniteFunctionsRev::getVal($layer, "link_id", "");
                     $linkClass = UniteFunctionsRev::getVal($layer, "link_class", "");
                     $linkTitle = UniteFunctionsRev::getVal($layer, "link_title", "");
                     $linkRel = UniteFunctionsRev::getVal($layer, "link_rel", "");
                     $linkIDHtml = "";
                     $linkClassHtml = "";
                     $linkTitleHtml = "";
                     $linkRelHtml = "";
                     if (!empty($linkID)) {
                         $linkIDHtml = ' id="' . $linkID . '"';
                     }
                     if (!empty($linkClass)) {
                         $linkClassHtml = ' class="' . $linkClass . '"';
                     }
                     if (!empty($linkTitle)) {
                         $linkTitleHtml = ' title="' . $linkTitle . '"';
                     }
                     if (!empty($linkRel)) {
                         $linkRelHtml = ' rel="' . $linkRel . '"';
                     }
                     $html = '<a href="' . $imageLink . '"' . $target . $linkIDHtml . $linkClassHtml . $linkTitleHtml . $linkRelHtml . '>' . $html . '</a>';
                 }
                 break;
             case "video":
                 $videoType = trim(UniteFunctionsRev::getVal($layer, "video_type"));
                 $videoID = trim(UniteFunctionsRev::getVal($layer, "video_id"));
                 $videoWidth = trim(UniteFunctionsRev::getVal($layer, "video_width"));
                 $videoHeight = trim(UniteFunctionsRev::getVal($layer, "video_height"));
                 $videoArgs = trim(UniteFunctionsRev::getVal($layer, "video_args"));
                 $rewind = UniteFunctionsRev::getVal($videoData, "forcerewind");
                 $rewind = UniteFunctionsRev::strToBool($rewind);
                 $htmlRewind = $rewind == true ? ' data-forcerewind="on"' : '';
                 if ($isFullWidthVideo == true) {
                     $videoWidth = "100%";
                     $videoHeight = "100%";
                 }
                 $setBase = is_ssl() ? "https://" : "http://";
                 switch ($videoType) {
                     case "youtube":
                         if (empty($videoArgs)) {
                             $videoArgs = GlobalsRevSlider::DEFAULT_YOUTUBE_ARGUMENTS;
                         }
                         $videoArgs = str_replace('rel=0', '', $videoArgs);
                         $ytBase = 'https://';
                         $videoArgs .= ';origin=' . $setBase . $_SERVER['SERVER_NAME'] . ';';
                         $html = "<iframe src='" . $ytBase . "www.youtube.com/embed/" . $videoID . "?enablejsapi=1&amp;html5=1&amp;" . $videoArgs . "' width='" . $videoWidth . "' height='" . $videoHeight . "' style='width:" . $videoWidth . "px;height:" . $videoHeight . "px;'></iframe>";
                         break;
                     case "vimeo":
                         if (empty($videoArgs)) {
                             $videoArgs = GlobalsRevSlider::DEFAULT_VIMEO_ARGUMENTS;
                         }
                         $html = "<iframe src='" . $setBase . "player.vimeo.com/video/" . $videoID . "?" . $videoArgs . "' width='" . $videoWidth . "' height='" . $videoHeight . "' style='width:" . $videoWidth . "px;height:" . $videoHeight . "px;'></iframe>";
                         break;
                     case "html5":
                         $html = $this->getHtml5LayerHtml($videoData);
                         $cover = UniteFunctionsRev::getVal($videoData, "cover");
                         $cover = UniteFunctionsRev::strToBool($cover);
                         if ($cover == true) {
                             $htmlCover = ' data-forceCover="1"';
                             $dotted = UniteFunctionsRev::getVal($videoData, "dotted");
                             if ($dotted !== 'none') {
                                 $htmlDotted = ' data-dottedoverlay="' . $dotted . '"';
                             }
                             $ratio = UniteFunctionsRev::getVal($videoData, "ratio");
                             if (!empty($ratio)) {
                                 $htmlRatio = ' data-aspectratio="' . $ratio . '"';
                             }
                         }
                         break;
                     default:
                         UniteFunctionsRev::throwError("wrong video type: {$videoType}");
                         break;
                 }
                 //set video autoplay, with backward compatability
                 if (array_key_exists("autoplay", $videoData)) {
                     $videoAutoplay = UniteFunctionsRev::getVal($videoData, "autoplay");
                 } else {
                     //backword compatability
                     $videoAutoplay = UniteFunctionsRev::getVal($layer, "video_autoplay");
                 }
                 //set video autoplayonlyfirsttime, with backward compatability
                 if (array_key_exists("autoplayonlyfirsttime", $videoData)) {
                     $videoAutoplayOnlyFirstTime = UniteFunctionsRev::getVal($videoData, "autoplayonlyfirsttime");
                 } else {
                     $videoAutoplayOnlyFirstTime = "";
                 }
                 $videoAutoplay = UniteFunctionsRev::strToBool($videoAutoplay);
                 $videoAutoplayOnlyFirstTime = UniteFunctionsRev::strToBool($videoAutoplayOnlyFirstTime);
                 $mute = UniteFunctionsRev::getVal($videoData, "mute");
                 $mute = UniteFunctionsRev::strToBool($mute);
                 $htmlMute = $mute ? ' data-volume="mute"' : '';
                 if ($videoAutoplay == true) {
                     $htmlVideoAutoplay = '			data-autoplay="true"' . "\n";
                 } else {
                     $htmlVideoAutoplay = '			data-autoplay="false"' . "\n";
                 }
                 if ($videoAutoplayOnlyFirstTime == true && $videoAutoplay == true) {
                     $htmlVideoAutoplayOnlyFirstTime = '			data-autoplayonlyfirsttime="true"' . "\n";
                 } else {
                     $htmlVideoAutoplayOnlyFirstTime = '			data-autoplayonlyfirsttime="false"' . "\n";
                 }
                 $videoNextSlide = UniteFunctionsRev::getVal($videoData, "nextslide");
                 $videoNextSlide = UniteFunctionsRev::strToBool($videoNextSlide);
                 if ($videoNextSlide == true) {
                     $htmlVideoNextSlide = '			data-nextslideatend="true"' . "\n";
                 }
                 $videoThumbnail = @$videoData["previewimage"];
                 if (trim($videoThumbnail) !== '') {
                     $htmlVideoThumbnail = '			data-thumbimage="' . $videoThumbnail . '"' . "\n";
                 }
                 break;
         }
         //handle end transitions:
         $endTime = trim(UniteFunctionsRev::getVal($layer, "endtime"));
         $htmlEnd = "";
         $customout = '';
         if (!empty($endTime)) {
             $htmlEnd = "data-end=\"{$endTime}\"" . "\n";
         }
         $endSpeed = trim(UniteFunctionsRev::getVal($layer, "endspeed"));
         if (!empty($endSpeed)) {
             $htmlEnd .= "data-endspeed=\"{$endSpeed}\"" . "\n";
         }
         $endEasing = trim(UniteFunctionsRev::getVal($layer, "endeasing"));
         if (!empty($endSpeed) && $endEasing != "nothing") {
             $htmlEnd .= "\t\t\tdata-endeasing=\"{$endEasing}\"" . "\n";
         }
         //add animation to class
         $endAnimation = trim(UniteFunctionsRev::getVal($layer, "endanimation"));
         if ($endAnimation == "fade") {
             $endAnimation = "tp-fade";
         }
         if (!array_key_exists($endAnimation, $endAnimations) && array_key_exists($endAnimation, $customEndAnimations)) {
             //if true, add custom animation
             $customout = 'data-customout="';
             $animArr = RevOperations::getCustomAnimationByHandle($customEndAnimations[$endAnimation]);
             if ($animArr !== false) {
                 $customout .= RevOperations::parseCustomAnimationByArray($animArr);
             }
             $customout .= '"';
             $endAnimation = 'customout';
         }
         if (strpos($endAnimation, 'customin-') !== false || strpos($endAnimation, 'customout-') !== false) {
             $endAnimation = "";
         }
         if (!empty($endAnimation) && $endAnimation != "auto") {
             $outputClass .= " " . $endAnimation;
         }
         //slide link
         $htmlLink = "";
         $slideLink = UniteFunctionsRev::getVal($layer, "link_slide");
         if (!empty($slideLink) && $slideLink != "nothing" && $slideLink != "scroll_under") {
             //get slide index from id
             if (is_numeric($slideLink)) {
                 $slideLink = UniteFunctionsRev::getVal($this->slidesNumIndex, $slideLink);
             }
             if (!empty($slideLink)) {
                 $htmlLink = "data-linktoslide=\"{$slideLink}\"" . "\n";
             }
         }
         //scroll under the slider
         if ($slideLink == "scroll_under") {
             $outputClass .= " tp-scrollbelowslider";
             $scrollUnderOffset = UniteFunctionsRev::getVal($layer, "scrollunder_offset");
             if (!empty($scrollUnderOffset)) {
                 $htmlLink .= "data-scrolloffset=\"" . $scrollUnderOffset . "\"" . "\n";
             }
         }
         //hidden under resolution
         $htmlHidden = "";
         $layerHidden = UniteFunctionsRev::getVal($layer, "hiddenunder");
         if ($layerHidden == "true" || $layerHidden == "1") {
             $htmlHidden = '			data-captionhidden="on"' . "\n";
         }
         $htmlParams = $htmlEnd . $htmlLink . $htmlVideoAutoplay . $htmlVideoAutoplayOnlyFirstTime . $htmlVideoNextSlide . $htmlVideoThumbnail . $htmlHidden . $htmlMute . $htmlCover . $htmlDotted . $htmlRatio . $htmlRewind;
         //set positioning options
         $alignHor = UniteFunctionsRev::getVal($layer, "align_hor", "left");
         $alignVert = UniteFunctionsRev::getVal($layer, "align_vert", "top");
         $htmlPosX = "";
         $htmlPosY = "";
         switch ($alignHor) {
             default:
             case "left":
                 $htmlPosX = "data-x=\"" . $left . "\"";
                 break;
             case "center":
                 $htmlPosX = "data-x=\"center\" data-hoffset=\"" . $left . "\"";
                 break;
             case "right":
                 $left = (int) $left * -1;
                 $htmlPosX = "data-x=\"right\" data-hoffset=\"" . $left . "\"";
                 break;
         }
         switch ($alignVert) {
             default:
             case "top":
                 $htmlPosY = "data-y=\"" . $top . "\" ";
                 break;
             case "middle":
                 $htmlPosY = "data-y=\"center\" data-voffset=\"" . $top . "\"";
                 break;
             case "bottom":
                 $top = (int) $top * -1;
                 $htmlPosY = "data-y=\"bottom\" data-voffset=\"" . $top . "\"";
                 break;
         }
         //set corners
         $htmlCorners = "";
         if ($type == "text") {
             $cornerLeft = UniteFunctionsRev::getVal($layer, "corner_left");
             $cornerRight = UniteFunctionsRev::getVal($layer, "corner_right");
             switch ($cornerLeft) {
                 case "curved":
                     $htmlCorners .= "<div class='frontcorner'></div>";
                     break;
                 case "reverced":
                     $htmlCorners .= "<div class='frontcornertop'></div>";
                     break;
             }
             switch ($cornerRight) {
                 case "curved":
                     $htmlCorners .= "<div class='backcorner'></div>";
                     break;
                 case "reverced":
                     $htmlCorners .= "<div class='backcornertop'></div>";
                     break;
             }
             //add resizeme class
             $resizeme = UniteFunctionsRev::getVal($layer, "resizeme");
             if ($resizeme == "true" || $resizeme == "1") {
                 $outputClass .= ' tp-resizeme';
             }
         }
         //end text related layer
         //make some modifications for the full screen video
         if ($isFullWidthVideo == true) {
             $htmlPosX = "data-x=\"0\"";
             $htmlPosY = "data-y=\"0\"";
             $outputClass .= " fullscreenvideo";
         }
         echo "\n\t\t<!-- LAYER NR. ";
         echo $zIndex - 1;
         echo " -->\n";
         echo "\t\t<div class=\"" . $outputClass;
         echo $classes != '' ? ' ' . $classes : '';
         echo "\"\n";
         echo $ids != '' ? '			' . $ids . "\n" : '';
         echo $title != '' ? '			' . $title . "\n" : '';
         echo $rel != '' ? '			' . $rel . "\n" : '';
         if ($htmlPosX != "") {
             echo "\t\t\t" . $htmlPosX . "\n";
         }
         if ($htmlPosY != "") {
             echo "\t\t\t" . $htmlPosY . "\n";
         }
         if ($customin != "") {
             echo "\t\t\t" . $customin . "\n";
         }
         if ($customout != "") {
             echo "\t\t\t" . $customout . "\n";
         }
         echo "\t\t\tdata-speed=\"" . $speed . "\"\n";
         echo "\t\t\tdata-start=\"" . $time . "\"\n";
         echo "\t\t\tdata-easing=\"" . $easing . "\"\n";
         echo "\t\t\tdata-splitin=\"" . $splitin . "\"\n";
         echo "\t\t\tdata-splitout=\"" . $splitout . "\"\n";
         echo "\t\t\tdata-elementdelay=\"" . $elementdelay . "\"\n";
         echo "\t\t\tdata-endelementdelay=\"" . $endelementdelay . "\"\n";
         if ($htmlParams != "") {
             echo "\t\t\t" . $htmlParams;
         }
         echo "\t\t\tstyle=\"z-index: " . $zIndex . ";" . $inline_styles . "\"";
         echo ">";
         echo $html . "\n";
         if ($htmlCorners != "") {
             echo $htmlCorners . "\n";
         }
         echo "\t\t</div>\n";
         $zIndex++;
     }
 }
Beispiel #27
0
 /**
  * 
  * throw error
  */
 private function throwError($message, $code = null)
 {
     UniteFunctionsRev::throwError($message, $code);
 }
Beispiel #28
0
 /**
  * 
  * onAjax action handler
  */
 public static function onAjaxAction()
 {
     $slider = new RevSlider();
     $slide = new RevSlide();
     $operations = new RevOperations();
     $action = self::getPostGetVar("client_action");
     $data = self::getPostGetVar("data");
     $nonce = self::getPostGetVar("nonce");
     try {
         //verify the nonce
         $isVerified = wp_verify_nonce($nonce, "revslider_actions");
         if ($isVerified == false) {
             UniteFunctionsRev::throwError("Wrong request");
         }
         switch ($action) {
             case 'add_google_fonts':
                 $f = new ThemePunch_Fonts();
                 $result = $f->add_new_font($data);
                 if ($result === true) {
                     self::ajaxResponseSuccess(__("Font successfully created!", REVSLIDER_TEXTDOMAIN), array('data' => $result, 'is_redirect' => true, 'redirect_url' => self::getFontsUrl()));
                 } else {
                     self::ajaxResponseError($result, false);
                 }
                 break;
             case 'remove_google_fonts':
                 if (!isset($data['handle'])) {
                     self::ajaxResponseError(__('Font not found', REVSLIDER_TEXTDOMAIN), false);
                 }
                 $f = new ThemePunch_Fonts();
                 $result = $f->remove_font_by_handle($data['handle']);
                 if ($result === true) {
                     self::ajaxResponseSuccess(__("Font successfully removed!", REVSLIDER_TEXTDOMAIN), array('data' => $result));
                 } else {
                     self::ajaxResponseError($result, false);
                 }
                 break;
             case 'edit_google_fonts':
                 if (!isset($data['handle'])) {
                     self::ajaxResponseError(__('No handle given', REVSLIDER_TEXTDOMAIN), false);
                 }
                 if (!isset($data['url'])) {
                     self::ajaxResponseError(__('No parameters given', REVSLIDER_TEXTDOMAIN), false);
                 }
                 $f = new ThemePunch_Fonts();
                 $result = $f->edit_font_by_handle($data);
                 if ($result === true) {
                     self::ajaxResponseSuccess(__("Font successfully changed!", REVSLIDER_TEXTDOMAIN), array('data' => $result));
                 } else {
                     self::ajaxResponseError($result, false);
                 }
                 break;
             case "export_slider":
                 $sliderID = self::getGetVar("sliderid");
                 $dummy = self::getGetVar("dummy");
                 $slider->initByID($sliderID);
                 $slider->exportSlider($dummy);
                 break;
             case "import_slider":
                 $updateAnim = self::getPostGetVar("update_animations");
                 $updateStatic = self::getPostGetVar("update_static_captions");
                 self::importSliderHandle(null, $updateAnim, $updateStatic);
                 break;
             case "import_slider_slidersview":
                 $viewBack = self::getViewUrl(self::VIEW_SLIDERS);
                 $updateAnim = self::getPostGetVar("update_animations");
                 $updateStatic = self::getPostGetVar("update_static_captions");
                 self::importSliderHandle($viewBack, $updateAnim, $updateStatic);
                 break;
             case "create_slider":
                 self::requireSettings("slider_settings");
                 $settingsMain = self::getSettings("slider_main");
                 $settingsParams = self::getSettings("slider_params");
                 $data = $operations->modifyCustomSliderParams($data);
                 $newSliderID = $slider->createSliderFromOptions($data, $settingsMain, $settingsParams);
                 self::ajaxResponseSuccessRedirect(__("The slider successfully created", REVSLIDER_TEXTDOMAIN), self::getViewUrl("sliders"));
                 break;
             case "update_slider":
                 self::requireSettings("slider_settings");
                 $settingsMain = self::getSettings("slider_main");
                 $settingsParams = self::getSettings("slider_params");
                 $data = $operations->modifyCustomSliderParams($data);
                 $slider->updateSliderFromOptions($data, $settingsMain, $settingsParams);
                 self::ajaxResponseSuccess(__("Slider updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "delete_slider":
                 $isDeleted = $slider->deleteSliderFromData($data);
                 if (is_array($isDeleted)) {
                     $isDeleted = implode(', ', $isDeleted);
                     self::ajaxResponseError("Template can't be deleted, it is still being used by the following Sliders: " . $isDeleted);
                 } else {
                     self::ajaxResponseSuccessRedirect(__("The slider deleted", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS));
                 }
                 break;
             case "duplicate_slider":
                 $slider->duplicateSliderFromData($data);
                 self::ajaxResponseSuccessRedirect(__("The duplicate successfully, refreshing page...", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS));
                 break;
             case "add_slide":
                 $numSlides = $slider->createSlideFromData($data);
                 $sliderID = $data["sliderid"];
                 if ($numSlides == 1) {
                     $responseText = __("Slide Created", REVSLIDER_TEXTDOMAIN);
                 } else {
                     $responseText = $numSlides . " " . __("Slides Created", REVSLIDER_TEXTDOMAIN);
                 }
                 $urlRedirect = self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}");
                 self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
                 break;
             case "add_slide_fromslideview":
                 $slideID = $slider->createSlideFromData($data, true);
                 $urlRedirect = self::getViewUrl(self::VIEW_SLIDE, "id={$slideID}");
                 $responseText = __("Slide Created, redirecting...", REVSLIDER_TEXTDOMAIN);
                 self::ajaxResponseSuccessRedirect($responseText, $urlRedirect);
                 break;
             case "update_slide":
                 require self::getSettingsFilePath("slide_settings");
                 $slide->updateSlideFromData($data, $slideSettings);
                 self::ajaxResponseSuccess(__("Slide updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "update_static_slide":
                 $slide->updateStaticSlideFromData($data);
                 self::ajaxResponseSuccess(__("Static Layers updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "delete_slide":
                 $isPost = $slide->deleteSlideFromData($data);
                 if ($isPost) {
                     $message = __("Post Deleted Successfully", REVSLIDER_TEXTDOMAIN);
                 } else {
                     $message = __("Slide Deleted Successfully", REVSLIDER_TEXTDOMAIN);
                 }
                 $sliderID = UniteFunctionsRev::getVal($data, "sliderID");
                 self::ajaxResponseSuccessRedirect($message, self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "duplicate_slide":
                 $sliderID = $slider->duplicateSlideFromData($data);
                 self::ajaxResponseSuccessRedirect(__("Slide Duplicated Successfully", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "copy_move_slide":
                 $sliderID = $slider->copyMoveSlideFromData($data);
                 self::ajaxResponseSuccessRedirect(__("The operation successfully, refreshing page...", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "get_static_css":
                 $contentCSS = $operations->getStaticCss();
                 self::ajaxResponseData($contentCSS);
                 break;
             case "get_dynamic_css":
                 $contentCSS = $operations->getDynamicCss();
                 self::ajaxResponseData($contentCSS);
                 break;
             case "insert_captions_css":
                 $arrCaptions = $operations->insertCaptionsContentData($data);
                 self::ajaxResponseSuccess(__("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
                 break;
             case "update_captions_css":
                 $arrCaptions = $operations->updateCaptionsContentData($data);
                 self::ajaxResponseSuccess(__("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
                 break;
             case "delete_captions_css":
                 $arrCaptions = $operations->deleteCaptionsContentData($data);
                 self::ajaxResponseSuccess(__("Style deleted succesfully!", REVSLIDER_TEXTDOMAIN), array("arrCaptions" => $arrCaptions));
                 break;
             case "update_static_css":
                 $staticCss = $operations->updateStaticCss($data);
                 self::ajaxResponseSuccess(__("CSS saved succesfully!", REVSLIDER_TEXTDOMAIN), array("css" => $staticCss));
                 break;
             case "insert_custom_anim":
                 $arrAnims = $operations->insertCustomAnim($data);
                 //$arrCaptions =
                 self::ajaxResponseSuccess(__("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
                 //,array("arrCaptions"=>$arrCaptions)
                 break;
             case "update_custom_anim":
                 $arrAnims = $operations->updateCustomAnim($data);
                 self::ajaxResponseSuccess(__("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
                 //,array("arrCaptions"=>$arrCaptions)
                 break;
             case "delete_custom_anim":
                 $arrAnims = $operations->deleteCustomAnim($data);
                 self::ajaxResponseSuccess(__("Animation saved succesfully!", REVSLIDER_TEXTDOMAIN), $arrAnims);
                 //,array("arrCaptions"=>$arrCaptions)
                 break;
             case "update_slides_order":
                 $slider->updateSlidesOrderFromData($data);
                 self::ajaxResponseSuccess(__("Order updated successfully", REVSLIDER_TEXTDOMAIN));
                 break;
             case "change_slide_image":
                 $slide->updateSlideImageFromData($data);
                 $sliderID = UniteFunctionsRev::getVal($data, "slider_id");
                 self::ajaxResponseSuccessRedirect(__("Slide Changed Successfully", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}"));
                 break;
             case "preview_slide":
                 $operations->putSlidePreviewByData($data);
                 break;
             case "preview_slider":
                 $sliderID = UniteFunctionsRev::getPostGetVariable("sliderid");
                 $do_markup = UniteFunctionsRev::getPostGetVariable("only_markup");
                 if ($do_markup == 'true') {
                     $operations->previewOutputMarkup($sliderID);
                 } else {
                     $operations->previewOutput($sliderID);
                 }
                 break;
             case "toggle_slide_state":
                 $currentState = $slide->toggleSlideStatFromData($data);
                 self::ajaxResponseData(array("state" => $currentState));
                 break;
             case "slide_lang_operation":
                 $responseData = $slide->doSlideLangOperation($data);
                 self::ajaxResponseData($responseData);
                 break;
             case "update_plugin":
                 self::updatePlugin(self::DEFAULT_VIEW);
                 break;
             case "update_text":
                 self::updateSettingsText();
                 self::ajaxResponseSuccess(__("All files successfully updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "update_general_settings":
                 $operations->updateGeneralSettings($data);
                 self::ajaxResponseSuccess(__("General settings updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "update_posts_sortby":
                 $slider->updatePostsSortbyFromData($data);
                 self::ajaxResponseSuccess(__("Sortby updated", REVSLIDER_TEXTDOMAIN));
                 break;
             case "replace_image_urls":
                 $slider->replaceImageUrlsFromData($data);
                 self::ajaxResponseSuccess(__("Image urls replaced", REVSLIDER_TEXTDOMAIN));
                 break;
             case "reset_slide_settings":
                 $slider->resetSlideSettings($data);
                 self::ajaxResponseSuccess(__("Settings in all Slides changed", REVSLIDER_TEXTDOMAIN));
                 break;
             case "activate_purchase_code":
                 $result = false;
                 if (!empty($data['username']) && !empty($data['api_key']) && !empty($data['code'])) {
                     $result = $operations->checkPurchaseVerification($data);
                 } else {
                     UniteFunctionsRev::throwError(__('The API key, the Purchase Code and the Username need to be set!', REVSLIDER_TEXTDOMAIN));
                     exit;
                 }
                 if ($result) {
                     self::ajaxResponseSuccessRedirect(__("Purchase Code Successfully Activated", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS));
                 } else {
                     UniteFunctionsRev::throwError(__('Purchase Code is invalid', REVSLIDER_TEXTDOMAIN));
                 }
                 break;
             case "deactivate_purchase_code":
                 $result = $operations->doPurchaseDeactivation($data);
                 if ($result) {
                     self::ajaxResponseSuccessRedirect(__("Successfully removed validation", REVSLIDER_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS));
                 } else {
                     UniteFunctionsRev::throwError(__('Could not remove Validation!', REVSLIDER_TEXTDOMAIN));
                 }
                 break;
             case "dismiss_notice":
                 update_option('revslider-valid-notice', 'false');
                 self::ajaxResponseSuccess(__(".", REVSLIDER_TEXTDOMAIN));
                 break;
             default:
                 self::ajaxResponseError("wrong ajax action: {$action} ");
                 break;
         }
     } catch (Exception $e) {
         $message = $e->getMessage();
         if ($action == "preview_slide" || $action == "preview_slider") {
             echo $message;
             exit;
         }
         self::ajaxResponseError($message);
     }
     //it's an ajax action, so exit
     self::ajaxResponseError("No response output on <b> {$action} </b> action. please check with the developer.");
     exit;
 }
    /**
     * 
     * draw settings function
     */
    public function draw($formID = null)
    {
        if (empty($formID)) {
            UniteFunctionsRev::throwError("You must provide formID to side settings.");
        }
        $this->formID = $formID;
        if (!empty($formID)) {
            ?>
				<form name="<?php 
            echo $formID;
            ?>
" id="<?php 
            echo $formID;
            ?>
">
					<?php 
            $this->drawSettings();
            ?>
				</form>
				<?php 
        } else {
            $this->drawSettings();
        }
        if ($this->isAccordion == true) {
            $this->putAccordionInit();
        }
    }
Beispiel #30
0
    /**
     * 
     * put creative layer
     */
    private function putCreativeLayer(RevSlide $slide)
    {
        $layers = $slide->getLayers();
        if (empty($layers)) {
            return false;
        }
        ?>
				<?php 
        foreach ($layers as $layer) {
            $type = UniteFunctionsRev::getVal($layer, "type", "text");
            //set if video full screen
            $isFullWidthVideo = false;
            if ($type == "video") {
                $videoData = UniteFunctionsRev::getVal($layer, "video_data");
                if (!empty($videoData)) {
                    $videoData = (array) $videoData;
                    $isFullWidthVideo = UniteFunctionsRev::getVal($videoData, "fullwidth");
                    $isFullWidthVideo = UniteFunctionsRev::strToBool($isFullWidthVideo);
                } else {
                    $videoData = array();
                }
            }
            $class = UniteFunctionsRev::getVal($layer, "style");
            $animation = UniteFunctionsRev::getVal($layer, "animation", "fade");
            //set output class:
            $outputClass = "tp-caption " . trim($class);
            $outputClass = trim($outputClass) . " ";
            $outputClass .= trim($animation);
            $left = UniteFunctionsRev::getVal($layer, "left", 0);
            $top = UniteFunctionsRev::getVal($layer, "top", 0);
            $speed = UniteFunctionsRev::getVal($layer, "speed", 300);
            $time = UniteFunctionsRev::getVal($layer, "time", 0);
            $easing = UniteFunctionsRev::getVal($layer, "easing", "easeOutExpo");
            $randomRotate = UniteFunctionsRev::getVal($layer, "random_rotation", "false");
            $randomRotate = UniteFunctionsRev::boolToStr($randomRotate);
            $text = UniteFunctionsRev::getVal($layer, "text");
            $htmlVideoAutoplay = "";
            $htmlVideoNextSlide = "";
            //set html:
            $html = "";
            switch ($type) {
                default:
                case "text":
                    $html = $text;
                    $html = do_shortcode($html);
                    break;
                case "image":
                    $urlImage = UniteFunctionsRev::getVal($layer, "image_url");
                    $html = '<img src="' . $urlImage . '" alt="' . $text . '">';
                    $imageLink = UniteFunctionsRev::getVal($layer, "link", "");
                    if (!empty($imageLink)) {
                        $openIn = UniteFunctionsRev::getVal($layer, "link_open_in", "same");
                        $target = "";
                        if ($openIn == "new") {
                            $target = ' target="_blank"';
                        }
                        $html = '<a href="' . $imageLink . '"' . $target . '>' . $html . '</a>';
                    }
                    break;
                case "video":
                    $videoType = trim(UniteFunctionsRev::getVal($layer, "video_type"));
                    $videoID = trim(UniteFunctionsRev::getVal($layer, "video_id"));
                    $videoWidth = trim(UniteFunctionsRev::getVal($layer, "video_width"));
                    $videoHeight = trim(UniteFunctionsRev::getVal($layer, "video_height"));
                    $videoArgs = trim(UniteFunctionsRev::getVal($layer, "video_args"));
                    if ($isFullWidthVideo == true) {
                        $videoWidth = "100%";
                        $videoHeight = "100%";
                    }
                    switch ($videoType) {
                        case "youtube":
                            if (empty($videoArgs)) {
                                $videoArgs = GlobalsRevSlider::DEFAULT_YOUTUBE_ARGUMENTS;
                            }
                            $html = "<iframe src='http://www.youtube.com/embed/{$videoID}?{$videoArgs}' width='{$videoWidth}' height='{$videoHeight}' style='width:{$videoWidth}px;height:{$videoHeight}px;'></iframe>";
                            break;
                        case "vimeo":
                            if (empty($videoArgs)) {
                                $videoArgs = GlobalsRevSlider::DEFAULT_VIMEO_ARGUMENTS;
                            }
                            $html = "<iframe src='http://player.vimeo.com/video/{$videoID}?{$videoArgs}' width='{$videoWidth}' height='{$videoHeight}' style='width:{$videoWidth}px;height:{$videoHeight}px;'></iframe>";
                            break;
                        case "html5":
                            $html = $this->getHtml5LayerHtml($videoData);
                            break;
                        default:
                            UniteFunctionsRev::throwError("wrong video type: {$videoType}");
                            break;
                    }
                    //set video autoplay, with backward compatability
                    if (array_key_exists("autoplay", $videoData)) {
                        $videoAutoplay = UniteFunctionsRev::getVal($videoData, "autoplay");
                    } else {
                        //backword compatability
                        $videoAutoplay = UniteFunctionsRev::getVal($layer, "video_autoplay");
                    }
                    $videoAutoplay = UniteFunctionsRev::strToBool($videoAutoplay);
                    if ($videoAutoplay == true) {
                        $htmlVideoAutoplay = ' data-autoplay="true"';
                    }
                    $videoNextSlide = UniteFunctionsRev::getVal($videoData, "nextslide");
                    $videoNextSlide = UniteFunctionsRev::strToBool($videoNextSlide);
                    if ($videoNextSlide == true) {
                        $htmlVideoNextSlide = ' data-nextslideatend="true"';
                    }
                    break;
            }
            //handle end transitions:
            $endTime = trim(UniteFunctionsRev::getVal($layer, "endtime"));
            $htmlEnd = "";
            if (!empty($endTime)) {
                $htmlEnd = "data-end=\"{$endTime}\"";
                $endSpeed = trim(UniteFunctionsRev::getVal($layer, "endspeed"));
                if (!empty($endSpeed)) {
                    $htmlEnd .= " data-endspeed=\"{$endSpeed}\"";
                }
                $endEasing = trim(UniteFunctionsRev::getVal($layer, "endeasing"));
                if (!empty($endSpeed) && $endEasing != "nothing") {
                    $htmlEnd .= " data-endeasing=\"{$endEasing}\"";
                }
                //add animation to class
                $endAnimation = trim(UniteFunctionsRev::getVal($layer, "endanimation"));
                if (!empty($endAnimation) && $endAnimation != "auto") {
                    $outputClass .= " " . $endAnimation;
                }
            }
            //slide link
            $htmlLink = "";
            $slideLink = UniteFunctionsRev::getVal($layer, "link_slide");
            if (!empty($slideLink) && $slideLink != "nothing" && $slideLink != "scroll_under") {
                //get slide index from id
                if (is_numeric($slideLink)) {
                    $slideLink = UniteFunctionsRev::getVal($this->slidesNumIndex, $slideLink);
                }
                if (!empty($slideLink)) {
                    $htmlLink = " data-linktoslide=\"{$slideLink}\"";
                }
            }
            //scroll under the slider
            if ($slideLink == "scroll_under") {
                $outputClass .= " tp-scrollbelowslider";
                $scrollUnderOffset = UniteFunctionsRev::getVal($layer, "scrollunder_offset");
                if (!empty($scrollUnderOffset)) {
                    $htmlLink .= " data-scrolloffset=\"{$scrollUnderOffset}\"";
                }
            }
            //hidden under resolution
            $htmlHidden = "";
            $layerHidden = UniteFunctionsRev::getVal($layer, "hiddenunder");
            if ($layerHidden == "true" || $layerHidden == "1") {
                $htmlHidden = ' data-captionhidden="on"';
            }
            $htmlParams = $htmlEnd . $htmlLink . $htmlVideoAutoplay . $htmlVideoNextSlide . $htmlHidden;
            //set positioning options
            $alignHor = UniteFunctionsRev::getVal($layer, "align_hor", "left");
            $alignVert = UniteFunctionsRev::getVal($layer, "align_vert", "top");
            $htmlPosX = "";
            $htmlPosY = "";
            switch ($alignHor) {
                default:
                case "left":
                    $htmlPosX = "data-x=\"{$left}\" \n";
                    break;
                case "center":
                    $htmlPosX = "data-x=\"center\" data-hoffset=\"{$left}\" \n";
                    break;
                case "right":
                    $left = (int) $left * -1;
                    $htmlPosX = "data-x=\"right\" data-hoffset=\"{$left}\" \n";
                    break;
            }
            switch ($alignVert) {
                default:
                case "top":
                    $htmlPosY = "data-y=\"{$top}\" ";
                    break;
                case "middle":
                    $htmlPosY = "data-y=\"center\" data-voffset=\"{$top}\" ";
                    break;
                case "bottom":
                    $top = (int) $top * -1;
                    $htmlPosY = "data-y=\"bottom\" data-voffset=\"{$top}\" ";
                    break;
            }
            //set corners
            $htmlCorners = "";
            if ($type == "text") {
                $cornerLeft = UniteFunctionsRev::getVal($layer, "corner_left");
                $cornerRight = UniteFunctionsRev::getVal($layer, "corner_right");
                switch ($cornerLeft) {
                    case "curved":
                        $htmlCorners .= "<div class='frontcorner'></div>";
                        break;
                    case "reverced":
                        $htmlCorners .= "<div class='frontcornertop'></div>";
                        break;
                }
                switch ($cornerRight) {
                    case "curved":
                        $htmlCorners .= "<div class='backcorner'></div>";
                        break;
                    case "reverced":
                        $htmlCorners .= "<div class='backcornertop'></div>";
                        break;
                }
                //add resizeme class
                $resizeme = UniteFunctionsRev::getVal($layer, "resizeme");
                if ($resizeme == "true" || $resizeme == "1") {
                    $outputClass .= ' tp-resizeme';
                }
            }
            //end text related layer
            //make some modifications for the full screen video
            if ($isFullWidthVideo == true) {
                $htmlPosX = "data-x=\"0\"" . "\n";
                $htmlPosY = "data-y=\"0\"" . "\n";
                $outputClass .= " fullscreenvideo";
            }
            ?>
				<div class="<?php 
            echo $outputClass;
            ?>
"
					 <?php 
            echo $htmlPosX;
            ?>
					 <?php 
            echo $htmlPosY;
            ?>
					 data-speed="<?php 
            echo $speed;
            ?>
" 
					 data-start="<?php 
            echo $time;
            ?>
" 
					 data-easing="<?php 
            echo $easing;
            ?>
" <?php 
            echo $htmlParams;
            ?>
 ><?php 
            echo $html;
            ?>
					 <?php 
            echo $htmlCorners;
            ?>
					 </div>
				
				<?php 
        }
    }