48 lines
1.2 KiB
PHP
48 lines
1.2 KiB
PHP
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
/**
|
|
* This class is for rendering HTML script tags
|
|
*
|
|
* @package lnApp
|
|
* @category Helpers
|
|
* @author Deon George
|
|
* @copyright (c) 2009-2013 Deon George
|
|
* @license http://dev.leenooks.net/license.html
|
|
*/
|
|
abstract class lnApp_Script extends HTMLRender {
|
|
protected static $_data = array();
|
|
protected static $_spacer = "\n";
|
|
protected static $_c = 0;
|
|
protected $_items = array('data','media','type');
|
|
protected $_unique_vals = array('data');
|
|
|
|
protected static $_required_keys = array('type','data');
|
|
|
|
/**
|
|
* Render the script tag
|
|
*
|
|
* @see HTMLRender::render()
|
|
*/
|
|
protected function render() {
|
|
$record = self::$_data[$this->_x];
|
|
$output = '';
|
|
|
|
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']));
|
|
}
|
|
|
|
return $output;
|
|
}
|
|
}
|
|
?>
|