This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
phptsmadmin/application/classes/lnapp/style.php
2011-05-01 13:51:45 +10:00

55 lines
1.2 KiB
PHP

<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class is for rendering HTML style tags
*
* @package lnApp
* @subpackage Page
* @category Helpers
* @author Deon George
* @copyright (c) 2010 Deon George
* @license http://dev.leenooks.net/license.html
*/
class lnApp_Style extends HTMLRender {
protected static $_data = array();
protected static $_spacer = "\n";
protected static $_required_keys = array('type','data');
/**
* Return an instance of this class
*
* @return Style
*/
public static function factory() {
return new Style;
}
/**
* Render the style tag
*
* @see HTMLRender::render()
*/
protected function render() {
$output = '';
$mediapath = Route::get(static::$_media_path);
$i = 0;
foreach (static::$_data as $value) {
if ($i++)
$output .= static::$_spacer;
switch ($value['type']) {
case 'file':
$output .= HTML::style($mediapath->uri(array('file'=>$value['data'])),
array('media'=>(! empty($value['media'])) ? $value['media'] : 'screen'),TRUE);
break;
default:
throw new Kohana_Exception('Unknown style type :type',array(':type'=>$value['type']));
}
}
return $output;
}
}
?>