mirror of
https://github.com/e107inc/e107.git
synced 2025-07-31 20:00:37 +02:00
e107::css() and e107::js() functions added.
This commit is contained in:
@@ -3679,7 +3679,13 @@ class eResponse
|
|||||||
*/
|
*/
|
||||||
public function addMeta($name = null, $content = null, $extended = array())
|
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();
|
$attr = array();
|
||||||
|
|
||||||
if(null !== $name) $attr['name'] = $name;
|
if(null !== $name) $attr['name'] = $name;
|
||||||
if(null !== $content) $attr['content'] = $content;
|
if(null !== $content) $attr['content'] = $content;
|
||||||
if(!empty($extended))
|
if(!empty($extended))
|
||||||
@@ -3698,7 +3704,6 @@ class eResponse
|
|||||||
*/
|
*/
|
||||||
public function renderMeta()
|
public function renderMeta()
|
||||||
{
|
{
|
||||||
|
|
||||||
$attrData = '';
|
$attrData = '';
|
||||||
|
|
||||||
foreach ($this->_meta as $attr)
|
foreach ($this->_meta as $attr)
|
||||||
|
@@ -1371,6 +1371,88 @@ class e107
|
|||||||
return e107::getUrl()->response()->addMeta($name, $content, $extended);
|
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.
|
* Retrieve admin dispatcher instance.
|
||||||
* It's instance is self registered (for now, this could change in the future) on initialization (__construct())
|
* It's instance is self registered (for now, this could change in the future) on initialization (__construct())
|
||||||
|
Reference in New Issue
Block a user