mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-22 05:15:29 +09:00
Revert "basic files의 로드를 막을 수 있도록 Context::unloadBasicFiles() 추가"
This reverts commit 35b73eec0b.
This commit is contained in:
parent
867d6930cf
commit
8db2ac16c7
2 changed files with 37 additions and 113 deletions
|
|
@ -92,12 +92,6 @@ class Context
|
||||||
*/
|
*/
|
||||||
public $canonical_url = '';
|
public $canonical_url = '';
|
||||||
|
|
||||||
/**
|
|
||||||
* unloaded basic files
|
|
||||||
* @var array
|
|
||||||
*/
|
|
||||||
public $unloaded_basic_files = array();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* language type - changed by HTTP_USER_AGENT or user's cookie
|
* language type - changed by HTTP_USER_AGENT or user's cookie
|
||||||
* @var string
|
* @var string
|
||||||
|
|
@ -2100,43 +2094,6 @@ class Context
|
||||||
self::$_oFrontEndFileHandler->unloadAllFiles($type);
|
self::$_oFrontEndFileHandler->unloadAllFiles($type);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* unload basic files that load in HTMLDisplayHandler (filename|all|common|admin|mobile)
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function unloadBasicFiles()
|
|
||||||
{
|
|
||||||
if(func_num_args() < 1)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
foreach(func_get_args() as $file)
|
|
||||||
{
|
|
||||||
self::$_instance->unloaded_basic_files[] = $file;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* get unloaded basic files
|
|
||||||
*
|
|
||||||
* @return array unloaded basic files
|
|
||||||
*/
|
|
||||||
public static function getUnloadedBasicFiles()
|
|
||||||
{
|
|
||||||
return self::$_instance->unloaded_basic_files;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* clear unloaded basic files
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function clearUnloadedBasicFiles()
|
|
||||||
{
|
|
||||||
self::$_instance->unloaded_basic_files = array();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the js file
|
* Add the js file
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -235,25 +235,18 @@ class HTMLDisplayHandler
|
||||||
Context::set('favicon_url', $favicon_url);
|
Context::set('favicon_url', $favicon_url);
|
||||||
Context::set('mobicon_url', $mobicon_url);
|
Context::set('mobicon_url', $mobicon_url);
|
||||||
|
|
||||||
// set content variable that will be inserted in common layout
|
// convert the final layout
|
||||||
Context::set('content', $output);
|
Context::set('content', $output);
|
||||||
|
$oTemplate = TemplateHandler::getInstance();
|
||||||
// load basic files
|
if(Mobile::isFromMobilePhone())
|
||||||
if(!in_array('all', Context::getUnloadedBasicFiles()))
|
|
||||||
{
|
{
|
||||||
if(Mobile::isFromMobilePhone())
|
$this->_loadMobileJSCSS();
|
||||||
{
|
|
||||||
$this->_loadMobileJSCSS();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->_loadDesktopJSCSS();
|
|
||||||
}
|
|
||||||
$this->_loadCommonJSCSS();
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
// set common layout
|
{
|
||||||
$output = TemplateHandler::getInstance()->compile('common/tpl', 'common_layout');
|
$this->_loadDesktopJSCSS();
|
||||||
|
}
|
||||||
|
$output = $oTemplate->compile('./common/tpl', 'common_layout');
|
||||||
|
|
||||||
// replace the user-defined-language
|
// replace the user-defined-language
|
||||||
$oModuleController = getController('module');
|
$oModuleController = getController('module');
|
||||||
|
|
@ -567,20 +560,20 @@ class HTMLDisplayHandler
|
||||||
* import basic .js files.
|
* import basic .js files.
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function _loadDesktopJSCSS()
|
function _loadDesktopJSCSS()
|
||||||
{
|
{
|
||||||
// add admin css
|
$lang_type = Context::getLangType();
|
||||||
if(!in_array('admin', Context::getUnloadedBasicFiles()))
|
$this->_loadCommonJSCSS();
|
||||||
|
|
||||||
|
// for admin page, add admin css
|
||||||
|
if(Context::get('module') == 'admin' || strpos(Context::get('act'), 'Admin') > 0)
|
||||||
{
|
{
|
||||||
if(Context::get('module') == 'admin' || strpos(Context::get('act'), 'Admin') > 0)
|
Context::loadFile(array('./modules/admin/tpl/css/admin.css', '', '', 10), true);
|
||||||
{
|
Context::loadFile(array("./modules/admin/tpl/css/admin.iefix.css", '', 'ie', 10), true);
|
||||||
$this->_loadBasicFile('modules/admin/tpl/css/admin.css', 10);
|
Context::loadFile('./modules/admin/tpl/js/admin.js', true);
|
||||||
$this->_loadBasicFile('modules/admin/tpl/css/admin.iefix.css', 10, '', true);
|
Context::loadFile(array('./modules/admin/tpl/css/admin.bootstrap.css', '', '', 1), true);
|
||||||
$this->_loadBasicFile('modules/admin/tpl/css/admin.bootstrap.css', 1);
|
Context::loadFile(array('./modules/admin/tpl/js/jquery.tmpl.js', '', '', 1), true);
|
||||||
$this->_loadBasicFile('modules/admin/tpl/js/admin.js');
|
Context::loadFile(array('./modules/admin/tpl/js/jquery.jstree.js', '', '', 1), true);
|
||||||
$this->_loadBasicFile('modules/admin/tpl/js/jquery.tmpl.js', 1);
|
|
||||||
$this->_loadBasicFile('modules/admin/tpl/js/jquery.jstree.js', 1);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -589,12 +582,8 @@ class HTMLDisplayHandler
|
||||||
*/
|
*/
|
||||||
private function _loadMobileJSCSS()
|
private function _loadMobileJSCSS()
|
||||||
{
|
{
|
||||||
if(in_array('mobile', Context::getUnloadedBasicFiles()))
|
$this->_loadCommonJSCSS();
|
||||||
{
|
Context::loadFile(array('./common/css/mobile.css', '', '', -1500000000), true);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->_loadBasicFile('common/css/mobile.css', -1500000000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -602,12 +591,7 @@ class HTMLDisplayHandler
|
||||||
*/
|
*/
|
||||||
private function _loadCommonJSCSS()
|
private function _loadCommonJSCSS()
|
||||||
{
|
{
|
||||||
if(in_array('common', Context::getUnloadedBasicFiles()))
|
Context::loadFile(array('./common/css/rhymix.less', '', '', -1600000000), true);
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$jquery_version = preg_match('/MSIE [5-8]\./', $_SERVER['HTTP_USER_AGENT']) ? self::JQUERY_V1 : self::JQUERY_V2;
|
|
||||||
$original_file_list = array(
|
$original_file_list = array(
|
||||||
'plugins/jquery.migrate/jquery-migrate-1.4.1.min.js',
|
'plugins/jquery.migrate/jquery-migrate-1.4.1.min.js',
|
||||||
'plugins/blankshield/blankshield.min.js',
|
'plugins/blankshield/blankshield.min.js',
|
||||||
|
|
@ -618,57 +602,40 @@ class HTMLDisplayHandler
|
||||||
'xml_handler.js',
|
'xml_handler.js',
|
||||||
'xml_js_filter.js',
|
'xml_js_filter.js',
|
||||||
);
|
);
|
||||||
|
$jquery_version = preg_match('/MSIE [5-8]\./', $_SERVER['HTTP_USER_AGENT']) ? self::JQUERY_V1 : self::JQUERY_V2;
|
||||||
$this->_loadBasicFile('common/css/rhymix.less', -1600000000);
|
|
||||||
$this->_loadBasicFile('common/js/jquery-' . $jquery_version . (config('view.minify_scripts') !== 'none' ? '.min' : '') . '.js', -1800000000, 'head');
|
|
||||||
|
|
||||||
if(config('view.minify_scripts') === 'none')
|
if(config('view.minify_scripts') === 'none')
|
||||||
{
|
{
|
||||||
|
Context::loadFile(array('./common/js/jquery-' . $jquery_version . '.js', 'head', '', -1800000000), true);
|
||||||
foreach($original_file_list as $filename)
|
foreach($original_file_list as $filename)
|
||||||
{
|
{
|
||||||
$this->_loadBasicFile('common/js/' . $filename, -1700000000, 'head');
|
Context::loadFile(array('./common/js/' . $filename, 'head', '', -1700000000), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Context::loadFile(array('./common/js/jquery-' . $jquery_version . '.min.js', 'head', '', -1800000000), true);
|
||||||
$concat_target_filename = 'files/cache/assets/minified/rhymix.min.js';
|
$concat_target_filename = 'files/cache/assets/minified/rhymix.min.js';
|
||||||
if(file_exists(\RX_BASEDIR . $concat_target_filename))
|
if(file_exists(\RX_BASEDIR . $concat_target_filename))
|
||||||
{
|
{
|
||||||
$original_mtime = 0;
|
|
||||||
$concat_target_mtime = filemtime(\RX_BASEDIR . $concat_target_filename);
|
$concat_target_mtime = filemtime(\RX_BASEDIR . $concat_target_filename);
|
||||||
|
$original_mtime = 0;
|
||||||
foreach($original_file_list as $filename)
|
foreach($original_file_list as $filename)
|
||||||
{
|
{
|
||||||
$original_mtime = max($original_mtime, filemtime(\RX_BASEDIR . 'common/js/' . $filename));
|
$original_mtime = max($original_mtime, filemtime(\RX_BASEDIR . 'common/js/' . $filename));
|
||||||
}
|
}
|
||||||
if($concat_target_mtime > $original_mtime)
|
if($concat_target_mtime > $original_mtime)
|
||||||
{
|
{
|
||||||
$no_renew = true;
|
Context::loadFile(array('./' . $concat_target_filename, 'head', '', -1700000000), true);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(!isset($no_renew))
|
Rhymix\Framework\Formatter::minifyJS(array_map(function($str) {
|
||||||
{
|
return \RX_BASEDIR . 'common/js/' . $str;
|
||||||
$target_file_list = array();
|
}, $original_file_list), \RX_BASEDIR . $concat_target_filename);
|
||||||
foreach($original_file_list as $filename)
|
Context::loadFile(array('./' . $concat_target_filename, 'head', '', -1700000000), true);
|
||||||
{
|
|
||||||
$target_file_list[] = \RX_BASEDIR . 'common/js/' . $filename;
|
|
||||||
}
|
|
||||||
Rhymix\Framework\Formatter::minifyJS($target_file_list, \RX_BASEDIR . $concat_target_filename);
|
|
||||||
}
|
|
||||||
$this->_loadBasicFile($concat_target_filename, -1700000000, 'head');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* load basic file
|
|
||||||
*/
|
|
||||||
private function _loadBasicFile($filename, $index = 0, $type = '', $ie = false)
|
|
||||||
{
|
|
||||||
if(in_array(pathinfo($filename, PATHINFO_BASENAME), Context::getUnloadedBasicFiles()))
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Context::loadFile(array($filename, $type, $ie ? 'ie' : '', $index));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
/* End of file HTMLDisplayHandler.class.php */
|
/* End of file HTMLDisplayHandler.class.php */
|
||||||
/* Location: ./classes/display/HTMLDisplayHandler.class.php */
|
/* Location: ./classes/display/HTMLDisplayHandler.class.php */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue