Skip to content

Commit

Permalink
Merge pull request #380 from shama/patch-code-standards
Browse files Browse the repository at this point in the history
Code standards formatting
  • Loading branch information
renan committed Dec 16, 2011
2 parents f1b566b + d794084 commit 1f8f2ce
Show file tree
Hide file tree
Showing 63 changed files with 269 additions and 260 deletions.
4 changes: 2 additions & 2 deletions lib/Cake/Console/Command/ApiShell.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function main() {
$this->_stop(); $this->_stop();
} }
$method = $parsed[$this->params['method']]; $method = $parsed[$this->params['method']];
$this->out($class .'::'.$method['method'] . $method['parameters']); $this->out($class . '::' . $method['method'] . $method['parameters']);
$this->hr(); $this->hr();
$this->out($method['comment'], true); $this->out($method['comment'], true);
} else { } else {
Expand All @@ -127,7 +127,7 @@ public function main() {
if (isset($methods[--$number])) { if (isset($methods[--$number])) {
$method = $parsed[$methods[$number]]; $method = $parsed[$methods[$number]];
$this->hr(); $this->hr();
$this->out($class .'::'.$method['method'] . $method['parameters']); $this->out($class . '::' . $method['method'] . $method['parameters']);
$this->hr(); $this->hr();
$this->out($method['comment'], true); $this->out($method['comment'], true);
} }
Expand Down
6 changes: 3 additions & 3 deletions lib/Cake/Console/Command/Task/ProjectTask.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ public function securitySalt($path) {
$contents = $File->read(); $contents = $File->read();
if (preg_match('/([\s]*Configure::write\(\'Security.salt\',[\s\'A-z0-9]*\);)/', $contents, $match)) { if (preg_match('/([\s]*Configure::write\(\'Security.salt\',[\s\'A-z0-9]*\);)/', $contents, $match)) {
$string = Security::generateAuthKey(); $string = Security::generateAuthKey();
$result = str_replace($match[0], "\t" . 'Configure::write(\'Security.salt\', \''.$string.'\');', $contents); $result = str_replace($match[0], "\t" . 'Configure::write(\'Security.salt\', \'' . $string . '\');', $contents);
if ($File->write($result)) { if ($File->write($result)) {
return true; return true;
} }
Expand All @@ -290,7 +290,7 @@ public function securityCipherSeed($path) {
if (preg_match('/([\s]*Configure::write\(\'Security.cipherSeed\',[\s\'A-z0-9]*\);)/', $contents, $match)) { if (preg_match('/([\s]*Configure::write\(\'Security.cipherSeed\',[\s\'A-z0-9]*\);)/', $contents, $match)) {
App::uses('Security', 'Utility'); App::uses('Security', 'Utility');
$string = substr(bin2hex(Security::generateAuthKey()), 0, 30); $string = substr(bin2hex(Security::generateAuthKey()), 0, 30);
$result = str_replace($match[0], "\t" . 'Configure::write(\'Security.cipherSeed\', \''.$string.'\');', $contents); $result = str_replace($match[0], "\t" . 'Configure::write(\'Security.cipherSeed\', \'' . $string . '\');', $contents);
if ($File->write($result)) { if ($File->write($result)) {
return true; return true;
} }
Expand Down Expand Up @@ -357,7 +357,7 @@ public function cakeAdmin($name) {
$File = new File($path . 'core.php'); $File = new File($path . 'core.php');
$contents = $File->read(); $contents = $File->read();
if (preg_match('%(\s*[/]*Configure::write\(\'Routing.prefixes\',[\s\'a-z,\)\(]*\);)%', $contents, $match)) { if (preg_match('%(\s*[/]*Configure::write\(\'Routing.prefixes\',[\s\'a-z,\)\(]*\);)%', $contents, $match)) {
$result = str_replace($match[0], "\n" . 'Configure::write(\'Routing.prefixes\', array(\''.$name.'\'));', $contents); $result = str_replace($match[0], "\n" . 'Configure::write(\'Routing.prefixes\', array(\'' . $name . '\'));', $contents);
if ($File->write($result)) { if ($File->write($result)) {
Configure::write('Routing.prefixes', array($name)); Configure::write('Routing.prefixes', array($name));
return true; return true;
Expand Down
8 changes: 4 additions & 4 deletions lib/Cake/Controller/Component/AclComponent.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -488,11 +488,11 @@ public function getAclLink($aro, $aco) {
} }


return array( return array(
'aro' => Set::extract($obj, 'Aro.0.'.$this->Aro->alias.'.id'), 'aro' => Set::extract($obj, 'Aro.0.' . $this->Aro->alias . '.id'),
'aco' => Set::extract($obj, 'Aco.0.'.$this->Aco->alias.'.id'), 'aco' => Set::extract($obj, 'Aco.0.' . $this->Aco->alias . '.id'),
'link' => $this->Aro->Permission->find('all', array('conditions' => array( 'link' => $this->Aro->Permission->find('all', array('conditions' => array(
$this->Aro->Permission->alias . '.aro_id' => Set::extract($obj, 'Aro.0.'.$this->Aro->alias.'.id'), $this->Aro->Permission->alias . '.aro_id' => Set::extract($obj, 'Aro.0.' . $this->Aro->alias . '.id'),
$this->Aro->Permission->alias . '.aco_id' => Set::extract($obj, 'Aco.0.'.$this->Aco->alias.'.id') $this->Aro->Permission->alias . '.aco_id' => Set::extract($obj, 'Aco.0.' . $this->Aco->alias . '.id')
))) )))
); );
} }
Expand Down
6 changes: 3 additions & 3 deletions lib/Cake/Controller/Controller.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -981,7 +981,7 @@ public function postConditions($data = array(), $op = null, $bool = 'AND', $excl
$arrayOp = is_array($op); $arrayOp = is_array($op);
foreach ($data as $model => $fields) { foreach ($data as $model => $fields) {
foreach ($fields as $field => $value) { foreach ($fields as $field => $value) {
$key = $model.'.'.$field; $key = $model . '.' . $field;
$fieldOp = $op; $fieldOp = $op;
if ($arrayOp) { if ($arrayOp) {
if (array_key_exists($key, $op)) { if (array_key_exists($key, $op)) {
Expand All @@ -998,9 +998,9 @@ public function postConditions($data = array(), $op = null, $bool = 'AND', $excl
$fieldOp = strtoupper(trim($fieldOp)); $fieldOp = strtoupper(trim($fieldOp));
if ($fieldOp === 'LIKE') { if ($fieldOp === 'LIKE') {
$key = $key.' LIKE'; $key = $key.' LIKE';
$value = '%'.$value.'%'; $value = '%' . $value . '%';
} elseif ($fieldOp && $fieldOp != '=') { } elseif ($fieldOp && $fieldOp != '=') {
$key = $key.' '.$fieldOp; $key = $key.' ' . $fieldOp;
} }
$cond[$key] = $value; $cond[$key] = $value;
} }
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Core/App.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ protected static function _loadClass($name, $plugin, $type, $originalType, $pare
} }
App::uses($extends, $extendType); App::uses($extends, $extendType);
if ($plugin && in_array($originalType, array('controller', 'model'))) { if ($plugin && in_array($originalType, array('controller', 'model'))) {
App::uses($plugin . $extends, $plugin . '.' .$type); App::uses($plugin . $extends, $plugin . '.' . $type);
} }
} }
if ($plugin) { if ($plugin) {
Expand Down
6 changes: 3 additions & 3 deletions lib/Cake/I18n/I18n.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public static function translate($singular, $plural = null, $domain = null, $cat
} }


if ($_this->category == 'LC_TIME') { if ($_this->category == 'LC_TIME') {
return $_this->_translateTime($singular,$domain); return $_this->_translateTime($singular, $domain);
} }


if (!isset($count)) { if (!isset($count)) {
Expand Down Expand Up @@ -466,7 +466,7 @@ protected function _loadPo($file, $domain) {
} while (!feof($file)); } while (!feof($file));
fclose($file); fclose($file);
$merge[""] = $header; $merge[""] = $header;
return $this->_domains[$domain][$this->_lang][$this->category] = array_merge($merge ,$translations); return $this->_domains[$domain][$this->_lang][$this->category] = array_merge($merge, $translations);
} }


/** /**
Expand All @@ -486,7 +486,7 @@ protected function _loadLocaleDefinition($file, $domain = null) {
if (empty($line) || $line[0] === $comment) { if (empty($line) || $line[0] === $comment) {
continue; continue;
} }
$parts = preg_split("/[[:space:]]+/",$line); $parts = preg_split("/[[:space:]]+/", $line);
if ($parts[0] === 'comment_char') { if ($parts[0] === 'comment_char') {
$comment = $parts[1]; $comment = $parts[1];
continue; continue;
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/I18n/Multibyte.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ public static function strtoupper($string) {
* @param string $haystack The string being checked. * @param string $haystack The string being checked.
* @param string $needle The string being found. * @param string $needle The string being found.
* @return integer The number of times the $needle substring occurs in the $haystack string. * @return integer The number of times the $needle substring occurs in the $haystack string.
*/ */
public static function substrCount($haystack, $needle) { public static function substrCount($haystack, $needle) {
$count = 0; $count = 0;
$haystack = Multibyte::utf8($haystack); $haystack = Multibyte::utf8($haystack);
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Model/AclNode.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function node($ref = null) {
$queryData['joins'][] = array( $queryData['joins'][] = array(
'table' => $table, 'table' => $table,
'alias' => "{$type}{$i}", 'alias' => "{$type}{$i}",
'type' => 'LEFT', 'type' => 'LEFT',
'conditions' => array( 'conditions' => array(
$db->name("{$type}{$i}.lft") . ' > ' . $db->name("{$type}{$j}.lft"), $db->name("{$type}{$i}.lft") . ' > ' . $db->name("{$type}{$j}.lft"),
$db->name("{$type}{$i}.rght") . ' < ' . $db->name("{$type}{$j}.rght"), $db->name("{$type}{$i}.rght") . ' < ' . $db->name("{$type}{$j}.rght"),
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Model/Behavior/ContainableBehavior.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -308,10 +308,10 @@ public function containments($Model, $contain, $containments = array(), $throwEr
$val = preg_split('/\s*,\s*/', substr(substr($key, 1), 0, -1)); $val = preg_split('/\s*,\s*/', substr(substr($key, 1), 0, -1));
} elseif (preg_match('/ASC|DESC$/', $key)) { } elseif (preg_match('/ASC|DESC$/', $key)) {
$option = 'order'; $option = 'order';
$val = $Model->{$name}->alias.'.'.$key; $val = $Model->{$name}->alias . '.' . $key;
} elseif (preg_match('/[ =!]/', $key)) { } elseif (preg_match('/[ =!]/', $key)) {
$option = 'conditions'; $option = 'conditions';
$val = $Model->{$name}->alias.'.'.$key; $val = $Model->{$name}->alias . '.' . $key;
} }
$children[$option] = is_array($val) ? $val : array($val); $children[$option] = is_array($val) ? $val : array($val);
$newChildren = null; $newChildren = null;
Expand Down
38 changes: 19 additions & 19 deletions lib/Cake/Model/Behavior/TranslateBehavior.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ public function beforeFind($model, $query) {
$joinTable->tablePrefix = $tablePrefix; $joinTable->tablePrefix = $tablePrefix;
$joinTable->table = $RuntimeModel->table; $joinTable->table = $RuntimeModel->table;


if (is_string($query['fields']) && 'COUNT(*) AS '.$db->name('count') == $query['fields']) { if (is_string($query['fields']) && 'COUNT(*) AS ' . $db->name('count') == $query['fields']) {
$query['fields'] = 'COUNT(DISTINCT('.$db->name($model->alias . '.' . $model->primaryKey) . ')) ' . $db->alias . 'count'; $query['fields'] = 'COUNT(DISTINCT(' . $db->name($model->alias . '.' . $model->primaryKey) . ')) ' . $db->alias . 'count';
$query['joins'][] = array( $query['joins'][] = array(
'type' => 'INNER', 'type' => 'INNER',
'alias' => $RuntimeModel->alias, 'alias' => $RuntimeModel->alias,
Expand All @@ -126,7 +126,7 @@ public function beforeFind($model, $query) {
foreach ($fields as $key => $value) { foreach ($fields as $key => $value) {
$field = (is_numeric($key)) ? $value : $key; $field = (is_numeric($key)) ? $value : $key;


if (in_array($model->alias.'.*', $query['fields']) || in_array($model->alias.'.'.$field, $query['fields']) || in_array($field, $query['fields'])) { if (in_array($model->alias.'.*', $query['fields']) || in_array($model->alias.'.' . $field, $query['fields']) || in_array($field, $query['fields'])) {
$addFields[] = $field; $addFields[] = $field;
} }
} }
Expand All @@ -137,7 +137,7 @@ public function beforeFind($model, $query) {
foreach ($addFields as $_f => $field) { foreach ($addFields as $_f => $field) {
$aliasField = is_numeric($_f) ? $field : $_f; $aliasField = is_numeric($_f) ? $field : $_f;


foreach (array($aliasField, $model->alias.'.'.$aliasField) as $_field) { foreach (array($aliasField, $model->alias . '.' . $aliasField) as $_field) {
$key = array_search($_field, (array)$query['fields']); $key = array_search($_field, (array)$query['fields']);


if ($key !== false) { if ($key !== false) {
Expand All @@ -147,36 +147,36 @@ public function beforeFind($model, $query) {


if (is_array($locale)) { if (is_array($locale)) {
foreach ($locale as $_locale) { foreach ($locale as $_locale) {
$model->virtualFields['i18n_'.$field.'_'.$_locale] = 'I18n__'.$field.'__'.$_locale.'.content'; $model->virtualFields['i18n_' . $field . '_' . $_locale] = 'I18n__' . $field . '__' . $_locale . '.content';
if (!empty($query['fields'])) { if (!empty($query['fields'])) {
$query['fields'][] = 'i18n_'.$field.'_'.$_locale; $query['fields'][] = 'i18n_' . $field . '_' . $_locale;
} }
$query['joins'][] = array( $query['joins'][] = array(
'type' => 'LEFT', 'type' => 'LEFT',
'alias' => 'I18n__'.$field.'__'.$_locale, 'alias' => 'I18n__' . $field . '__' . $_locale,
'table' => $joinTable, 'table' => $joinTable,
'conditions' => array( 'conditions' => array(
$model->alias . '.' . $model->primaryKey => $db->identifier("I18n__{$field}__{$_locale}.foreign_key"), $model->alias . '.' . $model->primaryKey => $db->identifier("I18n__{$field}__{$_locale}.foreign_key"),
'I18n__'.$field.'__'.$_locale.'.model' => $model->name, 'I18n__' . $field . '__' . $_locale . '.model' => $model->name,
'I18n__'.$field.'__'.$_locale.'.'.$RuntimeModel->displayField => $aliasField, 'I18n__' . $field . '__' . $_locale . '.' . $RuntimeModel->displayField => $aliasField,
'I18n__'.$field.'__'.$_locale.'.locale' => $_locale 'I18n__' . $field . '__' . $_locale . '.locale' => $_locale
) )
); );
} }
} else { } else {
$model->virtualFields['i18n_'.$field] = 'I18n__'.$field.'.content'; $model->virtualFields['i18n_' . $field] = 'I18n__' . $field . '.content';
if (!empty($query['fields'])) { if (!empty($query['fields'])) {
$query['fields'][] = 'i18n_'.$field; $query['fields'][] = 'i18n_' . $field;
} }
$query['joins'][] = array( $query['joins'][] = array(
'type' => 'INNER', 'type' => 'INNER',
'alias' => 'I18n__'.$field, 'alias' => 'I18n__' . $field,
'table' => $joinTable, 'table' => $joinTable,
'conditions' => array( 'conditions' => array(
$model->alias . '.' . $model->primaryKey => $db->identifier("I18n__{$field}.foreign_key"), $model->alias . '.' . $model->primaryKey => $db->identifier("I18n__{$field}.foreign_key"),
'I18n__'.$field.'.model' => $model->name, 'I18n__' . $field . '.model' => $model->name,
'I18n__'.$field.'.'.$RuntimeModel->displayField => $aliasField, 'I18n__' . $field . '.' . $RuntimeModel->displayField => $aliasField,
'I18n__'.$field.'.locale' => $locale 'I18n__' . $field . '.locale' => $locale
) )
); );
} }
Expand Down Expand Up @@ -211,11 +211,11 @@ public function afterFind($model, $results, $primary) {


if (is_array($locale)) { if (is_array($locale)) {
foreach ($locale as $_locale) { foreach ($locale as $_locale) {
if (!isset($row[$model->alias][$aliasField]) && !empty($row[$model->alias]['i18n_'.$field.'_'.$_locale])) { if (!isset($row[$model->alias][$aliasField]) && !empty($row[$model->alias]['i18n_' . $field . '_' . $_locale])) {
$row[$model->alias][$aliasField] = $row[$model->alias]['i18n_'.$field.'_'.$_locale]; $row[$model->alias][$aliasField] = $row[$model->alias]['i18n_' . $field . '_' . $_locale];
$row[$model->alias]['locale'] = $_locale; $row[$model->alias]['locale'] = $_locale;
} }
unset($row[$model->alias]['i18n_'.$field.'_'.$_locale]); unset($row[$model->alias]['i18n_' . $field . '_' . $_locale]);
} }


if (!isset($row[$model->alias][$aliasField])) { if (!isset($row[$model->alias][$aliasField])) {
Expand Down
8 changes: 4 additions & 4 deletions lib/Cake/Model/Behavior/TreeBehavior.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -163,8 +163,8 @@ public function beforeSave($Model) {
$this->_addToWhitelist($Model, $parent); $this->_addToWhitelist($Model, $parent);
} else { } else {
$values = $Model->find('first', array( $values = $Model->find('first', array(
'conditions' => array($scope,$Model->escapeField() => $Model->id), 'conditions' => array($scope, $Model->escapeField() => $Model->id),
'fields' => array($Model->primaryKey, $parent, $left, $right ), 'recursive' => $recursive) 'fields' => array($Model->primaryKey, $parent, $left, $right), 'recursive' => $recursive)
); );


if ($values === false) { if ($values === false) {
Expand Down Expand Up @@ -503,7 +503,7 @@ public function moveUp($Model, $id = null, $number = 1) {
extract($this->settings[$Model->alias]); extract($this->settings[$Model->alias]);
list($node) = array_values($Model->find('first', array( list($node) = array_values($Model->find('first', array(
'conditions' => array($scope, $Model->escapeField() => $id), 'conditions' => array($scope, $Model->escapeField() => $id),
'fields' => array($Model->primaryKey, $left, $right, $parent ), 'recursive' => $recursive 'fields' => array($Model->primaryKey, $left, $right, $parent), 'recursive' => $recursive
))); )));
if ($node[$parent]) { if ($node[$parent]) {
list($parentNode) = array_values($Model->find('first', array( list($parentNode) = array_values($Model->find('first', array(
Expand All @@ -527,7 +527,7 @@ public function moveUp($Model, $id = null, $number = 1) {
} }
$edge = $this->_getMax($Model, $scope, $right, $recursive); $edge = $this->_getMax($Model, $scope, $right, $recursive);
$this->_sync($Model, $edge - $previousNode[$left] +1, '+', 'BETWEEN ' . $previousNode[$left] . ' AND ' . $previousNode[$right]); $this->_sync($Model, $edge - $previousNode[$left] +1, '+', 'BETWEEN ' . $previousNode[$left] . ' AND ' . $previousNode[$right]);
$this->_sync($Model, $node[$left] - $previousNode[$left], '-', 'BETWEEN ' .$node[$left] . ' AND ' . $node[$right]); $this->_sync($Model, $node[$left] - $previousNode[$left], '-', 'BETWEEN ' . $node[$left] . ' AND ' . $node[$right]);
$this->_sync($Model, $edge - $previousNode[$left] - ($node[$right] - $node[$left]), '-', '> ' . $edge); $this->_sync($Model, $edge - $previousNode[$left] - ($node[$right] - $node[$left]), '-', '> ' . $edge);
if (is_int($number)) { if (is_int($number)) {
$number--; $number--;
Expand Down
16 changes: 8 additions & 8 deletions lib/Cake/Model/Datasource/Database/Postgres.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class Postgres extends DboSource {
*/ */
public $columns = array( public $columns = array(
'primary_key' => array('name' => 'serial NOT NULL'), 'primary_key' => array('name' => 'serial NOT NULL'),
'string' => array('name' => 'varchar', 'limit' => '255'), 'string' => array('name' => 'varchar', 'limit' => '255'),
'text' => array('name' => 'text'), 'text' => array('name' => 'text'),
'integer' => array('name' => 'integer', 'formatter' => 'intval'), 'integer' => array('name' => 'integer', 'formatter' => 'intval'),
'float' => array('name' => 'float', 'formatter' => 'floatval'), 'float' => array('name' => 'float', 'formatter' => 'floatval'),
Expand All @@ -78,7 +78,7 @@ class Postgres extends DboSource {
'binary' => array('name' => 'bytea'), 'binary' => array('name' => 'bytea'),
'boolean' => array('name' => 'boolean'), 'boolean' => array('name' => 'boolean'),
'number' => array('name' => 'numeric'), 'number' => array('name' => 'numeric'),
'inet' => array('name' => 'inet') 'inet' => array('name' => 'inet')
); );


/** /**
Expand Down Expand Up @@ -218,14 +218,14 @@ public function describe($model) {
$length = null; $length = null;
} }
$fields[$c->name] = array( $fields[$c->name] = array(
'type' => $this->column($type), 'type' => $this->column($type),
'null' => ($c->null == 'NO' ? false : true), 'null' => ($c->null == 'NO' ? false : true),
'default' => preg_replace( 'default' => preg_replace(
"/^'(.*)'$/", "/^'(.*)'$/",
"$1", "$1",
preg_replace('/::.*/', '', $c->default) preg_replace('/::.*/', '', $c->default)
), ),
'length' => $length 'length' => $length
); );
if ($model instanceof Model) { if ($model instanceof Model) {
if ($c->name == $model->primaryKey) { if ($c->name == $model->primaryKey) {
Expand Down Expand Up @@ -412,7 +412,7 @@ protected function _quoteFunctionField($match) {
$match[1] = $this->name($match[1]); $match[1] = $this->name($match[1]);
} }
} }
return '(' . $prepend .$match[1] . ')'; return '(' . $prepend . $match[1] . ')';
} }


/** /**
Expand Down Expand Up @@ -480,13 +480,13 @@ public function alterSchema($compare, $table = null) {
case 'add': case 'add':
foreach ($column as $field => $col) { foreach ($column as $field => $col) {
$col['name'] = $field; $col['name'] = $field;
$colList[] = 'ADD COLUMN '.$this->buildColumn($col); $colList[] = 'ADD COLUMN ' . $this->buildColumn($col);
} }
break; break;
case 'drop': case 'drop':
foreach ($column as $field => $col) { foreach ($column as $field => $col) {
$col['name'] = $field; $col['name'] = $field;
$colList[] = 'DROP COLUMN '.$this->name($field); $colList[] = 'DROP COLUMN ' . $this->name($field);
} }
break; break;
case 'change': case 'change':
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Model/Datasource/Database/Sqlite.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public function column($real) {
if (is_array($real)) { if (is_array($real)) {
$col = $real['name']; $col = $real['name'];
if (isset($real['limit'])) { if (isset($real['limit'])) {
$col .= '('.$real['limit'].')'; $col .= '(' . $real['limit'] . ')';
} }
return $col; return $col;
} }
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Model/Datasource/Database/Sqlserver.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ public function fields($model, $alias = null, $fields = array(), $quote = true)
$fieldAlias = $this->name($alias . '__' . $fields[$i]); $fieldAlias = $this->name($alias . '__' . $fields[$i]);
} else { } else {
$build = explode('.', $fields[$i]); $build = explode('.', $fields[$i]);
$this->_fieldMappings[$build[0] . '__' .$build[1]] = $fields[$i]; $this->_fieldMappings[$build[0] . '__' . $build[1]] = $fields[$i];
$fieldName = $this->name($build[0] . '.' . $build[1]); $fieldName = $this->name($build[0] . '.' . $build[1]);
$fieldAlias = $this->name(preg_replace("/^\[(.+)\]$/", "$1", $build[0]) . '__' . $build[1]); $fieldAlias = $this->name(preg_replace("/^\[(.+)\]$/", "$1", $build[0]) . '__' . $build[1]);
} }
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Model/Datasource/DboSource.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -787,7 +787,7 @@ public function name($data) {
} }
return $data; return $data;
} }
$cacheKey = crc32($this->startQuote.$data.$this->endQuote); $cacheKey = crc32($this->startQuote . $data . $this->endQuote);
if ($return = $this->cacheMethod(__FUNCTION__, $cacheKey)) { if ($return = $this->cacheMethod(__FUNCTION__, $cacheKey)) {
return $return; return $return;
} }
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Model/Model.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -2417,7 +2417,7 @@ public function hasAny($conditions = null) {
* Queries the datasource and returns a result set array. * Queries the datasource and returns a result set array.
* *
* Also used to perform notation finds, where the first argument is type of find operation to perform * Also used to perform notation finds, where the first argument is type of find operation to perform
* (all / first / count / neighbors / list / threaded ), * (all / first / count / neighbors / list / threaded),
* second parameter options for finding ( indexed array, including: 'conditions', 'limit', * second parameter options for finding ( indexed array, including: 'conditions', 'limit',
* 'recursive', 'page', 'fields', 'offset', 'order') * 'recursive', 'page', 'fields', 'offset', 'order')
* *
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Network/CakeResponse.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ protected function _setContentLength() {
$this->_headers['Content-Length'] = $offset + strlen($this->_body); $this->_headers['Content-Length'] = $offset + strlen($this->_body);
} }
} }
} }


/** /**
* Sends a header to the client. * Sends a header to the client.
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Network/CakeSocket.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ public function connect() {
} }


if ($this->config['persistent'] == true) { if ($this->config['persistent'] == true) {
$this->connection = @pfsockopen($scheme.$this->config['host'], $this->config['port'], $errNum, $errStr, $this->config['timeout']); $this->connection = @pfsockopen($scheme . $this->config['host'], $this->config['port'], $errNum, $errStr, $this->config['timeout']);
} else { } else {
$this->connection = @fsockopen($scheme.$this->config['host'], $this->config['port'], $errNum, $errStr, $this->config['timeout']); $this->connection = @fsockopen($scheme . $this->config['host'], $this->config['port'], $errNum, $errStr, $this->config['timeout']);
} }


if (!empty($errNum) || !empty($errStr)) { if (!empty($errNum) || !empty($errStr)) {
Expand Down
Loading

0 comments on commit 1f8f2ce

Please sign in to comment.