_items)) throw new Kohana_Exception('Unknown call to :name',array(':name'=>$name)); $c = $this->_x; if (! $args) return static::$_data[$c][$name]; static::$_data[$c][$name] = array_pop($args); return $this; } public function __construct() { $this->_x = ++static::$_c; } /** * Return the HTML to render the header images */ public function __toString() { if (! static::$_data) return ''; if (empty(static::$_data[$this->_x])) $this->record(); return $this->render(); try { return $this->render(); } // Display the exception message catch (Exception $e) { return $e->getMessage(); } } public static function factory() { $x = get_called_class(); return new $x; } public function record($x=NULL) { $this->_x = (is_null($x) OR empty(static::$_data[$x])) ? max(array_keys(static::$_data)) : $x; return $this; } /** * Render all of these items */ public static function render_all() { $output = ''; $o = static::factory(); for ($x=0; $xrecord($x); return $output; } /** * Set the space used between rendering output */ public static function spacer($spacer) { static::$_spacer = $spacer; } /** * Add an item to be rendered * * @param array Item to be added * @deprecated */ public static function add($item) { static::$_c = count(static::$_data); foreach (static::$_required_keys as $key) if (! isset($item[$key])) throw new Kohana_Exception('Missing key :key for image',array(':key'=>$key)); // Check for unique keys if (static::$_unique_vals) foreach (static::$_unique_vals as $v=>$u) foreach (static::$_data as $d) if (isset($d[$u]) && $d['data'] == $item['data']) return; static::$_data[++static::$_c] = $item; } } ?>