Permalink
Browse files

Merge branch '2.1' of github.com:cakephp/cakephp into 2.1

  • Loading branch information...
2 parents 7df6477 + c67feb0 commit eba0b1f999cfd0e84f1883759f0188b4aa2c919c @ceeram ceeram committed Mar 28, 2012
View
6 lib/Cake/Console/Command/Task/TestTask.php
@@ -398,8 +398,8 @@ protected function _processController($subject) {
protected function _addFixture($name) {
$parent = get_parent_class($name);
$prefix = 'app.';
- if (strtolower($parent) != 'appmodel' && strtolower(substr($parent, - 8)) == 'appmodel') {
- $pluginName = substr($parent, 0, strlen($parent) - 8);
+ if (strtolower($parent) != 'appmodel' && strtolower(substr($parent, -8)) == 'appmodel') {
+ $pluginName = substr($parent, 0, -8);
$prefix = 'plugin.' . Inflector::underscore($pluginName) . '.';
}
$fixture = $prefix . Inflector::underscore($name);
@@ -452,7 +452,7 @@ public function generateConstructor($type, $fullClassName) {
$construct = "new $fullClassName();\n";
}
if ($type == 'controller') {
- $className = substr($fullClassName, 0, strlen($fullClassName) - 10);
+ $className = substr($fullClassName, 0, -10);
$construct = "new Test$fullClassName();\n";
$post = "\$this->{$className}->constructClasses();\n";
}
View
3 lib/Cake/Console/Command/UpgradeShell.php
@@ -234,7 +234,8 @@ public function helpers() {
$helpers = array_merge($pluginHelpers, $helpers);
foreach ($helpers as $helper) {
$helper = preg_replace('/Helper$/', '', $helper);
- $oldHelper = strtolower(substr($helper, 0, 1)) . substr($helper, 1);
+ $oldHelper = $helper;
+ $oldHelper{0} = strtolower($oldHelper{0});
$patterns[] = array(
"\${$oldHelper} to \$this->{$helper}",
"/\\\${$oldHelper}->/",
View
3 lib/Cake/Controller/Controller.php
@@ -13,9 +13,6 @@
* @license MIT License (http://www.opensource.org/licenses/mit-license.php)
*/
-/**
- * Include files
- */
App::uses('CakeResponse', 'Network');
App::uses('ClassRegistry', 'Utility');
App::uses('ComponentCollection', 'Controller');
View
2 lib/Cake/Model/Behavior/ContainableBehavior.php
@@ -304,7 +304,7 @@ public function containments(Model $Model, $contain, $containments = array(), $t
$option = 'fields';
$val = array($key);
if ($key{0} == '(') {
- $val = preg_split('/\s*,\s*/', substr(substr($key, 1), 0, -1));
+ $val = preg_split('/\s*,\s*/', substr($key, 1, -1));
} elseif (preg_match('/ASC|DESC$/', $key)) {
$option = 'order';
$val = $Model->{$name}->alias . '.' . $key;
View
2 lib/Cake/View/Helper/FormHelper.php
@@ -786,7 +786,7 @@ public function label($fieldName = null, $text = null, $options = array()) {
$text = $fieldName;
}
if (substr($text, -3) == '_id') {
- $text = substr($text, 0, strlen($text) - 3);
+ $text = substr($text, 0, -3);
}
$text = __(Inflector::humanize(Inflector::underscore($text)));
}
View
2 lib/Cake/basics.php
@@ -308,7 +308,7 @@ function env($key) {
if (!strpos($name, '.php')) {
$offset = 4;
}
- return substr($filename, 0, strlen($filename) - (strlen($name) + $offset));
+ return substr($filename, 0, -(strlen($name) + $offset));
break;
case 'PHP_SELF':
return str_replace(env('DOCUMENT_ROOT'), '', env('SCRIPT_FILENAME'));

0 comments on commit eba0b1f

Please sign in to comment.