mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
change cdn feature
git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9017 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
b45522cdc4
commit
8062daecf3
5 changed files with 59 additions and 35 deletions
|
|
@ -1069,10 +1069,17 @@ class Context {
|
|||
* $args[2]: target IE
|
||||
* $args[3]: index
|
||||
**/
|
||||
function loadFile($args, $cdnPath = '')
|
||||
function loadFile($args, $useCdn = false, $cdnPrefix = '', $cdnVersion = '')
|
||||
{
|
||||
is_a($this,'Context')?$self=&$this:$self=&Context::getInstance();
|
||||
$self->oFrontEndFileHandler->loadFile($args, $cdnPath);
|
||||
|
||||
if ($useCdn && !$cdnPrefix)
|
||||
{
|
||||
$cdnPrefix = __XE_CDN_PREFIX__;
|
||||
$cdnVersion = __XE_CDN_VERSION__;
|
||||
}
|
||||
|
||||
$self->oFrontEndFileHandler->loadFile($args, $useCdn, $cdnPrefix, $cdnVersion);
|
||||
}
|
||||
|
||||
function unloadFile($file, $targetIe = '', $media = 'all')
|
||||
|
|
@ -1202,8 +1209,8 @@ 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));
|
||||
elseif(preg_match('/\.css$/i', $filename)) $self->loadFile(array($plugin_path.$filename, 'all', '', 0));
|
||||
if(preg_match('/\.js$/i', $filename)) $self->loadFile(array($plugin_path.$filename, 'body', '', 0), true);
|
||||
elseif(preg_match('/\.css$/i', $filename)) $self->loadFile(array($plugin_path.$filename, 'all', '', 0), true);
|
||||
}
|
||||
|
||||
if(is_dir($plugin_path.'lang')) $self->loadLang($plugin_path.'lang');
|
||||
|
|
|
|||
|
|
@ -162,30 +162,30 @@ class HTMLDisplayHandler {
|
|||
|
||||
// add common JS/CSS files
|
||||
if(__DEBUG__) {
|
||||
$oContext->loadFile(array('./common/js/jquery.js', 'head', '', -100000));
|
||||
$oContext->loadFile(array('./common/js/x.js', 'head', '', -100000));
|
||||
$oContext->loadFile(array('./common/js/common.js', 'head', '', -100000));
|
||||
$oContext->loadFile(array('./common/js/js_app.js', 'head', '', -100000));
|
||||
$oContext->loadFile(array('./common/js/xml_handler.js', 'head', '', -100000));
|
||||
$oContext->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -100000));
|
||||
$oContext->loadFile(array('./common/css/xe.css', 'all', '', -100000));
|
||||
$oContext->loadFile(array('./common/js/jquery.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/js/x.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/js/common.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/js/js_app.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/js/xml_handler.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/js/xml_js_filter.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/css/xe.css', 'all', '', -100000), true);
|
||||
} else {
|
||||
$oContext->loadFile(array('./common/js/jquery.min.js', 'head', '', -100000));
|
||||
$oContext->loadFile(array('./common/js/x.min.js', 'head', '', -100000));
|
||||
$oContext->loadFile(array('./common/js/xe.min.js', 'head', '', -100000));
|
||||
$oContext->loadFile(array('./common/css/xe.min.css', 'all', '', -100000));
|
||||
$oContext->loadFile(array('./common/js/jquery.min.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/js/x.min.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/js/xe.min.js', 'head', '', -100000), true);
|
||||
$oContext->loadFile(array('./common/css/xe.min.css', 'all', '', -100000), true);
|
||||
}
|
||||
|
||||
// for admin page, add admin css
|
||||
if(Context::get('module')=='admin' || strpos(Context::get('act'),'Admin')>0){
|
||||
if(__DEBUG__) {
|
||||
$oContext->loadFile(array('./modules/admin/tpl/css/admin.css', 'all', '', 100000));
|
||||
$oContext->loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.css", 'all', '', 100000));
|
||||
$oContext->loadFile('./modules/admin/tpl/js/admin.js');
|
||||
$oContext->loadFile(array('./modules/admin/tpl/css/admin.css', 'all', '', 100000), true);
|
||||
$oContext->loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.css", 'all', '', 100000), true);
|
||||
$oContext->loadFile('./modules/admin/tpl/js/admin.js', true);
|
||||
} else {
|
||||
$oContext->loadFile(array('./modules/admin/tpl/css/admin.min.css', 'all', '', 100000));
|
||||
$oContext->loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.min.css", 'all', '',10000));
|
||||
$oContext->loadFile('./modules/admin/tpl/js/admin.js');
|
||||
$oContext->loadFile(array('./modules/admin/tpl/css/admin.min.css', 'all', '', 100000), true);
|
||||
$oContext->loadFile(array("./modules/admin/tpl/css/admin_{$lang_type}.min.css", 'all', '',10000), true);
|
||||
$oContext->loadFile('./modules/admin/tpl/js/admin.js', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<?php
|
||||
/**
|
||||
* @class FrontEndFileHandler
|
||||
* @author NHN (developer@xpressengine.com)
|
||||
* @author NHN (developers@xpressengine.com)
|
||||
**/
|
||||
|
||||
class FrontEndFileHandler extends Handler
|
||||
|
|
@ -27,7 +27,7 @@
|
|||
* $args[2]: target IE
|
||||
* $args[3]: index
|
||||
**/
|
||||
function loadFile($args, $cdnPath = '')
|
||||
function loadFile($args, $useCdn = false, $cdnPrefix = '', $cdnVersion = '')
|
||||
{
|
||||
if (!is_array($args)) $args = array($args);
|
||||
|
||||
|
|
@ -35,7 +35,14 @@
|
|||
$file->fileName = $pathInfo['basename'];
|
||||
$file->filePath = $this->_getAbsFileUrl($pathInfo['dirname']);
|
||||
$file->fileExtension = strtolower($pathInfo['extension']);
|
||||
$file->cdnPath = $cdnPath;
|
||||
|
||||
if (strpos($file->filePath, '://') == false)
|
||||
{
|
||||
$file->useCdn = $useCdn;
|
||||
$file->cdnPath = $this->_normalizeFilePath($pathInfo['dirname']);
|
||||
$file->cdnPrefix = $cdnPrefix;
|
||||
$file->cdnVersion = $cdnVersion;
|
||||
}
|
||||
|
||||
$availableExtension = array('css', 'js');
|
||||
if (!in_array($file->fileExtension, $availableExtension)) return;
|
||||
|
|
@ -46,6 +53,7 @@
|
|||
if ($file->fileExtension == 'css')
|
||||
{
|
||||
$file->media = $args[1];
|
||||
if (!$file->media) $file->media = 'all';
|
||||
$map = &$this->cssMap;
|
||||
$mapIndex = &$this->cssMapIndex;
|
||||
$key = $file->filePath . $file->fileName . "\t" . $file->targetIe . "\t" . $file->media;
|
||||
|
|
@ -123,12 +131,13 @@
|
|||
|
||||
$dbInfo = Context::get('db_info');
|
||||
$useCdn = $dbInfo->use_cdn;
|
||||
|
||||
$result = array();
|
||||
foreach($map as $file)
|
||||
{
|
||||
if ($useCdn == 'Y' && $file->cdnPath)
|
||||
if ($useCdn == 'Y' && $file->useCdn)
|
||||
{
|
||||
$fullFilePath = __XE_CDN__ . $file->cdnPath . '/' . $file->fileName;
|
||||
$fullFilePath = $file->cdnPrefix . $file->cdnVersion . '/' . substr($file->cdnPath, 2) . '/' . $file->fileName;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -157,12 +166,13 @@
|
|||
|
||||
$dbInfo = Context::get('db_info');
|
||||
$useCdn = $dbInfo->use_cdn;
|
||||
|
||||
$result = array();
|
||||
foreach($map as $file)
|
||||
{
|
||||
if ($useCdn == 'Y' && $file->cdnPath)
|
||||
if ($useCdn == 'Y' && $file->useCdn)
|
||||
{
|
||||
$fullFilePath = __XE_CDN__ . $file->cdnPath . '/' . $file->fileName;
|
||||
$fullFilePath = $file->cdnPrefix . $file->cdnVersion . '/' . substr($file->cdnPath, 2) . '/' . $file->fileName;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
|
|
@ -527,7 +527,7 @@
|
|||
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(substr($target,0,1)!='/') $target = $web_path.$target;
|
||||
}
|
||||
|
||||
if(!$attrs['index']) $attrs['index'] = 'null';
|
||||
|
|
@ -579,19 +579,21 @@
|
|||
// css file
|
||||
case 'css' :
|
||||
if($type == 'unload') {
|
||||
$output = '<?php Context::unloadFile("'.$source_filename.'","'.$attrs['targetie'].'","'.$attrs['media'].'"); ?>';
|
||||
$output = sprintf("<?php Context::unloadFile('%s', '%s', '%s'); ?>", $source_filename, $attrs['targetie'], $attrs['media']);
|
||||
} else {
|
||||
$meta_file = $source_filename;
|
||||
$output = '<?php Context::loadFile(array("'.$source_filename.'","'.$attrs['media'].'","'.$attrs['targetie'].'","'.$attrs['index'].'"), "'.$attrs['cdn'].'"); ?>';
|
||||
$output = sprintf("<?php Context::loadFile(array('%s', '%s', '%s', '%s'), '%s', '%s', '%s'); ?>",
|
||||
$source_filename, $attrs['media'], $attrs['targetie'], $attrs['index'], $attrs['usecdn'], $attrs['cdnprefix'], $attrs['cdnversion']);
|
||||
}
|
||||
break;
|
||||
// js file
|
||||
case 'js' :
|
||||
if($type == 'unload') {
|
||||
$output = '<?php Context::unloadFile("'.$source_filename.'","'.$attrs['targetie'].'","'.$attrs['media'].'"); ?>';
|
||||
$output = sprintf("<?php Context::unloadFile('%s', '%s'); ?>", $source_filename, $attrs['targetie']);
|
||||
} else {
|
||||
$meta_file = $source_filename;
|
||||
$output = '<?php Context::loadFile(array("'.$source_filename.'","'.$attrs['type'].'","'.$attrs['targetie'].'","'.$attrs['index'].'"), "'.$attrs['cdn'].'"); ?>';
|
||||
$output = sprintf("<?php Context::loadFile(array('%s', '%s', '%s', '%s'), '%s', '%s', '%s'); ?>",
|
||||
$source_filename, $attrs['type'], $attrs['targetie'], $attrs['index'], $attrs['usecdn'], $attrs['cdnprefix'], $attrs['cdnversion']);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,9 +21,14 @@
|
|||
define('_XE_PATH_', str_replace('config/config.inc.php', '', str_replace('\\', '/', __FILE__)));
|
||||
|
||||
/**
|
||||
* @brief CDN domain
|
||||
* @brief CDN prefix
|
||||
**/
|
||||
define('__XE_CDN__', 'http://static.xpressengine.com/');
|
||||
define('__XE_CDN_PREFIX__', 'http://static.xpressengine.com/core/');
|
||||
|
||||
/**
|
||||
* @brief CDN version
|
||||
**/
|
||||
define('__XE_CDN_VERSION__', '1.0');
|
||||
|
||||
/**
|
||||
* @brief 쿠키 이외의 값에서도 세션을 인식할 수 있도록 함(파일업로드 등에서의 문제 수정)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue