diff --git a/cake/libs/view/helper.php b/cake/libs/view/helper.php index b7bb46f4b..8d7623c48 100644 --- a/cake/libs/view/helper.php +++ b/cake/libs/view/helper.php @@ -79,49 +79,7 @@ class Helper extends Overloadable { * @access public * @var array */ - var $tags = array('metalink' => '<link href="%s" title="%s"%s />', - 'link' => '<a href="%s" %s>%s</a>', - 'mailto' => '<a href="mailto:%s" %s>%s</a>', - 'form' => '<form %s>', - 'input' => '<input name="data[%s][%s]" %s/>', - 'textarea' => '<textarea name="data[%s][%s]" %s>%s</textarea>', - 'hidden' => '<input type="hidden" name="data[%s][%s]" %s/>', - 'textarea' => '<textarea name="data[%s][%s]" %s>%s</textarea>', - 'checkbox' => '<input type="checkbox" name="data[%s][%s]" %s/>', - 'radio' => '<input type="radio" name="data[%s][%s]" id="%s" %s />%s', - 'selectstart' => '<select name="data[%s][%s]" %s>', - 'selectmultiplestart' => '<select name="data[%s][%s][]" %s>', - 'selectempty' => '<option value="" %s> </option>', - 'selectoption' => '<option value="%s" %s>%s</option>', - 'selectend' => '</select>', - 'optiongroup' => '<optgroup label="%s"%s>', - 'optiongroupend' => '</optgroup>', - 'password' => '<input type="password" name="data[%s][%s]" %s/>', - 'file' => '<input type="file" name="data[%s][%s]" %s/>', - 'file_no_model' => '<input type="file" name="%s" %s/>', - 'submit' => '<input type="submit" %s/>', - 'submitimage' => '<input type="image" src="%s" %s/>', - '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>', - 'para' => '<p%s>%s</p>', - 'parastart' => '<p%s>', - 'label' => '<label for="%s"%s>%s</label>', - 'fieldset' => '<fieldset><legend>%s</legend>%s</fieldset>', - 'fieldsetstart' => '<fieldset><legend>%s</legend>', - 'fieldsetend' => '</fieldset>', - 'legend' => '<legend>%s</legend>', - '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" />', - 'javascriptblock' => '<script type="text/javascript">%s</script>', - 'javascriptstart' => '<script type="text/javascript">', - 'javascriptlink' => '<script type="text/javascript" src="%s"></script>'); + var $tags = array(); /** * Parses tag templates into $this->tags. diff --git a/cake/libs/view/helpers/ajax.php b/cake/libs/view/helpers/ajax.php index 0cfe4ee30..4c8771168 100644 --- a/cake/libs/view/helpers/ajax.php +++ b/cake/libs/view/helpers/ajax.php @@ -44,13 +44,6 @@ class AjaxHelper extends AppHelper { * @var array */ var $helpers = array('Html', 'Javascript'); -/** - * html tags used by this helper. - * - * @var array - */ - var $tags = array('blockstart' => '<div%s>', - 'blockend' => '</div>'); /** * Names of Javascript callback functions. * @@ -483,7 +476,7 @@ class AjaxHelper extends AppHelper { } } $attr = $this->_parseAttributes(am($options, array('id' => $id))); - return $this->output(sprintf($this->tags['blockstart'], $attr)); + return $this->output(sprintf($this->Html->tags['blockstart'], $attr)); } /** * Closes an Ajax-updateable DIV element @@ -501,7 +494,7 @@ class AjaxHelper extends AppHelper { return ''; } } - return $this->output($this->tags['blockend']); + return $this->output($this->Html->tags['blockend']); } /** * Detects Ajax requests diff --git a/cake/libs/view/helpers/form.php b/cake/libs/view/helpers/form.php index 99d9ca4f8..2e6a7fd1f 100644 --- a/cake/libs/view/helpers/form.php +++ b/cake/libs/view/helpers/form.php @@ -56,23 +56,6 @@ class FormHelper extends AppHelper { var $helpers = array('Html'); -/** - * html tags used by this helper. - * - * @var array - */ - var $tags = array('form' => '<form %s>', - 'label' => '<label for="%s"%s>%s</label>', - 'input' => '<input name="data[%s][%s]" %s/>', - 'password' => '<input type="password" name="data[%s][%s]" %s/>', - 'textarea' => '<textarea name="data[%s][%s]" %s>%s</textarea>', - 'submitimage' => '<input type="image" src="%s" %s/>', - 'selectmultiplestart' => '<select name="data[%s][%s][]" %s>', - 'selectstart' => '<select name="data[%s][%s]" %s>', - 'selectend' => '</select>', - 'optiongroupend' => '</optgroup>', - 'optiongroup' => '<optgroup label="%s"%s>', - 'selectoption' => '<option value="%s" %s>%s</option>'); /** * Returns an HTML FORM element. @@ -92,7 +75,7 @@ class FormHelper extends AppHelper { $token = $this->Html->hidden('_Token/key', array('value' => $this->params['_Token']['key']), true); } - return sprintf($this->tags['form'], $this->Html->parseHtmlOptions($htmlAttributes, null, '')) . $token; + return sprintf($this->Html->tags['form'], $this->Html->parseHtmlOptions($htmlAttributes, null, '')) . $token; } /** * Returns a formatted error message for given FORM field, NULL if no errors. @@ -114,7 +97,7 @@ class FormHelper extends AppHelper { * @deprecated */ function labelTag($tagName, $text) { - return sprintf($this->tags['label'], Inflector::camelize(r('/', '_', $tagName)), $text); + return sprintf($this->Html->tags['label'], Inflector::camelize(r('/', '_', $tagName)), $text); } /** * Returns a formatted LABEL element for HTML FORMs. @@ -135,7 +118,7 @@ class FormHelper extends AppHelper { if (strpos($tagName, '/') !== false) { $tagName = Inflector::camelize(r('/', '_', $tagName)); } - return $this->output(sprintf($this->tags['label'], $tagName, $this->_parseAttributes($attributes), $text)); + return $this->output(sprintf($this->Html->tags['label'], $tagName, $this->_parseAttributes($attributes), $text)); } /** * Generates a form input element complete with label and wrapper div @@ -233,7 +216,7 @@ class FormHelper extends AppHelper { if ($this->tagIsInvalid()) { $htmlAttributes = $this->Html->addClass($htmlAttributes, 'form_error'); } - return $this->output(sprintf($this->tags['input'], $this->model(), $this->field(), $this->_parseAttributes($htmlAttributes, null, ' ', ' '))); + return $this->output(sprintf($this->Html->tags['input'], $this->model(), $this->field(), $this->_parseAttributes($htmlAttributes, null, ' ', ' '))); } /** * Creates a password input widget. @@ -248,7 +231,7 @@ class FormHelper extends AppHelper { if ($this->tagIsInvalid()) { $htmlAttributes = $this->addClass($htmlAttributes, 'form_error'); } - return $this->output(sprintf($this->tags['password'], $this->model(), $this->field(), $this->_parseAttributes($htmlAttributes, null, ' ', ' '))); + return $this->output(sprintf($this->Html->tags['password'], $this->model(), $this->field(), $this->_parseAttributes($htmlAttributes, null, ' ', ' '))); } /** * Creates a textarea widget. @@ -268,7 +251,7 @@ class FormHelper extends AppHelper { if ($this->tagIsInvalid()) { $htmlAttributes = $this->Html->addClass($htmlAttributes, 'form_error'); } - return $this->output(sprintf($this->tags['textarea'], $this->model(), $this->field(), $this->Html->_parseAttributes($htmlAttributes, null, ' '), $value)); + return $this->output(sprintf($this->Html->tags['textarea'], $this->model(), $this->field(), $this->Html->_parseAttributes($htmlAttributes, null, ' '), $value)); } /** * Creates a button tag. @@ -313,7 +296,7 @@ class FormHelper extends AppHelper { } else { $url = $this->webroot . $this->themeWeb . IMAGES_URL . $path; } - return $this->output(sprintf($this->tags['submitimage'], $url, $this->_parseAttributes($htmlAttributes, null, '', ' '))); + return $this->output(sprintf($this->Html->tags['submitimage'], $url, $this->_parseAttributes($htmlAttributes, null, '', ' '))); } /** * Returns a formatted SELECT element. @@ -339,9 +322,9 @@ class FormHelper extends AppHelper { } if (isset($attributes) && array_key_exists("multiple", $attributes)) { - $tag = $this->tags['selectmultiplestart']; + $tag = $this->Html->tags['selectmultiplestart']; } else { - $tag = $this->tags['selectstart']; + $tag = $this->Html->tags['selectstart']; } $select[] = sprintf($tag, $this->model(), $this->field(), $this->Html->parseHtmlOptions($attributes)); @@ -354,7 +337,7 @@ class FormHelper extends AppHelper { $options = array_reverse($options, true); } $select = am($select, $this->__selectOptions(array_reverse($options, true), $selected, array(), $showParents)); - $select[] = sprintf($this->tags['selectend']); + $select[] = sprintf($this->Html->tags['selectend']); return $this->output(implode("\n", $select)); } /** @@ -368,12 +351,12 @@ class FormHelper extends AppHelper { $htmlOptions = array(); if (is_array($title) && (!isset($title['name']) || !isset($title['value']))) { if (!empty($name)) { - $select[] = $this->tags['optiongroupend']; + $select[] = $this->Html->tags['optiongroupend']; $parents[] = $name; } $select = am($select, $this->__selectOptions($title, $selected, $parents, $showParents)); if (!empty($name)) { - $select[] = sprintf($this->tags['optiongroup'], $name, ''); + $select[] = sprintf($this->Html->tags['optiongroup'], $name, ''); } $name = null; } elseif (is_array($title)) { @@ -390,7 +373,7 @@ class FormHelper extends AppHelper { } if($showParents || (!in_array($title, $parents))) { - $select[] = sprintf($this->tags['selectoption'], $name, $this->Html->parseHtmlOptions($htmlOptions), h($title)); + $select[] = sprintf($this->Html->tags['selectoption'], $name, $this->Html->parseHtmlOptions($htmlOptions), h($title)); } } } diff --git a/cake/libs/view/helpers/html.php b/cake/libs/view/helpers/html.php index 284799c38..864bc398f 100644 --- a/cake/libs/view/helpers/html.php +++ b/cake/libs/view/helpers/html.php @@ -40,6 +40,51 @@ class HtmlHelper extends AppHelper { /**#@+ * @access public */ +/** + * html tags used by this helper. + * + * @var array + */ + var $tags = array('metalink' => '<link href="%s" title="%s"%s />', + 'link' => '<a href="%s" %s>%s</a>', + 'mailto' => '<a href="mailto:%s" %s>%s</a>', + 'form' => '<form %s>', + 'input' => '<input name="data[%s][%s]" %s/>', + 'textarea' => '<textarea name="data[%s][%s]" %s>%s</textarea>', + 'hidden' => '<input type="hidden" name="data[%s][%s]" %s/>', + 'textarea' => '<textarea name="data[%s][%s]" %s>%s</textarea>', + 'checkbox' => '<input type="checkbox" name="data[%s][%s]" %s/>', + 'radio' => '<input type="radio" name="data[%s][%s]" id="%s" %s />%s', + 'selectstart' => '<select name="data[%s][%s]" %s>', + 'selectmultiplestart' => '<select name="data[%s][%s][]" %s>', + 'selectempty' => '<option value="" %s> </option>', + 'selectoption' => '<option value="%s" %s>%s</option>', + 'selectend' => '</select>', + 'optiongroup' => '<optgroup label="%s"%s>', + 'optiongroupend' => '</optgroup>', + 'password' => '<input type="password" name="data[%s][%s]" %s/>', + 'file' => '<input type="file" name="data[%s][%s]" %s/>', + 'file_no_model' => '<input type="file" name="%s" %s/>', + 'submit' => '<input type="submit" %s/>', + 'submitimage' => '<input type="image" src="%s" %s/>', + '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>', + 'para' => '<p%s>%s</p>', + 'parastart' => '<p%s>', + 'label' => '<label for="%s"%s>%s</label>', + 'fieldset' => '<fieldset><legend>%s</legend>%s</fieldset>', + 'fieldsetstart' => '<fieldset><legend>%s</legend>', + 'fieldsetend' => '</fieldset>', + 'legend' => '<legend>%s</legend>', + '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" />'); /** * Base URL * diff --git a/cake/libs/view/helpers/javascript.php b/cake/libs/view/helpers/javascript.php index 82dc105a6..0a979ecad 100644 --- a/cake/libs/view/helpers/javascript.php +++ b/cake/libs/view/helpers/javascript.php @@ -44,6 +44,14 @@ class JavascriptHelper extends AppHelper { var $_cacheAll = false; var $_rules = array(); var $safe = false; +/** + * html tags used by this helper. + * + * @var array + */ + var $tags = array('javascriptblock' => '<script type="text/javascript">%s</script>', + 'javascriptstart' => '<script type="text/javascript">', + 'javascriptlink' => '<script type="text/javascript" src="%s"></script>'); /** * Returns a JavaScript script tag. @@ -95,7 +103,7 @@ class JavascriptHelper extends AppHelper { $this->_cachedEvents[] = $script; } - + } /** * Returns a JavaScript include tag (SCRIPT element)