summaryrefslogtreecommitdiffstats
path: root/user_guide
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2011-03-09 11:08:36 +0100
committerPhil Sturgeon <email@philsturgeon.co.uk>2011-03-09 11:08:36 +0100
commit93ca71552d9a3e28eeaa00dd10755d20b2cbf32e (patch)
tree660233f2ec631e5730731491d2fd244fe15f7df8 /user_guide
parenta9924b8352aa18869677bea0182c45e2a7e2ce37 (diff)
parent2f8b27efeb0a39c24eddf89cf31ea0fd113a6b71 (diff)
Merged recent Core changes and fixed conflict.
Diffstat (limited to 'user_guide')
-rw-r--r--user_guide/changelog.html34
-rw-r--r--user_guide/database/active_record.html35
-rw-r--r--user_guide/database/configuration.html6
-rw-r--r--user_guide/database/forge.html2
-rw-r--r--user_guide/database/results.html23
-rw-r--r--user_guide/database/utilities.html6
-rw-r--r--user_guide/general/alternative_php.html2
-rw-r--r--user_guide/general/caching.html4
-rw-r--r--user_guide/general/views.html2
-rwxr-xr-xuser_guide/images/reactor-bullet.pngbin0 -> 781 bytes
-rw-r--r--user_guide/installation/downloads.html6
-rw-r--r--user_guide/libraries/caching.html193
-rw-r--r--user_guide/libraries/cart.html2
-rw-r--r--user_guide/libraries/config.html17
-rw-r--r--user_guide/libraries/file_uploading.html2
-rw-r--r--user_guide/libraries/form_validation.html310
-rw-r--r--user_guide/libraries/input.html40
-rw-r--r--user_guide/libraries/javascript.html7
-rw-r--r--user_guide/libraries/output.html15
-rw-r--r--user_guide/libraries/security.html9
-rw-r--r--user_guide/libraries/user_agent.html25
-rw-r--r--user_guide/toc.html20
-rw-r--r--user_guide/userguide.css3
23 files changed, 576 insertions, 187 deletions
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index b113b0c34..159f1a645 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -57,10 +57,12 @@ Change Log
<h1>Change Log</h1>
+<p>The <img src="images/reactor-bullet.png" width="16" height="16" alt="Reactor Marker" /> indicates items that were contributed to CodeIgniter via CodeIgniter Reactor.</p>
+
<h2>Version 2.0.1</h2>
-<p>Release Date: not yet released</p>
+<p>Release Date: n/a<br />
+Hg Tag: n/a</p>
-<h3>Bug Fixes for 2.0.1</h3>
<ul>
<li>General changes
<ul>
@@ -70,11 +72,23 @@ Change Log
</li>
<li>Libraries
<ul>
- <li>Fixed a bug where the table class would not clear table data after calling generate().</li>
+ <li class="reactor">Added <kbd>decimal</kbd>, <kbd>less_than</kbd> and <kbd>greater_than</kbd> rules to the <a href="libraries/form_validation.html">Form validation Class</a>.</li>
+ <li class="reactor"><a href="libraries/input.html">Input Class</a> methods <kbd>post()</kbd> and <kbd>get()</kbd> will now return a full array if the first argument is not provided.</li>
+ <li class="reactor">Secure cookies can now be made with the <kbd>set_cookie()</kbd> helper and <a href="libraries/input.html">Input Class</a> method.</li>
+ <li class="reactor">Added <kbd>set_content_type()</kbd> to <a href="libraries/output.html">Output Class</a> to set the output <kbd>Content-Type</kbd> HTTP header based on a MIME Type or a config/mimes.php array key.</li>
+ <li class="reactor"><a href="libraries/output.html">Output Class</a> will now support method chaining.</li>
</ul>
</li>
</ul>
+<h3>Bug fixes for 2.0.1</h3>
+<ul>
+ <li class="reactor">CLI requests can now be run from any folder, not just when CD'ed next to index.php.</li>
+ <li class="reactor">Fixed issue #41: Added audio/mp3 mime type to mp3.</li>
+ <li class="reactor">Fixed a bug (Core #329) where the file caching driver referenced the incorrect cache directory.</li>
+ <li class="reactor">Fixed a bug (Reactor #69) where the SHA1 library was named incorrectly.</li>
+</ul>
+
<h2>Version 2.0.0</h2>
<p>Release Date: January 28, 2011<br />
Hg Tag: v2.0.0</p>
@@ -86,18 +100,25 @@ Hg Tag: v2.0.0</p>
<li>Scaffolding, having been deprecated for a number of versions, has been removed.</li>
<li>Plugins have been removed, in favor of Helpers. The CAPTCHA plugin has been converted to a Helper and <a href="./helpers/captcha_helper.html">documented</a>. The JavaScript calendar plugin was removed due to the ready availability of great JavaScript calendars, particularly with jQuery.</li>
<li>Added new special Library type: <a href="./general/drivers.html">Drivers</a>.</li>
+ <li class="reactor">Added full query-string support. See the config file for details.</li>
<li>Moved the application folder outside of the system folder.</li>
<li>Moved system/cache and system/logs directories to the application directory.</li>
<li>Added routing overrides to the main index.php file, enabling the normal routing to be overridden on a per "index" file basis.</li>
<li>Added the ability to set config values (or override config values) directly from data set in the main index.php file. This allows a single application to be used with multiple front controllers, each having its own config values.</li>
<li>Added <kbd>$config['directory_trigger']</kbd> to the config file so that a controller sub-directory can be specified when running _GET strings instead of URI segments.</li>
<li>Added ability to set "Package" paths - specific paths where the Loader and Config classes should try to look first for a requested file. This allows distribution of sub-applications with their own libraries, models, config files, etc. in a single "package" directory. See the <a href="libraries/loader.html">Loader class</a> documentation for more details.</li>
- <li>In-development code is now hosted at <a href="http://bitbucket.org/ellislab/codeigniter/">BitBucket</a>.</li>
+ <li>In-development code is now hosted at <a href="http://bitbucket.org/ellislab/codeigniter-reactor/">BitBucket</a>.</li>
<li>Removed the deprecated Validation Class.</li>
<li>Added CI_ Prefix to all core classes.</li>
+ <li class="reactor">Package paths can now be set in application/config/autoload.php.</li>
+ <li class="reactor"><a href="libraries/file_uploading.html">Upload library</a> file_name can now be set without an extension, the extension will be taken from the uploaded file instead of the given name.</li>
+ <li class="reactor">In <a href="database/forge.html">Database Forge</a> the name can be omitted from $this->dbforge->modify_column()'s 2nd param if you aren't changing the name.</li>
+ <li class="reactor"><kbd>$config['base_url']</kbd> is now empty by default and will guess what it should be.</li>
+ <li class="reactor">Enabled full Command Line Interface compatibility with <kbd>config['uri_protocol'] = 'CLI';</kbd>.</li>
</ul>
<li>Libraries
<ul>
+ <li class="reactor">Added a <a href="libraries/caching.html">Cache driver</a> with APC, memcached, and file-based support.</li>
<li>Added <var>$prefix</var>, <var>$suffix</var> and <var>$first_url</var> properties to <a href="./libraries/pagination.html">Pagination library</a>.</li>
<li>Added the ability to suppress first, previous, next, last, and page links by setting their values to FALSE in the <a href="./libraries/pagination.html">Pagination library</a>.</li>
<li>Added <a href="./libraries/security.html">Security library</a>, which now contains the <dfn>xss_clean</dfn> function, <dfn>filename_security</dfn> function and other security related functions.</li>
@@ -128,6 +149,8 @@ Hg Tag: v2.0.0</p>
<li>Altered Form_Validation library to allow for method chaining on <kbd>set_rules()</kbd>, <kbd>set_message()</kbd> and <kbd>set_error_delimiters()</kbd> functions.</li>
<li>Altered Email Library to allow for method chaining.</li>
<li>Added <kbd>request_headers()</kbd>, <kbd>get_request_header()</kbd> and <kbd>is_ajax_request()</kbd> to the input class.</li>
+ <li class="reactor">Altered <a href="libraries/user_agent.html">User agent library</a> so that <kbd>is_browser()</kbd>, <kbd>is_mobile()</kbd> and <kbd>is_robot()</kbd> can optionally check for a specific browser or mobile device.</li>
+ <li class="reactor">Altered <a href="libraries/input.html">Input library</a> so that <kbd>post()</kbd> and <kbd>get()</kbd> will return all POST and GET items (respectively) if there are no parameters passed in.</li>
</ul>
</li>
<li>Database
@@ -189,6 +212,7 @@ Hg Tag: v2.0.0</p>
<h3>Bug fixes for 2.0.0</h3>
<ul>
+ <li class="reactor">Fixed a bug where you could not change the User-Agent when sending email.</li>
<li>Fixed a bug where the Output class would send incorrect cached output for controllers implementing their own <dfn>_output()</dfn> method.</li>
<li>Fixed a bug where a failed query would not have a saved query execution time causing errors in the Profiler</li>
<li>Fixed a bug that was writing log entries when multiple identical helpers and plugins were loaded.</li>
@@ -770,7 +794,7 @@ Hg Tag: 1.6.1</p>
</ul>
</li>
-
+
<li>Documentation Changes
<ul>
<li>Added <a href="./doc_style/index.html">Writing Documentation</a> section for the community to use in writing their own documentation.</li>
diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html
index 60e920208..f2f33e212 100644
--- a/user_guide/database/active_record.html
+++ b/user_guide/database/active_record.html
@@ -489,10 +489,10 @@ echo $this-&gt;db-&gt;count_all_results();<br />
<code>
$data = array(<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'title' => 'My title' ,<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'name' => 'My Name' ,<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'date' => 'My date'<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);<br />
+&nbsp;&nbsp;&nbsp;'title' => 'My title' ,<br />
+&nbsp;&nbsp;&nbsp;'name' => 'My Name' ,<br />
+&nbsp;&nbsp;&nbsp;'date' => 'My date'<br />
+);<br />
<br />
$this->db->insert('mytable', $data);
<br /><br />
@@ -521,6 +521,31 @@ $this->db->insert('mytable', $object);
<p class="important"><strong>Note:</strong> All values are escaped automatically producing safer queries.</p>
+<h2>$this->db->insert_batch();</h2>
+<p>Generates an insert string based on the data you supply, and runs the query. You can either pass an
+<strong>array</strong> or an <strong>object</strong> to the function. Here is an example using an array:</p>
+
+<code>
+$data = array(<br/>
+&nbsp;&nbsp;&nbsp;array(<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'title' => 'My title' ,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'name' => 'My Name' ,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'date' => 'My date'<br />
+&nbsp;&nbsp;&nbsp;),<br />
+&nbsp;&nbsp;&nbsp;array(<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'title' => 'Another title' ,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'name' => 'Another Name' ,<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'date' => 'Another date'<br />
+&nbsp;&nbsp;&nbsp;)<br/>
+);<br />
+<br />
+$this->db->insert_batch('mytable', $data);
+<br /><br />
+// Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date'), ('Another title', 'Another name', 'Another date')</code>
+
+<p>The first parameter will contain the table name, the second is an associative array of values.</p>
+
+<p class="important"><strong>Note:</strong> All values are escaped automatically producing safer queries.</p>
@@ -736,7 +761,7 @@ $this-&gt;db-&gt;get('tablename');<br />
<br />
//Generates: SELECT `field2` FROM (`tablename`)</code></p>
-<p class="important"> <strong>Note:</strong> The following statements can be cached: select, from, join, where, like, groupby, having, orderby, set</p>
+<p class="important"> <strong>Note:</strong> The following statements can be cached: select, from, join, where, like, group_by, having, order_by, set</p>
<p>&nbsp;</p>
</div>
<!-- END CONTENT -->
diff --git a/user_guide/database/configuration.html b/user_guide/database/configuration.html
index 8e6fe1f42..d71cd34db 100644
--- a/user_guide/database/configuration.html
+++ b/user_guide/database/configuration.html
@@ -61,9 +61,7 @@ Configuration
<h1>Database Configuration</h1>
<p>CodeIgniter has a config file that lets you store your database connection values (username, password, database name, etc.).
-The config file is located at:</p>
-
-<p><kbd>application/config/database.php</kbd></p>
+The config file is located at <samp>application/config/database.php</samp>. You can also set database connection values for specific <a href="../libraries/config.html">environments</a> by placing <strong>database.php</strong> it the respective environment config folder.</p>
<p>The config settings are stored in a multi-dimensional array with this prototype:</p>
@@ -136,7 +134,7 @@ for the primary connection, but it too can be renamed to something more relevant
<li><strong>char_set</strong> - The character set used in communicating with the database.</li>
<li><strong>dbcollat</strong> - The character collation used in communicating with the database.</li>
<li><strong>swap_pre</strong> - A default table prefix that should be swapped with <var>dbprefix</var>. This is useful for distributed applications where you might run manually written queries, and need the prefix to still be customizable by the end user.</li>
-<li><strong>autoinit</strong> - Whether or not to automatically initialize the database.</li>
+<li><strong>autoinit</strong> - Whether or not to automatically connect to the database when the library loads. If set to false, the connection will take place prior to executing the first query.</li>
<li><strong>stricton</strong> - TRUE/FALSE (boolean) - Whether to force "Strict Mode" connections, good for ensuring strict SQL while developing an application.</li>
<li><strong>port</strong> - The database port number. To use this value you have to add a line to the database config array.<code>$db['default']['port'] = 5432;</code>
</ul>
diff --git a/user_guide/database/forge.html b/user_guide/database/forge.html
index 8b59848ca..d18db5820 100644
--- a/user_guide/database/forge.html
+++ b/user_guide/database/forge.html
@@ -205,7 +205,7 @@ $this-&gt;dbforge-&gt;add_column('table_name', $fields);<br />
<p>Used to remove a column from a table. </p>
<p><code>$this-&gt;dbforge-&gt;drop_column('table_name', 'column_to_drop');</code></p>
<h2>$this-&gt;dbforge-&gt;modify_column()</h2>
-<p>The usage of this function is identical to add_column(), except it alters an existing column rather than adding a new one. In order to use it you must add a &quot;name&quot; key into the field defining array.</p>
+<p>The usage of this function is identical to add_column(), except it alters an existing column rather than adding a new one. In order to change the name you can add a &quot;name&quot; key into the field defining array.</p>
<p><code>$fields = array(<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'old_name' =&gt; array(<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'name' =&gt; 'new_name',<br />
diff --git a/user_guide/database/results.html b/user_guide/database/results.html
index 75cb190f9..e9a5cb4cf 100644
--- a/user_guide/database/results.html
+++ b/user_guide/database/results.html
@@ -98,6 +98,18 @@ Query Results
}
</code>
+ <p>You can also pass a string to result() which represents a class to instantiate for each result object (note: this class must be loaded)</p>
+
+ <code>
+ $query = $this->db->query("SELECT * FROM users;");<br />
+ <br />
+ foreach ($query->result('User') as $user)<br />
+ {<br />
+ &nbsp;&nbsp;&nbsp;echo $row->name; // call attributes<br />
+ &nbsp;&nbsp;&nbsp;echo $row->reverse_name(); // or methods defined on the 'User' class<br />
+ }
+ </code>
+
<h2>result_array()</h2>
<p>This function returns the query result as a pure array, or an empty array when no result is produced. Typically you'll use this in a foreach loop, like this:</p>
@@ -133,6 +145,15 @@ Query Results
<code>$row = $query->row(<dfn>5</dfn>);</code>
+ <p>You can also add a second String parameter, which is the name of a class to instantiate the row with:</p>
+
+ <code>
+ $query = $this->db->query("SELECT * FROM users LIMIT 1;");<br />
+ <br />
+ $query->row(0, 'User')<br />
+ echo $row->name; // call attributes<br />
+ echo $row->reverse_name(); // or methods defined on the 'User' class<br />
+ </code>
<h2>row_array()</h2>
@@ -235,4 +256,4 @@ Next Topic:&nbsp;&nbsp;<a href="helpers.html">Query Helper Functions</a>
</div>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/user_guide/database/utilities.html b/user_guide/database/utilities.html
index d4296fe2e..4a8b6739e 100644
--- a/user_guide/database/utilities.html
+++ b/user_guide/database/utilities.html
@@ -96,19 +96,19 @@ already be running, since the utilities class relies on it.</p>
<code>
$dbs = $this->dbutil->list_databases();<br />
<br />
-foreach($dbs as $db)<br />
+foreach ($dbs as $db)<br />
{<br />
&nbsp;&nbsp;&nbsp; echo $db;<br />
}</code>
-<h2><a name="exists"></a>$this->db->database_exists();</h2>
+<h2><a name="exists"></a>$this->dbutil->database_exists();</h2>
<p>Sometimes it's helpful to know whether a particular database exists.
Returns a boolean TRUE/FALSE. Usage example:</p>
<code>
-if ($this->db->database_exists('database_name'))<br />
+if ($this->dbutil->database_exists('database_name'))<br />
{<br />
&nbsp;&nbsp; // some code...<br />
}
diff --git a/user_guide/general/alternative_php.html b/user_guide/general/alternative_php.html
index 652cdad29..c843f2f6e 100644
--- a/user_guide/general/alternative_php.html
+++ b/user_guide/general/alternative_php.html
@@ -94,7 +94,7 @@ written in a simplified format as well. Here is an example using foreach:</p>
<code>
&lt;ul><br />
<br />
-<var>&lt;?php foreach($todo as $item): ?></var><br />
+<var>&lt;?php foreach ($todo as $item): ?></var><br />
<br />
&lt;li><var>&lt;?=$item?></var>&lt;/li><br />
<br />
diff --git a/user_guide/general/caching.html b/user_guide/general/caching.html
index 440896bb7..9f49b95d6 100644
--- a/user_guide/general/caching.html
+++ b/user_guide/general/caching.html
@@ -68,7 +68,7 @@ By caching your pages, since they are saved in their fully rendered state, you c
<h2>How Does Caching Work?</h2>
<p>Caching can be enabled on a per-page basis, and you can set the length of time that a page should remain cached before being refreshed.
-When a page is loaded for the first time, the cache file will be written to your <dfn>system/cache</dfn> folder. On subsequent page loads the cache file will be retrieved
+When a page is loaded for the first time, the cache file will be written to your <dfn>application/cache</dfn> folder. On subsequent page loads the cache file will be retrieved
and sent to the requesting user's browser. If it has expired, it will be deleted and refreshed before being sent to the browser.</p>
<p>Note: The Benchmark tag is not cached so you can still view your page load speed when caching is enabled.</p>
@@ -86,7 +86,7 @@ most logical to you. Once the tag is in place, your pages will begin being cache
<p class="important"><strong>Warning:</strong> Because of the way CodeIgniter stores content for output, caching will only work if you are generating display for your controller with a <a href="./views.html">view</a>.</p>
<p class="important"><strong>Note:</strong> Before the cache files can be written you must set the file permissions on your
-<dfn>system/cache</dfn> folder such that it is writable.</p>
+<dfn>application/cache</dfn> folder such that it is writable.</p>
<h2>Deleting Caches</h2>
diff --git a/user_guide/general/views.html b/user_guide/general/views.html
index fd5bde6af..746f7b846 100644
--- a/user_guide/general/views.html
+++ b/user_guide/general/views.html
@@ -233,7 +233,7 @@ class Blog extends CI_Controller {
&lt;h3>My Todo List&lt;/h3>
&lt;ul>
-&lt;?php foreach($todo_list as $item):?>
+&lt;?php foreach ($todo_list as $item):?>
&lt;li>&lt;?php echo $item;?>&lt;/li>
diff --git a/user_guide/images/reactor-bullet.png b/user_guide/images/reactor-bullet.png
new file mode 100755
index 000000000..89c8129a4
--- /dev/null
+++ b/user_guide/images/reactor-bullet.png
Binary files differ
diff --git a/user_guide/installation/downloads.html b/user_guide/installation/downloads.html
index d580fde7b..ad653307a 100644
--- a/user_guide/installation/downloads.html
+++ b/user_guide/installation/downloads.html
@@ -58,7 +58,9 @@ Downloading CodeIgniter
<h1>Downloading CodeIgniter</h1>
<ul>
-<li><a href="http://codeigniter.com/download.php">CodeIgniter V 1.7.2 (Current version)</a></li>
+<li><a href="http://codeigniter.com/downloads/">CodeIgniter V 2.0.0 (Current version)</a></li>
+<li><a href="http://codeigniter.com/download_files/CodeIgniter_1.7.3.zip">CodeIgniter V 1.7.3</a></li>
+<li><a href="http://codeigniter.com/download_files/CodeIgniter_1.7.2.zip">CodeIgniter V 1.7.2</a></li>
<li><a href="http://codeigniter.com/download_files/CodeIgniter_1.7.1.zip">CodeIgniter V 1.7.1</a></li>
<li><a href="http://codeigniter.com/download_files/CodeIgniter_1.7.0.zip">CodeIgniter V 1.7.0</a></li>
<li><a href="http://codeigniter.com/download_files/CodeIgniter_1.6.3.zip">CodeIgniter V 1.6.3</a></li>
@@ -85,7 +87,7 @@ Downloading CodeIgniter
<h1 id="hg">Mercurial Server</h1>
<p><a href="http://mercurial.selenic.com">Mercurial</a> is a distributed version control system.</p>
- <p>Public Hg access is available at <a href="http://bitbucket.org/ellislab/codeigniter/">BitBucket</a>.
+ <p>Public Hg access is available at <a href="http://bitbucket.org/ellislab/codeigniter-reactor/">BitBucket</a>.
Please note that while every effort is made to keep this code base functional, we cannot guarantee the functionality of code taken
from the tip.</p>
diff --git a/user_guide/libraries/caching.html b/user_guide/libraries/caching.html
new file mode 100644
index 000000000..3d3354436
--- /dev/null
+++ b/user_guide/libraries/caching.html
@@ -0,0 +1,193 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
+<head>
+
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
+<title>Caching Driver : CodeIgniter User Guide</title>
+
+<style type='text/css' media='all'>@import url('../userguide.css');</style>
+<link rel='stylesheet' type='text/css' media='all' href='../userguide.css' />
+
+<script type="text/javascript" src="../nav/nav.js"></script>
+<script type="text/javascript" src="../nav/prototype.lite.js"></script>
+<script type="text/javascript" src="../nav/moo.fx.js"></script>
+<script type="text/javascript" src="../nav/user_guide_menu.js"></script>
+
+<meta http-equiv='expires' content='-1' />
+<meta http-equiv= 'pragma' content='no-cache' />
+<meta name='robots' content='all' />
+<meta name='author' content='ExpressionEngine Dev Team' />
+<meta name='description' content='CodeIgniter User Guide' />
+
+</head>
+<body>
+
+<!-- START NAVIGATION -->
+<div id="nav"><div id="nav_inner"><script type="text/javascript">create_menu('../');</script></div></div>
+<div id="nav2"><a name="top"></a><a href="javascript:void(0);" onclick="myHeight.toggle();"><img src="../images/nav_toggle_darker.jpg" width="154" height="43" border="0" title="Toggle Table of Contents" alt="Toggle Table of Contents" /></a></div>
+<div id="masthead">
+<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
+<tr>
+<td><h1>CodeIgniter User Guide Version 2.0.0</h1></td>
+<td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
+</tr>
+</table>
+</div>
+<!-- END NAVIGATION -->
+
+
+<!-- START BREADCRUMB -->
+<table cellpadding="0" cellspacing="0" border="0" style="width:100%">
+<tr>
+<td id="breadcrumb">
+<a href="http://codeigniter.com/">CodeIgniter Home</a> &nbsp;&#8250;&nbsp;
+<a href="../index.html">User Guide Home</a> &nbsp;&#8250;&nbsp;
+<a href="../general/drivers.html">Drivers</a> &nbsp;&#8250;&nbsp;
+Caching Driver
+</td>
+<td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="codeigniter.com/user_guide/" />Search User Guide&nbsp; <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" />&nbsp;<input type="submit" class="submit" name="sa" value="Go" /></form></td>
+</tr>
+</table>
+<!-- END BREADCRUMB -->
+
+<br clear="all" />
+
+
+<!-- START CONTENT -->
+<div id="content">
+
+<h1>Caching Driver</h1>
+
+<p>CodeIgniter features wrappers around some of the most popular forms of fast and dynamic caching. All but file-based caching require specific server requirements, and a Fatal Exception will be thrown if server requirements are not met.</p>
+
+<h2>Table of Contents</h2>
+<ul>
+ <li><a href="#example_usage" title="Example Usage">Example Usage</a></li>
+ <li><a href="#function_reference" title="Function Reference">Function Reference</a></li>
+</ul>
+
+<h3>Available Drivers</h3>
+<ul>
+ <li><a href="#apc" title="APC Cache">Alternative PHP Cache (APC) Caching</a></li>
+ <li><a href="#file" title="File Caching">File-based Caching</a></li>
+ <li><a href="#memcached" title="Memcached">Memcached Caching</a></li>
+ <li><a href="#dummy" title="Dummy Caching">Dummy Cache</a></li>
+</ul>
+
+<h2 id="example_usage">Example Usage</h2>
+
+<p>The following example will load the cache driver, specify <a href="#apc" title="APC">APC</a> as the driver to use, and fall back to file-based caching if APC is not available in the hosting environment.</p>
+
+<code>
+$this->load->driver('cache', array('adapter' => 'apc', 'backup' => 'file'));<br />
+<br />
+if ( ! $foo = $this->cache->get('foo'))<br />
+{<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo 'Saving to the cache!&lt;br />';<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$foo = 'foobarbaz!';<br />
+<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Save into the cache for 5 minutes<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$this->cache->save('foo', $foo, 300);<br />
+}<br />
+<br />
+echo $foo;
+</code>
+
+<h1 id="function_reference">Function Reference</h1>
+
+<h2>is_supported(<var>driver</var>['string'])</h2>
+
+<p>This function is automatically called when accessing drivers via <samp>$this->cache->get()</samp>. However, if the individual drivers are used, make sure to call this function to ensure the driver is supported in the hosting environment.</p>
+
+<code>
+if ($this->cache->apc->is_supported())<br />
+{<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ($data = $this->cache->apc->get('my_cache'))<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// do things.<br />
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
+}
+</code>
+
+<h2>get(<var>id</var>['string'])</h2>
+
+<p>This function will attempt to fetch an item from the cache store. If the item does not exist, the function will return <samp>FALSE</samp>.</p>
+<code>$foo = $this->cache->get('my_cached_item');</code>
+
+<h2>save(<var>id</var>['string'], <var>data</var>['mixed'], <var>ttl</var>['int'])</h2>
+
+<p>This function will save an item to the cache store. If saving fails, the function will return <samp>FALSE</samp>.</p>
+<p>The optional third parameter (Time To Live) defaults to 60 seconds.</p>
+<code>$this->cache->save('cache_item_id', 'data_to_cache');</code>
+
+<h2>delete(<var>id</var>['string'])</h2>
+
+<p>This function will delete a specific item from the cache store. If item deletion fails, the function will return <samp>FALSE</samp>.</p>
+<code>$this->cache->delete('cache_item_id');</code>
+
+<h2>clean()</h2>
+
+<p>This function will 'clean' the entire cache. If the deletion of the cache files fails, the function will return <samp>FALSE</samp>.</p>
+
+<code>$this->cache->clean();</code>
+
+<h2>cache_info()</h2>
+
+<p>This function will return information on the entire cache.</p>
+
+<code>var_dump($this->cache->cache_info());</code>
+
+<h2>get_metadata(<var>id</var>['string'])</h2>
+
+<p>This function will return detailed information on a specific item in the cache.</p>
+
+<code>var_dump($this->cache->get_metadata('my_cached_item'));</code>
+
+<h1>Drivers</h1>
+
+<h2 id="apc">Alternative PHP Cache (APC) Caching</h2>
+
+<p>All of the functions listed above can be accessed without passing a specific adapter to the driver loader as follows:</p>
+<code>$this->load->driver('cache');<br />
+ $this->cache->apc->save('foo', 'bar', 10);</code>
+<p>For more information on APC, please see <a href="http://php.net/apc">http://php.net/apc</a></p>
+
+<h2 id="file">File-based Caching</h2>
+
+<p>Unlike caching from the Output Class, the driver file-based caching allows for pieces of view files to be cached. Use this with care, and make sure to benchmark your application, as a point can come where disk I/O will negate positive gains by caching.</p>
+
+<p>All of the functions listed above can be accessed without passing a specific adapter to the driver loader as follows:</p>
+<code>$this->load->driver('cache');<br />
+ $this->cache->file->save('foo', 'bar', 10);</code>
+
+<h2 id="memcached">Memcached Caching</h2>
+
+<p>Multiple Memcached servers can be specified in the memcached.php configuration file, located in the <samp>application/config/</samp> directory.
+
+<p>All of the functions listed above can be accessed without passing a specific adapter to the driver loader as follows:</p>
+<code>$this->load->driver('cache');<br />
+ $this->cache->memcached->save('foo', 'bar', 10);</code>
+
+<p>For more information on Memcached, please see <a href="http://php.net/memcached">http://php.net/memcached</a></p>
+
+<h2 id="dummy">Dummy Cache</h2>
+
+<p>This is a caching backend that will always 'miss.' It stores no data, but lets you keep your caching code in place in environments that don't support your chosen cache.</p>
+
+</div>
+<!-- END CONTENT -->
+
+
+<div id="footer">
+<p>
+Previous Topic:&nbsp;&nbsp;<a href="errors.html">Error Handling</a>
+&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+<a href="#top">Top of Page</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+<a href="../index.html">User Guide Home</a>&nbsp;&nbsp;&nbsp;&middot;&nbsp;&nbsp;
+Next Topic:&nbsp;&nbsp;<a href="profiling.html">Profiling Your Application</a>
+</p>
+<p><a href="http://codeigniter.com">CodeIgniter</a> &nbsp;&middot;&nbsp; Copyright &#169; 2006 - 2011 &nbsp;&middot;&nbsp; <a href="http://ellislab.com/">EllisLab, Inc.</a></p>
+</div>
+
+</body>
+</html> \ No newline at end of file
diff --git a/user_guide/libraries/cart.html b/user_guide/libraries/cart.html
index bc0721bb4..fe87a23f2 100644
--- a/user_guide/libraries/cart.html
+++ b/user_guide/libraries/cart.html
@@ -178,7 +178,7 @@ $this->cart->insert($data);
&lt;?php $i = 1; ?>
-&lt;?php foreach($this->cart->contents() as $items): ?>
+&lt;?php foreach ($this->cart->contents() as $items): ?>
&lt;?php echo form_hidden($i.'[rowid]', $items['rowid']); ?>
diff --git a/user_guide/libraries/config.html b/user_guide/libraries/config.html
index 6b48b2515..98b6052a9 100644
--- a/user_guide/libraries/config.html
+++ b/user_guide/libraries/config.html
@@ -150,6 +150,23 @@ $site_name = $blog_config['site_name'];</code>
<p>Where <var>item_name</var> is the $config array index you want to change, and <var>item_value</var> is its value.</p>
+<h2>Environments</h2>
+
+<p>You can set the environment of you application and load config items depending on the current environment. It also disables PHP from displaying errors in environments other than development. To set your environment, open <strong>index.php</strong>, located at the root and change the <var>ENVIRONMENT</var> constant. By default, there is support for a development, test and production environment.</p>
+
+<code>
+define('<var>ENVIRONMENT</var>', '<var>development</var>');
+</code>
+
+<p>To make a config file environment-aware, copy the file from <samp>application/config/</samp> to <samp>application/config/development/</samp>, depending on the environment the config file belongs to. You can place the following configuration files in environment folders:</p>
+
+<ul>
+<li>Default config files</li>
+<li>Database config files</li>
+<li>Custom config files</li>
+</ul>
+
+<p><strong>Note:</strong> CodeIgniter always tries to load the config file for the current environment first. If the file does not exist, the global config file (i.e. <samp>application/config/</samp>) is loaded. This means you are not obligated to place <strong>all</strong> your config files (but rather the files that change per environment) in an environment folder.</p>
<h2>Helper Functions</h2>
diff --git a/user_guide/libraries/file_uploading.html b/user_guide/libraries/file_uploading.html
index c5eab4695..5c3162819 100644
--- a/user_guide/libraries/file_uploading.html
+++ b/user_guide/libraries/file_uploading.html
@@ -125,7 +125,7 @@ In it, place this code and save it to your <samp>applications/views/</samp> fold
&lt;h3>Your file was successfully uploaded!&lt;/h3>
&lt;ul>
-&lt;?php foreach($upload_data as $item => $value):?>
+&lt;?php foreach ($upload_data as $item => $value):?>
&lt;li>&lt;?php echo $item;?>: &lt;?php echo $value;?>&lt;/li>
&lt;?php endforeach; ?>
&lt;/ul>
diff --git a/user_guide/libraries/form_validation.html b/user_guide/libraries/form_validation.html
index 935dca61f..d6120054b 100644
--- a/user_guide/libraries/form_validation.html
+++ b/user_guide/libraries/form_validation.html
@@ -924,118 +924,146 @@ POST array:</p>
<p>The following is a list of all the native rules that are available to use:</p>
-
<table cellpadding="0" cellspacing="1" border="0" style="width:100%" class="tableborder">
-<tr>
-<th>Rule</th>
-<th>Parameter</th>
-<th>Description</th>
-<th>Example</th>
-</tr><tr>
-
-<td class="td"><strong>required</strong></td>
-<td class="td">No</td>
-<td class="td">Returns FALSE if the form element is empty.</td>
-<td class="td">&nbsp;</td>
-</tr><tr>
-
-<td class="td"><strong>matches</strong></td>
-<td class="td">Yes</td>
-<td class="td">Returns FALSE if the form element does not match the one in the parameter.</td>
-<td class="td">matches[form_item]</td>
-</tr><tr>
-
-<td class="td"><strong>min_length</strong></td>
-<td class="td">Yes</td>
-<td class="td">Returns FALSE if the form element is shorter then the parameter value.</td>
-<td class="td">min_length[6]</td>
-</tr><tr>
-
-<td class="td"><strong>max_length</strong></td>
-<td class="td">Yes</td>
-<td class="td">Returns FALSE if the form element is longer then the parameter value.</td>
-<td class="td">max_length[12]</td>
-</tr><tr>
-
-<td class="td"><strong>exact_length</strong></td>
-<td class="td">Yes</td>
-<td class="td">Returns FALSE if the form element is not exactly the parameter value.</td>
-<td class="td">exact_length[8]</td>
-</tr><tr>
-
-<td class="td"><strong>alpha</strong></td>
-<td class="td">No</td>
-<td class="td">Returns FALSE if the form element contains anything other than alphabetical characters.</td>
-<td class="td">&nbsp;</td>
-</tr><tr>
-
-<td class="td"><strong>alpha_numeric</strong></td>
-<td class="td">No</td>
-<td class="td">Returns FALSE if the form element contains anything other than alpha-numeric characters.</td>
-<td class="td">&nbsp;</td>
-</tr><tr>
-
-<td class="td"><strong>alpha_dash</strong></td>
-<td class="td">No</td>
-<td class="td">Returns FALSE if the form element contains anything other than alpha-numeric characters, underscores or dashes.</td>
-<td class="td">&nbsp;</td>
-</tr>
-
-<tr>
-<td class="td"><strong>numeric</strong></td>
-<td class="td">No</td>
-<td class="td">Returns FALSE if the form element contains anything other than numeric characters.</td>
-<td class="td">&nbsp;</td>
-</tr>
-
-<tr>
-<td class="td"><strong>integer</strong></td>
-<td class="td">No</td>
-<td class="td">Returns FALSE if the form element contains anything other than an integer.</td>
-<td class="td">&nbsp;</td>
-</tr>
-
-<tr>
-<td class="td"><strong>is_natural</strong></td>
-<td class="td">No</td>
-<td class="td">Returns FALSE if the form element contains anything other than a natural number: 0, 1, 2, 3, etc.</td>
-<td class="td">&nbsp;</td>
-</tr>
-
-<tr>
-<td class="td"><strong>is_natural_no_zero</strong></td>
-<td class="td">No</td>
-<td class="td">Returns FALSE if the form element contains anything other than a natural number, but not zero: 1, 2, 3, etc.</td>
-<td class="td">&nbsp;</td>
-</tr>
-
-<tr>
-<td class="td"><strong>valid_email</strong></td>
-<td class="td">No</td>
-<td class="td">Returns FALSE if the form element does not contain a valid email address.</td>
-<td class="td">&nbsp;</td>
-</tr>
-
-<tr>
-<td class="td"><strong>valid_emails</strong></td>
-<td class="td">No</td>
-<td class="td">Returns FALSE if any value provided in a comma separated list is not a valid email.</td>
-<td class="td">&nbsp;</td>
-</tr>
-
-<tr>
-<td class="td"><strong>valid_ip</strong></td>
-<td class="td">No</td>
-<td class="td">Returns FALSE if the supplied IP is not valid.</td>
-<td class="td">&nbsp;</td>
-</tr>
-
-<tr>
-<td class="td"><strong>valid_base64</strong></td>
-<td class="td">No</td>
-<td class="td">Returns FALSE if the supplied string contains anything other than valid Base64 characters.</td>
-<td class="td">&nbsp;</td>
-</tr>
+ <tr>
+ <th>Rule</th>
+ <th>Parameter</th>
+ <th>Description</th>
+ <th>Example</th>
+ </tr>
+
+ <tr>
+ <td class="td"><strong>required</strong></td>
+ <td class="td">No</td>
+ <td class="td">Returns FALSE if the form element is empty.</td>
+ <td class="td">&nbsp;</td>
+ </tr>
+
+ <tr>
+ <td class="td"><strong>matches</strong></td>
+ <td class="td">Yes</td>
+ <td class="td">Returns FALSE if the form element does not match the one in the parameter.</td>
+ <td class="td">matches[form_item]</td>
+ </tr>
+
+ <tr>
+ <td class="td"><strong>min_length</strong></td>
+ <td class="td">Yes</td>
+ <td class="td">Returns FALSE if the form element is shorter then the parameter value.</td>
+ <td class="td">min_length[6]</td>
+ </tr>
+
+ <tr>
+ <td class="td"><strong>max_length</strong></td>
+ <td class="td">Yes</td>
+ <td class="td">Returns FALSE if the form element is longer then the parameter value.</td>
+ <td class="td">max_length[12]</td>
+ </tr>
+
+ <tr>
+ <td class="td"><strong>exact_length</strong></td>
+ <td class="td">Yes</td>
+ <td class="td">Returns FALSE if the form element is not exactly the parameter value.</td>
+ <td class="td">exact_length[8]</td>
+ </tr>
+
+ <tr>
+ <td class="td"><strong>greater_than</strong></td>
+ <td class="td">Yes</td>
+ <td class="td">Returns FALSE if the form element is less than the parameter value or not numeric.</td>
+ <td class="td">greater_than[8]</td>
+ </tr>
+
+ <tr>
+ <td class="td"><strong>less_than</strong></td>
+ <td class="td">Yes</td>
+ <td class="td">Returns FALSE if the form element is greater than the parameter value or not numeric.</td>
+ <td class="td">less_than[8]</td>
+ </tr>
+
+ <tr>
+ <td class="td"><strong>alpha</strong></td>
+ <td class="td">No</td>
+ <td class="td">Returns FALSE if the form element contains anything other than alphabetical characters.</td>
+ <td class="td">&nbsp;</td>
+ </tr>
+
+ <tr>
+ <td class="td"><strong>alpha_numeric</strong></td>
+ <td class="td">No</td>
+ <td class="td">Returns FALSE if the form element contains anything other than alpha-numeric characters.</td>
+ <td class="td">&nbsp;</td>
+ </tr>
+
+ <tr>
+ <td class="td"><strong>alpha_dash</strong></td>
+ <td class="td">No</td>
+ <td class="td">Returns FALSE if the form element contains anything other than alpha-numeric characters, underscores or dashes.</td>
+ <td class="td">&nbsp;</td>
+ </tr>
+
+ <tr>
+ <td class="td"><strong>numeric</strong></td>
+ <td class="td">No</td>
+ <td class="td">Returns FALSE if the form element contains anything other than numeric characters.</td>
+ <td class="td">&nbsp;</td>
+ </tr>
+
+ <tr>
+ <td class="td"><strong>integer</strong></td>
+ <td class="td">No</td>
+ <td class="td">Returns FALSE if the form element contains anything other than an integer.</td>
+ <td class="td">&nbsp;</td>
+ </tr>
+
+ <tr>
+ <td class="td"><strong>decimal</strong></td>
+ <td class="td">Yes</td>
+ <td class="td">Returns FALSE if the form element is not exactly the parameter value.</td>
+ <td class="td">&nbsp;</td>
+ </tr>
+
+ <tr>
+ <td class="td"><strong>is_natural</strong></td>
+ <td class="td">No</td>
+ <td class="td">Returns FALSE if the form element contains anything other than a natural number: 0, 1, 2, 3, etc.</td>
+ <td class="td">&nbsp;</td>
+ </tr>
+
+ <tr>
+ <td class="td"><strong>is_natural_no_zero</strong></td>
+ <td class="td">No</td>
+ <td class="td">Returns FALSE if the form element contains anything other than a natural number, but not zero: 1, 2, 3, etc.</td>
+ <td class="td">&nbsp;</td>
+ </tr>
+
+ <tr>
+ <td class="td"><strong>valid_email</strong></td>
+ <td class="td">No</td>
+ <td class="td">Returns FALSE if the form element does not contain a valid email address.</td>
+ <td class="td">&nbsp;</td>
+ </tr>
+
+ <tr>
+ <td class="td"><strong>valid_emails</strong></td>
+ <td class="td">No</td>
+ <td class="td">Returns FALSE if any value provided in a comma separated list is not a valid email.</td>
+ <td class="td">&nbsp;</td>
+ </tr>
+
+ <tr>
+ <td class="td"><strong>valid_ip</strong></td>
+ <td class="td">No</td>
+ <td class="td">Returns FALSE if the supplied IP is not valid.</td>
+ <td class="td">&nbsp;</td>
+ </tr>
+
+ <tr>
+ <td class="td"><strong>valid_base64</strong></td>
+ <td class="td">No</td>
+ <td class="td">Returns FALSE if the supplied string contains anything other than valid Base64 characters.</td>
+ <td class="td">&nbsp;</td>
+ </tr>
</table>
@@ -1058,36 +1086,36 @@ POST array:</p>
<table cellpadding="0" cellspacing="1" border="0" style="width:100%" class="tableborder">
-<tr>
-<th>Name</th>
-<th>Parameter</th>
-<th>Description</th>
-</tr><tr>
-
-<td class="td"><strong>xss_clean</strong></td>
-<td class="td">No</td>
-<td class="td">Runs the data through the XSS filtering function, described in the <a href="input.html">Input Class</a> page.</td>
-</tr><tr>
-
-<td class="td"><strong>prep_for_form</strong></td>
-<td class="td">No</td>
-<td class="td">Converts special characters so that HTML data can be shown in a form field without breaking it.</td>
-</tr><tr>
-
-<td class="td"><strong>prep_url</strong></td>
-<td class="td">No</td>
-<td class="td">Adds "http://" to URLs if missing.</td>
-</tr><tr>
-
-<td class="td"><strong>strip_image_tags</strong></td>
-<td class="td">No</td>
-<td class="td">Strips the HTML from image tags leaving the raw URL.</td>
-</tr><tr>
-
-<td class="td"><strong>encode_php_tags</strong></td>
-<td class="td">No</td>
-<td class="td">Converts PHP tags to entities.</td>
-</tr>
+ <tr>
+ <th>Name</th>
+ <th>Parameter</th>
+ <th>Description</th>
+ </tr><tr>
+
+ <td class="td"><strong>xss_clean</strong></td>
+ <td class="td">No</td>
+ <td class="td">Runs the data through the XSS filtering function, described in the <a href="input.html">Input Class</a> page.</td>
+ </tr><tr>
+
+ <td class="td"><strong>prep_for_form</strong></td>
+ <td class="td">No</td>
+ <td class="td">Converts special characters so that HTML data can be shown in a form field without breaking it.</td>
+ </tr><tr>
+
+ <td class="td"><strong>prep_url</strong></td>
+ <td class="td">No</td>
+ <td class="td">Adds "http://" to URLs if missing.</td>
+ </tr><tr>
+
+ <td class="td"><strong>strip_image_tags</strong></td>
+ <td class="td">No</td>
+ <td class="td">Strips the HTML from image tags leaving the raw URL.</td>
+ </tr><tr>
+
+ <td class="td"><strong>encode_php_tags</strong></td>
+ <td class="td">No</td>
+ <td class="td">Converts PHP tags to entities.</td>
+ </tr>
</table>
diff --git a/user_guide/libraries/input.html b/user_guide/libraries/input.html
index 552c49afd..2bc9b3b8c 100644
--- a/user_guide/libraries/input.html
+++ b/user_guide/libraries/input.html
@@ -132,12 +132,32 @@ else<br />
<code>$this->input->post('some_data', TRUE);</code>
+<p>To return an array of all POST items call without any parameters.</p>
+<p>To return all POST items and pass them through the XSS filter leave the first parameter blank while setting the second parameter to boolean;</p>
+<p>The function returns FALSE (boolean) if there are no items in the POST.</p>
+
+<code>
+ $this->input->post(); // returns all POST items with XSS filter
+ <br />
+ $this->input->post(NULL, FALSE); // returns all POST items without XSS
+</code>
+
<h2>$this->input->get()</h2>
<p>This function is identical to the post function, only it fetches get data:</p>
<code>$this->input->get('some_data', TRUE);</code>
+<p>To return an array of all GET items call without any parameters.</p>
+<p>To return all GET items and pass them through the XSS filter leave the first parameter blank while setting the second parameter to boolean;</p>
+<p>The function returns FALSE (boolean) if there are no items in the GET.</p>
+
+<code>
+ $this->input->get(); // returns all GET items with XSS filter
+ <br />
+ $this->input->get(NULL, FALSE); // returns all GET items without XSS filtering
+</code>
+
<h2>$this->input->get_post()</h2>
<p>This function will search through both the post and get streams for data, looking first in post, and then in get:</p>
@@ -167,13 +187,14 @@ Array Method, and Discrete Parameters:</p>
<p>Using this method, an associative array is passed to the first parameter:</p>
<code>$cookie = array(<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'name'&nbsp;&nbsp;&nbsp;=> 'The Cookie Name',<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'value'&nbsp;&nbsp;=> 'The Value',<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'expire' => '86500',<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'domain' => '.some-domain.com',<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'path'&nbsp;&nbsp;&nbsp;=> '/',<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'prefix' => 'myprefix_',<br />
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);<br />
+&nbsp;&nbsp;&nbsp;&nbsp;'name'&nbsp;&nbsp;&nbsp;=> 'The Cookie Name',<br />
+&nbsp;&nbsp;&nbsp;&nbsp;'value'&nbsp;&nbsp;=> 'The Value',<br />
+&nbsp;&nbsp;&nbsp;&nbsp;'expire' => '86500',<br />
+&nbsp;&nbsp;&nbsp;&nbsp;'domain' => '.some-domain.com',<br />
+&nbsp;&nbsp;&nbsp;&nbsp;'path'&nbsp;&nbsp;&nbsp;=> '/',<br />
+&nbsp;&nbsp;&nbsp;&nbsp;'prefix' => 'myprefix_',<br />
+&nbsp;&nbsp;&nbsp;&nbsp;'secure' => TRUE<br />
+);<br />
<br />
$this->input->set_cookie($cookie);
</code>
@@ -188,12 +209,13 @@ zero the cookie will only last as long as the browser is open.</p>
<p>For site-wide cookies regardless of how your site is requested, add your URL to the <strong>domain</strong> starting with a period, like this: .your-domain.com</p>
<p>The path is usually not needed since the function sets a root path.</p>
<p>The prefix is only needed if you need to avoid name collisions with other identically named cookies for your server.</p>
+<p>The secure boolean is only needed if you want to make it a secure cookie by setting it to TRUE.</p>
<h4>Discrete Parameters</h4>
<p>If you prefer, you can set the cookie by passing data using individual parameters:</p>
-<code>$this->input->set_cookie($name, $value, $expire, $domain, $path, $prefix);</code>
+<code>$this->input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure);</code>
<h2>$this->input->get_cookie()</h2>
@@ -231,7 +253,7 @@ else<br />
<h2>$this->input->user_agent()</h2>
<p>Returns the user agent (web browser) being used by the current user. Returns FALSE if it's not available.</p>
<code>echo $this->input->user_agent();</code>
-
+<p>See the <a href="user_agent.html">User Agent Class</a> for methods which extract information from the user agent string.</p>
<h2>$this->input->request_headers()</h2>
<p>Useful if running in a non-Apache environment where <a href="http://php.net/apache_request_headers">apache_request_headers()</a> will not be supported. Returns an array of headers.</p>
diff --git a/user_guide/libraries/javascript.html b/user_guide/libraries/javascript.html
index 55ad18907..4cd751f09 100644
--- a/user_guide/libraries/javascript.html
+++ b/user_guide/libraries/javascript.html
@@ -42,7 +42,8 @@
<td id="breadcrumb">
<a href="http://codeigniter.com/">CodeIgniter Home</a> &nbsp;&#8250;&nbsp;
<a href="../index.html">User Guide Home</a> &nbsp;&#8250;&nbsp;
-Input Class
+<a href="../general/drivers.html">Drivers</a> &nbsp;&#8250;&nbsp;
+JavaScript Driver
</td>
<td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="codeigniter.com/user_guide/" />Search User Guide&nbsp; <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" />&nbsp;<input type="submit" class="submit" name="sa" value="Go" /></form></td>
</tr>
@@ -82,7 +83,7 @@ Input Class
<h3>Set the path to the librarys with config items</h3>
<p>There are some configuration items in Javascript library. These can either be set in application/config.php, within its own config/javascript.php file, or within any controller usings the set_item() function. </p>
<p>An image to be used as an &quot;ajax loader&quot;, or progress indicator. Without one, the simple text message of &quot;loading&quot; will appear when Ajax calls need to be made.</p>
-<p><code>$config['javascript_location'] = 'http://localhost/codeigniter/themes/js/jquery/');<br />
+<p><code>$config['javascript_location'] = 'http://localhost/codeigniter/themes/js/jquery/';<br />
$config['javascript_ajax_img'] = 'images/ajax-loader.gif';</code></p>
<p>If you keep your files in the same directories they were downloaded from, then you need not set this configuration items.</p>
@@ -243,4 +244,4 @@ Next Topic:&nbsp;&nbsp;<a href="language.html">Language Class</a></p>
</div>
</body>
-</html> \ No newline at end of file
+</html>
diff --git a/user_guide/libraries/output.html b/user_guide/libraries/output.html
index ab8f1d683..25ec521b1 100644
--- a/user_guide/libraries/output.html
+++ b/user_guide/libraries/output.html
@@ -78,6 +78,21 @@ It is possible, however, for you to manually intervene with the output if you ne
For example, if you build a page in one of your controller functions, don't set the output until the end.</p>
+<h2>$this->output->set_content_type();</h2>
+
+<p>Permits you to set the mime-type of your page so you can serve JSON data, JPEG's, XML, etc easily.</p>
+
+<code>$this->output<br/>
+&nbsp;&nbsp;&nbsp;&nbsp;->set_content_type('application/json')<br/>
+&nbsp;&nbsp;&nbsp;&nbsp;->set_output(json_encode(array('foo' => 'bar')));<br/>
+<br/>
+$this->output<br/>
+&nbsp;&nbsp;&nbsp;&nbsp;->set_content_type('jpeg') // You could also use ".jpeg" which will have the full stop removed before looking in config/mimes.php<br/>
+&nbsp;&nbsp;&nbsp;&nbsp;->set_output(file_get_contents('files/something.jpg'));</code>
+
+<p><strong>Important:</strong> Make sure any non-mime string you pass to this method exists in config/mimes.php or it will have no effect.</p>
+
+
<h2>$this->output->get_output();</h2>
<p>Permits you to manually retrieve any output that has been sent for storage in the output class. Usage example:</p>
diff --git a/user_guide/libraries/security.html b/user_guide/libraries/security.html
index 5cd274787..943f72a0f 100644
--- a/user_guide/libraries/security.html
+++ b/user_guide/libraries/security.html
@@ -104,11 +104,18 @@ Note: This function should only be used to deal with data upon submission. It's
<p>If it is acceptable for the user input to include relative paths, e.g. <kbd>file/in/some/approved/folder.txt</kbd>, you can set the second optional parameter,
<samp>$relative_path</samp> to TRUE.</p>
-
+
<code>$filename = $this->security->sanitize_filename($this->input->post('filename'), TRUE);</code>
<!-- @todo write docs for CSRF methods -->
+<h2>Cross-site request forgery (CSRF)</h2>
+
+<p>You can enable csrf protection by opening your <kbd>application/config/config.php</kbd> file and setting this:</p>
+<code>$config['csrf_protection'] = TRUE;</code>
+
+<p>If you use the <a href="../helpers/form_helper.html">form helper</a> the <var>form_open()</var> function will automatically insert a hidden csrf field in your forms.</p>
+
</div>
<!-- END CONTENT -->
diff --git a/user_guide/libraries/user_agent.html b/user_guide/libraries/user_agent.html
index a9ef93768..8989fb2e1 100644
--- a/user_guide/libraries/user_agent.html
+++ b/user_guide/libraries/user_agent.html
@@ -111,9 +111,34 @@ echo $this->agent->platform(); // Platform info (Windows, Linux, Mac, etc.)
<h2>$this->agent->is_browser()</h2>
<p>Returns TRUE/FALSE (boolean) if the user agent is a known web browser.</p>
+<code> if ($this->agent->is_browser('Safari'))<br />
+{<br />
+&nbsp;&nbsp;&nbsp;&nbsp;echo 'You are using Safari.';<br />
+}<br />
+else if ($this->agent->is_browser())<br />
+{<br />
+&nbsp;&nbsp;&nbsp;&nbsp;echo 'You are using a browser.';<br />
+}</code>
+
+<p class="important"><strong>Note:</strong>&nbsp; The string "Safari" in this example is an array key in the list of browser definitions.
+You can find this list in <dfn>application/config/user_agents.php</dfn> if you want to add new browsers or change the stings.</p>
+
<h2>$this->agent->is_mobile()</h2>
<p>Returns TRUE/FALSE (boolean) if the user agent is a known mobile device.</p>
+<code> if ($this->agent->is_mobile('iphone'))<br />
+{<br />
+&nbsp;&nbsp;&nbsp;&nbsp;$this->load->view('iphone/home');<br />
+}<br />
+else if ($this->agent->is_mobile())<br />
+{<br />
+&nbsp;&nbsp;&nbsp;&nbsp;$this->load->view('mobile/home');<br />
+}<br/>
+else<br />
+{<br />
+&nbsp;&nbsp;&nbsp;&nbsp;$this->load->view('web/home');<br />
+}</code>
+
<h2>$this->agent->is_robot()</h2>
<p>Returns TRUE/FALSE (boolean) if the user agent is a known robot.</p>
diff --git a/user_guide/toc.html b/user_guide/toc.html
index 5eb9c2acc..9f51b1e91 100644
--- a/user_guide/toc.html
+++ b/user_guide/toc.html
@@ -118,6 +118,13 @@ Table of Contents
<li><a href="./doc_style/index.html">Writing Documentation</a></li>
</ul>
+<h3>Additional Resources</h3>
+
+<ul>
+<li><a href="http://codeigniter.com/forums/">Community Forums</a></li>
+<li><a href="http://codeigniter.com/wiki/">Community Wiki</a></li>
+</ul>
+
</td>
<td valign="top" width="25%">
@@ -127,7 +134,6 @@ Table of Contents
<li><a href="./libraries/calendar.html">Calendar Class</a></li>
<li><a href="./libraries/cart.html">Cart Class</a></li>
<li><a href="./libraries/config.html">Config Class</a></li>
-<li><a href="./database/index.html">Database Class</a></li>
<li><a href="./libraries/email.html">Email Class</a></li>
<li><a href="./libraries/encryption.html">Encryption Class</a></li>
<li><a href="./libraries/file_uploading.html">File Uploading Class</a></li>
@@ -157,6 +163,13 @@ Table of Contents
</td>
<td valign="top" width="25%">
+<h3>Driver Reference</h3>
+<ul>
+<li><a href="./libraries/caching.html">Caching Class</a></li>
+<li><a href="./database/index.html">Database Class</a></li>
+<li><a href="./libraries/javascript.html">Javascript Class</a></li>
+</ul>
+
<h3>Helper Reference</h3>
<ul>
<li><a href="./helpers/array_helper.html">Array Helper</a></li>
@@ -182,12 +195,7 @@ Table of Contents
<li><a href="./helpers/xml_helper.html">XML Helper</a></li>
</ul>
-<h3>Additional Resources</h3>
-<ul>
-<li><a href="http://codeigniter.com/forums/">Community Forums</a></li>
-<li><a href="http://codeigniter.com/wiki/">Community Wiki</a></li>
-</ul>
</td>
diff --git a/user_guide/userguide.css b/user_guide/userguide.css
index 57c2b05e1..f93ff0d75 100644
--- a/user_guide/userguide.css
+++ b/user_guide/userguide.css
@@ -259,6 +259,9 @@ padding: 3px 0 7px 3px;
margin: 10px 0 12px 0;
}
+li.reactor {
+ list-style-image: url(images/reactor-bullet.png);
+}
#content li {
margin-bottom: 9px;
}