diff options
-rw-r--r-- | system/helpers/string_helper.php | 3 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 18 | ||||
-rw-r--r-- | user_guide_src/source/helpers/string_helper.rst | 28 | ||||
-rw-r--r-- | user_guide_src/source/installation/upgrade_300.rst | 15 |
4 files changed, 44 insertions, 20 deletions
diff --git a/system/helpers/string_helper.php b/system/helpers/string_helper.php index c895d5767..5177a7e59 100644 --- a/system/helpers/string_helper.php +++ b/system/helpers/string_helper.php @@ -51,6 +51,9 @@ if ( ! function_exists('trim_slashes')) * * this/that/theother * + * @todo Remove in version 3.1+. + * @deprecated 3.0.0 This is just an alias for PHP's native trim() + * * @param string * @return string */ diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index ccb6dbb82..3296e876d 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -72,21 +72,25 @@ Release Date: Not Released - Added support (auto-detection) for HTTP/1.1 response code 303 in ``redirect()``. - "auto" method in ``redirect()`` now chooses the "refresh" method only on IIS servers, instead of all servers on Windows. - Added XHTML Basic 1.1 doctype to :doc:`HTML Helper <helpers/html_helper>`. - - Changed ``humanize()`` to include a second param for the separator. - - Refactored ``plural()`` and ``singular()`` to avoid double pluralization and support more words. + - :doc:`Inflector Helper <helpers/inflector_helper>` changes include: + - Changed :php:func:`humanize()` to allow passing an input separator as its second parameter. + - Refactored :php:func:`plural()` and :php:func:`singular()` to avoid double pluralization and support more words. - Added an optional third parameter to ``force_download()`` that enables/disables sending the actual file MIME type in the Content-Type header (disabled by default). - Added a work-around in ``force_download()`` for a bug Android <= 2.1, where the filename extension needs to be in uppercase. - :doc:`Form Helper <helpers/form_helper>` changes include: - - ``form_dropdown()`` will now also take an array for unity with other form helpers. - - ``form_prep()``'s second argument now only accepts a boolean value, which determines whether the value is escaped for a *textarea* or a regular *input* element. - - ``do_hash()`` now uses PHP's native ``hash()`` function (supporting more algorithms) and is deprecated. + - :php:func:`form_dropdown()` will now also take an array for unity with other form helpers. + - :php:func:`form_prep()`'s second argument now only accepts a boolean value, which determines whether the value is escaped for a <textarea> or a regular <input> element. + - :doc:`Security Helper <helpers/security_helper>` changes include: + - :php:func:`do_hash()` now uses PHP's native ``hash()`` function (supporting more algorithms) and is deprecated. + - :php:func:`strip_image_tags()` is now an alias for the same method in the :doc:`Security Library <libraries/security>`. - Removed previously deprecated helper function ``js_insert_smiley()`` from :doc:`Smiley Helper <helpers/smiley_helper>`. - :doc:`File Helper <helpers/file_helper>` changes include: - ``set_realpath()`` can now also handle file paths as opposed to just directories. - Added an optional paramater to ``delete_files()`` to enable it to skip deleting files such as .htaccess and index.html. - ``read_file()`` is now a deprecated alias of ``file_get_contents()``. - - :doc:`Security Helper <helpers/security_helper>` function ``strip_image_tags()`` is now an alias for the same method in the :doc:`Security Library <libraries/security>`. - - Deprecated :doc:`String Helper <helpers/string_helper>` function ``repeater()`` - it's just an alias for PHP's native ``str_repeat()``. + - :doc:`String Helper <helpers/string_helper>` changes include: + - Deprecated function :php:func:`repeater()` - it's just an alias for PHP's native ``str_repeat()``. + - Deprecated function :php:func:`trim_slashes()` - it's just an alias for PHP's native ``trim()`` (with a slash as its second argument). - :doc:`Directory Helper <helpers/directory_helper>` ``directory_map()`` will now append DIRECTORY_SEPARATOR to directory names in the returned array. - Deprecated the :doc:`Email Helper <helpers/email_helper>` as its ``valid_email()``, ``send_email()`` functions are now only aliases for PHP native functions ``filter_var()`` and ``mail()`` respectively. diff --git a/user_guide_src/source/helpers/string_helper.rst b/user_guide_src/source/helpers/string_helper.rst index 530af2f89..86b1cdb34 100644 --- a/user_guide_src/source/helpers/string_helper.rst +++ b/user_guide_src/source/helpers/string_helper.rst @@ -10,9 +10,7 @@ strings. Loading this Helper =================== -This helper is loaded using the following code - -:: +This helper is loaded using the following code:: $this->load->helper('string'); @@ -88,11 +86,16 @@ your loop the next item will be returned. repeater() ========== -Generates repeating copies of the data you submit. Example +.. php:function:: repeater($data, $num = 1) -:: + :param string $data: Input + :param int $num: Number of times to repeat + :returns: string + +Generates repeating copies of the data you submit. Example:: - $string = "\n"; echo repeater($string, 30); + $string = "\n"; + echo repeater($string, 30); The above would generate 30 newlines. @@ -143,13 +146,19 @@ The above will return the following array: trim_slashes() ============== -Removes any leading/trailing slashes from a string. Example +.. php:function:: trim_slashes($str) -:: + :param string $str: Input string + :returns: string + +Removes any leading/trailing slashes from a string. Example:: $string = "/this/that/theother/"; echo trim_slashes($string); // results in this/that/theother +.. note:: This function is DEPRECATED. Use the native ``trim()`` instead: + | + | trim($str, '/'); reduce_multiples() ================== @@ -195,5 +204,4 @@ strip_quotes() Removes single and double quotes from a string. Example:: $string = "Joe's \"dinner\""; - $string = strip_quotes($string); //results in "Joes dinner" - + $string = strip_quotes($string); //results in "Joes dinner"
\ No newline at end of file diff --git a/user_guide_src/source/installation/upgrade_300.rst b/user_guide_src/source/installation/upgrade_300.rst index 291d2a370..64f603a16 100644 --- a/user_guide_src/source/installation/upgrade_300.rst +++ b/user_guide_src/source/installation/upgrade_300.rst @@ -181,9 +181,18 @@ CodeIgniter 3.1+. String helper repeater() ======================== -:doc:`String Helper <../helpers/string_helper>` function ``repeater()`` is now just an alias for -PHP's native ``str_repeat()`` function. It is deprecated and scheduled for removal in -CodeIgniter 3.1+. +:doc:`String Helper <../helpers/string_helper>` function :php:func:`repeater()` is now just an alias for +PHP's native ``str_repeat()`` function. It is deprecated and scheduled for removal in CodeIgniter 3.1+. + +.. note:: This function is still available, but you're strongly encouraged to remove it's usage sooner + rather than later. + +String helper trim_slashes() +============================ + +:doc:`String Helper <../helpers/string_helper>` function :php:func:`trim_slashes()` is now just an alias +for PHP's native ``trim()`` function (with a slash passed as its second argument). It is deprecated and +scheduled for removal in CodeIgniter 3.1+. .. note:: This function is still available, but you're strongly encouraged to remove it's usage sooner rather than later. |