예제 #1
0
파일: Theme.php 프로젝트: jawngee/Stem
 public function __get($name)
 {
     assert($this->context != null, 'Context can not be null for a Theme model.');
     if (isset($_POST['wp_customize']) && $_POST['wp_customize'] == 'on') {
         $value = arrayPath($_POST, "customized/{$name}", false);
         if ($value) {
             return $value;
         }
     }
     if (!isset($this->values[$name])) {
         $val = get_option($name);
         if (!$val) {
             $val = $this->context->ui->setting("customizer/settings/{$name}/default", null);
         }
         $this->values[$name] = $val;
     }
     return $this->values[$name];
 }
예제 #2
0
 /**
  * Creates a new configuration object for the requested group.
  * @param string $group
  * @param bool $reload
  * @return array
  */
 public static function config($group, $reload = false)
 {
     static $config;
     if (strpos($group, '.') !== false) {
         // Split the config group and path
         list($group, $path) = explode('.', $group, 2);
     }
     if (!isset($config[$group]) or $reload) {
         // Load the config group into the cache
         $config[$group] = self::$config->load($group);
     }
     if (isset($path)) {
         return arrayPath($config[$group], $path);
     } else {
         return $config[$group];
     }
 }
예제 #3
0
파일: Admin.php 프로젝트: jawngee/Stem
 /**
  * Returns a setting using a path string, eg 'options/views/engine'.  Consider this
  * a poor man's xpath.
  *
  * @param $settingPath The "path" in the config settings to look up.
  * @param bool|mixed $default The default value to return if the settings doesn't exist.
  *
  * @return bool|mixed The result
  */
 public function setting($settingPath, $default = false)
 {
     return arrayPath($this->config, $settingPath, $default);
 }