/** * * get params of slider demo */ public function getSliderDemoParams() { $params = array(); $params["title"] = "Slider Demo"; $params["alias"] = "slider_demo"; $params["source_type"] = "gallery"; //set template ID $template = new ShowBizTemplate(); $params["template_id"] = $template->getFirstTemplateID(GlobalsShowBiz::TEMPLATE_TYPE_ITEM); $navTemplateID = $template->getFirstTemplateID(GlobalsShowBiz::TEMPLATE_TYPE_BUTTON); $params["nav_template_id"] = $navTemplateID; return $params; }
<?php $templates = new ShowBizTemplate(); $titleText = "ShowBiz Navigation Skin Editor"; $templatesType = GlobalsShowBiz::TEMPLATE_TYPE_BUTTON; //new item prefix $templatesPrefix = "Navigation Template"; $arrTemplates = $templates->getList($templatesType); //set buttons array $prefix = "showbiz_"; $arrButtons = array(); $arrButtons[$prefix . "left_button_id"] = "Left Button ID"; $arrButtons[$prefix . "right_button_id"] = "Right Button ID"; $arrButtons[$prefix . "play_button_id"] = "Play Button ID"; $arrOriginalTemplates = BizOperations::getArrInitNavigationTemplates(true); $linkShowAll = self::getPageUrl(ShowBizAdmin::VIEW_TEMPLATES_NAV); $filterID = UniteFunctionsBiz::getGetVar("id"); $showCustomOptions = false; $showClasses = false; $standartOptionsName = "Navigation Options"; $linkHelp = GlobalsShowBiz::LINK_HELP_TEMPLATES_NAVS; require self::getPathTemplate("templates"); ?>
/** * * 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); } }
/** * * onAjax action handler */ public static function onAjaxAction() { $slider = new ShowBizSlider(); $slide = new BizSlide(); $templates = new ShowBizTemplate(); $operations = new BizOperations(); $wildcards = new ShowBizWildcards(); $action = self::getPostGetVar("client_action"); $data = self::getPostGetVar("data"); $nonce = self::getPostGetVar("nonce"); try { //verify the nonce $isVerified = wp_verify_nonce($nonce, "showbiz_actions"); if ($isVerified == false) { UniteFunctionsBiz::throwError("Wrong request"); } switch ($action) { case "update_general_settings": $operations->updateGeneralSettings($data); self::ajaxResponseSuccess(__("General settings updated", SHOWBIZ_TEXTDOMAIN)); break; case "export_slider": $sliderID = self::getGetVar("sliderid"); $slider->initByID($sliderID); $slider->exportSlider(); break; case "import_slider": self::importSliderHandle(); break; case "create_slider": $newSliderID = $slider->createSliderFromOptions($data); self::ajaxResponseSuccessRedirect("The slider successfully created", self::getViewUrl("sliders")); break; case "update_slider": $slider->updateSliderFromOptions($data); self::ajaxResponseSuccess("Slider updated"); break; case "delete_slider": $slider->deleteSliderFromData($data); self::ajaxResponseSuccessRedirect("The slider deleted", self::getViewUrl(self::VIEW_SLIDERS)); break; case "duplicate_slider": $slider->duplicateSliderFromData($data); self::ajaxResponseSuccessRedirect("The duplicate successfully, refreshing page...", self::getViewUrl(self::VIEW_SLIDERS)); break; case "add_slide": $slider->createSlideFromData($data); $sliderID = $data["sliderid"]; self::ajaxResponseSuccessRedirect("Slide Created, refreshing...", self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}")); break; case "update_slide": $slide->updateSlideFromData($data); self::ajaxResponseSuccess("Slide updated"); break; case "delete_slide": $slide->deleteSlideFromData($data); $sliderID = UniteFunctionsBiz::getVal($data, "sliderID"); self::ajaxResponseSuccessRedirect("Slide Deleted Successfully", self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}")); break; case "duplicate_slide": $sliderID = $slider->duplicateSlideFromData($data); self::ajaxResponseSuccessRedirect("Slide Duplicated Successfully", self::getViewUrl(self::VIEW_SLIDES, "id={$sliderID}")); break; case "update_slides_order": $slider->updateSlidesOrderFromData($data); self::ajaxResponseSuccess("Order updated successfully"); break; case "preview_slide": $operations->putSlidePreviewByData($data); break; case "preview_slider": $sliderID = UniteFunctionsBiz::getPostVariable("sliderid"); $operations->previewOutput($sliderID); break; case "preview_template": $templateID = UniteFunctionsBiz::getPostGetVariable("templateid"); $operations->previewTemplateOutput($templateID); break; case "toggle_slide_state": $currentState = $slide->toggleSlideStatFromData($data); self::ajaxResponseData(array("state" => $currentState)); break; case "update_plugin": self::updateShowbizPlugin(); break; case "create_template": $templates->addFromData($data); self::ajaxResponseSuccess("Template Added Successfully"); break; case "delete_template": $templates->deleteFromData($data); self::ajaxResponseSuccess("Template Deleted Successfully"); break; case "duplicate_template": $templates->duplicateFromData($data); self::ajaxResponseSuccess("Template Duplicated Successfully"); break; case "get_template_content": $content = $templates->getContentFromData($data); $arrData = array("content" => $content); self::ajaxResponseData($arrData); break; case "get_template_css": $css = $templates->getCssFromData($data); $arrData = array("css" => $css); self::ajaxResponseData($arrData); break; case "update_template_content": $templates->updateContentFromData($data); self::ajaxResponseSuccess("Content Updated Successfully"); break; case "update_template_title": $templates->updateTitleFromData($data); self::ajaxResponseSuccess("Title Updated Successfully"); break; case "update_template_css": $templates->updateCssFromData($data); self::ajaxResponseSuccess("Css Updated Successfully"); break; case "restore_original_template": $templates->restoreOriginalFromData($data); self::ajaxResponseSuccess("Template Restored"); break; case "update_posts_sortby": $slider->updatePostsSortbyFromData($data); self::ajaxResponseSuccess("Sortby updated"); break; case "change_slide_image": $slide->updateSlideImageFromData($data); self::ajaxResponseSuccess("Image Changed"); break; case "add_wildcard": $response = $wildcards->addFromData($data); self::ajaxResponseSuccess("Added successfully", $response); break; case "remove_wildcard": $response = $wildcards->removeFromData($data); self::ajaxResponseSuccess("Removed successfully", $response); break; case "activate_purchase_code": $result = false; if (!empty($data['username']) && !empty($data['api_key']) && !empty($data['code'])) { $result = $operations->checkPurchaseVerification($data); } else { UniteFunctionsBiz::throwError(__('The API key, the Purchase Code and the Username need to be set!')); exit; } if ($result) { self::ajaxResponseSuccessRedirect(__("Purchase Code Successfully Activated"), self::getViewUrl(self::VIEW_SLIDERS)); } else { UniteFunctionsBiz::throwError(__('Purchase Code is invalid')); } break; case "deactivate_purchase_code": $result = $operations->doPurchaseDeactivation($data); if ($result) { self::ajaxResponseSuccessRedirect(__("Successfully removed validation"), self::getViewUrl(self::VIEW_SLIDERS)); } else { UniteFunctionsBiz::throwError(__('Could not remove Validation!')); } break; case "dismiss_notice": update_option('showbiz-valid-notice', 'false'); self::ajaxResponseSuccess(__(".")); 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; }
/** * * must be templateID in the data */ private function getTemplateFromData($data) { $templateID = UniteFunctionsBiz::getVal($data, "templateID"); UniteFunctionsBiz::validateNotEmpty($templateID, "tempalte id"); $template = new ShowBizTemplate(); $template->initById($templateID); return $template; }
<?php //set Slide settings $arrSlideNames = $slider->getArrSlideNames(); $slideSettings = new UniteSettingsAdvancedBiz(); //title $params = array("description" => "The title of the slide, will be shown in the slides list.", "class" => "medium"); $slideSettings->addTextBox("title", "Slide", "Slide Title", $params); //state $params = array("description" => "The state of the slide. The unpublished slide will be excluded from the slider."); $slideSettings->addSelect("state", array("published" => "Published", "unpublished" => "Unpublished"), "State", "published", $params); //----------------------- //select item template $templates = new ShowBizTemplate(); $arrTemplates = $templates->getArrShortAssoc(GlobalsShowBiz::TEMPLATE_TYPE_ITEM, true); $params = array("description" => "The template that set the look of the item (if not selected it will be taken from the slider global template)"); $slideSettings->addSelect("template_id", $arrTemplates, "Item Template", "", $params); $slideSettings->addHr(); //----------------------- //enable link $slideSettings->addSelect_boolean("enable_link", "Enable Link", false, "Enable", "Disable"); $slideSettings->startBulkControl("enable_link", UniteSettingsBiz::CONTROL_TYPE_SHOW, "true"); //link $params = array("description" => "A link on the whole slide pic"); $slideSettings->addTextBox("link", "", "Slide Link", $params); $slideSettings->addHr(); $slideSettings->endBulkControl(); $params = array("description" => "", "width" => 300, "height" => 200); $slideSettings->addImage("slide_image", "", "Slide Image", $params); //editor $params = array("description" => "");
$sliderMainSettings->addTextBox("wc_sale_price_from", "", "Sale Price", $arrParams); $arrParams = array("class" => "small", UniteSettingsBiz::PARAM_OUTPUTWITH => "wc_sale_price_from", UniteSettingsBiz::PARAM_ADDTEXT_BEFORE_ELEMENT => " To:"); $sliderMainSettings->addTextBox("wc_sale_price_to", "", "Sale Price To", $arrParams); $sliderMainSettings->addCheckbox("wc_instock_only", false, "In Stock Only"); $sliderMainSettings->addCheckbox("wc_featured_only", false, "Featured Products Only"); $sliderMainSettings->endBulkControl(); } //if woocommerce exists // -------------- End Filters ------------------ $sliderMainSettings->addHr(); //set select item template $templates = new ShowBizTemplate(); $arrTemplates = $templates->getArrShortAssoc(GlobalsShowBiz::TEMPLATE_TYPE_ITEM); $addHtml = "<a href='javascript:void(0)' id='button_edit_item_template' class='button-primary revblue mleft_10'><i class='revicon-pencil-1'></i>Edit</a>"; $params = array("description" => "The template that set the look of the item", UniteSettingsBiz::PARAM_ADDTEXT => $addHtml); $sliderMainSettings->addSelect("template_id", $arrTemplates, "Item Template", "", $params); self::storeSettings("slider_main", $sliderMainSettings); //set "slider_params" settings. $sliderParamsSettings = new UniteSettingsAdvancedBiz(); $sliderParamsSettings->loadXMLFile(self::$path_settings . "/slider_settings.xml"); //update navigation template $templates = new ShowBizTemplate(); $arrTemplates = $templates->getArrShortAssoc(GlobalsShowBiz::TEMPLATE_TYPE_BUTTON); $addHtml = "<a href='javascript:void(0)' id='button_edit_item_template_nav' class='button-secondary mleft_10' style='margin-top:17px;'>Edit</a>"; $sliderParamsSettings->updateSettingField("nav_template_id", "items", $arrTemplates); $sliderParamsSettings->updateSettingField("nav_template_id", UniteSettingsBiz::PARAM_ADDTEXT, $addHtml); //store params self::storeSettings("slider_params", $sliderParamsSettings); ?>
/** * * get wildcards settings object * $isInsidePost it means that it's used inside the post and not template page. */ public function getWildcardsSettings($isInsidePost = false) { $settings = new UniteSettingsAdvancedBiz(); //add youtube, excerpt and vimeo id if ($isInsidePost == true) { $templates = new ShowBizTemplate(); $arrTemplates = $templates->getArrShortAssoc(GlobalsShowBiz::TEMPLATE_TYPE_ITEM, true); $settings->addSelect("template_id", $arrTemplates, "Item Template", ""); $params = array("class" => "textbox_small", "description" => "Overwrite the global excerpt words limit option for this post"); $settings->addTextBox("showbiz_excerpt_limit", "", "Excerpt Words Limit", $params); $params = array("description" => "The youtube ID, example: 9bZkp7q19f0"); $settings->addTextBox("youtube_id", "", "Youtube ID", $params); $params = array("description" => "The youtube ID, example: 18554749"); $settings->addTextBox("vimeo_id", "", "Vimeo ID", $params); } //get custom settings: $arrCustomOptions = $this->getArrCustomOptions(); if (!empty($arrCustomOptions)) { $params = array("custom_type" => "user", "text_class" => "text_short", "description" => "Custom option. Can be used in variaty of needs in the template"); foreach ($arrCustomOptions as $option) { $title = $option["title"]; $name = self::PLACEHOLDER_PREFIX . $option["name"]; $settings->addTextBox($name, "", $title, $params); } } return $settings; }