diff options
Diffstat (limited to 'user_guide_src/source/helpers')
-rw-r--r-- | user_guide_src/source/helpers/captcha_helper.rst | 4 | ||||
-rw-r--r-- | user_guide_src/source/helpers/date_helper.rst | 4 | ||||
-rw-r--r-- | user_guide_src/source/helpers/email_helper.rst | 3 | ||||
-rw-r--r-- | user_guide_src/source/helpers/form_helper.rst | 85 | ||||
-rw-r--r-- | user_guide_src/source/helpers/smiley_helper.rst | 3 |
5 files changed, 63 insertions, 36 deletions
diff --git a/user_guide_src/source/helpers/captcha_helper.rst b/user_guide_src/source/helpers/captcha_helper.rst index 1b74d08ad..4aacafd49 100644 --- a/user_guide_src/source/helpers/captcha_helper.rst +++ b/user_guide_src/source/helpers/captcha_helper.rst @@ -33,6 +33,8 @@ Once loaded you can generate a CAPTCHA like this:: 'img_height' => 30, 'expiration' => 7200, 'word_length' => 8, + 'font_size' => 16, + 'img_id' => 'Imageid', 'pool' => '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', // White background and border, black text and red grid @@ -59,6 +61,8 @@ Once loaded you can generate a CAPTCHA like this:: in the captcha folder before it will be deleted. The default is two hours. - **word_length** defaults to 8, **pool** defaults to '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' +- **font_size** defaults to 16, the native GD font has a size limit. Specify a "true type" font for bigger sizes. +- The **img_id** will be set as the "id" of the captcha image. - If any of the **colors** values is missing, it will be replaced by the default. Adding a Database diff --git a/user_guide_src/source/helpers/date_helper.rst b/user_guide_src/source/helpers/date_helper.rst index d9019a203..dcff7a4e5 100644 --- a/user_guide_src/source/helpers/date_helper.rst +++ b/user_guide_src/source/helpers/date_helper.rst @@ -357,7 +357,7 @@ The following functions are available: <option value='UP95'>(UTC +9:30) Australian Central Standard Time</option> <option value='UP10'>(UTC +10:00) Australian Eastern Standard Time, Vladivostok Time</option> <option value='UP105'>(UTC +10:30) Lord Howe Island</option> - <option value='UP11'>(UTC +11:00) Magadan Time, Solomon Islands, Vanuatu</option> + <option value='UP11'>(UTC +11:00) Srednekolymsk Time, Solomon Islands, Vanuatu</option> <option value='UP115'>(UTC +11:30) Norfolk Island</option> <option value='UP12'>(UTC +12:00) Fiji, Gilbert Islands, Kamchatka Time, New Zealand Standard Time</option> <option value='UP1275'>(UTC +12:45) Chatham Islands Standard Time</option> @@ -428,7 +428,7 @@ UP9 (UTC +9:00) Japan Standard Time, Korea Standard Time, Yakutsk UP95 (UTC +9:30) Australian Central Standard Time UP10 (UTC +10:00) Australian Eastern Standard Time, Vladivostok Time UP105 (UTC +10:30) Lord Howe Island -UP11 (UTC +11:00) Magadan Time, Solomon Islands, Vanuatu +UP11 (UTC +11:00) Srednekolymsk Time, Solomon Islands, Vanuatu UP115 (UTC +11:30) Norfolk Island UP12 (UTC +12:00) Fiji, Gilbert Islands, Kamchatka, New Zealand UP1275 (UTC +12:45) Chatham Islands Standard Time diff --git a/user_guide_src/source/helpers/email_helper.rst b/user_guide_src/source/helpers/email_helper.rst index b665ce548..3b771a0b6 100644 --- a/user_guide_src/source/helpers/email_helper.rst +++ b/user_guide_src/source/helpers/email_helper.rst @@ -6,7 +6,8 @@ The Email Helper provides some assistive functions for working with Email. For a more robust email solution, see CodeIgniter's :doc:`Email Class <../libraries/email>`. -.. important:: The Email helper is **deprecated**. +.. important:: The Email helper is DEPRECATED and is currently + only kept for backwards compatibility. .. contents:: :local: diff --git a/user_guide_src/source/helpers/form_helper.rst b/user_guide_src/source/helpers/form_helper.rst index 4fa5f246b..5af0d4014 100644 --- a/user_guide_src/source/helpers/form_helper.rst +++ b/user_guide_src/source/helpers/form_helper.rst @@ -19,6 +19,31 @@ This helper is loaded using the following code:: $this->load->helper('form'); +Escaping field values +===================== + +You may need to use HTML and characters such as quotes within your form +elements. In order to do that safely, you'll need to use +:doc:`common function <../general/common_functions>` +:func:`html_escape()`. + +Consider the following example:: + + $string = 'Here is a string containing "quoted" text.'; + + <input type="text" name="myfield" value="<?php echo $string; ?>" /> + +Since the above string contains a set of quotes, it will cause the form +to break. The :func:`html_escape()` function converts HTML special +characters so that it can be used safely:: + + <input type="text" name="myfield" value="<?php echo html_escape($string); ?>" /> + +.. note:: If you use any of the form helper functions listed on this page, + the form values will be automatically escaped, so there is no need + to call this function. Use it only if you are creating your own + form elements. + Available Functions =================== @@ -546,37 +571,10 @@ The following functions are available: // Would produce: </form> </div></div> -.. function:: form_prep([$str = ''[, $is_textarea = FALSE]]) - - :param string $str: Value to escape - :param bool $is_textarea: Whether we're preparing for <textarea> or a regular input tag - :returns: Escaped value - :rtype: string - - Allows you to safely use HTML and characters such as quotes within form - elements without breaking out of the form. - - Consider this example:: - - $string = 'Here is a string containing "quoted" text.'; - <input type="text" name="myform" value="$string" /> - - Since the above string contains a set of quotes it will cause the form - to break. The ``form_prep()`` function converts HTML so that it can be used - safely:: - - <input type="text" name="myform" value="<?php echo form_prep($string); ?>" /> - - .. note:: If you use any of the form helper functions listed in this page the form - values will be prepped automatically, so there is no need to call this - function. Use it only if you are creating your own form elements. - - -.. function:: set_value([$field = ''[, $default = ''[, $is_textarea = FALSE]]]) +.. function:: set_value($field[, $default = '']) :param string $field: Field name :param string $default: Default value - :param bool $is_textarea: Whether we're setting <textarea> content :returns: Field value :rtype: string @@ -587,12 +585,16 @@ The following functions are available: Example:: - <input type="text" name="quantity" value="<?=set_value('quantity', '0');?>" size="50" /> + <input type="text" name="quantity" value="<?php echo set_value('quantity', '0'); ?>" size="50" /> The above form will show "0" when loaded for the first time. + .. note:: Only use this function with raw HTML fields, as it + internally calls :func:`html_escape()` and combining its + usage with other form helper functions will result in + double HTML encoding! -.. function:: set_select([$field = ''[, $value = ''[, $default = FALSE]]]) +.. function:: set_select($field[, $value = ''[, $default = FALSE]]) :param string $field: Field name :param string $value: Value to check for @@ -615,7 +617,7 @@ The following functions are available: <option value="three" <?php echo set_select('myselect', 'three'); ?> >Three</option> </select> -.. function:: set_checkbox([$field = ''[, $value = ''[, $default = FALSE]]]) +.. function:: set_checkbox($field[, $value = ''[, $default = FALSE]]) :param string $field: Field name :param string $value: Value to check for @@ -634,7 +636,7 @@ The following functions are available: <input type="checkbox" name="mycheck" value="1" <?php echo set_checkbox('mycheck', '1'); ?> /> <input type="checkbox" name="mycheck" value="2" <?php echo set_checkbox('mycheck', '2'); ?> /> -.. function:: set_radio([$field = ''[, $value = ''[, $default = FALSE]]]) +.. function:: set_radio($field[, $value = ''[, $default = FALSE]]) :param string $field: Field name :param string $value: Value to check for @@ -699,4 +701,21 @@ The following functions are available: <span class="error">The "email" field doesn't contain a valid e-mail address!</span> <span class="error">The "password" field doesn't match the "repeat_password" field!</span> - */
\ No newline at end of file + */ + +.. function:: form_prep($str) + + :param string $str: Value to escape + :returns: Escaped value + :rtype: string + + Allows you to safely use HTML and characters such as quotes within form + elements without breaking out of the form. + + .. note:: If you use any of the form helper functions listed in this page the form + values will be prepped automatically, so there is no need to call this + function. Use it only if you are creating your own form elements. + + .. note:: This function is DEPRECATED and is just an alias for + :doc:`common function <../general/common_functions>` + :func:`html_escape()` - please use that instead.
\ No newline at end of file diff --git a/user_guide_src/source/helpers/smiley_helper.rst b/user_guide_src/source/helpers/smiley_helper.rst index e7a5724a8..5de1d83bb 100644 --- a/user_guide_src/source/helpers/smiley_helper.rst +++ b/user_guide_src/source/helpers/smiley_helper.rst @@ -5,6 +5,9 @@ Smiley Helper The Smiley Helper file contains functions that let you manage smileys (emoticons). +.. important:: The Smiley helper is DEPRECATED and should not be used. + It is currently only kept for backwards compatibility. + .. contents:: :local: |