summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2015-07-15 15:41:06 +0200
committerAndrey Andreev <narf@devilix.net>2015-07-15 15:41:06 +0200
commitc19f3b2596ae846f5de73f562a0288af8c82855a (patch)
tree67cef6cda90fbbe9e84cca6ec51a62823b89e430
parent77034eaf8a834104dbb46a7862f1162e30064c67 (diff)
Polish changes from PR #3893
-rw-r--r--system/helpers/form_helper.php37
-rw-r--r--user_guide_src/source/changelog.rst2
-rw-r--r--user_guide_src/source/helpers/form_helper.rst31
3 files changed, 31 insertions, 39 deletions
diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php
index f8c6a9dde..fd807769a 100644
--- a/system/helpers/form_helper.php
+++ b/system/helpers/form_helper.php
@@ -208,9 +208,7 @@ if ( ! function_exists('form_input'))
'value' => $value
);
- $extra = _attributes_to_string($extra);
-
- return '<input '._parse_form_attributes($data, $defaults).$extra." />\n";
+ return '<input '._parse_form_attributes($data, $defaults)._attributes_to_string($extra)." />\n";
}
}
@@ -256,9 +254,7 @@ if ( ! function_exists('form_upload'))
is_array($data) OR $data = array('name' => $data);
$data['type'] = 'file';
- $extra = _attributes_to_string($extra);
-
- return '<input '._parse_form_attributes($data, $defaults).$extra." />\n";
+ return '<input '._parse_form_attributes($data, $defaults)._attributes_to_string($extra)." />\n";
}
}
@@ -292,9 +288,9 @@ if ( ! function_exists('form_textarea'))
unset($data['value']); // textareas don't use the value attribute
}
- $extra = _attributes_to_string($extra);
-
- return '<textarea '._parse_form_attributes($data, $defaults).$extra.'>'.html_escape($val)."</textarea>\n";
+ return '<textarea '._parse_form_attributes($data, $defaults)._attributes_to_string($extra).'>'
+ .html_escape($val)
+ ."</textarea>\n";
}
}
@@ -314,8 +310,7 @@ if ( ! function_exists('form_multiselect'))
function form_multiselect($name = '', $options = array(), $selected = array(), $extra = '')
{
$extra = _attributes_to_string($extra);
-
- if ( ! strpos($extra, 'multiple'))
+ if (stripos($extra, 'multiple') === FALSE)
{
$extra .= ' multiple="multiple"';
}
@@ -381,7 +376,7 @@ if ( ! function_exists('form_dropdown'))
$extra = _attributes_to_string($extra);
- $multiple = (count($selected) > 1 && strpos($extra, 'multiple') === FALSE) ? ' multiple="multiple"' : '';
+ $multiple = (count($selected) > 1 && stripos($extra, 'multiple') === FALSE) ? ' multiple="multiple"' : '';
$form = '<select '.rtrim(_parse_form_attributes($data, $defaults)).$extra.$multiple.">\n";
@@ -459,9 +454,7 @@ if ( ! function_exists('form_checkbox'))
unset($defaults['checked']);
}
- $extra = _attributes_to_string($extra);
-
- return '<input '._parse_form_attributes($data, $defaults).$extra." />\n";
+ return '<input '._parse_form_attributes($data, $defaults)._attributes_to_string($extra)." />\n";
}
}
@@ -507,9 +500,7 @@ if ( ! function_exists('form_submit'))
'value' => $value
);
- $extra = _attributes_to_string($extra);
-
- return '<input '._parse_form_attributes($data, $defaults).$extra." />\n";
+ return '<input '._parse_form_attributes($data, $defaults)._attributes_to_string($extra)." />\n";
}
}
@@ -533,9 +524,7 @@ if ( ! function_exists('form_reset'))
'value' => $value
);
- $extra = _attributes_to_string($extra);
-
- return '<input '._parse_form_attributes($data, $defaults).$extra." />\n";
+ return '<input '._parse_form_attributes($data, $defaults)._attributes_to_string($extra)." />\n";
}
}
@@ -564,9 +553,9 @@ if ( ! function_exists('form_button'))
unset($data['content']); // content is not an attribute
}
- $extra = _attributes_to_string($extra);
-
- return '<button '._parse_form_attributes($data, $defaults).$extra.'>'.$content."</button>\n";
+ return '<button '._parse_form_attributes($data, $defaults)._attributes_to_string($extra).'>'
+ .$content
+ ."</button>\n";
}
}
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 4fe3b94ff..55463edc2 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -8,7 +8,7 @@ Version 3.0.1
Release Date: Not Released
- Core
-
+
- Added DoS mitigation to :php:func:`hash_pbkdf2()` :doc:`compatibility function <general/compatibility_functions>`.
- Database
diff --git a/user_guide_src/source/helpers/form_helper.rst b/user_guide_src/source/helpers/form_helper.rst
index 1c55f5692..6317f08ed 100644
--- a/user_guide_src/source/helpers/form_helper.rst
+++ b/user_guide_src/source/helpers/form_helper.rst
@@ -191,7 +191,7 @@ The following functions are available:
:param array $data: Field attributes data
:param string $value: Field value
- :param mixed $extra: Extra attributes to be added to the tag either as array or string
+ :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string
:returns: An HTML text input field tag
:rtype: string
@@ -228,14 +228,14 @@ The following functions are available:
Or you can pass it as an array::
- $js = array('onClick' => "some_function()");
+ $js = array('onClick' => 'some_function();');
echo form_input('username', 'johndoe', $js);
.. php:function:: form_password([$data = ''[, $value = ''[, $extra = '']]])
:param array $data: Field attributes data
:param string $value: Field value
- :param mixed $extra: Extra attributes to be added to the tag either as array or string
+ :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string
:returns: An HTML password input field tag
:rtype: string
@@ -247,7 +247,7 @@ The following functions are available:
:param array $data: Field attributes data
:param string $value: Field value
- :param mixed $extra: Extra attributes to be added to the tag either as array or string
+ :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string
:returns: An HTML file upload input field tag
:rtype: string
@@ -260,7 +260,7 @@ The following functions are available:
:param array $data: Field attributes data
:param string $value: Field value
- :param mixed $extra: Extra attributes to be added to the tag either as array or string
+ :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string
:returns: An HTML textarea tag
:rtype: string
@@ -275,7 +275,7 @@ The following functions are available:
:param string $name: Field name
:param array $options: An associative array of options to be listed
:param array $selected: List of fields to mark with the *selected* attribute
- :param mixed $extra: Extra attributes to be added to the tag either as array or string
+ :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string
:returns: An HTML dropdown select field tag
:rtype: string
@@ -331,7 +331,10 @@ The following functions are available:
Or you can pass it as an array::
- $js = array('id' => "shirts", 'onChange' => "some_function();");
+ $js = array(
+ 'id' => 'shirts',
+ 'onChange' => 'some_function();'
+ );
echo form_dropdown('shirts', $options, 'large', $js);
If the array passed as ``$options`` is a multidimensional array, then
@@ -344,7 +347,7 @@ The following functions are available:
:param string $name: Field name
:param array $options: An associative array of options to be listed
:param array $selected: List of fields to mark with the *selected* attribute
- :param mixed $extra: Extra attributes to be added to the tag either as array or string
+ :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string
:returns: An HTML dropdown multiselect field tag
:rtype: string
@@ -427,7 +430,7 @@ The following functions are available:
:param array $data: Field attributes data
:param string $value: Field value
:param bool $checked: Whether to mark the checkbox as being *checked*
- :param mixed $extra: Extra attributes to be added to the tag either as array or string
+ :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string
:returns: An HTML checkbox input tag
:rtype: string
@@ -462,7 +465,7 @@ The following functions are available:
Or you can pass it as an array::
- $js = array('onClick' => "some_function()");
+ $js = array('onClick' => 'some_function();');
echo form_checkbox('newsletter', 'accept', TRUE, $js)
@@ -471,7 +474,7 @@ The following functions are available:
:param array $data: Field attributes data
:param string $value: Field value
:param bool $checked: Whether to mark the radio button as being *checked*
- :param mixed $extra: Extra attributes to be added to the tag either as array or string
+ :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string
:returns: An HTML radio input tag
:rtype: string
@@ -510,7 +513,7 @@ The following functions are available:
:param string $data: Button name
:param string $value: Button value
- :param mixed $extra: Extra attributes to be added to the tag either as array or string
+ :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string
:returns: An HTML input submit tag
:rtype: string
@@ -528,7 +531,7 @@ The following functions are available:
:param string $data: Button name
:param string $value: Button value
- :param mixed $extra: Extra attributes to be added to the tag either as array or string
+ :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string
:returns: An HTML input reset button tag
:rtype: string
@@ -540,7 +543,7 @@ The following functions are available:
:param string $data: Button name
:param string $content: Button label
- :param mixed $extra: Extra attributes to be added to the tag either as array or string
+ :param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string
:returns: An HTML button tag
:rtype: string