summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/helpers
diff options
context:
space:
mode:
Diffstat (limited to 'user_guide_src/source/helpers')
-rw-r--r--user_guide_src/source/helpers/date_helper.rst13
-rw-r--r--user_guide_src/source/helpers/form_helper.rst4
-rw-r--r--user_guide_src/source/helpers/path_helper.rst20
-rw-r--r--user_guide_src/source/helpers/security_helper.rst7
-rw-r--r--user_guide_src/source/helpers/string_helper.rst30
5 files changed, 57 insertions, 17 deletions
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/<your_lang>/date_lang.php
diff --git a/user_guide_src/source/helpers/form_helper.rst b/user_guide_src/source/helpers/form_helper.rst
index 4cb0cfd38..a110f3c14 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:
- <input type="text" name="username" id="username" value="johndoe" maxlength="100" size="50" style="width:50%" />
+ <input type="text" name="username" value="johndoe" id="username" maxlength="100" size="50" style="width:50%" />
*/
If you would like your form to contain some additional data, like
@@ -325,7 +325,7 @@ the tag. For example
$string = "</div></div>";
echo form_fieldset_close($string);
- // Would produce: </fieldset> </div></div>
+ // Would produce: </fieldset></div></div>
form_checkbox()
===============
diff --git a/user_guide_src/source/helpers/path_helper.rst b/user_guide_src/source/helpers/path_helper.rst
index 1a70af458..847f5a08b 100644
--- a/user_guide_src/source/helpers/path_helper.rst
+++ b/user_guide_src/source/helpers/path_helper.rst
@@ -28,10 +28,16 @@ cannot be resolved.
::
- $directory = '/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"
-
-
+ $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); // 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/"
+
+ $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"
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() <http://php.net/function.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()
==================
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()
==============