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"); }
public function update($table, $arrItems, $where) { $response = $this->wpdb->update($table, $arrItems, $where); if ($response === false) { UniteFunctionsBanner::throwError("no update action taken!"); } $this->checkForErrors("Update query error"); return $this->wpdb->num_rows; }
public function getFieldFromDB($name) { $arr = $this->db->fetch(GlobalsBannerRotator::$table_settings); if (empty($arr)) { return ""; } $arr = $arr[0]; if (array_key_exists($name, $arr) == false) { UniteFunctionsBanner::throwError("The settings db should cotnain field: {$name}"); } $value = $arr[$name]; return $value; }
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); }
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; }
public function draw($formID = null) { if (empty($formID)) { UniteFunctionsBanner::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(); } }
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; } } }
?> </th> </tr> </thead> <tbody> <?php foreach ($arrSliders as $slider) { $id = $slider->getID(); $showTitle = $slider->getShowTitle(); $title = $slider->getTitle(); $alias = $slider->getAlias(); $shortCode = $slider->getShortcode(); $numSlides = $slider->getNumSlides(); $editLink = self::getViewUrl(BannerRotatorAdmin::VIEW_SLIDER, "id={$id}"); $editSlidesLink = self::getViewUrl(BannerRotatorAdmin::VIEW_SLIDES, "id={$id}"); $showTitle = UniteFunctionsBanner::getHtmlLink($editLink, $showTitle); ?> <tr> <td><?php echo $id; ?> <span id="slider_title_<?php echo $id; ?> " class="hidden"><?php echo $title; ?> </span></td> <td><?php echo $showTitle; ?>
private function outputImageForDownload($filepath, $filename, $mimeType = "") { $contents = file_get_contents($filepath); $filesize = strlen($contents); if ($mimeType == "") { $info = UniteFunctionsBanner::getPathInfo($filepath); $ext = $info["extension"]; $mimeType = "image/{$ext}"; } header("Content-Type: {$mimeType}"); header("Content-Disposition: attachment; filename=\"{$filename}\""); header("Content-Length: {$filesize}"); echo $contents; exit; }
$operations = new BannerOperations(); //Set Layer settings $contentCSS = $operations->getCaptionsContent(); $arrAnimations = $operations->getArrAnimations(); $arrEndAnimations = $operations->getArrEndAnimations(); $htmlButtonDown = '<div id="layer_captions_down" class="ui-state-default ui-corner-all"><span class="ui-icon ui-icon-arrowthick-1-s"></span></div>'; $buttonEditStyles = UniteFunctionsBanner::getHtmlLink("javascript:void(0)", "<i class='icon-magic'></i>Edit CSS File", "button_edit_css", "button-primary btn-blue"); $arrEasing = $operations->getArrEasing(); $arrEndEasing = $operations->getArrEndEasing(); $captionsAddonHtml = $htmlButtonDown . $buttonEditStyles; //Set Layer settings $layerSettings = new UniteSettingsAdvancedBanner(); $layerSettings->addSection(__("Layer Params", BANNERROTATOR_TEXTDOMAIN), __("layer_params", BANNERROTATOR_TEXTDOMAIN)); $layerSettings->addSap(__("Layer Params", BANNERROTATOR_TEXTDOMAIN), __("layer_params")); $layerSettings->addTextBox(__("layer_caption"), __("caption_green"), __("Style", BANNERROTATOR_TEXTDOMAIN), array(UniteSettingsBanner::PARAM_ADDTEXT => $captionsAddonHtml, "class" => "textbox-caption")); $addHtmlTextarea = UniteFunctionsBanner::getHtmlLink("javascript:void(0)", "insert button", "linkInsertButton", "disabled"); $layerSettings->addTextArea("layer_text", "", __("Text / Html", BANNERROTATOR_TEXTDOMAIN), array("class" => "area-layer-params", UniteSettingsBanner::PARAM_ADDTEXT_BEFORE_ELEMENT => $addHtmlTextarea)); $layerSettings->addTextBox("layer_image_link", "", __("Image Link", BANNERROTATOR_TEXTDOMAIN), array("class" => "text-sidebar-link", "hidden" => true)); $layerSettings->addSelect("layer_link_open_in", array("same" => __("Same Window", BANNERROTATOR_TEXTDOMAIN), "new" => __("New Window", BANNERROTATOR_TEXTDOMAIN)), __("Link Open In", BANNERROTATOR_TEXTDOMAIN), "same", array("hidden" => true)); $layerSettings->addSelect("layer_animation", $arrAnimations, __("Animation", BANNERROTATOR_TEXTDOMAIN), "fade"); $layerSettings->addSelect("layer_easing", $arrEasing, __("Easing", BANNERROTATOR_TEXTDOMAIN), "easeOutExpo"); $params = array("unit" => __("ms", BANNERROTATOR_TEXTDOMAIN)); $layerSettings->addTextBox("layer_speed", "", "Speed", $params); $layerSettings->addCheckbox("layer_hidden", false, __("Hide Under Width", BANNERROTATOR_TEXTDOMAIN)); //Put left top $textOffsetX = __("OffsetX", BANNERROTATOR_TEXTDOMAIN); $textX = __("X", BANNERROTATOR_TEXTDOMAIN); $params = array("attrib_text" => "data-textoffset='{$textOffsetX}' data-textnormal='{$textX}'"); $layerSettings->addTextBox("layer_left", "", __("X", BANNERROTATOR_TEXTDOMAIN), $params); $textOffsetY = __("OffsetY", BANNERROTATOR_TEXTDOMAIN); $textY = __("Y", BANNERROTATOR_TEXTDOMAIN);
public function putSlidePreviewByData($data) { if ($data == "empty_output") { $this->loadingMessageOutput(); exit; } $data = UniteFunctionsBanner::jsonDecodeFromClientSide($data); $slideID = $data["slideid"]; $slide = new BannerSlide(); $slide->initByID($slideID); $sliderID = $slide->getSliderID(); $output = new BannerRotatorOutput(); $output->setOneSlideMode($data); $this->previewOutput($sliderID, $output); }
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; }
<?php $sliderID = self::getGetVar("id"); if (empty($sliderID)) { UniteFunctionsBanner::throwError("Slider ID not found"); } $slider = new BannerRotator(); $slider->initByID($sliderID); $sliderParams = $slider->getParams(); $arrSliders = $slider->getArrSlidersShort($sliderID); $selectSliders = UniteFunctionsBanner::getHTMLSelect($arrSliders, "", "id='selectSliders'", true); $numSliders = count($arrSliders); //Set iframe parameters $width = $sliderParams["width"]; $height = $sliderParams["height"]; $iframeWidth = $width + 60; $iframeHeight = $height + 50; $iframeStyle = "width:{$iframeWidth}px;height:{$iframeHeight}px;"; //Handle wpml $isWpmlExists = UniteWpmlBanner::isWpmlExists(); $useWpml = $slider->getParam("useWpml", "false"); $wpmlActive = false; if ($isWpmlExists && $useWpml == "true") { $wpmlActive = true; //Get langs floating menu $urlIconDelete = self::$url_plugin . "images/icon-trash.png"; $urlIconEdit = self::$url_plugin . "images/icon-edit.png"; $urlIconPreview = self::$url_plugin . "images/preview.png"; $textDelete = __("Delete Slide", BANNERROTATOR_TEXTDOMAIN); $textEdit = __("Edit Slide", BANNERROTATOR_TEXTDOMAIN); $textPreview = __("Preview Slide", BANNERROTATOR_TEXTDOMAIN);
$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");
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; }
public function draw($formID = null, $drawForm = false) { if (empty($formID)) { UniteFunctionsBanner::throwError("The form ID can't be empty. you must provide it"); } $this->formID = $formID; ?> <div class="settings_wrapper unite_settings_wide"> <?php if ($drawForm == true) { ?> <form name="<?php echo $formID; ?> " id="<?php echo $formID; ?> "> <?php $this->drawSettings(); ?> </form> <?php } else { $this->drawSettings(); } ?> </div> <?php }
public static function trimArrayItems($arr) { if (gettype($arr) != "array") { UniteFunctionsBanner::throwError("trimArrayItems error: The type must be array"); } foreach ($arr as $key => $item) { $arr[$key] = trim($item); } return $arr; }
protected static function updateSettingsText() { $filelist = UniteFunctionsBanner::getFileList(self::$path_settings, "xml"); foreach ($filelist as $file) { $filepath = self::$path_settings . $file; UniteFunctionsWPBanner::writeSettingLanguageFile($filepath); } }
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; } }
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; } }
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 } }
</span> <span class="slide-col col-handle"> <div class="col-handle-inside"> <span class="ui-icon ui-icon-arrowthick-2-n-s"></span> </div> </span> <div class="clear"></div> <?php if ($showLangs == true) { ?> <ul class="list_slide_icons"> <?php foreach ($arrChildLangs as $arrLang) { $isParent = UniteFunctionsBanner::boolToStr($arrLang["isparent"]); $childSlideID = $arrLang["slideid"]; $lang = $arrLang["lang"]; $urlFlag = UniteWpmlBanner::getFlagUrl($lang); $langTitle = UniteWpmlBanner::getLangTitle($lang); ?> <li> <img id="icon_lang_<?php echo $childSlideID; ?> " class="icon_slide_lang" src="<?php echo $urlFlag; ?> " title="<?php echo $langTitle; ?>
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); }
private function getParamsForExport() { $exportParams = $this->arrParams; //Modify background image $urlImage = UniteFunctionsBanner::getVal($exportParams, "backgroundImage"); if (!empty($urlImage)) { $exportParams["backgroundImage"] = $urlImage; } return $exportParams; }
private static function validateWpmlExists() { if (!self::isWpmlExists()) { UniteFunctionsBanner::throwError("The wpml plugin doesn't exist"); } }