private function getThumbFilename() { $info = pathInfo($this->filename); //Add dirname as postfix (if exists) $postfix = ""; $dirname = UniteFunctionsBanner::getVal($info, "dirname"); if (!empty($dirname)) { $postfix = str_replace("/", "-", $dirname); } $ext = $info["extension"]; $name = $info["filename"]; $width = ceil($this->maxWidth); $height = ceil($this->maxHeight); $thumbFilename = $name . "_" . $width . "x" . $height; if (!empty($this->type)) { $thumbFilename .= "_" . $this->type; } if (!empty($this->effect)) { $thumbFilename .= "_e" . $this->effect; if (!empty($this->effect_arg1)) { $thumbFilename .= "x" . $this->effect_arg1; } } //Add postfix if (!empty($postfix)) { $thumbFilename .= "_" . $postfix; } $thumbFilename .= "." . $ext; return $thumbFilename; }
public static function onAddScripts() { $operations = new BannerOperations(); $arrValues = $operations->getGeneralSettingsValues(); $includesGlobally = UniteFunctionsBanner::getVal($arrValues, "includes_globally", "on"); $strPutIn = UniteFunctionsBanner::getVal($arrValues, "pages_for_includes"); $isPutIn = BannerRotatorOutput::isPutIn($strPutIn, true); //Put the includes only on pages with active widget or shortcode //If the put in match, then include them always (ignore this if) if ($isPutIn == false && $includesGlobally == "off") { $isWidgetActive = is_active_widget(false, false, "banner-rotator-widget", true); $hasShortcode = UniteFunctionsWPBanner::hasShortcode("banner_rotator"); if ($isWidgetActive == false && $hasShortcode == false) { return false; } } //Banner Rotator CSS settings self::addStyle("banner-rotator", "banner-rotator", "css"); self::addStyle("caption", "banner-rotator-caption", "css"); //jQuery $setBase = is_ssl() ? "https://" : "http://"; $url_jquery = $setBase . "ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js?app=banner-rotator"; self::addScriptAbsoluteUrl($url_jquery, "jquery"); //Banner Rotator JS self::addScript("jquery.flashblue-plugins", "js", "flashblue.plugins"); self::addScript("jquery.banner-rotator", "js"); }
function putBannerRotator($data, $putIn = "") { $operations = new BannerOperations(); $arrValues = $operations->getGeneralSettingsValues(); $includesGlobally = UniteFunctionsBanner::getVal($arrValues, "includes_globally", "on"); $strPutIn = UniteFunctionsBanner::getVal($arrValues, "pages_for_includes"); $isPutIn = BannerRotatorOutput::isPutIn($strPutIn, true); if ($isPutIn == false && $includesGlobally == "off") { $output = new BannerRotatorOutput(); $option1Name = "Include BannerRotator libraries globally (all pages/posts)"; $option2Name = "Pages to include BannerRotator libraries"; $output->putErrorMessage(__("If you want to use the PHP function \"putBannerRotator\" in your code please make sure to check \" ", BANNERROTATOR_TEXTDOMAIN) . $option1Name . __(" \" in the backend's \"General Settings\" (top right panel). <br> <br> Or add the current page to the \"", BANNERROTATOR_TEXTDOMAIN) . $option2Name . __("\" option box.")); return false; } BannerRotatorOutput::putSlider($data, $putIn); }
public function addSelect_filescan($name, $path, $arrExtensions, $defaultValue, $text, $arrParams = array()) { if (getType($arrExtensions) == "string") { $arrExtensions = array($arrExtensions); } elseif (getType($arrExtensions) != "array") { $this->throwError("The extensions array is not array and not string in setting: {$name}, please check."); } //Make items array if (!is_dir($path)) { $this->throwError("path: {$path} not found"); } $arrItems = array(); $files = scandir($path); foreach ($files as $file) { //General filter if ($file == ".." || $file == "." || $file == ".svn") { continue; } $info = pathinfo($file); $ext = UniteFunctionsBanner::getVal($info, "extension"); $ext = strtolower($ext); if (array_search($ext, $arrExtensions) === FALSE) { continue; } $arrItems[$file] = $file; } //Handle add data array if (isset($arrParams["addData"])) { foreach ($arrParams["addData"] as $key => $value) { $arrItems[$key] = $value; } } if (empty($defaultValue) && !empty($arrItems)) { $defaultValue = current($arrItems); } $this->addSelect($name, $arrItems, $text, $defaultValue, $arrParams); }
protected function drawSettingRow($setting) { //Set cellstyle $cellStyle = ""; if (isset($setting[UniteSettingsBanner::PARAM_CELLSTYLE])) { $cellStyle .= $setting[UniteSettingsBanner::PARAM_CELLSTYLE]; } //Set text style $textStyle = $cellStyle; if (isset($setting[UniteSettingsBanner::PARAM_TEXTSTYLE])) { $textStyle .= $setting[UniteSettingsBanner::PARAM_TEXTSTYLE]; } if ($textStyle != "") { $textStyle = "style='" . $textStyle . "'"; } if ($cellStyle != "") { $cellStyle = "style='" . $cellStyle . "'"; } //Set hidden $rowStyle = ""; if (isset($setting["hidden"])) { $rowStyle = "display:none;"; } if (!empty($rowStyle)) { $rowStyle = "style='{$rowStyle}'"; } //Set text class $class = ""; if (isset($setting["disabled"])) { $class = "class='disabled'"; } //Modify text $text = UniteFunctionsBanner::getVal($setting, "text", ""); //Prevent line break (convert spaces to nbsp) $text = str_replace(" ", " ", $text); switch ($setting["type"]) { case UniteSettingsBanner::TYPE_CHECKBOX: $text = "<label for='" . $setting["id"] . "' style='cursor:pointer;'>{$text}</label>"; break; } //Set settings text width $textWidth = ""; if (isset($setting["textWidth"])) { $textWidth = 'width="' . $setting["textWidth"] . '"'; } $description = UniteFunctionsBanner::getVal($setting, "description"); $required = UniteFunctionsBanner::getVal($setting, "required"); ?> <tr id="<?php echo $setting["id_row"]; ?> " <?php echo $rowStyle; ?> <?php echo $class; ?> valign="top"> <th <?php echo $textStyle; ?> scope="row" <?php echo $textWidth; ?> > <?php echo $text; ?> : </th> <td <?php echo $cellStyle; ?> > <?php $this->drawInputs($setting); ?> <?php if (!empty($required)) { ?> <span class='setting_required'>*</span> <?php } ?> <div class="description_container"> <?php if (!empty($description)) { ?> <span class="description"><?php echo $description; ?> </span> <?php } ?> </div> </td> <td class="description_container_in_td"> <?php if (!empty($description)) { ?> <span class="description"><?php echo $description; ?> </span> <?php } ?> </td> </tr> <?php }
public static function onAjaxAction() { $slider = new BannerRotator(); $slide = new BannerSlide(); $operations = new BannerOperations(); $action = self::getPostGetVar("client_action"); $data = self::getPostGetVar("data"); $nonce = self::getPostGetVar("nonce"); try { //Verify the nonce $isVerified = wp_verify_nonce($nonce, "bannerrotator_actions"); if ($isVerified == false) { UniteFunctionsBanner::throwError("Wrong request"); } switch ($action) { case "export_slider": $sliderID = self::getGetVar("sliderid"); $dummy = self::getGetVar("dummy"); $slider->initByID($sliderID); $slider->exportSlider($dummy); break; case "import_slider": self::importSliderHandle(); break; case "import_slider_slidersview": $viewBack = self::getViewUrl(self::VIEW_SLIDERS); self::importSliderHandle($viewBack); break; case "create_slider": $newSliderID = $slider->createSliderFromOptions($data); self::ajaxResponseSuccessRedirect(__("The slider successfully created", BANNERROTATOR_TEXTDOMAIN), self::getViewUrl("sliders")); break; case "update_slider": $slider->updateSliderFromOptions($data); self::ajaxResponseSuccess(__("Slider updated", BANNERROTATOR_TEXTDOMAIN)); break; case "delete_slider": $slider->deleteSliderFromData($data); self::ajaxResponseSuccessRedirect(__("The slider deleted", BANNERROTATOR_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS)); break; case "duplicate_slider": $slider->duplicateSliderFromData($data); self::ajaxResponseSuccessRedirect(__("The duplicate successfully, refreshing page...", BANNERROTATOR_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDERS)); break; case "add_slide": $numSlides = $slider->createSlideFromData($data); $sliderID = $data["sliderid"]; if ($numSlides == 1) { $responseText = __("Slide Created", BANNERROTATOR_TEXTDOMAIN); } else { $responseText = $numSlides . " " . __("Slides Created", BANNERROTATOR_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...", BANNERROTATOR_TEXTDOMAIN); self::ajaxResponseSuccessRedirect($responseText, $urlRedirect); break; case "update_slide": $slide->updateSlideFromData($data); self::ajaxResponseSuccess(__("Slide updated", BANNERROTATOR_TEXTDOMAIN)); break; case "delete_slide": $slide->deleteSlideFromData($data); $sliderID = UniteFunctionsBanner::getVal($data, "sliderID"); self::ajaxResponseSuccessRedirect(__("Slide Deleted Successfully", BANNERROTATOR_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}")); break; case "duplicate_slide": $sliderID = $slider->duplicateSlideFromData($data); self::ajaxResponseSuccessRedirect(__("Slide Duplicated Successfully", BANNERROTATOR_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}")); break; case "copy_move_slide": $sliderID = $slider->copyMoveSlideFromData($data); self::ajaxResponseSuccessRedirect(__("The operation successfully, refreshing page...", BANNERROTATOR_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}")); break; case "get_captions_css": $contentCSS = $operations->getCaptionsContent(); self::ajaxResponseData($contentCSS); break; case "update_captions_css": $arrCaptions = $operations->updateCaptionsContentData($data); self::ajaxResponseSuccess(__("CSS file saved succesfully!", BANNERROTATOR_TEXTDOMAIN), array("arrCaptions" => $arrCaptions)); break; case "restore_captions_css": $operations->restoreCaptionsCss(); $contentCSS = $operations->getCaptionsContent(); self::ajaxResponseData($contentCSS); break; case "update_slides_order": $slider->updateSlidesOrderFromData($data); self::ajaxResponseSuccess(__("Order updated successfully", BANNERROTATOR_TEXTDOMAIN)); break; case "change_slide_image": $slide->updateSlideImageFromData($data); $sliderID = UniteFunctionsBanner::getVal($data, "slider_id"); self::ajaxResponseSuccessRedirect(__("Slide Changed Successfully", BANNERROTATOR_TEXTDOMAIN), self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}")); break; case "preview_slide": $operations->putSlidePreviewByData($data); break; case "preview_slider": $sliderID = UniteFunctionsBanner::getPostVariable("sliderid"); $operations->previewOutput($sliderID); break; case "toggle_slide_state": $currentState = $slide->toggleSlideStateFromData($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"); break; case "update_general_settings": $operations->updateGeneralSettings($data); self::ajaxResponseSuccess(__("General settings updated")); break; default: self::ajaxResponseError("wrong ajax action: {$action} "); break; } } catch (Exception $e) { $message = $e->getMessage(); 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; }
protected function drawSettingRow($setting) { //Set cellstyle $cellStyle = ""; if (isset($setting[UniteSettingsBanner::PARAM_CELLSTYLE])) { $cellStyle .= $setting[UniteSettingsBanner::PARAM_CELLSTYLE]; } //Set text style $textStyle = $cellStyle; if (isset($setting[UniteSettingsBanner::PARAM_TEXTSTYLE])) { $textStyle .= $setting[UniteSettingsBanner::PARAM_TEXTSTYLE]; } if ($textStyle != "") { $textStyle = "style='" . $textStyle . "'"; } if ($cellStyle != "") { $cellStyle = "style='" . $cellStyle . "'"; } //Set hidden $rowStyle = ""; if (isset($setting["hidden"]) && $setting["hidden"] == true) { $rowStyle = "display:none;"; } if (!empty($rowStyle)) { $rowStyle = "style='{$rowStyle}'"; } //Set row class $rowClass = ""; if (isset($setting["disabled"])) { $rowClass = "class='disabled'"; } //Modify text $text = UniteFunctionsBanner::getVal($setting, "text", ""); $text = __($text, BANNERROTATOR_TEXTDOMAIN); //Prevent line break (convert spaces to nbsp) $text = str_replace(" ", " ", $text); if ($setting["type"] == UniteSettingsBanner::TYPE_CHECKBOX) { $text = "<label for='{$setting["id"]}'>{$text}</label>"; } //Set settings text width: $textWidth = ""; if (isset($setting["textWidth"])) { $textWidth = 'width="' . $setting["textWidth"] . '"'; } $description = UniteFunctionsBanner::getVal($setting, "description"); $description = __($description, BANNERROTATOR_TEXTDOMAIN); $unit = UniteFunctionsBanner::getVal($setting, "unit"); $unit = __($unit, BANNERROTATOR_TEXTDOMAIN); $required = UniteFunctionsBanner::getVal($setting, "required"); $addHtml = UniteFunctionsBanner::getVal($setting, UniteSettingsBanner::PARAM_ADDTEXT); $addHtmlBefore = UniteFunctionsBanner::getVal($setting, UniteSettingsBanner::PARAM_ADDTEXT_BEFORE_ELEMENT); //Set if draw text or not. $toDrawText = true; if ($setting["type"] == UniteSettingsBanner::TYPE_BUTTON) { $toDrawText = false; } $settingID = $setting["id"]; $attribsText = UniteFunctionsBanner::getVal($setting, "attrib_text"); ?> <li id="<?php echo $settingID; ?> _row" <?php echo $rowStyle . " " . $rowClass; ?> > <?php if ($toDrawText == true) { ?> <span id="<?php echo $settingID; ?> _text" class='setting_text' title="<?php echo $description; ?> " <?php echo $attribsText; ?> ><?php echo $text; ?> </span> <?php } ?> <?php if (!empty($addHtmlBefore)) { ?> <span class="settings_addhtmlbefore"><?php echo $addHtmlBefore; ?> </span> <?php } ?> <span class='setting_input'> <?php $this->drawInputs($setting); ?> </span> <?php if (!empty($unit)) { ?> <span class='setting_unit'><?php echo $unit; ?> </span> <?php } ?> <?php if (!empty($required)) { ?> <span class='setting_required'>*</span> <?php } ?> <?php if (!empty($addHtml)) { ?> <span class="settings_addhtml"><?php echo $addHtml; ?> </span> <?php } ?> <div class="clear"></div> </li> <?php }
public function widget($args, $instance) { $sliderID = UniteFunctionsBanner::getVal($instance, "banner_rotator"); $homepageCheck = UniteFunctionsBanner::getVal($instance, "banner_rotator_homepage"); $homepage = ""; if ($homepageCheck == "on") { $homepage = "homepage"; } $pages = UniteFunctionsBanner::getVal($instance, "banner_rotator_pages"); if (!empty($pages)) { if (!empty($homepage)) { $homepage .= ","; } $homepage .= $pages; } if (empty($sliderID)) { return false; } BannerRotatorOutput::putSlider($sliderID, $homepage); }
public function doSlideLangOperation($data) { $operation = UniteFunctionsBanner::getVal($data, "operation"); switch ($operation) { case "add": $response = $this->addLangFromData($data); break; case "delete": $response = $this->deleteSlideFromLangData($data); break; case "update": default: $response = $this->updateLangFromData($data); break; } return $response; }
protected function drawCustomInputs($setting) { $customType = UniteFunctionsBanner::getVal($setting, "custom_type"); switch ($customType) { case "sliderSize": $this->drawSliderSize($setting); break; case "responsitiveSettings": $this->drawResponsitiveSettings($setting); break; default: UniteFunctionsBanner::throwError("No handler function for type: {$customType}"); break; } }
protected static function updatePlugin($viewBack = false) { $linkBack = self::getViewUrl($viewBack); $htmlLinkBack = UniteFunctionsBanner::getHtmlLink($linkBack, "Go Back"); $zip = new UniteZipBanner(); try { if (function_exists("unzip_file") == false) { if (UniteZipBanner::isZipExists() == false) { UniteFunctionsBanner::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 = UniteFunctionsBanner::getVal($_FILES, "update_file"); if (empty($arrFiles)) { UniteFunctionsBanner::throwError("Update file don't found."); } $filename = UniteFunctionsBanner::getVal($arrFiles, "name"); if (empty($filename)) { UniteFunctionsBanner::throwError("Update filename not found."); } $fileType = UniteFunctionsBanner::getVal($arrFiles, "type"); /* $fileType = strtolower($fileType); if($fileType != "application/zip") UniteFunctionsBanner::throwError("The file uploaded is not zip."); */ $filepathTemp = UniteFunctionsBanner::getVal($arrFiles, "tmp_name"); if (file_exists($filepathTemp) == false) { UniteFunctionsBanner::throwError("Can't find the uploaded file."); } //Crate temp folder UniteFunctionsBanner::checkCreateDir(self::$path_temp); //Create the update folder $pathUpdate = self::$path_temp . "update_extract/"; UniteFunctionsBanner::checkCreateDir($pathUpdate); //Remove all files in the update folder if (is_dir($pathUpdate)) { $arrNotDeleted = UniteFunctionsBanner::deleteDir($pathUpdate, false); if (!empty($arrNotDeleted)) { $strNotDeleted = print_r($arrNotDeleted, true); UniteFunctionsBanner::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) { UniteFunctionsBanner::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 = UniteFunctionsBanner::getFoldersList($pathUpdate); if (empty($arrFolders)) { UniteFunctionsBanner::throwError("The update folder is not extracted"); } if (count($arrFolders) > 1) { UniteFunctionsBanner::throwError("Extracted folders are more then 1. Please check the update file."); } //Get product folder $productFolder = $arrFolders[0]; if (empty($productFolder)) { UniteFunctionsBanner::throwError("Wrong product folder."); } if ($productFolder != self::$dir_plugin) { UniteFunctionsBanner::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) { UniteFunctionsBanner::throwError("Wrong update extracted folder. The file: {$checkFilepath} not found."); } //Copy the plugin without the captions file $pathOriginalPlugin = self::$path_plugin; $arrBlackList = array(); $arrBlackList[] = "css/caption.css"; UniteFunctionsBanner::copyDir($pathUpdateProduct, $pathOriginalPlugin, "", $arrBlackList); //Delete the update UniteFunctionsBanner::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; } }
public static function getFileList($path, $ext = "") { $dir = scandir($path); $arrFiles = array(); foreach ($dir as $file) { if ($file == "." || $file == "..") { continue; } if (!empty($ext)) { $info = pathinfo($file); $extension = UniteFunctionsBanner::getVal($info, "extension"); if ($ext != strtolower($extension)) { continue; } } $filepath = $path . "/" . $file; if (is_file($filepath)) { $arrFiles[] = $file; } } return $arrFiles; }
public static function getAttachmentImage($thumbID, $size = self::THUMB_FULL) { $arrImage = wp_get_attachment_image_src($thumbID, $size); if (empty($arrImage)) { return false; } $output = array(); $output["url"] = UniteFunctionsBanner::getVal($arrImage, 0); $output["width"] = UniteFunctionsBanner::getVal($arrImage, 1); $output["height"] = UniteFunctionsBanner::getVal($arrImage, 2); return $output; }
$imageUrl = $slide->getImageUrl(); $imageID = $slide->getImageID(); $imageFilename = $slide->getImageFilename(); $urlCaptionsCSS = GlobalsBannerRotator::$urlCaptionsCSS; $style = "width:{$width}px;height:{$height}px;"; //Set iframe parameters $iframeWidth = $width + 60; $iframeHeight = $height + 50; $iframeStyle = "width:{$iframeWidth}px;height:{$iframeHeight}px;"; $closeUrl = self::getViewUrl(BannerRotatorAdmin::VIEW_SLIDES, "id=" . $sliderID); $jsonLayers = UniteFunctionsBanner::jsonEncodeForClientSide($arrLayers); $jsonCaptions = UniteFunctionsBanner::jsonEncodeForClientSide($arrCaptionClasses); $loadGoogleFont = $slider->getParam("loadGoogleFont", "false"); //Bg type params $bgType = UniteFunctionsBanner::getVal($slideParams, "background_type", "image"); $slideBGColor = UniteFunctionsBanner::getVal($slideParams, "slide_bg_color", "#E7E7E7"); $divLayersClass = "slide_layers"; $bgSolidPickerProps = 'class="inputColorPicker slide_bg_color disabled" disabled="disabled"'; switch ($bgType) { case "trans": $divLayersClass = "slide_layers trans_bg"; break; case "solid": $style .= "background-color:{$slideBGColor};"; $bgSolidPickerProps = 'class="inputColorPicker slide_bg_color" style="background-color:' . $slideBGColor . '"'; break; case "image": $style .= "background-image:url('{$imageUrl}');"; break; } $slideTitle = $slide->getParam("title", "Slide");
private function putCreativeLayer(BannerSlide $slide) { $layers = $slide->getLayers(); if (empty($layers)) { return false; } ?> <?php foreach ($layers as $layer) { $type = UniteFunctionsBanner::getVal($layer, "type", "text"); //Set if video full screen $isFullWidthVideo = false; if ($type == "video") { $videoData = UniteFunctionsBanner::getVal($layer, "video_data"); if (!empty($videoData)) { $videoData = (array) $videoData; $isFullWidthVideo = UniteFunctionsBanner::getVal($videoData, "fullwidth"); $isFullWidthVideo = UniteFunctionsBanner::strToBool($isFullWidthVideo); } else { $videoData = array(); } } $class = UniteFunctionsBanner::getVal($layer, "style"); $animation = UniteFunctionsBanner::getVal($layer, "animation", "fade"); //Set output class $outputClass = "caption " . trim($class); $outputClass = trim($outputClass) . " "; $outputClass .= trim($animation); $left = UniteFunctionsBanner::getVal($layer, "left", 0); $top = UniteFunctionsBanner::getVal($layer, "top", 0); $speed = UniteFunctionsBanner::getVal($layer, "speed", 300); $time = UniteFunctionsBanner::getVal($layer, "time", 0); $easing = UniteFunctionsBanner::getVal($layer, "easing", "easeOutExpo"); $randomRotate = UniteFunctionsBanner::getVal($layer, "random_rotation", "false"); $randomRotate = UniteFunctionsBanner::boolToStr($randomRotate); $text = UniteFunctionsBanner::getVal($layer, "text"); $htmlVideoAutoplay = ""; $htmlVideoNextSlide = ""; //Set html $html = ""; switch ($type) { default: case "text": $html = $text; $html = do_shortcode($html); break; case "image": $urlImage = UniteFunctionsBanner::getVal($layer, "image_url"); $html = '<img src="' . $urlImage . '" alt="' . $text . '">'; $imageLink = UniteFunctionsBanner::getVal($layer, "link", ""); if (!empty($imageLink)) { $openIn = UniteFunctionsBanner::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(UniteFunctionsBanner::getVal($layer, "video_type")); $videoID = trim(UniteFunctionsBanner::getVal($layer, "video_id")); $videoWidth = trim(UniteFunctionsBanner::getVal($layer, "video_width")); $videoHeight = trim(UniteFunctionsBanner::getVal($layer, "video_height")); $videoArgs = trim(UniteFunctionsBanner::getVal($layer, "video_args")); if ($isFullWidthVideo == true) { $videoWidth = "100%"; $videoHeight = "100%"; } $setBase = is_ssl() ? "https://" : "http://"; switch ($videoType) { case "youtube": if (empty($videoArgs)) { $videoArgs = GlobalsBannerRotator::DEFAULT_YOUTUBE_ARGUMENTS; } $videoArgs .= ';origin=' . $setBase . $_SERVER['SERVER_NAME'] . ';'; $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 = GlobalsBannerRotator::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: UniteFunctionsBanner::throwError("wrong video type: {$videoType}"); break; } //Set video autoplay, with backward compatability if (array_key_exists("autoplay", $videoData)) { $videoAutoplay = UniteFunctionsBanner::getVal($videoData, "autoplay"); } else { //Backward compatability $videoAutoplay = UniteFunctionsBanner::getVal($layer, "video_autoplay"); } $videoAutoplay = UniteFunctionsBanner::strToBool($videoAutoplay); if ($videoAutoplay == true) { $htmlVideoAutoplay = ' data-autoplay="true"'; } $videoNextSlide = UniteFunctionsBanner::getVal($videoData, "nextslide"); $videoNextSlide = UniteFunctionsBanner::strToBool($videoNextSlide); if ($videoNextSlide == true) { $htmlVideoNextSlide = ' data-nextslideatend="true"'; } break; } //Handle end transitions $endTime = trim(UniteFunctionsBanner::getVal($layer, "endtime")); $htmlEnd = ""; if (!empty($endTime)) { $htmlEnd = "data-end=\"{$endTime}\""; $endSpeed = trim(UniteFunctionsBanner::getVal($layer, "endspeed")); if (!empty($endSpeed)) { $htmlEnd .= " data-endspeed=\"{$endSpeed}\""; } $endEasing = trim(UniteFunctionsBanner::getVal($layer, "endeasing")); if (!empty($endSpeed) && $endEasing != "nothing") { $htmlEnd .= " data-endeasing=\"{$endEasing}\""; } //Add animation to class $endAnimation = trim(UniteFunctionsBanner::getVal($layer, "endanimation")); if (!empty($endAnimation) && $endAnimation != "auto") { $outputClass .= " " . $endAnimation; } } //Slide link $htmlLink = ""; $slideLink = UniteFunctionsBanner::getVal($layer, "link_slide"); if (!empty($slideLink) && $slideLink != "nothing" && $slideLink != "scroll_under") { //Get slide index from id if (is_numeric($slideLink)) { $slideLink = UniteFunctionsBanner::getVal($this->slidesNumIndex, $slideLink); } if (!empty($slideLink)) { $htmlLink = " data-linktoslide=\"{$slideLink}\""; } } //Scroll under the slider if ($slideLink == "scroll_under") { $outputClass .= " fb-scrollbelowslider"; $scrollUnderOffset = UniteFunctionsBanner::getVal($layer, "scrollunder_offset"); if (!empty($scrollUnderOffset)) { $htmlLink .= " data-scrolloffset=\"{$scrollUnderOffset}\""; } } //Hidden under resolution $htmlHidden = ""; $layerHidden = UniteFunctionsBanner::getVal($layer, "hiddenunder"); if ($layerHidden == "true" || $layerHidden == "1") { $htmlHidden = ' data-captionhidden="on"'; } $htmlParams = $htmlEnd . $htmlLink . $htmlVideoAutoplay . $htmlVideoNextSlide . $htmlHidden; //Set positioning options $alignHor = UniteFunctionsBanner::getVal($layer, "align_hor", "left"); $alignVert = UniteFunctionsBanner::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 = UniteFunctionsBanner::getVal($layer, "corner_left"); $cornerRight = UniteFunctionsBanner::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 = UniteFunctionsBanner::getVal($layer, "resizeme"); if ($resizeme == "true" || $resizeme == "1") { $outputClass .= ' fb-resizeme'; } } //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 } }
private function getParamsForExport() { $exportParams = $this->arrParams; //Modify background image $urlImage = UniteFunctionsBanner::getVal($exportParams, "backgroundImage"); if (!empty($urlImage)) { $exportParams["backgroundImage"] = $urlImage; } return $exportParams; }
public function setStoredValues($arrValues) { foreach ($this->arrSettings as $key => $setting) { $name = UniteFunctionsBanner::getVal($setting, "name"); //Type consolidation $type = UniteFunctionsBanner::getVal($setting, "type"); $customType = UniteFunctionsBanner::getVal($setting, "custom_type"); if (!empty($customType)) { $type .= "." . $customType; } switch ($type) { case "custom.kenburns_position": $name = $setting["name"]; if (array_key_exists($name . "_hor", $arrValues)) { $value_vert = UniteFunctionsBanner::getVal($arrValues, $name . "_vert", "random"); $value_hor = UniteFunctionsBanner::getVal($arrValues, $name . "_hor", "random"); $this->arrSettings[$key]["value"] = "{$value_vert},{$value_hor}"; } break; default: if (array_key_exists($name, $arrValues)) { $this->arrSettings[$key]["value"] = $arrValues[$name]; } break; } } }