mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Removing usage of up() and low() from core
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8253 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
8f61c666c2
commit
9eaad7528f
8 changed files with 42 additions and 42 deletions
|
@ -66,7 +66,7 @@ class ApiShell extends Shell {
|
|||
return $this->help();
|
||||
}
|
||||
|
||||
$type = low($this->args[0]);
|
||||
$type = strtolower($this->args[0]);
|
||||
|
||||
if (isset($this->paths[$type])) {
|
||||
$path = $this->paths[$type];
|
||||
|
|
|
@ -149,10 +149,10 @@ class Shell extends Object {
|
|||
ClassRegistry::map($this->name, $this->alias);
|
||||
|
||||
if (!PHP5 && isset($this->args[0])) {
|
||||
if (strpos($this->name, low(Inflector::camelize($this->args[0]))) !== false) {
|
||||
if (strpos($this->name, strtolower(Inflector::camelize($this->args[0]))) !== false) {
|
||||
$dispatch->shiftArgs();
|
||||
}
|
||||
if (low($this->command) == low(Inflector::variable($this->args[0])) && method_exists($this, $this->command)) {
|
||||
if (strtolower($this->command) == strtolower(Inflector::variable($this->args[0])) && method_exists($this, $this->command)) {
|
||||
$dispatch->shiftArgs();
|
||||
}
|
||||
}
|
||||
|
@ -329,7 +329,7 @@ class Shell extends Object {
|
|||
}
|
||||
}
|
||||
if (is_array($options)) {
|
||||
while ($in == '' || ($in && (!in_array(low($in), $options) && !in_array(up($in), $options)) && !in_array($in, $options))) {
|
||||
while ($in == '' || ($in && (!in_array(strtolower($in), $options) && !in_array(strtoupper($in), $options)) && !in_array($in, $options))) {
|
||||
$in = $this->Dispatch->getInput($prompt, $options, $default);
|
||||
}
|
||||
}
|
||||
|
@ -427,10 +427,10 @@ class Shell extends Object {
|
|||
$this->out("\n" . sprintf(__("Creating file %s", true), $path));
|
||||
if (is_file($path) && $this->interactive === true) {
|
||||
$key = $this->in(__("File exists, overwrite?", true). " {$path}", array('y', 'n', 'q'), 'n');
|
||||
if (low($key) == 'q') {
|
||||
if (strtolower($key) == 'q') {
|
||||
$this->out(__("Quitting.", true) ."\n");
|
||||
exit;
|
||||
} elseif (low($key) != 'y') {
|
||||
} elseif (strtolower($key) != 'y') {
|
||||
$this->out(__("Skip", true) ." {$path}\n");
|
||||
return false;
|
||||
}
|
||||
|
@ -472,7 +472,7 @@ class Shell extends Object {
|
|||
return true;
|
||||
}
|
||||
$unitTest = $this->in('SimpleTest is not installed. Do you want to bake unit test files anyway?', array('y','n'), 'y');
|
||||
$result = low($unitTest) == 'y' || low($unitTest) == 'yes';
|
||||
$result = strtolower($unitTest) == 'y' || strtolower($unitTest) == 'yes';
|
||||
|
||||
if ($result) {
|
||||
$this->out("\nYou can download SimpleTest from http://simpletest.org", true);
|
||||
|
@ -528,7 +528,7 @@ class Shell extends Object {
|
|||
* @access protected
|
||||
*/
|
||||
function _controllerPath($name) {
|
||||
return low(Inflector::underscore($name));
|
||||
return strtolower(Inflector::underscore($name));
|
||||
}
|
||||
/**
|
||||
* Creates the proper controller plural name for the specified controller class name
|
||||
|
|
|
@ -120,7 +120,7 @@ class ControllerTask extends Shell {
|
|||
$this->out("Baking {$controllerName}Controller");
|
||||
$this->hr();
|
||||
|
||||
$controllerFile = low(Inflector::underscore($controllerName));
|
||||
$controllerFile = strtolower(Inflector::underscore($controllerName));
|
||||
|
||||
$question[] = __("Would you like to build your controller interactively?", true);
|
||||
if (file_exists($this->path . $controllerFile .'_controller.php')) {
|
||||
|
@ -128,29 +128,29 @@ class ControllerTask extends Shell {
|
|||
}
|
||||
$doItInteractive = $this->in(join("\n", $question), array('y','n'), 'y');
|
||||
|
||||
if (low($doItInteractive) == 'y' || low($doItInteractive) == 'yes') {
|
||||
if (strtolower($doItInteractive) == 'y' || strtolower($doItInteractive) == 'yes') {
|
||||
$this->interactive = true;
|
||||
|
||||
$wannaUseScaffold = $this->in(__("Would you like to use scaffolding?", true), array('y','n'), 'n');
|
||||
|
||||
if (low($wannaUseScaffold) == 'n' || low($wannaUseScaffold) == 'no') {
|
||||
if (strtolower($wannaUseScaffold) == 'n' || strtolower($wannaUseScaffold) == 'no') {
|
||||
|
||||
$wannaDoScaffolding = $this->in(__("Would you like to include some basic class methods (index(), add(), view(), edit())?", true), array('y','n'), 'n');
|
||||
|
||||
if (low($wannaDoScaffolding) == 'y' || low($wannaDoScaffolding) == 'yes') {
|
||||
if (strtolower($wannaDoScaffolding) == 'y' || strtolower($wannaDoScaffolding) == 'yes') {
|
||||
$wannaDoAdmin = $this->in(__("Would you like to create the methods for admin routing?", true), array('y','n'), 'n');
|
||||
}
|
||||
|
||||
$wannaDoHelpers = $this->in(__("Would you like this controller to use other helpers besides HtmlHelper and FormHelper?", true), array('y','n'), 'n');
|
||||
|
||||
if (low($wannaDoHelpers) == 'y' || low($wannaDoHelpers) == 'yes') {
|
||||
if (strtolower($wannaDoHelpers) == 'y' || strtolower($wannaDoHelpers) == 'yes') {
|
||||
$helpersList = $this->in(__("Please provide a comma separated list of the other helper names you'd like to use.\nExample: 'Ajax, Javascript, Time'", true));
|
||||
$helpersListTrimmed = str_replace(' ', '', $helpersList);
|
||||
$helpers = explode(',', $helpersListTrimmed);
|
||||
}
|
||||
$wannaDoComponents = $this->in(__("Would you like this controller to use any components?", true), array('y','n'), 'n');
|
||||
|
||||
if (low($wannaDoComponents) == 'y' || low($wannaDoComponents) == 'yes') {
|
||||
if (strtolower($wannaDoComponents) == 'y' || strtolower($wannaDoComponents) == 'yes') {
|
||||
$componentsList = $this->in(__("Please provide a comma separated list of the component names you'd like to use.\nExample: 'Acl, Security, RequestHandler'", true));
|
||||
$componentsListTrimmed = str_replace(' ', '', $componentsList);
|
||||
$components = explode(',', $componentsListTrimmed);
|
||||
|
@ -163,20 +163,20 @@ class ControllerTask extends Shell {
|
|||
} else {
|
||||
$wannaDoScaffolding = $this->in(__("Would you like to include some basic class methods (index(), add(), view(), edit())?", true), array('y','n'), 'y');
|
||||
|
||||
if (low($wannaDoScaffolding) == 'y' || low($wannaDoScaffolding) == 'yes') {
|
||||
if (strtolower($wannaDoScaffolding) == 'y' || strtolower($wannaDoScaffolding) == 'yes') {
|
||||
$wannaDoAdmin = $this->in(__("Would you like to create the methods for admin routing?", true), array('y','n'), 'y');
|
||||
}
|
||||
}
|
||||
$admin = false;
|
||||
|
||||
if ((low($wannaDoAdmin) == 'y' || low($wannaDoAdmin) == 'yes')) {
|
||||
if ((strtolower($wannaDoAdmin) == 'y' || strtolower($wannaDoAdmin) == 'yes')) {
|
||||
$admin = $this->getAdmin();
|
||||
}
|
||||
|
||||
if (low($wannaDoScaffolding) == 'y' || low($wannaDoScaffolding) == 'yes') {
|
||||
$actions = $this->bakeActions($controllerName, null, in_array(low($wannaUseSession), array('y', 'yes')));
|
||||
if (strtolower($wannaDoScaffolding) == 'y' || strtolower($wannaDoScaffolding) == 'yes') {
|
||||
$actions = $this->bakeActions($controllerName, null, in_array(strtolower($wannaUseSession), array('y', 'yes')));
|
||||
if ($admin) {
|
||||
$actions .= $this->bakeActions($controllerName, $admin, in_array(low($wannaUseSession), array('y', 'yes')));
|
||||
$actions .= $this->bakeActions($controllerName, $admin, in_array(strtolower($wannaUseSession), array('y', 'yes')));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ class ControllerTask extends Shell {
|
|||
$this->hr();
|
||||
$this->out("Controller Name: $controllerName");
|
||||
|
||||
if (low($wannaUseScaffold) == 'y' || low($wannaUseScaffold) == 'yes') {
|
||||
if (strtolower($wannaUseScaffold) == 'y' || strtolower($wannaUseScaffold) == 'yes') {
|
||||
$this->out(" var \$scaffold;");
|
||||
$actions = 'scaffold';
|
||||
}
|
||||
|
@ -218,7 +218,7 @@ class ControllerTask extends Shell {
|
|||
$this->hr();
|
||||
$looksGood = $this->in(__('Look okay?', true), array('y','n'), 'y');
|
||||
|
||||
if (low($looksGood) == 'y' || low($looksGood) == 'yes') {
|
||||
if (strtolower($looksGood) == 'y' || strtolower($looksGood) == 'yes') {
|
||||
$baked = $this->bake($controllerName, $actions, $helpers, $components, $uses);
|
||||
if ($baked && $this->_checkUnitTest()) {
|
||||
$this->bakeTest($controllerName);
|
||||
|
@ -408,7 +408,7 @@ class ControllerTask extends Shell {
|
|||
$out .= "class $controllerName" . "Controller extends {$this->plugin}AppController {\n\n";
|
||||
$out .= "\tvar \$name = '$controllerName';\n";
|
||||
|
||||
if (low($actions) == 'scaffold') {
|
||||
if (strtolower($actions) == 'scaffold') {
|
||||
$out .= "\tvar \$scaffold;\n";
|
||||
} else {
|
||||
if (count($uses)) {
|
||||
|
|
|
@ -240,7 +240,7 @@ class DbConfigTask extends Shell {
|
|||
$this->hr();
|
||||
$looksGood = $this->in('Look okay?', array('y', 'n'), 'y');
|
||||
|
||||
if (low($looksGood) == 'y' || low($looksGood) == 'yes') {
|
||||
if (strtolower($looksGood) == 'y' || strtolower($looksGood) == 'yes') {
|
||||
return $config;
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -112,11 +112,11 @@ class ModelTask extends Shell {
|
|||
$tableIsGood = $this->in(__('Do you want to use this table?', true), array('y','n'), 'y');
|
||||
}
|
||||
|
||||
if (low($tableIsGood) == 'n' || low($tableIsGood) == 'no') {
|
||||
if (strtolower($tableIsGood) == 'n' || strtolower($tableIsGood) == 'no') {
|
||||
$useTable = $this->in(__('What is the name of the table (enter "null" to use NO table)?', true));
|
||||
}
|
||||
|
||||
while ($tableIsGood == false && low($useTable) != 'null') {
|
||||
while ($tableIsGood == false && strtolower($useTable) != 'null') {
|
||||
if (is_array($this->__tables) && !in_array($useTable, $this->__tables)) {
|
||||
$fullTableName = $db->fullTableName($useTable, false);
|
||||
$this->out($fullTableName . ' does not exist.');
|
||||
|
@ -144,12 +144,12 @@ class ModelTask extends Shell {
|
|||
}
|
||||
}
|
||||
|
||||
if (array_search($useTable, $this->__tables) !== false && (low($wannaDoValidation) == 'y' || low($wannaDoValidation) == 'yes')) {
|
||||
if (array_search($useTable, $this->__tables) !== false && (strtolower($wannaDoValidation) == 'y' || strtolower($wannaDoValidation) == 'yes')) {
|
||||
$validate = $this->doValidation($tempModel);
|
||||
}
|
||||
|
||||
$wannaDoAssoc = $this->in(__('Would you like to define model associations (hasMany, hasOne, belongsTo, etc.)?', true), array('y','n'), 'y');
|
||||
if ((low($wannaDoAssoc) == 'y' || low($wannaDoAssoc) == 'yes')) {
|
||||
if ((strtolower($wannaDoAssoc) == 'y' || strtolower($wannaDoAssoc) == 'yes')) {
|
||||
$associations = $this->doAssociations($tempModel);
|
||||
}
|
||||
|
||||
|
@ -201,7 +201,7 @@ class ModelTask extends Shell {
|
|||
$this->hr();
|
||||
$looksGood = $this->in(__('Look okay?', true), array('y','n'), 'y');
|
||||
|
||||
if (low($looksGood) == 'y' || low($looksGood) == 'yes') {
|
||||
if (strtolower($looksGood) == 'y' || strtolower($looksGood) == 'yes') {
|
||||
if ($this->bake($currentModelName, $associations, $validate, $primaryKey, $useTable, $useDbConfig)) {
|
||||
if ($this->_checkUnitTest()) {
|
||||
$this->bakeTest($currentModelName, $useTable, $associations);
|
||||
|
@ -401,7 +401,7 @@ class ModelTask extends Shell {
|
|||
$prompt = "{$model->name} {$type} {$associations[$type][$i]['alias']}";
|
||||
$response = $this->in("{$prompt}?", array('y','n'), 'y');
|
||||
|
||||
if ('n' == low($response) || 'no' == low($response)) {
|
||||
if ('n' == strtolower($response) || 'no' == strtolower($response)) {
|
||||
unset($associations[$type][$i]);
|
||||
} else {
|
||||
if ($model->name === $associations[$type][$i]['alias']) {
|
||||
|
@ -414,7 +414,7 @@ class ModelTask extends Shell {
|
|||
|
||||
$alternateAlias = $this->in(sprintf(__('This is a self join. Use %s as the alias', true), $alias), array('y', 'n'), 'y');
|
||||
|
||||
if ('n' == low($alternateAlias) || 'no' == low($alternateAlias)) {
|
||||
if ('n' == strtolower($alternateAlias) || 'no' == strtolower($alternateAlias)) {
|
||||
$associations[$type][$i]['alias'] = $this->in(__('Specify an alternate alias.', true));
|
||||
} else {
|
||||
$associations[$type][$i]['alias'] = $alias;
|
||||
|
@ -429,7 +429,7 @@ class ModelTask extends Shell {
|
|||
|
||||
$wannaDoMoreAssoc = $this->in(__('Would you like to define some additional model associations?', true), array('y','n'), 'n');
|
||||
|
||||
while ((low($wannaDoMoreAssoc) == 'y' || low($wannaDoMoreAssoc) == 'yes')) {
|
||||
while ((strtolower($wannaDoMoreAssoc) == 'y' || strtolower($wannaDoMoreAssoc) == 'yes')) {
|
||||
$assocs = array(1 => 'belongsTo', 2 => 'hasOne', 3 => 'hasMany', 4 => 'hasAndBelongsToMany');
|
||||
$bad = true;
|
||||
while ($bad) {
|
||||
|
|
|
@ -136,7 +136,7 @@ class PluginTask extends Shell {
|
|||
|
||||
$looksGood = $this->in('Look okay?', array('y', 'n', 'q'), 'y');
|
||||
|
||||
if (low($looksGood) == 'y' || low($looksGood) == 'yes') {
|
||||
if (strtolower($looksGood) == 'y' || strtolower($looksGood) == 'yes') {
|
||||
$verbose = $this->in(__('Do you want verbose output?', true), array('y', 'n'), 'n');
|
||||
|
||||
$Folder = new Folder($this->path . $pluginPath);
|
||||
|
@ -146,7 +146,7 @@ class PluginTask extends Shell {
|
|||
$Folder->create($this->path . $pluginPath . DS . $directory);
|
||||
}
|
||||
|
||||
if (low($verbose) == 'y' || low($verbose) == 'yes') {
|
||||
if (strtolower($verbose) == 'y' || strtolower($verbose) == 'yes') {
|
||||
foreach ($Folder->messages() as $message) {
|
||||
$this->out($message);
|
||||
}
|
||||
|
|
|
@ -144,7 +144,7 @@ class ProjectTask extends Shell {
|
|||
|
||||
$looksGood = $this->in('Look okay?', array('y', 'n', 'q'), 'y');
|
||||
|
||||
if (low($looksGood) == 'y' || low($looksGood) == 'yes') {
|
||||
if (strtolower($looksGood) == 'y' || strtolower($looksGood) == 'yes') {
|
||||
$verbose = $this->in(__('Do you want verbose output?', true), array('y', 'n'), 'n');
|
||||
|
||||
$Folder = new Folder($skel);
|
||||
|
@ -157,14 +157,14 @@ class ProjectTask extends Shell {
|
|||
return false;
|
||||
}
|
||||
|
||||
if (low($verbose) == 'y' || low($verbose) == 'yes') {
|
||||
if (strtolower($verbose) == 'y' || strtolower($verbose) == 'yes') {
|
||||
foreach ($Folder->messages() as $message) {
|
||||
$this->out($message);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
} elseif (low($looksGood) == 'q' || low($looksGood) == 'quit') {
|
||||
} elseif (strtolower($looksGood) == 'q' || strtolower($looksGood) == 'quit') {
|
||||
$this->out('Bake Aborted.');
|
||||
} else {
|
||||
$this->execute(false);
|
||||
|
|
|
@ -161,25 +161,25 @@ class ViewTask extends Shell {
|
|||
|
||||
$this->controllerName = $this->Controller->getName();
|
||||
|
||||
$this->controllerPath = low(Inflector::underscore($this->controllerName));
|
||||
$this->controllerPath = strtolower(Inflector::underscore($this->controllerName));
|
||||
|
||||
$interactive = $this->in("Would you like bake to build your views interactively?\nWarning: Choosing no will overwrite {$this->controllerName} views if it exist.", array('y','n'), 'y');
|
||||
|
||||
if (low($interactive) == 'y' || low($interactive) == 'yes') {
|
||||
if (strtolower($interactive) == 'y' || strtolower($interactive) == 'yes') {
|
||||
$this->interactive = true;
|
||||
$wannaDoScaffold = $this->in("Would you like to create some scaffolded views (index, add, view, edit) for this controller?\nNOTE: Before doing so, you'll need to create your controller and model classes (including associated models).", array('y','n'), 'n');
|
||||
}
|
||||
|
||||
if (low($wannaDoScaffold) == 'y' || low($wannaDoScaffold) == 'yes') {
|
||||
if (strtolower($wannaDoScaffold) == 'y' || strtolower($wannaDoScaffold) == 'yes') {
|
||||
$wannaDoAdmin = $this->in("Would you like to create the views for admin routing?", array('y','n'), 'y');
|
||||
}
|
||||
$admin = false;
|
||||
|
||||
if ((low($wannaDoAdmin) == 'y' || low($wannaDoAdmin) == 'yes')) {
|
||||
if ((strtolower($wannaDoAdmin) == 'y' || strtolower($wannaDoAdmin) == 'yes')) {
|
||||
$admin = $this->getAdmin();
|
||||
}
|
||||
|
||||
if (low($wannaDoScaffold) == 'y' || low($wannaDoScaffold) == 'yes') {
|
||||
if (strtolower($wannaDoScaffold) == 'y' || strtolower($wannaDoScaffold) == 'yes') {
|
||||
$actions = $this->scaffoldActions;
|
||||
if ($admin) {
|
||||
foreach ($actions as $action) {
|
||||
|
@ -213,7 +213,7 @@ class ViewTask extends Shell {
|
|||
$this->out("Path: ".$this->params['app'] . DS . $this->controllerPath . DS . Inflector::underscore($action) . ".ctp");
|
||||
$this->hr();
|
||||
$looksGood = $this->in('Look okay?', array('y','n'), 'y');
|
||||
if (low($looksGood) == 'y' || low($looksGood) == 'yes') {
|
||||
if (strtolower($looksGood) == 'y' || strtolower($looksGood) == 'yes') {
|
||||
$this->bake($action);
|
||||
$this->_stop();
|
||||
} else {
|
||||
|
|
Loading…
Add table
Reference in a new issue