Skip to content
Permalink
Browse files

Removing all uses of uses() global method & replacing with require or…

… App::import.
  • Loading branch information...
jperras committed Jul 23, 2009
1 parent d70900c commit e40428801ef3bbf005d753855b60aa3c683f7f21
@@ -436,7 +436,7 @@ function createFile ($path, $contents) {
}
}
if (!class_exists('File')) {
uses('file');
require LIBS . 'file.php';
}
if ($File = new File($path, true)) {
@@ -194,7 +194,7 @@ function securitySalt($path) {
$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);
@@ -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');
?>
@@ -79,4 +81,4 @@ $output .= "\t\tYou can also add some CSS styles for your pages at: %s', true),\
$output .= "\t\tAPP . 'views' . DS . 'pages' . DS . 'home.ctp.<br />', APP . 'views' . DS . 'layouts' . DS . 'default.ctp.<br />', APP . 'webroot' . DS . 'css');\n";
$output .= "?>\n";
$output .= "</p>\n";
?>
?>
@@ -32,7 +32,7 @@
* Enter description here...
*/
if (!class_exists('File')) {
uses('file');
require LIBS . 'file.php';
}
/**
* Enter description here...
@@ -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'));
@@ -27,7 +27,7 @@
*
*/
if (!class_exists('Object')) {
uses('object');
require LIBS . 'object.php';
}
if (!class_exists('Folder')) {
require LIBS . 'folder.php';
@@ -27,7 +27,7 @@
*
*/
if (!class_exists('Object')) {
uses('object');
require LIBS . 'object.php';
}
/**
* Folder structure browser, lists folders and files.
@@ -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
@@ -55,7 +55,7 @@ function setup(&$model, $config = array()) {
$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')) {
@@ -148,7 +148,7 @@ function _stop($status = 0) {
*/
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();
@@ -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');
?>
@@ -147,6 +147,7 @@ function testEnv() {
*
* @access public
* @return void
* @deprecated
*/
function testUses() {
$this->skipIf(class_exists('Security') || class_exists('Sanitize'), '%s Security and/or Sanitize class already loaded');
@@ -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
*
@@ -1755,7 +1755,6 @@ function testMapReverse() {
$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),
@@ -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
*
@@ -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
*
@@ -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');
?>
@@ -77,4 +79,4 @@ if (!empty($filePresent)):
You can also add some CSS styles for your pages at: %s', true),
APP . 'views' . DS . 'pages' . DS . 'home.ctp.<br />', APP . 'views' . DS . 'layouts' . DS . 'default.ctp.<br />', APP . 'webroot' . DS . 'css');
?>
</p>
</p>
@@ -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');
?>

0 comments on commit e404288

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