Ejemplo n.º 1
0
 /**
  */
 protected function load_config_section($section_name, $section_array)
 {
     // not a feature option by default
     $feature_option = null;
     // sub option syntax?
     if (strpos($section_name, self::SUB_OPTION_DELIM)) {
         // yes, split at special delim
         $parts = explode(self::SUB_OPTION_DELIM, $section_name);
         // feature is the first part
         $feature = $parts[0];
         // name is the second part
         $feature_option = $parts[1];
     } else {
         // feature name is section name
         $feature = $section_name;
     }
     // does theme support this feature?
     if (current_theme_supports($feature)) {
         // yes, options component enabled?
         if ($feature_option && $this->policy()->options() instanceof ICE_Policy) {
             // inject feature atts into config array
             $section_array['feature'] = $feature;
             // is it a sub option?
             if ($this->policy()->options()->registry()->load_feature_option($feature_option, $section_array)) {
                 // yes, skip standard loading
                 return true;
             }
         } else {
             // load like a regular feature
             return parent::load_config_section($section_name, $section_array);
         }
     }
     // feature config *not* loaded
     return false;
 }
Ejemplo n.º 2
0
 /**
  * Return the registry instance
  *
  * @return ICE_Registry
  */
 public final function registry()
 {
     // handle empty registry
     if (!$this->registry instanceof ICE_Registry) {
         $this->registry = $this->new_registry();
         $this->registry->policy($this);
     }
     return $this->registry;
 }
Ejemplo n.º 3
0
 /**
  * Load directives from an ini file
  *
  * @uses parse_ini_file()
  * @param string $filename Absolute path to the component ini file to parse
  * @param string $theme The theme to assign the parsed directives to
  * @return boolean
  */
 public final function load_config_file($filename, $theme)
 {
     // try to parse the file into INI sections
     $sections = parse_ini_file($filename, true);
     // get a config?
     if ($sections) {
         // set the current theme being loaded
         self::$theme_scope = $theme;
         // load all parsed sections
         $result = $this->load_config_sections($sections);
         // remove theme scope
         self::$theme_scope = null;
         // all done
         return $result;
     }
     return false;
 }
Ejemplo n.º 4
0
 /**
  * Return registered options as an array
  *
  * @param ICE_Section $section Limit options to one section by passing a section object
  * @return array
  */
 public function get_for_section(ICE_Section $section)
 {
     // options to return
     $options = array();
     // loop through and compare names
     foreach (parent::get_all() as $option) {
         // do section names match?
         if ($section->property('name') != $option->property('section')) {
             continue;
         }
         // add to array
         $options[] = $option;
     }
     // return them
     return $options;
 }
Ejemplo n.º 5
0
 /**
  * Format a suboption name using the glue character defined in the registry
  *
  * @param string $name
  * @return string
  */
 public function format_suboption($name)
 {
     // call registry suboption format helper
     return ICE_Registry::format_suboption($this->name, $name);
 }