mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-03-01 23:29:45 +00:00
Deprecating $escape for HtmlHelper::tag() use $attributes['escape'] instead. Test case added.
This commit is contained in:
parent
56d2423bc3
commit
136b4db7ad
2 changed files with 10 additions and 13 deletions
cake
|
@ -708,7 +708,10 @@ class HtmlHelper extends AppHelper {
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function tag($name, $text = null, $attributes = array(), $escape = false) {
|
function tag($name, $text = null, $attributes = array(), $escape = false) {
|
||||||
if ($escape) {
|
if ($escape || isset($attributes['escape']) && $attributes['escape']) {
|
||||||
|
if (is_array($attributes)) {
|
||||||
|
unset($attributes['escape']);
|
||||||
|
}
|
||||||
$text = h($text);
|
$text = h($text);
|
||||||
}
|
}
|
||||||
if (!is_array($attributes)) {
|
if (!is_array($attributes)) {
|
||||||
|
|
|
@ -123,16 +123,17 @@ class HtmlHelperTest extends CakeTestCase {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* tearDown method
|
* endTest method
|
||||||
*
|
*
|
||||||
* @access public
|
* @access public
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function tearDown() {
|
function endTest() {
|
||||||
Configure::write('App.encoding', $this->_appEncoding);
|
Configure::write('App.encoding', $this->_appEncoding);
|
||||||
Configure::write('Asset', $this->_asset);
|
Configure::write('Asset', $this->_asset);
|
||||||
Configure::write('debug', $this->_debug);
|
Configure::write('debug', $this->_debug);
|
||||||
ClassRegistry::flush();
|
ClassRegistry::flush();
|
||||||
|
unset($this->Html);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1108,6 +1109,9 @@ class HtmlHelperTest extends CakeTestCase {
|
||||||
$result = $this->Html->tag('div', '<text>', array('class' => 'class-name'), true);
|
$result = $this->Html->tag('div', '<text>', array('class' => 'class-name'), true);
|
||||||
$this->assertTags($result, array('div' => array('class' => 'class-name'), '<text>', '/div'));
|
$this->assertTags($result, array('div' => array('class' => 'class-name'), '<text>', '/div'));
|
||||||
|
|
||||||
|
$result = $this->Html->tag('div', '<text>', array('class' => 'class-name', 'escape' => true));
|
||||||
|
$this->assertTags($result, array('div' => array('class' => 'class-name'), '<text>', '/div'));
|
||||||
|
|
||||||
$result = $this->Html->tag('div', '<text>', 'class-name', true);
|
$result = $this->Html->tag('div', '<text>', 'class-name', true);
|
||||||
$this->assertTags($result, array('div' => array('class' => 'class-name'), '<text>', '/div'));
|
$this->assertTags($result, array('div' => array('class' => 'class-name'), '<text>', '/div'));
|
||||||
}
|
}
|
||||||
|
@ -1145,15 +1149,5 @@ class HtmlHelperTest extends CakeTestCase {
|
||||||
$result = $this->Html->para('class-name', '<text>', array(), true);
|
$result = $this->Html->para('class-name', '<text>', array(), true);
|
||||||
$this->assertTags($result, array('p' => array('class' => 'class-name'), '<text>', '/p'));
|
$this->assertTags($result, array('p' => array('class' => 'class-name'), '<text>', '/p'));
|
||||||
}
|
}
|
||||||
/**
|
|
||||||
* endTest method
|
|
||||||
*
|
|
||||||
* @access public
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function endTest() {
|
|
||||||
ClassRegistry::flush();
|
|
||||||
unset($this->Html);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
?>
|
?>
|
Loading…
Add table
Reference in a new issue