diff options
author | Pascal Kriete <pascal.kriete@ellislab.com> | 2010-11-04 22:59:52 +0100 |
---|---|---|
committer | Pascal Kriete <pascal.kriete@ellislab.com> | 2010-11-04 22:59:52 +0100 |
commit | e917f9be8b05c81357c1c2c9730d5060685d644d (patch) | |
tree | b6a7d5ce8ba57b69ba61454f77829b04f2ce5974 /user_guide | |
parent | 5b2d2da5ae2e97043c6bef53e565d30e50196e2b (diff) | |
parent | e1f6e9ddff788f6a154f5f35dc117d14aeb0c484 (diff) |
Automated merge with http://hg.ellislab.com/CodeIgniter2
Diffstat (limited to 'user_guide')
61 files changed, 347 insertions, 275 deletions
diff --git a/user_guide/changelog.html b/user_guide/changelog.html index fb533b082..5bfbee702 100644 --- a/user_guide/changelog.html +++ b/user_guide/changelog.html @@ -95,7 +95,7 @@ Hg Tag: </p> <li>The <a href="libraries/unit_testing.html">Unit Test Class</a> now has an optional "notes" field available to it, and allows for discrete display of test result items using <kbd>$this->unit->set_test_items()</kbd>.</li> <li>Added a <kbd>$xss_clean</kbd> class variable to the XMLRPC library, enabling control over the use of the Security library's <kbd>xss_clean()</kbd> method.</li> <li>Added a <kbd>download()</kbd> method to the <a href="libraries/ftp.html">FTP library</a></li> - <li>Changed <kbd>do_xss_clean()</kbd> to return FALSE if the uploaded file fails XSS checks.</li> + <li>Changed <kbd>do_xss_clean()</kbd> to return FALSE if the uploaded file fails XSS checks.</li> <li>Added stripslashes() and trim()ing of double quotes from $_FILES type value to standardize input in Upload library.</li> <li>Added a second parameter (boolean) to <kbd>$this->zip->read_dir('/path/to/directory', FALSE)</kbd> to remove the preceding trail of empty folders when creating a Zip archive. This example would contain a zip with "directory" and all of its contents.</li> <li>Added ability in the Image Library to handle PNG transparency for resize operations when using the GD lib.</li> @@ -129,7 +129,7 @@ Hg Tag: </p> <li>Non-backwards compatible change made to <kbd>get_dir_file_info()</kbd> in the <a href="helpers/file_helper.html">File Helper</a>. No longer recurses by default so as to encourage responsible use (this function can cause server performance issues when used without caution).</li> <li>Modified the second parameter of <kbd>directory_map()</kbd> in the <a href="helpers/directory_helper.html">Directory Helper</a> to accept an integer to specify recursion depth.</li> - <li>Modified <kbd>delete_files()</kbd> in the <a href="helpers/file_helper.html">File Helper</a> to return FALSE on failure.</li> + <li>Modified <kbd>delete_files()</kbd> in the <a href="helpers/file_helper.html">File Helper</a> to return FALSE on failure.</li> <li>Added an optional second parameter to <kbd>byte_format()</kbd> in the <a href="helpers/number_helper.html">Number Helper</a> to allow for decimal precision.</li> <li>Added alpha, and sha1 string types to <kbd>random_string()</kbd> in the <a href="helpers/string_helper.html">String Helper</a>.</li> <li>Modified <kbd>prep_url()</kbd> so as to not prepend http:// if the supplied string already has a scheme.</li> @@ -139,6 +139,7 @@ Hg Tag: </p> <li>If CSRF is enabled in the application config file, <kbd>form_open()</kbd> will automatically insert it as a hidden field.</li> <li>Added <kbd>sanitize_filename()</kbd> into the <a href="./helpers/security_helper.html">Security helper</a>.</li> <li>Added <kbd>ellipsize()</kbd> to the <a href="./helpers/text_helper.html">Text Helper</a></li> + <li>Added <kbd>elements()</kbd> to the <a href="./helpers/array_helper.html">Array Helper</a></li> </ul> </li> <li>Other Changes @@ -162,6 +163,7 @@ Hg Tag: </p> <h3>Bug fixes for 2.0.0</h3> <ul> + <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> <li>Fixed assorted user guide typos or examples (#10693, #8951, #7825, #8660, #7883, #6771, #10656).</li> @@ -186,6 +188,7 @@ Hg Tag: </p> <li>Fixed a bug in the Email library where CC and BCC recipients were not reset when using the clear() method (#109).</li> <li>Fixed a bug in the URL Helper where prep_url() could cause a PHP error on PHP versions < 5.1.2.</li> <li>Added a log message in core/output if the cache directory config value was not found.</li> + <li>Fixed a bug where multiple libraries could not be loaded by passing an array to load->library()</li> </ul> <h2>Version 1.7.2</h2> @@ -226,7 +229,7 @@ Hg Tag: v1.7.2</p> <li>Modified <a href="general/errors.html">show_error()</a> to allow sending of HTTP server response codes.</li> <li>Modified <a href="general/errors.html">show_404()</a> to send 404 status code, removing non-CGI compatible header() statement from error_404.php template.</li> <li>Added set_status_header() to the <a href="general/common_functions.html">Common functions<a> to allow use when the Output class is unavailable.</li> - <li>Added is_php() to <a href="general/common_functions.html">Common functions</a> to facilitate PHP version comparisons.</p> + <li>Added is_php() to <a href="general/common_functions.html">Common functions</a> to facilitate PHP version comparisons.</p> <li>Added 2 CodeIgniter "cheatsheets" (thanks to DesignFellow.com for this contribution).</li> </ul> </li> @@ -251,7 +254,7 @@ Hg Tag: v1.7.2</p> <li>Fixed a bug in form_textarea() where form data was not prepped correctly.</li> <li>Fixed a bug in form_prep() causing it to not preserve entities in the user's original input when called back into a form element</li> <li>Fixed a bug in _protect_identifiers() where the swap prefix ($swap_pre) was not being observed.</li> - <li>Fixed a bug where the 400 status header sent with the 'disallowed URI characters' was not compatible with CGI environments.</li> + <li>Fixed a bug where the 400 status header sent with the 'disallowed URI characters' was not compatible with CGI environments.</li> <li>Fixed a bug in the typography class where heading tags could have paragraph tags inserted when using auto_typography().</li> </ul> @@ -362,7 +365,7 @@ Hg Tag: 1.7.0</p> </li> <li>Database <ul> - <li>Improved Active Record class to allow full path column and table names: hostname.database.table.column. Also improved the alias handling.</li> + <li>Improved Active Record class to allow full path column and table names: hostname.database.table.column. Also improved the alias handling.</li> <li>Improved how table and column names are escaped and prefixed. It now honors full path names when adding prefixes and escaping.</li> <li>Added Active Record caching feature to "update" and "delete" functions.</li> <li>Added removal of non-printing control characters in <kbd>escape_str()</kbd> of DB drivers that do not have native PHP escaping mechanisms (mssql, oci8, odbc), to avoid potential SQL errors, and possible sources of SQL injection.</li> @@ -552,7 +555,7 @@ Hg Tag: 1.6.2</p> <ul> <li>Added ability for <a href="libraries/input.html">xss_clean()</a> to accept arrays.</li> <li>Removed closing PHP tags from all PHP files to avoid accidental output and potential 'cannot modify headers' errors.</li> - <li>Removed "scripts" from the auto-load search path. Scripts were deprecated + <li>Removed "scripts" from the auto-load search path. Scripts were deprecated in Version 1.4.1 (September 21, 2006). If you still need to use them for legacy reasons, they must now be manually loaded in each Controller.</li> <li>Added a <a href="general/reserved_names.html">Reserved Names</a> page to the userguide, and migrated reserved controller names into it.</li> <li>Added a <a href="general/common_functions.html">Common Functions</a> page to the userguide for globally available functions.</li> @@ -598,7 +601,7 @@ Hg Tag: 1.6.2</p> <p>Release Date: February 12, 2008<br /> Hg Tag: 1.6.1</p> <ul> - <li>Active Record + <li>Active Record <ul> <li>Added <a href="./database/active_record.html#caching">Active Record Caching</a>.</li> <li>Made Active Record fully database-prefix aware.</li> @@ -673,7 +676,7 @@ Hg Tag: 1.6.1</p> <li>Changed the behaviour of variables submitted to the where() clause with no values to auto set "IS NULL"</li> </ul> </li> - + <li>Other Database Related <ul> <li>MySQL driver now requires MySQL 4.1+</li> @@ -689,19 +692,19 @@ Hg Tag: 1.6.1</p> in harmony with the global nature of the behavior (#1834).</li> </ul> </li> - + <li>Core changes <ul> <li>Added ability to load multiple views, whose content will be appended to the output in the order loaded.</li> <li>Added the ability to <a href="./general/autoloader.html">auto-load</a> <a href="./general/models.html">Models</a>.</li> <li>Reorganized the URI and Routes classes for better clarity.</li> - <li>Added Compat.php to allow function overrides for older versions of PHP or PHP environments missing certain extensions / libraries</li> + <li>Added Compat.php to allow function overrides for older versions of PHP or PHP environments missing certain extensions / libraries</li> <li>Added memory usage, GET, URI string data, and individual query execution time to Profiler output.</li> <li>Deprecated Scaffolding.</li> <li>Added is_really_writable() to Common.php to provide a cross-platform reliable method of testing file/folder writability.</li> </ul> </li> - + <li>Libraries <ul> <li>Changed the load protocol of Models to allow for extension.</li> @@ -721,7 +724,7 @@ Hg Tag: 1.6.1</p> <li>Enabled the 'system' methods for the XML-RPC Server library, except for 'system.multicall' which is still disabled.</li> </ul> </li> - + <li>Helpers & Plugins <ul> <li>Added link_tag() to the <a href="./helpers/html_helper.html">HTML helper.</a></li> @@ -737,8 +740,8 @@ Hg Tag: 1.6.1</p> <li>Javascript Calendar plugin now uses the months and days from the calendar language file, instead of hard-coded values, internationalizing it.</li> </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> @@ -755,7 +758,7 @@ Hg Tag: 1.6.1</p> </ul> <h3>Bug fixes for Version 1.6.0</h3> - + <ul> <li>Fixed a bug (#1813) preventing using $CI->db in the same application with returned database objects.</li> <li>Fixed a bug (#1842) where the $this->uri->rsegments array would not include the 'index' method if routed to the controller without an implicit method.</li> diff --git a/user_guide/database/active_record.html b/user_guide/database/active_record.html index 482115ccd..065db4913 100644 --- a/user_guide/database/active_record.html +++ b/user_guide/database/active_record.html @@ -220,20 +220,20 @@ $this->db->join('comments', 'comments.id = blogs.id', <strong>'left'</strong>);< <code>$this->db->where('name', $name); <br /><br />// Produces: WHERE name = 'Joe' </code> - + <p>Notice that the equal sign is added for you.</p> - + <p>If you use multiple function calls they will be chained together with <var>AND</var> between them:</p> - + <code>$this->db->where('name', $name);<br /> $this->db->where('title', $title);<br /> $this->db->where('status', $status); <br /><br />// WHERE name = 'Joe' AND title = 'boss' AND status = 'active' </code> </li> - + <li><strong>Custom key/value method:</strong> - + <p>You can include an operator in the first parameter in order to control the comparison:</p> - + <code>$this->db->where('name !=', $name);<br /> $this->db->where('id <', $id); <br /><br />// Produces: WHERE name != 'Joe' AND id < 45 </code> </li> @@ -242,7 +242,7 @@ $this->db->join('comments', 'comments.id = blogs.id', <strong>'left'</strong>);< <code> $array = array('name' => $name, 'title' => $title, 'status' => $status);<br /><br /> - + $this->db->where($array); <br /><br />// Produces: WHERE name = 'Joe' AND title = 'boss' AND status = 'active' </code> @@ -250,10 +250,10 @@ $this->db->join('comments', 'comments.id = blogs.id', <strong>'left'</strong>);< <code> $array = array('name !=' => $name, 'id <' => $id, 'date >' => $date);<br /><br /> - + $this->db->where($array);</code> </li> <li><strong>Custom string:</strong> - + <p>You can write your own clauses manually:</p> <code> @@ -263,7 +263,7 @@ $this->db->join('comments', 'comments.id = blogs.id', <strong>'left'</strong>);< <p>$this->db->where() accepts an optional third parameter. If you set it to FALSE, CodeIgniter will not try to protect your field or table names with backticks.</p> -<p><code> $this->db->where('MATCH (field) AGAINST ("value")', NULL, FALSE);<br /> +<p><code> $this->db->where('MATCH (field) AGAINST ("value")', NULL, FALSE);<br /> </code></p> <h2>$this->db->or_where();</h2> <p>This function is identical to the one above, except that multiple instances are joined by OR:</p> @@ -290,7 +290,7 @@ $this->db->or_where('id >', $id); $names = array('Frank', 'Todd', 'James');<br /> $this->db->or_where_in('username', $names);<br /> // Produces: OR username IN ('Frank', 'Todd', 'James')</code></p> - + <h2>$this->db->where_not_in();</h2> <p>Generates a WHERE field NOT IN ('item', 'item') SQL query joined with AND if appropriate</p> <p><code> @@ -316,14 +316,14 @@ $this->db->or_where('id >', $id); <code>$this->db->like('title', 'match'); <br /><br />// Produces: WHERE title LIKE '%match%' </code> - + <p>If you use multiple function calls they will be chained together with <var>AND</var> between them:</p> - + <code>$this->db->like('title', 'match');<br /> $this->db->like('body', 'match'); <br /><br /> // WHERE title LIKE '%match%' AND body LIKE '%match%</code> - If you want to control where the wildcard (%) is placed, you can use an optional third argument. Your options are 'before', 'after' and 'both' (which is the default). + If you want to control where the wildcard (%) is placed, you can use an optional third argument. Your options are 'before', 'after' and 'both' (which is the default). <code>$this->db->like('title', 'match', 'before'); <br /> // Produces: WHERE title LIKE '%match' <br /> @@ -333,17 +333,17 @@ $this->db->or_where('id >', $id); <br /> $this->db->like('title', 'match', 'both'); <br /> // Produces: WHERE title LIKE '%match%' </code> </li> - + <li><strong>Associative array method:</strong> <code> $array = array('title' => $match, 'page1' => $match, 'page2' => $match);<br /><br /> - + $this->db->like($array); <br /><br />// WHERE title LIKE '%match%' AND page1 LIKE '%match%' AND page2 LIKE '%match%'</code></li> </ol> - - + + <h2>$this->db->or_like();</h2> <p>This function is identical to the one above, except that multiple instances are joined by OR:</p> @@ -355,7 +355,7 @@ $this->db->or_like('body', $match); - + <p class="important">Note: or_like() was formerly known as orlike(), which has been removed.</p> <h2>$this->db->not_like();</h2> <p>This function is identical to <strong>like()</strong>, except that it generates NOT LIKE statements:</p> @@ -370,17 +370,17 @@ $this->db->or_not_like('body', 'match'); <br /> // WHERE title LIKE '%match% OR body NOT LIKE '%match%'</code> <h2>$this->db->group_by();</h2> <p>Permits you to write the GROUP BY portion of your query:</p> - + <code>$this->db->group_by("title"); <br /><br />// Produces: GROUP BY title </code> <p>You can also pass an array of multiple values as well:</p> - + <code>$this->db->group_by(array("title", "date")); <br /> <br />// Produces: GROUP BY title, date</code> - + <p class="important">Note: group_by() was formerly known as groupby(), which has been removed. </p> <h2> $this->db->distinct();<br /> @@ -392,7 +392,7 @@ $this->db->or_not_like('body', 'match'); <br /> // Produces: SELECT DISTINCT * FROM table</code></p> <h2>$this->db->having();</h2> <p>Permits you to write the HAVING portion of your query. There are 2 possible syntaxes, 1 argument or 2:</p> - + <code>$this->db->having('user_id = 45'); <br /> // Produces: HAVING user_id = 45<br /> @@ -401,7 +401,7 @@ $this->db->having('user_id', 45); <br /> // Produces: HAVING user_id = 45<br /> <br /> </code> - + <p>You can also pass an array of multiple values as well:</p> @@ -419,14 +419,14 @@ $this->db->having('user_id', 45); <br /> <h2>$this->db->order_by();</h2> <p>Lets you set an ORDER BY clause. The first parameter contains the name of the column you would like to order by. The second parameter lets you set the direction of the result. Options are <kbd>asc</kbd> or <kbd>desc</kbd>, or <kbd>random</kbd>. </p> - + <code>$this->db->order_by("title", "desc"); <br /> <br />// Produces: ORDER BY title DESC </code> <p>You can also pass your own string in the first parameter:</p> - + <code>$this->db->order_by('title desc, name asc'); <br /> <br />// Produces: ORDER BY title DESC, name ASC @@ -479,10 +479,10 @@ echo $this->db->count_all_results();<br /> // Produces an integer, like 25</code> - + <a name="insert"> </a> <h1>Inserting Data</h1> - + <h2>$this->db->insert();</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> @@ -520,9 +520,9 @@ $this->db->insert('mytable', $object); <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> - - - + + + <h2>$this->db->set();</h2> <p>This function enables you to set values for <dfn>inserts</dfn> or <dfn>updates</dfn>.</p> @@ -576,10 +576,10 @@ $this->db->insert('mytable'); </code> - + <a name="update"> </a> <h1>Updating Data</h1> - + <h2>$this->db->update();</h2> <p>Generates an update string and runs the query based on the data you supply. You can pass an <strong>array</strong> or an <strong>object</strong> to the function. Here is an example using @@ -625,7 +625,7 @@ $this->db->update('mytable', $object); <p class="important"><strong>Note:</strong> All values are escaped automatically producing safer queries.</p> - + <p>You'll notice the use of the <dfn>$this->db->where()</dfn> function, enabling you to set the WHERE clause. You can optionally pass this information directly into the update function as a string:</p> @@ -634,15 +634,15 @@ You can optionally pass this information directly into the update function as a <p>Or as an array:</p> <code>$this->db->update('mytable', $data, array('id' => $id));</code> - + <p>You may also use the <dfn>$this->db->set()</dfn> function described above when performing updates.</p> - + <a name="delete"> </a> <h1>Deleting Data</h1> - + <h2>$this->db->delete();</h2> <p>Generates a delete SQL string and runs the query.</p> diff --git a/user_guide/database/call_function.html b/user_guide/database/call_function.html index fe09d2b14..46dfe89dc 100644 --- a/user_guide/database/call_function.html +++ b/user_guide/database/call_function.html @@ -97,7 +97,7 @@ Obviously not all function calls are identical between platforms, so there are l - + </div> <!-- END CONTENT --> diff --git a/user_guide/database/fields.html b/user_guide/database/fields.html index 30d39a42d..e5cc4777d 100644 --- a/user_guide/database/fields.html +++ b/user_guide/database/fields.html @@ -142,7 +142,7 @@ $fields = $query->field_data(); <li>primary_key - 1 if the column is a primary key</li> <li>type - the type of the column</li> </ul> - + </div> <!-- END CONTENT --> diff --git a/user_guide/database/index.html b/user_guide/database/index.html index 45d15dba4..381592c26 100644 --- a/user_guide/database/index.html +++ b/user_guide/database/index.html @@ -78,7 +78,7 @@ structures and Active Record patterns. The database functions offer clear, simpl <li><a href="forge.html">Database manipulation with Database Forge</a></li> <li><a href="utilities.html">Database Utilities Class</a></li> </ul> - + </div> <!-- END CONTENT --> diff --git a/user_guide/database/queries.html b/user_guide/database/queries.html index 7a6734c4a..c8a304943 100644 --- a/user_guide/database/queries.html +++ b/user_guide/database/queries.html @@ -132,7 +132,7 @@ $this->db->query($sql, array(3, 'live', 'Rick')); <p>The question marks in the query are automatically replaced with the values in the array in the second parameter of the query function.</p> <p class="important">The secondary benefit of using binds is that the values are automatically escaped, producing safer queries. You don't have to remember to manually escape data; the engine does it automatically for you.</p> - + </div> <!-- END CONTENT --> diff --git a/user_guide/database/results.html b/user_guide/database/results.html index 9eaa1793e..410dac840 100644 --- a/user_guide/database/results.html +++ b/user_guide/database/results.html @@ -65,11 +65,11 @@ Query Results <p>There are several ways to generate query results:</p> <h2>result()</h2> - + <p>This function returns the query result as an array of <strong>objects</strong>, or <strong>an empty array</strong> on failure. - + Typically you'll use this in a foreach loop, like this:</p> - + <code> $query = $this->db->query("YOUR QUERY");<br /> <br /> @@ -79,11 +79,11 @@ Query Results echo $row->name;<br /> echo $row->body;<br /> }</code> - + <p>The above <dfn>function</dfn> is an alias of <dfn>result_object()</dfn>.</p> <p>If you run queries that might <strong>not</strong> produce a result, you are encouraged to test the result first:</p> - + <code> $query = $this->db->query("YOUR QUERY");<br /> <br /> @@ -97,9 +97,9 @@ Query Results }<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> <code> $query = $this->db->query("YOUR QUERY");<br /> @@ -113,7 +113,7 @@ Query Results <h2>row()</h2> - + <p>This function returns a single result row. If your query has more than one row, it returns only the first row. The result is returned as an <strong>object</strong>. Here's a usage example:</p> <code> @@ -128,9 +128,9 @@ Query Results echo $row->body;<br /> } </code> - + <p>If you want a specific row returned you can submit the row number as a digit in the first parameter:</p> - + <code>$row = $query->row(<dfn>5</dfn>);</code> @@ -151,13 +151,13 @@ Query Results } </code> - + <p>If you want a specific row returned you can submit the row number as a digit in the first parameter:</p> - + <code>$row = $query->row_array(<dfn>5</dfn>);</code> - - <p>In addition, you can walk forward/backwards/first/last through your results using these variations:</p> + + <p>In addition, you can walk forward/backwards/first/last through your results using these variations:</p> <p> <strong>$row = $query->first_row()</strong><br /> @@ -217,7 +217,7 @@ $query2->free_result(); // The $query2 result object will no longer be availabl - + </div> <!-- END CONTENT --> diff --git a/user_guide/database/table_data.html b/user_guide/database/table_data.html index c85408fab..8b86ed58e 100644 --- a/user_guide/database/table_data.html +++ b/user_guide/database/table_data.html @@ -92,7 +92,7 @@ if ($this->db->table_exists('table_name'))<br /> - + </div> <!-- END CONTENT --> diff --git a/user_guide/doc_style/template.html b/user_guide/doc_style/template.html index 26831ac06..d5ef5caa4 100644 --- a/user_guide/doc_style/template.html +++ b/user_guide/doc_style/template.html @@ -54,7 +54,7 @@ Foo Class <p>Brief description of Foo Class. If it extends a native CodeIgniter class, please link to the class in the CodeIgniter documents here.</p> <p class="important"><strong>Important:</strong> This is an important note with <kbd>EMPHASIS</kbd>.</p> - + <p>Features:</p> <ul> diff --git a/user_guide/general/alternative_php.html b/user_guide/general/alternative_php.html index b9069a8be..3193c0585 100644 --- a/user_guide/general/alternative_php.html +++ b/user_guide/general/alternative_php.html @@ -58,14 +58,14 @@ Alternate PHP Syntax <h1>Alternate PHP Syntax for View Files</h1> <p>If you do not utilize CodeIgniter's <a href="../libraries/parser.html">template engine</a>, you'll be using pure PHP -in your View files. To minimize the PHP code in these files, and to make it easier to identify the code blocks it is recommended that you use +in your View files. To minimize the PHP code in these files, and to make it easier to identify the code blocks it is recommended that you use PHPs alternative syntax for control structures and short tag echo statements. If you are not familiar with this syntax, it allows you to eliminate the braces from your code, and eliminate "echo" statements.</p> <h2>Automatic Short Tag Support</h2> <p><strong>Note:</strong> If you find that the syntax described in this page does not work on your server it might -be that "short tags" are disabled in your PHP ini file. CodeIgniter will optionally rewrite short tags on-the-fly, +be that "short tags" are disabled in your PHP ini file. CodeIgniter will optionally rewrite short tags on-the-fly, allowing you to use that syntax even if your server doesn't support it. This feature can be enabled in your <dfn>config/config.php</dfn> file.</p> diff --git a/user_guide/general/controllers.html b/user_guide/general/controllers.html index 9658df876..782fbfa7e 100644 --- a/user_guide/general/controllers.html +++ b/user_guide/general/controllers.html @@ -268,7 +268,16 @@ function _output($output)<br /> <p class="important">Please note that your <dfn>_output()</dfn> function will receive the data in its finalized state. Benchmark and memory usage data will be rendered, cache files written (if you have caching enabled), and headers will be sent (if you use that <a href="../libraries/output.html">feature</a>) -before it is handed off to the _output() function. If you are using this feature the page execution timer and memory usage stats might not be perfectly accurate +before it is handed off to the _output() function.<br /> +<br /> +To have your controller's output cached properly, its <dfn>_output()</dfn> method can use:<br /> + +<code>if ($this->output->cache_expiration > 0)<br /> +{<br /> + $this->output->_write_cache($output);<br /> +}</code> + +If you are using this feature the page execution timer and memory usage stats might not be perfectly accurate since they will not take into acccount any further processing you do. For an alternate way to control output <em>before</em> any of the final processing is done, please see the available methods in the <a href="../libraries/output.html">Output Class</a>.</p> diff --git a/user_guide/general/creating_libraries.html b/user_guide/general/creating_libraries.html index 0b4d642ae..3f0e32cb0 100644 --- a/user_guide/general/creating_libraries.html +++ b/user_guide/general/creating_libraries.html @@ -200,7 +200,7 @@ etc. <kbd>This is very important.</kbd> Assigning by reference allows you to use the original CodeIgniter object rather than creating a copy of it. <br /><br /> <kbd>Also, please note:</kbd> If you are running PHP 4 it's usually best to avoid calling <dfn>get_instance()</dfn> -from within your class constructors. PHP 4 has trouble referencing the CI super object within application constructors +from within your class constructors. PHP 4 has trouble referencing the CI super object within application constructors since objects do not exist until the class is fully instantiated.</p> diff --git a/user_guide/general/credits.html b/user_guide/general/credits.html index b77528a7e..5423d5838 100644 --- a/user_guide/general/credits.html +++ b/user_guide/general/credits.html @@ -58,8 +58,8 @@ Credits <h1>Credits</h1> <p>CodeIgniter was originally developed by <a href="http://www.ellislab.com/">Rick Ellis</a> (CEO of -<a href="http://ellislab.com/">EllisLab, Inc.</a>). The framework was written for performance in the real -world, with many of the class libraries, helpers, and sub-systems borrowed from the code-base of +<a href="http://ellislab.com/">EllisLab, Inc.</a>). The framework was written for performance in the real +world, with many of the class libraries, helpers, and sub-systems borrowed from the code-base of <a href="http://www.expressionengine.com/">ExpressionEngine</a>.</p> <p>It is currently developed and maintained by the ExpressionEngine Development Team.</p> diff --git a/user_guide/general/drivers.html b/user_guide/general/drivers.html index 9c86f0216..3163c11a7 100644 --- a/user_guide/general/drivers.html +++ b/user_guide/general/drivers.html @@ -75,7 +75,7 @@ Using CodeIgniter Drivers <code>$this->some_parent->some_method();</code> <p>The child classes, the drivers themselves, can then be called directly through the parent class, without initializing them:</p> - + <code>$this->some_parent->child_one->some_method();<br /> $this->some_parent->child_two->another_method();</code> diff --git a/user_guide/general/libraries.html b/user_guide/general/libraries.html index cd83da741..4d6064fa9 100644 --- a/user_guide/general/libraries.html +++ b/user_guide/general/libraries.html @@ -69,6 +69,10 @@ In most cases, to use one of these classes involves initializing it within a <a <p>Once initialized you can use it as indicated in the user guide page corresponding to that class.</p> +<p>Additionally, multiple libraries can be loaded at the same time by passing an array of libraries to the load function.</p> + +<code>$this->load->library(array('<var>email</var>', '<var>table</var>'));</code> + <h2>Creating Your Own Libraries</h2> <p>Please read the section of the user guide that discusses how to <a href="creating_libraries.html">create your own libraries</a></p> diff --git a/user_guide/general/managing_apps.html b/user_guide/general/managing_apps.html index 04af6e6a3..a1a96cf82 100644 --- a/user_guide/general/managing_apps.html +++ b/user_guide/general/managing_apps.html @@ -70,7 +70,7 @@ file and set its name using the <samp>$application_folder</samp> variable:</p> <h2>Relocating your Application Folder</h2> -<p>It is possible to move your <dfn>application</dfn> folder to a different location on your server than your <kbd>system</kbd> folder. +<p>It is possible to move your <dfn>application</dfn> folder to a different location on your server than your <kbd>system</kbd> folder. To do so open your main <kbd>index.php</kbd> and set a <em>full server path</em> in the <samp>$application_folder</samp> variable.</p> @@ -79,7 +79,7 @@ To do so open your main <kbd>index.php</kbd> and set a <em>full server path</em> <h2>Running Multiple Applications with one CodeIgniter Installation</h2> -<p>If you would like to share a common CodeIgniter installation to manage several different applications simply +<p>If you would like to share a common CodeIgniter installation to manage several different applications simply put all of the directories located inside your <kbd>application</kbd> folder into their own sub-folder.</p> @@ -107,7 +107,7 @@ variable. For example, to select the "foo" application for use you would do thi <code>$application_folder = "applications/foo";</code> -<p class="important"><strong>Note:</strong> Each of your applications will need its own <dfn>index.php</dfn> file which +<p class="important"><strong>Note:</strong> Each of your applications will need its own <dfn>index.php</dfn> file which calls the desired application. The index.php file can be named anything you want.</p> diff --git a/user_guide/general/models.html b/user_guide/general/models.html index e405dd1b6..35ab08d20 100644 --- a/user_guide/general/models.html +++ b/user_guide/general/models.html @@ -212,7 +212,7 @@ class Blog_controller extends Controller {<br /> <li>You can tell the model loading function to auto-connect by passing <kbd>TRUE</kbd> (boolean) via the third parameter, and connectivity settings, as defined in your database config file will be used: - <code>$this->load->model('<var>Model_name</var>', '', <kbd>TRUE</kbd>);</code> + <code>$this->load->model('<var>Model_name</var>', '', <kbd>TRUE</kbd>);</code> </li> diff --git a/user_guide/general/profiling.html b/user_guide/general/profiling.html index 47c1a5abc..7cb3f158d 100644 --- a/user_guide/general/profiling.html +++ b/user_guide/general/profiling.html @@ -129,7 +129,7 @@ This information can be useful during development in order to help with debuggin <td class="td">Any GET data passed in the request</td> <td class="td">TRUE</td> </tr><tr> - + <td class="td"><strong>http_headers</strong></td> <td class="td">The HTTP headers for the current request</td> <td class="td">TRUE</td> @@ -149,7 +149,7 @@ This information can be useful during development in order to help with debuggin <td class="td">Listing of all database queries executed, including execution time</td> <td class="td">TRUE</td> </tr><tr> - + <td class="td"><strong>uri_string</strong></td> <td class="td">The URI of the current request</td> <td class="td">TRUE</td> diff --git a/user_guide/general/styleguide.html b/user_guide/general/styleguide.html index 1200a2c12..7b7d837d9 100644 --- a/user_guide/general/styleguide.html +++ b/user_guide/general/styleguide.html @@ -107,12 +107,12 @@ Style Guide a UTF-8 encoded file, and the <abbr title="Byte Order Mark">BOM</abbr> can have a negative side effect in PHP of sending output, preventing the application from being able to set its own headers. Unix line endings should be used (LF).</p> - + <p>Here is how to apply these settings in some of the more common text editors. Instructions for your text editor may vary; check your text editor's documentation.</p> - + <h5>TextMate</h5> - + <ol> <li>Open the Application Preferences</li> <li>Click Advanced, and then the "Saving" tab</li> @@ -121,9 +121,9 @@ Style Guide <li><em>Optional:</em> Check "Use for existing files as well" if you wish to modify the line endings of files you open to your new preference.</li> </ol> - + <h5>BBEdit</h5> - + <ol> <li>Open the Application Preferences</li> <li>Select "Text Encodings" on the left.</li> @@ -137,7 +137,7 @@ Style Guide <h2><a name="php_closing_tag"></a>PHP Closing Tag</h2> <div class="guidelineDetails"> - <p>The PHP closing tag on a PHP document <strong>?></strong> is optional to the PHP parser. However, if used, any whitespace following the closing tag, whether introduced + <p>The PHP closing tag on a PHP document <strong>?></strong> is optional to the PHP parser. However, if used, any whitespace following the closing tag, whether introduced by the developer, user, or an FTP application, can cause unwanted output, PHP errors, or if the latter are suppressed, blank pages. For this reason, all PHP files should <strong>OMIT</strong> the closing PHP tag, and instead use a comment block to mark the end of file and it's location relative to the application root. This allows you to still identify a file as being complete and not truncated.</p> @@ -158,7 +158,7 @@ echo "Here's my code!"; </code> </div> - + <h2><a name="class_and_method_naming"></a>Class and Method Naming</h2> <div class="guidelineDetails"> <p>Class names should always have their first letter uppercase, and the constructor method should match identically. Multiple words should be separated with an underscore, and not CamelCased. All other class methods should be entirely lowercased and named to clearly indicate their function, preferably including a verb. Try to avoid overly long and verbose names.</p> @@ -193,8 +193,8 @@ function get_the_file_properties_from_the_file() // wordy function get_file_properties() // descriptive, underscore separator, and all lowercase letters</code> </div> - - + + <h2><a name="variable_names"></a>Variable Names</h2> <div class="guidelineDetails"> <p>The guidelines for variable naming is very similar to that used for class methods. Namely, variables should contain only lowercase letters, use underscore separators, and be reasonably named to indicate their purpose and contents. Very short, non-word variables should only be used as iterators in for() loops.</p> @@ -213,8 +213,8 @@ $group_id $last_city </code> </div> - - + + <h2><a name="commenting"></a>Commenting</h2> <div class="guidelineDetails"> <p>In general, code should be commented prolifically. It not only helps describe the flow and intent of the code for less experienced programmers, but can prove invaluable when returning to your own code months down the line. There is not a required format for comments, but the following are recommended.</p> @@ -257,8 +257,8 @@ $parts = explode("\n", $str); $parts = $this->foo($parts); </code> </div> - - + + <h2><a name="constants"></a>Constants</h2> <div class="guidelineDetails"> <p>Constants follow the same guidelines as do variables, except constants should always be fully uppercase. <em>Always use CodeIgniter constants when appropriate, i.e. SLASH, LD, RD, PATH_CACHE, etc.</em></p> @@ -275,8 +275,8 @@ SUPER_CLASS_VERSION $str = str_replace(LD.'foo'.RD, 'bar', $str); </code> </div> - - + + <h2><a name="true_false_and_null"></a>TRUE, FALSE, and NULL</h2> <div class="guidelineDetails"> <p><strong>TRUE</strong>, <strong>FALSE</strong>, and <strong>NULL</strong> keywords should always be fully uppercase.</p> @@ -290,9 +290,9 @@ if ($foo == TRUE) $bar = FALSE; function foo($bar = NULL)</code> </div> - - + + <h2><a name="logical_operators"></a>Logical Operators</h2> <div class="guidelineDetails"> <p>Use of <strong>||</strong> is discouraged as its clarity on some output devices is low (looking like the number 11 for instance). @@ -310,9 +310,9 @@ if ( ! $foo) if ( ! is_array($foo)) </code> </div> - - - + + + <h2><a name="comparing_return_values_and_typecasting"></a>Comparing Return Values and Typecasting</h2> <div class="guidelineDetails"> <p>Some PHP functions return FALSE on failure, but may also have a valid return value of "" or 0, which would evaluate to FALSE in loose comparisons. Be explicit by comparing the variable type when using these return values in conditionals to ensure the return value is indeed what you expect, and not a value that has an equivalent loose-type evaluation.</p> @@ -350,27 +350,27 @@ function build_string($str = "") <code>$str = (string) $str; // cast $str as a string</code> </div> - - + + <h2><a name="debugging_code"></a>Debugging Code</h2> <div class="guidelineDetails"> <p>No debugging code can be left in place for submitted add-ons unless it is commented out, i.e. no var_dump(), print_r(), die(), and exit() calls that were used while creating the add-on, unless they are commented out.</p> <code>// print_r($foo);</code> </div> - - + + <h2><a name="whitespace_in_files"></a>Whitespace in Files</h2> <div class="guidelineDetails"> <p>No whitespace can precede the opening PHP tag or follow the closing PHP tag. Output is buffered, so whitespace in your files can cause output to begin before CodeIgniter outputs its content, leading to errors and an inability for CodeIgniter to send proper headers. In the examples below, select the text with your mouse to reveal the incorrect whitespace.</p> <p><strong>INCORRECT</strong>:</p> -<code> +<code> <?php // ...there is whitespace and a linebreak above the opening PHP tag // as well as whitespace after the closing PHP tag -?> +?> </code> <p><strong>CORRECT</strong>:</p> <code><?php @@ -378,15 +378,15 @@ function build_string($str = "") ?></code> </div> - - + + <h2><a name="compatibility"></a>Compatibility</h2> <div class="guidelineDetails"> <p>Unless specifically mentioned in your add-on's documentation, all code must be compatible with PHP version 4.3+. Additionally, do not use PHP functions that require non-default libraries to be installed unless your code contains an alternative method when the function is not available, or you implicitly document that your add-on requires said PHP libraries.</p> </div> - - + + <h2><a name="class_and_file_names_using_common_words"></a>Class and File Names using Common Words</h2> <div class="guidelineDetails"> <p>When your class or filename is a common word, or might quite likely be identically named in another PHP script, provide a unique prefix to help prevent collision. Always realize that your end users may be running other add-ons or third party PHP scripts. Choose a prefix that is unique to your identity as a developer or company.</p> @@ -402,8 +402,8 @@ class Pre_xml ext.pre_xml.php class Pre_import mod.pre_import.php </code> </div> - - + + <h2><a name="database_table_names"></a>Database Table Names</h2> <div class="guidelineDetails"> <p>Any tables that your add-on might use must use the 'exp_' prefix, followed by a prefix uniquely identifying you as the developer or company, and then a short descriptive table name. You do not need to be concerned about the database prefix being used on the user's installation, as CodeIgniter's database class will automatically convert 'exp_' to what is actually being used.</p> @@ -419,30 +419,30 @@ exp_pre_email_addresses <p class="important"><strong>NOTE:</strong> Be mindful that MySQL has a limit of 64 characters for table names. This should not be an issue as table names that would exceed this would likely have unreasonable names. For instance, the following table name exceeds this limitation by one character. Silly, no? <strong>exp_pre_email_addresses_of_registered_users_in_seattle_washington</strong> </div> - - + + <h2><a name="one_file_per_class"></a>One File per Class</h2> <div class="guidelineDetails"> <p>Use separate files for each class your add-on uses, unless the classes are <em>closely related</em>. An example of CodeIgniter files that contains multiple classes is the Database class file, which contains both the DB class and the DB_Cache class, and the Magpie plugin, which contains both the Magpie and Snoopy classes.</p> </div> - - + + <h2><a name="whitespace"></a>Whitespace</h2> <div class="guidelineDetails"> <p>Use tabs for whitespace in your code, not spaces. This may seem like a small thing, but using tabs instead of whitespace allows the developer looking at your code to have indentation at levels that they prefer and customize in whatever application they use. And as a side benefit, it results in (slightly) more compact files, storing one tab character versus, say, four space characters.</p> </div> - - + + <h2><a name="line_breaks"></a>Line Breaks</h2> <div class="guidelineDetails"> <p>Files must be saved with Unix line breaks. This is more of an issue for developers who work in Windows, but in any case ensure that your text editor is setup to save files with Unix line breaks.</p> </div> - - + + <h2><a name="code_indenting"></a>Code Indenting</h2> <div class="guidelineDetails"> <p>Use Allman style indenting. With the exception of Class declarations, braces are always placed on a line by themselves, and indented at the same level as the control statement that "owns" them.</p> @@ -498,12 +498,12 @@ for ($i = 0; $i < 10; $i++) } }</code> </div> - + <h2><a name="bracket_spacing"></a>Bracket and Parenthetic Spacing</h2> <div class="guidelineDetails"> <p>In general, parenthesis and brackets should not use any additional spaces. The exception is that a space should always follow PHP control structures that accept arguments with parenthesis (declare, do-while, elseif, for, foreach, if, switch, while), to help distinguish them from functions and increase readability.</p> - + <code>INCORRECT: $arr[ $foo ] = 'foo'; @@ -514,13 +514,13 @@ $arr[$foo] = 'foo'; // no spaces around array keys INCORRECT: function foo ( $bar ) { - + } CORRECT: function foo($bar) // no spaces around parenthesis in function declarations { - + } @@ -531,9 +531,9 @@ CORRECT: foreach ($query->result() as $row) // single space following PHP control structures, but not in interior parenthesis </code> </div> - - - + + + <h2><a name="localized_text"></a>Localized Text</h2> <div class="guidelineDetails"> <p>Any text that is output in the control panel should use language variables in your lang file to allow localization.</p> @@ -544,9 +544,9 @@ return "Invalid Selection"; CORRECT: return $this->lang->line('invalid_selection');</code> </div> - - + + <h2><a name="private_methods_and_variables"></a>Private Methods and Variables</h2> <div class="guidelineDetails"> <p>Methods and variables that are only accessed internally by your class, such as utility and helper functions that your public methods use for code abstraction, should be prefixed with an underscore.</p> @@ -554,9 +554,9 @@ return $this->lang->line('invalid_selection');</code> <code>convert_text() // public method _convert_text() // private method</code> </div> - - + + <h2><a name="php_errors"></a>PHP Errors</h2> <div class="guidelineDetails"> <p>Code must run error free and not rely on warnings and notices to be hidden to meet this requirement. For instance, never access a variable that you did not set yourself (such as $_POST array keys) without first checking to see that it isset().</p> @@ -574,9 +574,9 @@ _convert_text() // private method</code> <p class="important"><strong>NOTE:</strong> Setting the <a href="http://us.php.net/manual/en/ref.errorfunc.php#ini.display-errors">display_errors</a> setting with ini_set() at runtime is not identical to having it enabled in the PHP environment. Namely, it will not have any effect if the script has fatal errors</p> </div> - - + + <h2><a name="short_open_tags"></a>Short Open Tags</h2> <div class="guidelineDetails"> <p>Always use full PHP opening tags, in case a server does not have short_open_tag enabled.</p> @@ -589,9 +589,9 @@ _convert_text() // private method</code> <strong>CORRECT</strong>: <?php echo $foo; ?></code> </div> - - + + <h2><a name="one_statement_per_line"></a>One Statement Per Line</h2> <div class="guidelineDetails"> <p>Never combine statements on one line.</p> @@ -605,9 +605,9 @@ $bar = 'that'; $bat = str_replace($foo, $bar, $bag); </code> </div> - - + + <h2><a name="strings"></a>Strings</h2> <div class="guidelineDetails"> <p>Always use single quoted strings unless you need variables parsed, and in cases where you do need variables parsed, use braces to prevent greedy token parsing. You may also use double-quoted strings if the string contains single quotes, so you do not have to use escape characters.</p> @@ -622,9 +622,9 @@ $bat = str_replace($foo, $bar, $bag); "My string {$foo}" "SELECT foo FROM bar WHERE baz = 'bag'"</code> </div> - - + + <h2><a name="sql_queries"></a>SQL Queries</h2> <div class="guidelineDetails"> <p>MySQL keywords are always capitalized: SELECT, INSERT, UPDATE, WHERE, AS, JOIN, ON, IN, etc.</p> @@ -645,16 +645,16 @@ $query = $this->db->query("SELECT foo, bar, baz, foofoo, foobar AS raboof, fooba ORDER BY foobaz LIMIT 5, 100");</code> </div> - - + + <h2><a name="default_function_arguments"></a>Default Function Arguments</h2> <div class="guidelineDetails"> <p>Whenever appropriate, provide function argument defaults, which helps prevent PHP errors with mistaken calls and provides common fallback values which can save a few lines of code. Example:</p> <code>function foo($bar = '', $baz = FALSE)</code> </div> - + </div> diff --git a/user_guide/general/views.html b/user_guide/general/views.html index 107446946..8f317109e 100644 --- a/user_guide/general/views.html +++ b/user_guide/general/views.html @@ -109,12 +109,12 @@ class Blog extends Controller { </textarea> -<p>If you visit the your site using the URL you did earlier you should see your new view. The URL was similar to this:</p> +<p>If you visit your site using the URL you did earlier you should see your new view. The URL was similar to this:</p> <code>example.com/index.php/<var>blog</var>/</code> <h2>Loading multiple views</h2> -<p>CodeIgniter will intelligently handle multiple calls to $this->load->view from within a controller. If more then one call happens they will be appended together. For example, you may wish to have a header view, a menu view, a content view, and a footer view. That might look something like this:</p> +<p>CodeIgniter will intelligently handle multiple calls to $this->load->view from within a controller. If more than one call happens they will be appended together. For example, you may wish to have a header view, a menu view, a content view, and a footer view. That might look something like this:</p> <p><code><?php<br /> <br /> class Page extends Controller {<br /><br /> @@ -169,7 +169,7 @@ class Blog extends Controller { { $data['title'] = "My Real Title"; $data['heading'] = "My Real Heading"; - + $this->load->view('blogview', $data); } } @@ -211,7 +211,7 @@ class Blog extends Controller { $data['title'] = "My Real Title"; $data['heading'] = "My Real Heading"; - + $this->load->view('blogview', $data); } } @@ -229,8 +229,8 @@ class Blog extends Controller { </head> <body> <h1><?php echo $heading;?></h1> - -<h3>My Todo List</h3> + +<h3>My Todo List</h3> <ul> <?php foreach($todo_list as $item):?> @@ -239,7 +239,7 @@ class Blog extends Controller { <?php endforeach;?> </ul> - + </body> </html> </textarea> diff --git a/user_guide/helpers/array_helper.html b/user_guide/helpers/array_helper.html index c0bdd78e3..6d95c4a5f 100644 --- a/user_guide/helpers/array_helper.html +++ b/user_guide/helpers/array_helper.html @@ -100,7 +100,58 @@ echo element('size', $array, NULL); echo random_element($quotes);</code> +<h2>elements()</h2> +<p>Lets you fetch a number of items from an array. The function tests whether each of the array indices is set. If an index does not exist +it is set to FALSE, or whatever you've specified as the default value via the third parameter. Example:</p> + +<code> +$array = array(<br /> + 'color' => 'red',<br /> + 'shape' => 'round',<br /> + 'radius' => '10',<br /> + 'diameter' => '20'<br /> +);<br /> +<br /> +$my_shape = elements(array('color', 'shape', 'height'), $array);<br /> +</code> + +<p>The above will return the following array:</p> + +<code> +array(<br /> + 'color' => 'red',<br /> + 'shape' => 'round',<br /> + 'height' => FALSE<br /> +); +</code> + +<p>You can set the third parameter to any default value you like:</p> + +<code> +$my_shape = elements(array('color', 'shape', 'height'), $array, NULL);<br /> +</code> + +<p>The above will return the following array:</p> + +<code> +array(<br /> + 'color' => 'red',<br /> + 'shape' => 'round',<br /> + 'height' => NULL<br /> +); +</code> + +<p>This is useful when sending the <kbd>$_POST</kbd> array to one of your Models. This prevents users from +sending additional POST data to be entered into your tables:</p> + +<code> +$this->load->model('post_model');<br /> +<br /> +$this->post_model->update(elements(array('id', 'title', 'content'), $_POST)); +</code> + +<p>This ensures that only the id, title and content fields are sent to be updated.</p> </div> <!-- END CONTENT --> diff --git a/user_guide/helpers/captcha_helper.html b/user_guide/helpers/captcha_helper.html index c4aa65fad..d6eb0652c 100644 --- a/user_guide/helpers/captcha_helper.html +++ b/user_guide/helpers/captcha_helper.html @@ -87,9 +87,9 @@ CAPTCHA Helper <p>The "word" is the word that appears in the captcha image, which if not supplied to the function, will be a random string.</p> - + <h3>Using the CAPTCHA helper</h3> - + <p>Once loaded you can generate a captcha like this:</p> <code>$vals = array(<br /> @@ -120,14 +120,14 @@ echo $cap['image'];</code> </ul> <h3>Adding a Database</h3> - + <p>In order for the captcha function to prevent someone from submitting, you will need to add the information returned from <kbd>create_captcha()</kbd> function to your database. Then, when the data from the form is submitted by the user you will need to verify that the data exists in the database and has not expired.</p> - + <p>Here is a table prototype:</p> - + <code>CREATE TABLE captcha (<br /> captcha_id bigint(13) unsigned NOT NULL auto_increment,<br /> captcha_time int(10) unsigned NOT NULL,<br /> @@ -135,10 +135,10 @@ echo $cap['image'];</code> word varchar(20) NOT NULL,<br /> PRIMARY KEY `captcha_id` (`captcha_id`),<br /> KEY `word` (`word`)<br /> -)</code> +);</code> <p>Here is an example of usage with a database. On the page where the CAPTCHA will be shown you'll have something like this:</p> - + <code>$this->load->helper('captcha');<br /> $vals = array(<br /> 'img_path' => './captcha/',<br /> @@ -161,10 +161,10 @@ echo $cap['image'];<br /> echo '<input type="text" name="captcha" value="" />';</code> <p>Then, on the page that accepts the submission you'll have something like this:</p> - + <code>// First, delete old captchas<br /> $expiration = time()-7200; // Two hour limit<br /> -$this->db->query("DELETE FROM captcha WHERE captcha_time < ".$expiration); <br /> +$this->db->query("DELETE FROM captcha WHERE captcha_time < ".$expiration); <br /> <br /> // Then see if a captcha exists:<br /> $sql = "SELECT COUNT(*) AS count FROM captcha WHERE word = ? AND ip_address = ? AND date > ?";<br /> @@ -176,7 +176,7 @@ if ($row->count == 0)<br /> {<br /> echo "You must submit the word that appears in the image";<br /> }</code> - + </div> <!-- END CONTENT --> @@ -192,4 +192,4 @@ Previous Topic: <a href="url_helper.html">URL Helper</a> </div> </body> -</html>
\ No newline at end of file +</html> diff --git a/user_guide/helpers/compatibility_helper.html b/user_guide/helpers/compatibility_helper.html index de8c49d0a..9afec6541 100644 --- a/user_guide/helpers/compatibility_helper.html +++ b/user_guide/helpers/compatibility_helper.html @@ -68,7 +68,7 @@ Compatibility Helper You may use those functions without loading this helper. The functions are split between that file and this Helper so that only functions required by the framework are included by default. This way, whether or not you load the additional functions in this Helper remains your choice.</p> - + <h2>Loading this Helper</h2> <p>This helper is loaded using the following code:</p> diff --git a/user_guide/helpers/date_helper.html b/user_guide/helpers/date_helper.html index 2d908705e..f8775b146 100644 --- a/user_guide/helpers/date_helper.html +++ b/user_guide/helpers/date_helper.html @@ -116,7 +116,7 @@ echo standard_date($format, $time); <th>Description</th> <th>Example</th> </tr> - <tr> + <tr> <td>DATE_ATOM</td> <td>Atom</td> <td>2005-08-15T16:13:03+0000</td> @@ -149,7 +149,7 @@ echo standard_date($format, $time); <tr> <td>DATE_RFC1123</td> <td>RFC 1123</td> - <td>Sun, 14 Aug 2005 16:13:03 UTC</td> + <td>Sun, 14 Aug 2005 16:13:03 UTC</td> </tr> <tr> <td>DATE_RFC2822</td> diff --git a/user_guide/helpers/directory_helper.html b/user_guide/helpers/directory_helper.html index 2324252dd..6e4faef02 100644 --- a/user_guide/helpers/directory_helper.html +++ b/user_guide/helpers/directory_helper.html @@ -83,7 +83,7 @@ you can do so using the second parameter (integer). A depth of 1 will only map t <code>$map = directory_map('./mydirectory/', 1);</code> -<p>By default, hidden files will not be included in the returned array. To override this behavior, +<p>By default, hidden files will not be included in the returned array. To override this behavior, you may set a third parameter to <var>true</var> (boolean):</p> <code>$map = directory_map('./mydirectory/', FALSE, TRUE);</code> diff --git a/user_guide/helpers/form_helper.html b/user_guide/helpers/form_helper.html index 03a60685b..0aaa8f60f 100644 --- a/user_guide/helpers/form_helper.html +++ b/user_guide/helpers/form_helper.html @@ -258,11 +258,11 @@ echo form_fieldset_close(); <br /> <br /> // Produces<br /> -<fieldset> +<fieldset> <br /> -<legend>Address Information</legend> +<legend>Address Information</legend> <br /> -<p>form content here</p> +<p>form content here</p> <br /> </fieldset></code> <p>Similar to other functions, you can submit an associative array in the second parameter if you prefer to set additional attributes. </p> diff --git a/user_guide/helpers/html_helper.html b/user_guide/helpers/html_helper.html index 50a1c48a4..845ecf109 100644 --- a/user_guide/helpers/html_helper.html +++ b/user_guide/helpers/html_helper.html @@ -118,7 +118,7 @@ echo link_tag('css/mystyles.css');<br /> <code> echo link_tag('favicon.ico', 'shortcut icon', 'image/ico');<br /> - // <link href="http://site.com/favicon.ico" rel="shortcut icon" type="image/ico" /> + // <link href="http://site.com/favicon.ico" rel="shortcut icon" type="image/ico" /> <br /> <br /> echo link_tag('feed', 'alternate', 'application/rss+xml', 'My RSS Feed');<br /> @@ -134,7 +134,7 @@ echo link_tag('css/mystyles.css');<br /> <br /> echo link_tag($link);<br /> // <link href="http://site.com/css/printer.css" rel="stylesheet" type="text/css" media="print" /></code></p> - + <h2><a name="nbs"></a>nbs()</h2> <p>Generates non-breaking spaces (&nbsp;) based on the number you submit. Example:</p> <code>echo nbs(3);</code> diff --git a/user_guide/helpers/smiley_helper.html b/user_guide/helpers/smiley_helper.html index 661330aab..d95562d94 100644 --- a/user_guide/helpers/smiley_helper.html +++ b/user_guide/helpers/smiley_helper.html @@ -91,7 +91,7 @@ a publicly accessible place on your server. This helper also assumes you have t <p>In your <dfn>application/controllers/</dfn> folder, create a file called <kbd>smileys.php</kbd> and place the code below in it.</p> -<p><strong>Important:</strong> Change the URL in the <dfn>get_clickable_smileys()</dfn> function below so that it points to +<p><strong>Important:</strong> Change the URL in the <dfn>get_clickable_smileys()</dfn> function below so that it points to your <dfn>smiley</dfn> folder.</p> <p>You'll notice that in addition to the smiley helper we are using the <a href="../libraries/table.html">Table Class</a>.</p> @@ -105,21 +105,21 @@ class Smileys extends Controller { { parent::Controller(); } - + 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); } - + } ?> </textarea> diff --git a/user_guide/helpers/string_helper.html b/user_guide/helpers/string_helper.html index 2b12c2a2a..d3f97fb52 100644 --- a/user_guide/helpers/string_helper.html +++ b/user_guide/helpers/string_helper.html @@ -145,7 +145,7 @@ The third parameter is FALSE by default; if set to TRUE it will remove occurence $string=",Fred, Bill,, Joe, Jimmy,";<br /> $string=reduce_multiples($string, ", ", TRUE); //results in "Fred, Bill, Joe, Jimmy" </code> -</p> +</p> <h2>quotes_to_entities()</h2> <p>Converts single and double quotes in a string to the corresponding HTML entities. Example:</p> diff --git a/user_guide/helpers/text_helper.html b/user_guide/helpers/text_helper.html index 438eaec45..6a68180b6 100644 --- a/user_guide/helpers/text_helper.html +++ b/user_guide/helpers/text_helper.html @@ -120,7 +120,7 @@ part it should correctly identify characters outside the normal range (like acce <p>Transliterates high ASCII characters to low ASCII equivalents, useful when non-English characters need to be used where only standard ASCII characters are safely used, for instance, in URLs.</p> <code>$string = convert_accented_characters($string);</code> - + <p>This function uses a companion config file <dfn>application/config/foreign_chars.php</dfn> to define the to and from array for transliteration.</p> <h2>word_censor()</h2> diff --git a/user_guide/images/ci_logo.jpg b/user_guide/images/ci_logo.jpg Binary files differindex 3ae0eee07..9ab5a8e24 100644 --- a/user_guide/images/ci_logo.jpg +++ b/user_guide/images/ci_logo.jpg diff --git a/user_guide/images/ci_logo_flame.jpg b/user_guide/images/ci_logo_flame.jpg Binary files differindex 17e9c586b..5bf38adbb 100644 --- a/user_guide/images/ci_logo_flame.jpg +++ b/user_guide/images/ci_logo_flame.jpg diff --git a/user_guide/images/ci_quick_ref.png b/user_guide/images/ci_quick_ref.png Binary files differindex c07d6b469..a4aa49585 100644 --- a/user_guide/images/ci_quick_ref.png +++ b/user_guide/images/ci_quick_ref.png diff --git a/user_guide/images/codeigniter_1.7.1_helper_reference.png b/user_guide/images/codeigniter_1.7.1_helper_reference.png Binary files differindex 15a7c1576..6a7d9f8c9 100644 --- a/user_guide/images/codeigniter_1.7.1_helper_reference.png +++ b/user_guide/images/codeigniter_1.7.1_helper_reference.png diff --git a/user_guide/images/codeigniter_1.7.1_library_reference.png b/user_guide/images/codeigniter_1.7.1_library_reference.png Binary files differindex 7f054f95f..08636857e 100644 --- a/user_guide/images/codeigniter_1.7.1_library_reference.png +++ b/user_guide/images/codeigniter_1.7.1_library_reference.png diff --git a/user_guide/images/nav_bg.jpg b/user_guide/images/nav_bg.jpg Binary files differindex 440e04ddb..35640707b 100644 --- a/user_guide/images/nav_bg.jpg +++ b/user_guide/images/nav_bg.jpg diff --git a/user_guide/installation/downloads.html b/user_guide/installation/downloads.html index f4114b7d1..f557a7887 100644 --- a/user_guide/installation/downloads.html +++ b/user_guide/installation/downloads.html @@ -84,11 +84,11 @@ 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>. 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> - + <p>Beginning with version 1.6.1, stable tags are also available via BitBucket, simply select the version from the Tags dropdown.</p> </div> <!-- END CONTENT --> diff --git a/user_guide/installation/index.html b/user_guide/installation/index.html index 3d58725ed..973d21064 100644 --- a/user_guide/installation/index.html +++ b/user_guide/installation/index.html @@ -73,7 +73,7 @@ variables at the top of the file with the new name you've chosen.</p> <p>For the best security, both the <dfn>system</dfn> and any <dfn>application</dfn> folders should be placed above web root so that they are not directly accessible via a browser. By default, .htaccess files are included in each folder to help prevent direct access, but it is best to remove them from public access entirely in case the web server configuration changes or doesn't abide by the .htaccess.</p> <p>After moving them, open your main <kdb>index.php</kbd> file and set the <samp>$system_folder</samp> and <samp>$application_folder</samp> variables, preferably with a full path, e.g. '<dfn>/www/MyUser/system</dfn>'.</p> - + <p>That's it!</p> diff --git a/user_guide/installation/upgrade_160.html b/user_guide/installation/upgrade_160.html index e0e987ede..b6a946d7e 100644 --- a/user_guide/installation/upgrade_160.html +++ b/user_guide/installation/upgrade_160.html @@ -79,7 +79,7 @@ Upgrading from 1.5.4 to 1.6.0 <h2>Step 2: Add time_to_update to your config.php </h2> <p>Add the following to application/config/config.php with the other session configuration options</p> -<p><code>$config['sess_time_to_update'] = 300;</code></p> +<p><code>$config['sess_time_to_update'] = 300;</code></p> <h2>Step 3: Add $autoload['model']</h2> <p>Add the following to application/config/autoload.php</p> <p><code> /*<br /> diff --git a/user_guide/installation/upgrade_170.html b/user_guide/installation/upgrade_170.html index 7f3cec614..91238ecbc 100644 --- a/user_guide/installation/upgrade_170.html +++ b/user_guide/installation/upgrade_170.html @@ -79,7 +79,7 @@ Upgrading from 1.6.3 to 1.7.0 <h2>Step 2: Update your Session Table</h2> -<p>If you are using the Session class in your application, AND if you are storing session data to a database, you must add a new column named <dfn>user_data</dfn> to your session table. +<p>If you are using the Session class in your application, AND if you are storing session data to a database, you must add a new column named <dfn>user_data</dfn> to your session table. Here is an example of what this column might look like for MySQL:</p> <code>user_data text NOT NULL</code> @@ -93,7 +93,7 @@ Here is an example of what this column might look like for MySQL:</p> <h2>Step 3: Update your Validation Syntax</h2> -<p>This is an <strong>optional</strong>, but recommended step, for people currently using the Validation class. CI 1.7 introduces a new <a href="../libraries/form_validation.html">Form Validation class</a>, which +<p>This is an <strong>optional</strong>, but recommended step, for people currently using the Validation class. CI 1.7 introduces a new <a href="../libraries/form_validation.html">Form Validation class</a>, which deprecates the old Validation library. We have left the old one in place so that existing applications that use it will not break, but you are encouraged to migrate to the new version as soon as possible. Please read the user guide carefully as the new library works a little differently, and has several new features.</p> diff --git a/user_guide/installation/upgrade_200.html b/user_guide/installation/upgrade_200.html index 155df90d3..58ed6e5ce 100644 --- a/user_guide/installation/upgrade_200.html +++ b/user_guide/installation/upgrade_200.html @@ -80,9 +80,9 @@ Upgrading from 1.7.2 to 2.0.0 <h2>Step 3: Convert your Plugins to Helpers</h2> <p>2.0.0 gets rid of the "Plugin" system as their functionality was identical to Helpers, but non-extensible. You will need to rename your plugin files from <var>filename_pi.php</var> to <var>filename_helper.php</var>, move them to your <kbd>helpers</kbd> folder, and change all instances of: - + <code>$this->load->plugin('foo');</code> - + to <code>$this->load->helper('foo');</code> @@ -97,7 +97,7 @@ to making it no longer possible to decode encrypted data produced by the original version of this library. To help with the transition, a new method has been added, <kbd>encode_from_legacy()</kbd> that will decode the data with the original algorithm and return a re-encoded string using the improved methods. This will enable you to easily replace stale encrypted data with fresh in your applications, either on the fly or en masse.</p> - + <p>Please read <a href="../libraries/encryption.html#legacy">how to use this method</a> in the Encryption library documentation.</p> </p> diff --git a/user_guide/libraries/calendar.html b/user_guide/libraries/calendar.html index 74a8619bf..2c052424d 100644 --- a/user_guide/libraries/calendar.html +++ b/user_guide/libraries/calendar.html @@ -114,7 +114,7 @@ how data passed to your cells is handled so you can pass different types of info <h2>Setting Display Preferences</h2> -<p>There are seven preferences you can set to control various aspects of the calendar. Preferences are set by passing an +<p>There are seven preferences you can set to control various aspects of the calendar. Preferences are set by passing an array of preferences in the second parameter of the loading function. Here is an example:</p> diff --git a/user_guide/libraries/cart.html b/user_guide/libraries/cart.html index 0dcf04acc..fb5f6621c 100644 --- a/user_guide/libraries/cart.html +++ b/user_guide/libraries/cart.html @@ -58,7 +58,7 @@ Shopping Cart Class <h1>Shopping Cart Class</h1> -<p>The Cart Class permits items to be added to a session that stays active while a user is browsing your site. +<p>The Cart Class permits items to be added to a session that stays active while a user is browsing your site. These items can be retrieved and displayed in a standard "shopping cart" format, allowing the user to update the quantity or remove items from the cart.</p> <p>Please note that the Cart Class ONLY provides the core "cart" functionality. It does not provide shipping, credit card authorization, or other processing components.</p> @@ -109,7 +109,7 @@ It is intended to be used in cases where your product has options associated wit <li><strong>options</strong> - Any additional attributes that are needed to identify the product. These must be passed via an array. </ul> -<p>In addition to the five indexes above, there are two reserved words: <dfn>rowid</dfn> and <dfn>subtotal</dfn>. These are used internally by the Cart class, so +<p>In addition to the five indexes above, there are two reserved words: <dfn>rowid</dfn> and <dfn>subtotal</dfn>. These are used internally by the Cart class, so please do NOT use those words as index names when inserting data into the cart.</p> <p>Your array may contain additional data. Anything you include in your array will be stored in the session. However, it is best to standardize your data among @@ -181,24 +181,24 @@ $this->cart->insert($data); <?php foreach($this->cart->contents() as $items): ?> <?php echo form_hidden($i.'[rowid]', $items['rowid']); ?> - + <tr> <td><?php echo form_input(array('name' => $i.'[qty]', 'value' => $items['qty'], 'maxlength' => '3', 'size' => '5')); ?></td> <td> <?php echo $items['name']; ?> - + <?php if ($this->cart->has_options($items['rowid']) == TRUE): ?> - + <p> <?php foreach ($this->cart->product_options($items['rowid']) as $option_name => $option_value): ?> - + <strong><?php echo $option_name; ?>:</strong> <?php echo $option_value; ?><br /> - + <?php endforeach; ?> </p> - + <?php endif; ?> - + </td> <td style="text-align:right"><?php echo $this->cart->format_number($items['price']); ?></td> <td style="text-align:right">$<?php echo $this->cart->format_number($items['subtotal']); ?></td> diff --git a/user_guide/libraries/email.html b/user_guide/libraries/email.html index e144826be..b863ef4c1 100644 --- a/user_guide/libraries/email.html +++ b/user_guide/libraries/email.html @@ -83,7 +83,7 @@ Email Class <code>$this->load->library('email');<br /> <br /> -$this->email->from('your@example.com', 'Your Name');<br /> +$this->email->from('your@example.com', 'Your Name');<br /> $this->email->to('someone@example.com'); <br /> $this->email->cc('another@another-example.com'); <br /> $this->email->bcc('them@their-example.com'); <br /> @@ -233,7 +233,7 @@ in a loop, permitting the data to be reset between cycles.</p> <code>foreach ($list as $name => $address)<br /> {<br /> $this->email->clear();<br /><br /> - + $this->email->to($address);<br /> $this->email->from('your@example.com');<br /> $this->email->subject('Here is your info '.$name);<br /> diff --git a/user_guide/libraries/file_uploading.html b/user_guide/libraries/file_uploading.html index 31041341f..254b2666a 100644 --- a/user_guide/libraries/file_uploading.html +++ b/user_guide/libraries/file_uploading.html @@ -145,15 +145,15 @@ folder:</p> <textarea class="textarea" style="width:100%" cols="50" rows="43"><?php class Upload extends Controller { - + function Upload() { parent::Controller(); $this->load->helper(array('form', 'url')); } - + function index() - { + { $this->load->view('upload_form', array('error' => ' ' )); } @@ -164,22 +164,22 @@ class Upload extends Controller { $config['max_size'] = '100'; $config['max_width'] = '1024'; $config['max_height'] = '768'; - + $this->load->library('upload', $config); - + if ( ! $this->upload->do_upload()) { $error = array('error' => $this->upload->display_errors()); - + $this->load->view('upload_form', $error); - } + } else { $data = array('upload_data' => $this->upload->data()); - + $this->load->view('upload_success', $data); } - } + } } ?></textarea> diff --git a/user_guide/libraries/form_validation.html b/user_guide/libraries/form_validation.html index 2099135a0..1d0b57181 100644 --- a/user_guide/libraries/form_validation.html +++ b/user_guide/libraries/form_validation.html @@ -106,7 +106,7 @@ have left the old class in the library so applications currently using it will n <ol> <li>A form is displayed.</li> <li>You fill it in and submit it.</li> -<li>If you submitted something invalid, or perhaps missed a required item, the form is redisplayed containing your data +<li>If you submitted something invalid, or perhaps missed a required item, the form is redisplayed containing your data along with an error message describing the problem.</li> <li>This process continues until you have submitted a valid form.</li> </ol> @@ -225,13 +225,13 @@ folder:</p> <textarea class="textarea" style="width:100%" cols="50" rows="21"><?php class Form extends Controller { - + function index() { $this->load->helper(array('form', 'url')); - + $this->load->library('form_validation'); - + if ($this->form_validation->run() == FALSE) { $this->load->view('myform'); @@ -316,18 +316,18 @@ $this->form_validation->set_rules('email', 'Email', 'required');<br /> <textarea class="textarea" style="width:100%" cols="50" rows="28"><?php class Form extends Controller { - + function index() { $this->load->helper(array('form', 'url')); - + $this->load->library('form_validation'); - + $this->form_validation->set_rules('username', 'Username', 'required'); $this->form_validation->set_rules('password', 'Password', 'required'); $this->form_validation->set_rules('passconf', 'Password Confirmation', 'required'); $this->form_validation->set_rules('email', 'Email', 'required'); - + if ($this->form_validation->run() == FALSE) { $this->load->view('myform'); @@ -518,18 +518,18 @@ create a callback function that does that. Let's create a example of this.</p> <textarea class="textarea" style="width:100%" cols="50" rows="44"><?php class Form extends Controller { - + function index() { $this->load->helper(array('form', 'url')); - + $this->load->library('form_validation'); - + $this->form_validation->set_rules('username', 'Username', 'callback_username_check'); $this->form_validation->set_rules('password', 'Password', 'required'); $this->form_validation->set_rules('passconf', 'Password Confirmation', 'required'); $this->form_validation->set_rules('email', 'Email', 'required'); - + if ($this->form_validation->run() == FALSE) { $this->load->view('myform'); @@ -539,7 +539,7 @@ class Form extends Controller { $this->load->view('formsuccess'); } } - + function username_check($str) { if ($str == 'test') @@ -552,7 +552,7 @@ class Form extends Controller { return TRUE; } } - + } ?></textarea> @@ -616,7 +616,7 @@ $this->form_validation->set_rules('first_name', '<kbd>lang:</kbd>first_name', 'r <a name="errordelimiters"></a> <h2>Changing the Error Delimiters</h2> -<p>By default, the Form Validation class adds a paragraph tag (<p>) around each error message shown. You can either change these delimiters globally or +<p>By default, the Form Validation class adds a paragraph tag (<p>) around each error message shown. You can either change these delimiters globally or individually.</p> <ol> diff --git a/user_guide/libraries/ftp.html b/user_guide/libraries/ftp.html index a46b155b9..493177655 100644 --- a/user_guide/libraries/ftp.html +++ b/user_guide/libraries/ftp.html @@ -82,7 +82,7 @@ $this->load->library('ftp');<br /> $config['hostname'] = 'ftp.example.com';<br /> $config['username'] = 'your-username';<br /> $config['password'] = 'your-password';<br /> -$config['debug'] = TRUE;<br /> +$config['debug'] = TRUE;<br /> <br /> $this->ftp->connect($config);<br /> <br /> @@ -101,7 +101,7 @@ $this->load->library('ftp');<br /> $config['hostname'] = 'ftp.example.com';<br /> $config['username'] = 'your-username';<br /> $config['password'] = 'your-password';<br /> -$config['debug'] = TRUE;<br /> +$config['debug'] = TRUE;<br /> <br /> $this->ftp->connect($config);<br /> <br /> @@ -121,7 +121,7 @@ $this->load->library('ftp');<br /> $config['hostname'] = 'ftp.example.com';<br /> $config['username'] = 'your-username';<br /> $config['password'] = 'your-password';<br /> -$config['debug'] = TRUE;<br /> +$config['debug'] = TRUE;<br /> <br /> $this->ftp->connect($config);<br /> <br /> @@ -231,7 +231,7 @@ $this->ftp->delete_file('/public_html/joe/blog.html'); <h2>$this->ftp->delete_dir()</h2> <p>Lets you delete a directory and everything it contains. Supply the source path to the directory with a trailing slash.</p> -<p class="important"><strong>Important</strong> Be VERY careful with this function. It will recursively delete +<p class="important"><strong>Important</strong> Be VERY careful with this function. It will recursively delete <b>everything</b> within the supplied path, including sub-folders and all files. Make absolutely sure your path is correct. Try using the <kbd>list_files()</kbd> function first to verify that your path is correct.</p> @@ -242,7 +242,7 @@ $this->ftp->delete_dir('/public_html/path/to/folder/'); <h2>$this->ftp->list_files()</h2> -<p>Permits you to retrieve a list of files on your server returned as an <dfn>array</dfn>. You must supply +<p>Permits you to retrieve a list of files on your server returned as an <dfn>array</dfn>. You must supply the path to the desired directory.</p> <code> @@ -254,7 +254,7 @@ print_r($list); <h2>$this->ftp->mirror()</h2> -<p>Recursively reads a local folder and everything it contains (including sub-folders) and creates a +<p>Recursively reads a local folder and everything it contains (including sub-folders) and creates a mirror via FTP based on it. Whatever the directory structure of the original file path will be recreated on the server. You must supply a source path and a destination path:</p> diff --git a/user_guide/libraries/image_lib.html b/user_guide/libraries/image_lib.html index 3dce50bf2..98ed4f6dd 100644 --- a/user_guide/libraries/image_lib.html +++ b/user_guide/libraries/image_lib.html @@ -447,7 +447,7 @@ calling the watermark function. Here is an example:</p> <code> $config['source_image'] = '/path/to/image/mypic.jpg';<br /> -$config['wm_text'] = 'Copyright 2006 - John Doe';<br /> +$config['wm_text'] = 'Copyright 2006 - John Doe';<br /> $config['wm_type'] = 'text';<br /> $config['wm_font_path'] = './system/fonts/texb.ttf';<br /> $config['wm_font_size'] = '16';<br /> diff --git a/user_guide/libraries/loader.html b/user_guide/libraries/loader.html index 1d5a47f40..34e3929a9 100644 --- a/user_guide/libraries/loader.html +++ b/user_guide/libraries/loader.html @@ -78,8 +78,8 @@ Note: We use the terms "class" and "library" interchangeably.</p> <p>Once loaded, the library will be ready for use, using <kbd>$this->email-></kbd><samp><em>some_function</em>()</samp>.</p> -<p>Library files can be stored in subdirectories within the main "libraries" folder, or within your personal <dfn>application/libraries</dfn> folder. -To load a file located in a subdirectory, simply include the path, relative to the "libraries" folder. +<p>Library files can be stored in subdirectories within the main "libraries" folder, or within your personal <dfn>application/libraries</dfn> folder. +To load a file located in a subdirectory, simply include the path, relative to the "libraries" folder. For example, if you have file located at:</p> <code>libraries/flavors/chocolate.php</code> @@ -217,7 +217,7 @@ $this->load->library('foo_bar');</code> <p>When your controller is finished using resources from an application package, and particularly if you have other application packages you want to work with, you may wish to remove the package path so the Loader no longer looks in that folder for resources. To remove the last path added, simply call the method with no parameters.</p> <h3>$this->load->remove_package_path()</h3> - + <p>Or to remove a specific package path, specify the same path previously given to <kbd>add_package_path() for a package.</kbd>:</p> <code>$this->load->remove_package_path(<var>APPPATH</var>.'third_party/<var>foo_bar</var>/');</code> diff --git a/user_guide/libraries/output.html b/user_guide/libraries/output.html index eeb278371..a1427de7b 100644 --- a/user_guide/libraries/output.html +++ b/user_guide/libraries/output.html @@ -140,9 +140,9 @@ at the bottom of your pages for debugging and optimization purposes.</p> <h2>Parsing Execution Variables</h2> <p>CodeIgniter will parse the pseudo-variables <var>{elapsed_time}</var> and <var>{memory_usage}</var> in your output by default. To disable this, set the <var>$parse_exec_vars</var> class property to <var>FALSE</var> in your controller. - + <code>$this->output->parse_exec_vars = FALSE;</code> - + </div> <!-- END CONTENT --> diff --git a/user_guide/libraries/pagination.html b/user_guide/libraries/pagination.html index 521b708b1..42c102c8d 100644 --- a/user_guide/libraries/pagination.html +++ b/user_guide/libraries/pagination.html @@ -69,7 +69,7 @@ Pagination Class <p>Here is a simple example showing how to create pagination in one of your <a href="../general/controllers.html">controller</a> functions:</p> <code> -$this->load->library('pagination');<br /><br /> +$this->load->library('pagination');<br /><br /> $config['base_url'] = 'http://example.com/index.php/test/page/';<br /> $config['total_rows'] = '200';<br /> $config['per_page'] = '20'; diff --git a/user_guide/libraries/security.html b/user_guide/libraries/security.html index a50d94846..6d6216d95 100644 --- a/user_guide/libraries/security.html +++ b/user_guide/libraries/security.html @@ -102,6 +102,11 @@ Note: This function should only be used to deal with data upon submission. It's <code>$filename = $this->security->sanitize_filename($this->input->post('filename'));</code> +<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 --> </div> diff --git a/user_guide/libraries/table.html b/user_guide/libraries/table.html index f1a46fca0..e90aca3d2 100644 --- a/user_guide/libraries/table.html +++ b/user_guide/libraries/table.html @@ -83,7 +83,7 @@ $data = array(<br /> array('John', 'Green', 'Medium') <br /> );<br /> <br /> -echo $this->table->generate($data); +echo $this->table->generate($data); </code> <p>Here is an example of a table created from a database query result. The table class will automatically generate the @@ -95,7 +95,7 @@ $this->load->library('table');<br /> <br /> $query = $this->db->query("SELECT * FROM my_table");<br /> <br /> -echo $this->table->generate($query); +echo $this->table->generate($query); </code> @@ -110,7 +110,7 @@ $this->table->add_row('Fred', 'Blue', 'Small');<br /> $this->table->add_row('Mary', 'Red', 'Large');<br /> $this->table->add_row('John', 'Green', 'Medium');<br /> <br /> -echo $this->table->generate(); +echo $this->table->generate(); </code> <p>Here is the same example, except instead of individual parameters, arrays are used:</p> @@ -124,7 +124,7 @@ $this->table->add_row(array('Fred', 'Blue', 'Small'));<br /> $this->table->add_row(array('Mary', 'Red', 'Large'));<br /> $this->table->add_row(array('John', 'Green', 'Medium'));<br /> <br /> -echo $this->table->generate(); +echo $this->table->generate(); </code> diff --git a/user_guide/libraries/typography.html b/user_guide/libraries/typography.html index 2675fa759..e78af5f9a 100644 --- a/user_guide/libraries/typography.html +++ b/user_guide/libraries/typography.html @@ -134,7 +134,7 @@ This function is identical to the native PHP <dfn>nl2br()</dfn> function, except <p>When using the Typography library in conjunction with the Template Parser library it can often be desirable to protect single and double quotes within curly braces. To enable this, set the <kbd>protect_braced_quotes</kbd> class property to <samp>TRUE</samp>.</p> - + <p>Usage example:</p> <code>$this->load->library('typography');<br /> diff --git a/user_guide/libraries/unit_testing.html b/user_guide/libraries/unit_testing.html index 0e7d1d696..84db54431 100644 --- a/user_guide/libraries/unit_testing.html +++ b/user_guide/libraries/unit_testing.html @@ -81,7 +81,7 @@ to determine if it is producing the correct data type and result. <h2>$this->unit->run( <var>test</var>, <var>expected result</var>, '<var>test name</var>', '<var>notes</var>');</h2> -<p>Where <var>test</var> is the result of the code you wish to test, <var>expected result</var> is the data type you expect, +<p>Where <var>test</var> is the result of the code you wish to test, <var>expected result</var> is the data type you expect, <var>test name</var> is an optional name you can give your test, and <var>notes</var> are optional notes. Example:</p> <code>$test = 1 + 1;<br /> diff --git a/user_guide/libraries/xmlrpc.html b/user_guide/libraries/xmlrpc.html index 8d1dbdf5f..971ab0296 100644 --- a/user_guide/libraries/xmlrpc.html +++ b/user_guide/libraries/xmlrpc.html @@ -192,7 +192,7 @@ The allowed methods are on the left side of the array. When either of those are <p>The '<var>object</var>' key is a special key that you pass an instantiated class object with, which is necessary when the method you are mapping to is not part of the CodeIgniter super object.</p> - + <p>In other words, if an XML-RPC Client sends a request for the <var>new_post</var> method, your server will load the <dfn>My_blog</dfn> class and call the <dfn>new_entry</dfn> function. If the request is for the <var>update_post</var> method, your @@ -202,7 +202,7 @@ server will load the <dfn>My_blog</dfn> class and call the <dfn>update_entry</df or if you are using standardized APIs, like the Blogger or MetaWeblog API, you'll use their function names.</p> <p>There are two additional configuration keys you may make use of when initializing the server class: <var>debug</var> can be set to TRUE in order to enable debugging, and <var>xss_clean</var> may be set to FALSE to prevent sending data through the Security library's xss_clean function. - + <h2>Processing Server Requests</h2> <p>When the XML-RPC Server receives a request and loads the class/method for processing, it will pass @@ -324,20 +324,20 @@ In it, place this code and save it to your <samp>applications/controllers/</samp <textarea class="textarea" style="width:100%" cols="50" rows="32"><?php class Xmlrpc_client extends Controller { - + function index() - { + { $this->load->helper('url'); $server_url = site_url('xmlrpc_server'); - + $this->load->library('xmlrpc'); - + $this->xmlrpc->server($server_url, 80); $this->xmlrpc->method('Greetings'); - + $request = array('How is it going?'); - $this->xmlrpc->request($request); - + $this->xmlrpc->request($request); + if ( ! $this->xmlrpc->send_request()) { echo $this->xmlrpc->display_error(); @@ -367,24 +367,24 @@ class Xmlrpc_server extends Controller { { $this->load->library('xmlrpc'); $this->load->library('xmlrpcs'); - + $config['functions']['Greetings'] = array('function' => 'Xmlrpc_server.process'); - + $this->xmlrpcs->initialize($config); $this->xmlrpcs->serve(); } - - + + function process($request) { $parameters = $request->output_parameters(); - + $response = array( array( 'you_said' => $parameters['0'], 'i_respond' => 'Not bad at all.'), 'struct'); - + return $this->xmlrpc->send_response($response); } } @@ -422,7 +422,7 @@ The Server receives the request and maps it to the "process" function, where a r )<br /> );<br /> $this->xmlrpc->request($request);</code> - + <p>You can retrieve the associative array when processing the request in the Server.</p> <code>$parameters = $request->output_parameters();<br /> diff --git a/user_guide/nav/moo.fx.js b/user_guide/nav/moo.fx.js index 53cfa925f..c80697fd2 100755 --- a/user_guide/nav/moo.fx.js +++ b/user_guide/nav/moo.fx.js @@ -71,7 +71,7 @@ fx.Layout.prototype = Object.extend(new fx.Base(), { }); fx.Height = Class.create(); -Object.extend(Object.extend(fx.Height.prototype, fx.Layout.prototype), { +Object.extend(Object.extend(fx.Height.prototype, fx.Layout.prototype), { increase: function() { this.el.style.height = this.now + "px"; }, @@ -83,7 +83,7 @@ Object.extend(Object.extend(fx.Height.prototype, fx.Layout.prototype), { }); fx.Width = Class.create(); -Object.extend(Object.extend(fx.Width.prototype, fx.Layout.prototype), { +Object.extend(Object.extend(fx.Width.prototype, fx.Layout.prototype), { increase: function() { this.el.style.width = this.now + "px"; }, diff --git a/user_guide/nav/moo.fx.pack.js b/user_guide/nav/moo.fx.pack.js index 574f27cff..e2ce39927 100755 --- a/user_guide/nav/moo.fx.pack.js +++ b/user_guide/nav/moo.fx.pack.js @@ -113,7 +113,7 @@ fx.MultiFadeSize.prototype = Object.extend(new Multi(), { this.el[i].fs.toggle(mode); setTimeout(function(){el.fs.toggle(mode);}.bind(el), delay); } - + } }, @@ -170,13 +170,13 @@ fx.RememberHeight.prototype = Object.extend(new Remember(), { this.fx = new fx.Height(this.el, this.options); this.prefix = 'height'; }, - + toggle: function(){ if (this.el.offsetHeight == 0) this.setCookie(this.el.scrollHeight); else this.setCookie(0); this.fx.toggle(); }, - + resize: function(to){ this.setCookie(this.el.offsetHeight+to); this.fx.custom(this.el.offsetHeight,this.el.offsetHeight+to); diff --git a/user_guide/overview/at_a_glance.html b/user_guide/overview/at_a_glance.html index f07313721..984eb0867 100644 --- a/user_guide/overview/at_a_glance.html +++ b/user_guide/overview/at_a_glance.html @@ -103,7 +103,7 @@ approach to URLs that is synonymous with dynamic systems, CodeIgniter uses a seg <h2>CodeIgniter Packs a Punch</h2> <p>CodeIgniter comes with full-range of libraries that enable the most commonly needed web development tasks, -like accessing a database, sending email, validating form data, maintaining sessions, manipulating images, working with XML-RPC data and +like accessing a database, sending email, validating form data, maintaining sessions, manipulating images, working with XML-RPC data and much more.</p> <h2>CodeIgniter is Extensible</h2> diff --git a/user_guide/overview/index.html b/user_guide/overview/index.html index 3cb56f42b..59ee05c5a 100644 --- a/user_guide/overview/index.html +++ b/user_guide/overview/index.html @@ -67,7 +67,7 @@ Introduction <li><a href="goals.html">Design and Architectural Goals</a></li> <li><a href="package.html">Package Description</a></li> </ul> - + diff --git a/user_guide/toc.html b/user_guide/toc.html index db9e9a824..d0caa6231 100644 --- a/user_guide/toc.html +++ b/user_guide/toc.html @@ -68,7 +68,7 @@ Table of Contents <li><a href="license.html">License Agreement</a></li> <li><a href="changelog.html">Change Log</a></li> <li><a href="./general/credits.html">Credits</a></li> -</ul> +</ul> <h3>Installation</h3> <ul> @@ -87,7 +87,7 @@ Table of Contents <li><a href="./overview/appflow.html">Application Flow Chart</a></li> <li><a href="./overview/mvc.html">Model-View-Controller</a></li> <li><a href="./overview/goals.html">Architectural Goals</a></li> -</ul> +</ul> </td> @@ -114,7 +114,7 @@ Table of Contents <li><a href="./general/managing_apps.html">Managing Applications</a></li> <li><a href="./general/alternative_php.html">Alternative PHP Syntax</a></li> <li><a href="./general/security.html">Security</a></li> - <li><a href="./general/styleguide.html">PHP Style Guide</a></li> + <li><a href="./general/styleguide.html">PHP Style Guide</a></li> <li><a href="./doc_style/index.html">Writing Documentation</a></li> </ul> @@ -134,7 +134,7 @@ Table of Contents <li><a href="./libraries/form_validation.html">Form Validation Class</a></li> <li><a href="./libraries/ftp.html">FTP Class</a></li> <li><a href="./libraries/table.html">HTML Table Class</a></li> -<li><a href="./libraries/image_lib.html">Image Manipulation Class</a></li> +<li><a href="./libraries/image_lib.html">Image Manipulation Class</a></li> <li><a href="./libraries/input.html">Input Class</a></li> <li><a href="./libraries/loader.html">Loader Class</a></li> <li><a href="./libraries/language.html">Language Class</a></li> @@ -180,7 +180,7 @@ Table of Contents <li><a href="./helpers/typography_helper.html">Typography Helper</a></li> <li><a href="./helpers/url_helper.html">URL Helper</a></li> <li><a href="./helpers/xml_helper.html">XML Helper</a></li> -</ul> +</ul> <h3>Additional Resources</h3> |