mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 02:31:40 +09:00
Added load type(head, body) in <!--%load_js_plugin()-->
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9995 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
9353d7d311
commit
bb8daf9bcd
2 changed files with 12 additions and 4 deletions
|
|
@ -1254,7 +1254,7 @@ class Context {
|
|||
/**
|
||||
* @brief javascript plugin load
|
||||
**/
|
||||
function loadJavascriptPlugin($plugin_name) {
|
||||
function loadJavascriptPlugin($plugin_name, $type='body') {
|
||||
static $loaded_plugins = array();
|
||||
|
||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
||||
|
|
@ -1273,7 +1273,7 @@ class Context {
|
|||
if(!$filename) continue;
|
||||
|
||||
if(substr($filename,0,2)=='./') $filename = substr($filename,2);
|
||||
if(preg_match('/\.js$/i', $filename)) $self->loadFile(array($plugin_path.$filename, 'body', '', 0), true);
|
||||
if(preg_match('/\.js$/i', $filename)) $self->loadFile(array($plugin_path.$filename, $type, '', 0), true);
|
||||
elseif(preg_match('/\.css$/i', $filename)) $self->loadFile(array($plugin_path.$filename, 'all', '', 0), true);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -427,7 +427,7 @@ class TemplateHandler {
|
|||
{
|
||||
$attr = array();
|
||||
if($m[5]) {
|
||||
if(preg_match_all('@,(\w+)="([^"]+)"@', $m[6], $mm)) {
|
||||
if(preg_match_all('@,(?: +)?(\w+)="([^"]+)"@', $m[6], $mm)) {
|
||||
foreach($mm[1] as $idx=>$name) {
|
||||
$attr[$name] = $mm[2][$idx];
|
||||
}
|
||||
|
|
@ -458,7 +458,15 @@ class TemplateHandler {
|
|||
$plugin = $this->_replaceVar($m[5]);
|
||||
if(strpos($plugin, '$__Context') === false) $plugin = "'{$plugin}'";
|
||||
|
||||
return "<?php Context::loadJavascriptPlugin({$plugin}); ?>";
|
||||
if($attr['type'])
|
||||
{
|
||||
$type = "'{$attr['type']}'";
|
||||
return "<?php Context::loadJavascriptPlugin({$plugin}, {$type}); ?>";
|
||||
}
|
||||
else
|
||||
{
|
||||
return "<?php Context::loadJavascriptPlugin({$plugin}); ?>";
|
||||
}
|
||||
|
||||
// <load ...> or <unload ...> or <!--%import ...--> or <!--%unload ...-->
|
||||
case 'import':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue