public static function setSettingsCustomValues(UniteSettingsBanner $settings, $arrValues)
 {
     $arrSettings = $settings->getArrSettings();
     foreach ($arrSettings as $key => $setting) {
         $type = UniteFunctionsBanner::getVal($setting, "type");
         if ($type != UniteSettingsBanner::TYPE_CUSTOM) {
             continue;
         }
         $customType = UniteFunctionsBanner::getVal($setting, "custom_type");
         switch ($customType) {
             case "sliderSize":
                 $setting["width"] = UniteFunctionsBanner::getVal($arrValues, "width", UniteFunctionsBanner::getVal($setting, "width"));
                 $setting["height"] = UniteFunctionsBanner::getVal($arrValues, "height", UniteFunctionsBanner::getVal($setting, "height"));
                 $arrSettings[$key] = $setting;
                 break;
             case "responsitiveSettings":
                 $id = $setting["id"];
                 $setting["w1"] = UniteFunctionsBanner::getVal($arrValues, $id . "_w1", UniteFunctionsBanner::getVal($setting, "w1"));
                 $setting["w2"] = UniteFunctionsBanner::getVal($arrValues, $id . "_w2", UniteFunctionsBanner::getVal($setting, "w2"));
                 $setting["w3"] = UniteFunctionsBanner::getVal($arrValues, $id . "_w3", UniteFunctionsBanner::getVal($setting, "w3"));
                 $setting["w4"] = UniteFunctionsBanner::getVal($arrValues, $id . "_w4", UniteFunctionsBanner::getVal($setting, "w4"));
                 $setting["w5"] = UniteFunctionsBanner::getVal($arrValues, $id . "_w5", UniteFunctionsBanner::getVal($setting, "w5"));
                 $setting["w6"] = UniteFunctionsBanner::getVal($arrValues, $id . "_w6", UniteFunctionsBanner::getVal($setting, "w6"));
                 $setting["sw1"] = UniteFunctionsBanner::getVal($arrValues, $id . "_sw1", UniteFunctionsBanner::getVal($setting, "sw1"));
                 $setting["sw2"] = UniteFunctionsBanner::getVal($arrValues, $id . "_sw2", UniteFunctionsBanner::getVal($setting, "sw2"));
                 $setting["sw3"] = UniteFunctionsBanner::getVal($arrValues, $id . "_sw3", UniteFunctionsBanner::getVal($setting, "sw3"));
                 $setting["sw4"] = UniteFunctionsBanner::getVal($arrValues, $id . "_sw4", UniteFunctionsBanner::getVal($setting, "sw4"));
                 $setting["sw5"] = UniteFunctionsBanner::getVal($arrValues, $id . "_sw5", UniteFunctionsBanner::getVal($setting, "sw5"));
                 $setting["sw6"] = UniteFunctionsBanner::getVal($arrValues, $id . "_sw6", UniteFunctionsBanner::getVal($setting, "sw6"));
                 $arrSettings[$key] = $setting;
                 break;
         }
     }
     $settings->setArrSettings($arrSettings);
     //Disable settings by slider type:
     $sliderType = $settings->getSettingValue("sliderType");
     switch ($sliderType) {
         case "fixed":
         case "fullwidth":
         case "fullscreen":
             //Hide responsive
             $settingRes = $settings->getSettingByName("responsitive");
             $settingRes["disabled"] = true;
             $settings->updateArrSettingByName("responsitive", $settingRes);
             break;
     }
     //Change height to max height
     $settingSize = $settings->getSettingByName("sliderSize");
     $settingSize["sliderType"] = $sliderType;
     $settings->updateArrSettingByName("sliderSize", $settingSize);
     return $settings;
 }
Exemplo n.º 2
0
<?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);