mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-07 10:41:40 +09:00
Make minify option configurable by the site administrator
This commit is contained in:
parent
a4d944f23d
commit
bfaa2c170b
6 changed files with 32 additions and 2 deletions
|
|
@ -423,7 +423,7 @@ class HTMLDisplayHandler
|
|||
$oContext->loadFile(array('./common/css/xe.css', '', '', -1000000), true);
|
||||
$original_file_list = array('x.js', 'common.js', 'js_app.js', 'xml_handler.js', 'xml_js_filter.js');
|
||||
|
||||
if(__DEBUG__ || !__XE_VERSION_STABLE__)
|
||||
if(Context::getDBInfo()->minify_scripts === 'N')
|
||||
{
|
||||
$oContext->loadFile(array('./common/js/jquery-1.x.js', 'head', 'lt IE 9', -111000), true);
|
||||
$oContext->loadFile(array('./common/js/jquery.js', 'head', 'gte IE 9', -110000), true);
|
||||
|
|
|
|||
|
|
@ -143,6 +143,12 @@ class FrontEndFileHandler extends Handler
|
|||
private function getFileInfo($fileName, $targetIe = '', $media = 'all')
|
||||
{
|
||||
static $existsInfo = array();
|
||||
static $autoMinify = null;
|
||||
|
||||
if($autoMinify === null)
|
||||
{
|
||||
$autoMinify = Context::getDBInfo()->minify_scripts === 'N' ? false : true;
|
||||
}
|
||||
|
||||
if(isset($existsInfo[$existsKey]))
|
||||
{
|
||||
|
|
@ -169,7 +175,7 @@ class FrontEndFileHandler extends Handler
|
|||
$file->cdnPath = $this->_normalizeFilePath($pathInfo['dirname']);
|
||||
|
||||
// Minify file
|
||||
if(!__DEBUG__ && __XE_VERSION_STABLE__ && !$file->isMinified && strpos($file->filePath, '://') === false && strpos($file->filePath, 'common/js/plugins') === false)
|
||||
if($autoMinify && !$file->isMinified && strpos($file->filePath, '://') === false && strpos($file->filePath, 'common/js/plugins') === false)
|
||||
{
|
||||
$originalFilePath = $file->fileRealPath . '/' . $pathInfo['basename'];
|
||||
if(($file->fileExtension === 'css' || $file->fileExtension === 'js') && file_exists($originalFilePath))
|
||||
|
|
|
|||
|
|
@ -71,6 +71,7 @@ class adminAdminView extends admin
|
|||
Context::set('use_html5', $db_info->use_html5 == 'Y' ? 'Y' : 'N');
|
||||
Context::set('use_spaceremover', $db_info->use_spaceremover ? $db_info->use_spaceremover : 'Y'); //not use
|
||||
Context::set('qmail_compatibility', $db_info->qmail_compatibility == 'Y' ? 'Y' : 'N');
|
||||
Context::set('minify_scripts', $db_info->minify_scripts == 'N' ? 'N' : 'Y');
|
||||
Context::set('cache_friendly', $db_info->cache_friendly == 'Y' ? 'Y' : 'N');
|
||||
Context::set('use_db_session', $db_info->use_db_session == 'N' ? 'N' : 'Y');
|
||||
Context::set('use_mobile_view', $db_info->use_mobile_view == 'Y' ? 'Y' : 'N');
|
||||
|
|
|
|||
|
|
@ -760,6 +760,16 @@
|
|||
<value xml:lang="zh-CN"><![CDATA[启用Qmail]]></value>
|
||||
<value xml:lang="tr"><![CDATA[Qmail etkinleştirin]]></value>
|
||||
</item>
|
||||
<item name="minify_scripts">
|
||||
<value xml:lang="ko"><![CDATA[스크립트 자동 압축]]></value>
|
||||
<value xml:lang="en"><![CDATA[Auto-minify scripts]]></value>
|
||||
<value xml:lang="jp"><![CDATA[スクリプト自動圧縮]]></value>
|
||||
</item>
|
||||
<item name="about_minify_scripts">
|
||||
<value xml:lang="ko"><![CDATA[코어와 모든 모듈에 포함된 CSS, JS 파일들을 자동으로 압축(minify)하여 전송합니다.]]></value>
|
||||
<value xml:lang="en"><![CDATA[Automatically minify all CSS and JS scripts in the Core and all modules.]]></value>
|
||||
<value xml:lang="jp"><![CDATA[コアとすべてのモジュールに含まれたCSS、JSファイルを自動的に圧縮(minify)して配信します。]]></value>
|
||||
</item>
|
||||
<item name="cache_friendly">
|
||||
<value xml:lang="ko"><![CDATA[캐싱 최적화]]></value>
|
||||
<value xml:lang="en"><![CDATA[Optimize for caching]]></value>
|
||||
|
|
|
|||
|
|
@ -225,6 +225,15 @@
|
|||
<label for="qmail_compatibility_n" class="x_inline"><input type="radio" name="qmail_compatibility" id="qmail_compatibility_n" value="N" checked="checked"|cond="$qmail_compatibility!='Y'" /> {$lang->cmd_no}</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->minify_scripts}</label>
|
||||
<div class="x_controls">
|
||||
<label for="minify_scripts_y" class="x_inline"><input type="radio" name="minify_scripts" id="minify_scripts_y" value="Y" checked="checked"|cond="$minify_scripts=='Y'" /> {$lang->cmd_yes}</label>
|
||||
<label for="minify_scripts_n" class="x_inline"><input type="radio" name="minify_scripts" id="minify_scripts_n" value="N" checked="checked"|cond="$minify_scripts!='Y'" /> {$lang->cmd_no}</label>
|
||||
<br />
|
||||
<p class="x_help-block">{$lang->about_minify_scripts}</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
<label class="x_control-label">{$lang->cache_friendly}</label>
|
||||
<div class="x_controls">
|
||||
|
|
|
|||
|
|
@ -96,6 +96,9 @@ class installAdminController extends install
|
|||
$qmail_compatibility = Context::get('qmail_compatibility');
|
||||
if($qmail_compatibility!='Y') $qmail_compatibility = 'N';
|
||||
|
||||
$minify_scripts = Context::get('minify_scripts');
|
||||
if($minify_scripts!='Y') $minify_scripts = 'N';
|
||||
|
||||
$cache_friendly = Context::get('cache_friendly');
|
||||
if($cache_friendly!='Y') $cache_friendly = 'N';
|
||||
|
||||
|
|
@ -104,6 +107,7 @@ class installAdminController extends install
|
|||
|
||||
$db_info->default_url = $default_url;
|
||||
$db_info->qmail_compatibility = $qmail_compatibility;
|
||||
$db_info->minify_scripts = $minify_scripts;
|
||||
$db_info->cache_friendly = $cache_friendly;
|
||||
$db_info->use_db_session = $use_db_session;
|
||||
$db_info->use_rewrite = $use_rewrite;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue