Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Removing use of Helper::output from core helpers.

Removing duplicated test caused by merge in form helper test.
  • Loading branch information...
commit c11509483ce837e276584bd8f73a5598191bd847 1 parent 94c0ec1
@markstory markstory authored
View
4 cake/libs/view/helpers/ajax.php
@@ -528,7 +528,7 @@ function div($id, $options = array()) {
}
}
$attr = $this->_parseAttributes(array_merge($options, array('id' => $id)));
- return $this->output(sprintf($this->Html->tags['blockstart'], $attr));
+ return sprintf($this->Html->tags['blockstart'], $attr);
}
/**
@@ -547,7 +547,7 @@ function divEnd($id) {
return '';
}
}
- return $this->output($this->Html->tags['blockend']);
+ return $this->Html->tags['blockend'];
}
/**
View
50 cake/libs/view/helpers/form.php
@@ -294,7 +294,7 @@ function create($model = null, $options = array()) {
$this->setEntity($model . '.', true);
$attributes = $this->_parseAttributes($htmlAttributes, null, '');
- return $this->output(sprintf($this->Html->tags['form'], $attributes)) . $append;
+ return sprintf($this->Html->tags['form'], $attributes) . $append;
}
/**
@@ -349,7 +349,7 @@ function end($options = null) {
$view =& ClassRegistry::getObject('view');
$view->modelScope = false;
- return $this->output($out);
+ return $out;
}
/**
@@ -528,11 +528,11 @@ function label($fieldName = null, $text = null, $options = array()) {
$labelFor = $this->domId($fieldName);
}
- return $this->output(sprintf(
+ return sprintf(
$this->Html->tags['label'],
$labelFor,
$this->_parseAttributes($options), $text
- ));
+ );
}
/**
@@ -940,11 +940,11 @@ function checkbox($fieldName, $options = array()) {
}
unset($options['hiddenField']);
- return $this->output($output . sprintf(
+ return $output . sprintf(
$this->Html->tags['checkbox'],
$options['name'],
$this->_parseAttributes($options, array('name'), null, ' ')
- ));
+ );
}
/**
@@ -1036,7 +1036,7 @@ function radio($fieldName, $options = array(), $attributes = array()) {
sprintf($this->Html->tags['legend'], $legend) . $out
);
}
- return $this->output($out);
+ return $out;
}
/**
@@ -1050,11 +1050,11 @@ function text($fieldName, $options = array()) {
$options = $this->_initInputField($fieldName, array_merge(
array('type' => 'text'), $options
));
- return $this->output(sprintf(
+ return sprintf(
$this->Html->tags['input'],
$options['name'],
$this->_parseAttributes($options, array('name'), null, ' ')
- ));
+ );
}
/**
@@ -1066,11 +1066,11 @@ function text($fieldName, $options = array()) {
*/
function password($fieldName, $options = array()) {
$options = $this->_initInputField($fieldName, $options);
- return $this->output(sprintf(
+ return sprintf(
$this->Html->tags['password'],
$options['name'],
$this->_parseAttributes($options, array('name'), null, ' ')
- ));
+ );
}
/**
@@ -1091,12 +1091,12 @@ function textarea($fieldName, $options = array()) {
}
unset($options['value']);
}
- return $this->output(sprintf(
+ return sprintf(
$this->Html->tags['textarea'],
$options['name'],
$this->_parseAttributes($options, array('type', 'name'), null, ' '),
$value
- ));
+ );
}
/**
@@ -1123,11 +1123,11 @@ function hidden($fieldName, $options = array()) {
$this->__secure(null, '' . $options['value']);
}
- return $this->output(sprintf(
+ return sprintf(
$this->Html->tags['hidden'],
$options['name'],
$this->_parseAttributes($options, array('name', 'class'), '', ' ')
- ));
+ );
}
/**
@@ -1149,7 +1149,7 @@ function file($fieldName, $options = array()) {
}
$attributes = $this->_parseAttributes($options, array('name'), '', ' ');
- return $this->output(sprintf($this->Html->tags['file'], $options['name'], $attributes));
+ return sprintf($this->Html->tags['file'], $options['name'], $attributes);
}
/**
@@ -1169,12 +1169,12 @@ function button($title, $options = array()) {
if ($options['escape']) {
$title = h($title);
}
- return $this->output(sprintf(
+ return sprintf(
$this->Html->tags['button'],
$options['type'],
$this->_parseAttributes($options, array('type'), '', ' '),
$title
- ));
+ );
}
/**
@@ -1217,11 +1217,11 @@ function submit($caption = null, $options = array()) {
if (strpos($caption, '://') !== false) {
unset($options['type']);
- $out .= $this->output($before . sprintf(
+ $out .= $before . sprintf(
$this->Html->tags['submitimage'],
$caption,
$this->_parseAttributes($options, null, '', ' ')
- ) . $after);
+ ) . $after;
} elseif (preg_match('/\.(jpg|jpe|jpeg|gif|png|ico)$/', $caption)) {
unset($options['type']);
if ($caption{0} !== '/') {
@@ -1230,17 +1230,17 @@ function submit($caption = null, $options = array()) {
$caption = trim($caption, '/');
$url = $this->webroot($caption);
}
- $out .= $this->output($before . sprintf(
+ $out .= $before . sprintf(
$this->Html->tags['submitimage'],
$url,
$this->_parseAttributes($options, null, '', ' ')
- ) . $after);
+ ) . $after;
} else {
$options['value'] = $caption;
- $out .= $this->output($before . sprintf(
+ $out .= $before . sprintf(
$this->Html->tags['submit'],
$this->_parseAttributes($options, null, '', ' ')
- ). $after);
+ ). $after;
}
if (isset($divOptions)) {
@@ -1347,7 +1347,7 @@ function select($fieldName, $options = array(), $selected = null, $attributes =
$template = ($style == 'checkbox') ? 'checkboxmultipleend' : 'selectend';
$select[] = $this->Html->tags[$template];
- return $this->output(implode("\n", $select));
+ return implode("\n", $select);
}
/**
View
26 cake/libs/view/helpers/html.php
@@ -201,7 +201,7 @@ function addCrumb($name, $link = null, $options = null) {
*/
function docType($type = 'xhtml-strict') {
if (isset($this->__docTypes[$type])) {
- return $this->output($this->__docTypes[$type]);
+ return $this->__docTypes[$type];
}
return null;
}
@@ -270,7 +270,7 @@ function meta($type, $url = null, $options = array()) {
}
if ($inline) {
- return $this->output($out);
+ return $out;
} else {
$view =& ClassRegistry::getObject('view');
$view->addScript($out);
@@ -288,7 +288,7 @@ function charset($charset = null) {
if (empty($charset)) {
$charset = strtolower(Configure::read('App.encoding'));
}
- return $this->output(sprintf($this->tags['charset'], (!empty($charset) ? $charset : 'utf-8')));
+ return sprintf($this->tags['charset'], (!empty($charset) ? $charset : 'utf-8'));
}
/**
@@ -347,7 +347,7 @@ function link($title, $url = null, $options = array(), $confirmMessage = false)
}
unset($options['default']);
}
- return $this->output(sprintf($this->tags['link'], $url, $this->_parseAttributes($options), $title));
+ return sprintf($this->tags['link'], $url, $this->_parseAttributes($options), $title);
}
/**
@@ -408,7 +408,6 @@ function css($path, $rel = null, $options = array()) {
}
$out = sprintf($this->tags['css'], $rel, $url, $this->_parseAttributes($options, array('inline'), '', ' '));
}
- $out = $this->output($out);
if ($options['inline']) {
return $out;
@@ -472,7 +471,7 @@ function script($url, $options = array()) {
}
}
$attributes = $this->_parseAttributes($options, array('inline', 'once'), ' ');
- $out = $this->output(sprintf($this->tags['javascriptlink'], $url, $attributes));
+ $out = sprintf($this->tags['javascriptlink'], $url, $attributes);
if ($options['inline']) {
return $out;
@@ -585,7 +584,7 @@ function getCrumbs($separator = '»', $startText = false) {
$out[] = $crumb[0];
}
}
- return $this->output(join($separator, $out));
+ return join($separator, $out);
} else {
return null;
}
@@ -624,9 +623,9 @@ function image($path, $options = array()) {
$image = sprintf($this->tags['image'], $path, $this->_parseAttributes($options, null, '', ' '));
if ($url) {
- return $this->output(sprintf($this->tags['link'], $this->url($url), null, $image));
+ return sprintf($this->tags['link'], $this->url($url), null, $image);
}
- return $this->output($image);
+ return $image;
}
/**
@@ -643,8 +642,7 @@ function tableHeaders($names, $trOptions = null, $thOptions = null) {
foreach ($names as $arg) {
$out[] = sprintf($this->tags['tableheader'], $this->_parseAttributes($thOptions), $arg);
}
- $data = sprintf($this->tags['tablerow'], $this->_parseAttributes($trOptions), join(' ', $out));
- return $this->output($data);
+ return sprintf($this->tags['tablerow'], $this->_parseAttributes($trOptions), join(' ', $out));
}
/**
@@ -698,7 +696,7 @@ function tableCells($data, $oddTrOptions = null, $evenTrOptions = null, $useCoun
$options = $this->_parseAttributes($count % 2 ? $oddTrOptions : $evenTrOptions);
$out[] = sprintf($this->tags['tablerow'], $options, join(' ', $cellsOut));
}
- return $this->output(join("\n", $out));
+ return implode("\n", $out);
}
/**
@@ -729,7 +727,7 @@ function tag($name, $text = null, $options = array()) {
} else {
$tag = 'tag';
}
- return $this->output(sprintf($this->tags[$tag], $name, $this->_parseAttributes($options, null, ' ', ''), $text, $name));
+ return sprintf($this->tags[$tag], $name, $this->_parseAttributes($options, null, ' ', ''), $text, $name);
}
/**
@@ -778,7 +776,7 @@ function para($class, $text, $options = array()) {
} else {
$tag = 'para';
}
- return $this->output(sprintf($this->tags[$tag], $this->_parseAttributes($options, null, ' ', ''), $text));
+ return sprintf($this->tags[$tag], $this->_parseAttributes($options, null, ' ', ''), $text);
}
/**
View
2  cake/libs/view/helpers/javascript.php
@@ -273,7 +273,7 @@ function link($url, $inline = true) {
}
}
}
- $out = $this->output(sprintf($this->tags['javascriptlink'], $url));
+ $out = sprintf($this->tags['javascriptlink'], $url);
if ($inline) {
return $out;
View
4 cake/libs/view/helpers/paginator.php
@@ -557,7 +557,7 @@ function counter($options = array()) {
$out = str_replace($newKeys, array_values($map), $out);
break;
}
- return $this->output($out);
+ return $out;
}
/**
@@ -678,7 +678,7 @@ function numbers($options = array()) {
$out .= $after;
}
- return $this->output($out);
+ return $out;
}
/**
View
2  cake/libs/view/helpers/rss.php
@@ -269,7 +269,7 @@ function item($att = array(), $elements = array()) {
if (!empty($elements)) {
$content = join('', $elements);
}
- return $this->output($this->elem('item', $att, $content, !($content === null)));
+ return $this->elem('item', $att, $content, !($content === null));
}
/**
View
25 cake/libs/view/helpers/time.php
@@ -87,8 +87,7 @@ function nice($dateString = null, $userOffset = null) {
$date = time();
}
- $ret = date("D, M jS Y, H:i", $date);
- return $this->output($ret);
+ return date("D, M jS Y, H:i", $date);
}
/**
@@ -115,8 +114,7 @@ function niceShort($dateString = null, $userOffset = null) {
} else {
$ret = date("M jS{$y}, H:i", $date);
}
-
- return $this->output($ret);
+ return $ret;
}
/**
@@ -134,8 +132,7 @@ function daysAsSql($begin, $end, $fieldName, $userOffset = null) {
$begin = date('Y-m-d', $begin) . ' 00:00:00';
$end = date('Y-m-d', $end) . ' 23:59:59';
- $ret ="($fieldName >= '$begin') AND ($fieldName <= '$end')";
- return $this->output($ret);
+ return "($fieldName >= '$begin') AND ($fieldName <= '$end')";
}
/**
@@ -149,8 +146,7 @@ function daysAsSql($begin, $end, $fieldName, $userOffset = null) {
*/
function dayAsSql($dateString, $fieldName, $userOffset = null) {
$date = $this->fromString($dateString, $userOffset);
- $ret = $this->daysAsSql($dateString, $dateString, $fieldName);
- return $this->output($ret);
+ return $this->daysAsSql($dateString, $dateString, $fieldName);
}
/**
@@ -254,7 +250,7 @@ function toQuarter($dateString, $range = false) {
break;
}
}
- return $this->output($date);
+ return $date;
}
/**
@@ -265,8 +261,7 @@ function toQuarter($dateString, $range = false) {
* @return integer Unix timestamp
*/
function toUnix($dateString, $userOffset = null) {
- $ret = $this->fromString($dateString, $userOffset);
- return $this->output($ret);
+ return $this->fromString($dateString, $userOffset);
}
/**
@@ -278,8 +273,7 @@ function toUnix($dateString, $userOffset = null) {
*/
function toAtom($dateString, $userOffset = null) {
$date = $this->fromString($dateString, $userOffset);
- $ret = date('Y-m-d\TH:i:s\Z', $date);
- return $this->output($ret);
+ return date('Y-m-d\TH:i:s\Z', $date);
}
/**
@@ -291,8 +285,7 @@ function toAtom($dateString, $userOffset = null) {
*/
function toRSS($dateString, $userOffset = null) {
$date = $this->fromString($dateString, $userOffset);
- $ret = date("r", $date);
- return $this->output($ret);
+ return date("r", $date);
}
/**
@@ -472,7 +465,7 @@ function timeAgoInWords($dateTime, $options = array()) {
$relativeDate = sprintf(__('%s ago', true), $relativeDate);
}
}
- return $this->output($relativeDate);
+ return $relativeDate;
}
/**
View
6 cake/libs/view/helpers/xml.php
@@ -65,7 +65,7 @@ function header($attrib = array()) {
$attrib = 'xml ' . $attrib;
}
- return $this->output($this->Xml->header($attrib));
+ return $this->Xml->header($attrib);
}
/**
@@ -131,7 +131,7 @@ function elem($name, $attrib = array(), $content = null, $endTag = true) {
if (!$endTag) {
$this->Xml =& $elem;
}
- return $this->output($out);
+ return $out;
}
/**
@@ -144,7 +144,7 @@ function closeElem() {
if ($parent =& $this->Xml->parent()) {
$this->Xml =& $parent;
}
- return $this->output('</' . $name . '>');
+ return '</' . $name . '>';
}
/**
View
15 cake/tests/cases/libs/view/helpers/form.test.php
@@ -5064,21 +5064,6 @@ function testCreate() {
'/fieldset'
);
$this->assertTags($result, $expected);
-
- $this->Form->data = array();
- $this->Form->params['controller'] = 'contacts';
- $this->Form->params['models'] = array('Contact');
- $result = $this->Form->create(array('url' => array('action' => 'index', 'param')));
- $expected = array(
- 'form' => array(
- 'id' => 'ContactAddForm', 'method' => 'post', 'action' => '/contacts/index/param'
- ),
- 'fieldset' => array('style' => 'preg:/display\s*\:\s*none;\s*/'),
- 'input' => array('type' => 'hidden', 'name' => '_method', 'value' => 'POST'),
- '/fieldset'
- );
- $this->assertTags($result, $expected);
-
}
/**
Please sign in to comment.
Something went wrong with that request. Please try again.