/** * * init the slider object by database id */ public function initByID($sliderID) { UniteFunctionsBiz::validateNumeric($sliderID, "Slider ID"); $sliderID = $this->db->escape($sliderID); try { $sliderData = $this->db->fetchSingle(GlobalsShowBiz::$table_sliders, "id={$sliderID}"); } catch (Exception $e) { UniteFunctionsBiz::throwError("Slider with ID: {$sliderID} Not Found"); } $this->initByDBData($sliderData); }
/** * * init the slider by id */ public function initByID($slideid) { UniteFunctionsBiz::validateNumeric($slideid, "Slide ID"); $slideid = $this->db->escape($slideid); $record = $this->db->fetchSingle(GlobalsShowBiz::$table_slides, "id={$slideid}"); $this->initByData($record); }
/** * * 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); } }
private function handleImageEffects(&$imgHandle) { if (empty($this->effect)) { return false; } switch ($this->effect) { case self::EFFECT_BW: if (defined("IMG_FILTER_GRAYSCALE")) { imagefilter($imgHandle, IMG_FILTER_GRAYSCALE); } break; case self::EFFECT_BRIGHTNESS: if (defined("IMG_FILTER_BRIGHTNESS")) { if (!is_numeric($this->effect_arg1)) { $this->effect_arg1 = 50; } //set default value UniteFunctionsBiz::validateNumeric($this->effect_arg1, "'ea1' argument"); imagefilter($imgHandle, IMG_FILTER_BRIGHTNESS, $this->effect_arg1); } break; case self::EFFECT_DARK: if (defined("IMG_FILTER_BRIGHTNESS")) { if (!is_numeric($this->effect_arg1)) { $this->effect_arg1 = -50; } //set default value UniteFunctionsBiz::validateNumeric($this->effect_arg1, "'ea1' argument"); imagefilter($imgHandle, IMG_FILTER_BRIGHTNESS, $this->effect_arg1); } break; case self::EFFECT_CONTRAST: if (defined("IMG_FILTER_CONTRAST")) { if (!is_numeric($this->effect_arg1)) { $this->effect_arg1 = -5; } //set default value imagefilter($imgHandle, IMG_FILTER_CONTRAST, $this->effect_arg1); } break; case self::EFFECT_EDGE: if (defined("IMG_FILTER_EDGEDETECT")) { imagefilter($imgHandle, IMG_FILTER_EDGEDETECT); } break; case self::EFFECT_EMBOSS: if (defined("IMG_FILTER_EMBOSS")) { imagefilter($imgHandle, IMG_FILTER_EMBOSS); } break; case self::EFFECT_BLUR: $this->effect_Blur($imgHandle, 5); /* if(defined("IMG_FILTER_GAUSSIAN_BLUR")) imagefilter($imgHandle,IMG_FILTER_GAUSSIAN_BLUR); */ break; case self::EFFECT_MEAN: if (defined("IMG_FILTER_MEAN_REMOVAL")) { imagefilter($imgHandle, IMG_FILTER_MEAN_REMOVAL); } break; case self::EFFECT_SMOOTH: if (defined("IMG_FILTER_SMOOTH")) { if (!is_numeric($this->effect_arg1)) { $this->effect_arg1 = 15; } //set default value imagefilter($imgHandle, IMG_FILTER_SMOOTH, $this->effect_arg1); } break; case self::EFFECT_BLUR3: $this->effect_Blur($imgHandle, 5); break; default: $this->throwError("Effect not supported: <b>{$this->effect}</b>"); break; } }