/** * * a must function. you can not use it, but the function must stay there!. */ public static function onAddScripts() { $operations = new BizOperations(); $arrValues = $operations->getGeneralSettingsValues(); $includesGlobally = UniteFunctionsBiz::getVal($arrValues, "includes_globally", "on"); $includesFooter = UniteFunctionsBiz::getVal($arrValues, "js_to_footer", "off"); $strPutIn = UniteFunctionsBiz::getVal($arrValues, "pages_for_includes"); $isPutIn = ShowBizOutput::isPutIn($strPutIn, true); $includeFancy = UniteFunctionsBiz::getVal($arrValues, "includes_globally_facybox", "on"); //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, "showbiz-widget", true); $hasShortcode = UniteFunctionsWPBiz::hasShortcode("showbiz"); if ($isWidgetActive == false && $hasShortcode == false) { return false; } } self::addStyle("settings", "showbiz-settings", "showbiz-plugin/css"); $url_jquery = "http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js?app=showbiz"; self::addScriptAbsoluteUrl($url_jquery, "jquery"); if ($includeFancy == "on") { self::addStyle("jquery.fancybox", "fancybox", "showbiz-plugin/fancybox"); self::addScript("jquery.fancybox.pack", "showbiz-plugin/fancybox", "fancybox"); } if ($includesFooter == "off") { $waitfor = array('jquery'); self::addScript("jquery.themepunch.tools.min", "showbiz-plugin/js", 'tp-tools', $waitfor); self::addScript("jquery.themepunch.showbizpro.min", "showbiz-plugin/js"); } else { //put javascript to footer UniteBaseClassBiz::addAction('wp_footer', 'putJavascript'); } }
/** * * 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 template output * @param int $templateID */ public function previewTemplateOutput($templateID) { if ($templateID == "empty_output") { $this->loadingMessageOutput(); exit; } $output = new ShowBizOutput(); //if it's a navigation template, load firs template $template = new ShowBizTemplate(); $template->initById($templateID); $templateType = $template->getType(); if ($templateType == GlobalsShowBiz::TEMPLATE_TYPE_BUTTON) { $navigationTempalateID = $templateID; $templateID = $template->getFirstTemplateID(GlobalsShowBiz::TEMPLATE_TYPE_ITEM); //navigation template mode $output->setPreviewMode("template", $navigationTempalateID); } else { //item template mode $output->setPreviewMode("template"); } $this->previewOutput($templateID, $output); }
/** * * widget output */ public function widget($args, $instance) { $sliderID = UniteFunctionsBiz::getVal($instance, "showbiz"); $title = UniteFunctionsBiz::getVal($instance, "showbiz_title"); $homepageCheck = UniteFunctionsBiz::getVal($instance, "showbiz_homepage"); $homepage = ""; if ($homepageCheck == "on") { $homepage = "homepage"; } $pages = UniteFunctionsBiz::getVal($instance, "showbiz_pages"); if (!empty($pages)) { if (!empty($homepage)) { $homepage .= ","; } $homepage .= $pages; } if (empty($sliderID)) { return false; } //widget output $beforeWidget = UniteFunctionsBiz::getVal($args, "before_widget"); $afterWidget = UniteFunctionsBiz::getVal($args, "after_widget"); $beforeTitle = UniteFunctionsBiz::getVal($args, "before_title"); $afterTitle = UniteFunctionsBiz::getVal($args, "after_title"); echo $beforeWidget; echo $beforeTitle . $title . $afterTitle; ShowBizOutput::putSlider($sliderID, $homepage, true); echo $afterWidget; }
/** * * put the slider on the html page. * @param $data - mixed, can be ID ot Alias. */ public static function putSlider($sliderID, $putIn = "") { $putIn = strtolower($putIn); if ($putIn == "homepage") { //filter by homepage if (is_front_page() == false) { return false; } } else { //case filter by pages if (!empty($putIn)) { $arrPutInPages = array(); $arrPagesTemp = explode(",", $putIn); foreach ($arrPagesTemp as $page) { if (is_numeric($page) || $page == "homepage") { $arrPutInPages[] = $page; } } if (!empty($arrPutInPages)) { //get current page id $currentPageID = ""; if (is_front_page() == true) { $currentPageID = "homepage"; } else { global $post; if (isset($post->ID)) { $currentPageID = $post->ID; } } //do the filter by pages if (array_search($currentPageID, $arrPutInPages) === false) { return false; } } } } $output = new ShowBizOutput(); $output->putSliderBase($sliderID); $slider = $output->getSlider(); return $slider; }