mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-09-06 19:42:41 +00:00
Replacing $pluginPath loops with App::pluginPath(). Minor optimization for App::pluginPath().
This commit is contained in:
parent
3a85197f25
commit
ecc7d9b303
4 changed files with 9 additions and 29 deletions
|
@ -677,9 +677,9 @@ class App extends Object {
|
|||
function pluginPath($plugin) {
|
||||
$_this =& App::getInstance();
|
||||
$pluginDir = Inflector::underscore($plugin);
|
||||
foreach ($_this->plugins as $path) {
|
||||
if (is_dir($path . $pluginDir)) {
|
||||
return $path . $pluginDir . DS ;
|
||||
for ($i = 0, $length = count($_this->plugins); $i < $length; $i++) {
|
||||
if (is_dir($_this->plugins[$i] . $pluginDir)) {
|
||||
return $_this->plugins[$i] . $pluginDir . DS ;
|
||||
}
|
||||
}
|
||||
return $_this->plugins[0] . $pluginDir . DS;
|
||||
|
|
|
@ -272,14 +272,10 @@ class I18n extends Object {
|
|||
$plugins = App::objects('plugin');
|
||||
|
||||
if (!empty($plugins)) {
|
||||
$pluginPaths = App::path('plugins');
|
||||
|
||||
foreach ($plugins as $plugin) {
|
||||
$plugin = Inflector::underscore($plugin);
|
||||
if ($plugin === $domain) {
|
||||
foreach ($pluginPaths as $pluginPath) {
|
||||
$searchPaths[] = $pluginPath . $plugin . DS . 'locale' . DS;
|
||||
}
|
||||
$searchPaths[] = App::pluginPath($plugin) . DS . 'locale' . DS;
|
||||
$searchPaths = array_reverse($searchPaths);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -937,12 +937,7 @@ class View extends Object {
|
|||
$paths[] = $viewPaths[$i] . 'plugins' . DS . $plugin . DS;
|
||||
}
|
||||
}
|
||||
$pluginPaths = App::path('plugins');
|
||||
$count = count($pluginPaths);
|
||||
|
||||
for ($i = 0; $i < $count; $i++) {
|
||||
$paths[] = $pluginPaths[$i] . $plugin . DS . 'views' . DS;
|
||||
}
|
||||
$paths[] = App::pluginPath($plugin) . 'views' . DS;
|
||||
}
|
||||
$paths = array_merge($paths, $viewPaths);
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
<?php
|
||||
/* SVN FILE: $Id$ */
|
||||
|
||||
/**
|
||||
* CakeTestCase file
|
||||
*
|
||||
|
@ -9,20 +7,17 @@
|
|||
* PHP versions 4 and 5
|
||||
*
|
||||
* CakePHP(tm) Tests <https://trac.cakephp.org/wiki/Developement/TestSuite>
|
||||
* Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||
* Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||
*
|
||||
* Licensed under The Open Group Test Suite License
|
||||
* Redistributions of files must retain the above copyright notice.
|
||||
*
|
||||
* @filesource
|
||||
* @copyright Copyright 2005-2008, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||
* @copyright Copyright 2005-2009, Cake Software Foundation, Inc. (http://www.cakefoundation.org)
|
||||
* @link https://trac.cakephp.org/wiki/Developement/TestSuite CakePHP(tm) Tests
|
||||
* @package cake
|
||||
* @subpackage cake.cake.tests.libs
|
||||
* @since CakePHP(tm) v 1.2.0.4667
|
||||
* @version $Revision$
|
||||
* @modifiedby $LastChangedBy$
|
||||
* @lastmodified $Date$
|
||||
* @license http://www.opensource.org/licenses/opengroup.php The Open Group Test Suite License
|
||||
*/
|
||||
if (!class_exists('dispatcher')) {
|
||||
|
@ -67,7 +62,7 @@ class CakeTestDispatcher extends Dispatcher {
|
|||
* @param array $params
|
||||
* @param boolean $missingAction
|
||||
* @return Controller
|
||||
* @access proptected
|
||||
* @access protected
|
||||
*/
|
||||
function _invoke(&$controller, $params, $missingAction = false) {
|
||||
$this->controller =& $controller;
|
||||
|
@ -775,13 +770,7 @@ class CakeTestCase extends UnitTestCase {
|
|||
TESTS . 'fixtures',
|
||||
VENDORS . 'tests' . DS . 'fixtures'
|
||||
);
|
||||
$pluginPaths = App::path('plugins');
|
||||
foreach ($pluginPaths as $path) {
|
||||
if (file_exists($path . $pluginName . DS . 'tests' . DS. 'fixtures')) {
|
||||
$fixturePaths[0] = $path . $pluginName . DS . 'tests' . DS. 'fixtures';
|
||||
break;
|
||||
}
|
||||
}
|
||||
$fixturesPaths[0] = App::pluginPath($pluginName) . DS . 'tests' . DS . 'fixtures';
|
||||
} else {
|
||||
$fixturePaths = array(
|
||||
TESTS . 'fixtures',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue