mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-05 19:12:42 +00:00
updating asset handling, closes #3149 To use compression for css and js files in vendors use Configure::write('Asset.compress', true);
Also, closes #1897 serving css and js from plugin vendors folder for paths within that plugin. Tests added. git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@6189 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
5e7f3a8287
commit
98f454bc8a
7 changed files with 300 additions and 30 deletions
|
@ -58,6 +58,14 @@ class CacheHelper extends AppHelper {
|
|||
* @access public
|
||||
*/
|
||||
var $view;
|
||||
/**
|
||||
* cache action time
|
||||
*
|
||||
* @var object
|
||||
* @access public
|
||||
*/
|
||||
var $cacheAction;
|
||||
|
||||
/**
|
||||
* Main method used to cache a view
|
||||
*
|
||||
|
@ -75,7 +83,7 @@ class CacheHelper extends AppHelper {
|
|||
$match = str_replace('/' . $this->controllerName . '/', '', $match);
|
||||
$check = str_replace($replace, '', $check);
|
||||
$check = str_replace('_' . $this->controllerName . '_', '', $check);
|
||||
$check = convertSlash($check);
|
||||
$check = Inflector::slug($check);
|
||||
$check = preg_replace('/^_+/', '', $check);
|
||||
$keys = str_replace('/', '_', array_keys($this->cacheAction));
|
||||
$found = array_keys($this->cacheAction);
|
||||
|
@ -202,7 +210,7 @@ class CacheHelper extends AppHelper {
|
|||
$cacheTime = strtotime($timestamp, $now);
|
||||
}
|
||||
|
||||
$cache = convertSlash($this->here);
|
||||
$cache = Inflector::slug($this->here);
|
||||
if (empty($cache)) {
|
||||
return;
|
||||
}
|
||||
|
@ -211,8 +219,8 @@ class CacheHelper extends AppHelper {
|
|||
$file = '<!--cachetime:' . $cacheTime . '--><?php';
|
||||
if (empty($this->plugin)) {
|
||||
$file .= '
|
||||
loadController(\'' . $this->controllerName. '\');
|
||||
loadModels();
|
||||
App::import(\'Controller\', \'' . $this->controllerName. '\');
|
||||
App::import(\'Model\');
|
||||
';
|
||||
} else {
|
||||
$file .= '
|
||||
|
@ -223,8 +231,8 @@ class CacheHelper extends AppHelper {
|
|||
require(\''.CAKE . 'app_controller.php\');
|
||||
}
|
||||
}
|
||||
loadController(\'' . $this->plugin . '.' . $this->controllerName . '\');
|
||||
loadPluginModels(\''.$this->plugin.'\');
|
||||
App::import(\'Controller\', \'' . $this->plugin . '.' . $this->controllerName. '\');
|
||||
App::import(\'Model\', \''.$this->plugin.'\');
|
||||
';
|
||||
}
|
||||
$file .= '$this->controller = new ' . $this->controllerName . 'Controller();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue