1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 12:48:24 +01:00

e107::css() and e107::js() functions added.

This commit is contained in:
CaMer0n 2012-05-13 05:53:48 +00:00
parent 546d930311
commit 34f37ce9f7
2 changed files with 88 additions and 1 deletions

View File

@ -3679,7 +3679,13 @@ class eResponse
*/
public function addMeta($name = null, $content = null, $extended = array())
{
if(empty($content)){ return $this; } // content is required, otherwise ignore.
//TODO need an option that allows subsequent entries to overwrite existing ones.
//ie. 'description' and 'keywords' should never be duplicated, but overwritten by plugins and other non-pref-based meta data.
$attr = array();
if(null !== $name) $attr['name'] = $name;
if(null !== $content) $attr['content'] = $content;
if(!empty($extended))
@ -3698,7 +3704,6 @@ class eResponse
*/
public function renderMeta()
{
$attrData = '';
foreach ($this->_meta as $attr)

View File

@ -1370,6 +1370,88 @@ class e107
{
return e107::getUrl()->response()->addMeta($name, $content, $extended);
}
/**
* CSS Common Public Function
* @var string $type - core | inline | theme | other | (plugin folder name)
*/
public static function css($type = null, $file_path = null, $media = 'all', $preComment = '', $postComment = '')
{
if($type == 'core')
{
return e107::getJs()->coreCSS($file_path, $media, $preComment, $postComment);
}
if($type == 'inline')
{
return e107::getJs()->inlineCSS($file_path, $media);
}
if($type == 'theme')
{
return e107::getJs()->themeCSS($file_path, $media, $preComment, $postComment);
}
if($type == 'other')
{
return e107::getJs()->otherCSS($file_path, $media, $preComment, $postComment);
}
if($this->isInstalled($type)) // plugin
{
return e107::getJs()->pluginCSS($type, $file_path, $media, $preComment, $postComment);
}
}
/**
* JS Common Public Function
* @var string $type - core | file | header_inline | footer | footer_inline | theme | (plugin folder name)
*/
public static function js($type, $file_path ='', $zone='')
{
if($type == 'core')
{
if(empty($zone)){ $zone = 2; }
return e107::getJs()->headerCore($file_path, $zone);
}
if($type == 'file' || $type == 'header')
{
if(empty($zone)){ $zone = 5; }
e107::getJs()->headerFile($file_path, $zone);
}
if($type == 'header_inline')
{
if(empty($zone)){ $zone = 5; }
e107::getJs()->headerInline($file_path, $zone);
}
if($type == 'footer_inline')
{
if(empty($zone)){ $zone = 5; }
e107::getJs()->footerInline($file_path, $zone);
}
if($type == 'footer')
{
if(empty($zone)){ $zone = 2; }
e107::getJs()->footerFile($file_path, $zone);
}
if($type=='theme')
{
if(empty($zone)){ $zone = 5; }
return e107::getJs()->headerTheme($file_path, $zone);
}
if($this->isInstalled($type)) // plugin
{
return e107::getJs()->headerPlugin($type, $file_path);
}
}
/**
* Retrieve admin dispatcher instance.