Applying patch from 'davidpersson' fixing code spacing. Closes #5643

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7772 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
mark_story 2008-10-23 00:10:44 +00:00
parent 6da2040b45
commit 1b456f2cf1
70 changed files with 233 additions and 233 deletions

View file

@ -383,15 +383,15 @@ class ShellDispatcher {
*/
function getInput($prompt, $options = null, $default = null) {
if (!is_array($options)) {
$print_options = '';
$printOptions = '';
} else {
$print_options = '(' . implode('/', $options) . ')';
$printOptions = '(' . implode('/', $options) . ')';
}
if ($default == null) {
$this->stdout($prompt . " $print_options \n" . '> ', false);
$this->stdout($prompt . " $printOptions \n" . '> ', false);
} else {
$this->stdout($prompt . " $print_options \n" . "[$default] > ", false);
$this->stdout($prompt . " $printOptions \n" . "[$default] > ", false);
}
$result = fgets($this->stdin);

View file

@ -389,13 +389,13 @@ class RequestHandlerComponent extends Object {
*/
function getReferrer() {
if (env('HTTP_HOST') != null) {
$sess_host = env('HTTP_HOST');
$sessHost = env('HTTP_HOST');
}
if (env('HTTP_X_FORWARDED_HOST') != null) {
$sess_host = env('HTTP_X_FORWARDED_HOST');
$sessHost = env('HTTP_X_FORWARDED_HOST');
}
return trim(preg_replace('/(?:\:.*)/', '', $sess_host));
return trim(preg_replace('/(?:\:.*)/', '', $sessHost));
}
/**
* Gets remote client IP

View file

@ -125,9 +125,9 @@ class Folder extends Object {
return $this->path;
}
/**
* Change directory to $desired_path.
* Change directory to $path.
*
* @param string $desired_path Path to the directory to change to
* @param string $path Path to the directory to change to
* @return string The new path. Returns false on failure
* @access public
*/
@ -189,12 +189,12 @@ class Folder extends Object {
* @return array Files that match given pattern
* @access public
*/
function find($regexp_pattern = '.*', $sort = false) {
function find($regexpPattern = '.*', $sort = false) {
list($dirs, $files) = $this->read($sort);
$found = array();
foreach ($files as $file) {
if (preg_match("/^{$regexp_pattern}$/i", $file)) {
if (preg_match("/^{$regexpPattern}$/i", $file)) {
$found[] = $file;
}
}
@ -536,9 +536,9 @@ class Folder extends Object {
$path = $this->slashTerm($path);
if (is_dir($path) === true) {
$files = glob($path . "*", GLOB_NOSORT);
$normal_files = glob($path . "*");
$hidden_files = glob($path . "\.?*");
$files = array_merge($normal_files, $hidden_files);
$normalFiles = glob($path . "*");
$hiddenFiles = glob($path . "\.?*");
$files = array_merge($normalFiles, $hiddenFiles);
if (is_array($files)) {
foreach ($files as $file) {
if (preg_match("/(\.|\.\.)$/", $file)) {

View file

@ -417,10 +417,10 @@ class Inflector extends Object {
return $replace;
}
/**
* Returns an underscore-syntaxed ($like_this_dear_reader) version of the $camel_cased_word.
* Returns an underscore-syntaxed (like_this_dear_reader) version of the $camel_cased_word.
*
* @param string $camel_cased_word Camel-cased word to be "underscorized"
* @return string Underscore-syntaxed version of the $camel_cased_word
* @param string $camelCasedWord Camel-cased word to be "underscorized"
* @return string Underscore-syntaxed version of the $camelCasedWord
* @access public
* @static
*/
@ -442,9 +442,9 @@ class Inflector extends Object {
return $replace;
}
/**
* Returns corresponding table name for given $class_name. ("posts" for the model class "Post").
* Returns corresponding table name for given $className. ("posts" for the model class "Post").
*
* @param string $class_name Name of class to get database table name for
* @param string $className Name of class to get database table name for
* @return string Name of the database table for given class
* @access public
* @static

View file

@ -118,7 +118,7 @@ class DboDb2 extends DboSource {
if ($config['cataloged']) {
$this->connection = $connect($config['database'], $config['login'], $config['password']);
} else {
$conn_string = sprintf(
$connString = sprintf(
"DRIVER={IBM DB2 ODBC DRIVER};DATABASE=%s;HOSTNAME=%s;PORT=%d;PROTOCOL=TCPIP;UID=%s;PWD=%s;",
$config['database'],
$config['hostname'],
@ -126,7 +126,7 @@ class DboDb2 extends DboSource {
$config['login'],
$config['password']
);
$this->connection = db2_connect($conn_string, '', '');
$this->connection = db2_connect($connString, '', '');
}
if ($this->connection) {
@ -164,12 +164,12 @@ class DboDb2 extends DboSource {
if (!is_bool($result)) {
// build table/column map for this result
$map = array();
$num_fields = db2_num_fields($result);
$numFields = db2_num_fields($result);
$index = 0;
$j = 0;
$offset = 0;
while ($j < $num_fields) {
while ($j < $numFields) {
$columnName = strtolower(db2_field_name($result, $j));
$tmp = strpos($sql, '.' . $columnName, $offset);
$tableName = substr($sql, $offset, ($tmp-$offset));

View file

@ -500,11 +500,11 @@ class DboMssql extends DboSource {
function resultSet(&$results) {
$this->results =& $results;
$this->map = array();
$num_fields = mssql_num_fields($results);
$numFields = mssql_num_fields($results);
$index = 0;
$j = 0;
while ($j < $num_fields) {
while ($j < $numFields) {
$column = mssql_field_name($results, $j);
if (strpos($column, '__')) {

View file

@ -436,11 +436,11 @@ class DboMysql extends DboSource {
}
$this->results =& $results;
$this->map = array();
$num_fields = mysql_num_fields($results);
$numFields = mysql_num_fields($results);
$index = 0;
$j = 0;
while ($j < $num_fields) {
while ($j < $numFields) {
$column = mysql_fetch_field($results,$j);
if (!empty($column->table)) {

View file

@ -412,10 +412,10 @@ class DboMysqli extends DboSource {
}
$this->results =& $results;
$this->map = array();
$num_fields = mysqli_num_fields($results);
$numFields = mysqli_num_fields($results);
$index = 0;
$j = 0;
while ($j < $num_fields) {
while ($j < $numFields) {
$column = mysqli_fetch_field_direct($results, $j);
if (!empty($column->table)) {
$this->map[$index++] = array($column->table, $column->name);

View file

@ -422,22 +422,22 @@ class CakeSession extends Object {
* @access private
*/
function __initSession() {
$ini_set = function_exists('ini_set');
$iniSet = function_exists('ini_set');
if ($ini_set && env('HTTPS')) {
if ($iniSet && env('HTTPS')) {
ini_set('session.cookie_secure', 1);
}
switch ($this->security) {
case 'high':
$this->cookieLifeTime = 0;
if ($ini_set) {
if ($iniSet) {
ini_set('session.referer_check', $this->host);
}
break;
case 'medium':
$this->cookieLifeTime = 7 * 86400;
if ($ini_set) {
if ($iniSet) {
ini_set('session.referer_check', $this->host);
}
break;
@ -450,7 +450,7 @@ class CakeSession extends Object {
switch (Configure::read('Session.save')) {
case 'cake':
if (!isset($_SESSION)) {
if ($ini_set) {
if ($iniSet) {
ini_set('session.use_trans_sid', 0);
ini_set('url_rewriter.tags', '');
ini_set('session.serialize_handler', 'php');
@ -471,7 +471,7 @@ class CakeSession extends Object {
} elseif (Configure::read('Session.database') === null) {
Configure::write('Session.database', 'default');
}
if ($ini_set) {
if ($iniSet) {
ini_set('session.use_trans_sid', 0);
ini_set('url_rewriter.tags', '');
ini_set('session.save_handler', 'user');
@ -492,7 +492,7 @@ class CakeSession extends Object {
break;
case 'php':
if (!isset($_SESSION)) {
if ($ini_set) {
if ($iniSet) {
ini_set('session.use_trans_sid', 0);
ini_set('session.name', Configure::read('Session.cookie'));
ini_set('session.cookie_lifetime', $this->cookieLifeTime);
@ -505,7 +505,7 @@ class CakeSession extends Object {
if (!class_exists('Cache')) {
uses('Cache');
}
if ($ini_set) {
if ($iniSet) {
ini_set('session.use_trans_sid', 0);
ini_set('url_rewriter.tags', '');
ini_set('session.save_handler', 'user');

View file

@ -81,7 +81,7 @@ class JsHelper extends Overloadable2 {
return 'alert("' . $this->escape($message) . '");';
}
function if_($if, $then, $else = null, $elseif = array()) {
function if_($if, $then, $else = null, $elseIf = array()) {
$len = strlen($if) - 1;
if ($if{$len} == ';') {
$if{$len} = null;
@ -89,7 +89,7 @@ class JsHelper extends Overloadable2 {
$out = 'if (' . $if . ') { ' . $then . ' }';
foreach ($elseif as $cond => $exec) {
foreach ($elseIf as $cond => $exec) {
//$out .=
}

View file

@ -38,8 +38,8 @@ class TimeHelper extends AppHelper {
/**
* Converts given time (in server's time zone) to user's local time, given his/her offset from GMT.
*
* @param string $server_time UNIX timestamp
* @param int $user_offset User's offset from GMT (in hours)
* @param string $serverTime UNIX timestamp
* @param int $userOffset User's offset from GMT (in hours)
* @return string UNIX timestamp
*/
function convert($serverTime, $userOffset) {
@ -317,8 +317,8 @@ class TimeHelper extends AppHelper {
if (!is_null($userOffset)) {
$now = $this->convert(time(), $userOffset);
}
$in_seconds = $this->fromString($dateTime, $userOffset);
$backwards = ($in_seconds > $now);
$inSeconds = $this->fromString($dateTime, $userOffset);
$backwards = ($inSeconds > $now);
$format = 'j/n/y';
$end = '+1 month';
@ -337,22 +337,22 @@ class TimeHelper extends AppHelper {
}
if ($backwards) {
$future_time = $in_seconds;
$past_time = $now;
$futureTime = $inSeconds;
$pastTime = $now;
} else {
$future_time = $now;
$past_time = $in_seconds;
$futureTime = $now;
$pastTime = $inSeconds;
}
$diff = $future_time - $past_time;
$diff = $futureTime - $pastTime;
// If more than a week, then take into account the length of months
if ($diff >= 604800) {
$current = array();
$date = array();
list($future['H'], $future['i'], $future['s'], $future['d'], $future['m'], $future['Y']) = explode('/', date('H/i/s/d/m/Y', $future_time));
list($future['H'], $future['i'], $future['s'], $future['d'], $future['m'], $future['Y']) = explode('/', date('H/i/s/d/m/Y', $futureTime));
list($past['H'], $past['i'], $past['s'], $past['d'], $past['m'], $past['Y']) = explode('/', date('H/i/s/d/m/Y', $past_time));
list($past['H'], $past['i'], $past['s'], $past['d'], $past['m'], $past['Y']) = explode('/', date('H/i/s/d/m/Y', $pastTime));
$years = $months = $weeks = $days = $hours = $minutes = $seconds = 0;
if ($future['Y'] == $past['Y'] && $future['m'] == $past['m']) {
@ -379,13 +379,13 @@ class TimeHelper extends AppHelper {
if ($future['d'] >= $past['d']) {
$days = $future['d'] - $past['d'];
} else {
$days_in_past_month = date('t', $past_time);
$days_in_future_month = date('t', mktime(0, 0, 0, $future['m'] - 1, 1, $future['Y']));
$daysInPastMonth = date('t', $pastTime);
$daysInFutureMonth = date('t', mktime(0, 0, 0, $future['m'] - 1, 1, $future['Y']));
if (!$backwards) {
$days = ($days_in_past_month - $past['d']) + $future['d'];
$days = ($daysInPastMonth - $past['d']) + $future['d'];
} else {
$days = ($days_in_future_month - $past['d']) + $future['d'];
$days = ($daysInFutureMonth - $past['d']) + $future['d'];
}
if ($future['m'] != $past['m']) {
@ -420,48 +420,48 @@ class TimeHelper extends AppHelper {
$diff = $diff - ($minutes * 60);
$seconds = $diff;
}
$relative_date = '';
$diff = $future_time - $past_time;
$relativeDate = '';
$diff = $futureTime - $pastTime;
if ($diff > abs($now - $this->fromString($end))) {
$relative_date = sprintf(__('on %s',true), date($format, $in_seconds));
$relativeDate = sprintf(__('on %s',true), date($format, $inSeconds));
} else {
if ($years > 0) {
// years and months and days
$relative_date .= ($relative_date ? ', ' : '') . $years . ' ' . __n('year', 'years', $years, true);
$relative_date .= $months > 0 ? ($relative_date ? ', ' : '') . $months . ' ' . __n('month', 'months', $months, true) : '';
$relative_date .= $weeks > 0 ? ($relative_date ? ', ' : '') . $weeks . ' ' . __n('week', 'weeks', $weeks, true) : '';
$relative_date .= $days > 0 ? ($relative_date ? ', ' : '') . $days . ' ' . __n('day', 'days', $days, true) : '';
$relativeDate .= ($relativeDate ? ', ' : '') . $years . ' ' . __n('year', 'years', $years, true);
$relativeDate .= $months > 0 ? ($relativeDate ? ', ' : '') . $months . ' ' . __n('month', 'months', $months, true) : '';
$relativeDate .= $weeks > 0 ? ($relativeDate ? ', ' : '') . $weeks . ' ' . __n('week', 'weeks', $weeks, true) : '';
$relativeDate .= $days > 0 ? ($relativeDate ? ', ' : '') . $days . ' ' . __n('day', 'days', $days, true) : '';
} elseif (abs($months) > 0) {
// months, weeks and days
$relative_date .= ($relative_date ? ', ' : '') . $months . ' ' . __n('month', 'months', $months, true);
$relative_date .= $weeks > 0 ? ($relative_date ? ', ' : '') . $weeks . ' ' . __n('week', 'weeks', $weeks, true) : '';
$relative_date .= $days > 0 ? ($relative_date ? ', ' : '') . $days . ' ' . __n('day', 'days', $days, true) : '';
$relativeDate .= ($relativeDate ? ', ' : '') . $months . ' ' . __n('month', 'months', $months, true);
$relativeDate .= $weeks > 0 ? ($relativeDate ? ', ' : '') . $weeks . ' ' . __n('week', 'weeks', $weeks, true) : '';
$relativeDate .= $days > 0 ? ($relativeDate ? ', ' : '') . $days . ' ' . __n('day', 'days', $days, true) : '';
} elseif (abs($weeks) > 0) {
// weeks and days
$relative_date .= ($relative_date ? ', ' : '') . $weeks . ' ' . __n('week', 'weeks', $weeks, true);
$relative_date .= $days > 0 ? ($relative_date ? ', ' : '') . $days . ' ' . __n('day', 'days', $days, true) : '';
$relativeDate .= ($relativeDate ? ', ' : '') . $weeks . ' ' . __n('week', 'weeks', $weeks, true);
$relativeDate .= $days > 0 ? ($relativeDate ? ', ' : '') . $days . ' ' . __n('day', 'days', $days, true) : '';
} elseif (abs($days) > 0) {
// days and hours
$relative_date .= ($relative_date ? ', ' : '') . $days . ' ' . __n('day', 'days', $days, true);
$relative_date .= $hours > 0 ? ($relative_date ? ', ' : '') . $hours . ' ' . __n('hour', 'hours', $hours, true) : '';
$relativeDate .= ($relativeDate ? ', ' : '') . $days . ' ' . __n('day', 'days', $days, true);
$relativeDate .= $hours > 0 ? ($relativeDate ? ', ' : '') . $hours . ' ' . __n('hour', 'hours', $hours, true) : '';
} elseif (abs($hours) > 0) {
// hours and minutes
$relative_date .= ($relative_date ? ', ' : '') . $hours . ' ' . __n('hour', 'hours', $hours, true);
$relative_date .= $minutes > 0 ? ($relative_date ? ', ' : '') . $minutes . ' ' . __n('minute', 'minutes', $minutes, true) : '';
$relativeDate .= ($relativeDate ? ', ' : '') . $hours . ' ' . __n('hour', 'hours', $hours, true);
$relativeDate .= $minutes > 0 ? ($relativeDate ? ', ' : '') . $minutes . ' ' . __n('minute', 'minutes', $minutes, true) : '';
} elseif (abs($minutes) > 0) {
// minutes only
$relative_date .= ($relative_date ? ', ' : '') . $minutes . ' ' . __n('minute', 'minutes', $minutes, true);
$relativeDate .= ($relativeDate ? ', ' : '') . $minutes . ' ' . __n('minute', 'minutes', $minutes, true);
} else {
// seconds only
$relative_date .= ($relative_date ? ', ' : '') . $seconds . ' ' . __n('second', 'seconds', $seconds, true);
$relativeDate .= ($relativeDate ? ', ' : '') . $seconds . ' ' . __n('second', 'seconds', $seconds, true);
}
if (!$backwards) {
$relative_date = sprintf(__('%s ago', true), $relative_date);
$relativeDate = sprintf(__('%s ago', true), $relativeDate);
}
}
return $this->output($relative_date);
return $this->output($relativeDate);
}
/**
* Alias for timeAgoInWords

View file

@ -406,7 +406,7 @@ class View extends Object {
* @return mixed Rendered output, or false on error
*/
function renderLayout($content_for_layout, $layout = null) {
$layout_fn = $this->_getLayoutFileName($layout);
$layoutFileName = $this->_getLayoutFileName($layout);
$debug = '';
if (isset($this->viewVars['cakeDebug']) && Configure::read() > 2) {
@ -447,15 +447,15 @@ class View extends Object {
}
}
if (substr($layout_fn, -3) === 'ctp' || substr($layout_fn, -5) === 'thtml') {
$this->output = View::_render($layout_fn, $data_for_layout, $loadHelpers, true);
if (substr($layoutFileName, -3) === 'ctp' || substr($layoutFileName, -5) === 'thtml') {
$this->output = View::_render($layoutFileName, $data_for_layout, $loadHelpers, true);
} else {
$this->output = $this->_render($layout_fn, $data_for_layout, $loadHelpers);
$this->output = $this->_render($layoutFileName, $data_for_layout, $loadHelpers);
}
if ($this->output === false) {
$this->output = $this->_render($layout_fn, $data_for_layout);
trigger_error(sprintf(__("Error in layout %s, got: <blockquote>%s</blockquote>", true), $layout_fn, $this->output), E_USER_ERROR);
$this->output = $this->_render($layoutFileName, $data_for_layout);
trigger_error(sprintf(__("Error in layout %s, got: <blockquote>%s</blockquote>", true), $layoutFileName, $this->output), E_USER_ERROR);
return false;
}