diff options
author | Ahmad Anbar <aanbar@gmail.com> | 2015-02-04 18:20:01 +0100 |
---|---|---|
committer | Ahmad Anbar <aanbar@gmail.com> | 2015-02-04 18:20:01 +0100 |
commit | e5454f9b28f123a5549971f580255a065b2f8cc2 (patch) | |
tree | c4927e7b7afb0bf242976034630cc60f2f1db00f /user_guide_src/source/helpers | |
parent | 6db62ab0ad0e223806a1367e12b1884b48dc65d7 (diff) | |
parent | eccac6e6a73a4d1a5b40f383ce64359c2c94ae12 (diff) |
Merge remote-tracking branch 'upstream/develop' into develop
Diffstat (limited to 'user_guide_src/source/helpers')
21 files changed, 202 insertions, 182 deletions
diff --git a/user_guide_src/source/helpers/array_helper.rst b/user_guide_src/source/helpers/array_helper.rst index 4805f581a..d6b48773f 100644 --- a/user_guide_src/source/helpers/array_helper.rst +++ b/user_guide_src/source/helpers/array_helper.rst @@ -26,7 +26,7 @@ Available Functions The following functions are available: -.. function:: element($item, $array[, $default = NULL]) +.. php:function:: element($item, $array[, $default = NULL]) :param string $item: Item to fetch from the array :param array $array: Input array @@ -51,7 +51,7 @@ The following functions are available: echo element('size', $array, 'foobar'); // returns "foobar" -.. function:: elements($items, $array[, $default = NULL]) +.. php:function:: elements($items, $array[, $default = NULL]) :param string $item: Item to fetch from the array :param array $array: Input array @@ -111,7 +111,7 @@ The following functions are available: updated. -.. function:: random_element($array) +.. php:function:: random_element($array) :param array $array: Input array :returns: A random element from the array diff --git a/user_guide_src/source/helpers/captcha_helper.rst b/user_guide_src/source/helpers/captcha_helper.rst index 4aacafd49..986c1d3e1 100644 --- a/user_guide_src/source/helpers/captcha_helper.rst +++ b/user_guide_src/source/helpers/captcha_helper.rst @@ -132,7 +132,7 @@ Available Functions The following functions are available: -.. function:: create_captcha([$data = ''[, $img_path = ''[, $img_url = ''[, $font_path = '']]]]) +.. php:function:: create_captcha([$data = ''[, $img_path = ''[, $img_url = ''[, $font_path = '']]]]) :param array $data: Array of data for the CAPTCHA :param string $img_path: Path to create the image in diff --git a/user_guide_src/source/helpers/cookie_helper.rst b/user_guide_src/source/helpers/cookie_helper.rst index 22fd0f77f..da26151cb 100644 --- a/user_guide_src/source/helpers/cookie_helper.rst +++ b/user_guide_src/source/helpers/cookie_helper.rst @@ -25,7 +25,7 @@ Available Functions The following functions are available: -.. function:: set_cookie($name[, $value = ''[, $expire = ''[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = FALSE[, $httponly = FALSE]]]]]]]]) +.. php:function:: set_cookie($name[, $value = ''[, $expire = ''[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = FALSE[, $httponly = FALSE]]]]]]]]) :param mixed $name: Cookie name *or* associative array of all of the parameters available to this function :param string $value: Cookie value @@ -37,25 +37,26 @@ The following functions are available: :param bool $httponly: Whether to hide the cookie from JavaScript :rtype: void - This helper function gives you view file friendly syntax to set browser - cookies. Refer to the :doc:`Input Library <../libraries/input>` for a - description of its use, as this function is an alias for + This helper function gives you friendlier syntax to set browser + cookies. Refer to the :doc:`Input Library <../libraries/input>` for + a description of its use, as this function is an alias for ``CI_Input::set_cookie()``. - -.. function:: get_cookie($index[, $xss_clean = NULL]]) +.. php:function:: get_cookie($index[, $xss_clean = NULL]]) :param string $index: Cookie name :param bool $xss_clean: Whether to apply XSS filtering to the returned value :returns: The cookie value or NULL if not found :rtype: mixed - This helper function gives you view file friendly syntax to get browser - cookies. Refer to the :doc:`Input Library <../libraries/input>` for a - description of its use, as this function is an alias for ``CI_Input::cookie()``. - + This helper function gives you friendlier syntax to get browser + cookies. Refer to the :doc:`Input Library <../libraries/input>` for + detailed description of its use, as this function acts very + similarly to ``CI_Input::cookie()``, except it will also prepend + the ``$config['cookie_prefix']`` that you might've set in your + *application/config/config.php* file. -.. function:: delete_cookie($name[, $domain = ''[, $path = '/'[, $prefix = '']]]]) +.. php:function:: delete_cookie($name[, $domain = ''[, $path = '/'[, $prefix = '']]]]) :param string $name: Cookie name :param string $domain: Cookie domain (usually: .yourdomain.com) @@ -75,4 +76,4 @@ The following functions are available: parameters. :: - delete_cookie($name, $domain, $path, $prefix)
\ No newline at end of file + delete_cookie($name, $domain, $path, $prefix); diff --git a/user_guide_src/source/helpers/date_helper.rst b/user_guide_src/source/helpers/date_helper.rst index dcff7a4e5..bed3b32a2 100644 --- a/user_guide_src/source/helpers/date_helper.rst +++ b/user_guide_src/source/helpers/date_helper.rst @@ -24,7 +24,7 @@ Available Functions The following functions are available: -.. function:: now([$timezone = NULL]) +.. php:function:: now([$timezone = NULL]) :param string $timezone: Timezone :returns: UNIX timestamp @@ -43,7 +43,7 @@ The following functions are available: If a timezone is not provided, it will return ``time()`` based on the **time_reference** setting. -.. function:: mdate([$datestr = ''[, $time = '']]) +.. php:function:: mdate([$datestr = ''[, $time = '']]) :param string $datestr: Date string :param int $time: UNIX timestamp @@ -67,7 +67,7 @@ The following functions are available: If a timestamp is not included in the second parameter the current time will be used. -.. function:: standard_date([$fmt = 'DATE_RFC822'[, $time = NULL]]) +.. php:function:: standard_date([$fmt = 'DATE_RFC822'[, $time = NULL]]) :param string $fmt: Date format :param int $time: UNIX timestamp @@ -106,7 +106,7 @@ The following functions are available: DATE_W3C W3C 2005-08-14T16:13:03+0000 =============== ======================= ====================================== -.. function:: local_to_gmt([$time = '']) +.. php:function:: local_to_gmt([$time = '']) :param int $time: UNIX timestamp :returns: UNIX timestamp @@ -118,7 +118,7 @@ The following functions are available: $gmt = local_to_gmt(time()); -.. function:: gmt_to_local([$time = ''[, $timezone = 'UTC'[, $dst = FALSE]]]) +.. php:function:: gmt_to_local([$time = ''[, $timezone = 'UTC'[, $dst = FALSE]]]) :param int $time: UNIX timestamp :param string $timezone: Timezone @@ -140,7 +140,7 @@ The following functions are available: .. note:: For a list of timezones see the reference at the bottom of this page. -.. function:: mysql_to_unix([$time = '']) +.. php:function:: mysql_to_unix([$time = '']) :param string $time: MySQL timestamp :returns: UNIX timestamp @@ -152,7 +152,7 @@ The following functions are available: $unix = mysql_to_unix('20061124092345'); -.. function:: unix_to_human([$time = ''[, $seconds = FALSE[, $fmt = 'us']]]) +.. php:function:: unix_to_human([$time = ''[, $seconds = FALSE[, $fmt = 'us']]]) :param int $time: UNIX timestamp :param bool $seconds: Whether to show seconds @@ -179,13 +179,13 @@ The following functions are available: echo unix_to_human($now, TRUE, 'us'); // U.S. time with seconds echo unix_to_human($now, TRUE, 'eu'); // Euro time with seconds -.. function:: human_to_unix([$datestr = '']) +.. php:function:: human_to_unix([$datestr = '']) :param int $datestr: Date string :returns: UNIX timestamp or FALSE on failure :rtype: int - The opposite of the :func:`unix_to_time()` function. Takes a "human" + The opposite of the :php:func:`unix_to_time()` function. Takes a "human" time as input and returns it as a UNIX timestamp. This is useful if you accept "human" formatted dates submitted via a form. Returns boolean FALSE date string passed to it is not formatted as indicated above. @@ -196,7 +196,7 @@ The following functions are available: $human = unix_to_human($now); $unix = human_to_unix($human); -.. function:: nice_date([$bad_date = ''[, $format = FALSE]]) +.. php:function:: nice_date([$bad_date = ''[, $format = FALSE]]) :param int $bad_date: The terribly formatted date-like string :param string $format: Date format to return (same as PHP's ``date()`` function) @@ -220,7 +220,7 @@ The following functions are available: // Should Produce: 2001-09-11 $better_date = nice_date($bad_date, 'Y-m-d'); -.. function:: timespan([$seconds = 1[, $time = ''[, $units = '']]]) +.. php:function:: timespan([$seconds = 1[, $time = ''[, $units = '']]]) :param int $seconds: Number of seconds :param string $time: UNIX timestamp @@ -252,7 +252,7 @@ The following functions are available: .. note:: The text generated by this function is found in the following language file: `language/<your_lang>/date_lang.php` -.. function:: days_in_month([$month = 0[, $year = '']]) +.. php:function:: days_in_month([$month = 0[, $year = '']]) :param int $month: a numeric month :param int $year: a numeric year @@ -271,7 +271,7 @@ The following functions are available: .. note:: This function will alias the native ``cal_days_in_month()``, if it is available. -.. function:: date_range([$unix_start = ''[, $mixed = ''[, $is_unix = TRUE[, $format = 'Y-m-d']]]]) +.. php:function:: date_range([$unix_start = ''[, $mixed = ''[, $is_unix = TRUE[, $format = 'Y-m-d']]]]) :param int $unix_start: UNIX timestamp of the range start date :param int $mixed: UNIX timestamp of the range end date or interval in days @@ -291,7 +291,7 @@ The following functions are available: echo $date."\n"; } -.. function:: timezones([$tz = '']) +.. php:function:: timezones([$tz = '']) :param string $tz: A numeric timezone :returns: Hour difference from UTC @@ -306,9 +306,9 @@ The following functions are available: echo timezones('UM5'); - This function is useful when used with :func:`timezone_menu()`. + This function is useful when used with :php:func:`timezone_menu()`. -.. function:: timezone_menu([$default = 'UTC'[, $class = ''[, $name = 'timezones'[, $attributes = '']]]]) +.. php:function:: timezone_menu([$default = 'UTC'[, $class = ''[, $name = 'timezones'[, $attributes = '']]]]) :param string $default: Timezone :param string $class: Class name diff --git a/user_guide_src/source/helpers/directory_helper.rst b/user_guide_src/source/helpers/directory_helper.rst index 030e0ef53..b5f1093c1 100644 --- a/user_guide_src/source/helpers/directory_helper.rst +++ b/user_guide_src/source/helpers/directory_helper.rst @@ -27,7 +27,7 @@ Available Functions The following functions are available: -.. function:: directory_map($source_dir[, $directory_depth = 0[, $hidden = FALSE]]) +.. php:function:: directory_map($source_dir[, $directory_depth = 0[, $hidden = FALSE]]) :param string $source_dir: Path to the source directory :param int $directory_depth: Depth of directories to traverse (0 = fully recursive, 1 = current dir, etc) diff --git a/user_guide_src/source/helpers/download_helper.rst b/user_guide_src/source/helpers/download_helper.rst index f374d491f..1a4065073 100644 --- a/user_guide_src/source/helpers/download_helper.rst +++ b/user_guide_src/source/helpers/download_helper.rst @@ -24,7 +24,7 @@ Available Functions The following functions are available: -.. function:: force_download([$filename = ''[, $data = ''[, $set_mime = FALSE]]]) +.. php:function:: force_download([$filename = ''[, $data = ''[, $set_mime = FALSE]]]) :param string $filename: Filename :param mixed $data: File contents diff --git a/user_guide_src/source/helpers/email_helper.rst b/user_guide_src/source/helpers/email_helper.rst index 3b771a0b6..685226951 100644 --- a/user_guide_src/source/helpers/email_helper.rst +++ b/user_guide_src/source/helpers/email_helper.rst @@ -29,7 +29,7 @@ Available Functions The following functions are available: -.. function:: valid_email($email) +.. php:function:: valid_email($email) :param string $email: E-mail address :returns: TRUE if a valid email is supplied, FALSE otherwise @@ -54,7 +54,7 @@ The following functions are available: (bool) filter_var($email, FILTER_VALIDATE_EMAIL); -.. function:: send_email($recipient, $subject, $message) +.. php:function:: send_email($recipient, $subject, $message) :param string $recipient: E-mail address :param string $subject: Mail subject diff --git a/user_guide_src/source/helpers/file_helper.rst b/user_guide_src/source/helpers/file_helper.rst index 013b583a0..92cb31a82 100644 --- a/user_guide_src/source/helpers/file_helper.rst +++ b/user_guide_src/source/helpers/file_helper.rst @@ -24,7 +24,7 @@ Available Functions The following functions are available: -.. function:: read_file($file) +.. php:function:: read_file($file) :param string $file: File path :returns: File contents or FALSE on failure @@ -49,7 +49,7 @@ The following functions are available: function might not work if you are trying to access a file above the calling script. -.. function:: write_file($path, $data[, $mode = 'wb']) +.. php:function:: write_file($path, $data[, $mode = 'wb']) :param string $path: File path :param string $data: Data to write to file @@ -89,7 +89,7 @@ The following functions are available: .. note:: This function acquires an exclusive lock on the file while writing to it. -.. function:: delete_files($path[, $del_dir = FALSE[, $htdocs = FALSE]]) +.. php:function:: delete_files($path[, $del_dir = FALSE[, $htdocs = FALSE]]) :param string $path: Directory path :param bool $del_dir: Whether to also delete directories @@ -112,7 +112,7 @@ The following functions are available: .. note:: The files must be writable or owned by the system in order to be deleted. -.. function:: get_filenames($source_dir[, $include_path = FALSE]) +.. php:function:: get_filenames($source_dir[, $include_path = FALSE]) :param string $source_dir: Directory path :param bool $include_path: Whether to include the path as part of the filenames @@ -127,7 +127,7 @@ The following functions are available: $controllers = get_filenames(APPPATH.'controllers/'); -.. function:: get_dir_file_info($source_dir, $top_level_only) +.. php:function:: get_dir_file_info($source_dir, $top_level_only) :param string $source_dir: Directory path :param bool $top_level_only: Whether to look only at the specified directory (excluding sub-directories) @@ -143,7 +143,7 @@ The following functions are available: $models_info = get_dir_file_info(APPPATH.'models/'); -.. function:: get_file_info($file[, $returned_values = array('name', 'server_path', 'size', 'date')]) +.. php:function:: get_file_info($file[, $returned_values = array('name', 'server_path', 'size', 'date')]) :param string $file: File path :param array $returned_values: What type of info to return @@ -157,7 +157,7 @@ The following functions are available: Valid ``$returned_values`` options are: `name`, `size`, `date`, `readable`, `writeable`, `executable` and `fileperms`. -.. function:: get_mime_by_extension($filename) +.. php:function:: get_mime_by_extension($filename) :param string $filename: File name :returns: MIME type string or FALSE on failure @@ -175,7 +175,7 @@ The following functions are available: is here strictly for convenience. It should not be used for security purposes. -.. function:: symbolic_permissions($perms) +.. php:function:: symbolic_permissions($perms) :param int $perms: Permissions :returns: Symbolic permissions string @@ -188,7 +188,7 @@ The following functions are available: echo symbolic_permissions(fileperms('./index.php')); // -rw-r--r-- -.. function:: octal_permissions($perms) +.. php:function:: octal_permissions($perms) :param int $perms: Permissions :returns: Octal permissions string diff --git a/user_guide_src/source/helpers/form_helper.rst b/user_guide_src/source/helpers/form_helper.rst index 4fa5f246b..15f5d7825 100644 --- a/user_guide_src/source/helpers/form_helper.rst +++ b/user_guide_src/source/helpers/form_helper.rst @@ -19,13 +19,38 @@ 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 :php: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 =================== The following functions are available: -.. function:: form_open([$action = ''[, $attributes = ''[, $hidden = array()]]]) +.. php:function:: form_open([$action = ''[, $attributes = ''[, $hidden = array()]]]) :param string $action: Form action/target URI string :param array $attributes: HTML attributes @@ -83,7 +108,7 @@ The following functions are available: <input type="hidden" name="member_id" value="234" /> -.. function:: form_open_multipart([$action = ''[, $attributes = array()[, $hidden = array()]]) +.. php:function:: form_open_multipart([$action = ''[, $attributes = array()[, $hidden = array()]]) :param string $action: Form action/target URI string :param array $attributes: HTML attributes @@ -91,12 +116,12 @@ The following functions are available: :returns: An HTML multipart form opening tag :rtype: string - This function is absolutely identical to :func:`form_open()` above, + This function is absolutely identical to :php:func:`form_open()` above, except that it adds a *multipart* attribute, which is necessary if you would like to use the form to upload files with. -.. function:: form_hidden($name[, $value = '']) +.. php:function:: form_hidden($name[, $value = '']) :param string $name: Field name :param string $value: Field value @@ -162,7 +187,7 @@ The following functions are available: <input type="hidden" name="email" value="john@example.com" id="hiddenemail" class="hiddenemail" /> */ -.. function:: form_input([$data = ''[, $value = ''[, $extra = '']]) +.. php:function:: form_input([$data = ''[, $value = ''[, $extra = '']]) :param array $data: Field attributes data :param string $value: Field value @@ -201,7 +226,7 @@ The following functions are available: $js = 'onClick="some_function()"'; echo form_input('username', 'johndoe', $js); -.. function:: form_password([$data = ''[, $value = ''[, $extra = '']]]) +.. php:function:: form_password([$data = ''[, $value = ''[, $extra = '']]]) :param array $data: Field attributes data :param string $value: Field value @@ -209,11 +234,11 @@ The following functions are available: :returns: An HTML password input field tag :rtype: string - This function is identical in all respects to the :func:`form_input()` + This function is identical in all respects to the :php:func:`form_input()` function above except that it uses the "password" input type. -.. function:: form_upload([$data = ''[, $value = ''[, $extra = '']]]) +.. php:function:: form_upload([$data = ''[, $value = ''[, $extra = '']]]) :param array $data: Field attributes data :param string $value: Field value @@ -221,12 +246,12 @@ The following functions are available: :returns: An HTML file upload input field tag :rtype: string - This function is identical in all respects to the :func:`form_input()` + This function is identical in all respects to the :php:func:`form_input()` function above except that it uses the "file" input type, allowing it to be used to upload files. -.. function:: form_textarea([$data = ''[, $value = ''[, $extra = '']]]) +.. php:function:: form_textarea([$data = ''[, $value = ''[, $extra = '']]]) :param array $data: Field attributes data :param string $value: Field value @@ -234,13 +259,13 @@ The following functions are available: :returns: An HTML textarea tag :rtype: string - This function is identical in all respects to the :func:`form_input()` + This function is identical in all respects to the :php:func:`form_input()` function above except that it generates a "textarea" type. .. note:: Instead of the *maxlength* and *size* attributes in the above example, you will instead specify *rows* and *cols*. -.. function:: form_dropdown([$name = ''[, $options = array()[, $selected = array()[, $extra = '']]]]) +.. php:function:: form_dropdown([$name = ''[, $options = array()[, $selected = array()[, $extra = '']]]]) :param string $name: Field name :param array $options: An associative array of options to be listed @@ -304,7 +329,7 @@ The following functions are available: label. -.. function:: form_multiselect([$name = ''[, $options = array()[, $selected = array()[, $extra = '']]]]) +.. php:function:: form_multiselect([$name = ''[, $options = array()[, $selected = array()[, $extra = '']]]]) :param string $name: Field name :param array $options: An associative array of options to be listed @@ -318,12 +343,12 @@ The following functions are available: associative array of options, and the third parameter will contain the value or values you wish to be selected. - The parameter usage is identical to using :func:`form_dropdown()` above, + The parameter usage is identical to using :php:func:`form_dropdown()` above, except of course that the name of the field will need to use POST array syntax, e.g. foo[]. -.. function:: form_fieldset([$legend_text = ''[, $attributes = array()]]) +.. php:function:: form_fieldset([$legend_text = ''[, $attributes = array()]]) :param string $legend_text: Text to put in the <legend> tag :param array $attributes: Attributes to be set on the <fieldset> tag @@ -369,7 +394,7 @@ The following functions are available: */ -.. function:: form_fieldset_close([$extra = '']) +.. php:function:: form_fieldset_close([$extra = '']) :param string $extra: Anything to append after the closing tag, *as is* :returns: An HTML fieldset closing tag @@ -387,7 +412,7 @@ The following functions are available: // Would produce: </fieldset></div></div> -.. function:: form_checkbox([$data = ''[, $value = ''[, $checked = FALSE[, $extra = '']]]]) +.. php:function:: form_checkbox([$data = ''[, $value = ''[, $checked = FALSE[, $extra = '']]]]) :param array $data: Field attributes data :param string $value: Field value @@ -426,7 +451,7 @@ The following functions are available: echo form_checkbox('newsletter', 'accept', TRUE, $js) -.. function:: form_radio([$data = ''[, $value = ''[, $checked = FALSE[, $extra = '']]]]) +.. php:function:: form_radio([$data = ''[, $value = ''[, $checked = FALSE[, $extra = '']]]]) :param array $data: Field attributes data :param string $value: Field value @@ -435,11 +460,11 @@ The following functions are available: :returns: An HTML radio input tag :rtype: string - This function is identical in all respects to the :func:`form_checkbox()` + This function is identical in all respects to the :php:func:`form_checkbox()` function above except that it uses the "radio" input type. -.. function:: form_label([$label_text = ''[, $id = ''[, $attributes = array()]]]) +.. php:function:: form_label([$label_text = ''[, $id = ''[, $attributes = array()]]]) :param string $label_text: Text to put in the <label> tag :param string $id: ID of the form element that we're making a label for @@ -466,7 +491,7 @@ The following functions are available: // Would produce: <label for="username" class="mycustomclass" style="color: #000;">What is your Name</label> -.. function:: form_submit([$data = ''[, $value = ''[, $extra = '']]]) +.. php:function:: form_submit([$data = ''[, $value = ''[, $extra = '']]]) :param string $data: Button name :param string $value: Button value @@ -484,7 +509,7 @@ The following functions are available: parameter lets you add extra data to your form, like JavaScript. -.. function:: form_reset([$data = ''[, $value = ''[, $extra = '']]]) +.. php:function:: form_reset([$data = ''[, $value = ''[, $extra = '']]]) :param string $data: Button name :param string $value: Button value @@ -496,7 +521,7 @@ The following functions are available: :func:`form_submit()`. -.. function:: form_button([$data = ''[, $content = ''[, $extra = '']]]) +.. php:function:: form_button([$data = ''[, $content = ''[, $extra = '']]]) :param string $data: Button name :param string $content: Button label @@ -531,7 +556,7 @@ The following functions are available: echo form_button('mybutton', 'Click Me', $js); -.. function:: form_close([$extra = '']) +.. php:function:: form_close([$extra = '']) :param string $extra: Anything to append after the closing tag, *as is* :returns: An HTML form closing tag @@ -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]]]) +.. php: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 :php: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]]]) +.. php: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]]]) +.. php: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]]]) +.. php:function:: set_radio($field[, $value = ''[, $default = FALSE]]) :param string $field: Field name :param string $value: Value to check for @@ -643,7 +645,7 @@ The following functions are available: :rtype: string Permits you to display radio buttons in the state they were submitted. - This function is identical to the :func:`set_checkbox()` function above. + This function is identical to the :php:func:`set_checkbox()` function above. Example:: @@ -656,7 +658,7 @@ The following functions are available: defined, the control for ``set_*()`` is handed over to a method of the class instead of the generic helper function. -.. function:: form_error([$field = ''[, $prefix = ''[, $suffix = '']]]) +.. php:function:: form_error([$field = ''[, $prefix = ''[, $suffix = '']]]) :param string $field: Field name :param string $prefix: Error opening tag @@ -677,14 +679,14 @@ The following functions are available: // Would produce: <div class="error">Error message associated with the "username" field.</div> -.. function:: validation_errors([$prefix = ''[, $suffix = '']]) +.. php:function:: validation_errors([$prefix = ''[, $suffix = '']]) :param string $prefix: Error opening tag :param string $suffix: Error closing tag :returns: HTML-formatted form validation error message(s) :rtype: string - Similarly to the :func:`form_error()` function, returns all validation + Similarly to the :php:func:`form_error()` function, returns all validation error messages produced by the :doc:`Form Validation Library <../libraries/form_validation>`, with optional opening and closing tags around each of the messages. @@ -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 + */ + +.. php: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/html_helper.rst b/user_guide_src/source/helpers/html_helper.rst index ff387be10..d35be396a 100644 --- a/user_guide_src/source/helpers/html_helper.rst +++ b/user_guide_src/source/helpers/html_helper.rst @@ -25,7 +25,7 @@ Available Functions The following functions are available: -.. function:: heading([$data = ''[, $h = '1'[, $attributes = '']]]) +.. php:function:: heading([$data = ''[, $h = '1'[, $attributes = '']]]) :param string $data: Content :param string $h: Heading level @@ -51,7 +51,7 @@ The following functions are available: <h3 class="pink">Welcome!<h3> -.. function:: img([$src = ''[, $index_page = FALSE[, $attributes = '']]]) +.. php:function:: img([$src = ''[, $index_page = FALSE[, $attributes = '']]]) :param string $src: Image source data :param bool $index_page: Whether to treat $src as a routed URI string @@ -90,7 +90,7 @@ The following functions are available: img($image_properties); // <img src="http://site.com/index.php/images/picture.jpg" alt="Me, demonstrating how to eat 4 slices of pizza at one time" class="post_images" width="200" height="200" title="That was quite a night" rel="lightbox" /> -.. function:: link_tag([$href = ''[, $rel = 'stylesheet'[, $type = 'text/css'[, $title = ''[, $media = ''[, $index_page = FALSE]]]]]]) +.. php:function:: link_tag([$href = ''[, $rel = 'stylesheet'[, $type = 'text/css'[, $title = ''[, $media = ''[, $index_page = FALSE]]]]]]) :param string $href: What are we linking to :param string $rel: Relation type @@ -135,7 +135,7 @@ The following functions are available: // <link href="http://site.com/css/printer.css" rel="stylesheet" type="text/css" media="print" /> -.. function:: ul($list[, $attributes = '']) +.. php:function:: ul($list[, $attributes = '']) :param array $list: List entries :param array $attributes: HTML attributes @@ -255,17 +255,17 @@ The following functions are available: </li> </ul> -.. function:: ol($list, $attributes = '') +.. php:function:: ol($list, $attributes = '') :param array $list: List entries :param array $attributes: HTML attributes :returns: HTML-formatted ordered list :rtype: string - Identical to :func:`ul()`, only it produces the <ol> tag for + Identical to :php:func:`ul()`, only it produces the <ol> tag for ordered lists instead of <ul>. -.. function:: meta([$name = ''[, $content = ''[, $type = 'name'[, $newline = "\n"]]]]) +.. php:function:: meta([$name = ''[, $content = ''[, $type = 'name'[, $newline = "\n"]]]]) :param string $name: Meta name :param string $content: Meta content @@ -321,7 +321,7 @@ The following functions are available: // <meta http-equiv="Content-type" content="text/html; charset=utf-8" /> -.. function:: doctype([$type = 'xhtml1-strict']) +.. php:function:: doctype([$type = 'xhtml1-strict']) :param string $type: Doctype name :returns: HTML DocType tag @@ -363,7 +363,7 @@ The following functions are available: XHTML+RDFa 1.1 xhtml-rdfa-2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd"> =============================== =================== ================================================================================================================================================== -.. function:: br([$count = 1]) +.. php:function:: br([$count = 1]) :param int $count: Number of times to repeat the tag :returns: HTML line break tag @@ -383,7 +383,7 @@ The following functions are available: .. note:: This function is DEPRECATED. Use the native ``str_repeat()`` in combination with ``<br />`` instead. -.. function:: nbs([$num = 1]) +.. php:function:: nbs([$num = 1]) :param int $num: Number of space entities to produce :returns: A sequence of non-breaking space HTML entities diff --git a/user_guide_src/source/helpers/inflector_helper.rst b/user_guide_src/source/helpers/inflector_helper.rst index d0cb17c18..ed1e2b30f 100644 --- a/user_guide_src/source/helpers/inflector_helper.rst +++ b/user_guide_src/source/helpers/inflector_helper.rst @@ -25,7 +25,7 @@ Available Functions The following functions are available: -.. function:: singular($str) +.. php:function:: singular($str) :param string $str: Input string :returns: A singular word @@ -35,7 +35,7 @@ The following functions are available: echo singular('dogs'); // Prints 'dog' -.. function:: plural($str) +.. php:function:: plural($str) :param string $str: Input string :returns: A plular word @@ -45,7 +45,7 @@ The following functions are available: echo plural('dog'); // Prints 'dogs' -.. function:: camelize($str) +.. php:function:: camelize($str) :param string $str: Input string :returns: Camelized string @@ -56,7 +56,7 @@ The following functions are available: echo camelize('my_dog_spot'); // Prints 'myDogSpot' -.. function:: underscore($str) +.. php:function:: underscore($str) :param string $str: Input string :returns: String containing underscores instead of spaces @@ -67,7 +67,7 @@ The following functions are available: echo underscore('my dog spot'); // Prints 'my_dog_spot' -.. function:: humanize($str[, $separator = '_']) +.. php:function:: humanize($str[, $separator = '_']) :param string $str: Input string :param string $separator: Input separator @@ -85,7 +85,7 @@ The following functions are available: echo humanize('my-dog-spot', '-'); // Prints 'My Dog Spot' -.. function:: is_countable($word) +.. php:function:: is_countable($word) :param string $word: Input string :returns: TRUE if the word is countable or FALSE if not diff --git a/user_guide_src/source/helpers/language_helper.rst b/user_guide_src/source/helpers/language_helper.rst index e4d093725..cadf3c0ce 100644 --- a/user_guide_src/source/helpers/language_helper.rst +++ b/user_guide_src/source/helpers/language_helper.rst @@ -25,7 +25,7 @@ Available Functions The following functions are available: -.. function:: lang($line[, $for = ''[, $attributes = array()]]) +.. php:function:: lang($line[, $for = ''[, $attributes = array()]]) :param string $line: Language line key :param string $for: HTML "for" attribute (ID of the element we're creating a label for) diff --git a/user_guide_src/source/helpers/number_helper.rst b/user_guide_src/source/helpers/number_helper.rst index 2de4457d9..9d5e98cfb 100644 --- a/user_guide_src/source/helpers/number_helper.rst +++ b/user_guide_src/source/helpers/number_helper.rst @@ -25,7 +25,7 @@ Available Functions The following functions are available: -.. function:: byte_format($num[, $precision = 1]) +.. php:function:: byte_format($num[, $precision = 1]) :param mixed $num: Number of bytes :param int $precision: Floating point precision diff --git a/user_guide_src/source/helpers/path_helper.rst b/user_guide_src/source/helpers/path_helper.rst index 705ca23b9..f46cbad44 100644 --- a/user_guide_src/source/helpers/path_helper.rst +++ b/user_guide_src/source/helpers/path_helper.rst @@ -25,7 +25,7 @@ Available Functions The following functions are available: -.. function:: set_realpath($path[, $check_existance = FALSE]) +.. php:function:: set_realpath($path[, $check_existance = FALSE]) :param string $path: Path :param bool $check_existance: Whether to check if the path actually exists diff --git a/user_guide_src/source/helpers/security_helper.rst b/user_guide_src/source/helpers/security_helper.rst index 2e26890b0..103880cf9 100644 --- a/user_guide_src/source/helpers/security_helper.rst +++ b/user_guide_src/source/helpers/security_helper.rst @@ -24,7 +24,7 @@ Available Functions The following functions are available: -.. function:: xss_clean($str[, $is_image = FALSE]) +.. php:function:: xss_clean($str[, $is_image = FALSE]) :param string $str: Input data :param bool $is_image: Whether we're dealing with an image @@ -36,7 +36,7 @@ The following functions are available: This function is an alias for ``CI_Input::xss_clean()``. For more info, please see the :doc:`Input Library <../libraries/input>` documentation. -.. function:: sanitize_filename($filename) +.. php:function:: sanitize_filename($filename) :param string $filename: Filename :returns: Sanitized file name @@ -49,7 +49,7 @@ The following functions are available: documentation. -.. function:: do_hash($str[, $type = 'sha1']) +.. php:function:: do_hash($str[, $type = 'sha1']) :param string $str: Input :param string $type: Algorithm @@ -73,7 +73,7 @@ The following functions are available: .. note:: This function is DEPRECATED. Use the native ``hash()`` instead. -.. function:: strip_image_tags($str) +.. php:function:: strip_image_tags($str) :param string $str: Input string :returns: The input string with no image tags @@ -91,7 +91,7 @@ The following functions are available: documentation. -.. function:: encode_php_tags($str) +.. php:function:: encode_php_tags($str) :param string $str: Input string :returns: Safely formatted string @@ -99,7 +99,7 @@ The following functions are available: This is a security function that converts PHP tags to entities. - .. note:: :func:`xss_clean()` does this automatically, if you use it. + .. note:: :php:func:`xss_clean()` does this automatically, if you use it. Example:: diff --git a/user_guide_src/source/helpers/smiley_helper.rst b/user_guide_src/source/helpers/smiley_helper.rst index 5de1d83bb..978d11e5f 100644 --- a/user_guide_src/source/helpers/smiley_helper.rst +++ b/user_guide_src/source/helpers/smiley_helper.rst @@ -54,7 +54,7 @@ The Controller In your **application/controllers/** directory, create a file called Smileys.php and place the code below in it. -.. important:: Change the URL in the :func:`get_clickable_smileys()` +.. important:: Change the URL in the :php:func:`get_clickable_smileys()` function below so that it points to your smiley folder. You'll notice that in addition to the smiley helper, we are also using @@ -115,7 +115,7 @@ To map the alias to the field id, pass them both into the Available Functions =================== -.. function:: get_clickable_smileys($image_url[, $alias = ''[, $smileys = NULL]]) +.. php:function:: get_clickable_smileys($image_url[, $alias = ''[, $smileys = NULL]]) :param string $image_url: URL path to the smileys directory :param string $alias: Field alias @@ -130,7 +130,7 @@ Available Functions $image_array = get_clickable_smileys('http://example.com/images/smileys/', 'comment'); -.. function:: smiley_js([$alias = ''[, $field_id = ''[, $inline = TRUE]]]) +.. php:function:: smiley_js([$alias = ''[, $field_id = ''[, $inline = TRUE]]]) :param string $alias: Field alias :param string $field_id: Field ID @@ -148,7 +148,7 @@ Available Functions <?php echo smiley_js(); ?> -.. function:: parse_smileys([$str = ''[, $image_url = ''[, $smileys = NULL]]]) +.. php:function:: parse_smileys([$str = ''[, $image_url = ''[, $smileys = NULL]]]) :param string $str: Text containing smiley codes :param string $image_url: URL path to the smileys directory diff --git a/user_guide_src/source/helpers/string_helper.rst b/user_guide_src/source/helpers/string_helper.rst index 922bc6b8d..9d0d890b3 100644 --- a/user_guide_src/source/helpers/string_helper.rst +++ b/user_guide_src/source/helpers/string_helper.rst @@ -25,7 +25,7 @@ Available Functions The following functions are available: -.. function:: random_string([$type = 'alnum'[, $len = 8]]) +.. php:function:: random_string([$type = 'alnum'[, $len = 8]]) :param string $type: Randomization type :param int $len: Output string length @@ -53,7 +53,7 @@ The following functions are available: .. note:: Usage of the *unique* and *encrypt* types is DEPRECATED. They are just aliases for *md5* and *sha1* respectively. -.. function:: increment_string($str[, $separator = '_'[, $first = 1]]) +.. php:function:: increment_string($str[, $separator = '_'[, $first = 1]]) :param string $str: Input string :param string $separator: Separator to append a duplicate number with @@ -72,7 +72,7 @@ The following functions are available: echo increment_string('file_4'); // "file_5" -.. function:: alternator($args) +.. php:function:: alternator($args) :param mixed $args: A variable number of arguments :returns: Alternated string(s) @@ -99,7 +99,7 @@ The following functions are available: .. note:: To use multiple separate calls to this function simply call the function with no arguments to re-initialize. -.. function:: repeater($data[, $num = 1]) +.. php:function:: repeater($data[, $num = 1]) :param string $data: Input :param int $num: Number of times to repeat @@ -117,7 +117,7 @@ The following functions are available: instead. -.. function:: reduce_double_slashes($str) +.. php:function:: reduce_double_slashes($str) :param string $str: Input string :returns: A string with normalized slashes @@ -132,7 +132,7 @@ The following functions are available: echo reduce_double_slashes($string); // results in "http://example.com/index.php" -.. function:: strip_slashes($data) +.. php:function:: strip_slashes($data) :param mixed $data: Input string or an array of strings :returns: String(s) with stripped slashes @@ -160,7 +160,7 @@ The following functions are available: and handle string inputs. This however makes it just an alias for ``stripslashes()``. -.. function:: trim_slashes($str) +.. php:function:: trim_slashes($str) :param string $str: Input string :returns: Slash-trimmed string @@ -175,7 +175,7 @@ The following functions are available: | | trim($str, '/'); -.. function:: reduce_multiples($str[, $character = ''[, $trim = FALSE]]) +.. php:function:: reduce_multiples($str[, $character = ''[, $trim = FALSE]]) :param string $str: Text to search in :param string $character: Character to reduce @@ -195,7 +195,7 @@ The following functions are available: $string = ",Fred, Bill,, Joe, Jimmy,"; $string = reduce_multiples($string, ", ", TRUE); //results in "Fred, Bill, Joe, Jimmy" -.. function:: quotes_to_entities($str) +.. php:function:: quotes_to_entities($str) :param string $str: Input string :returns: String with quotes converted to HTML entities @@ -208,7 +208,7 @@ The following functions are available: $string = quotes_to_entities($string); //results in "Joe's "dinner"" -.. function:: strip_quotes($str) +.. php:function:: strip_quotes($str) :param string $str: Input string :returns: String with quotes stripped diff --git a/user_guide_src/source/helpers/text_helper.rst b/user_guide_src/source/helpers/text_helper.rst index 88a6d0658..d1723c58a 100644 --- a/user_guide_src/source/helpers/text_helper.rst +++ b/user_guide_src/source/helpers/text_helper.rst @@ -24,7 +24,7 @@ Available Functions The following functions are available: -.. function:: word_limiter($str[, $limit = 100[, $end_char = '…']]) +.. php:function:: word_limiter($str[, $limit = 100[, $end_char = '…']]) :param string $str: Input string :param int $limit: Limit @@ -42,7 +42,7 @@ The following functions are available: default it adds an ellipsis. -.. function:: character_limiter($str[, $n = 500[, $end_char = '…']]) +.. php:function:: character_limiter($str[, $n = 500[, $end_char = '…']]) :param string $str: Input string :param int $n: Number of characters @@ -64,9 +64,9 @@ The following functions are available: undeclared this helper uses an ellipsis. .. note:: If you need to truncate to an exact number of characters please - see the :func:`ellipsize()` function below. + see the :php:func:`ellipsize()` function below. -.. function:: ascii_to_entities($str) +.. php:function:: ascii_to_entities($str) :param string $str: Input string :returns: A string with ASCII values converted to entities @@ -84,17 +84,17 @@ The following functions are available: $string = ascii_to_entities($string); -.. function::entities_to_ascii($str[, $all = TRUE]) +.. php:function::entities_to_ascii($str[, $all = TRUE]) :param string $str: Input string :param bool $all: Whether to convert unsafe entities as well :returns: A string with HTML entities converted to ASCII characters :rtype: string - This function does the opposite of :func:`ascii_to_entities()`. + This function does the opposite of :php:func:`ascii_to_entities()`. It turns character entities back into ASCII. -.. function:: convert_accented_characters($str) +.. php:function:: convert_accented_characters($str) :param string $str: Input string :returns: A string with accented characters converted @@ -112,7 +112,7 @@ The following functions are available: `application/config/foreign_chars.php` to define the to and from array for transliteration. -.. function:: word_censor($str, $censored[, $replacement = '']) +.. php:function:: word_censor($str, $censored[, $replacement = '']) :param string $str: Input string :param array $censored: List of bad words to censor @@ -131,7 +131,7 @@ The following functions are available: $disallowed = array('darn', 'shucks', 'golly', 'phooey'); $string = word_censor($string, $disallowed, 'Beep!'); -.. function:: highlight_code($str) +.. php:function:: highlight_code($str) :param string $str: Input string :returns: String with code highlighted via HTML @@ -145,7 +145,7 @@ The following functions are available: colors used are the ones specified in your php.ini file. -.. function:: highlight_phrase($str, $phrase[, $tag_open = '<mark>'[, $tag_close = '</mark>']]) +.. php:function:: highlight_phrase($str, $phrase[, $tag_open = '<mark>'[, $tag_close = '</mark>']]) :param string $str: Input string :param string $phrase: Phrase to highlight @@ -178,7 +178,7 @@ The following functions are available: color: #000; }; -.. function:: word_wrap($str[, $charlim = 76]) +.. php:function:: word_wrap($str[, $charlim = 76]) :param string $str: Input string :param int $charlim: Character limit @@ -195,7 +195,7 @@ The following functions are available: // Would produce: Here is a simple string of text that will help us demonstrate this function -.. function:: ellipsize($str, $max_length[, $position = 1[, $ellipsis = '…']]) +.. php:function:: ellipsize($str, $max_length[, $position = 1[, $ellipsis = '…']]) :param string $str: Input string :param int $max_length: String length limit diff --git a/user_guide_src/source/helpers/typography_helper.rst b/user_guide_src/source/helpers/typography_helper.rst index deb3d164e..7eb4fceec 100644 --- a/user_guide_src/source/helpers/typography_helper.rst +++ b/user_guide_src/source/helpers/typography_helper.rst @@ -25,7 +25,7 @@ Available Functions The following functions are available: -.. function:: auto_typography($str[, $reduce_linebreaks = FALSE]) +.. php:function:: auto_typography($str[, $reduce_linebreaks = FALSE]) :param string $str: Input string :param bool $reduce_linebreaks: Whether to reduce multiple instances of double newlines to two @@ -49,7 +49,7 @@ The following functions are available: pages. -.. function:: nl2br_except_pre($str) +.. php:function:: nl2br_except_pre($str) :param string $str: Input string :returns: String with HTML-formatted line breaks @@ -63,7 +63,7 @@ The following functions are available: $string = nl2br_except_pre($string); -.. function:: entity_decode($str, $charset = NULL) +.. php:function:: entity_decode($str, $charset = NULL) :param string $str: Input string :param string $charset: Character set diff --git a/user_guide_src/source/helpers/url_helper.rst b/user_guide_src/source/helpers/url_helper.rst index 3bdcb8e17..83864d9d3 100644 --- a/user_guide_src/source/helpers/url_helper.rst +++ b/user_guide_src/source/helpers/url_helper.rst @@ -23,7 +23,7 @@ The following functions are available: Available Functions =================== -.. function:: site_url([$uri = ''[, $protocol = NULL]]) +.. php:function:: site_url([$uri = ''[, $protocol = NULL]]) :param string $uri: URI string :param string $protocol: Protocol, e.g. 'http' or 'https' @@ -55,7 +55,7 @@ Available Functions This function is an alias for ``CI_Config::site_url()``. For more info, please see the :doc:`Config Library <../libraries/config>` documentation. -.. function:: base_url($uri = '', $protocol = NULL) +.. php:function:: base_url($uri = '', $protocol = NULL) :param string $uri: URI string :param string $protocol: Protocol, e.g. 'http' or 'https' @@ -66,10 +66,10 @@ Available Functions echo base_url(); - This function returns the same thing as :func:`site_url()`, without + This function returns the same thing as :php:func:`site_url()`, without the *index_page* or *url_suffix* being appended. - Also like :func:`site_url()`, you can supply segments as a string or + Also like :php:func:`site_url()`, you can supply segments as a string or an array. Here is a string example:: echo base_url("blog/post/123"); @@ -77,7 +77,7 @@ Available Functions The above example would return something like: *http://example.com/blog/post/123* - This is useful because unlike :func:`site_url()`, you can supply a + This is useful because unlike :php:func:`site_url()`, you can supply a string to a file, such as an image or stylesheet. For example:: echo base_url("images/icons/edit.png"); @@ -88,7 +88,7 @@ Available Functions This function is an alias for ``CI_Config::base_url()``. For more info, please see the :doc:`Config Library <../libraries/config>` documentation. -.. function:: current_url() +.. php:function:: current_url() :returns: The current URL :rtype: string @@ -101,7 +101,7 @@ Available Functions | site_url(uri_string()); -.. function:: uri_string() +.. php:function:: uri_string() :returns: An URI string :rtype: string @@ -119,7 +119,7 @@ Available Functions please see the :doc:`Config Library <../libraries/config>` documentation. -.. function:: index_page() +.. php:function:: index_page() :returns: 'index_page' value :rtype: mixed @@ -129,7 +129,7 @@ Available Functions echo index_page(); -.. function:: anchor($uri = '', $title = '', $attributes = '') +.. php:function:: anchor($uri = '', $title = '', $attributes = '') :param string $uri: URI string :param string $title: Anchor title @@ -140,7 +140,7 @@ Available Functions Creates a standard HTML anchor link based on your local site URL. The first parameter can contain any segments you wish appended to the - URL. As with the :func:`site_url()` function above, segments can + URL. As with the :php:func:`site_url()` function above, segments can be a string or an array. .. note:: If you are building links that are internal to your application @@ -167,7 +167,7 @@ Available Functions // Prints: <a href="http://example.com">Click Here</a> -.. function:: anchor_popup($uri = '', $title = '', $attributes = FALSE) +.. php:function:: anchor_popup($uri = '', $title = '', $attributes = FALSE) :param string $uri: URI string :param string $title: Anchor title @@ -175,7 +175,7 @@ Available Functions :returns: Pop-up hyperlink :rtype: string - Nearly identical to the :func:`anchor()` function except that it + Nearly identical to the :php:func:`anchor()` function except that it opens the URL in a new window. You can specify JavaScript window attributes in the third parameter to control how the window is opened. If the third parameter is not set it will simply open a new window with @@ -211,7 +211,7 @@ Available Functions HTML attribute to the anchor tag. -.. function:: mailto($email, $title = '', $attributes = '') +.. php:function:: mailto($email, $title = '', $attributes = '') :param string $email: E-mail address :param string $title: Anchor title @@ -223,13 +223,13 @@ Available Functions echo mailto('me@my-site.com', 'Click Here to Contact Me'); - As with the :func:`anchor()` tab above, you can set attributes using the + As with the :php:func:`anchor()` tab above, you can set attributes using the third parameter:: $attributes = array('title' => 'Mail me'); echo mailto('me@my-site.com', 'Contact Me', $attributes); -.. function:: safe_mailto($email, $title = '', $attributes = '') +.. php:function:: safe_mailto($email, $title = '', $attributes = '') :param string $email: E-mail address :param string $title: Anchor title @@ -237,11 +237,11 @@ Available Functions :returns: A spam-safe "mail to" hyperlink :rtype: string - Identical to the :func:`mailto()` function except it writes an obfuscated + Identical to the :php:func:`mailto()` function except it writes an obfuscated version of the *mailto* tag using ordinal numbers written with JavaScript to help prevent the e-mail address from being harvested by spam bots. -.. function:: auto_link($str, $type = 'both', $popup = FALSE) +.. php:function:: auto_link($str, $type = 'both', $popup = FALSE) :param string $str: Input string :param string $type: Link type ('email', 'url' or 'both') @@ -256,7 +256,7 @@ Available Functions The second parameter determines whether URLs and e-mails are converted or just one or the other. Default behavior is both if the parameter is not - specified. E-mail links are encoded as :func:`safe_mailto()` as shown + specified. E-mail links are encoded as :php:func:`safe_mailto()` as shown above. Converts only URLs:: @@ -273,7 +273,7 @@ Available Functions $string = auto_link($string, 'both', TRUE); -.. function:: url_title($str, $separator = '-', $lowercase = FALSE) +.. php:function:: url_title($str, $separator = '-', $lowercase = FALSE) :param string $str: Input string :param string $separator: Word separator @@ -311,7 +311,7 @@ Available Functions // Produces: whats_wrong_with_css -.. function:: prep_url($str = '') +.. php:function:: prep_url($str = '') :param string $str: URL string :returns: Protocol-prefixed URL string @@ -325,7 +325,7 @@ Available Functions $url = prep_url('example.com'); -.. function:: redirect($uri = '', $method = 'auto', $code = NULL) +.. php:function:: redirect($uri = '', $method = 'auto', $code = NULL) :param string $uri: URI string :param string $method: Redirect method ('auto', 'location' or 'refresh') diff --git a/user_guide_src/source/helpers/xml_helper.rst b/user_guide_src/source/helpers/xml_helper.rst index a40ea9ad3..903e925c2 100644 --- a/user_guide_src/source/helpers/xml_helper.rst +++ b/user_guide_src/source/helpers/xml_helper.rst @@ -26,7 +26,7 @@ Available Functions The following functions are available: -.. function:: xml_convert($str[, $protect_all = FALSE]) +.. php:function:: xml_convert($str[, $protect_all = FALSE]) :param string $str: the text string to convert :param bool $protect_all: Whether to protect all content that looks like a potential entity instead of just numbered entities, e.g. &foo; |