/**
  * set category by post type, with specific name (can be regular or woocommerce)
  */
 public static function setCategoryByPostTypes(UniteSettingsBiz $settings, $arrValues, $postTypesWithCats, $nameType, $nameCat, $defaultType)
 {
     //update the categories list by the post types
     $postTypes = UniteFunctionsBiz::getVal($arrValues, $nameType, $defaultType);
     if (strpos($postTypes, ",") !== false) {
         $postTypes = explode(",", $postTypes);
     } else {
         $postTypes = array($postTypes);
     }
     $arrCats = array();
     $globalCounter = 0;
     $arrCats = array();
     $isFirst = true;
     foreach ($postTypes as $postType) {
         $cats = UniteFunctionsBiz::getVal($postTypesWithCats, $postType, array());
         if ($isFirst == true) {
             $firstValue = self::getFirstCategory($cats);
             $isFirst = false;
         }
         $arrCats = array_merge($arrCats, $cats);
     }
     $settingCategory = $settings->getSettingByName($nameCat);
     $settingCategory["items"] = $arrCats;
     $settings->updateArrSettingByName($nameCat, $settingCategory);
     //update value to first category
     $value = $settings->getSettingValue($nameCat);
     if (empty($value)) {
         $settings->updateSettingValue($nameCat, $firstValue);
     }
     return $settings;
 }
예제 #2
0
<?php

$generalSettings = new UniteSettingsBiz();
$generalSettings->addRadio("includes_globally", array("on" => __("On", SHOWBIZ_TEXTDOMAIN), "off" => __("Off", SHOWBIZ_TEXTDOMAIN)), __("Include Showbiz libraries globally", SHOWBIZ_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 showbiz shortcode exists only. This will work only when the slider added by a shortcode.", SHOWBIZ_TEXTDOMAIN)));
$generalSettings->addRadio("includes_globally_facybox", array("on" => __("On", SHOWBIZ_TEXTDOMAIN), "off" => __("Off", SHOWBIZ_TEXTDOMAIN)), __("Include Fancybox libraries", SHOWBIZ_TEXTDOMAIN), "on", array("description" => "<br>" . __("Add css and js includes from fanxybox. If off, fancybox will not work if your selected theme doe snot include fancybox", SHOWBIZ_TEXTDOMAIN)));
$generalSettings->addRadio("includes_globally_facybox_be", array("on" => __("On", SHOWBIZ_TEXTDOMAIN), "off" => __("Off", SHOWBIZ_TEXTDOMAIN)), __("Include Fancybox libraries in backend (for preview reasons)", SHOWBIZ_TEXTDOMAIN), "on", array("description" => "<br>" . __("Add css and js includes from fanxybox in backend. If off, fancybox will not work o preview mode", SHOWBIZ_TEXTDOMAIN)));
$generalSettings->addTextBox("pages_for_includes", "", __("Pages to include ShowBiz libraries", SHOWBIZ_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", SHOWBIZ_TEXTDOMAIN)));
$generalSettings->addRadio("js_to_footer", array("on" => __("On", SHOWBIZ_TEXTDOMAIN), "off" => __("Off", SHOWBIZ_TEXTDOMAIN)), __("Put JS Includes To Footer", SHOWBIZ_TEXTDOMAIN), "off", array("description" => "<br>" . __("Putting the js to footer (instead of the head) is good for fixing some javascript conflicts.", SHOWBIZ_TEXTDOMAIN)));
//get stored values
$operations = new BizOperations();
$arrValues = $operations->getGeneralSettingsValues();
$generalSettings->setStoredValues($arrValues);
self::storeSettings("general", $generalSettings);
예제 #3
0
 /**
  * 
  * add settings from another settings object
  */
 public function addFromSettingsObject(UniteSettingsBiz $settings)
 {
     $arrSettings = $settings->getArrSettings();
     foreach ($arrSettings as $value) {
         $this->arrSettings[] = $value;
     }
 }