Пример #1
0
 /**
  * 
  * 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');
     }
 }