Removing all uses of uses() global method & replacing with require or App::import.

This commit is contained in:
jperras 2009-07-23 16:53:37 -04:00
parent d70900c540
commit e40428801e
18 changed files with 31 additions and 34 deletions

View file

@ -436,7 +436,7 @@ class Shell extends Object {
}
}
if (!class_exists('File')) {
uses('file');
require LIBS . 'file.php';
}
if ($File = new File($path, true)) {

View file

@ -194,7 +194,7 @@ class ProjectTask extends Shell {
$contents = $File->read();
if (preg_match('/([\\t\\x20]*Configure::write\\(\\\'Security.salt\\\',[\\t\\x20\'A-z0-9]*\\);)/', $contents, $match)) {
if (!class_exists('Security')) {
uses('Security');
require LIBS . 'security.php';
}
$string = Security::generateAuthKey();
$result = str_replace($match[0], "\t" . 'Configure::write(\'Security.salt\', \''.$string.'\');', $contents);

View file

@ -52,7 +52,9 @@ endif;
</p>
<?php
if (!empty(\$filePresent)):
uses('model' . DS . 'connection_manager');
if (!class_exists('ConnectionManager')) {
require LIBS . 'model' . DS . 'connection_manager.php';
}
\$db = ConnectionManager::getInstance();
\$connected = \$db->getDataSource('default');
?>

View file

@ -32,7 +32,7 @@ if (!defined('CAKE_CORE_INCLUDE_PATH')) {
* Enter description here...
*/
if (!class_exists('File')) {
uses('file');
require LIBS . 'file.php';
}
/**
* Enter description here...

View file

@ -201,7 +201,7 @@ class DbAcl extends AclBase {
function __construct() {
parent::__construct();
if (!class_exists('AclNode')) {
uses('model' . DS . 'db_acl');
require LIBS . 'model' . DS . 'db_acl.php';
}
$this->Aro =& ClassRegistry::init(array('class' => 'Aro', 'alias' => 'Aro'));
$this->Aco =& ClassRegistry::init(array('class' => 'Aco', 'alias' => 'Aco'));

View file

@ -27,7 +27,7 @@
*
*/
if (!class_exists('Object')) {
uses('object');
require LIBS . 'object.php';
}
if (!class_exists('Folder')) {
require LIBS . 'folder.php';

View file

@ -27,7 +27,7 @@
*
*/
if (!class_exists('Object')) {
uses('object');
require LIBS . 'object.php';
}
/**
* Folder structure browser, lists folders and files.

View file

@ -22,8 +22,11 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
if (!class_exists('Object')) {
require LIBS . 'object.php';
}
if (!class_exists('File')) {
uses('object', 'file');
require LIBS . 'file.php';
}
/**
* A class to parse and use the MagicDb for file type analysis

View file

@ -55,7 +55,7 @@ class AclBehavior extends ModelBehavior {
$type = $this->__typeMaps[$this->settings[$model->name]['type']];
if (!class_exists('AclNode')) {
uses('model' . DS . 'db_acl');
require LIBS . 'model' . DS . 'db_acl.php';
}
$model->{$type} =& ClassRegistry::init($type);
if (!method_exists($model, 'parentNode')) {

View file

@ -148,7 +148,7 @@ class Object {
*/
function log($msg, $type = LOG_ERROR) {
if (!class_exists('CakeLog')) {
uses('cake_log');
require LIBS . 'cake_log.php';
}
if (is_null($this->_log)) {
$this->_log = new CakeLog();

View file

@ -78,7 +78,9 @@ endif;
</p>
<?php
if (isset($filePresent)):
uses('model' . DS . 'connection_manager');
if (!class_exists('ConnectionManager')) {
require LIBS . 'model' . DS . 'connection_manager.php';
}
$db = ConnectionManager::getInstance();
@$connected = $db->getDataSource('default');
?>

View file

@ -147,6 +147,7 @@ class BasicsTest extends CakeTestCase {
*
* @access public
* @return void
* @deprecated
*/
function testUses() {
$this->skipIf(class_exists('Security') || class_exists('Sanitize'), '%s Security and/or Sanitize class already loaded');

View file

@ -22,7 +22,9 @@
* @lastmodified $Date$
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
uses('magic_db', 'object');
if (!class_exists('MagicDb')) {
require LIBS . 'magic_db.php';
}
/**
* The test class for the MagicDb class
*

View file

@ -1755,7 +1755,6 @@ class SetTest extends CakeTestCase {
$result = Set::reverse($class);
$this->assertIdentical($result, $expected);
uses('model'.DS.'model');
$model = new Model(array('id' => false, 'name' => 'Model', 'table' => false));
$expected = array(
'Behaviors' => array('modelName' => 'Model', '_attached' => array(), '_disabled' => array(), '__methods' => array(), '__mappedMethods' => array(), '_log' => null),

View file

@ -27,16 +27,7 @@
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
define('CAKEPHP_UNIT_TEST_EXECUTION', 1);
}
uses(
'view' . DS . 'helpers' . DS . 'app_helper',
'controller' . DS . 'controller',
'model' . DS . 'model',
'view' . DS . 'helper',
'view' . DS . 'helpers'.DS.'ajax',
'view' . DS . 'helpers' . DS . 'html',
'view' . DS . 'helpers' . DS . 'form',
'view' . DS . 'helpers' . DS . 'javascript'
);
App::import('Helper', array('Html', 'Form', 'Javascript', 'Ajax'));
/**
* AjaxTestController class
*

View file

@ -27,13 +27,6 @@
if (!defined('CAKEPHP_UNIT_TEST_EXECUTION')) {
define('CAKEPHP_UNIT_TEST_EXECUTION', 1);
}
uses(
'view' . DS . 'helpers' . DS . 'app_helper',
'controller' . DS . 'controller',
'model' . DS . 'model',
'view' . DS . 'helper',
'view' . DS . 'helpers' . DS . 'js'
);
/**
* JsHelperTest class
*

View file

@ -51,7 +51,9 @@ endif;
</p>
<?php
if (!empty($filePresent)):
uses('model' . DS . 'connection_manager');
if (!class_exists('ConnectionManager')) {
require LIBS . 'model' . DS . 'connection_manager.php';
}
$db = ConnectionManager::getInstance();
$connected = $db->getDataSource('default');
?>

View file

@ -81,7 +81,9 @@
</p>
<?php
if (!empty($filePresent)):
uses('model' . DS . 'connection_manager');
if (!class_exists('ConnectionManager')) {
require LIBS . 'model' . DS . 'connection_manager.php';
}
$db = ConnectionManager::getInstance();
$connected = $db->getDataSource('default');
?>