mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Removing all uses of uses() global method & replacing with require or App::import.
This commit is contained in:
parent
d70900c540
commit
e40428801e
18 changed files with 31 additions and 34 deletions
|
@ -436,7 +436,7 @@ class Shell extends Object {
|
|||
}
|
||||
}
|
||||
if (!class_exists('File')) {
|
||||
uses('file');
|
||||
require LIBS . 'file.php';
|
||||
}
|
||||
|
||||
if ($File = new File($path, true)) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 @@ if (!defined('CAKE_CORE_INCLUDE_PATH')) {
|
|||
* 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 @@ 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')) {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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 @@ 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');
|
||||
|
|
|
@ -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 @@ 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),
|
||||
|
|
|
@ -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');
|
||||
?>
|
||||
|
|
Loading…
Reference in a new issue