Skip to content

Commit

Permalink
Remove old _tags property and useTag() method.
Browse files Browse the repository at this point in the history
Both of these are not really that useful. useTag can be replaced with
tag(), I'm not really sure why we ever had both.
  • Loading branch information
markstory committed Mar 8, 2014
1 parent 5c49e13 commit c818a07
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 76 deletions.
57 changes: 0 additions & 57 deletions src/View/Helper/HtmlHelper.php
Expand Up @@ -41,42 +41,6 @@ class HtmlHelper extends Helper {
*/
public $response;

/**
* html tags used by this helper.
*
* @var array
*/
protected $_tags = array(
'meta' => '<meta%s/>',
'metalink' => '<link href="%s"%s/>',
'link' => '<a href="%s"%s>%s</a>',
'mailto' => '<a href="mailto:%s" %s>%s</a>',
'image' => '<img src="%s" %s/>',
'tableheader' => '<th%s>%s</th>',
'tableheaderrow' => '<tr%s>%s</tr>',
'tablecell' => '<td%s>%s</td>',
'tablerow' => '<tr%s>%s</tr>',
'block' => '<div%s>%s</div>',
'blockstart' => '<div%s>',
'blockend' => '</div>',
'tag' => '<%s%s>%s</%s>',
'tagstart' => '<%s%s>',
'tagend' => '</%s>',
'tagselfclosing' => '<%s%s/>',
'para' => '<p%s>%s</p>',
'parastart' => '<p%s>',
'css' => '<link rel="%s" type="text/css" href="%s" %s/>',
'style' => '<style type="text/css"%s>%s</style>',
'charset' => '<meta http-equiv="Content-Type" content="text/html; charset=%s" />',
'ul' => '<ul%s>%s</ul>',
'ol' => '<ol%s>%s</ol>',
'li' => '<li%s>%s</li>',
'javascriptblock' => '<script%s>%s</script>',
'javascriptstart' => '<script>',
'javascriptlink' => '<script type="text/javascript" src="%s"%s></script>',
'javascriptend' => '</script>'
);

/**
* Default templates the helper users.
*
Expand Down Expand Up @@ -969,27 +933,6 @@ public function tag($name, $text = null, $options = array()) {
]);
}

/**
* Returns a formatted existent block of $tags
*
* @param string $tag Tag name
* @return string Formatted block
* @link http://book.cakephp.org/2.0/en/core-libraries/helpers/html.html#HtmlHelper::useTag
*/
public function useTag($tag) {
if (!isset($this->_tags[$tag])) {
return '';
}
$args = func_get_args();
array_shift($args);
foreach ($args as &$arg) {
if (is_array($arg)) {
$arg = $this->_templater->formatAttributes($arg);
}
}
return vsprintf($this->_tags[$tag], $args);
}

/**
* Returns a formatted DIV tag for HTML FORMs.
*
Expand Down
19 changes: 0 additions & 19 deletions tests/TestCase/View/Helper/HtmlHelperTest.php
Expand Up @@ -1750,25 +1750,6 @@ public function testTag() {
$this->assertEquals('<em>stuff</em>', $result);
}

/**
* testUseTag method
*
* @return void
*/
public function testUseTag() {
$result = $this->Html->useTag('unknowntag');
$this->assertEquals('', $result);

$result = $this->Html->useTag('blockend');
$this->assertEquals('</div>', $result);

$result = $this->Html->useTag('image', 'url', 'test');
$this->assertEquals('<img src="url" test/>', $result);

$result = $this->Html->useTag('image', 'example.com', array('test' => 'ok'));
$this->assertEquals('<img src="example.com" test="ok"/>', $result);
}

/**
* testDiv method
*
Expand Down

0 comments on commit c818a07

Please sign in to comment.