summaryrefslogtreecommitdiffstats
path: root/user_guide_src
diff options
context:
space:
mode:
Diffstat (limited to 'user_guide_src')
-rw-r--r--user_guide_src/source/changelog.rst20
-rw-r--r--user_guide_src/source/database/query_builder.rst37
-rw-r--r--user_guide_src/source/general/caching.rst12
-rw-r--r--user_guide_src/source/helpers/language_helper.rst10
-rw-r--r--user_guide_src/source/installation/upgrade_300.rst16
-rw-r--r--user_guide_src/source/libraries/email.rst12
-rw-r--r--user_guide_src/source/libraries/form_validation.rst1
-rw-r--r--user_guide_src/source/libraries/language.rst40
-rw-r--r--user_guide_src/source/libraries/output.rst30
-rw-r--r--user_guide_src/source/libraries/sessions.rst5
10 files changed, 113 insertions, 70 deletions
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 5d4757a7e..6570eb790 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -96,7 +96,8 @@ Release Date: Not Released
- 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.
+ - :doc:`Directory Helper <helpers/directory_helper>` :php:func:`directory_map()` will now append ``DIRECTORY_SEPARATOR`` to directory names in the returned array.
+ - :doc:`Language Helper <helpers/language_helper>` :php:func:`lang()` now accepts an optional list of additional HTML attributes.
- 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.
- Database
@@ -220,11 +221,12 @@ Release Date: Not Released
- Added method ``reset_validation()`` which resets internal validation variables in case of multiple validation routines.
- Added support for setting error delimiters in the config file via ``$config['error_prefix']`` and ``$config['error_suffix']``.
- ``_execute()`` now considers input data to be invalid if a specified rule is not found.
- - Removed method ``is_numeric()`` as it exists as a native PHP function and ``_execute()`` will find and use that (the *is_numeric* rule itself is deprecated since 1.6.1).
+ - Removed method ``is_numeric()`` as it exists as a native PHP function and ``_execute()`` will find and use that (the **is_numeric** rule itself is deprecated since 1.6.1).
- Native PHP functions used as rules can now accept an additional parameter, other than the data itself.
- Updated ``set_rules()`` to accept an array of rules as well as a string.
- Fields that have empty rules set no longer run through validation (and therefore are not considered erroneous).
- - Added rule *differs* to check if the value of a field differs from the value of another field.
+ - Added rule **differs* to check if the value of a field differs from the value of another field.
+ - Added rule **valid_url**.
- Added support for setting :doc:`Table <libraries/table>` class defaults in a config file.
- :doc:`Caching Library <libraries/caching>` changes include:
- Added Wincache driver.
@@ -242,6 +244,7 @@ Release Date: Not Released
- Default charset now relies on the global ``$config['charset']`` setting.
- Removed unused protected method ``_get_ip()`` (:doc:`Input Library <libraries/input>`'s ``ip_address()`` should be used anyway).
- Internal method ``_prep_q_encoding()`` now utilizes PHP's *mbstring* and *iconv* extensions (when available) and no longer has a second (``$from``) argument.
+ - Added an optional parameter to ``print_debugger()`` to allow specifying which parts of the message should be printed ('headers', 'subject', 'body').
- :doc:`Pagination Library <libraries/pagination>` changes include:
- Added support for the anchor "rel" attribute.
- Added support for setting custom attributes.
@@ -252,9 +255,6 @@ Release Date: Not Released
- :doc:`Encryption Library <libraries/encryption>` changes include:
- Added support for hashing algorithms other than SHA1 and MD5.
- Removed previously deprecated ``sha1()`` method.
- - :doc:`Language Library <libraries/language>` changes include:
- - Changed method ``load()`` to filter the language name with ``ctype_digit()``.
- - Added an optional second parameter to method ``line()`` to disable error login for line keys that were not found.
- :doc:`Profiler Library <general/profiling>` now also displays database object names.
- :doc:`Migration Library <libraries/migration>` changes include:
- Added support for timestamp-based migrations (enabled by default).
@@ -275,7 +275,6 @@ Release Date: Not Released
- Added method ``get_vars()`` to the Loader to retrieve all variables loaded with ``$this->load->vars()``.
- ``_ci_autoloader()`` is now a protected method.
- Added autoloading of drivers with ``$autoload['drivers']``.
- - ``library()`` method will now load drivers as well, for backward compatibility of converted libraries (like :doc:`Session <libraries/sessions>`).
- ``$config['rewrite_short_tags']`` now has no effect when using PHP 5.4 as ``<?=`` will always be available.
- Changed method ``config()`` to return whatever ``CI_Config::load()`` returns instead of always being void.
- :doc:`Input Library <libraries/input>` changes include:
@@ -295,8 +294,9 @@ Release Date: Not Released
- Added support for HTTP-Only cookies with new config option *cookie_httponly* (default FALSE).
- Renamed method ``_call_hook()`` to ``call_hook()`` in the :doc:`Hooks Library <general/hooks>`.
- :doc:`Output Library <libraries/output>` changes include:
- - Added method ``get_content_type()``.
- Added a second argument to method ``set_content_type()`` that allows setting the document charset as well.
+ - Added methods ``get_content_type()`` and ``get_header()``.
+ - Added method ``delete_cache()``.
- ``$config['time_reference']`` now supports all timezone strings supported by PHP.
- :doc:`Config Library <libraries/config>` changes include:
- Changed ``site_url()`` method to accept an array as well.
@@ -308,6 +308,10 @@ Release Date: Not Released
- :doc:`URI Routing <general/routing>` changes include:
- Added possibility to route requests using callbacks.
- Added possibility to use dashes in the controller and method URI segments (translated to underscores).
+ - :doc:`Language Library <libraries/language>` changes include:
+ - Changed method ``load()`` to filter the language name with ``ctype_digit()``.
+ - Added an optional second parameter to method ``line()`` to disable error login for line keys that were not found.
+ - Language files are now loaded in a cascading style with the one in **system/** always loaded and overriden afterwards, if another one is found.
Bug fixes for 3.0
------------------
diff --git a/user_guide_src/source/database/query_builder.rst b/user_guide_src/source/database/query_builder.rst
index 8fb906052..65609c1cb 100644
--- a/user_guide_src/source/database/query_builder.rst
+++ b/user_guide_src/source/database/query_builder.rst
@@ -345,23 +345,24 @@ if appropriate
$this->db->like()
=================
-This function enables you to generate **LIKE** clauses, useful for doing
+This method enables you to generate **LIKE** clauses, useful for doing
searches.
-.. note:: All values passed to this function are escaped automatically.
+.. note:: All values passed to this method are escaped automatically.
#. **Simple key/value method:**
::
- $this->db->like('title', 'match'); // Produces: WHERE title LIKE '%match%'
+ $this->db->like('title', 'match');
+ // Produces: WHERE `title` LIKE '%match%' ESCAPE '!'
- If you use multiple function calls they will be chained together with
+ If you use multiple method calls they will be chained together with
AND between them::
$this->db->like('title', 'match');
$this->db->like('body', 'match');
- // WHERE title LIKE '%match%' AND body LIKE '%match%
+ // WHERE `title` LIKE '%match%' ESCAPE '!' AND `body` LIKE '%match% ESCAPE '!'
If you want to control where the wildcard (%) is placed, you can use
an optional third argument. Your options are 'before', 'after' and
@@ -369,9 +370,9 @@ searches.
::
- $this->db->like('title', 'match', 'before'); // Produces: WHERE title LIKE '%match'
- $this->db->like('title', 'match', 'after'); // Produces: WHERE title LIKE 'match%'
- $this->db->like('title', 'match', 'both'); // Produces: WHERE title LIKE '%match%'
+ $this->db->like('title', 'match', 'before'); // Produces: WHERE `title` LIKE '%match' ESCAPE '!'
+ $this->db->like('title', 'match', 'after'); // Produces: WHERE `title` LIKE 'match%' ESCAPE '!'
+ $this->db->like('title', 'match', 'both'); // Produces: WHERE `title` LIKE '%match%' ESCAPE '!'
#. **Associative array method:**
@@ -379,37 +380,37 @@ searches.
$array = array('title' => $match, 'page1' => $match, 'page2' => $match);
$this->db->like($array);
- // WHERE title LIKE '%match%' AND page1 LIKE '%match%' AND page2 LIKE '%match%'
+ // WHERE `title` LIKE '%match%' ESCAPE '!' AND `page1` LIKE '%match%' ESCAPE '!' AND `page2` LIKE '%match%' ESCAPE '!'
$this->db->or_like()
====================
-This function is identical to the one above, except that multiple
+This method is identical to the one above, except that multiple
instances are joined by OR::
$this->db->like('title', 'match'); $this->db->or_like('body', $match);
- // WHERE title LIKE '%match%' OR body LIKE '%match%'
+ // WHERE `title` LIKE '%match%' ESCAPE '!' OR `body` LIKE '%match%' ESCAPE '!'
-.. note:: or_like() was formerly known as orlike(), which has been removed.
+.. note:: ``or_like()`` was formerly known as ``orlike()``, which has been removed.
$this->db->not_like()
=====================
-This function is identical to **like()**, except that it generates NOT
-LIKE statements::
+This method is identical to ``like()``, except that it generates
+NOT LIKE statements::
- $this->db->not_like('title', 'match'); // WHERE title NOT LIKE '%match%
+ $this->db->not_like('title', 'match'); // WHERE `title` NOT LIKE '%match% ESCAPE '!'
$this->db->or_not_like()
========================
-This function is identical to **not_like()**, except that multiple
+This method is identical to ``not_like()``, except that multiple
instances are joined by OR::
$this->db->like('title', 'match');
$this->db->or_not_like('body', 'match');
- // WHERE title LIKE '%match% OR body NOT LIKE '%match%'
+ // WHERE `title` LIKE '%match% OR `body` NOT LIKE '%match%' ESCAPE '!'
$this->db->group_by()
=====================
@@ -1054,4 +1055,4 @@ run the query::
$data = $this->db->get()->result_array();
// Would execute and return an array of results of the following query:
- // SELECT field1, field1 from mytable where field3 = 5;
+ // SELECT field1, field1 from mytable where field3 = 5; \ No newline at end of file
diff --git a/user_guide_src/source/general/caching.rst b/user_guide_src/source/general/caching.rst
index c40f652ac..48385d6c9 100644
--- a/user_guide_src/source/general/caching.rst
+++ b/user_guide_src/source/general/caching.rst
@@ -56,5 +56,13 @@ If you no longer wish to cache a file you can remove the caching tag and
it will no longer be refreshed when it expires.
.. note:: Removing the tag will not delete the cache immediately. It will
- have to expire normally. If you need to remove it earlier you
- will need to manually delete it from your cache directory. \ No newline at end of file
+ have to expire normally.
+
+If you need to manually delete the cache, you can use the ``delete_cache()``
+method::
+
+ // Deletes cache for the currently requested URI
+ $this->output->delete_cache();
+
+ // Deletes cache for /foo/bar
+ $this->output->delete_cache('/foo/bar'); \ No newline at end of file
diff --git a/user_guide_src/source/helpers/language_helper.rst b/user_guide_src/source/helpers/language_helper.rst
index 8b039374d..1911e3bfd 100644
--- a/user_guide_src/source/helpers/language_helper.rst
+++ b/user_guide_src/source/helpers/language_helper.rst
@@ -19,18 +19,18 @@ The following functions are available:
lang()
======
-.. php:function:: lang($line, $id = '')
+.. php:function:: lang($line, $for = '', $attributes = array())
:param string $line: Language line key
- :param string $id: ID of the element we're creating a label for
+ :param string $for: HTML "for" attribute (ID of the element we're creating a label for)
+ :param array $attributes: Any additional HTML attributes
:returns: 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()``.
-The optional second parameter will also output a form label for you.
Example::
- echo lang('language_key', 'form_item_id');
- // becomes <label for="form_item_id">language_key</label> \ No newline at end of file
+ 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/installation/upgrade_300.rst b/user_guide_src/source/installation/upgrade_300.rst
index 0af21b11e..ef5fbdf71 100644
--- a/user_guide_src/source/installation/upgrade_300.rst
+++ b/user_guide_src/source/installation/upgrade_300.rst
@@ -42,9 +42,13 @@ or extensions to work, you need to move them to **application/core/**::
application/libraries/Log.php -> application/core/Log.php
application/libraries/MY_Log.php -> application/core/MY_log.php
-**************************************************************
-Step 5: Add new session driver items to your config/config.php
-**************************************************************
+*********************************************************
+Step 5: Convert your Session usage from library to driver
+*********************************************************
+
+When you load (or autoload) the Session library, you must now load it as a driver instead of a library. This means
+calling ``$this->load->driver('session')`` instead of ``$this->load->library('session')`` and/or listing 'session'
+in ``$autoload['drivers']`` instead of ``$autoload['libraries']``.
With the change from a single Session Library to the new Session Driver, two new config items have been added:
@@ -58,6 +62,10 @@ As the new Session Driver library loads the classic Cookie driver by default and
available as valid drivers, neither of these configuration items are required. However, it is recommended that you
add them for clarity and ease of configuration in the future.
+If you have written a Session extension, you must move it into a 'Session' sub-directory of 'libraries', following the
+standard for Drivers. Also beware that some functions which are not part of the external Session API have moved into
+the drivers, so your extension may have to be broken down into separate library and driver class extensions.
+
***************************************
Step 6: Update your config/database.php
***************************************
@@ -314,4 +322,4 @@ You should now put AFTER clause field names in the field definition array instea
sooner rather than later.
.. note:: This is for MySQL and CUBRID databases only! Other drivers don't support this
- clause and will silently ignore it.
+ clause and will silently ignore it. \ No newline at end of file
diff --git a/user_guide_src/source/libraries/email.rst b/user_guide_src/source/libraries/email.rst
index da3bf2616..8643444f8 100644
--- a/user_guide_src/source/libraries/email.rst
+++ b/user_guide_src/source/libraries/email.rst
@@ -268,11 +268,21 @@ parameter as mime-type::
$this->email->attach($buffer, 'attachment', 'report.pdf', 'application/pdf');
$this->email->print_debugger()
--------------------------------
+------------------------------
Returns a string containing any server messages, the email headers, and
the email messsage. Useful for debugging.
+You can optionally specify which parts of the message should be printed.
+Valid options are: **headers**, **subject**, **body**.
+
+Example::
+
+ // Will only print the email headers, excluding the message subject and body
+ $this->email->print_debugger(array('headers'));
+
+.. note:: By default, all of the raw data will be printed.
+
Overriding Word Wrapping
========================
diff --git a/user_guide_src/source/libraries/form_validation.rst b/user_guide_src/source/libraries/form_validation.rst
index b1f466f4c..7478ca0ef 100644
--- a/user_guide_src/source/libraries/form_validation.rst
+++ b/user_guide_src/source/libraries/form_validation.rst
@@ -894,6 +894,7 @@ Rule Parameter Description
0, 1, 2, 3, etc.
**is_natural_no_zero** No Returns FALSE if the form element contains anything other than a natural
number, but not zero: 1, 2, 3, etc.
+**valid_url** No Returns FALSE if the form element does not contain a valid URL.
**valid_email** No Returns FALSE if the form element does not contain a valid email address.
**valid_emails** No Returns FALSE if any value provided in a comma separated list is not a valid email.
**valid_ip** No Returns FALSE if the supplied IP is not valid.
diff --git a/user_guide_src/source/libraries/language.rst b/user_guide_src/source/libraries/language.rst
index 772f70d0b..d288cd65e 100644
--- a/user_guide_src/source/libraries/language.rst
+++ b/user_guide_src/source/libraries/language.rst
@@ -10,12 +10,11 @@ containing sets of language files. You can create your own language
files as needed in order to display error and other messages in other
languages.
-Language files are typically stored in your system/language directory.
-Alternately you can create a folder called language inside your
-application folder and store them there. CodeIgniter will look first in
-your application/language directory. If the directory does not exist or
-the specified language is not located there CI will instead look in your
-global system/language folder.
+Language files are typically stored in your **system/language/** directory.
+Alternately you can create a directory called language inside your
+application folder and store them there. CodeIgniter will always load the
+one in **system/language/** first and will then look for an override in
+your **application/language/** directory.
.. note:: Each language should be stored in its own folder. For example,
the English files are located at: system/language/english
@@ -23,14 +22,14 @@ global system/language folder.
Creating Language Files
=======================
-Language files must be named with _lang.php as the file extension. For
+Language files must be named with **_lang.php** as the file extension. For
example, let's say you want to create a file containing error messages.
You might name it: error_lang.php
Within the file you will assign each line of text to an array called
-$lang with this prototype::
+``$lang`` with this prototype::
- $lang['language_key'] = "The actual message to be shown";
+ $lang['language_key'] = 'The actual message to be shown';
.. note:: It's a good practice to use a common prefix for all messages
in a given file to avoid collisions with similarly named items in other
@@ -39,9 +38,9 @@ $lang with this prototype::
::
- $lang['error_email_missing'] = "You must submit an email address";
- $lang['error_url_missing'] = "You must submit a URL";
- $lang['error_username_missing'] = "You must submit a username";
+ $lang['error_email_missing'] = 'You must submit an email address';
+ $lang['error_url_missing'] = 'You must submit a URL';
+ $lang['error_username_missing'] = 'You must submit a username';
Loading A Language File
=======================
@@ -54,7 +53,7 @@ first. Loading a language file is done with the following code::
Where filename is the name of the file you wish to load (without the
file extension), and language is the language set containing it (ie,
english). If the second parameter is missing, the default language set
-in your *application/config/config.php* file will be used.
+in your **application/config/config.php** file will be used.
.. note:: The *language* parameter can only consist of letters.
@@ -80,17 +79,14 @@ Using language lines as form labels
-----------------------------------
This feature has been deprecated from the language library and moved to
-the lang() function of the :doc:`Language
-helper <../helpers/language_helper>`.
+the :php:func:`lang()` function of the :doc:`Language Helper
+<../helpers/language_helper>`.
Auto-loading Languages
======================
If you find that you need a particular language globally throughout your
-application, you can tell CodeIgniter to
-:doc:`auto-load <../general/autoloader>` it during system
-initialization. This is done by opening the
-application/config/autoload.php file and adding the language(s) to the
-autoload array.
-
-
+application, you can tell CodeIgniter to :doc:`auto-load
+<../general/autoloader>` it during system initialization. This is done
+by opening the **application/config/autoload.php** file and adding the
+language(s) to the autoload array. \ No newline at end of file
diff --git a/user_guide_src/source/libraries/output.rst b/user_guide_src/source/libraries/output.rst
index 82b1a56a5..a3d67b847 100644
--- a/user_guide_src/source/libraries/output.rst
+++ b/user_guide_src/source/libraries/output.rst
@@ -53,17 +53,37 @@ You can also set the character set of the document, by passing a second argument
$this->output->set_content_type('css', 'utf-8');
-$this->output->get_content_type();
-==========================================
+$this->output->get_content_type()
+=================================
-Returns the Content-Type HTTP header that's currently in use.
+Returns the Content-Type HTTP header that's currently in use,
+excluding the character set value.
$mime = $this->output->get_content_type();
.. note:: If not set, the default return value is 'text/html'.
-$this->output->get_output();
-=============================
+$this->output->get_header()
+===========================
+
+Gets the requested HTTP header value, if set.
+
+If the header is not set, NULL will be returned.
+If an empty value is passed to the method, it will return FALSE.
+
+Example::
+
+ $this->output->set_content_type('text/plain', 'UTF-8');
+ echo $this->output->get_header('content-type');
+ // Outputs: text/plain; charset=utf-8
+
+.. note:: The header name is compared in a case-insensitive manner.
+
+.. note:: Raw headers sent via PHP's native ``header()`` function are
+ also detected.
+
+$this->output->get_output()
+===========================
Permits you to manually retrieve any output that has been sent for
storage in the output class. Usage example::
diff --git a/user_guide_src/source/libraries/sessions.rst b/user_guide_src/source/libraries/sessions.rst
index aecad3164..36c7c1d32 100644
--- a/user_guide_src/source/libraries/sessions.rst
+++ b/user_guide_src/source/libraries/sessions.rst
@@ -28,10 +28,6 @@ use the $this->load->driver function::
Once loaded, the Sessions library object will be available using:
$this->session
-.. note:: For backward compatibility, the Session class may stil be loaded
- using the $this->load->library function, but converting your applications
- to use $this->load->driver is strongly recommended.
-
How do Sessions work?
=====================
@@ -487,4 +483,3 @@ without making it the initially loaded driver, set 'sess_valid_drivers' in
your config.php file to an array including your driver name::
$config['sess_valid_drivers'] = array('sess_driver');
-