Skip to content
Permalink
Browse files

Replacing $pluginPath loops with App::pluginPath(). Minor optimizatio…

…n for App::pluginPath().
  • Loading branch information...
markstory committed Oct 14, 2009
1 parent 38f65bd commit de8f251758e9e263c227560a4c5a4f0d6bd3dab3
Showing with 9 additions and 29 deletions.
  1. +3 −3 cake/libs/configure.php
  2. +1 −5 cake/libs/i18n.php
  3. +1 −6 cake/libs/view/view.php
  4. +4 −15 cake/tests/lib/cake_test_case.php
@@ -677,9 +677,9 @@ function build($paths = array(), $reset = false) {
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 @@ function __bindTextDomain($domain) {
$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 @@ function _paths($plugin = null, $cached = true) {
$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 @@ function testCase(&$testCase) {
* @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 @@ function _loadFixtures() {
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',

0 comments on commit de8f251

Please sign in to comment.
You can’t perform that action at this time.