Themeing work based on bootstrap
This commit is contained in:
@@ -12,18 +12,10 @@
|
||||
abstract class lnApp_Script extends HTMLRender {
|
||||
protected static $_data = array();
|
||||
protected static $_spacer = "\n";
|
||||
protected static $_required_keys = array('type','data');
|
||||
protected static $_unique_vals = array('file'=>'type');
|
||||
protected static $_rendered = FALSE;
|
||||
protected static $_c = 0;
|
||||
protected $_items = array('data','media','type');
|
||||
|
||||
/**
|
||||
* Return an instance of this class
|
||||
*
|
||||
* @return Script
|
||||
*/
|
||||
public static function factory() {
|
||||
return new Script;
|
||||
}
|
||||
protected static $_required_keys = array('type','data');
|
||||
|
||||
/**
|
||||
* Render the script tag
|
||||
@@ -31,34 +23,24 @@ abstract class lnApp_Script extends HTMLRender {
|
||||
* @see HTMLRender::render()
|
||||
*/
|
||||
protected function render() {
|
||||
$foutput = $soutput = '';
|
||||
$mediapath = Route::get(static::$_media_path);
|
||||
$record = static::$_data[$this->_x];
|
||||
$output = '';
|
||||
|
||||
foreach (static::$_data as $value) {
|
||||
switch ($value['type']) {
|
||||
case 'file':
|
||||
$foutput .= HTML::script($mediapath->uri(array('file'=>$value['data'])));
|
||||
break;
|
||||
case 'src':
|
||||
$foutput .= HTML::script($value['data']);
|
||||
break;
|
||||
case 'stdin':
|
||||
$soutput .= sprintf("<script type=\"text/javascript\">//<![CDATA[\n%s\n//]]></script>",$value['data']);
|
||||
break;
|
||||
default:
|
||||
throw new Kohana_Exception('Unknown style type :type',array(':type'=>$value['type']));
|
||||
}
|
||||
switch ($record['type']) {
|
||||
case 'file':
|
||||
$output .= HTML::script($record['data']);
|
||||
break;
|
||||
case 'stdin':
|
||||
$output .= sprintf("<script type=\"text/javascript\">//<![CDATA[\n%s\n//]]></script>",$record['data']);
|
||||
break;
|
||||
case 'src':
|
||||
$output .= HTML::script($record['data']);
|
||||
break;
|
||||
default:
|
||||
throw new Kohana_Exception('Unknown style type :type',array(':type'=>$record['type']));
|
||||
}
|
||||
|
||||
static::$_rendered = TRUE;
|
||||
return $foutput.static::$_spacer.$soutput;
|
||||
}
|
||||
|
||||
public static function add($item,$prepend=FALSE,$x='') {
|
||||
if (static::$_rendered)
|
||||
throw new Kohana_Exception('Already rendered?');
|
||||
|
||||
return parent::add($item,$prepend);
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
Reference in New Issue
Block a user