Skip to content

Commit b3b7eb0

Browse files
author
gwoo
committed
Merge branch '1.2'
2 parents 4c17740 + 92fd7cf commit b3b7eb0

File tree

125 files changed

+17064
-7459
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

125 files changed

+17064
-7459
lines changed

cake/basics.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -362,8 +362,8 @@ function am() {
362362
*/
363363
function env($key) {
364364
if ($key == 'HTTPS') {
365-
if (isset($_SERVER) && !empty($_SERVER)) {
366-
return (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on');
365+
if (isset($_SERVER['HTTPS'])) {
366+
return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off');
367367
}
368368
return (strpos(env('SCRIPT_URI'), 'https://') === 0);
369369
}
@@ -624,9 +624,9 @@ function __n($singular, $plural, $count, $return = false) {
624624
}
625625

626626
if ($return === false) {
627-
echo I18n::translate($singular, $plural, null, 5, $count);
627+
echo I18n::translate($singular, $plural, null, 6, $count);
628628
} else {
629-
return I18n::translate($singular, $plural, null, 5, $count);
629+
return I18n::translate($singular, $plural, null, 6, $count);
630630
}
631631
}
632632
/**
@@ -672,9 +672,9 @@ function __dn($domain, $singular, $plural, $count, $return = false) {
672672
}
673673

674674
if ($return === false) {
675-
echo I18n::translate($singular, $plural, $domain, 5, $count);
675+
echo I18n::translate($singular, $plural, $domain, 6, $count);
676676
} else {
677-
return I18n::translate($singular, $plural, $domain, 5, $count);
677+
return I18n::translate($singular, $plural, $domain, 6, $count);
678678
}
679679
}
680680
/**
@@ -723,13 +723,13 @@ function __dc($domain, $msg, $category, $return = false) {
723723
* Valid categories are: LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES and LC_ALL.
724724
*
725725
* Note that the category must be specified with a numeric value, instead of the constant name. The values are:
726-
* LC_CTYPE 0
727-
* LC_NUMERIC 1
728-
* LC_TIME 2
729-
* LC_COLLATE 3
730-
* LC_MONETARY 4
731-
* LC_MESSAGES 5
732-
* LC_ALL 6
726+
* LC_ALL 0
727+
* LC_COLLATE 1
728+
* LC_CTYPE 2
729+
* LC_MONETARY 3
730+
* LC_NUMERIC 4
731+
* LC_TIME 5
732+
* LC_MESSAGES 6
733733
*
734734
* @param string $domain Domain
735735
* @param string $singular Singular string to translate
@@ -810,7 +810,7 @@ function array_diff_key() {
810810

811811
foreach ($args[0] as $valueKey => $valueData) {
812812
for ($i = 1; $i < $argc; $i++) {
813-
if (isset($args[$i][$valueKey])) {
813+
if (array_key_exists($valueKey, $args[$i])) {
814814
continue 2;
815815
}
816816
}
@@ -830,7 +830,7 @@ function array_diff_key() {
830830
function array_intersect_key($arr1, $arr2) {
831831
$res = array();
832832
foreach ($arr1 as $key => $value) {
833-
if (isset($arr2[$key])) {
833+
if (array_key_exists($key, $arr2)) {
834834
$res[$key] = $arr1[$key];
835835
}
836836
}

cake/console/cake.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -446,13 +446,15 @@ function stderr($string) {
446446
*/
447447
function parseParams($params) {
448448
$this->__parseParams($params);
449-
450449
$defaults = array('app' => 'app', 'root' => dirname(dirname(dirname(__FILE__))), 'working' => null, 'webroot' => 'webroot');
451-
452450
$params = array_merge($defaults, array_intersect_key($this->params, $defaults));
453-
454-
$isWin = array_filter(array_map('strpos', $params, array('\\')));
455-
451+
$isWin = false;
452+
foreach ($defaults as $default => $value) {
453+
if (strpos($params[$default], '\\') !== false) {
454+
$isWin = true;
455+
break;
456+
}
457+
}
456458
$params = str_replace('\\', '/', $params);
457459

458460
if (!empty($params['working']) && (!isset($this->args[0]) || isset($this->args[0]) && $this->args[0]{0} !== '.')) {
@@ -464,7 +466,7 @@ function parseParams($params) {
464466
}
465467
}
466468

467-
if ($params['app'][0] == '/' || preg_match('/([a-zA-Z])(:)/i', $params['app'], $matches)) {
469+
if ($params['app'][0] == '/' || preg_match('/([a-z])(:)/i', $params['app'], $matches)) {
468470
$params['root'] = dirname($params['app']);
469471
} elseif (strpos($params['app'], '/')) {
470472
$params['root'] .= '/' . dirname($params['app']);

cake/console/libs/api.php

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function main() {
6666
return $this->help();
6767
}
6868

69-
$type = low($this->args[0]);
69+
$type = strtolower($this->args[0]);
7070

7171
if (isset($this->paths[$type])) {
7272
$path = $this->paths[$type];
@@ -151,17 +151,17 @@ function help() {
151151

152152
$commands = array(
153153
'path' => "\t<type>\n" .
154-
"\t\tEither a full path or type of class (model, behavior, controller, component, view, helper).\n".
155-
"\t\tAvailable values:\n\n".
156-
"\t\tbehavior\tLook for class in CakePHP behavior path\n".
157-
"\t\tcache\tLook for class in CakePHP cache path\n".
158-
"\t\tcontroller\tLook for class in CakePHP controller path\n".
159-
"\t\tcomponent\tLook for class in CakePHP component path\n".
160-
"\t\thelper\tLook for class in CakePHP helper path\n".
161-
"\t\tmodel\tLook for class in CakePHP model path\n".
162-
"\t\tview\tLook for class in CakePHP view path\n",
154+
"\t\tEither a full path or type of class (model, behavior, controller, component, view, helper).\n".
155+
"\t\tAvailable values:\n\n".
156+
"\t\tbehavior\tLook for class in CakePHP behavior path\n".
157+
"\t\tcache\tLook for class in CakePHP cache path\n".
158+
"\t\tcontroller\tLook for class in CakePHP controller path\n".
159+
"\t\tcomponent\tLook for class in CakePHP component path\n".
160+
"\t\thelper\tLook for class in CakePHP helper path\n".
161+
"\t\tmodel\tLook for class in CakePHP model path\n".
162+
"\t\tview\tLook for class in CakePHP view path\n",
163163
'className' => "\t<className>\n" .
164-
"\t\tA CakePHP core class name (e.g: Component, HtmlHelper).\n"
164+
"\t\tA CakePHP core class name (e.g: Component, HtmlHelper).\n"
165165
);
166166

167167
$this->out($head);
@@ -196,16 +196,16 @@ function __parseClass($path) {
196196

197197
$contents = $File->read();
198198

199-
if (preg_match_all('%(/\\*\\*[\\s\\S]*?\\*/)(\\s+function\\s+\\w+)(\\(.+\\))%', $contents, $result, PREG_PATTERN_ORDER)) {
199+
if (preg_match_all('%(/\\*\\*[\\s\\S]*?\\*/)(\\s+function\\s+\\w+)(\\(.*\\))%', $contents, $result, PREG_PATTERN_ORDER)) {
200200
foreach ($result[2] as $key => $method) {
201201
$method = str_replace('function ', '', trim($method));
202202

203203
if (strpos($method, '__') === false && $method[0] != '_') {
204204
$parsed[$method] = array(
205-
'comment' => r(array('/*', '*/', '*'), '', trim($result[1][$key])),
206-
'method' => $method,
207-
'parameters' => trim($result[3][$key]),
208-
);
205+
'comment' => str_replace(array('/*', '*/', '*'), '', trim($result[1][$key])),
206+
'method' => $method,
207+
'parameters' => trim($result[3][$key])
208+
);
209209
}
210210
}
211211
}

cake/console/libs/console.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -252,8 +252,7 @@ function main($command = null) {
252252
if ($this->__isValidModel($modelToSave)) {
253253
// Extract the array of data we are trying to build
254254
list($foo, $data) = explode("->save", $command);
255-
$badChars = array("(", ")");
256-
$data = str_replace($badChars, "", $data);
255+
$data = preg_replace('/^\(*(array)?\(*(.+?)\)*$/i', '\\2', $data);
257256
$saveCommand = "\$this->{$modelToSave}->save(array('{$modelToSave}' => array({$data})));";
258257
@eval($saveCommand);
259258
$this->out('Saved record for ' . $modelToSave);
@@ -336,4 +335,4 @@ function __loadRoutes() {
336335
return true;
337336
}
338337
}
339-
?>
338+
?>

cake/console/libs/schema.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ function dump() {
199199
}
200200
}
201201
$db =& ConnectionManager::getDataSource($this->Schema->connection);
202-
$contents = "#". $Schema->name ." sql generated on: " . date('Y-m-d H:m:s') . " : ". time()."\n\n";
202+
$contents = "#" . $Schema->name . " sql generated on: " . date('Y-m-d H:i:s') . " : " . time() . "\n\n";
203203
$contents .= $db->dropSchema($Schema) . "\n\n". $db->createSchema($Schema);
204204
if ($write) {
205205
if (strpos($write, '.sql') === false) {

cake/console/libs/shell.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@ function __construct(&$dispatch) {
149149
ClassRegistry::map($this->name, $this->alias);
150150

151151
if (!PHP5 && isset($this->args[0])) {
152-
if (strpos($this->name, low(Inflector::camelize($this->args[0]))) !== false) {
152+
if (strpos($this->name, strtolower(Inflector::camelize($this->args[0]))) !== false) {
153153
$dispatch->shiftArgs();
154154
}
155-
if (low($this->command) == low(Inflector::variable($this->args[0])) && method_exists($this, $this->command)) {
155+
if (strtolower($this->command) == strtolower(Inflector::variable($this->args[0])) && method_exists($this, $this->command)) {
156156
$dispatch->shiftArgs();
157157
}
158158
}
@@ -297,7 +297,7 @@ function loadTasks() {
297297
}
298298

299299
if (!isset($this->{$taskName})) {
300-
$this->err("Task '".$taskName."' could not be loaded");
300+
$this->err("Task '" . $taskName . "' could not be loaded");
301301
$this->_stop();
302302
}
303303
}
@@ -329,7 +329,7 @@ function in($prompt, $options = null, $default = null) {
329329
}
330330
}
331331
if (is_array($options)) {
332-
while ($in == '' || ($in && (!in_array(low($in), $options) && !in_array(up($in), $options)) && !in_array($in, $options))) {
332+
while ($in == '' || ($in && (!in_array(strtolower($in), $options) && !in_array(strtoupper($in), $options)) && !in_array($in, $options))) {
333333
$in = $this->Dispatch->getInput($prompt, $options, $default);
334334
}
335335
}
@@ -427,10 +427,10 @@ function createFile ($path, $contents) {
427427
$this->out("\n" . sprintf(__("Creating file %s", true), $path));
428428
if (is_file($path) && $this->interactive === true) {
429429
$key = $this->in(__("File exists, overwrite?", true). " {$path}", array('y', 'n', 'q'), 'n');
430-
if (low($key) == 'q') {
430+
if (strtolower($key) == 'q') {
431431
$this->out(__("Quitting.", true) ."\n");
432432
exit;
433-
} elseif (low($key) != 'y') {
433+
} elseif (strtolower($key) != 'y') {
434434
$this->out(__("Skip", true) ." {$path}\n");
435435
return false;
436436
}
@@ -472,7 +472,7 @@ function _checkUnitTest() {
472472
return true;
473473
}
474474
$unitTest = $this->in('SimpleTest is not installed. Do you want to bake unit test files anyway?', array('y','n'), 'y');
475-
$result = low($unitTest) == 'y' || low($unitTest) == 'yes';
475+
$result = strtolower($unitTest) == 'y' || strtolower($unitTest) == 'yes';
476476

477477
if ($result) {
478478
$this->out("\nYou can download SimpleTest from http://simpletest.org", true);
@@ -488,8 +488,8 @@ function _checkUnitTest() {
488488
*/
489489
function shortPath($file) {
490490
$shortPath = str_replace(ROOT, null, $file);
491-
$shortPath = str_replace('..'.DS, '', $shortPath);
492-
return r(DS.DS, DS, $shortPath);
491+
$shortPath = str_replace('..' . DS, '', $shortPath);
492+
return str_replace(DS . DS, DS, $shortPath);
493493
}
494494
/**
495495
* Checks for Configure::read('Routing.admin') and forces user to input it if not enabled
@@ -528,7 +528,7 @@ function getAdmin() {
528528
* @access protected
529529
*/
530530
function _controllerPath($name) {
531-
return low(Inflector::underscore($name));
531+
return strtolower(Inflector::underscore($name));
532532
}
533533
/**
534534
* Creates the proper controller plural name for the specified controller class name

0 commit comments

Comments
 (0)