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/cookie_helper.rst6
-rw-r--r--user_guide_src/source/helpers/date_helper.rst46
-rw-r--r--user_guide_src/source/helpers/download_helper.rst17
-rw-r--r--user_guide_src/source/helpers/email_helper.rst75
-rw-r--r--user_guide_src/source/helpers/file_helper.rst28
-rw-r--r--user_guide_src/source/helpers/form_helper.rst28
-rw-r--r--user_guide_src/source/helpers/html_helper.rst62
-rw-r--r--user_guide_src/source/helpers/inflector_helper.rst22
-rw-r--r--user_guide_src/source/helpers/language_helper.rst13
-rw-r--r--user_guide_src/source/helpers/security_helper.rst27
-rw-r--r--user_guide_src/source/helpers/smiley_helper.rst169
-rw-r--r--user_guide_src/source/helpers/string_helper.rst42
-rw-r--r--user_guide_src/source/helpers/typography_helper.rst4
-rw-r--r--user_guide_src/source/helpers/url_helper.rst10
14 files changed, 81 insertions, 468 deletions
diff --git a/user_guide_src/source/helpers/cookie_helper.rst b/user_guide_src/source/helpers/cookie_helper.rst
index da26151cb..71e40a33c 100644
--- a/user_guide_src/source/helpers/cookie_helper.rst
+++ b/user_guide_src/source/helpers/cookie_helper.rst
@@ -25,7 +25,7 @@ Available Functions
The following functions are available:
-.. php:function:: set_cookie($name[, $value = ''[, $expire = ''[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = FALSE[, $httponly = FALSE]]]]]]]])
+.. php:function:: set_cookie($name[, $value = ''[, $expire = ''[, $domain = ''[, $path = '/'[, $prefix = ''[, $secure = FALSE[, $httponly = FALSE]]]]]]])
:param mixed $name: Cookie name *or* associative array of all of the parameters available to this function
:param string $value: Cookie value
@@ -42,7 +42,7 @@ The following functions are available:
a description of its use, as this function is an alias for
``CI_Input::set_cookie()``.
-.. php:function:: get_cookie($index[, $xss_clean = NULL]])
+.. php:function:: get_cookie($index[, $xss_clean = FALSE])
:param string $index: Cookie name
:param bool $xss_clean: Whether to apply XSS filtering to the returned value
@@ -56,7 +56,7 @@ The following functions are available:
the ``$config['cookie_prefix']`` that you might've set in your
*application/config/config.php* file.
-.. php:function:: delete_cookie($name[, $domain = ''[, $path = '/'[, $prefix = '']]]])
+.. php:function:: delete_cookie($name[, $domain = ''[, $path = '/'[, $prefix = '']]])
:param string $name: Cookie name
:param string $domain: Cookie domain (usually: .yourdomain.com)
diff --git a/user_guide_src/source/helpers/date_helper.rst b/user_guide_src/source/helpers/date_helper.rst
index a85da26a4..2f44cb923 100644
--- a/user_guide_src/source/helpers/date_helper.rst
+++ b/user_guide_src/source/helpers/date_helper.rst
@@ -31,7 +31,7 @@ The following functions are available:
:rtype: int
Returns the current time as a UNIX timestamp, referenced either to your server's
- local time or any PHP suported timezone, based on the "time reference" setting
+ local time or any PHP supported timezone, based on the "time reference" setting
in your config file. If you do not intend to set your master time reference to
any other PHP supported timezone (which you'll typically do if you run a site
that lets each user set their own timezone settings) there is no benefit to using
@@ -67,45 +67,6 @@ The following functions are available:
If a timestamp is not included in the second parameter the current time
will be used.
-.. php:function:: standard_date([$fmt = 'DATE_RFC822'[, $time = NULL]])
-
- :param string $fmt: Date format
- :param int $time: UNIX timestamp
- :returns: Formatted date or FALSE on invalid format
- :rtype: string
-
- Lets you generate a date string in one of several standardized formats.
-
- Example::
-
- $format = 'DATE_RFC822';
- $time = time();
- echo standard_date($format, $time);
-
- .. note:: This function is DEPRECATED. Use the native ``date()`` combined with
- `DateTime's format constants
- <http://php.net/manual/en/class.datetime.php#datetime.constants.types>`_
- instead::
-
- echo date(DATE_RFC822, time());
-
- **Supported formats:**
-
- =============== ======================= ======================================
- Constant Description Example
- =============== ======================= ======================================
- DATE_ATOM Atom 2005-08-15T16:13:03+0000
- DATE_COOKIE HTTP Cookies Sun, 14 Aug 2005 16:13:03 UTC
- DATE_ISO8601 ISO-8601 2005-08-14T16:13:03+00:00
- DATE_RFC822 RFC 822 Sun, 14 Aug 05 16:13:03 UTC
- DATE_RFC850 RFC 850 Sunday, 14-Aug-05 16:13:03 UTC
- DATE_RFC1036 RFC 1036 Sunday, 14-Aug-05 16:13:03 UTC
- DATE_RFC1123 RFC 1123 Sun, 14 Aug 2005 16:13:03 UTC
- DATE_RFC2822 RFC 2822 Sun, 14 Aug 2005 16:13:03 +0000
- DATE_RSS RSS Sun, 14 Aug 2005 16:13:03 UTC
- DATE_W3C W3C 2005-08-14T16:13:03+0000
- =============== ======================= ======================================
-
.. php:function:: local_to_gmt([$time = ''])
:param int $time: UNIX timestamp
@@ -220,6 +181,9 @@ The following functions are available:
// Should Produce: 2001-09-11
$better_date = nice_date($bad_date, 'Y-m-d');
+ .. note:: This function is DEPRECATED. Use PHP's native `DateTime class
+ <https://secure.php.net/datetime>`_ instead.
+
.. php:function:: timespan([$seconds = 1[, $time = ''[, $units = '']]])
:param int $seconds: Number of seconds
@@ -434,4 +398,4 @@ UP12 (UTC +12:00) Fiji, Gilbert Islands, Kamchatka, New Zealand
UP1275 (UTC +12:45) Chatham Islands Standard Time
UP13 (UTC +13:00) Phoenix Islands Time, Tonga
UP14 (UTC +14:00) Line Islands
-=========== ===================================================================== \ No newline at end of file
+=========== =====================================================================
diff --git a/user_guide_src/source/helpers/download_helper.rst b/user_guide_src/source/helpers/download_helper.rst
index 1a4065073..e11d92a14 100644
--- a/user_guide_src/source/helpers/download_helper.rst
+++ b/user_guide_src/source/helpers/download_helper.rst
@@ -26,7 +26,7 @@ The following functions are available:
.. php:function:: force_download([$filename = ''[, $data = ''[, $set_mime = FALSE]]])
- :param string $filename: Filename
+ :param mixed $filename: Filename
:param mixed $data: File contents
:param bool $set_mime: Whether to try to send the actual MIME type
:rtype: void
@@ -37,8 +37,11 @@ The following functions are available:
file data.
If you set the second parameter to NULL and ``$filename`` is an existing, readable
- file path, then its content will be read instead.
-
+ file path, then its content will be read instead. You may also set ``$filename``
+ as an associative array with a single element, where the key of that element would be
+ the local file you are trying to read and where the value is the name of the downloadable
+ file that will be sent to browser. An example of this is provided below.
+
If you set the third parameter to boolean TRUE, then the actual file MIME type
(based on the filename extension) will be sent, so that if your browser has a
handler for that type - it can use it.
@@ -53,4 +56,10 @@ The following functions are available:
do the following::
// Contents of photo.jpg will be automatically read
- force_download('/path/to/photo.jpg', NULL); \ No newline at end of file
+ force_download('/path/to/photo.jpg', NULL);
+
+ If you want to download an existing file from your server, but change the name
+ of the actual file sent to browser, you will need this::
+
+ // Contents of photo.jpg will be automatically read and sent as my-photo.jpg
+ force_download(array('/path/to/photo.jpg' => 'my-photo.jpg'), NULL); \ No newline at end of file
diff --git a/user_guide_src/source/helpers/email_helper.rst b/user_guide_src/source/helpers/email_helper.rst
deleted file mode 100644
index 1ee97d902..000000000
--- a/user_guide_src/source/helpers/email_helper.rst
+++ /dev/null
@@ -1,75 +0,0 @@
-############
-Email Helper
-############
-
-The Email Helper provides some assistive functions for working with
-Email. For a more robust email solution, see CodeIgniter's :doc:`Email
-Class <../libraries/email>`.
-
-.. important:: The Email helper is DEPRECATED and is currently
- only kept for backwards compatibility.
-
-.. contents::
- :local:
-
-.. raw:: html
-
- <div class="custom-index container"></div>
-
-Loading this Helper
-===================
-
-This helper is loaded using the following code::
-
- $this->load->helper('email');
-
-Available Functions
-===================
-
-The following functions are available:
-
-
-.. php:function:: valid_email($email)
-
- :param string $email: E-mail address
- :returns: TRUE if a valid email is supplied, FALSE otherwise
- :rtype: bool
-
- Checks if the input is a correctly formatted e-mail address. Note that is
- doesn't actually prove that the address will be able recieve mail, but
- simply that it is a validly formed address.
-
- Example::
-
- if (valid_email('email@somesite.com'))
- {
- echo 'email is valid';
- }
- else
- {
- echo 'email is not valid';
- }
-
- .. note:: All that this function does is to use PHP's native ``filter_var()``::
-
- (bool) filter_var($email, FILTER_VALIDATE_EMAIL);
-
-.. php:function:: send_email($recipient, $subject, $message)
-
- :param string $recipient: E-mail address
- :param string $subject: Mail subject
- :param string $message: Message body
- :returns: TRUE if the mail was successfully sent, FALSE in case of an error
- :rtype: bool
-
- Sends an email using PHP's native `mail() <http://php.net/function.mail>`_
- function.
-
- .. note:: All that this function does is to use PHP's native ``mail``
-
- ::
-
- mail($recipient, $subject, $message);
-
- For a more robust email solution, see CodeIgniter's :doc:`Email Library
- <../libraries/email>`. \ No newline at end of file
diff --git a/user_guide_src/source/helpers/file_helper.rst b/user_guide_src/source/helpers/file_helper.rst
index 833cddea4..dcf3a2340 100644
--- a/user_guide_src/source/helpers/file_helper.rst
+++ b/user_guide_src/source/helpers/file_helper.rst
@@ -23,32 +23,6 @@ Available Functions
The following functions are available:
-
-.. php:function:: read_file($file)
-
- :param string $file: File path
- :returns: File contents or FALSE on failure
- :rtype: string
-
- Returns the data contained in the file specified in the path.
-
- Example::
-
- $string = read_file('./path/to/file.php');
-
- The path can be a relative or full server path. Returns FALSE (boolean) on failure.
-
- .. note:: The path is relative to your main site index.php file, NOT your
- controller or view files. CodeIgniter uses a front controller so paths
- are always relative to the main site index.
-
- .. note:: This function is DEPRECATED. Use the native ``file_get_contents()``
- instead.
-
- .. important:: If your server is running an **open_basedir** restriction this
- function might not work if you are trying to access a file above the
- calling script.
-
.. php:function:: write_file($path, $data[, $mode = 'wb'])
:param string $path: File path
@@ -199,4 +173,4 @@ The following functions are available:
::
- echo octal_permissions(fileperms('./index.php')); // 644 \ No newline at end of file
+ echo octal_permissions(fileperms('./index.php')); // 644
diff --git a/user_guide_src/source/helpers/form_helper.rst b/user_guide_src/source/helpers/form_helper.rst
index d3ee3ffb6..97595c90b 100644
--- a/user_guide_src/source/helpers/form_helper.rst
+++ b/user_guide_src/source/helpers/form_helper.rst
@@ -108,7 +108,7 @@ The following functions are available:
<input type="hidden" name="member_id" value="234" />
-.. php:function:: form_open_multipart([$action = ''[, $attributes = array()[, $hidden = array()]])
+.. php:function:: form_open_multipart([$action = ''[, $attributes = array()[, $hidden = array()]]])
:param string $action: Form action/target URI string
:param array $attributes: HTML attributes
@@ -187,7 +187,7 @@ The following functions are available:
<input type="hidden" name="email" value="john@example.com" id="hiddenemail" class="hiddenemail" />
*/
-.. php:function:: form_input([$data = ''[, $value = ''[, $extra = '']])
+.. php:function:: form_input([$data = ''[, $value = ''[, $extra = '']]])
:param array $data: Field attributes data
:param string $value: Field value
@@ -243,10 +243,9 @@ The following functions are available:
function above except that it uses the "password" input type.
-.. php:function:: form_upload([$data = ''[, $value = ''[, $extra = '']]])
+.. php:function:: form_upload([$data = '', $extra = '']])
:param array $data: Field attributes data
- :param string $value: Field value
:param mixed $extra: Extra attributes to be added to the tag either as an array or a literal string
:returns: An HTML file upload input field tag
:rtype: string
@@ -461,12 +460,12 @@ The following functions are available:
fourth parameter::
$js = 'onClick="some_function()"';
- echo form_checkbox('newsletter', 'accept', TRUE, $js)
+ echo form_checkbox('newsletter', 'accept', TRUE, $js);
Or you can pass it as an array::
$js = array('onClick' => 'some_function();');
- echo form_checkbox('newsletter', 'accept', TRUE, $js)
+ echo form_checkbox('newsletter', 'accept', TRUE, $js);
.. php:function:: form_radio([$data = ''[, $value = ''[, $checked = FALSE[, $extra = '']]]])
@@ -724,20 +723,3 @@ The following functions are available:
<span class="error">The "password" field doesn't match the "repeat_password" field!</span>
*/
-
-.. php:function:: form_prep($str)
-
- :param string $str: Value to escape
- :returns: Escaped value
- :rtype: string
-
- Allows you to safely use HTML and characters such as quotes within form
- elements without breaking out of the form.
-
- .. note:: If you use any of the form helper functions listed in this page the form
- values will be prepped automatically, so there is no need to call this
- function. Use it only if you are creating your own form elements.
-
- .. note:: This function is DEPRECATED and is just an alias for
- :doc:`common function <../general/common_functions>`
- :func:`html_escape()` - please use that instead.
diff --git a/user_guide_src/source/helpers/html_helper.rst b/user_guide_src/source/helpers/html_helper.rst
index 2c748bea0..734b4465c 100644
--- a/user_guide_src/source/helpers/html_helper.rst
+++ b/user_guide_src/source/helpers/html_helper.rst
@@ -286,7 +286,7 @@ The following functions are available:
// Generates: <meta name="description" content="My Great Site" />
echo meta('Content-type', 'text/html; charset=utf-8', 'equiv');
- // Note the third parameter. Can be "equiv" or "name"
+ // Note the third parameter. Can be "charset", "http-equiv", "name" or "property"
// Generates: <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
echo meta(array('name' => 'robots', 'content' => 'no-cache'));
@@ -310,8 +310,13 @@ The following functions are available:
'content' => 'no-cache'
),
array(
- 'name' => 'Content-type',
- 'content' => 'text/html; charset=utf-8', 'type' => 'equiv'
+ 'name' => 'Content-Type',
+ 'type' => 'http-equiv',
+ 'content' => 'text/html; charset=utf-8'
+ ),
+ array(
+ 'name' => 'UTF-8',
+ 'type' => 'charset'
)
);
@@ -321,21 +326,22 @@ The following functions are available:
// <meta name="description" content="My Great Site" />
// <meta name="keywords" content="love, passion, intrigue, deception" />
// <meta name="robots" content="no-cache" />
- // <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
+ // <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+ // <meta charset="UTF-8" />
-.. php:function:: doctype([$type = 'xhtml1-strict'])
+.. php:function:: doctype([$type = 'html5'])
:param string $type: Doctype name
:returns: HTML DocType tag
:rtype: string
- Helps you generate document type declarations, or DTD's. XHTML 1.0
- Strict is used by default, but many doctypes are available.
+ Helps you generate document type declarations, or DTD's. HTML 5
+ is used by default, but many doctypes are available.
Example::
- echo doctype(); // <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+ echo doctype(); // <!DOCTYPE html>
echo doctype('html4-trans'); // <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
@@ -365,43 +371,3 @@ The following functions are available:
XHTML+RDFa 1.0 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 xhtml-rdfa-2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.1//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-2.dtd">
=============================== =================== ==================================================================================================================================================
-
-.. php:function:: br([$count = 1])
-
- :param int $count: Number of times to repeat the tag
- :returns: HTML line break tag
- :rtype: string
-
- Generates line break tags (<br />) based on the number you submit.
- Example::
-
- echo br(3);
-
- The above would produce:
-
- .. code-block:: html
-
- <br /><br /><br />
-
- .. note:: This function is DEPRECATED. Use the native ``str_repeat()``
- in combination with ``<br />`` instead.
-
-.. php:function:: nbs([$num = 1])
-
- :param int $num: Number of space entities to produce
- :returns: A sequence of non-breaking space HTML entities
- :rtype: string
-
- Generates non-breaking spaces (&nbsp;) based on the number you submit.
- Example::
-
- echo nbs(3);
-
- The above would produce:
-
- .. code-block:: html
-
- &nbsp;&nbsp;&nbsp;
-
- .. note:: This function is DEPRECATED. Use the native ``str_repeat()``
- in combination with ``&nbsp;`` instead.
diff --git a/user_guide_src/source/helpers/inflector_helper.rst b/user_guide_src/source/helpers/inflector_helper.rst
index ed1e2b30f..76cce6f4d 100644
--- a/user_guide_src/source/helpers/inflector_helper.rst
+++ b/user_guide_src/source/helpers/inflector_helper.rst
@@ -3,7 +3,7 @@ Inflector Helper
################
The Inflector Helper file contains functions that permits you to change
-words to plural, singular, camel case, etc.
+**English** words to plural, singular, camel case, etc.
.. contents::
:local:
@@ -38,7 +38,7 @@ The following functions are available:
.. php:function:: plural($str)
:param string $str: Input string
- :returns: A plular word
+ :returns: A plural word
:rtype: string
Changes a singular word to plural. Example::
@@ -93,4 +93,20 @@ The following functions are available:
Checks if the given word has a plural version. Example::
- is_countable('equipment'); // Returns FALSE \ No newline at end of file
+ is_countable('equipment'); // Returns FALSE
+
+.. php:function:: ordinal_format($number)
+
+ :param int $number: non-negative natural number to be converted
+ :returns: Ordinal numeral for given number or original value on failure
+ :rtype: string
+
+ Returns the ordinal numeral (1st, 2nd, 3rd etc.) for a
+ non-negative natural number. If the input is not a natural number
+ greater than 0, the function will return the original value. Examples::
+
+ echo ordinal_format(1); // Returns 1st
+ echo ordinal_format(3); // Returns 3rd
+ echo ordinal_format(21); // Returns 21st
+ echo ordinal_format(102); // Returns 102nd
+ echo ordinal_format(-5); // Invalid input, will return -5
diff --git a/user_guide_src/source/helpers/language_helper.rst b/user_guide_src/source/helpers/language_helper.rst
index cadf3c0ce..cfbd6c057 100644
--- a/user_guide_src/source/helpers/language_helper.rst
+++ b/user_guide_src/source/helpers/language_helper.rst
@@ -27,17 +27,20 @@ The following functions are available:
.. php:function:: lang($line[, $for = ''[, $attributes = array()]])
- :param string $line: Language line key
- :param string $for: HTML "for" attribute (ID of the element we're creating a label for)
- :param array $attributes: Any additional HTML attributes
- :returns: HTML-formatted language line label
+ :param string $line: Language line key
+ :param string $for: HTML "for" attribute (ID of the element we're creating a label for)
+ :param array $attributes: Any additional HTML attributes
+ :returns: The language line; in an HTML label tag, if the ``$for`` parameter is not empty
:rtype: string
This function returns a line of text from a loaded language file with
simplified syntax that may be more desirable for view files than
``CI_Lang::line()``.
- Example::
+ Examples::
+
+ echo lang('language_key');
+ // Outputs: Language line
echo lang('language_key', 'form_item_id', array('class' => 'myClass'));
// Outputs: <label for="form_item_id" class="myClass">Language line</label> \ No newline at end of file
diff --git a/user_guide_src/source/helpers/security_helper.rst b/user_guide_src/source/helpers/security_helper.rst
index 103880cf9..e981bc6b6 100644
--- a/user_guide_src/source/helpers/security_helper.rst
+++ b/user_guide_src/source/helpers/security_helper.rst
@@ -48,31 +48,6 @@ The following functions are available:
For more info, please see the :doc:`Security Library <../libraries/security>`
documentation.
-
-.. php:function:: do_hash($str[, $type = 'sha1'])
-
- :param string $str: Input
- :param string $type: Algorithm
- :returns: Hex-formatted hash
- :rtype: string
-
- Permits you to create one way hashes suitable for encrypting
- passwords. Will use SHA1 by default.
-
- See `hash_algos() <http://php.net/function.hash_algos>`_
- for a full list of supported algorithms.
-
- Examples::
-
- $str = do_hash($str); // SHA1
- $str = do_hash($str, 'md5'); // MD5
-
- .. note:: This function was formerly named ``dohash()``, which has been
- removed in favor of ``do_hash()``.
-
- .. note:: This function is DEPRECATED. Use the native ``hash()`` instead.
-
-
.. php:function:: strip_image_tags($str)
:param string $str: Input string
@@ -103,4 +78,4 @@ The following functions are available:
Example::
- $string = encode_php_tags($string); \ No newline at end of file
+ $string = encode_php_tags($string);
diff --git a/user_guide_src/source/helpers/smiley_helper.rst b/user_guide_src/source/helpers/smiley_helper.rst
deleted file mode 100644
index 3e7669942..000000000
--- a/user_guide_src/source/helpers/smiley_helper.rst
+++ /dev/null
@@ -1,169 +0,0 @@
-#############
-Smiley Helper
-#############
-
-The Smiley Helper file contains functions that let you manage smileys
-(emoticons).
-
-.. important:: The Smiley helper is DEPRECATED and should not be used.
- It is currently only kept for backwards compatibility.
-
-.. contents::
- :local:
-
-.. raw:: html
-
- <div class="custom-index container"></div>
-
-Loading this Helper
-===================
-
-This helper is loaded using the following code::
-
- $this->load->helper('smiley');
-
-Overview
-========
-
-The Smiley helper has a renderer that takes plain text smileys, like
-:-) and turns them into a image representation, like |smile!|
-
-It also lets you display a set of smiley images that when clicked will
-be inserted into a form field. For example, if you have a blog that
-allows user commenting you can show the smileys next to the comment
-form. Your users can click a desired smiley and with the help of some
-JavaScript it will be placed into the form field.
-
-Clickable Smileys Tutorial
-==========================
-
-Here is an example demonstrating how you might create a set of clickable
-smileys next to a form field. This example requires that you first
-download and install the smiley images, then create a controller and the
-View as described.
-
-.. important:: Before you begin, please `download the smiley images
- <https://ellislab.com/asset/ci_download_files/smileys.zip>`_
- and put them in a publicly accessible place on your server.
- This helper also assumes you have the smiley replacement array
- located at `application/config/smileys.php`
-
-The Controller
---------------
-
-In your **application/controllers/** directory, create a file called
-Smileys.php and place the code below in it.
-
-.. important:: Change the URL in the :php:func:`get_clickable_smileys()`
- function below so that it points to your smiley folder.
-
-You'll notice that in addition to the smiley helper, we are also using
-the :doc:`Table Class <../libraries/table>`::
-
- <?php
-
- class Smileys extends CI_Controller {
-
- public function index()
- {
- $this->load->helper('smiley');
- $this->load->library('table');
-
- $image_array = get_clickable_smileys('http://example.com/images/smileys/', 'comments');
- $col_array = $this->table->make_columns($image_array, 8);
-
- $data['smiley_table'] = $this->table->generate($col_array);
- $this->load->view('smiley_view', $data);
- }
-
- }
-
-In your **application/views/** directory, create a file called **smiley_view.php**
-and place this code in it::
-
- <html>
- <head>
- <title>Smileys</title>
- <?php echo smiley_js(); ?>
- </head>
- <body>
- <form name="blog">
- <textarea name="comments" id="comments" cols="40" rows="4"></textarea>
- </form>
- <p>Click to insert a smiley!</p>
- <?php echo $smiley_table; ?> </body> </html>
- When you have created the above controller and view, load it by visiting http://www.example.com/index.php/smileys/
- </body>
- </html>
-
-Field Aliases
--------------
-
-When making changes to a view it can be inconvenient to have the field
-id in the controller. To work around this, you can give your smiley
-links a generic name that will be tied to a specific id in your view.
-
-::
-
- $image_array = get_smiley_links("http://example.com/images/smileys/", "comment_textarea_alias");
-
-To map the alias to the field id, pass them both into the
-:func:`smiley_js()` function::
-
- $image_array = smiley_js("comment_textarea_alias", "comments");
-
-Available Functions
-===================
-
-.. php:function:: get_clickable_smileys($image_url[, $alias = ''[, $smileys = NULL]])
-
- :param string $image_url: URL path to the smileys directory
- :param string $alias: Field alias
- :returns: An array of ready to use smileys
- :rtype: array
-
- Returns an array containing your smiley images wrapped in a clickable
- link. You must supply the URL to your smiley folder and a field id or
- field alias.
-
- Example::
-
- $image_array = get_clickable_smileys('http://example.com/images/smileys/', 'comment');
-
-.. php:function:: smiley_js([$alias = ''[, $field_id = ''[, $inline = TRUE]]])
-
- :param string $alias: Field alias
- :param string $field_id: Field ID
- :param bool $inline: Whether we're inserting an inline smiley
- :returns: Smiley-enabling JavaScript code
- :rtype: string
-
- Generates the JavaScript that allows the images to be clicked and
- inserted into a form field. If you supplied an alias instead of an id
- when generating your smiley links, you need to pass the alias and
- corresponding form id into the function. This function is designed to be
- placed into the <head> area of your web page.
-
- Example::
-
- <?php echo smiley_js(); ?>
-
-.. php:function:: parse_smileys([$str = ''[, $image_url = ''[, $smileys = NULL]]])
-
- :param string $str: Text containing smiley codes
- :param string $image_url: URL path to the smileys directory
- :param array $smileys: An array of smileys
- :returns: Parsed smileys
- :rtype: string
-
- Takes a string of text as input and replaces any contained plain text
- smileys into the image equivalent. The first parameter must contain your
- string, the second must contain the URL to your smiley folder
-
- Example::
-
- $str = 'Here are some smileys: :-) ;-)';
- $str = parse_smileys($str, 'http://example.com/images/smileys/');
- echo $str;
-
-.. |smile!| image:: ../images/smile.gif \ No newline at end of file
diff --git a/user_guide_src/source/helpers/string_helper.rst b/user_guide_src/source/helpers/string_helper.rst
index a1acb215c..7a45dc95b 100644
--- a/user_guide_src/source/helpers/string_helper.rst
+++ b/user_guide_src/source/helpers/string_helper.rst
@@ -5,6 +5,9 @@ String Helper
The String Helper file contains functions that assist in working with
strings.
+.. important:: Please note that these functions are NOT intended, nor
+ suitable to be used for any kind of security-related logic.
+
.. contents::
:local:
@@ -24,7 +27,6 @@ Available Functions
The following functions are available:
-
.. php:function:: random_string([$type = 'alnum'[, $len = 8]])
:param string $type: Randomization type
@@ -99,24 +101,6 @@ The following functions are available:
.. note:: To use multiple separate calls to this function simply call the
function with no arguments to re-initialize.
-.. php:function:: repeater($data[, $num = 1])
-
- :param string $data: Input
- :param int $num: Number of times to repeat
- :returns: Repeated string
- :rtype: string
-
- Generates repeating copies of the data you submit. Example::
-
- $string = "\n";
- echo repeater($string, 30);
-
- The above would generate 30 newlines.
-
- .. note:: This function is DEPRECATED. Use the native ``str_repeat()``
- instead.
-
-
.. php:function:: reduce_double_slashes($str)
:param string $str: Input string
@@ -131,7 +115,6 @@ The following functions are available:
$string = "http://example.com//index.php";
echo reduce_double_slashes($string); // results in "http://example.com/index.php"
-
.. php:function:: strip_slashes($data)
:param mixed $data: Input string or an array of strings
@@ -160,21 +143,6 @@ The following functions are available:
and handle string inputs. This however makes it just an
alias for ``stripslashes()``.
-.. php:function:: trim_slashes($str)
-
- :param string $str: Input string
- :returns: Slash-trimmed string
- :rtype: 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, '/');
-
.. php:function:: reduce_multiples($str[, $character = ''[, $trim = FALSE]])
:param string $str: Text to search in
@@ -183,7 +151,7 @@ The following functions are available:
:returns: Reduced string
:rtype: string
- Reduces multiple instances of a particular character occuring directly
+ Reduces multiple instances of a particular character occurring directly
after each other. Example::
$string = "Fred, Bill,, Joe, Jimmy";
@@ -217,4 +185,4 @@ The following functions are available:
Removes single and double quotes from a string. Example::
$string = "Joe's \"dinner\"";
- $string = strip_quotes($string); //results in "Joes dinner" \ No newline at end of file
+ $string = strip_quotes($string); //results in "Joes dinner"
diff --git a/user_guide_src/source/helpers/typography_helper.rst b/user_guide_src/source/helpers/typography_helper.rst
index 7eb4fceec..89730b03d 100644
--- a/user_guide_src/source/helpers/typography_helper.rst
+++ b/user_guide_src/source/helpers/typography_helper.rst
@@ -35,7 +35,7 @@ The following functions are available:
Formats text so that it is semantically and typographically correct
HTML.
- This function is an alias for ``CI_Typography::auto_typography``.
+ This function is an alias for ``CI_Typography::auto_typography()``.
For more info, please see the :doc:`Typography Library
<../libraries/typography>` documentation.
@@ -45,7 +45,7 @@ The following functions are available:
.. note:: Typographic formatting can be processor intensive, particularly if
you have a lot of content being formatted. If you choose to use this
- function you may want to consider `caching <../general/caching>` your
+ function you may want to consider :doc:`caching <../general/caching>` your
pages.
diff --git a/user_guide_src/source/helpers/url_helper.rst b/user_guide_src/source/helpers/url_helper.rst
index 64deae240..435a21df4 100644
--- a/user_guide_src/source/helpers/url_helper.rst
+++ b/user_guide_src/source/helpers/url_helper.rst
@@ -18,11 +18,11 @@ This helper is loaded using the following code::
$this->load->helper('url');
-The following functions are available:
-
Available Functions
===================
+The following functions are available:
+
.. php:function:: site_url([$uri = ''[, $protocol = NULL]])
:param string $uri: URI string
@@ -277,7 +277,7 @@ Available Functions
:param string $str: Input string
:param string $separator: Word separator
- :param string $lowercase: Whether to transform the output string to lower-case
+ :param bool $lowercase: Whether to transform the output string to lower-case
:returns: URL-formatted string
:rtype: string
@@ -360,7 +360,7 @@ Available Functions
is outputted to the browser since it utilizes server headers.
.. note:: For very fine grained control over headers, you should use the
- `Output Library </libraries/output>` ``set_header()`` method.
+ :doc:`Output Library </libraries/output>` ``set_header()`` method.
.. note:: To IIS users: if you hide the `Server` HTTP header, the *auto*
method won't detect IIS, in that case it is advised you explicitly
@@ -370,4 +370,4 @@ Available Functions
will *automatically* be selected when the page is currently accessed
via POST and HTTP/1.1 is used.
- .. important:: This function will terminate script execution. \ No newline at end of file
+ .. important:: This function will terminate script execution.