merge sandbox to trunk for 1.4.4.2

git-svn-id: http://xe-core.googlecode.com/svn/trunk@7944 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ngleader 2010-11-30 07:01:36 +00:00
parent 9139515e57
commit f59deeb270
131 changed files with 11605 additions and 4218 deletions

View file

@ -179,7 +179,7 @@
$buff = preg_replace('!(\n?)( *?)<\!--//(.*?)-->!is', '', $buff);
// import xml filter/ css/ js/ files <!--%import("filename"[,optimized=true|false][,media="media"][,targetie="lt IE 6|IE 7|gte IE 8|..."])--> (media is applied to only css)
$buff = preg_replace_callback('!<\!--%import\(\"([^\"]*?)\"(,optimized\=(true|false))?(,media\=\"([^\"]*)\")?(,targetie=\"([^\"]*)\")?\)-->!is', array($this, '_compileImportCode'), $buff);
$buff = preg_replace_callback('!<\!--%import\(\"([^\"]*?)\"(,optimized\=(true|false))?(,media\=\"([^\"]*)\")?(,targetie=\"([^\"]*)\")?(,index=\"([^\"]*)\")?(,type=\"([^\"]*)\")?\)-->!is', array($this, '_compileImportCode'), $buff);
// unload css/ js <!--%unload("filename"[,optimized=true|false][,media="media"][,targetie="lt IE 6|IE 7|gte IE 8|..."])--> (media is applied to only css)
$buff = preg_replace_callback('!<\!--%unload\(\"([^\"]*?)\"(,optimized\=(true|false))?(,media\=\"([^\"]*)\")?(,targetie=\"([^\"]*)\")?\)-->!is', array($this, '_compileUnloadCode'), $buff);
@ -318,7 +318,7 @@
$tmp_buff = substr($next, 0, $close_pos+strlen('</'.$tag_name.'>'));
$tag .= $tmp_buff;
$next = substr($next, strlen($tmp_buff));
if(false === strpos($tmp_buff, '<'.$tag_name)) break;
if(substr_count($tag, '<'.$tag_name) == substr_count($tag,'</'.$tag_name)) break;
}
}
@ -351,7 +351,10 @@
$next = substr($buff,$pos);
$pre_pos = strrpos($pre, '<');
$next_pos = strpos($next, '<');
preg_match('/<(\/|[a-z])/i',$next,$m);
if(!$m[0]) return $buff;
$next_pos = strpos($next, $m[0]);
$tag = substr($pre, $pre_pos). substr($next, 0, $next_pos);
$pre = substr($pre, 0, $pre_pos);
@ -387,7 +390,8 @@
$tmp_buff = substr($next, 0, $close_pos+strlen('</'.$tag_name.'>'));
$tag .= $tmp_buff;
$next = substr($next, strlen($tmp_buff));
if(false === strpos($tmp_buff, '<'.$tag_name)) break;
if(substr_count($tag, '<'.$tag_name) == substr_count($tag,'</'.$tag_name)) break;
}
$buff = $pre.$tag_head.$tag.$tag_tail.$next;
}
@ -407,7 +411,7 @@
}
$target = $m[1];
if(substr($target,0,1)=='/')
if(substr($target,0,1)=='/')
{
$target = substr($target,1);
$pos = strrpos('/',$target);
@ -452,9 +456,14 @@
$base_path = $this->path;
$target = $attrs['target'];
if(substr($target,0,2)=='./') $target = substr($target,2);
if(!substr($target,0,1)!='/') $target = $web_path.$target;
if(!preg_match('/^(http|https)/i',$target))
{
if(substr($target,0,2)=='./') $target = substr($target,2);
if(!substr($target,0,1)!='/') $target = $web_path.$target;
}
if(!$attrs['index']) $attrs['index'] = 'null';
if($attrs['type']!='body') $attrs['type'] = 'head';
// if target ends with lang, load language pack
if(substr($target, -4)=='lang') {
@ -464,7 +473,8 @@
// otherwise try to load xml, css, js file
} else {
if(substr($target,0,1)!='/') $source_filename = $base_path.$target;
if(preg_match('/^(http|https)/i',$target)) $source_filename = $target;
else if(substr($target,0,1)!='/') $source_filename = $base_path.$target;
else $source_filename = $target;
// get filename and path
@ -490,7 +500,7 @@
'?>%s',
"\n",
"\n",
$base_path,
$this->path,
$filename,
"\n",
"\n",
@ -499,15 +509,15 @@
break;
// css file
case 'css' :
if(!preg_match('/^(http|\/)/i',$source_filename)) $source_filename = $base_path.$filename;
if(!preg_match('/^(http|https|\/)/i',$source_filename)) $source_filename = $this->path.$filename;
if($type == 'unload') $output = '<?php Context::unloadCSSFile("'.$source_filename.'"); ?>';
else $output = '<?php Context::addCSSFile("'.$source_filename.'"); ?>';
else $output = '<?php Context::addCSSFile("'.$source_filename.'",false,"'.$attrs['media'].'","'.$attrs['targetie'].'",'.$attrs['index'].'); ?>';
break;
// js file
case 'js' :
if(!preg_match('/^(http|\/)/i',$source_filename)) $source_filename = $base_path.$filename;
if(!preg_match('/^(http|https|\/)/i',$source_filename)) $source_filename = $this->path.$filename;
if($type == 'unload') $output = '<?php Context::unloadJsFile("'.$source_filename.'"); ?>';
else $output = '<?php Context::addJsFile("'.$source_filename.'"); ?>';
else $output = '<?php Context::addJsFile("'.$source_filename.'",false,"'.$attrs['targetie'].'",'.$attrs['index'].',"'.$attrs['type'].'"); ?>';
break;
}
}
@ -721,6 +731,11 @@
if(!$targetie) $targetie = '';
else $optimized = 'false';
if(isset($matches[9])) $index = intval($matches[9]);
if(!$index) $index = 'null';
if(isset($matches[11])) $type = strtolower(trim($matches[11]));
if($type!='body') $type = 'head';
// if given_file ends with lang, load language pack
if(substr($given_file, -4)=='lang') {
if(substr($given_file,0,2)=='./') $given_file = substr($given_file, 2);
@ -729,7 +744,8 @@
// otherwise try to load xml, css, js file
} else {
if(substr($given_file,0,1)!='/') $source_filename = sprintf("%s%s",$base_path, $given_file);
if(preg_match('/^(http|https):/i',$given_file)) $source_filename = $given_file;
elseif(substr($given_file,0,1)!='/') $source_filename = sprintf("%s%s",$base_path, $given_file);
else $source_filename = $given_file;
// get filename and path
@ -765,19 +781,19 @@
// css file
case 'css' :
if(preg_match('/^(http|\/)/i',$source_filename)) {
$output = sprintf('<?php Context::addCSSFile("%s", %s, "%s", "%s"); ?>', $source_filename, 'false', $media, $targetie);
$output = sprintf('<?php Context::addCSSFile("%s", %s, "%s", "%s", %s); ?>', $source_filename, 'false', $media, $targetie, $index);
} else {
$meta_file = sprintf('%s%s', $base_path, $filename);
$output = sprintf('<?php Context::addCSSFile("%s%s", %s, "%s", "%s"); ?>', $base_path, $filename, $optimized, $media, $targetie);
$output = sprintf('<?php Context::addCSSFile("%s%s", %s, "%s", "%s", %s); ?>', $base_path, $filename, $optimized, $media, $targetie, $index);
}
break;
// js file
case 'js' :
if(preg_match('/^(http|\/)/i',$source_filename)) {
$output = sprintf('<?php Context::addJsFile("%s", %s, "%s"); ?>', $source_filename, 'false', $targetie);
$output = sprintf('<?php Context::addJsFile("%s", %s, "%s", %s,"%s"); ?>', $source_filename, 'false', $targetie, $index, $type);
} else {
$meta_file = sprintf('%s%s', $base_path, $filename);
$output = sprintf('<?php Context::addJsFile("%s%s", %s, "%s"); ?>', $base_path, $filename, $optimized, $targetie);
$output = sprintf('<?php Context::addJsFile("%s%s", %s, "%s", %s, "%s"); ?>', $base_path, $filename, $optimized, $targetie, $index, $type);
}
break;
}
@ -833,19 +849,17 @@
switch($ext) {
// css file
case 'css' :
if(preg_match('/^(http|\/)/i',$source_filename)) {
if(preg_match('/^(http|https|\/)/i',$source_filename)) {
$output = sprintf('<?php Context::unloadCSSFile("%s", %s, "%s", "%s"); ?>', $source_filename, 'false', $media, $targetie);
} else {
$meta_file = sprintf('%s%s', $base_path, $filename);
$output = sprintf('<?php Context::unloadCSSFile("%s%s", %s, "%s", "%s"); ?>', $base_path, $filename, $optimized, $media, $targetie);
}
break;
// js file
case 'js' :
if(preg_match('/^(http|\/)/i',$source_filename)) {
if(preg_match('/^(http|https|\/)/i',$source_filename)) {
$output = sprintf('<?php Context::unloadJsFile("%s", %s, "%s"); ?>', $source_filename, 'false', $targetie);
} else {
$meta_file = sprintf('%s%s', $base_path, $filename);
$output = sprintf('<?php Context::unloadJsFile("%s%s", %s, "%s"); ?>', $base_path, $filename, $optimized, $targetie);
}
break;