diff options
author | Eric Roberts <eric@cryode.com> | 2012-04-15 00:49:21 +0200 |
---|---|---|
committer | Eric Roberts <eric@cryode.com> | 2012-04-15 00:49:21 +0200 |
commit | 8cefb3ff51de4f023753c0146eb16950f48601a9 (patch) | |
tree | ed868ec7a795fcf1fe97efc5642d26dc1d1faefe /user_guide_src/source/helpers | |
parent | 0760a48d431fb9ab85f2a0ca9af63aa131e29520 (diff) | |
parent | 0f2211711deceb74157d6811116acc0376d3157d (diff) |
Merge branch 'develop' of https://github.com/EllisLab/CodeIgniter into feature/form_error_msgs
Conflicts:
system/language/english/form_validation_lang.php
Diffstat (limited to 'user_guide_src/source/helpers')
-rw-r--r-- | user_guide_src/source/helpers/date_helper.rst | 13 | ||||
-rw-r--r-- | user_guide_src/source/helpers/form_helper.rst | 269 | ||||
-rw-r--r-- | user_guide_src/source/helpers/html_helper.rst | 62 | ||||
-rw-r--r-- | user_guide_src/source/helpers/path_helper.rst | 20 | ||||
-rw-r--r-- | user_guide_src/source/helpers/security_helper.rst | 7 | ||||
-rw-r--r-- | user_guide_src/source/helpers/string_helper.rst | 30 |
6 files changed, 250 insertions, 151 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 3794e0835..a110f3c14 100644 --- a/user_guide_src/source/helpers/form_helper.rst +++ b/user_guide_src/source/helpers/form_helper.rst @@ -45,7 +45,7 @@ parameter, like this :: - $attributes = array('class' => 'email', 'id' => 'myform'); + $attributes = array('class' => 'email', 'id' => 'myform'); echo form_open('email/send', $attributes); The above example would create a form similar to this @@ -61,15 +61,15 @@ Hidden fields can be added by passing an associative array to the third paramete :: - $hidden = array('username' => 'Joe', 'member_id' => '234'); + $hidden = array('username' => 'Joe', 'member_id' => '234'); echo form_open('email/send', '', $hidden); The above example would create a form similar to this :: - <form method="post" accept-charset="utf-8" action="http://example.com/index.php/email/send"> - <input type="hidden" name="username" value="Joe" /> + <form method="post" accept-charset="utf-8" action="http://example.com/index.php/email/send"> + <input type="hidden" name="username" value="Joe" /> <input type="hidden" name="member_id" value="234" /> form_open_multipart() @@ -87,28 +87,67 @@ name/value string to create one field :: - form_hidden('username', 'johndoe'); + form_hidden('username', 'johndoe'); // Would produce: <input type="hidden" name="username" value="johndoe" /> Or you can submit an associative array to create multiple fields :: - $data = array( - 'name' => 'John Doe', - 'email' => 'john@example.com', - 'url' => 'http://example.com' - ); - - echo form_hidden($data); - + $data = array( + 'name' => 'John Doe', + 'email' => 'john@example.com', + 'url' => 'http://example.com' + ); + + echo form_hidden($data); + /* - Would produce: - <input type="hidden" name="name" value="John Doe" /> - <input type="hidden" name="email" value="john@example.com" /> + Would produce: + <input type="hidden" name="name" value="John Doe" /> + <input type="hidden" name="email" value="john@example.com" /> <input type="hidden" name="url" value="http://example.com" /> */ +Or pass an associative array to the value field. + +:: + + $data = array( + 'name' => 'John Doe', + 'email' => 'john@example.com', + 'url' => 'http://example.com' + ); + + echo form_hidden('my_array', $data); + + /* + Would produce: + <input type="hidden" name="my_array[name]" value="John Doe" /> + <input type="hidden" name="my_array[email]" value="john@example.com" /> + <input type="hidden" name="my_array[url]" value="http://example.com" /> + */ + +If you want to create hidden input fields with extra attributes + +:: + + $data = array( + 'type' => 'hidden', + 'name' => 'email', + 'id' => 'hiddenemail', + 'value' => 'john@example.com', + 'class' => 'hiddenemail' + ); + + echo form_input($data); + + /* + Would produce: + + <input type="hidden" name="email" value="john@example.com" id="hiddenemail" class="hiddenemail" /> + */ + form_input() ============ @@ -124,21 +163,21 @@ form to contain :: - $data = array( - 'name' => 'username', - 'id' => 'username', - 'value' => 'johndoe', - 'maxlength' => '100', - 'size' => '50', - 'style' => 'width:50%', - ); - + $data = array( + 'name' => 'username', + 'id' => 'username', + 'value' => 'johndoe', + 'maxlength' => '100', + 'size' => '50', + 'style' => 'width:50%' + ); + echo form_input($data); - + /* 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 @@ -146,7 +185,7 @@ Javascript, you can pass it as a string in the third parameter :: - $js = 'onClick="some_function()"'; + $js = 'onClick="some_function()"'; echo form_input('username', 'johndoe', $js); form_password() @@ -176,37 +215,37 @@ multiple select for you. Example :: - $options = array( - 'small' => 'Small Shirt', - 'med' => 'Medium Shirt', - 'large' => 'Large Shirt', - 'xlarge' => 'Extra Large Shirt', - ); - - $shirts_on_sale = array('small', 'large'); - echo form_dropdown('shirts', $options, 'large'); - + $options = array( + 'small' => 'Small Shirt', + 'med' => 'Medium Shirt', + 'large' => 'Large Shirt', + 'xlarge' => 'Extra Large Shirt', + ); + + $shirts_on_sale = array('small', 'large'); + echo form_dropdown('shirts', $options, 'large'); + /* - Would produce: - - <select name="shirts"> - <option value="small">Small Shirt</option> - <option value="med">Medium Shirt</option> - <option value="large" selected="selected">Large Shirt</option> - <option value="xlarge">Extra Large Shirt</option> + Would produce: + + <select name="shirts"> + <option value="small">Small Shirt</option> + <option value="med">Medium Shirt</option> + <option value="large" selected="selected">Large Shirt</option> + <option value="xlarge">Extra Large Shirt</option> </select> */ - + echo form_dropdown('shirts', $options, $shirts_on_sale); - + /* - Would produce: - - <select name="shirts" multiple="multiple"> - <option value="small" selected="selected">Small Shirt</option> - <option value="med">Medium Shirt</option> - <option value="large" selected="selected">Large Shirt</option> - <option value="xlarge">Extra Large Shirt</option> + Would produce: + + <select name="shirts" multiple="multiple"> + <option value="small" selected="selected">Small Shirt</option> + <option value="med">Medium Shirt</option> + <option value="large" selected="selected">Large Shirt</option> + <option value="xlarge">Extra Large Shirt</option> </select> */ @@ -216,7 +255,7 @@ parameter :: - $js = 'id="shirts" onChange="some_function();"'; + $js = 'id="shirts" onChange="some_function();"'; echo form_dropdown('shirts', $options, 'large', $js); If the array passed as $options is a multidimensional array, @@ -240,38 +279,38 @@ Lets you generate fieldset/legend fields. :: - echo form_fieldset('Address Information'); - echo "<p>fieldset content here</p>\n"; + echo form_fieldset('Address Information'); + echo "<p>fieldset content here</p>\n"; echo form_fieldset_close(); - + /* Produces: - <fieldset> - <legend>Address Information</legend> - <p>form content here</p> + <fieldset> + <legend>Address Information</legend> + <p>form content here</p> </fieldset> */ - + Similar to other functions, you can submit an associative array in the second parameter if you prefer to set additional attributes. :: $attributes = array( - 'id' => 'address_info', + 'id' => 'address_info', 'class' => 'address_info' - ); - - echo form_fieldset('Address Information', $attributes); - echo "<p>fieldset content here</p>\n"; - echo form_fieldset_close(); - + ); + + echo form_fieldset('Address Information', $attributes); + echo "<p>fieldset content here</p>\n"; + echo form_fieldset_close(); + /* - Produces: - - <fieldset id="address_info" class="address_info"> - <legend>Address Information</legend> - <p>form content here</p> + Produces: + + <fieldset id="address_info" class="address_info"> + <legend>Address Information</legend> + <p>form content here</p> </fieldset> */ @@ -284,9 +323,9 @@ the tag. For example :: - $string = "</div></div>"; - echo form_fieldset_close($string); - // Would produce: </fieldset> </div></div> + $string = "</div></div>"; + echo form_fieldset_close($string); + // Would produce: </fieldset></div></div> form_checkbox() =============== @@ -295,7 +334,7 @@ Lets you generate a checkbox field. Simple example :: - echo form_checkbox('newsletter', 'accept', TRUE); + echo form_checkbox('newsletter', 'accept', TRUE); // Would produce: <input type="checkbox" name="newsletter" value="accept" checked="checked" /> The third parameter contains a boolean TRUE/FALSE to determine whether @@ -306,15 +345,15 @@ array of attributes to the function :: - $data = array( - 'name' => 'newsletter', - 'id' => 'newsletter', - 'value' => 'accept', - 'checked' => TRUE, - 'style' => 'margin:10px', - ); - - echo form_checkbox($data); + $data = array( + 'name' => 'newsletter', + 'id' => 'newsletter', + 'value' => 'accept', + 'checked' => TRUE, + 'style' => 'margin:10px', + ); + + echo form_checkbox($data); // Would produce: <input type="checkbox" name="newsletter" id="newsletter" value="accept" checked="checked" style="margin:10px" /> As with other functions, if you would like the tag to contain additional @@ -323,7 +362,7 @@ parameter :: - $js = 'onClick="some_function()"'; + $js = 'onClick="some_function()"'; echo form_checkbox('newsletter', 'accept', TRUE, $js) form_radio() @@ -339,7 +378,7 @@ Lets you generate a standard submit button. Simple example :: - echo form_submit('mysubmit', 'Submit Post!'); + echo form_submit('mysubmit', 'Submit Post!'); // Would produce: <input type="submit" name="mysubmit" value="Submit Post!" /> Similar to other functions, you can submit an associative array in the @@ -353,7 +392,7 @@ Lets you generate a <label>. Simple example :: - echo form_label('What is your Name', 'username'); + echo form_label('What is your Name', 'username'); // Would produce: <label for="username">What is your Name</label> Similar to other functions, you can submit an associative array in the @@ -361,12 +400,12 @@ third parameter if you prefer to set additional attributes. :: - $attributes = array( - 'class' => 'mycustomclass', + $attributes = array( + 'class' => 'mycustomclass', 'style' => 'color: #000;' - ); - - echo form_label('What is your Name', 'username', $attributes); + ); + + echo form_label('What is your Name', 'username', $attributes); // Would produce: <label for="username" class="mycustomclass" style="color: #000;">What is your Name</label> @@ -384,7 +423,7 @@ button name and content in the first and second parameter :: - echo form_button('name','content'); + echo form_button('name','content'); // Would produce <button name="name" type="button">Content</button> Or you can pass an associative array containing any data you wish your @@ -392,15 +431,15 @@ form to contain: :: - $data = array( - 'name' => 'button', - 'id' => 'button', - 'value' => 'true', - 'type' => 'reset', - 'content' => 'Reset' - ); - - echo form_button($data); + $data = array( + 'name' => 'button', + 'id' => 'button', + 'value' => 'true', + 'type' => 'reset', + 'content' => 'Reset' + ); + + echo form_button($data); // Would produce: <button name="button" id="button" value="true" type="reset">Reset</button> If you would like your form to contain some additional data, like @@ -408,7 +447,7 @@ JavaScript, you can pass it as a string in the third parameter: :: - $js = 'onClick="some_function()"'; + $js = 'onClick="some_function()"'; echo form_button('mybutton', 'Click Me', $js); form_close() @@ -420,8 +459,8 @@ the tag. For example :: - $string = "</div></div>"; - echo form_close($string); + $string = "</div></div>"; + echo form_close($string); // Would produce: </form> </div></div> form_prep() @@ -432,7 +471,7 @@ elements without breaking out of the form. Consider this example :: - $string = 'Here is a string containing "quoted" text.'; + $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 @@ -475,9 +514,9 @@ Example :: <select name="myselect"> - <option value="one" <?php echo set_select('myselect', 'one', TRUE); ?> >One</option> - <option value="two" <?php echo set_select('myselect', 'two'); ?> >Two</option> - <option value="three" <?php echo set_select('myselect', 'three'); ?> >Three</option> + <option value="one" <?php echo set_select('myselect', 'one', TRUE); ?> >One</option> + <option value="two" <?php echo set_select('myselect', 'two'); ?> >Two</option> + <option value="three" <?php echo set_select('myselect', 'three'); ?> >Three</option> </select> set_checkbox() @@ -490,7 +529,7 @@ lets you set an item as the default (use boolean TRUE/FALSE). Example :: - <input type="checkbox" name="mycheck" value="1" <?php echo set_checkbox('mycheck', '1'); ?> /> + <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'); ?> /> set_radio() @@ -501,6 +540,6 @@ This function is identical to the **set_checkbox()** function above. :: - <input type="radio" name="myradio" value="1" <?php echo set_radio('myradio', '1', TRUE); ?> /> + <input type="radio" name="myradio" value="1" <?php echo set_radio('myradio', '1', TRUE); ?> /> <input type="radio" name="myradio" value="2" <?php echo set_radio('myradio', '2'); ?> /> diff --git a/user_guide_src/source/helpers/html_helper.rst b/user_guide_src/source/helpers/html_helper.rst index 2e217898e..17c28cd2a 100644 --- a/user_guide_src/source/helpers/html_helper.rst +++ b/user_guide_src/source/helpers/html_helper.rst @@ -325,24 +325,44 @@ Strict is used by default, but many doctypes are available. The following is a list of doctype choices. These are configurable, and pulled from application/config/doctypes.php -+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+ -| Doctype | Option | Result | -+========================+==========================+===========================================================================================================================+ -| XHTML 1.1 | doctype('xhtml11') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | -+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+ -| XHTML 1.0 Strict | doctype('xhtml1-strict') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | -+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+ -| XHTML 1.0 Transitional | doctype('xhtml1-trans') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | -+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+ -| XHTML 1.0 Frameset | doctype('xhtml1-frame') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> | -+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+ -| XHTML Basic 1.1 | doctype('xhtml-basic11') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd"> | -+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+ -| HTML 5 | doctype('html5') | <!DOCTYPE html> | -+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+ -| HTML 4 Strict | doctype('html4-strict') | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | -+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+ -| HTML 4 Transitional | doctype('html4-trans') | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | -+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+ -| HTML 4 Frameset | doctype('html4-frame') | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> | -+------------------------+--------------------------+---------------------------------------------------------------------------------------------------------------------------+ ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| Doctype | Option | Result | ++===============================+==============================+==================================================================================================================================================+ +| XHTML 1.1 | doctype('xhtml11') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| XHTML 1.0 Strict | doctype('xhtml1-strict') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| XHTML 1.0 Transitional | doctype('xhtml1-trans') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| XHTML 1.0 Frameset | doctype('xhtml1-frame') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| XHTML Basic 1.1 | doctype('xhtml-basic11') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.1//EN" "http://www.w3.org/TR/xhtml-basic/xhtml-basic11.dtd"> | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| HTML 5 | doctype('html5') | <!DOCTYPE html> | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| HTML 4 Strict | doctype('html4-strict') | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| HTML 4 Transitional | doctype('html4-trans') | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| HTML 4 Frameset | doctype('html4-frame') | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd"> | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| MathML 1.01 | doctype('mathml1') | <!DOCTYPE math SYSTEM "http://www.w3.org/Math/DTD/mathml1/mathml.dtd"> | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| MathML 2.0 | doctype('mathml2') | <!DOCTYPE math PUBLIC "-//W3C//DTD MathML 2.0//EN" "http://www.w3.org/Math/DTD/mathml2/mathml2.dtd"> | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| SVG 1.0 | doctype('svg10') | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd"> | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| SVG 1.1 Full | doctype('svg11') | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| SVG 1.1 Basic | doctype('svg11-basic') | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Basic//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-basic.dtd"> | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| SVG 1.1 Tiny | doctype('svg11-tiny') | <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1 Tiny//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11-tiny.dtd"> | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| XHTML+MathML+SVG (XHTML host) | doctype('xhtml-math-svg-xh') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"> | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| XHTML+MathML+SVG (SVG host) | doctype('xhtml-math-svg-sh') | <!DOCTYPE svg:svg PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN" "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd"> | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| XHTML+RDFa 1.0 | doctype('xhtml-rdfa-1') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"> | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+ +| XHTML+RDFa 1.1 | doctype('xhtml-rdfa-2') | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd"> | ++-------------------------------+------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------+
\ No newline at end of file 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() ============== |