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.
lnapp/classes/lnApp/Style.php

45 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2013-04-22 05:50:28 +00:00
<?php defined('SYSPATH') or die('No direct access allowed.');
/**
* This class is for rendering HTML style tags
*
* @package lnApp
2013-10-08 23:24:11 +00:00
* @category Helpers
2013-04-22 05:50:28 +00:00
* @author Deon George
* @copyright (c) 2009-2013 Deon George
* @license http://dev.leenooks.net/license.html
*/
abstract class lnApp_Style extends HTMLRender {
protected static $_data = array();
protected static $_spacer = "\n";
2013-04-25 00:22:36 +00:00
protected static $_c = 0;
protected $_items = array('data','media','type');
2013-05-15 12:21:34 +00:00
protected $_unique_vals = array('data');
2013-04-22 05:50:28 +00:00
2013-04-25 00:22:36 +00:00
protected static $_required_keys = array('type','data');
2013-04-22 05:50:28 +00:00
/**
* Render the style tag
*
* @see HTMLRender::render()
*/
protected function render() {
2013-12-26 10:39:49 +00:00
$record = self::$_data[$this->_x];
2013-04-22 05:50:28 +00:00
2013-04-25 00:22:36 +00:00
$output = '';
switch ($record['type']) {
case 'file':
$output .= HTML::style($record['data'],array('media'=>(! empty($record['media'])) ? $record['media'] : 'screen'));
break;
case 'stdin':
$output .= sprintf("<style type=\"text/css\">%s</style>",$record['data']);
break;
default:
throw new Kohana_Exception('Unknown style type :type',array(':type'=>$record['type']));
2013-04-22 05:50:28 +00:00
}
2013-04-25 00:22:36 +00:00
return $output;
2013-04-22 05:50:28 +00:00
}
}
?>