Permalink
Browse files

Merge branch '1.2'

  • Loading branch information...
2 parents 4c17740 + 92fd7cf commit b3b7eb0f941c0023aadad8093b81896cd185aa43 gwoo committed Aug 3, 2009
Showing with 17,064 additions and 7,459 deletions.
  1. +15 −15 cake/basics.php
  2. +8 −6 cake/console/cake.php
  3. +16 −16 cake/console/libs/api.php
  4. +2 −3 cake/console/libs/console.php
  5. +1 −1 cake/console/libs/schema.php
  6. +10 −10 cake/console/libs/shell.php
  7. +26 −23 cake/console/libs/tasks/controller.php
  8. +1 −1 cake/console/libs/tasks/db_config.php
  9. +12 −12 cake/console/libs/tasks/model.php
  10. +2 −2 cake/console/libs/tasks/plugin.php
  11. +6 −6 cake/console/libs/tasks/project.php
  12. +1 −1 cake/console/libs/tasks/test.php
  13. +6 −6 cake/console/libs/tasks/view.php
  14. +3 −3 cake/console/libs/templates/views/form.ctp
  15. +1 −1 cake/console/libs/templates/views/home.ctp
  16. +2 −2 cake/console/libs/templates/views/index.ctp
  17. +9 −9 cake/console/libs/templates/views/view.ctp
  18. +2 −2 cake/dispatcher.php
  19. +0 −1 cake/libs/cache/file.php
  20. +5 −2 cake/libs/controller/components/auth.php
  21. +7 −7 cake/libs/controller/components/cookie.php
  22. +16 −10 cake/libs/controller/components/email.php
  23. +1 −1 cake/libs/controller/components/request_handler.php
  24. +1 −1 cake/libs/controller/components/security.php
  25. +13 −9 cake/libs/controller/controller.php
  26. +2 −2 cake/libs/controller/scaffold.php
  27. +6 −5 cake/libs/file.php
  28. +20 −6 cake/libs/http_socket.php
  29. +6 −4 cake/libs/i18n.php
  30. +3 −3 cake/libs/l10n.php
  31. +2 −2 cake/libs/model/behaviors/containable.php
  32. +7 −7 cake/libs/model/datasources/datasource.php
  33. +32 −19 cake/libs/model/datasources/dbo/dbo_mssql.php
  34. +4 −2 cake/libs/model/datasources/dbo/dbo_mysql.php
  35. +17 −33 cake/libs/model/datasources/dbo/dbo_mysqli.php
  36. +8 −5 cake/libs/model/datasources/dbo/dbo_oracle.php
  37. +3 −0 cake/libs/model/datasources/dbo/dbo_postgres.php
  38. +34 −26 cake/libs/model/datasources/dbo_source.php
  39. +47 −25 cake/libs/model/model.php
  40. +2 −2 cake/libs/model/schema.php
  41. +3 −2 cake/libs/object.php
  42. +12 −16 cake/libs/router.php
  43. +1 −1 cake/libs/set.php
  44. +12 −2 cake/libs/socket.php
  45. +3 −3 cake/libs/view/errors/missing_action.ctp
  46. +3 −3 cake/libs/view/errors/missing_component_class.ctp
  47. +2 −2 cake/libs/view/errors/missing_component_file.ctp
  48. +3 −3 cake/libs/view/errors/missing_controller.ctp
  49. +2 −2 cake/libs/view/errors/missing_helper_class.ctp
  50. +3 −3 cake/libs/view/errors/missing_helper_file.ctp
  51. +3 −3 cake/libs/view/errors/missing_layout.ctp
  52. +2 −2 cake/libs/view/errors/missing_model.ctp
  53. +2 −2 cake/libs/view/errors/missing_scaffolddb.ctp
  54. +2 −2 cake/libs/view/errors/missing_table.ctp
  55. +2 −2 cake/libs/view/errors/missing_view.ctp
  56. +2 −2 cake/libs/view/errors/private_action.ctp
  57. +1 −1 cake/libs/view/errors/scaffold_error.ctp
  58. +3 −4 cake/libs/view/helpers/ajax.php
  59. +2 −2 cake/libs/view/helpers/cache.php
  60. +5 −4 cake/libs/view/helpers/html.php
  61. +136 −48 cake/libs/view/helpers/javascript.php
  62. +21 −21 cake/libs/view/helpers/paginator.php
  63. +4 −4 cake/libs/view/helpers/session.php
  64. +4 −1 cake/libs/view/helpers/text.php
  65. +1 −1 cake/libs/view/helpers/time.php
  66. +1 −1 cake/libs/view/layouts/xml/default.ctp
  67. +3 −3 cake/libs/view/scaffolds/edit.ctp
  68. +2 −2 cake/libs/view/scaffolds/index.ctp
  69. +8 −8 cake/libs/view/scaffolds/view.ctp
  70. +7 −3 cake/libs/view/view.php
  71. +27 −9 cake/libs/xml.php
  72. +59 −12 cake/tests/cases/basics.test.php
  73. +19 −0 cake/tests/cases/console/cake.test.php
  74. +1 −1 cake/tests/cases/console/libs/acl.test.php
  75. +116 −0 cake/tests/cases/console/libs/api.test.php
  76. +10 −4 cake/tests/cases/console/libs/shell.test.php
  77. +1 −1 cake/tests/cases/console/libs/tasks/test.test.php
  78. +12 −10 cake/tests/cases/libs/cake_test_case.test.php
  79. +3 −3 cake/tests/cases/libs/cake_test_fixture.test.php
  80. +15 −0 cake/tests/cases/libs/controller/component.test.php
  81. +29 −0 cake/tests/cases/libs/controller/components/auth.test.php
  82. +88 −3 cake/tests/cases/libs/controller/components/email.test.php
  83. +40 −15 cake/tests/cases/libs/controller/components/request_handler.test.php
  84. +8 −0 cake/tests/cases/libs/controller/components/security.test.php
  85. +222 −0 cake/tests/cases/libs/controller/controller_merge_vars.test.php
  86. +72 −11 cake/tests/cases/libs/controller/scaffold.test.php
  87. +2 −2 cake/tests/cases/libs/http_socket.test.php
  88. +90 −5 cake/tests/cases/libs/i18n.test.php
  89. +1 −1 cake/tests/cases/libs/l10n.test.php
  90. +112 −10 cake/tests/cases/libs/model/behavior.test.php
  91. +61 −58 cake/tests/cases/libs/model/behaviors/containable.test.php
  92. +12 −9 cake/tests/cases/libs/model/behaviors/translate.test.php
  93. +206 −10 cake/tests/cases/libs/model/datasources/dbo/dbo_mssql.test.php
  94. +16 −0 cake/tests/cases/libs/model/datasources/dbo/dbo_mysqli.test.php
  95. +15 −0 cake/tests/cases/libs/model/datasources/dbo/dbo_postgres.test.php
  96. +18 −7 cake/tests/cases/libs/model/datasources/dbo_source.test.php
  97. +5 −6,560 cake/tests/cases/libs/model/model.test.php
  98. +571 −0 cake/tests/cases/libs/model/model_delete.test.php
  99. +1,837 −0 cake/tests/cases/libs/model/model_integration.test.php
  100. +7,151 −0 cake/tests/cases/libs/model/model_read.test.php
  101. +126 −0 cake/tests/cases/libs/model/model_validation.test.php
  102. +3,890 −0 cake/tests/cases/libs/model/model_write.test.php
  103. +2 −1 cake/tests/cases/libs/model/models.php
  104. +123 −1 cake/tests/cases/libs/router.test.php
  105. +2 −2 cake/tests/cases/libs/sanitize.test.php
  106. +12 −0 cake/tests/cases/libs/socket.test.php
  107. +50 −8 cake/tests/cases/libs/view/helpers/html.test.php
  108. +241 −97 cake/tests/cases/libs/view/helpers/javascript.test.php
  109. +821 −150 cake/tests/cases/libs/view/helpers/paginator.test.php
  110. +52 −0 cake/tests/cases/libs/view/helpers/session.test.php
  111. +26 −6 cake/tests/cases/libs/view/helpers/text.test.php
  112. +17 −0 cake/tests/cases/libs/view/helpers/time.test.php
  113. +19 −1 cake/tests/cases/libs/view/helpers/xml.test.php
  114. +23 −0 cake/tests/cases/libs/view/view.test.php
  115. +112 −0 cake/tests/cases/libs/xml.test.php
  116. +1 −1 cake/tests/fixtures/uuid_tree_fixture.php
  117. +56 −0 cake/tests/groups/database.group.php
  118. +2 −5 cake/tests/groups/model.group.php
  119. +0 −1 cake/tests/lib/cake_reporter.php
  120. +3 −2 cake/tests/lib/cake_test_case.php
  121. +7 −2 cake/tests/lib/cake_test_fixture.php
  122. +4 −6 cake/tests/lib/cake_web_test_case.php
  123. +2 −1 cake/tests/test_app/controllers/tests_apps_posts_controller.php
  124. +18 −0 cake/tests/test_app/locale/po/LC_MONETARY/default.po
  125. +22 −0 cake/tests/test_app/plugins/test_plugin/locale/po/LC_MONETARY/test_plugin.po
View
@@ -362,8 +362,8 @@ function am() {
*/
function env($key) {
if ($key == 'HTTPS') {
- if (isset($_SERVER) && !empty($_SERVER)) {
- return (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on');
+ if (isset($_SERVER['HTTPS'])) {
+ return (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off');
}
return (strpos(env('SCRIPT_URI'), 'https://') === 0);
}
@@ -624,9 +624,9 @@ function __n($singular, $plural, $count, $return = false) {
}
if ($return === false) {
- echo I18n::translate($singular, $plural, null, 5, $count);
+ echo I18n::translate($singular, $plural, null, 6, $count);
} else {
- return I18n::translate($singular, $plural, null, 5, $count);
+ return I18n::translate($singular, $plural, null, 6, $count);
}
}
/**
@@ -672,9 +672,9 @@ function __dn($domain, $singular, $plural, $count, $return = false) {
}
if ($return === false) {
- echo I18n::translate($singular, $plural, $domain, 5, $count);
+ echo I18n::translate($singular, $plural, $domain, 6, $count);
} else {
- return I18n::translate($singular, $plural, $domain, 5, $count);
+ return I18n::translate($singular, $plural, $domain, 6, $count);
}
}
/**
@@ -723,13 +723,13 @@ function __dc($domain, $msg, $category, $return = false) {
* Valid categories are: LC_CTYPE, LC_NUMERIC, LC_TIME, LC_COLLATE, LC_MONETARY, LC_MESSAGES and LC_ALL.
*
* Note that the category must be specified with a numeric value, instead of the constant name. The values are:
- * LC_CTYPE 0
- * LC_NUMERIC 1
- * LC_TIME 2
- * LC_COLLATE 3
- * LC_MONETARY 4
- * LC_MESSAGES 5
- * LC_ALL 6
+ * LC_ALL 0
+ * LC_COLLATE 1
+ * LC_CTYPE 2
+ * LC_MONETARY 3
+ * LC_NUMERIC 4
+ * LC_TIME 5
+ * LC_MESSAGES 6
*
* @param string $domain Domain
* @param string $singular Singular string to translate
@@ -810,7 +810,7 @@ function array_diff_key() {
foreach ($args[0] as $valueKey => $valueData) {
for ($i = 1; $i < $argc; $i++) {
- if (isset($args[$i][$valueKey])) {
+ if (array_key_exists($valueKey, $args[$i])) {
continue 2;
}
}
@@ -830,7 +830,7 @@ function array_diff_key() {
function array_intersect_key($arr1, $arr2) {
$res = array();
foreach ($arr1 as $key => $value) {
- if (isset($arr2[$key])) {
+ if (array_key_exists($key, $arr2)) {
$res[$key] = $arr1[$key];
}
}
View
@@ -446,13 +446,15 @@ function stderr($string) {
*/
function parseParams($params) {
$this->__parseParams($params);
-
$defaults = array('app' => 'app', 'root' => dirname(dirname(dirname(__FILE__))), 'working' => null, 'webroot' => 'webroot');
-
$params = array_merge($defaults, array_intersect_key($this->params, $defaults));
-
- $isWin = array_filter(array_map('strpos', $params, array('\\')));
-
+ $isWin = false;
+ foreach ($defaults as $default => $value) {
+ if (strpos($params[$default], '\\') !== false) {
+ $isWin = true;
+ break;
+ }
+ }
$params = str_replace('\\', '/', $params);
if (!empty($params['working']) && (!isset($this->args[0]) || isset($this->args[0]) && $this->args[0]{0} !== '.')) {
@@ -464,7 +466,7 @@ function parseParams($params) {
}
}
- if ($params['app'][0] == '/' || preg_match('/([a-zA-Z])(:)/i', $params['app'], $matches)) {
+ if ($params['app'][0] == '/' || preg_match('/([a-z])(:)/i', $params['app'], $matches)) {
$params['root'] = dirname($params['app']);
} elseif (strpos($params['app'], '/')) {
$params['root'] .= '/' . dirname($params['app']);
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];
@@ -151,17 +151,17 @@ function help() {
$commands = array(
'path' => "\t<type>\n" .
- "\t\tEither a full path or type of class (model, behavior, controller, component, view, helper).\n".
- "\t\tAvailable values:\n\n".
- "\t\tbehavior\tLook for class in CakePHP behavior path\n".
- "\t\tcache\tLook for class in CakePHP cache path\n".
- "\t\tcontroller\tLook for class in CakePHP controller path\n".
- "\t\tcomponent\tLook for class in CakePHP component path\n".
- "\t\thelper\tLook for class in CakePHP helper path\n".
- "\t\tmodel\tLook for class in CakePHP model path\n".
- "\t\tview\tLook for class in CakePHP view path\n",
+ "\t\tEither a full path or type of class (model, behavior, controller, component, view, helper).\n".
+ "\t\tAvailable values:\n\n".
+ "\t\tbehavior\tLook for class in CakePHP behavior path\n".
+ "\t\tcache\tLook for class in CakePHP cache path\n".
+ "\t\tcontroller\tLook for class in CakePHP controller path\n".
+ "\t\tcomponent\tLook for class in CakePHP component path\n".
+ "\t\thelper\tLook for class in CakePHP helper path\n".
+ "\t\tmodel\tLook for class in CakePHP model path\n".
+ "\t\tview\tLook for class in CakePHP view path\n",
'className' => "\t<className>\n" .
- "\t\tA CakePHP core class name (e.g: Component, HtmlHelper).\n"
+ "\t\tA CakePHP core class name (e.g: Component, HtmlHelper).\n"
);
$this->out($head);
@@ -196,16 +196,16 @@ function __parseClass($path) {
$contents = $File->read();
- if (preg_match_all('%(/\\*\\*[\\s\\S]*?\\*/)(\\s+function\\s+\\w+)(\\(.+\\))%', $contents, $result, PREG_PATTERN_ORDER)) {
+ if (preg_match_all('%(/\\*\\*[\\s\\S]*?\\*/)(\\s+function\\s+\\w+)(\\(.*\\))%', $contents, $result, PREG_PATTERN_ORDER)) {
foreach ($result[2] as $key => $method) {
$method = str_replace('function ', '', trim($method));
if (strpos($method, '__') === false && $method[0] != '_') {
$parsed[$method] = array(
- 'comment' => r(array('/*', '*/', '*'), '', trim($result[1][$key])),
- 'method' => $method,
- 'parameters' => trim($result[3][$key]),
- );
+ 'comment' => str_replace(array('/*', '*/', '*'), '', trim($result[1][$key])),
+ 'method' => $method,
+ 'parameters' => trim($result[3][$key])
+ );
}
}
}
@@ -252,8 +252,7 @@ function main($command = null) {
if ($this->__isValidModel($modelToSave)) {
// Extract the array of data we are trying to build
list($foo, $data) = explode("->save", $command);
- $badChars = array("(", ")");
- $data = str_replace($badChars, "", $data);
+ $data = preg_replace('/^\(*(array)?\(*(.+?)\)*$/i', '\\2', $data);
$saveCommand = "\$this->{$modelToSave}->save(array('{$modelToSave}' => array({$data})));";
@eval($saveCommand);
$this->out('Saved record for ' . $modelToSave);
@@ -336,4 +335,4 @@ function __loadRoutes() {
return true;
}
}
-?>
+?>
@@ -199,7 +199,7 @@ function dump() {
}
}
$db =& ConnectionManager::getDataSource($this->Schema->connection);
- $contents = "#". $Schema->name ." sql generated on: " . date('Y-m-d H:m:s') . " : ". time()."\n\n";
+ $contents = "#" . $Schema->name . " sql generated on: " . date('Y-m-d H:i:s') . " : " . time() . "\n\n";
$contents .= $db->dropSchema($Schema) . "\n\n". $db->createSchema($Schema);
if ($write) {
if (strpos($write, '.sql') === false) {
@@ -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();
}
}
@@ -297,7 +297,7 @@ function loadTasks() {
}
if (!isset($this->{$taskName})) {
- $this->err("Task '".$taskName."' could not be loaded");
+ $this->err("Task '" . $taskName . "' could not be loaded");
$this->_stop();
}
}
@@ -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);
@@ -488,8 +488,8 @@ function _checkUnitTest() {
*/
function shortPath($file) {
$shortPath = str_replace(ROOT, null, $file);
- $shortPath = str_replace('..'.DS, '', $shortPath);
- return r(DS.DS, DS, $shortPath);
+ $shortPath = str_replace('..' . DS, '', $shortPath);
+ return str_replace(DS . DS, DS, $shortPath);
}
/**
* Checks for Configure::read('Routing.admin') and forces user to input it if not enabled
@@ -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
Oops, something went wrong.

0 comments on commit b3b7eb0

Please sign in to comment.