public function putSliderBase($sliderID) { try { self::$sliderSerial++; $this->slider = new BannerRotator(); $this->slider->initByMixed($sliderID); //Modify settings for admin preview mode if ($this->previewMode == true) { $this->modifyPreviewModeSettings(); } //Set slider language $isWpmlExists = UniteWpmlBanner::isWpmlExists(); $useWpml = $this->slider->getParam("useWpml", "false"); if ($isWpmlExists && $useWpml == "true") { if ($this->previewMode == false) { $this->sliderLang = UniteFunctionsWPBanner::getCurrentLangCode(); } } //Edit html before slider $htmlBeforeSlider = ""; if ($this->slider->getParam("loadGoogleFont", "false") == "true") { $googleFont = $this->slider->getParam("googleFont"); $htmlBeforeSlider = BannerOperations::getCleanFontImport($googleFont); } //Put js to body handle if ($this->slider->getParam("js_to_body", "false") == "true") { $urlIncludeJS1 = UniteBaseClassBanner::$url_plugin . "js/jquery.flashblue-plugins.js"; $urlIncludeJS2 = UniteBaseClassBanner::$url_plugin . "js/jquery.banner-rotator.js"; $htmlBeforeSlider .= "<script type='text/javascript' src='../inc_php/{$urlIncludeJS1}'></script>"; $htmlBeforeSlider .= "<script type='text/javascript' src='../inc_php/{$urlIncludeJS2}'></script>"; } //The initial id can be alias $sliderID = $this->slider->getID(); $bannerWidth = $this->slider->getParam("width", null, BannerRotator::VALIDATE_NUMERIC, "Slider Width"); $bannerHeight = $this->slider->getParam("height", null, BannerRotator::VALIDATE_NUMERIC, "Slider Height"); $sliderType = $this->slider->getParam("sliderType"); //Slider id $this->sliderHtmlID = "banner_rotator_" . $sliderID . "_" . self::$sliderSerial; //Slider wrapper $this->sliderHtmlID_wrapper = $this->sliderHtmlID . "_wrapper"; $containerStyle = ""; $sliderPosition = $this->slider->getParam("position", "center"); //Set position if ($sliderType != "fullscreen") { switch ($sliderPosition) { case "center": default: $containerStyle .= "margin:0px auto;"; break; case "left": $containerStyle .= "float:left;"; break; case "right": $containerStyle .= "float:right;"; break; } } //Add background color $backgrondColor = trim($this->slider->getParam("backgroundColor")); if (!empty($backgrondColor)) { $containerStyle .= "background-color:{$backgrondColor};"; } //Set padding //$containerStyle .= "padding:".$this->slider->getParam("padding","0")."px;"; //Set margin if ($sliderType != "fullscreen") { if ($sliderPosition != "center") { $containerStyle .= "margin-left:" . $this->slider->getParam("marginLeft", "0") . "px;" . "margin-right:" . $this->slider->getParam("marginRight", "0") . "px;"; } $containerStyle .= "margin-top:" . $this->slider->getParam("marginTop", "0") . "px;" . "margin-bottom:" . $this->slider->getParam("marginBottom", "0") . "px;"; } //Set height and width $bannerStyle = "display:none;"; //Add background image (to banner style) $showBackgroundImage = $this->slider->getParam("showBackgroundImage", "false"); if ($showBackgroundImage == "true") { $backgroundImage = $this->slider->getParam("backgroundImage"); if (!empty($backgroundImage)) { $bannerStyle .= "background-image:url({$backgroundImage});background-repeat:no-repeat;"; } } //Set wrapper and slider class $sliderWrapperClass = "banner-rotator-wrapper"; $sliderClass = "banner-rotator"; $putResponsiveStyles = false; switch ($sliderType) { default: case "fixed": $bannerStyle .= "height:{$bannerHeight}px;width:{$bannerWidth}px;"; $containerStyle .= "height:{$bannerHeight}px;width:{$bannerWidth}px;"; break; case "responsitive": $putResponsiveStyles = true; break; case "fullwidth": $sliderWrapperClass .= " fullwidthbanner-container"; $sliderClass .= " fullwidthbanner"; $bannerStyle .= "max-height:{$bannerHeight}px;height:{$bannerHeight};"; $containerStyle .= "max-height:{$bannerHeight}px;"; break; case "fullscreen": $sliderWrapperClass .= " fullscreen-container"; $sliderClass .= " fullscreenbanner"; break; } //Check inner / outer border $paddingType = $this->slider->getParam("padding_type", "outter"); if ($paddingType == "inner") { $sliderWrapperClass .= " tp_inner_padding"; } global $bannerRotatorVersion; ?> <!-- START BANNER ROTATOR <?php echo $bannerRotatorVersion; ?> <?php echo $sliderType; ?> mode --> <?php if ($putResponsiveStyles == true) { $this->putResponsitiveStyles(); } ?> <?php echo $htmlBeforeSlider; ?> <div id="<?php echo $this->sliderHtmlID_wrapper; ?> " class="<?php echo $sliderWrapperClass; ?> " style="<?php echo $containerStyle; ?> "> <div id="<?php echo $this->sliderHtmlID; ?> " class="<?php echo $sliderClass; ?> " style="<?php echo $bannerStyle; ?> "> <?php $this->putSlides(); ?> </div> </div> <?php $this->putJS(); ?> <!-- END BANNER ROTATOR --> <?php } catch (Exception $e) { $message = $e->getMessage(); $this->putErrorMessage($message); } }
<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; ?> " data-slideid="<?php echo $childSlideID; ?> " data-lang="<?php
public function previewOutput($sliderID, $output = null) { if ($sliderID == "empty_output") { $this->loadingMessageOutput(); exit; } if ($output == null) { $output = new BannerRotatorOutput(); } $output->setPreviewMode(); $slider = new BannerRotator(); $slider->initByID($sliderID); $isWpmlExists = UniteWpmlBanner::isWpmlExists(); $useWpml = $slider->getParam("useWpml", "false"); $wpmlActive = false; if ($isWpmlExists && $useWpml == "true") { $wpmlActive = true; $arrLanguages = UniteWpmlBanner::getArrLanguages(false); //Set current lang to output $currentLang = UniteFunctionsBanner::getPostGetVariable("lang"); if (empty($currentLang)) { $currentLang = UniteWpmlBanner::getCurrentLang(); } if (empty($currentLang)) { $currentLang = $arrLanguages[0]; } $output->setLang($currentLang); $selectLangChoose = UniteFunctionsBanner::getHTMLSelect($arrLanguages, $currentLang, "id='select_langs'", true); } //Put the output html $urlPlugin = BannerRotatorAdmin::$url_plugin; $urlPreviewPattern = UniteBaseClassBanner::$url_ajax_actions . "&client_action=preview_slider&sliderid={$sliderID}&lang=[lang]&nonce=[nonce]"; $nonce = wp_create_nonce("bannerrotator_actions"); $setBase = is_ssl() ? "https://" : "http://"; ?> <html> <head> <link rel='stylesheet' href='<?php echo $urlPlugin; ?> css/banner-rotator.css' type='text/css' media='all' /> <link rel='stylesheet' href='<?php echo $urlPlugin; ?> css/caption.css' type='text/css' media='all' /> <script type='text/javascript' src='<?php echo $setBase; ?> ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js'></script> <script type='text/javascript' src='<?php echo $urlPlugin; ?> js/jquery.flashblue-plugins.js'></script> <script type='text/javascript' src='<?php echo $urlPlugin; ?> js/jquery.banner-rotator.js'></script> </head> <body style="padding:0px;margin:0px;"> <?php if ($wpmlActive) { ?> <div style="margin-bottom:10px;text-align:center;"> <?php _e("Choose language"); ?> : <?php echo $selectLangChoose; ?> </div> <script type="text/javascript"> var g_previewPattern = '<?php echo $urlPreviewPattern; ?> '; jQuery("#select_langs").change(function(){ var lang = this.value; var nonce = "<?php echo $nonce; ?> "; var pattern = g_previewPattern; var urlPreview = pattern.replace("[lang]",lang).replace("[nonce]",nonce); location.href = urlPreview; }); </script> <?php } ?> <?php $output->putSliderBase($sliderID); ?> </body> </html> <?php exit; }
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); $htmlBefore = ""; $htmlBefore .= "<li class='item_operation operation_delete'><a data-operation='delete' href='javascript:void(0)'>" . "\n"; $htmlBefore .= "<img src='{$urlIconDelete}'/> {$textDelete}" . "\n"; $htmlBefore .= "</a></li>" . "\n"; $htmlBefore .= "<li class='item_operation operation_edit'><a data-operation='edit' href='javascript:void(0)'>" . "\n"; $htmlBefore .= "<img src='{$urlIconEdit}'/> {$textEdit}" . "\n"; $htmlBefore .= "</a></li>" . "\n"; $htmlBefore .= "<li class='item_operation operation_preview'><a data-operation='preview' href='javascript:void(0)'>" . "\n"; $htmlBefore .= "<img src='{$urlIconPreview}'/> {$textPreview}" . "\n"; $htmlBefore .= "</a></li>" . "\n"; $htmlBefore .= "<li class='item_operation operation_sap'>" . "\n"; $htmlBefore .= "<div class='float_menu_sap'></div>" . "\n"; $htmlBefore .= "</a></li>" . "\n"; $langFloatMenu = UniteWpmlBanner::getLangsWithFlagsHtmlList("id='slides_langs_float' class='slides_langs_float'", $htmlBefore); } $arrSlides = $slider->getSlides(); $numSlides = count($arrSlides); $linksSliderSettings = self::getViewUrl(BannerRotatorAdmin::VIEW_SLIDER, "id={$sliderID}"); $patternViewSlide = self::getViewUrl("slide", "id=[slideid]"); require self::getPathTemplate("slides"); ?>
$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"); $slideOrder = $slide->getOrder(); //Treat multilanguage $isWpmlExists = UniteWpmlBanner::isWpmlExists(); $useWpml = $slider->getParam("useWpml", "false"); $wpmlActive = false; if ($isWpmlExists && $useWpml == "true") { $wpmlActive = true; $parentSlide = $slide->getParentSlide(); $arrChildLangs = $parentSlide->getArrChildrenLangs(); } require self::getPathTemplate("slide"); ?>
private function addLangFromData($data) { $sliderID = UniteFunctionsBanner::getVal($data, "sliderid"); $slideID = UniteFunctionsBanner::getVal($data, "slideid"); $lang = UniteFunctionsBanner::getVal($data, "lang"); //duplicate slide $slider = new BannerRotator(); $slider->initByID($sliderID); $newSlideID = $slider->duplicateSlide($slideID); //update new slide $this->initByID($newSlideID); $arrUpdate = array(); $arrUpdate["lang"] = $lang; $arrUpdate["parentid"] = $slideID; $this->updateParamsInDB($arrUpdate); $urlIcon = UniteWpmlBanner::getFlagUrl($lang); $title = UniteWpmlBanner::getLangTitle($lang); $newSlide = new BannerSlide(); $newSlide->initByID($slideID); $arrLangCodes = $newSlide->getArrChildLangCodes(); $isAll = UniteWpmlBanner::isAllLangsInArray($arrLangCodes); $html = "<li>\n\t\t\t\t\t\t<img id=\"icon_lang_{$newSlideID}\" class=\"icon_slide_lang\" src=\"{$urlIcon}\" title=\"{$title}\" data-slideid=\"{$newSlideID}\" data-lang=\"{$lang}\">\n\t\t\t\t\t\t<div class=\"icon_lang_loader loader_round\" style=\"display:none\"></div>\t\t\t\t\t\t\t\t\n\t\t\t\t\t</li>"; $response = array(); $response["operation"] = "add"; $response["isAll"] = $isAll; $response["html"] = $html; return $response; }
$slideSettings->addTextBox("title", __("Slide", BANNERROTATOR_TEXTDOMAIN), __("Slide Title", BANNERROTATOR_TEXTDOMAIN), $params); //State $params = array("description" => __("The state of the slide. The unpublished slide will be excluded from the slider.", BANNERROTATOR_TEXTDOMAIN)); $slideSettings->addSelect("state", array("published" => __("Published", BANNERROTATOR_TEXTDOMAIN), "unpublished" => __("Unpublished", BANNERROTATOR_TEXTDOMAIN)), __("State", BANNERROTATOR_TEXTDOMAIN), "published", $params); //Visible from $params = array("description" => __("If set, slide will be visible after the date is reached", BANNERROTATOR_TEXTDOMAIN)); $slideSettings->addDatePicker("date_from", "", __("Visible from", BANNERROTATOR_TEXTDOMAIN), $params); //Visible until $params = array("description" => __("If set, slide will be visible till the date is reached", BANNERROTATOR_TEXTDOMAIN)); $slideSettings->addDatePicker("date_to", "", __("Visible until", BANNERROTATOR_TEXTDOMAIN), $params); $slideSettings->addHr(""); //WPML $isWpmlExists = UniteWpmlBanner::isWpmlExists(); $useWpml = $slider->getParam("useWpml", "false"); if ($isWpmlExists && $useWpml == "true") { $arrLangs = UniteWpmlBanner::getArrLanguages(); $params = array("description" => __("The language of the slide (uses WPML plugin).", BANNERROTATOR_TEXTDOMAIN)); $slideSettings->addSelect("lang", $arrLangs, __("Language", BANNERROTATOR_TEXTDOMAIN), "all", $params); } //Transition $params = array("description" => "The appearance transition of this slide."); $slideSettings->addSelect("slide_transition", $arrTransitions, "Transition", "random", $params); //Delay $params = array("description" => __("A new delay value for the Slide. If no delay defined per slide, the delay defined via Options (", BANNERROTATOR_TEXTDOMAIN) . $sliderDelay . __("ms) will be used", BANNERROTATOR_TEXTDOMAIN), "class" => "small"); $slideSettings->addTextBox("delay", "", __("Delay", BANNERROTATOR_TEXTDOMAIN), $params); //Enable link $slideSettings->addSelect_boolean("enable_link", __("Enable Link", BANNERROTATOR_TEXTDOMAIN), false, __("Enable", BANNERROTATOR_TEXTDOMAIN), __("Disable", BANNERROTATOR_TEXTDOMAIN)); $slideSettings->startBulkControl("enable_link", UniteSettingsBanner::CONTROL_TYPE_SHOW, "true"); //Link type $slideSettings->addRadio("link_type", array("regular" => __("Regular", BANNERROTATOR_TEXTDOMAIN), "slide" => __("To Slide", BANNERROTATOR_TEXTDOMAIN)), __("Link Type", BANNERROTATOR_TEXTDOMAIN), "regular"); //Link