55 lines
1.4 KiB
PHP
55 lines
1.4 KiB
PHP
<?php defined('SYSPATH') or die('No direct access allowed.');
|
|
|
|
/**
|
|
* This class is for rendering HTML style tags
|
|
*
|
|
* @package PLA
|
|
* @subpackage Page
|
|
* @category Helpers
|
|
* @author Deon George
|
|
* @copyright (c) phpLDAPadmin Development Team
|
|
* @license http://dev.phpldapadmin.org/license.html
|
|
*/
|
|
abstract class PLA_Style extends HTMLRender {
|
|
protected static $_data = array();
|
|
protected static $_spacer = "\n";
|
|
protected static $_required_keys = array('type','data');
|
|
protected static $_unique_vals = array('file'=>'type');
|
|
|
|
/**
|
|
* 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() {
|
|
$foutput = $soutput = '';
|
|
$mediapath = Route::get(static::$_media_path);
|
|
|
|
foreach (static::$_data as $value) {
|
|
switch ($value['type']) {
|
|
case 'file':
|
|
$foutput .= HTML::style($mediapath->uri(array('file'=>$value['data'])),
|
|
array('media'=>(! empty($value['media'])) ? $value['media'] : 'screen'),TRUE);
|
|
break;
|
|
case 'stdin':
|
|
$soutput .= sprintf("<style type=\"text/css\">%s</style>",$value['data']);
|
|
break;
|
|
default:
|
|
throw new Kohana_Exception('Unknown style type :type',array(':type'=>$value['type']));
|
|
}
|
|
}
|
|
|
|
return $foutput.static::$_spacer.$soutput;
|
|
}
|
|
}
|
|
?>
|