Correcting coding standards violations

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7220 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
nate 2008-06-20 11:57:56 +00:00
parent c9eff14ca4
commit f7a4858503
10 changed files with 69 additions and 64 deletions

View file

@ -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) {

View file

@ -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 <cake:nocache><cake:nocache> 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)/", "<?php echo '$1';?>",$content);
$file .= $content;
return cache('views' . DS . $cache, $file, $timestamp);
}
$content = preg_replace("/(<\\?xml)/", "<?php echo '$1';?>",$content);
$file .= $content;
return cache('views' . DS . $cache, $file, $timestamp);
}
}
?>

View file

@ -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];
}
}
?>
?>

View file

@ -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.

View file

@ -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));

View file

@ -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'=>'&#163;', 'after' => 'p', 'zero' => 0,
'places' => 2, 'thousands' => ',', 'decimals' => '.',
'negative' => '()','escape' => false
),
'EUR' => array('before'=>'&#8364;', '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'=>'&#163;', 'after' => 'p', 'zero' => 0, 'places' => 2, 'thousands' => ',',
'decimals' => '.', 'negative' => '()','escape' => false
),
'EUR' => array(
'before'=>'&#8364;', 'after' => 'c', 'zero' => 0, 'places' => 2, 'thousands' => '.',
'decimals' => ',', 'negative' => '()', 'escape' => false
)
);
if (isset($currencies[$currency])) {
$default = $currencies[$currency];

View file

@ -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);
}
}
}
?>

View file

@ -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;
}
/**

View file

@ -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;
}
}
/**

View file

@ -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);