From b81f909f8aaa3bedc3820c0d4c9056b57113b46e Mon Sep 17 00:00:00 2001 From: Roger Herbert Date: Mon, 12 Mar 2012 12:46:02 +0000 Subject: updated docs & changelog --- user_guide_src/source/helpers/date_helper.rst | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'user_guide_src/source/helpers') diff --git a/user_guide_src/source/helpers/date_helper.rst b/user_guide_src/source/helpers/date_helper.rst index ad06dd628..b21d147bd 100644 --- a/user_guide_src/source/helpers/date_helper.rst +++ b/user_guide_src/source/helpers/date_helper.rst @@ -255,14 +255,16 @@ Formats a unix timestamp so that is appears similar to this The first parameter must contain a Unix timestamp. The second parameter must contain a timestamp that is greater that the first timestamp. If -the second parameter empty, the current time will be used. The most -common purpose for this function is to show how much time has elapsed -from some point in time in the past to now. +the second parameter empty, the current time will be used. The third +parameter is optional and limits the number of time units to display. +The most common purpose for this function is to show how much time has +elapsed from some point in time in the past to now. -.. php:method:: timespan($seconds = 1, $time = '') +.. php:method:: timespan($seconds = 1, $time = '', $units = '') :param integer $seconds: a number of seconds :param string $time: Unix timestamp + :param integer $units: a number of time units to display :returns: string Example @@ -271,7 +273,8 @@ Example $post_date = '1079621429'; $now = time(); - echo timespan($post_date, $now); + $units = 2; + echo timespan($post_date, $now, $units); .. note:: The text generated by this function is found in the following language file: language//date_lang.php -- cgit v1.2.3-24-g4f1b From 89338828264a6b50e0eb63c449a96f14f0f84076 Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Mon, 12 Mar 2012 21:03:37 +0700 Subject: Path helper improvement --- user_guide_src/source/helpers/path_helper.rst | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'user_guide_src/source/helpers') diff --git a/user_guide_src/source/helpers/path_helper.rst b/user_guide_src/source/helpers/path_helper.rst index 1a70af458..6efd93cc1 100644 --- a/user_guide_src/source/helpers/path_helper.rst +++ b/user_guide_src/source/helpers/path_helper.rst @@ -28,10 +28,13 @@ cannot be resolved. :: + $file = '/etc/php5/apache2/php.ini'; + echo set_realpath($file); // returns "/etc/php5/apache2/php.ini" + $non_existent_file = '/path/to/non-exist-file.txt'; + echo set_realpath($non_existent_file, TRUE); // returns an error, as the path could not be resolved + echo set_realpath($non_existent_file, FALSE); // returns "/path/to/non-exist-file.txt" $directory = '/etc/passwd'; - echo set_realpath($directory); // returns "/etc/passwd" + echo set_realpath($directory); // returns "/etc/passwd/" $non_existent_directory = '/path/to/nowhere'; echo set_realpath($non_existent_directory, TRUE); // returns an error, as the path could not be resolved - echo set_realpath($non_existent_directory, FALSE); // returns "/path/to/nowhere" - - + echo set_realpath($non_existent_directory, FALSE); // returns "/path/to/nowhere" \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 311b230cf32dda94102866e56e8dd1ef81b5685b Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Mon, 12 Mar 2012 21:49:55 +0700 Subject: Doc --- user_guide_src/source/helpers/path_helper.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'user_guide_src/source/helpers') diff --git a/user_guide_src/source/helpers/path_helper.rst b/user_guide_src/source/helpers/path_helper.rst index 6efd93cc1..4a2252834 100644 --- a/user_guide_src/source/helpers/path_helper.rst +++ b/user_guide_src/source/helpers/path_helper.rst @@ -33,8 +33,8 @@ cannot be resolved. $non_existent_file = '/path/to/non-exist-file.txt'; echo set_realpath($non_existent_file, TRUE); // returns an error, as the path could not be resolved echo set_realpath($non_existent_file, FALSE); // returns "/path/to/non-exist-file.txt" - $directory = '/etc/passwd'; - echo set_realpath($directory); // returns "/etc/passwd/" + $directory = '/etc/php5'; + echo set_realpath($directory); // returns "/etc/php5/" $non_existent_directory = '/path/to/nowhere'; echo set_realpath($non_existent_directory, TRUE); // returns an error, as the path could not be resolved echo set_realpath($non_existent_directory, FALSE); // returns "/path/to/nowhere" \ No newline at end of file -- cgit v1.2.3-24-g4f1b From f2915f2787170d681a50db39a6650f48eefc8d7b Mon Sep 17 00:00:00 2001 From: Taufan Aditya Date: Wed, 14 Mar 2012 00:02:39 +0700 Subject: New line and changelog correction --- user_guide_src/source/helpers/path_helper.rst | 3 +++ 1 file changed, 3 insertions(+) (limited to 'user_guide_src/source/helpers') diff --git a/user_guide_src/source/helpers/path_helper.rst b/user_guide_src/source/helpers/path_helper.rst index 4a2252834..43caffec2 100644 --- a/user_guide_src/source/helpers/path_helper.rst +++ b/user_guide_src/source/helpers/path_helper.rst @@ -30,11 +30,14 @@ cannot be resolved. $file = '/etc/php5/apache2/php.ini'; echo set_realpath($file); // returns "/etc/php5/apache2/php.ini" + $non_existent_file = '/path/to/non-exist-file.txt'; echo set_realpath($non_existent_file, TRUE); // returns an error, as the path could not be resolved echo set_realpath($non_existent_file, FALSE); // returns "/path/to/non-exist-file.txt" + $directory = '/etc/php5'; echo set_realpath($directory); // returns "/etc/php5/" + $non_existent_directory = '/path/to/nowhere'; echo set_realpath($non_existent_directory, TRUE); // returns an error, as the path could not be resolved echo set_realpath($non_existent_directory, FALSE); // returns "/path/to/nowhere" \ No newline at end of file -- cgit v1.2.3-24-g4f1b From ce707b4cafd64b95031690cf927584b1d60c7ad7 Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 14 Mar 2012 10:26:08 +0200 Subject: Further improve the path helper --- user_guide_src/source/helpers/path_helper.rst | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'user_guide_src/source/helpers') diff --git a/user_guide_src/source/helpers/path_helper.rst b/user_guide_src/source/helpers/path_helper.rst index 43caffec2..847f5a08b 100644 --- a/user_guide_src/source/helpers/path_helper.rst +++ b/user_guide_src/source/helpers/path_helper.rst @@ -28,16 +28,16 @@ cannot be resolved. :: - $file = '/etc/php5/apache2/php.ini'; - echo set_realpath($file); // returns "/etc/php5/apache2/php.ini" + $file = '/etc/php5/apache2/php.ini'; + echo set_realpath($file); // returns "/etc/php5/apache2/php.ini" - $non_existent_file = '/path/to/non-exist-file.txt'; - echo set_realpath($non_existent_file, TRUE); // returns an error, as the path could not be resolved - echo set_realpath($non_existent_file, FALSE); // returns "/path/to/non-exist-file.txt" + $non_existent_file = '/path/to/non-exist-file.txt'; + echo set_realpath($non_existent_file, TRUE); // shows an error, as the path cannot be resolved + echo set_realpath($non_existent_file, FALSE); // returns "/path/to/non-exist-file.txt" - $directory = '/etc/php5'; - echo set_realpath($directory); // returns "/etc/php5/" + $directory = '/etc/php5'; + echo set_realpath($directory); // returns "/etc/php5/" - $non_existent_directory = '/path/to/nowhere'; - echo set_realpath($non_existent_directory, TRUE); // returns an error, as the path could not be resolved - echo set_realpath($non_existent_directory, FALSE); // returns "/path/to/nowhere" \ No newline at end of file + $non_existent_directory = '/path/to/nowhere'; + echo set_realpath($non_existent_directory, TRUE); // shows an error, as the path cannot be resolved + echo set_realpath($non_existent_directory, FALSE); // returns "/path/to/nowhere" -- cgit v1.2.3-24-g4f1b From dd1cabd0eec66ad494d5d7780dadaf23ec0b2216 Mon Sep 17 00:00:00 2001 From: tiyowan Date: Wed, 14 Mar 2012 22:37:43 +0400 Subject: Fix form_input() associative array example to match actual return --- user_guide_src/source/helpers/form_helper.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'user_guide_src/source/helpers') diff --git a/user_guide_src/source/helpers/form_helper.rst b/user_guide_src/source/helpers/form_helper.rst index 4cb0cfd38..62579ca18 100644 --- a/user_guide_src/source/helpers/form_helper.rst +++ b/user_guide_src/source/helpers/form_helper.rst @@ -177,7 +177,7 @@ form to contain /* Would produce: - + */ If you would like your form to contain some additional data, like -- cgit v1.2.3-24-g4f1b From 5511fbfd8f3054049037124059487096c9c9dde9 Mon Sep 17 00:00:00 2001 From: tiyowan Date: Thu, 15 Mar 2012 21:53:07 +0400 Subject: Add strip_slashes() to string helper documentation --- user_guide_src/source/helpers/string_helper.rst | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'user_guide_src/source/helpers') diff --git a/user_guide_src/source/helpers/string_helper.rst b/user_guide_src/source/helpers/string_helper.rst index dc70e461a..2d23fb00c 100644 --- a/user_guide_src/source/helpers/string_helper.rst +++ b/user_guide_src/source/helpers/string_helper.rst @@ -108,6 +108,36 @@ found in http://. Example $string = "http://example.com//index.php"; echo reduce_double_slashes($string); // results in "http://example.com/index.php" +strip_slashes() +=============== + +Removes any slashes from a string. Example + +:: + + $str = "Is your name O\'reilly?"; + echo strip_slashes($str); // results in Is your name O'reilly? + +You can also use an array. Example + +:: + + $str = array( + 'question'  => 'Is your name O\'reilly?', + 'answer' => 'No, my name is O\'connor.' + ); + + $str = strip_slashes($str); + +The above will return the following array: + +:: + + array( + 'question'  => "Is your name O'reilly?", + 'answer' => "No, my name is O'connor." + ); + trim_slashes() ============== -- cgit v1.2.3-24-g4f1b From e538e2ce1b853a8a246c691cbcac37842395c624 Mon Sep 17 00:00:00 2001 From: tiyowan Date: Fri, 16 Mar 2012 20:38:13 +0400 Subject: Fix form_fieldset_close() example to match actual return --- user_guide_src/source/helpers/form_helper.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'user_guide_src/source/helpers') diff --git a/user_guide_src/source/helpers/form_helper.rst b/user_guide_src/source/helpers/form_helper.rst index 62579ca18..a110f3c14 100644 --- a/user_guide_src/source/helpers/form_helper.rst +++ b/user_guide_src/source/helpers/form_helper.rst @@ -325,7 +325,7 @@ the tag. For example $string = ""; echo form_fieldset_close($string); - // Would produce: + // Would produce: form_checkbox() =============== -- cgit v1.2.3-24-g4f1b From 8840c96cc0608859ad4b5341c31db9bb1f833792 Mon Sep 17 00:00:00 2001 From: freewil Date: Sun, 18 Mar 2012 15:23:09 -0400 Subject: use php's hash() function for do_hash() helper --- user_guide_src/source/helpers/security_helper.rst | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'user_guide_src/source/helpers') diff --git a/user_guide_src/source/helpers/security_helper.rst b/user_guide_src/source/helpers/security_helper.rst index 01018c61a..b1bcf2b4a 100644 --- a/user_guide_src/source/helpers/security_helper.rst +++ b/user_guide_src/source/helpers/security_helper.rst @@ -34,8 +34,9 @@ More info can be found there. do_hash() ========= -Permits you to create SHA1 or MD5 one way hashes suitable for encrypting -passwords. Will create SHA1 by default. Examples +Permits you to create one way hashes suitable for encrypting +passwords. Will create SHA1 by default. See `hash_algos() `_ +for a full list of supported algorithms. :: @@ -43,7 +44,7 @@ passwords. Will create SHA1 by default. Examples $str = do_hash($str, 'md5'); // MD5 .. note:: This function was formerly named dohash(), which has been - deprecated in favor of `do_hash()`. + removed in favor of `do_hash()`. strip_image_tags() ================== -- cgit v1.2.3-24-g4f1b