/** * * javascript output to footer */ public function putJavascript() { $urlPlugin = UniteBaseClassBiz::$url_plugin . "showbiz-plugin/"; $operations = new BizOperations(); $arrValues = $operations->getGeneralSettingsValues(); ?> <script type='text/javascript' src='<?php echo $urlPlugin; ?> js/jquery.themepunch.tools.min.js?rev=<?php echo GlobalsShowBiz::SLIDER_REVISION; ?> '></script> <script type='text/javascript' src='<?php echo $urlPlugin; ?> js/jquery.themepunch.showbizpro.min.js?rev=<?php echo GlobalsShowBiz::SLIDER_REVISION; ?> '></script> <?php }
/** * * put kb slider on the page. * the data can be slider ID or slider alias. */ function putShowBiz($data, $putIn = "") { $operations = new BizOperations(); $arrValues = $operations->getGeneralSettingsValues(); $includesGlobally = UniteFunctionsBiz::getVal($arrValues, "includes_globally", "on"); $strPutIn = UniteFunctionsBiz::getVal($arrValues, "pages_for_includes"); $isPutIn = ShowBizOutput::isPutIn($strPutIn, true); if ($isPutIn == false && $includesGlobally == "off") { $output = new ShowBizOutput(); $option1Name = "Include ShowBiz libraries globally (all pages/posts)"; $option2Name = "Pages to include ShowBiz libraries"; $output->putErrorMessage(__("If you want to use the PHP function \"putShowBiz\" in your code please make sure to check \" ", SHOWBIZ_TEXTDOMAIN) . $option1Name . __(" \" in the backend's \"General Settings\" (top right panel). <br> <br> Or add the current page to the \"", SHOWBIZ_TEXTDOMAIN) . $option2Name . __("\" option box.")); return false; } ShowBizOutput::putSlider($data, $putIn); }
/** * * preview slider output * if output object is null - create object */ public function previewOutput($sliderID, $output = null) { if ($sliderID == "empty_output") { $this->loadingMessageOutput(); exit; } if ($output == null) { $output = new ShowBizOutput(); } $output->setPreviewMode(); //put the output html $urlPlugin = ShowBizAdmin::$url_plugin . "showbiz-plugin/"; $operations = new BizOperations(); $arrValues = $operations->getGeneralSettingsValues(); $includeFancyBackend = UniteFunctionsBiz::getVal($arrValues, "includes_globally_facybox_be", "on"); ?> <html> <head> <link rel='stylesheet' href='<?php echo $urlPlugin; ?> css/settings.css?rev=<?php echo GlobalsShowBiz::SLIDER_REVISION; ?> ' type='text/css' media='all' /> <?php if ($includeFancyBackend == "on") { ?> <link rel='stylesheet' href='<?php echo $urlPlugin; ?> fancybox/jquery.fancybox.css?rev=<?php echo GlobalsShowBiz::SLIDER_REVISION; ?> ' type='text/css' media='all' /> <?php } ?> <script type='text/javascript' src='http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'></script> <?php if ($includeFancyBackend == "on") { ?> <script type='text/javascript' src='<?php echo $urlPlugin; ?> fancybox/jquery.fancybox.pack.js?rev=<?php echo GlobalsShowBiz::SLIDER_REVISION; ?> '></script> <?php } ?> <script type='text/javascript' src='<?php echo $urlPlugin; ?> js/jquery.themepunch.tools.min.js?rev=<?php echo GlobalsShowBiz::SLIDER_REVISION; ?> '></script> <script type='text/javascript' src='<?php echo $urlPlugin; ?> js/jquery.themepunch.showbizpro.min.js?rev=<?php echo GlobalsShowBiz::SLIDER_REVISION; ?> '></script> </head> <body style="padding:0px;margin:20px;"> <?php $output->putSliderBase($sliderID); ?> </body> </html> <?php exit; }
/** * * put html slider on the html page. * @param $data - mixed, can be ID ot Alias. */ public function putSliderBase($sliderID) { global $showbizVersion; try { self::$sliderSerial++; $this->slider = new ShowBizSlider(); //if it's put template mode, the sliderID is the templateID if ($this->previewMode == true && $this->previewTemplateMode == true) { $this->slider->initByHardcodedDemo(); $this->slider->setTemplateID($sliderID); } else { $this->slider->initByMixed($sliderID); } //modify settings for admin preview mode if ($this->previewMode == true) { $this->modifyPreviewModeSettings(); } $this->sliderHtmlID = "showbiz_" . $sliderID . "_" . self::$sliderSerial; //get template html: $templateID = $this->slider->getParam("template_id"); UniteFunctionsBiz::validateNumeric($templateID, "Slider should have item template assigned"); $this->template = new ShowBizTemplate(); $this->template->initById($templateID); //get css template: $templateCSS = $this->template->getCss(); //$templateCSS = $this->getDemoCss(); //set navigation params (template, custom, none) $navigationType = $this->slider->getParam("navigation_type", "template"); $navigationParams = ""; if ($navigationType == "template") { $navigationParams = " data-left=\"#showbiz_left_{$sliderID}\" data-right=\"#showbiz_right_{$sliderID}\" "; $navigationParams .= "data-play=\"#showbiz_play_{$sliderID}\" "; //get navigation template html: $navTemplateID = $this->slider->getParam("nav_template_id"); if (!empty($this->initNavTemplateID)) { $navTemplateID = $this->initNavTemplateID; } UniteFunctionsBiz::validateNumeric($navTemplateID, "Slider should have navigation template assigned"); $templateNavigation = new ShowBizTemplate(); $templateNavigation->initById($navTemplateID); $navigationHtml = $templateNavigation->getContent(); //$navigationHtml = $this->getDemoNavigationHtml(); $navigationHtml = str_replace("[showbiz_left_button_id]", "showbiz_left_" . $sliderID, $navigationHtml); $navigationHtml = str_replace("[showbiz_right_button_id]", "showbiz_right_" . $sliderID, $navigationHtml); $navigationHtml = str_replace("[showbiz_play_button_id]", "showbiz_play_" . $sliderID, $navigationHtml); $navigationCss = $templateNavigation->getCss(); //$navigationCss = $this->getDemoNavigationCss(); $templateCSS .= "\n" . $navigationCss; $navPosition = $this->slider->getParam("nav_position", "top"); } else { if ($navigationType == "custom") { $leftButtonID = $this->slider->getParam("left_buttonid"); $rightButtonID = $this->slider->getParam("right_buttonid"); $navigationParams = " data-left=\"#{$leftButtonID}\" data-right=\"#{$rightButtonID}\" "; } } $templateCSS = str_replace("[itemid]", "#" . $this->sliderHtmlID, $templateCSS); $containerStyle = ""; //set position: $sliderPosition = $this->slider->getParam("position", "center"); switch ($sliderPosition) { case "center": default: $containerStyle .= "margin:0px auto;"; break; case "left": $containerStyle .= "float:left;"; break; case "right": $containerStyle .= "float:right;"; break; } //set margin: if ($sliderPosition != "center") { $containerStyle .= "margin-left:" . $this->slider->getParam("margin_left", "0") . "px;"; $containerStyle .= "margin-right:" . $this->slider->getParam("margin_right", "0") . "px;"; } $containerStyle .= "margin-top:" . $this->slider->getParam("margin_top", "0") . "px;"; $containerStyle .= "margin-bottom:" . $this->slider->getParam("margin_bottom", "0") . "px;"; $clearBoth = $this->slider->getParam("clear_both", "false"); $htmlBeforeSlider = ""; //put js to body handle if ($this->slider->getParam("js_to_body", "false") == "true") { $operations = new BizOperations(); $arrValues = $operations->getGeneralSettingsValues(); //include showbiz js $urlIncludeJS = UniteBaseClassBiz::$url_plugin . "showbiz-plugin/js/jquery.themepunch.tools.min.js?rev=" . GlobalsShowBiz::SLIDER_REVISION; $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>"; $urlIncludeJS = UniteBaseClassBiz::$url_plugin . "showbiz-plugin/js/jquery.themepunch.showbizpro.min.js?rev=" . GlobalsShowBiz::SLIDER_REVISION; $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeJS}'></script>"; $operations = new BizOperations(); $arrValues = $operations->getGeneralSettingsValues(); $includeFancy = UniteFunctionsBiz::getVal($arrValues, "includes_globally_facybox", "on"); //include fancybox js if ($includeFancy == "on") { $urlIncludeFancybox = UniteBaseClassBiz::$url_plugin . "showbiz-plugin/fancybox/jquery.fancybox.pack.js?rev=" . GlobalsShowBiz::SLIDER_REVISION; $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeFancybox}'></script>"; $urlIncludeFancybox = UniteBaseClassBiz::$url_plugin . "showbiz-plugin/fancybox/helpers/jquery.fancybox-media.js?rev=" . GlobalsShowBiz::SLIDER_REVISION; $htmlBeforeSlider .= "<script type='text/javascript' src='{$urlIncludeFancybox}'></script>"; } } ob_start(); ?> <!-- START SHOWBIZ <?php echo $showbizVersion; ?> --> <?php echo $htmlBeforeSlider; ?> <?php if (!empty($templateCSS)) { ?> <style type="text/css"> <?php echo $templateCSS; ?> .showbiz-drag-mouse { cursor:url(<?php echo SHOWBIZ_PLUGIN_URL; ?> showbiz-plugin/css/openhand.cur), move; } .showbiz-drag-mouse.dragged { cursor:url(<?php echo SHOWBIZ_PLUGIN_URL; ?> showbiz-plugin/css/closedhand.cur), move; } </style> <?php } ?> <div id="<?php echo $this->sliderHtmlID; ?> " class="showbiz-container" style="<?php echo $containerStyle; ?> "> <?php if ($navigationType == "template" && $navPosition == "top") { ?> <!-- start navigation --> <?php echo $navigationHtml; ?> <!-- end navigation --> <?php } ?> <div class="showbiz" <?php echo $navigationParams; ?> > <div class="overflowholder"> <?php $this->putSlides(); ?> <div class="sbclear"></div> </div> <div class="sbclear"></div> </div> <?php if ($navigationType == "template" && $navPosition == "bottom") { ?> <!-- start navigation --> <?php echo $navigationHtml; ?> <!-- end navigation --> <?php } ?> </div> <?php if ($clearBoth == "true") { ?> <div style="clear:both"></div> <?php } ?> <?php $this->putJS(); ?> <!-- END SHOWBIZ --> <?php $content = ob_get_contents(); ob_clean(); ob_end_clean(); echo $content; //check if option of refresh_images need to be set to false $refresh = $this->slider->getParam("refresh_images", 'false'); if ($refresh == "true") { //set param to false in DB $this->slider->updateParam(array("refresh_images" => "false")); } } catch (Exception $e) { $debugMode = $this->slider->getParam("debug_mode", "false"); $content = ob_get_contents(); $message = $e->getMessage(); $trace = ""; if ($debugMode == "true") { ob_clean(); ob_end_clean(); $trace = $e->getTraceAsString(); $trace .= $content; } $this->putErrorMessage($message, $trace); } }
<?php $generalSettings = new UniteSettingsBiz(); $generalSettings->addRadio("includes_globally", array("on" => __("On", SHOWBIZ_TEXTDOMAIN), "off" => __("Off", SHOWBIZ_TEXTDOMAIN)), __("Include Showbiz libraries globally", SHOWBIZ_TEXTDOMAIN), "on", array("description" => "<br>" . __("Add css and js includes only on all pages. Id turned to off they will added to pages where the showbiz shortcode exists only. This will work only when the slider added by a shortcode.", SHOWBIZ_TEXTDOMAIN))); $generalSettings->addRadio("includes_globally_facybox", array("on" => __("On", SHOWBIZ_TEXTDOMAIN), "off" => __("Off", SHOWBIZ_TEXTDOMAIN)), __("Include Fancybox libraries", SHOWBIZ_TEXTDOMAIN), "on", array("description" => "<br>" . __("Add css and js includes from fanxybox. If off, fancybox will not work if your selected theme doe snot include fancybox", SHOWBIZ_TEXTDOMAIN))); $generalSettings->addRadio("includes_globally_facybox_be", array("on" => __("On", SHOWBIZ_TEXTDOMAIN), "off" => __("Off", SHOWBIZ_TEXTDOMAIN)), __("Include Fancybox libraries in backend (for preview reasons)", SHOWBIZ_TEXTDOMAIN), "on", array("description" => "<br>" . __("Add css and js includes from fanxybox in backend. If off, fancybox will not work o preview mode", SHOWBIZ_TEXTDOMAIN))); $generalSettings->addTextBox("pages_for_includes", "", __("Pages to include ShowBiz libraries", SHOWBIZ_TEXTDOMAIN), array("description" => "<br>" . __("Specify the page id's that the front end includes will be included in. Example: 2,3,5 also: homepage,3,4", SHOWBIZ_TEXTDOMAIN))); $generalSettings->addRadio("js_to_footer", array("on" => __("On", SHOWBIZ_TEXTDOMAIN), "off" => __("Off", SHOWBIZ_TEXTDOMAIN)), __("Put JS Includes To Footer", SHOWBIZ_TEXTDOMAIN), "off", array("description" => "<br>" . __("Putting the js to footer (instead of the head) is good for fixing some javascript conflicts.", SHOWBIZ_TEXTDOMAIN))); //get stored values $operations = new BizOperations(); $arrValues = $operations->getGeneralSettingsValues(); $generalSettings->setStoredValues($arrValues); self::storeSettings("general", $generalSettings);