get_called_class())); } /** * Add an item to be rendered * * @param array Item to be added */ public static function add($item,$prepend=FALSE) { 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; if ($prepend) array_unshift(static::$_data,$item); else array_push(static::$_data,$item); } /** * Set the space used between rendering output */ public static function setSpacer($spacer) { static::$_spacer = $spacer; } /** * Set the Kohana Media Path, used to determine where to find additional * HTML content required for rendering. */ public static function setMediaPath($path) { static::$_media_path = $path; } /** * Factory instance method must be declared by the child class */ public static function factory() { throw new Kohana_Exception(':class is calling :method, when it should have its own method', array(':class'=>get_called_class(),':method'=>__METHOD__)); } /** * Return the HTML to render the header images */ public function __toString() { try { return static::render(); } // Display the exception message catch (Exception $e) { Kohana::exception_handler($e); return ''; } } /** * Rendering must be declared by the child class */ protected function render() { throw new Kohana_Exception(':class is calling :method, when it should have its own method', array(':class'=>get_called_class(),':method'=>__METHOD__)); } } ?>