Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

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
  • Loading branch information...
commit 9eaad7528fc1efb09c2420c9e77ae75cb39ed1b4 1 parent 8f61c66
Tim Koschuetzki tim-kos authored
2  cake/console/libs/api.php
View
@@ -66,7 +66,7 @@ function main() {
return $this->help();
}
- $type = low($this->args[0]);
+ $type = strtolower($this->args[0]);
if (isset($this->paths[$type])) {
$path = $this->paths[$type];
14 cake/console/libs/shell.php
View
@@ -149,10 +149,10 @@ function __construct(&$dispatch) {
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 @@ function in($prompt, $options = null, $default = null) {
}
}
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 @@ function createFile ($path, $contents) {
$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 @@ function _checkUnitTest() {
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 @@ function getAdmin() {
* @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
28 cake/console/libs/tasks/controller.php
View
@@ -120,7 +120,7 @@ function __interactive($controllerName = false) {
$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 @@ function __interactive($controllerName = false) {
}
$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 @@ function __interactive($controllerName = false) {
} 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 @@ function __interactive($controllerName = false) {
$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 @@ function __interactive($controllerName = false) {
$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 @@ function bake($controllerName, $actions = '', $helpers = null, $components = nul
$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)) {
2  cake/console/libs/tasks/db_config.php
View
@@ -240,7 +240,7 @@ function __verify($config) {
$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;
16 cake/console/libs/tasks/model.php
View
@@ -112,11 +112,11 @@ function __interactive() {
$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 @@ function __interactive() {
}
}
- 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 @@ function __interactive() {
$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 @@ function doAssociations(&$model, $interactive = true) {
$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 @@ function doAssociations(&$model, $interactive = true) {
$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 @@ function doAssociations(&$model, $interactive = true) {
$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) {
4 cake/console/libs/tasks/plugin.php
View
@@ -136,7 +136,7 @@ function bake($plugin) {
$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 @@ function bake($plugin) {
$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);
}
6 cake/console/libs/tasks/project.php
View
@@ -144,7 +144,7 @@ function bake($path, $skel = null, $skip = array('empty')) {
$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 @@ function bake($path, $skel = null, $skip = array('empty')) {
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);
12 cake/console/libs/tasks/view.php
View
@@ -161,25 +161,25 @@ function __interactive() {
$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 @@ function __interactive() {
$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 {
Please sign in to comment.
Something went wrong with that request. Please try again.