mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-09 03:32:00 +09:00
Fixed a bug, does not load external front end file
git-svn-id: http://xe-core.googlecode.com/svn/branches/luminous@12281 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
76fd205b4c
commit
0797d6126d
2 changed files with 23 additions and 21 deletions
|
|
@ -97,34 +97,35 @@
|
|||
if (!is_array($args)) $args = array($args);
|
||||
|
||||
$pathInfo = pathinfo($args[0]);
|
||||
$file = new stdClass();
|
||||
$file->fileName = $pathInfo['basename'];
|
||||
$file->filePath = $this->_getAbsFileUrl($pathInfo['dirname']);
|
||||
$file->fileRealPath = FileHandler::getRealPath($pathInfo['dirname']);
|
||||
$file->fileExtension = strtolower($pathInfo['extension']);
|
||||
$file->fileNameNoExt = preg_replace("/\.{$file->fileExtension}$/", '', $file->fileName);
|
||||
$file->fileNameNoExt = preg_replace('/\.min$/', '', $pathInfo['filename']);
|
||||
$file->keyName = implode('.', array($file->fileNameNoExt, $file->fileExtension));
|
||||
|
||||
// Remove .min
|
||||
$file->fileNameNoExt = preg_replace("/\.min$/", '', $file->fileNameNoExt);
|
||||
$file->fileName = $file->keyName = "{$file->fileNameNoExt}.{$file->fileExtension}";
|
||||
|
||||
// if no debug mode load minified file
|
||||
if(!__DEBUG__)
|
||||
if(strpos($file->filePath, '://') === FALSE)
|
||||
{
|
||||
$tmp = "{$file->fileNameNoExt}.min.{$file->fileExtension}";
|
||||
if(file_exists("{$file->fileRealPath}/{$tmp}"))
|
||||
if(!__DEBUG__)
|
||||
{
|
||||
$file->fileName = $tmp;
|
||||
$file->useMin = TRUE;
|
||||
// if no debug mode, load minifed file
|
||||
$minifiedFileName = implode('.', array($file->fileNameNoExt, 'min', $file->fileExtension));
|
||||
$minifiedRealPath = implode('/', array($file->fileRealPath, $minifiedFileName));
|
||||
if(file_exists($minifiedRealPath))
|
||||
{
|
||||
$file->fileName = $minifiedFileName;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Remove .min
|
||||
if(file_exists(implode('/', array($file->fileRealPath, $file->keyName))))
|
||||
{
|
||||
$file->fileName = $file->keyName;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(!$file->useMin && !file_exists("{$file->fileRealPath}/{$file->fileName}"))
|
||||
{
|
||||
$file->fileName = "{$file->fileNameNoExt}.min.{$file->fileExtension}";
|
||||
}
|
||||
|
||||
if (strpos($file->filePath, '://') == false)
|
||||
{
|
||||
$file->useCdn = $useCdn;
|
||||
$file->cdnPath = $this->_normalizeFilePath($pathInfo['dirname']);
|
||||
$file->cdnPrefix = $cdnPrefix;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ if(!defined('__XE__')) require dirname(__FILE__).'/../../Bootstrap.php';
|
|||
|
||||
require_once _XE_PATH_.'classes/handler/Handler.class.php';
|
||||
require_once _XE_PATH_.'classes/frontendfile/FrontEndFileHandler.class.php';
|
||||
require_once _XE_PATH_.'classes/file/FileHandler.class.php';
|
||||
|
||||
|
||||
class FrontEndFileHandlerTest extends PHPUnit_Framework_TestCase
|
||||
|
|
@ -16,12 +17,12 @@ class FrontEndFileHandlerTest extends PHPUnit_Framework_TestCase
|
|||
$handler = new FrontEndFileHandler();
|
||||
|
||||
// js(head)
|
||||
$handler->loadFile(array('./common/js/jquery.js'));
|
||||
$handler->loadFile(array('./common/js/jquery.min.js'));
|
||||
$handler->loadFile(array('./common/js/js_app.js'));
|
||||
$handler->loadFile(array('./common/js/common.js'));
|
||||
$handler->loadFile(array('./common/js/xml_handler.js'));
|
||||
$handler->loadFile(array('./common/js/xml_js_filter.js'));
|
||||
|
||||
|
||||
$expected[] = array('file' => '/xe/common/js/jquery.js', 'targetie' => '');
|
||||
$expected[] = array('file' => '/xe/common/js/js_app.js', 'targetie' => '');
|
||||
$expected[] = array('file' => '/xe/common/js/common.js', 'targetie' => '');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue