public static function onAddScripts()
 {
     $operations = new BannerOperations();
     $arrValues = $operations->getGeneralSettingsValues();
     $includesGlobally = UniteFunctionsBanner::getVal($arrValues, "includes_globally", "on");
     $strPutIn = UniteFunctionsBanner::getVal($arrValues, "pages_for_includes");
     $isPutIn = BannerRotatorOutput::isPutIn($strPutIn, true);
     //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, "banner-rotator-widget", true);
         $hasShortcode = UniteFunctionsWPBanner::hasShortcode("banner_rotator");
         if ($isWidgetActive == false && $hasShortcode == false) {
             return false;
         }
     }
     //Banner Rotator CSS settings
     self::addStyle("banner-rotator", "banner-rotator", "css");
     self::addStyle("caption", "banner-rotator-caption", "css");
     //jQuery
     $setBase = is_ssl() ? "https://" : "http://";
     $url_jquery = $setBase . "ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js?app=banner-rotator";
     self::addScriptAbsoluteUrl($url_jquery, "jquery");
     //Banner Rotator JS
     self::addScript("jquery.flashblue-plugins", "js", "flashblue.plugins");
     self::addScript("jquery.banner-rotator", "js");
 }
Esempio n. 2
0
 function putBannerRotator($data, $putIn = "")
 {
     $operations = new BannerOperations();
     $arrValues = $operations->getGeneralSettingsValues();
     $includesGlobally = UniteFunctionsBanner::getVal($arrValues, "includes_globally", "on");
     $strPutIn = UniteFunctionsBanner::getVal($arrValues, "pages_for_includes");
     $isPutIn = BannerRotatorOutput::isPutIn($strPutIn, true);
     if ($isPutIn == false && $includesGlobally == "off") {
         $output = new BannerRotatorOutput();
         $option1Name = "Include BannerRotator libraries globally (all pages/posts)";
         $option2Name = "Pages to include BannerRotator libraries";
         $output->putErrorMessage(__("If you want to use the PHP function \"putBannerRotator\" in your code please make sure to check \" ", BANNERROTATOR_TEXTDOMAIN) . $option1Name . __(" \" in the backend's \"General Settings\" (top right panel). <br> <br> Or add the current page to the \"", BANNERROTATOR_TEXTDOMAIN) . $option2Name . __("\" option box."));
         return false;
     }
     BannerRotatorOutput::putSlider($data, $putIn);
 }
<?php

$generalSettings = new UniteSettingsBanner();
$generalSettings->addSelect("role", array(UniteBaseAdminClassBanner::ROLE_ADMIN => __("To Admin", BANNERROTATOR_TEXTDOMAIN), UniteBaseAdminClassBanner::ROLE_EDITOR => __("To Editor, Admin", BANNERROTATOR_TEXTDOMAIN), UniteBaseAdminClassBanner::ROLE_AUTHOR => __("Author, Editor, Admin", BANNERROTATOR_TEXTDOMAIN)), __("View Plugin Permission", BANNERROTATOR_TEXTDOMAIN), UniteBaseAdminClassBanner::ROLE_ADMIN, array("description" => "<br>" . __("The role of user that can view and edit the plugin", BANNERROTATOR_TEXTDOMAIN)));
$generalSettings->addRadio("includes_globally", array("on" => __("On", BANNERROTATOR_TEXTDOMAIN), "off" => __("Off", BANNERROTATOR_TEXTDOMAIN)), __("Include BannerRotator libraries globally", BANNERROTATOR_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 banner_rotator shortcode exists only. This will work only when the slider added by a shortcode.", BANNERROTATOR_TEXTDOMAIN)));
$generalSettings->addTextBox("pages_for_includes", "", __("Pages to include BannerRotator libraries", BANNERROTATOR_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", BANNERROTATOR_TEXTDOMAIN)));
//Get stored values
$operations = new BannerOperations();
$arrValues = $operations->getGeneralSettingsValues();
$generalSettings->setStoredValues($arrValues);
self::storeSettings("general", $generalSettings);