diff --git a/cake/config/tags.ini.php b/cake/config/tags.ini.php index 859587886..c35fabf24 100644 --- a/cake/config/tags.ini.php +++ b/cake/config/tags.ini.php @@ -107,6 +107,7 @@ blockend = "" ; Tag templates for a paragraph element. para = "%s

" +parastart = "" ; Tag templates for a label element. label = "" diff --git a/cake/libs/model/datasources/dbo/dbo_postgres.php b/cake/libs/model/datasources/dbo/dbo_postgres.php index cec08a934..405bbc387 100644 --- a/cake/libs/model/datasources/dbo/dbo_postgres.php +++ b/cake/libs/model/datasources/dbo/dbo_postgres.php @@ -527,23 +527,22 @@ class DboPostgres extends DboSource { } } /** - * Translates between PHP boolean values and MySQL (faked) boolean values + * Translates between PHP boolean values and PostgreSQL boolean values * * @param mixed $data Value to be translated * @return mixed Converted boolean value */ function boolean($data) { if ($data === true || $data === false) { - if ($data === true) { - return 't'; - } - return 'f'; - } else { + return $data; + } elseif (is_string($data)) { if (strpos($data, 't') !== false) { return true; } return false; + } else { + return (bool)$data; } } /** diff --git a/cake/libs/view/helpers/ajax.php b/cake/libs/view/helpers/ajax.php index 059ec5ac1..d93c7b309 100644 --- a/cake/libs/view/helpers/ajax.php +++ b/cake/libs/view/helpers/ajax.php @@ -442,7 +442,7 @@ class AjaxHelper extends Helper { } if (!isset($options['id'])) { - $options['id'] = r("/", "_", $field); + $options['id'] = Inflector::camelize(r("/", "_", $field)); } $divOptions = array('id' => $options['id'] . "_autoComplete", 'class' => isset($options['class']) ? $options['class'] : 'auto_complete'); @@ -470,7 +470,7 @@ class AjaxHelper extends Helper { $options = $this->_buildOptions($options, $this->autoCompleteOptions); return $this->Html->input($field, $htmlOptions) . "\n" . - $this->Html->tag("div", $divOptions, true) . "\n" . + $this->Html->div(null, '', $divOptions) . "\n" . $this->Javascript->codeBlock("{$var}new Ajax.Autocompleter('" . $htmlOptions['id'] . "', '" . $divOptions['id'] . "', '" . $this->Html->url($url) . "', " . $options . ");"); @@ -706,7 +706,7 @@ class AjaxHelper extends Helper { } foreach($extra as $key) { - if (isset($extra[$key])) { + if (isset($options[$key])) { unset($options[$key]); } } diff --git a/cake/libs/view/helpers/html.php b/cake/libs/view/helpers/html.php index 5b04ba202..eb5b75d19 100644 --- a/cake/libs/view/helpers/html.php +++ b/cake/libs/view/helpers/html.php @@ -840,29 +840,51 @@ class HtmlHelper extends Helper { } } /** - * @deprecated + * Returns a formatted DIV tag for HTML FORMs. + * + * @param string $class CSS class name of the div element. + * @param string $text String content that will appear inside the div element. + * If null, only a start tag will be printed + * @param array $attributes Additional HTML attributes of the DIV tag + * @param boolean $escape If true, $text will be HTML-escaped + * @return string The formatted DIV element */ - function charsetTag($charset, $return = false) { - trigger_error('HtmlHelper::charsetTag has been deprecated, use HtmlHelper::charset', E_USER_WARNING); - return $this->charset($charset, $return); + function div($class = null, $text = null, $attributes = array(), $escape = false) { + if ($escape) { + $text = h($text); + } + if ($class != null && !empty($class)) { + $attributes['class'] = $class; + } + if ($text === null) { + $tag = 'blockstart'; + } else { + $tag = 'block'; + } + return $this->output(sprintf($this->tags[$tag], $this->parseHtmlOptions($attributes, null, ' ', ''), $text)); } /** - * Returns a generic HTML tag (no content). + * Returns a formatted P tag. * - * Examples: - * + tag("br") =>
- * + tag("input", array("type" => "text")) => - * - * @param string $name Name of HTML element - * @param array $options HTML options - * @param bool $open Is the tag open or closed? (defaults to closed "/>") - * @returnstring The formatted HTML tag - * @deprecated This seems useless. Version 0.9.2. + * @param string $class CSS class name of the p element. + * @param string $text String content that will appear inside the p element. + * @param array $attributes Additional HTML attributes of the P tag + * @param boolean $escape If true, $text will be HTML-escaped + * @return string The formatted P element */ - function tag($name, $options = null, $open = false) { - $tag = "<$name " . $this->parseHtmlOptions($options); - $tag .= $open ? ">" : " />"; - return $tag; + function para($class, $text, $attributes = array(), $escape = false) { + if ($escape) { + $text = h($text); + } + if ($class != null && !empty($class)) { + $attributes['class'] = $class; + } + if ($text === null) { + $tag = 'parastart'; + } else { + $tag = 'para'; + } + return $this->output(sprintf($this->tags[$tag], $this->parseHtmlOptions($attributes, null, ' ', ''), $text)); } /** * Returns a SELECT element for days.