mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-18 18:46:17 +00:00
Adding same fixes as [3225] and [3223], and adding HtmlHelper::para() and HtmlHelper::div()
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@3226 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
4cf5dea802
commit
5af4c7e372
4 changed files with 49 additions and 27 deletions
|
@ -107,6 +107,7 @@ blockend = "</div>"
|
|||
|
||||
; Tag templates for a paragraph element.
|
||||
para = "<p%s>%s</p>"
|
||||
parastart = "<p%s>"
|
||||
|
||||
; Tag templates for a label element.
|
||||
label = "<label for="%s"%s>%s</label>"
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
/**
|
||||
|
|
|
@ -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) . "</div>\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]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
* + <code>tag("br") => <br /></code>
|
||||
* + <code>tag("input", array("type" => "text")) => <input type="text"/></code>
|
||||
*
|
||||
* @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.
|
||||
|
|
Loading…
Add table
Reference in a new issue