From f7a485850376fb52552b5856b695003879e09641 Mon Sep 17 00:00:00 2001 From: nate Date: Fri, 20 Jun 2008 11:57:56 +0000 Subject: [PATCH] Correcting coding standards violations git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7220 3807eeeb-6ff5-0310-8944-8be069107fe0 --- cake/libs/view/helper.php | 2 +- cake/libs/view/helpers/cache.php | 17 ++++++------ cake/libs/view/helpers/form.php | 37 +++++++++++++-------------- cake/libs/view/helpers/html.php | 12 ++++----- cake/libs/view/helpers/javascript.php | 2 +- cake/libs/view/helpers/number.php | 35 ++++++++++++++----------- cake/libs/view/helpers/rss.php | 4 +-- cake/libs/view/helpers/time.php | 4 +-- cake/libs/view/theme.php | 18 ++++++------- cake/libs/view/view.php | 2 +- 10 files changed, 69 insertions(+), 64 deletions(-) diff --git a/cake/libs/view/helper.php b/cake/libs/view/helper.php index ef77a605c..921828483 100644 --- a/cake/libs/view/helper.php +++ b/cake/libs/view/helper.php @@ -381,7 +381,7 @@ class Helper extends Overloadable { } } break; - case 2: + case 2: if ($view->modelScope === false) { list($view->model, $view->field) = $parts; } elseif ($sameScope === true && $hasField === 0) { diff --git a/cake/libs/view/helpers/cache.php b/cake/libs/view/helpers/cache.php index 46c6316ee..29c352f69 100644 --- a/cake/libs/view/helpers/cache.php +++ b/cake/libs/view/helpers/cache.php @@ -42,7 +42,7 @@ class CacheHelper extends AppHelper { * @var array * @access private */ - var $__replace = array(); + var $__replace = array(); /** * Array of string that are replace with there var replace above. * The strings are any content inside and includes the tags in views @@ -50,21 +50,21 @@ class CacheHelper extends AppHelper { * @var array * @access private */ - var $__match = array(); + var $__match = array(); /** * holds the View object passed in final call to CacheHelper::cache() * * @var object * @access public */ - var $view; + var $view; /** * cache action time * * @var object * @access public */ - var $cacheAction; + var $cacheAction; /** * Main method used to cache a view * @@ -275,9 +275,10 @@ class CacheHelper extends AppHelper { $this->loaded[$camelBackedHelper] =& ${$camelBackedHelper}; } ?>'; - $content = preg_replace("/(<\\?xml)/", "",$content); - $file .= $content; - return cache('views' . DS . $cache, $file, $timestamp); - } + $content = preg_replace("/(<\\?xml)/", "",$content); + $file .= $content; + return cache('views' . DS . $cache, $file, $timestamp); + } } + ?> \ No newline at end of file diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index 8fb90e95b..d00d799d4 100644 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -406,7 +406,7 @@ class FormHelper extends AppHelper { if (is_array($text) && isset($text[$error])) { $text = $text[$error]; } elseif (is_array($text)) { - $options = array_merge($options, $text); + $options = array_merge($options, $text); $text = null; } @@ -420,7 +420,7 @@ class FormHelper extends AppHelper { unset($options['escape']); } if ($options['wrap']) { - $tag = is_string($options['wrap']) ? $options['wrap'] : 'div'; + $tag = is_string($options['wrap']) ? $options['wrap'] : 'div'; unset($options['wrap']); return $this->Html->tag($tag, $error, $options); } else { @@ -634,8 +634,8 @@ class FormHelper extends AppHelper { $divOptions = $this->addClass($divOptions, 'required'); } if (!isset($divOptions['tag'])) { - $divOptions['tag'] = 'div'; - } + $divOptions['tag'] = 'div'; + } } $label = null; @@ -770,9 +770,9 @@ class FormHelper extends AppHelper { } } if (isset($divOptions) && isset($divOptions['tag'])) { - $tag = $divOptions['tag']; - unset($divOptions['tag']); - $out = $this->Html->tag($tag, $out, $divOptions); + $tag = $divOptions['tag']; + unset($divOptions['tag']); + $out = $this->Html->tag($tag, $out, $divOptions); } return $out; } @@ -1043,8 +1043,8 @@ class FormHelper extends AppHelper { } if (isset($divOptions)) { - $tag = $divOptions['tag']; - unset($divOptions['tag']); + $tag = $divOptions['tag']; + unset($divOptions['tag']); $out = $this->Html->tag($tag, $out, $divOptions); } return $out; @@ -1061,7 +1061,7 @@ class FormHelper extends AppHelper { } return $this->output(sprintf($this->Html->tags['submitimage'], $url, $this->_parseAttributes($options, null, '', ' '))); } - /** +/** * Returns a formatted SELECT element. * * @param string $fieldName Name attribute of the SELECT @@ -1644,17 +1644,15 @@ class FormHelper extends AppHelper { $data = array('am' => 'am', 'pm' => 'pm'); break; case 'day': - if (!isset($options['min'])) { - $min = 1; - } else { + $min = 1; + $max = 31; + + if (isset($options['min'])) { $min = $options['min']; } - - if (!isset($options['max'])) { - $max = 31; - } else { + if (isset($options['max'])) { $max = $options['max']; - } + } for ($i = $min; $i <= $max; $i++) { $data[sprintf('%02d', $i)] = $i; @@ -1707,4 +1705,5 @@ class FormHelper extends AppHelper { return $this->__options[$name]; } } -?> + +?> \ No newline at end of file diff --git a/cake/libs/view/helpers/html.php b/cake/libs/view/helpers/html.php index e104cf006..d50cd4517 100644 --- a/cake/libs/view/helpers/html.php +++ b/cake/libs/view/helpers/html.php @@ -231,7 +231,7 @@ class HtmlHelper extends AppHelper { $attributes = array_merge($type, $attributes); $out = null; - if (isset($attributes['link'])) { + if (isset($attributes['link'])) { if (isset($attributes['rel']) && $attributes['rel'] === 'icon') { $out = sprintf($this->tags['metalink'], $attributes['link'], $this->_parseAttributes($attributes, array('link'))); $attributes['rel'] = 'shortcut icon'; @@ -343,7 +343,7 @@ class HtmlHelper extends AppHelper { if (strpos($path, '?') === false) { if (strpos($path, '.css') === false) { - $path .= '.css'; + $path .= '.css'; } if ((Configure::read('Asset.timestamp') === true && Configure::read() > 0) || Configure::read('Asset.timestamp') === 'force') { $path .= '?' . @filemtime(WWW_ROOT . str_replace('/', DS, $path)); @@ -502,7 +502,7 @@ class HtmlHelper extends AppHelper { static $count = 0; } else { $count = 0; - } + } foreach ($data as $line) { $count++; @@ -539,7 +539,7 @@ class HtmlHelper extends AppHelper { $text = h($text); } if (!is_array($attributes)) { - $attributes = array('class' => $attributes); + $attributes = array('class' => $attributes); } if ($text === null) { $tag = 'tagstart'; @@ -547,7 +547,7 @@ class HtmlHelper extends AppHelper { $tag = 'tag'; } return $this->output(sprintf($this->tags[$tag], $name, $this->_parseAttributes($attributes, null, ' ', ''), $text, $name)); - } + } /** * Returns a formatted DIV tag for HTML FORMs. * @@ -562,7 +562,7 @@ class HtmlHelper extends AppHelper { if ($class != null && !empty($class)) { $attributes['class'] = $class; } - return $this->tag('div', $text, $attributes, $escape); + return $this->tag('div', $text, $attributes, $escape); } /** * Returns a formatted P tag. diff --git a/cake/libs/view/helpers/javascript.php b/cake/libs/view/helpers/javascript.php index 48fe2f0a2..7a1b55e1a 100644 --- a/cake/libs/view/helpers/javascript.php +++ b/cake/libs/view/helpers/javascript.php @@ -261,7 +261,7 @@ class JavascriptHelper extends AppHelper { } if (strpos($url, '?') === false) { if (strpos($url, '.js') === false) { - $url .= '.js'; + $url .= '.js'; } if ((Configure::read('Asset.timestamp') === true && Configure::read() > 0) || Configure::read('Asset.timestamp') === 'force') { $url .= '?' . @filemtime(WWW_ROOT . str_replace('/', DS, $url)); diff --git a/cake/libs/view/helpers/number.php b/cake/libs/view/helpers/number.php index 937b7fdcb..cebc06fea 100644 --- a/cake/libs/view/helpers/number.php +++ b/cake/libs/view/helpers/number.php @@ -132,25 +132,30 @@ class NumberHelper extends AppHelper { * Formats a number into a currency format. * * @param float $number - * @param string $currency Shortcut to default options. Valid values are 'USD', 'EUR', 'GBP', otherwise set at least 'before' and 'after' options. + * @param string $currency Shortcut to default options. Valid values are 'USD', 'EUR', 'GBP', otherwise + * set at least 'before' and 'after' options. * @param array $options * @return string Number formatted as a currency. */ function currency($number, $currency = 'USD', $options = array()) { - $default = array('before'=>'', 'after' => '', 'zero' => '0', 'places' => 2, 'thousands' => ',', 'decimals' => '.','negative' => '()', 'escape' => true); - $currencies = array('USD' => array('before'=>'$', 'after' => 'c', 'zero' => 0, - 'places' => 2, 'thousands' => ',', 'decimals' => '.', - 'negative' => '()', 'escape' => true - ), - 'GBP' => array('before'=>'£', 'after' => 'p', 'zero' => 0, - 'places' => 2, 'thousands' => ',', 'decimals' => '.', - 'negative' => '()','escape' => false - ), - 'EUR' => array('before'=>'€', 'after' => 'c', 'zero' => 0, - 'places' => 2, 'thousands' => '.', 'decimals' => ',', - 'negative' => '()', 'escape' => false - ) - ); + $default = array( + 'before'=>'', 'after' => '', 'zero' => '0', 'places' => 2, 'thousands' => ',', + 'decimals' => '.','negative' => '()', 'escape' => true + ); + $currencies = array( + 'USD' => array( + 'before' => '$', 'after' => 'c', 'zero' => 0, 'places' => 2, 'thousands' => ',', + 'decimals' => '.', 'negative' => '()', 'escape' => true + ), + 'GBP' => array( + 'before'=>'£', 'after' => 'p', 'zero' => 0, 'places' => 2, 'thousands' => ',', + 'decimals' => '.', 'negative' => '()','escape' => false + ), + 'EUR' => array( + 'before'=>'€', 'after' => 'c', 'zero' => 0, 'places' => 2, 'thousands' => '.', + 'decimals' => ',', 'negative' => '()', 'escape' => false + ) + ); if (isset($currencies[$currency])) { $default = $currencies[$currency]; diff --git a/cake/libs/view/helpers/rss.php b/cake/libs/view/helpers/rss.php index a8d27c45c..8a25a992b 100644 --- a/cake/libs/view/helpers/rss.php +++ b/cake/libs/view/helpers/rss.php @@ -244,8 +244,8 @@ class RssHelper extends XmlHelper { * @return string An RSS-formatted timestamp * @see TimeHelper::toRSS */ - function time($time) { + function time($time) { return $this->Time->toRSS($time); - } + } } ?> \ No newline at end of file diff --git a/cake/libs/view/helpers/time.php b/cake/libs/view/helpers/time.php index fb15b5e54..a7ec93bd2 100644 --- a/cake/libs/view/helpers/time.php +++ b/cake/libs/view/helpers/time.php @@ -54,9 +54,9 @@ class TimeHelper extends AppHelper { * @return int Offset */ function serverOffset() { - $timezoneServer = new DateTimeZone(date_default_timezone_get()); + $timezoneServer = new DateTimeZone(date_default_timezone_get()); $timeServer = new DateTime('now', $timezoneServer); - $offset = $timezoneServer->getOffset($timeServer); + $offset = $timezoneServer->getOffset($timeServer); return $offset; } /** diff --git a/cake/libs/view/theme.php b/cake/libs/view/theme.php index 45680f2d4..7e2bae514 100644 --- a/cake/libs/view/theme.php +++ b/cake/libs/view/theme.php @@ -58,17 +58,17 @@ class ThemeView extends View { */ function __construct (&$controller) { parent::__construct($controller); + $this->theme =& $controller->theme; - $this->theme =& $controller->theme; - if (!empty($this->theme)) { - if (is_dir(WWW_ROOT . 'themed' . DS . $this->theme)) { - $this->themeWeb = 'themed/'. $this->theme .'/'; - } + if (!empty($this->theme)) { + if (is_dir(WWW_ROOT . 'themed' . DS . $this->theme)) { + $this->themeWeb = 'themed/'. $this->theme .'/'; + } /* deprecated: as of 6128 the following properties are no longer needed */ - $this->themeElement = 'themed'. DS . $this->theme . DS .'elements'. DS; - $this->themeLayout = 'themed'. DS . $this->theme . DS .'layouts'. DS; - $this->themePath = 'themed'. DS . $this->theme . DS; - } + $this->themeElement = 'themed'. DS . $this->theme . DS .'elements'. DS; + $this->themeLayout = 'themed'. DS . $this->theme . DS .'layouts'. DS; + $this->themePath = 'themed'. DS . $this->theme . DS; + } } /** diff --git a/cake/libs/view/view.php b/cake/libs/view/view.php index 24917373a..73a25499d 100644 --- a/cake/libs/view/view.php +++ b/cake/libs/view/view.php @@ -622,7 +622,7 @@ class View extends Object { $loadedHelpers = array(); if ($this->helpers != false && $loadHelpers === true) { - $loadedHelpers = $this->_loadHelpers($loadedHelpers, $this->helpers); + $loadedHelpers = $this->_loadHelpers($loadedHelpers, $this->helpers); foreach (array_keys($loadedHelpers) as $helper) { $camelBackedHelper = Inflector::variable($helper);