Beispiel #1
0
 /**
  * Returns one of this asset's sections if applicable
  *
  * @return ICE_Asset
  */
 public final function get_section($name)
 {
     if (is_string($name)) {
         return $this->sections->item_at($name);
     } else {
         return $this;
     }
 }
Beispiel #2
0
 /**
  * Get policy instance
  *
  * @param string $class Return policy instance which is instance of this class
  * @return ICE_Policy
  */
 public static function instance($class = null)
 {
     // init instances map
     if (!self::$instances instanceof ICE_Map) {
         self::$instances = new ICE_Map();
     }
     // is this a lookup?
     if ($class) {
         foreach (self::$instances as $instance) {
             if ($instance instanceof $class) {
                 return $instance;
             }
         }
     } else {
         // create new instance?
         if (!self::$instances->contains(self::$calling_class)) {
             self::$instances->add(self::$calling_class, new self::$calling_class());
         }
         // return it
         return self::$instances->item_at(self::$calling_class);
     }
 }
Beispiel #3
0
 /**
  * Load one component given its name and config array
  *
  * @param string $name
  * @param array $config_array
  * @return boolean
  */
 protected final function load_config_map($name, $config_array)
 {
     // normalize name
     $name = $this->normalize_name($name);
     // push theme onto config
     $config_array['theme'] = self::theme_scope();
     // check if already registered
     if ($this->components->contains($name)) {
         // use that one
         $component = $this->components->item_at($name);
     } else {
         // use factory to create new component
         $component = $this->policy()->factory()->create($name, $config_array);
         // register component
         $this->register($component);
     }
     // push configuration
     $component->config_array($config_array);
     // post registration
     if ($component->supported()) {
         $component->init_registered();
     }
     return true;
 }
 /**
  * Return fstat object for filename
  *
  * @param string $filename
  * @return ICE_File|null
  */
 public function item_at($filename)
 {
     return parent::item_at($this->hash($filename));
 }
 /**
  * Add dep to an existing style
  *
  * This only applies to styles handled by this special enqueuer
  *
  * @param string $handle
  * @param string $dep
  */
 public function style_dep($handle, $dep)
 {
     if ($this->styles->contains($dep)) {
         $this->styles->item_at($handle)->item_at(self::TRIGGER_DEPS)->push($dep);
     }
 }
Beispiel #6
0
 /**
  * Return information of about loaded extensions
  *
  * @param string $class_name the extension's class name
  * @param boolean $return_array set to true to return an array of the extension name parts
  * @return boolean|array
  */
 public final function loaded($class_name, $return_array = false)
 {
     // is class in loaded map?
     if ($this->loaded->contains($class_name)) {
         // yep return array or true
         return $return_array ? $this->loaded->item_at($class_name) : true;
     }
     // class not loaded
     return false;
 }
Beispiel #7
0
 /**
  * Add enumeration as a possible value type
  */
 public function add_enum($string, $desc = null)
 {
     if (!$this->valmap->contains(self::KEY_ENUM)) {
         $this->valmap->add(self::KEY_ENUM, new ICE_Style_Value_Enum());
     }
     $this->valmap->item_at(self::KEY_ENUM)->add($string, $desc);
     return $this;
 }
Beispiel #8
0
 /**
  * Get an export instance for handle
  *
  * @param string $handle
  * @return ICE_Export
  */
 public function get($handle)
 {
     if ($this->exports->contains($handle)) {
         return $this->exports->item_at($handle);
     } else {
         throw new Exception(sprintf('The "%s" handle is not registered'), $handle);
     }
 }
Beispiel #9
0
    /**
     * Recursively render a map of values
     *
     * @param ICE_Map $map
     * @param ICE_Map $map_last
     */
    protected function render_value_map(ICE_Map $map, ICE_Map $map_last = null)
    {
        // open list
        ?>
		<ul><?php 
        foreach ($map as $key => $value) {
            // inline styles
            $style_attr = null;
            // strike through the text?
            if ($map_last instanceof ICE_Map) {
                if ($map_last->contains($key)) {
                    // get the value
                    $map_value = $map_last->item_at($key);
                    // strike or not?
                    if ($map_value instanceof ICE_Map) {
                        // map to compare on next loop
                        $map_next = $map_value;
                    } elseif ($map_value !== $value) {
                        // strike it!
                        $style_attr = ' style="text-decoration: line-through;"';
                    }
                }
            }
            // render item
            ?>
			<li id="<?php 
            $this->render_item_id($key);
            ?>
" class="jstree-open"<?php 
            print $style_attr;
            ?>
>
				<?php 
            if ($value instanceof ICE_Map) {
                ?>
					<a>[<?php 
                print $key;
                ?>
]</a>
					<?php 
                $this->render_value_map($value, $map_next);
                ?>
				<?php 
            } else {
                ?>
					<span>
						<em><?php 
                print $key;
                ?>
 </em> =
						<?php 
                if (is_scalar($value) && null !== $value) {
                    ?>
							<?php 
                    $this->render_value($value);
                    ?>
						<?php 
                } else {
                    ?>
							<?php 
                    _e('null', infinity_text_domain);
                    ?>
						<?php 
                }
                ?>
					</span>
				<?php 
            }
            ?>
			</li><?php 
            $this->render_item_id();
        }
        // close list
        ?>
		</ul><?php 
    }