Skip to content

Commit

Permalink
Polish docs for URL and XML helpers and deprecate obsolete options fo…
Browse files Browse the repository at this point in the history
…r String helper random_string() and URL helper url_title()
  • Loading branch information
narfbg committed Nov 9, 2012
1 parent 442682e commit 08f0f8b
Show file tree
Hide file tree
Showing 6 changed files with 235 additions and 156 deletions.
17 changes: 10 additions & 7 deletions system/helpers/url_helper.php
Expand Up @@ -474,9 +474,11 @@ function prep_url($str = '')
* human-friendly URL string with a "separator" string
* as the word separator.
*
* @param string the string
* @param string the separator
* @param bool
* @todo Remove old 'dash' and 'underscore' usage in 3.1+.
* @param string $str Input string
* @param string $separator Word separator
* (usually '-' or '_')
* @param bool $lowercase Wether to transform the output string to lowercase
* @return string
*/
function url_title($str, $separator = '-', $lowercase = FALSE)
Expand Down Expand Up @@ -525,10 +527,11 @@ function url_title($str, $separator = '-', $lowercase = FALSE)
* For very fine grained control over headers, you could use the Output
* Library's set_header() function.
*
* @param string the URL
* @param string the method: location or refresh
* @param int
* @return string
* @param string $uri URL
* @param string $method Redirect method
* 'auto', 'location' or 'refresh'
* @param int $code HTTP Response status code
* @return void
*/
function redirect($uri = '', $method = 'auto', $code = NULL)
{
Expand Down
34 changes: 18 additions & 16 deletions user_guide_src/source/changelog.rst
Expand Up @@ -66,31 +66,33 @@ Release Date: Not Released
- Added function ``date_range()`` that generates a list of dates between a specified period.
- ``create_captcha()`` accepts additional colors parameter, allowing for color customization.
- :doc:`URL Helper <helpers/url_helper>` changes include:
- ``url_title()`` will now trim extra dashes from beginning and end.
- ``anchor_popup()`` will now fill the *href* attribute with the URL and its JS code will return FALSE instead.
- Added JS window name support to ``anchor_popup()`` function.
- 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.
- Deprecated *separator* options **dash** and **underscore** for function :php:func:`url_title()` (they are only aliases for '-' and '_' respectively).
- :php:func:`url_title()` will now trim extra dashes from beginning and end.
- :php:func:`anchor_popup()` will now fill the *href* attribute with the URL and its JS code will return FALSE instead.
- Added JS window name support to the :php:func:`anchor_popup()` function.
- Added support (auto-detection) for HTTP/1.1 response code 303 in :php:func:`redirect()`.
- Changed :php:func:`redirect()` to only choose the **refresh** method only on IIS servers, instead of all servers on Windows (when **auto** is used).
- Added XHTML Basic 1.1 doctype to :doc:`HTML Helper <helpers/html_helper>`.
- :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.
- 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:
- :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.
- :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>`.
- :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()``.
- :php:func:`set_realpath()` can now also handle file paths as opposed to just directories.
- Added an optional paramater to :php:func:`delete_files()` to enable it to skip deleting files such as *.htaccess* and *index.html*.
- Deprecated function ``read_file()`` - it's just an alias for PHP's native ``file_get_contents()``.
- :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).
- Deprecated function ``repeater()`` - it's just an alias for PHP's native ``str_repeat()``.
- Deprecated function ``trim_slashes()`` - it's just an alias for PHP's native ``trim()`` (with a slash as its second argument).
- Deprecated randomization type options **unique** and **encrypt** for funcion :php:func:`random_string()` (they are only aliases for **md5** and **sha1** respectively).
- :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.

Expand Down
9 changes: 2 additions & 7 deletions user_guide_src/source/helpers/string_helper.rst
Expand Up @@ -31,18 +31,13 @@ Useful for creating passwords or generating random hashes.
The first parameter specifies the type of string, the second parameter
specifies the length. The following choices are available:

alpha, alunum, basic, numeric, nozero, md5 and sha1

- **alpha**: A string with lower and uppercase letters only.
- **alnum**: Alpha-numeric string with lower and uppercase characters.
- **basic**: A random number based on ``mt_rand()``.
- **numeric**: Numeric string.
- **nozero**: Numeric string with no zeros.
- **unique**: Encrypted with MD5 and uniqid(). Note: The length
parameter is not available for this type. Returns a fixed length 32
character string.
- **md5**: An encrypted random number based on ``md5()``.
- **sha1**: An encrypted random number based on ``sha1()``.
- **md5**: An encrypted random number based on ``md5()`` (fixed length of 32).
- **sha1**: An encrypted random number based on ``sha1()`` (fixed length of 40).

Usage example::

Expand Down
4 changes: 3 additions & 1 deletion user_guide_src/source/helpers/text_helper.rst
Expand Up @@ -59,7 +59,7 @@ The third parameter is an optional suffix added to the string, if
undeclared this helper uses an ellipsis.

.. note:: If you need to truncate to an exact number of characters please
see the :php:func:`ellipsize()` function below.
see the :ref:`ellipsize()` function below.

ascii_to_entities()
===================
Expand Down Expand Up @@ -193,6 +193,8 @@ Example::

// Would produce: Here is a simple string of text that will help us demonstrate this function

.. _ellipsize():

ellipsize()
===========

Expand Down

0 comments on commit 08f0f8b

Please sign in to comment.