From 4b9c62980599228f070b401c7673dce8085b0c61 Mon Sep 17 00:00:00 2001
From: Derek Jones An incompatibility in PHP versions < 5.2.3 and MySQL < 5.0.7 with mysql_set_charset() creates a situation where using multi-byte character sets on these environments may potentially expose a SQL injection attack vector. Latin-1, UTF-8, and other "low ASCII" character sets are unaffected on all environments. If you are running or considering running a multi-byte character set for your database connection, please pay close attention to the server environment you are deploying on to ensure you are not vulnerable. An incompatibility in PHP versions < 5.2.3 and MySQL < 5.0.7 with mysql_set_charset() creates a situation where using multi-byte character sets on these environments may potentially expose a SQL injection attack vector. Latin-1, UTF-8, and other "low ASCII" character sets are unaffected on all environments. If you are running or considering running a multi-byte character set for your database connection, please pay close attention to the server environment you are deploying on to ensure you are not vulnerable.
-
CodeIgniter uses a modified version of the Active Record Database Pattern. This pattern allows information to be retrieved, inserted, and updated in your database with minimal scripting. In some cases only one or two lines of code are necessary to perform a database action. -CodeIgniter does not require that each database table be its own class file. It instead provides a more simplified interface.
+CodeIgniter does not require that each database table be its own class file. It instead provides a more simplified interface.Beyond simplicity, a major benefit to using the Active Record features is that it allows you to create database independent applications, since the query syntax -is generated by each database adapter. It also allows for safer queries, since the values are escaped automatically by the system.
+is generated by each database adapter. It also allows for safer queries, since the values are escaped automatically by the system. -Note: If you intend to write your own queries you can disable this class in your database config file, allowing the core database library and adapter to utilize fewer resources.
Note: If you intend to write your own queries you can disable this class in your database config file, allowing the core database library and adapter to utilize fewer resources.
Runs the selection query and returns the result. Can be used by itself to retrieve all records from a table:
+Runs the selection query and returns the result. Can be used by itself to retrieve all records from a table:
$query = $this->db->get('mytable');
@@ -126,7 +126,7 @@ $this->db->select('title, content, date');
$query = $this->db->get('mytable');
// Produces: SELECT title, content, date FROM mytable
-Note: If you are selecting all (*) from a table you do not need to use this function. When omitted, CodeIgniter assumes you wish to SELECT *
+Note: If you are selecting all (*) from a table you do not need to use this function. When omitted, CodeIgniter assumes you wish to SELECT *
$this->db->select() accepts an optional second parameter. If you set it to FALSE, CodeIgniter will not try to protect your field or table names with backticks. This is useful if you need a compound select statement.
Generates a WHERE field IN ('item', 'item') SQL query joined with AND if appropriate Generates a WHERE field IN ('item', 'item') SQL query joined with AND if appropriate$this->db->select('(SELECT SUM(payments.amount) FROM payments WHERE payments.invoice_id=4') AS amount_paid', FALSE);
@@ -351,7 +351,7 @@ $this->db->or_where('id >', $id);
$this->db->like('title', 'match');
@@ -278,7 +278,7 @@ $this->db->or_where('id >', $id);
$this->db->where_in();
-
$names = array('Frank', 'Todd', 'James');
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).
$this->db->where_in('username', $names);
@@ -322,7 +322,7 @@ $this->db->or_where('id >', $id);
$this->db->like('title', 'match');
+ // WHERE title LIKE '%match%' AND body LIKE '%match%
$this->db->like('body', 'match');
- // WHERE title LIKE '%match%' AND body LIKE '%match%$this->db->like('title', 'match', 'before');
+
@@ -340,7 +340,7 @@ $this->db->or_where('id >', $id);
$array = array('title' => $match, 'page1' => $match, 'page2' => $match);
$this->db->like($array);
-
// WHERE title LIKE '%match%' AND page1 LIKE '%match%' AND page2 LIKE '%match%'
// WHERE title LIKE '%match%' AND page1 LIKE '%match%' AND page2 LIKE '%match%'
$this->db->or_like('body', $match);
-
// WHERE title LIKE '%match%' OR body LIKE '%match%'
+
// WHERE title LIKE '%match%' OR body LIKE '%match%'
@@ -367,7 +367,7 @@ $this->db->or_like('body', $match);
$this->db->like('title', 'match');
+// WHERE title LIKE '%match% OR body NOT LIKE '%match%'
$this->db->or_not_like('body', 'match');
-// WHERE title LIKE '%match% OR body NOT LIKE '%match%'
Permits you to write the GROUP BY portion of your query:
@@ -385,7 +385,7 @@ $this->db->or_not_like('body', 'match');Adds the "DISTINCT" keyword to a query
+Adds the "DISTINCT" keyword to a query
$this->db->distinct();
@@ -409,16 +409,16 @@ $this->db->having('user_id', 45);
$this->db->get('table');
@@ -397,7 +397,7 @@ $this->db->or_not_like('body', 'match');
// Produces: HAVING user_id = 45
-$this->db->having('user_id', 45);
+$this->db->having('user_id', 45);
// Produces: HAVING user_id = 45
// Produces: HAVING title = 'My Title', id < 45
If you are using a database that CodeIgniter escapes queries for, you can prevent escaping content by passing an optional third argument, and setting it to FALSE.
-Identical to having(), only separates multiple clauses with "OR". 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 asc or desc, or random. $this->db->having('user_id', 45);
+$this->db->having('user_id', 45);
// Produces: HAVING `user_id` = 45 in some databases such as MySQL
- $this->db->having('user_id', 45, FALSE);
+ $this->db->having('user_id', 45, FALSE);
// Produces: HAVING user_id = 45$this->db->or_having();
$this->db->order_by();
$this->db->order_by("title", "desc");
@@ -455,12 +455,12 @@ $this->db->limit(10);
$this->db->limit(10, 20);
-// Produces: LIMIT 20, 10 (in MySQL. Other databases have slightly different syntax)
+// Produces: LIMIT 20, 10 (in MySQL. Other databases have slightly different syntax)
Permits you to determine the number of rows in a particular Active Record query. Queries will accept Active Record restrictors such as where(), or_where(), like(), or_like(), etc. Example:
+Permits you to determine the number of rows in a particular Active Record query. Queries will accept Active Record restrictors such as where(), or_where(), like(), or_like(), etc. Example:
echo $this->db->count_all_results('my_table');
// Produces an integer, like 25
@@ -472,7 +472,7 @@ echo $this->db->count_all_results();
$this->db->count_all();
-Permits you to determine the number of rows in a particular table. Submit the table name in the first parameter. Example:
+Permits you to determine the number of rows in a particular table. Submit the table name in the first parameter. Example:
echo $this->db->count_all('my_table');
@@ -485,7 +485,7 @@ echo $this->db->count_all_results();
$this->db->insert();
Generates an insert string based on the data you supply, and runs the query. You can either pass an
-array or an object to the function. Here is an example using an array:
+array or an object to the function. Here is an example using an array:
$data = array(
@@ -505,9 +505,9 @@ $this->db->insert('mytable', $data);
/*
class Myclass {
- var $title = 'My Title';
- var $content = 'My Content';
- var $date = 'My Date';
+ var $title = 'My Title';
+ var $content = 'My Content';
+ var $date = 'My Date';
}
*/
@@ -523,7 +523,7 @@ $this->db->insert('mytable', $object);
$this->db->insert_batch();
Generates an insert string based on the data you supply, and runs the query. You can either pass an
-array or an object to the function. Here is an example using an array:
+array or an object to the function. Here is an example using an array:
$data = array(
@@ -541,7 +541,7 @@ $data = array(
$this->db->update_batch('mytable', $data);
-// Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date'), ('Another title', 'Another name', 'Another date')
+// Produces: INSERT INTO mytable (title, name, date) VALUES ('My title', 'My name', 'My date'), ('Another title', 'Another name', 'Another date')
The first parameter will contain the table name, the second is an associative array of values.
@@ -588,9 +588,9 @@ $this->db->insert('mytable');
/*
class Myclass {
- var $title = 'My Title';
- var $content = 'My Content';
- var $date = 'My Date';
+ var $title = 'My Title';
+ var $content = 'My Content';
+ var $date = 'My Date';
}
*/
@@ -606,7 +606,7 @@ $this->db->insert('mytable');
Updating Data
$this->db->update();
-Generates an update string and runs the query based on the data you supply. You can pass an
+
Generates an update string and runs the query based on the data you supply. You can pass an
array or an object to the function. Here is an example using
an array:
@@ -630,9 +630,9 @@ $this->db->update('mytable', $data);
/*
class Myclass {
- var $title = 'My Title';
- var $content = 'My Content';
- var $date = 'My Date';
+ var $title = 'My Title';
+ var $content = 'My Content';
+ var $date = 'My Date';
}
*/
@@ -711,7 +711,7 @@ $this->db->truncate('mytable');
Method Chaining
-Method chaining allows you to simplify your syntax by connecting multiple functions. Consider this example:
+Method chaining allows you to simplify your syntax by connecting multiple functions. Consider this example:
$this->db->select('title')->from('mytable')->where('id', $id)->limit(10, 20);
@@ -752,14 +752,14 @@ $this->db->get('tablename');
$this->db->select('field2');
$this->db->get('tablename');
-//Generates: SELECT `field1`, `field2` FROM (`tablename`)
+//Generates: SELECT `field1`, `field2` FROM (`tablename`)
$this->db->flush_cache();
$this->db->select('field2');
$this->db->get('tablename');
-//Generates: SELECT `field2` FROM (`tablename`)
+//Generates: SELECT `field2` FROM (`tablename`)
Note: The following statements can be cached: select, from, join, where, like, group_by, having, order_by, set
diff --git a/user_guide/database/caching.html b/user_guide/database/caching.html
index 76a91216d..3f4ef2bc3 100644
--- a/user_guide/database/caching.html
+++ b/user_guide/database/caching.html
@@ -62,7 +62,7 @@ Database Caching Class
The Database Caching Class permits you to cache your queries as text files for reduced database load.
Important: This class is initialized automatically by the database driver
-when caching is enabled. Do NOT load this class manually.
+when caching is enabled. Do NOT load this class manually.
Also note: Not all query result functions are available when you use caching. Please read this page carefully.
@@ -84,12 +84,12 @@ when caching is enabled. Do NOT load this class manually.
CodeIgniter's query caching system happens dynamically when your pages are viewed.
When caching is enabled, the first time a web page is loaded, the query result object will
be serialized and stored in a text file on your server. The next time the page is loaded the cache file will be used instead of
-accessing your database. Your database usage can effectively be reduced to zero for any pages that have been cached.
+accessing your database. Your database usage can effectively be reduced to zero for any pages that have been cached.
Only read-type (SELECT) queries can be cached, since these are the only type of queries that produce a result.
Write-type (INSERT, UPDATE, etc.) queries, since they don't generate a result, will not be cached by the system.
-Cache files DO NOT expire. Any queries that have been cached will remain cached until you delete them. The caching system
+
Cache files DO NOT expire. Any queries that have been cached will remain cached until you delete them. The caching system
permits you clear caches associated with individual pages, or you can delete the entire collection of cache files.
Typically you'll want to use the housekeeping functions described below to delete cache files after certain
events take place, like when you've added new information to your database.
@@ -99,33 +99,33 @@ events take place, like when you've added new information to your database.
Getting a performance gain as a result of caching depends on many factors.
If you have a highly optimized database under very little load, you probably won't see a performance boost.
If your database is under heavy use you probably will see an improved response, assuming your file-system is not
-overly taxed. Remember that caching simply changes how your information is retrieved, shifting it from being a database
+overly taxed. Remember that caching simply changes how your information is retrieved, shifting it from being a database
operation to a file-system one.
In some clustered server environments, for example, caching may be detrimental since file-system operations are so intense.
On single servers in shared environments, caching will probably be beneficial. Unfortunately there is no
-single answer to the question of whether you should cache your database. It really depends on your situation.
+single answer to the question of whether you should cache your database. It really depends on your situation.
How are Cache Files Stored?
-CodeIgniter places the result of EACH query into its own cache file. Sets of cache files are further organized into
-sub-folders corresponding to your controller functions. To be precise, the sub-folders are named identically to the
+
CodeIgniter places the result of EACH query into its own cache file. Sets of cache files are further organized into
+sub-folders corresponding to your controller functions. To be precise, the sub-folders are named identically to the
first two segments of your URI (the controller class name and function name).
For example, let's say you have a controller called blog with a function called comments that
-contains three queries. The caching system will create a cache folder
+contains three queries. The caching system will create a cache folder
called blog+comments, into which it will write three cache files.
If you use dynamic queries that change based on information in your URI (when using pagination, for example), each instance of
-the query will produce its own cache file. It's possible, therefore, to end up with many times more cache files than you have
+the query will produce its own cache file. It's possible, therefore, to end up with many times more cache files than you have
queries.
Managing your Cache Files
-Since cache files do not expire, you'll need to build deletion routines into your application. For example, let's say you have a blog
-that allows user commenting. Whenever a new comment is submitted you'll want to delete the cache files associated with the
-controller function that serves up your comments. You'll find two delete functions described below that help you
+
Since cache files do not expire, you'll need to build deletion routines into your application. For example, let's say you have a blog
+that allows user commenting. Whenever a new comment is submitted you'll want to delete the cache files associated with the
+controller function that serves up your comments. You'll find two delete functions described below that help you
clear data.
@@ -155,8 +155,8 @@ pertain to run-time operations.
$this->db->cache_on() / $this->db->cache_off()
-Manually enables/disables caching. This can be useful if you want to
-keep certain queries from being cached. Example:
+Manually enables/disables caching. This can be useful if you want to
+keep certain queries from being cached. Example:
// Turn caching on
@@ -177,9 +177,9 @@ $query = $this->db->query("SELECT * FROM another_table");
Deletes the cache files associated with a particular page. This is useful if you need to clear caching after you update your database.
-The caching system saves your cache files to folders that correspond to the URI of the page you are viewing. For example, if you are viewing
+
The caching system saves your cache files to folders that correspond to the URI of the page you are viewing. For example, if you are viewing
a page at example.com/index.php/blog/comments, the caching system will put all cache files associated with it in a folder
-called blog+comments. To delete those particular cache files you will use:
+called blog+comments. To delete those particular cache files you will use:
$this->db->cache_delete('blog', 'comments');
@@ -188,7 +188,7 @@ called blog+comments. To delete those particular cache files you will
$this->db->cache_delete_all()
-Clears all existing cache files. Example:
+Clears all existing cache files. Example:
$this->db->cache_delete_all();
diff --git a/user_guide/database/call_function.html b/user_guide/database/call_function.html
index 7f294401e..3e0c78d3d 100644
--- a/user_guide/database/call_function.html
+++ b/user_guide/database/call_function.html
@@ -63,13 +63,13 @@ Custom Function Calls
This function enables you to call PHP database functions that are not natively included in CodeIgniter, in a platform independent manner.
For example, lets say you want to call the mysql_get_client_info() function, which is not natively supported
-by CodeIgniter. You could do so like this:
+by CodeIgniter. You could do so like this:
$this->db->call_function('get_client_info');
-You must supply the name of the function, without the mysql_ prefix, in the first parameter. The prefix is added
-automatically based on which database driver is currently being used. This permits you to run the same function on different database platforms.
+
You must supply the name of the function, without the mysql_ prefix, in the first parameter. The prefix is added
+automatically based on which database driver is currently being used. This permits you to run the same function on different database platforms.
Obviously not all function calls are identical between platforms, so there are limits to how useful this function can be in terms of portability.
Any parameters needed by the function you are calling will be added to the second parameter.
@@ -77,7 +77,7 @@ Obviously not all function calls are identical between platforms, so there are l
$this->db->call_function('some_function', $param1, $param2, etc..);
-Often, you will either need to supply a database connection ID or a database result ID. The connection ID can be accessed using:
+Often, you will either need to supply a database connection ID or a database result ID. The connection ID can be accessed using:
$this->db->conn_id;
diff --git a/user_guide/database/configuration.html b/user_guide/database/configuration.html
index b34705410..51d11c9f2 100644
--- a/user_guide/database/configuration.html
+++ b/user_guide/database/configuration.html
@@ -74,7 +74,7 @@ $db['default']['dbprefix'] = "";
$db['default']['pconnect'] = TRUE;
$db['default']['db_debug'] = FALSE;
$db['default']['cache_on'] = FALSE;
-$db['default']['cachedir'] = "";
+$db['default']['cachedir'] = "";
$db['default']['char_set'] = "utf8";
$db['default']['dbcollat'] = "utf8_general_ci";
$db['default']['swap_pre'] = "";
@@ -82,7 +82,7 @@ $db['default']['autoinit'] = TRUE;
$db['default']['stricton'] = FALSE;
The reason we use a multi-dimensional array rather than a more simple one is to permit you to optionally store
-multiple sets of connection values. If, for example, you run multiple environments (development, production, test, etc.)
+multiple sets of connection values. If, for example, you run multiple environments (development, production, test, etc.)
under a single installation, you can set up a connection group for each, then switch between groups as needed.
For example, to set up a "test" environment you would do this:
@@ -95,7 +95,7 @@ $db['test']['dbprefix'] = "";
$db['test']['pconnect'] = TRUE;
$db['test']['db_debug'] = FALSE;
$db['test']['cache_on'] = FALSE;
-$db['test']['cachedir'] = "";
+$db['test']['cachedir'] = "";
$db['test']['char_set'] = "utf8";
$db['test']['dbcollat'] = "utf8_general_ci";
$db['test']['swap_pre'] = "";
@@ -107,7 +107,7 @@ $db['test']['stricton'] = FALSE;
$active_group = "test";
-Note: The name "test" is arbitrary. It can be anything you want. By default we've used the word "default"
+
Note: The name "test" is arbitrary. It can be anything you want. By default we've used the word "default"
for the primary connection, but it too can be renamed to something more relevant to your project.
Active Record
@@ -126,21 +126,21 @@ for the primary connection, but it too can be renamed to something more relevant
- password - The password used to connect to the database.
- database - The name of the database you want to connect to.
- dbdriver - The database type. ie: mysql, postgres, odbc, etc. Must be specified in lower case.
-- dbprefix - An optional table prefix which will added to the table name when running Active Record queries. This permits multiple CodeIgniter installations to share one database.
+- dbprefix - An optional table prefix which will added to the table name when running Active Record queries. This permits multiple CodeIgniter installations to share one database.
- pconnect - TRUE/FALSE (boolean) - Whether to use a persistent connection.
- db_debug - TRUE/FALSE (boolean) - Whether database errors should be displayed.
- cache_on - TRUE/FALSE (boolean) - Whether database query caching is enabled, see also Database Caching Class.
- cachedir - The absolute server path to your database query cache directory.
- char_set - The character set used in communicating with the database.
-- dbcollat - The character collation used in communicating with the database.
Note: For MySQL and MySQLi databases, this setting is only used as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7. There is an incompatibility in PHP with mysql_real_escape_string() which can make your site vulnerable to SQL injection if you are using a multi-byte character set and are running versions lower than these. Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
-- swap_pre - A default table prefix that should be swapped with dbprefix. 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.
+- dbcollat - The character collation used in communicating with the database.
Note: For MySQL and MySQLi databases, this setting is only used as a backup if your server is running PHP < 5.2.3 or MySQL < 5.0.7. There is an incompatibility in PHP with mysql_real_escape_string() which can make your site vulnerable to SQL injection if you are using a multi-byte character set and are running versions lower than these. Sites using Latin-1 or UTF-8 database character set and collation are unaffected.
+- swap_pre - A default table prefix that should be swapped with dbprefix. 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.
- autoinit - 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.
- stricton - TRUE/FALSE (boolean) - Whether to force "Strict Mode" connections, good for ensuring strict SQL while developing an application.
-- port - The database port number. To use this value you have to add a line to the database config array.
$db['default']['port'] = 5432;
+ - port - The database port number. To use this value you have to add a line to the database config array.
$db['default']['port'] = 5432;
Note: Depending on what database platform you are using (MySQL, Postgres, etc.) -not all values will be needed. For example, when using SQLite you will not need to supply a username or password, and +not all values will be needed. For example, when using SQLite you will not need to supply a username or password, and the database name will be the path to your database file. The information above assumes you are using MySQL.
diff --git a/user_guide/database/connecting.html b/user_guide/database/connecting.html index 1a74f5571..bb1b401f9 100644 --- a/user_guide/database/connecting.html +++ b/user_guide/database/connecting.html @@ -84,8 +84,8 @@ to the group specified in your database config file. For most people, this is thBy setting the second parameter to TRUE (boolean) the function will return the database object.
When you connect this way, you will use your object name to issue commands rather than the syntax used throughout this guide. In other words, rather than issuing commands with:
+When you connect this way, you will use your object name to issue commands rather than the syntax used throughout this guide. In other words, rather than issuing commands with:
$this->db->query();
$this->db->result();
etc...
The following page contains example code showing how the database class is used. For complete details please +
The following page contains example code showing how the database class is used. For complete details please read the individual pages describing each function.
@@ -73,7 +73,7 @@ read the individual pages describing each function.Once loaded the class is ready to be used as described below.
-Note: If all your pages require database access you can connect automatically. See the connecting page for details.
+Note: If all your pages require database access you can connect automatically. See the connecting page for details.
The above result() function returns an array of objects. Example: $row->title
+The above result() function returns an array of objects. Example: $row->title
The above result_array() function returns an array of standard array indexes. Example: $row['title']
+The above result_array() function returns an array of standard array indexes. Example: $row['title']
The above row() function returns an object. Example: $row->name
+The above row() function returns an object. Example: $row->name
The above row_array() function returns an array. Example: $row['name']
+The above row_array() function returns an array. Example: $row['name']
Sometimes it's helpful to know whether a particular field exists before performing an action. -Returns a boolean TRUE/FALSE. Usage example:
+Returns a boolean TRUE/FALSE. Usage example:
if ($this->db->field_exists('field_name', 'table_name'))
@@ -101,7 +101,7 @@ if ($this->db->field_exists('field_name', 'table_name'))
}
-Note: Replace field_name with the name of the column you are looking for, and replace +
Note: Replace field_name with the name of the column you are looking for, and replace table_name with the name of the table you are looking for.
diff --git a/user_guide/database/forge.html b/user_guide/database/forge.html index bbef053e4..cad2cf26f 100644 --- a/user_guide/database/forge.html +++ b/user_guide/database/forge.html @@ -151,7 +151,7 @@ already be running, since the forge class relies on it. ),After the fields have been defined, they can be added using $this->dbforge->add_field($fields); followed by a call to the create_table() function.
+After the fields have been defined, they can be added using $this->dbforge->add_field($fields); followed by a call to the create_table() function.
The add fields function will accept the above array.
Generally speaking, you'll want your table to have Keys. This is accomplished with $this->dbforge->add_key('field'). An optional second parameter set to TRUE will make it a primary key. Note that add_key() must be followed by a call to create_table().
-Multiple column non-primary keys must be sent as an array. Sample output below is for MySQL.
+Multiple column non-primary keys must be sent as an array. Sample output below is for MySQL.
$this->dbforge->add_key('blog_id', TRUE);
// gives PRIMARY KEY `blog_id` (`blog_id`)
@@ -187,7 +187,7 @@ already be running, since the forge class relies on it.
Executes a DROP TABLE sql
$this->dbforge->drop_table('table_name');
- // gives DROP TABLE IF EXISTS table_name
Executes a TABLE rename
$this->dbforge->rename_table('old_table_name', 'new_table_name');
@@ -200,7 +200,7 @@ already be running, since the forge class relies on it.
Used to remove a column from a table.
$this->dbforge->drop_column('table_name', 'column_to_drop');
Displays the number of affected rows, when doing "write" type queries (insert, update, etc.).
-Note: In MySQL "DELETE FROM TABLE" returns 0 affected rows. The database class has a small hack that allows it to return the -correct number of affected rows. By default this hack is enabled but it can be turned off in the database driver file.
+Note: In MySQL "DELETE FROM TABLE" returns 0 affected rows. The database class has a small hack that allows it to return the +correct number of affected rows. By default this hack is enabled but it can be turned off in the database driver file.
Permits you to determine the number of rows in a particular table. Submit the table name in the first parameter. Example:
+Permits you to determine the number of rows in a particular table. Submit the table name in the first parameter. Example:
echo $this->db->count_all('my_table');
// Produces an integer, like 25
@@ -90,11 +90,11 @@ correct number of affected rows. By default this hack is enabled but it can be t
$this->db->last_query();
-Returns the last query that was run (the query string, not the result). Example:
+Returns the last query that was run (the query string, not the result). Example:
$str = $this->db->last_query();
-// Produces: SELECT * FROM sometable....
+// Produces: SELECT * FROM sometable....
@@ -109,7 +109,7 @@ correct number of affected rows. By default this hack is enabled but it can be t
$str = $this->db->insert_string('table_name', $data);
-The first parameter is the table name, the second is an associative array with the data to be inserted. The above example produces:
+The first parameter is the table name, the second is an associative array with the data to be inserted. The above example produces:
INSERT INTO table_name (name, email, url) VALUES ('Rick', 'rick@example.com', 'example.com')
Note: Values are automatically escaped, producing safer queries.
diff --git a/user_guide/database/index.html b/user_guide/database/index.html index 594de80dd..fa3548cf1 100644 --- a/user_guide/database/index.html +++ b/user_guide/database/index.html @@ -63,7 +63,7 @@ Database Library structures and Active Record patterns. The database functions offer clear, simple syntax.$this->db->query('YOUR QUERY HERE');
The query() function returns a database result object when "read" type queries are run, -which you can use to show your results. When "write" type queries are run it simply returns TRUE or FALSE -depending on success or failure. When retrieving data you will typically assign the query to your own variable, like this:
+which you can use to show your results. When "write" type queries are run it simply returns TRUE or FALSE +depending on success or failure. When retrieving data you will typically assign the query to your own variable, like this:$query = $this->db->query('YOUR QUERY HERE');
This is a simplified version of the $this->db->query() function. It ONLY returns TRUE/FALSE on success or failure. +
This is a simplified version of the $this->db->query() function. It ONLY returns TRUE/FALSE on success or failure. It DOES NOT return a database result set, nor does it set the query timer, or compile bind data, or store your query for debugging. It simply lets you submit a query. Most users will rarely use this function.
@@ -100,16 +100,16 @@ CodeIgniter has three methods that help you do this:$sql = "INSERT INTO table (title) VALUES(".$this->db->escape($title).")";
$sql = "INSERT INTO table (title) VALUES('".$this->db->escape_str($title)."')";
$search = '20% raise';
@@ -130,7 +130,7 @@ $this->db->query($sql, array(3, 'live', 'Rick'));
The question marks in the query are automatically replaced with the values in the array in the second parameter of the query function.
-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.
+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.
diff --git a/user_guide/database/results.html b/user_guide/database/results.html index 0b82752a7..8ad6a1986 100644 --- a/user_guide/database/results.html +++ b/user_guide/database/results.html @@ -112,7 +112,7 @@ Query ResultsThis 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:
+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:
$query = $this->db->query("YOUR QUERY");
@@ -126,8 +126,8 @@ Query Results
row()
- 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 object. Here's a usage example:
+ 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 object. Here's a usage example:
$query = $this->db->query("YOUR QUERY");
@@ -157,7 +157,7 @@ Query Results
row_array()
- Identical to the above row() function, except it returns an array. Example:
+ Identical to the above row() function, except it returns an array. Example:
$query = $this->db->query("YOUR QUERY");
@@ -209,7 +209,7 @@ echo $query->num_rows();
$query->num_fields()
-The number of FIELDS (columns) returned by the query. Make sure to call the function using your query result object:
+The number of FIELDS (columns) returned by the query. Make sure to call the function using your query result object:
$query = $this->db->query('SELECT * FROM my_table');
echo $query->num_fields();
@@ -218,9 +218,9 @@ echo $query->num_fields();
$query->free_result()
-It frees the memory associated with the result and deletes the result resource ID. Normally PHP frees its memory automatically at the end of script
-execution. However, if you are running a lot of queries in a particular script you might want to free the result after each query result has been
-generated in order to cut down on memory consumptions. Example:
+
It frees the memory associated with the result and deletes the result resource ID. Normally PHP frees its memory automatically at the end of script
+execution. However, if you are running a lot of queries in a particular script you might want to free the result after each query result has been
+generated in order to cut down on memory consumptions. Example:
$query = $this->db->query('SELECT title FROM my_table');
@@ -228,12 +228,12 @@ foreach ($query->result() as $row)
{
echo $row->title;
}
-$query->free_result(); // The $query result object will no longer be available
+$query->free_result(); // The $query result object will no longer be available
$query2 = $this->db->query('SELECT name FROM some_table');
$row = $query2->row();
echo $row->name;
-$query2->free_result(); // The $query2 result object will no longer be available
+$query2->free_result(); // The $query2 result object will no longer be available
diff --git a/user_guide/database/table_data.html b/user_guide/database/table_data.html
index 631e3b9d1..a2aaa99a8 100644
--- a/user_guide/database/table_data.html
+++ b/user_guide/database/table_data.html
@@ -65,7 +65,7 @@ Table Data
$this->db->list_tables();
-Returns an array containing the names of all the tables in the database you are currently connected to. Example:
+Returns an array containing the names of all the tables in the database you are currently connected to. Example:
$tables = $this->db->list_tables();
@@ -79,7 +79,7 @@ foreach ($tables as $table)
$this->db->table_exists();
Sometimes it's helpful to know whether a particular table exists before running an operation on it.
-Returns a boolean TRUE/FALSE. Usage example:
+Returns a boolean TRUE/FALSE. Usage example:
if ($this->db->table_exists('table_name'))
@@ -88,7 +88,7 @@ if ($this->db->table_exists('table_name'))
}
-Note: Replace table_name with the name of the table you are looking for.
+Note: Replace table_name with the name of the table you are looking for.
diff --git a/user_guide/database/transactions.html b/user_guide/database/transactions.html
index 68d76dff6..74945d434 100644
--- a/user_guide/database/transactions.html
+++ b/user_guide/database/transactions.html
@@ -61,18 +61,18 @@ Transactions
Transactions
-CodeIgniter's database abstraction allows you to use transactions with databases that support transaction-safe table types. In MySQL, you'll need
-to be running InnoDB or BDB table types rather than the more common MyISAM. Most other database platforms support transactions natively.
+CodeIgniter's database abstraction allows you to use transactions with databases that support transaction-safe table types. In MySQL, you'll need
+to be running InnoDB or BDB table types rather than the more common MyISAM. Most other database platforms support transactions natively.
If you are not familiar with
-transactions we recommend you find a good online resource to learn about them for your particular database. The information below assumes you
+transactions we recommend you find a good online resource to learn about them for your particular database. The information below assumes you
have a basic understanding of transactions.
CodeIgniter's Approach to Transactions
-CodeIgniter utilizes an approach to transactions that is very similar to the process used by the popular database class ADODB. We've chosen that approach
-because it greatly simplifies the process of running transactions. In most cases all that is required are two lines of code.
+CodeIgniter utilizes an approach to transactions that is very similar to the process used by the popular database class ADODB. We've chosen that approach
+because it greatly simplifies the process of running transactions. In most cases all that is required are two lines of code.
Traditionally, transactions have required a fair amount of work to implement since they demand that you to keep track of your queries
and determine whether to commit or rollback based on the success or failure of your queries. This is particularly cumbersome with
@@ -98,7 +98,7 @@ of any given query.
Strict Mode
-By default CodeIgniter runs all transactions in Strict Mode. When strict mode is enabled, if you are running multiple groups of
+
By default CodeIgniter runs all transactions in Strict Mode. When strict mode is enabled, if you are running multiple groups of
transactions, if one group fails all groups will be rolled back. If strict mode is disabled, each group is treated independently, meaning
a failure of one group will not affect any others.
@@ -127,7 +127,7 @@ if ($this->db->trans_status() === FALSE)
Enabling Transactions
-Transactions are enabled automatically the moment you use $this->db->trans_start(). If you would like to disable transactions you
+
Transactions are enabled automatically the moment you use $this->db->trans_start(). If you would like to disable transactions you
can do so using $this->db->trans_off():
diff --git a/user_guide/database/utilities.html b/user_guide/database/utilities.html
index ec45f2688..c488180a8 100644
--- a/user_guide/database/utilities.html
+++ b/user_guide/database/utilities.html
@@ -105,7 +105,7 @@ foreach ($dbs as $db)
$this->dbutil->database_exists();
Sometimes it's helpful to know whether a particular database exists.
-Returns a boolean TRUE/FALSE. Usage example:
+Returns a boolean TRUE/FALSE. Usage example:
if ($this->dbutil->database_exists('database_name'))
@@ -114,7 +114,7 @@ if ($this->dbutil->database_exists('database_name'))
}
-Note: Replace database_name with the name of the table you are looking for. This function is case sensitive.
+Note: Replace database_name with the name of the table you are looking for. This function is case sensitive.
@@ -184,7 +184,7 @@ echo $this->dbutil->csv_from_result($query);
The second and third parameters allows you to
-set the delimiter and newline character. By default tabs are used as the delimiter and "\n" is used as a new line. Example:
+set the delimiter and newline character. By default tabs are used as the delimiter and "\n" is used as a new line. Example:
$delimiter = ",";
@@ -193,14 +193,14 @@ $newline = "\r\n";
echo $this->dbutil->csv_from_result($query, $delimiter, $newline);
-Important: This function will NOT write the CSV file for you. It simply creates the CSV layout.
+
Important: This function will NOT write the CSV file for you. It simply creates the CSV layout.
If you need to write the file use the File Helper.
$this->dbutil->xml_from_result($db_result)
Permits you to generate an XML file from a query result. The first parameter expects a query result object, the second
-may contain an optional array of config parameters. Example:
+may contain an optional array of config parameters. Example:
$this->load->dbutil();
@@ -217,18 +217,18 @@ $config = array (
echo $this->dbutil->xml_from_result($query, $config);
-Important: This function will NOT write the XML file for you. It simply creates the XML layout.
+
Important: This function will NOT write the XML file for you. It simply creates the XML layout.
If you need to write the file use the File Helper.
$this->dbutil->backup()
-Permits you to backup your full database or individual tables. The backup data can be compressed in either Zip or Gzip format.
+Permits you to backup your full database or individual tables. The backup data can be compressed in either Zip or Gzip format.
Note: This features is only available for MySQL databases.
Note: Due to the limited execution time and memory available to PHP, backing up very large
-databases may not be possible. If your database is very large you might need to backup directly from your SQL server
+databases may not be possible. If your database is very large you might need to backup directly from your SQL server
via the command line, or have your server admin do it for you if you do not have root privileges.
Usage Example
@@ -278,7 +278,7 @@ $this->dbutil->backup($prefs);
Options
Description
-tables empty array None An array of tables you want backed up. If left blank all tables will be exported.
+tables empty array None An array of tables you want backed up. If left blank all tables will be exported.
ignore empty array None An array of tables you want the backup routine to ignore.
diff --git a/user_guide/doc_style/template.html b/user_guide/doc_style/template.html
index e25503200..d59d5e4ed 100644
--- a/user_guide/doc_style/template.html
+++ b/user_guide/doc_style/template.html
@@ -51,7 +51,7 @@ Foo Class
Foo Class
-Brief description of Foo Class. If it extends a native CodeIgniter class, please link to the class in the CodeIgniter documents here.
+Brief description of Foo Class. If it extends a native CodeIgniter class, please link to the class in the CodeIgniter documents here.
Important: This is an important note with EMPHASIS.
diff --git a/user_guide/general/alternative_php.html b/user_guide/general/alternative_php.html
index 574ab35d7..abd5845ff 100644
--- a/user_guide/general/alternative_php.html
+++ b/user_guide/general/alternative_php.html
@@ -58,19 +58,19 @@ Alternate PHP Syntax
Alternate PHP Syntax for View Files
If you do not utilize CodeIgniter's template engine, 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
-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,
+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.
Automatic Short Tag Support
Note: 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,
-allowing you to use that syntax even if your server doesn't support it. This feature can be enabled in your
+allowing you to use that syntax even if your server doesn't support it. This feature can be enabled in your
config/config.php file.
Please note that if you do use this feature, if PHP errors are encountered
-in your view files, the error message and line number will not be accurately shown. Instead, all errors
+in your view files, the error message and line number will not be accurately shown. Instead, all errors
will be shown as eval() errors.
@@ -89,7 +89,7 @@ will be shown as eval() errors.
Alternative Control Structures
Controls structures, like if, for, foreach, and while can be
-written in a simplified format as well. Here is an example using foreach:
+written in a simplified format as well. Here is an example using foreach:
<ul>
@@ -102,14 +102,14 @@ written in a simplified format as well. Here is an example using foreach:
</ul>
-Notice that there are no braces. Instead, the end brace is replaced with endforeach.
+
Notice that there are no braces. Instead, the end brace is replaced with endforeach.
Each of the control structures listed above has a similar closing syntax:
endif, endfor, endforeach, and endwhile
-Also notice that instead of using a semicolon after each structure (except the last one), there is a colon. This is
+
Also notice that instead of using a semicolon after each structure (except the last one), there is a colon. This is
important!
-Here is another example, using if/elseif/else. Notice the colons:
+Here is another example, using if/elseif/else. Notice the colons:
<?php if ($username == 'sally'): ?>
diff --git a/user_guide/general/autoloader.html b/user_guide/general/autoloader.html
index 405dda30f..fae0b5fd9 100644
--- a/user_guide/general/autoloader.html
+++ b/user_guide/general/autoloader.html
@@ -75,7 +75,7 @@ consider auto-loading them for convenience.
loaded to the autoload array. You'll find instructions in that file corresponding to each
type of item.
-Note: Do not include the file extension (.php) when adding items to the autoload array.
+Note: Do not include the file extension (.php) when adding items to the autoload array.
diff --git a/user_guide/general/caching.html b/user_guide/general/caching.html
index abfe6ded9..c77f9a15d 100644
--- a/user_guide/general/caching.html
+++ b/user_guide/general/caching.html
@@ -68,8 +68,8 @@ By caching your pages, since they are saved in their fully rendered state, you c
How Does Caching Work?
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 application/cache 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.
+When a page is loaded for the first time, the cache file will be written to your application/cache 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.
Note: The Benchmark tag is not cached so you can still view your page load speed when caching is enabled.
@@ -90,8 +90,8 @@ most logical to you. Once the tag is in place, your pages will begin being cache
Deleting Caches
-If you no longer wish to cache a file you can remove the caching tag and it will no longer be refreshed when it expires. Note:
-Removing the tag will not delete the cache immediately. It will have to expire normally. If you need to remove it earlier you
+
If you no longer wish to cache a file you can remove the caching tag and it will no longer be refreshed when it expires. Note:
+Removing the tag will not delete the cache immediately. It will have to expire normally. If you need to remove it earlier you
will need to manually delete it from your cache folder.
diff --git a/user_guide/general/common_functions.html b/user_guide/general/common_functions.html
index 3c7a5df9e..bfac32685 100644
--- a/user_guide/general/common_functions.html
+++ b/user_guide/general/common_functions.html
@@ -68,7 +68,7 @@ Auto-loading Resources
$str = quoted_printable_encode($str);
}
-Returns boolean TRUE if the installed version of PHP is equal to or greater than the supplied version number. Returns FALSE if the installed version of PHP is lower than the supplied version number.
+Returns boolean TRUE if the installed version of PHP is equal to or greater than the supplied version number. Returns FALSE if the installed version of PHP is lower than the supplied version number.
is_really_writable('path/to/file')
@@ -92,10 +92,10 @@ else
set_status_header(code, 'text');
-Permits you to manually set a server status header. Example:
+Permits you to manually set a server status header. Example:
set_status_header(401);
-// Sets the header as: Unauthorized
+// Sets the header as: Unauthorized
See here for a full list of headers.
diff --git a/user_guide/general/controllers.html b/user_guide/general/controllers.html
index 01ef3d1ff..c90916472 100644
--- a/user_guide/general/controllers.html
+++ b/user_guide/general/controllers.html
@@ -91,7 +91,7 @@ Controllers
Let's try it: Hello World!
-Let's create a simple controller so you can see it in action. Using your text editor, create a file called blog.php, and put the following code in it:
+Let's create a simple controller so you can see it in action. Using your text editor, create a file called blog.php, and put the following code in it:
@@ -203,7 +203,7 @@ preferences have no effect on cropping. The "availability" column indicates whic
dynamic_output
FALSE
TRUE/FALSE (boolean)
-Determines whether the new image file should be written to disk or generated dynamically. Note: If you choose the dynamic setting, only one image can be shown at a time, and it can't be positioned on the page. It simply outputs the raw image dynamically to your browser, along with image headers.
+Determines whether the new image file should be written to disk or generated dynamically. Note: If you choose the dynamic setting, only one image can be shown at a time, and it can't be positioned on the page. It simply outputs the raw image dynamically to your browser, along with image headers.
R, C, X, W
@@ -221,7 +221,7 @@ preferences have no effect on cropping. The "availability" column indicates whic
new_image
None
None
-Sets the destination image name/path. You'll use this preference when creating an image copy. The path must be a relative or absolute server path, not a URL.
+Sets the destination image name/path. You'll use this preference when creating an image copy. The path must be a relative or absolute server path, not a URL.
R, C, X, W
@@ -253,7 +253,7 @@ preferences have no effect on cropping. The "availability" column indicates whic
thumb_marker
_thumb
None
-Specifies the thumbnail indicator. It will be inserted just before the file extension, so mypic.jpg would become mypic_thumb.jpg
+Specifies the thumbnail indicator. It will be inserted just before the file extension, so mypic.jpg would become mypic_thumb.jpg
R
@@ -281,7 +281,7 @@ preferences have no effect on cropping. The "availability" column indicates whic
rotation_angle
None
90, 180, 270, vrt, hor
-Specifies the angle of rotation when rotating images. Note that PHP rotates counter-clockwise, so a 90 degree rotation to the right must be specified as 270.
+Specifies the angle of rotation when rotating images. Note that PHP rotates counter-clockwise, so a 90 degree rotation to the right must be specified as 270.
X
@@ -306,7 +306,7 @@ preferences have no effect on cropping. The "availability" column indicates whic
Setting preferences in a config file
If you prefer not to set preferences using the above method, you can instead put them into a config file.
-Simply create a new file called image_lib.php, add the $config
+Simply create a new file called image_lib.php, add the $config
array in that file. Then save the file in: config/image_lib.php and it will be used automatically. You
will NOT need to use the $this->image_lib->initialize function if you save your preferences in a config file.
@@ -319,7 +319,7 @@ or create a thumbnail image.
For practical purposes there is no difference between creating a copy and creating
a thumbnail except a thumb will have the thumbnail marker as part of the name (ie, mypic_thumb.jpg).
-All preferences listed in the table above are available for this function except these three: rotation_angle, x_axis, and y_axis.
+All preferences listed in the table above are available for this function except these three: rotation_angle, x_axis, and y_axis.
Creating a Thumbnail
@@ -358,7 +358,7 @@ preferences for the X and Y axis (in pixels) specifying where to crop, like this
$config['x_axis'] = '100';
$config['y_axis'] = '40';
-All preferences listed in the table above are available for this function except these: rotation_angle, width, height, create_thumb, new_image.
+All preferences listed in the table above are available for this function except these: rotation_angle, width, height, create_thumb, new_image.
Here's an example showing how you might crop an image:
@@ -378,8 +378,8 @@ if ( ! $this->image_lib->crop())
Note: Without a visual interface it is difficult to crop images, so this function is not very useful
-unless you intend to build such an interface. That's exactly what we did using for the photo
-gallery module in ExpressionEngine, the CMS we develop. We added a JavaScript UI that lets the cropping
+unless you intend to build such an interface. That's exactly what we did using for the photo
+gallery module in ExpressionEngine, the CMS we develop. We added a JavaScript UI that lets the cropping
area be selected.
$this->image_lib->rotate()
@@ -443,7 +443,7 @@ containing your watermark over the source image.
Just as with the other functions (resizing, cropping, and rotating) the general process for watermarking involves setting the preferences corresponding to the action you intend to perform, then -calling the watermark function. Here is an example:
+calling the watermark function. Here is an example:
$config['source_image'] = '/path/to/image/mypic.jpg';
@@ -452,9 +452,9 @@ $config['wm_type'] = 'text';
$config['wm_font_path'] = './system/fonts/texb.ttf';
$config['wm_font_size'] = '16';
$config['wm_font_color'] = 'ffffff';
-$config['wm_vrt_alignment'] = 'bottom';
-$config['wm_hor_alignment'] = 'center';
-$config['wm_padding'] = '20';
+$config['wm_vrt_alignment'] = 'bottom';
+$config['wm_hor_alignment'] = 'center';
+$config['wm_padding'] = '20';
$this->image_lib->initialize($config);
@@ -462,7 +462,7 @@ $this->image_lib->initialize($config);
$this->image_lib->watermark();
-The above example will use a 16 pixel True Type font to create the text "Copyright 2006 - John Doe". The watermark +
The above example will use a 16 pixel True Type font to create the text "Copyright 2006 - John Doe". The watermark will be positioned at the bottom/center of the image, 20 pixels from the bottom of the image.
Note: In order for the image class to be allowed to do any processing, the image file must have "write" file permissions. For example, 777.
@@ -491,14 +491,14 @@ will be positioned at the bottom/center of the image, 20 pixels from the bottomThe security filtering function is called automatically when a new controller is invoked. It does the following:
+The security filtering function is called automatically when a new controller is invoked. It does the following:
The Input class has the ability to filter input automatically to prevent cross-site scripting attacks. If you want the filter to run automatically every time it encounters POST or COOKIE data you can enable it by opening your +
The Input class has the ability to filter input automatically to prevent cross-site scripting attacks. If you want the filter to run automatically every time it encounters POST or COOKIE data you can enable it by opening your application/config/config.php file and setting this:
$config['global_xss_filtering'] = TRUE;
@@ -93,9 +93,9 @@ Input Class
CodeIgniter comes with three helper functions that let you fetch POST, COOKIE or SERVER items. The main advantage of using the provided +
CodeIgniter comes with three helper functions that let you fetch POST, COOKIE or SERVER items. The main advantage of using the provided functions rather than fetching an item directly ($_POST['something']) is that the functions will check to see if the item is set and -return false (boolean) if not. This lets you conveniently use data without having to test whether an item exists first. +return false (boolean) if not. This lets you conveniently use data without having to test whether an item exists first. In other words, normally you might do something like this:
@@ -128,7 +128,7 @@ else
The function returns FALSE (boolean) if the item you are attempting to retrieve does not exist.
-The second optional parameter lets you run the data through the XSS filter. It's enabled by setting the second parameter to boolean TRUE;
+The second optional parameter lets you run the data through the XSS filter. It's enabled by setting the second parameter to boolean TRUE;
$this->input->post('some_data', TRUE);
@@ -179,7 +179,7 @@ else
$this->input->set_cookie()
-Sets a cookie containing the values you specify. There are two ways to pass information to this function so that a cookie can be set:
+
Sets a cookie containing the values you specify. There are two ways to pass information to this function so that a cookie can be set:
Array Method, and Discrete Parameters:
Array Method
@@ -203,10 +203,10 @@ $this->input->set_cookie($cookie);
Only the name and value are required. To delete a cookie set it with the expiration blank.
-The expiration is set in seconds, which will be added to the current time. Do not include the time, but rather only the
-number of seconds from now that you wish the cookie to be valid. If the expiration is set to
+
The expiration is set in seconds, which will be added to the current time. Do not include the time, but rather only the
+number of seconds from now that you wish the cookie to be valid. If the expiration is set to
zero the cookie will only last as long as the browser is open.
-For site-wide cookies regardless of how your site is requested, add your URL to the domain starting with a period, like this: .your-domain.com
+For site-wide cookies regardless of how your site is requested, add your URL to the domain starting with a period, like this: .your-domain.com
The path is usually not needed since the function sets a root path.
The prefix is only needed if you need to avoid name collisions with other identically named cookies for your server.
The secure boolean is only needed if you want to make it a secure cookie by setting it to TRUE.
@@ -219,25 +219,25 @@ zero the cookie will only last as long as the browser is open.
$this->input->cookie()
-Lets you fetch a cookie. The first parameter will contain the name of the cookie you are looking for (including any prefixes):
+Lets you fetch a cookie. The first parameter will contain the name of the cookie you are looking for (including any prefixes):
cookie('some_cookie');
The function returns FALSE (boolean) if the item you are attempting to retrieve does not exist.
-The second optional parameter lets you run the data through the XSS filter. It's enabled by setting the second parameter to boolean TRUE;
+The second optional parameter lets you run the data through the XSS filter. It's enabled by setting the second parameter to boolean TRUE;
cookie('some_cookie', TRUE);
$this->input->ip_address()
-Returns the IP address for the current user. If the IP address is not valid, the function will return an IP of: 0.0.0.0
+Returns the IP address for the current user. If the IP address is not valid, the function will return an IP of: 0.0.0.0
echo $this->input->ip_address();
$this->input->valid_ip($ip)
-Takes an IP address as input and returns TRUE or FALSE (boolean) if it is valid or not. Note: The $this->input->ip_address() function above
+
Takes an IP address as input and returns TRUE or FALSE (boolean) if it is valid or not. Note: The $this->input->ip_address() function above
validates the IP automatically.
if ( ! $this->input->valid_ip($ip))
@@ -256,7 +256,7 @@ else
See the User Agent Class for methods which extract information from the user agent string.
$this->input->request_headers()
-Useful if running in a non-Apache environment where apache_request_headers() will not be supported. Returns an array of headers.
+Useful if running in a non-Apache environment where apache_request_headers() will not be supported. Returns an array of headers.
$headers = $this->input->request_headers();
diff --git a/user_guide/libraries/javascript.html b/user_guide/libraries/javascript.html
index cd3adf1d2..4e262279d 100644
--- a/user_guide/libraries/javascript.html
+++ b/user_guide/libraries/javascript.html
@@ -65,11 +65,11 @@ JavaScript Driver
$this->load->library('javascript');
-The Javascript class also accepts parameters, js_library_driver (string) default 'jquery' and autoload (bool) default TRUE. You may override the defaults if you wish by sending an associative array:
+The Javascript class also accepts parameters, js_library_driver (string) default 'jquery' and autoload (bool) default TRUE. You may override the defaults if you wish by sending an associative array:
$this->load->library('javascript', array('js_library_driver' => 'scripto', 'autoload' => FALSE));
-Again, presently only 'jquery' is available. You may wish to set autoload to FALSE, though, if you do not want the jQuery library to automatically include a script tag for the main jQuery script file. This is useful if you are loading it from a location outside of CodeIgniter, or already have the script tag in your markup.
+Again, presently only 'jquery' is available. You may wish to set autoload to FALSE, though, if you do not want the jQuery library to automatically include a script tag for the main jQuery script file. This is useful if you are loading it from a location outside of CodeIgniter, or already have the script tag in your markup.
Once loaded, the jQuery library object will be available using: $this->javascript
Setup and Configuration
@@ -93,7 +93,7 @@ JavaScript Driver
$this->load->library('jquery');
-You may send an optional parameter to determine whether or not a script tag for the main jQuery file will be automatically included when loading the library. It will be created by default. To prevent this, load the library as follows:
+You may send an optional parameter to determine whether or not a script tag for the main jQuery file will be automatically included when loading the library. It will be created by default. To prevent this, load the library as follows:
$this->load->library('jquery', FALSE);
@@ -115,7 +115,7 @@ JavaScript Driver
Effects
-The query library supports a powerful Effects repertoire. Before an effect can be used, it must be loaded:
+The query library supports a powerful Effects repertoire. Before an effect can be used, it must be loaded:
$this->jquery->effect([optional path] plugin name);
// for example
@@ -125,8 +125,8 @@ $this->jquery->effect('bounce');
hide() / show()
Each of this functions will affect the visibility of an item on your page. hide() will set an item invisible, show() will reveal it.
-$this->jquery->hide(target, optional speed, optional extra information);
- $this->jquery->show(target, optional speed, optional extra information);
+$this->jquery->hide(target, optional speed, optional extra information);
+ $this->jquery->show(target, optional speed, optional extra information);
- "target" will be any valid jQuery selector or selectors.
@@ -162,8 +162,8 @@ $this->jquery->click('#trigger', $this->jquery->animate('#note', $pa
fadeIn() / fadeOut()
-$this->jquery->fadeIn(target, optional speed, optional extra information);
- $this->jquery->fadeOut(target, optional speed, optional extra information);
+$this->jquery->fadeIn(target, optional speed, optional extra information);
+ $this->jquery->fadeOut(target, optional speed, optional extra information);
- "target" will be any valid jQuery selector or selectors.
- "speed" is optional, and is set to either slow, normal, fast, or alternatively a number of milliseconds.
@@ -182,8 +182,8 @@ $this->jquery->click('#trigger', $this->jquery->animate('#note', $pa
fadeIn() / fadeOut()
These effects cause an element(s) to disappear or reappear over time.
-$this->jquery->fadeIn(target, optional speed, optional extra information);
- $this->jquery->fadeOut(target, optional speed, optional extra information);
+$this->jquery->fadeIn(target, optional speed, optional extra information);
+ $this->jquery->fadeOut(target, optional speed, optional extra information);
- "target" will be any valid jQuery selector or selectors.
- "speed" is optional, and is set to either slow, normal, fast, or alternatively a number of milliseconds.
@@ -193,9 +193,9 @@ $this->jquery->click('#trigger', $this->jquery->animate('#note', $pa
slideUp() / slideDown() / slideToggle()
These effects cause an element(s) to slide.
-$this->jquery->slideUp(target, optional speed, optional extra information);
- $this->jquery->slideDown(target, optional speed, optional extra information);
-$this->jquery->slideToggle(target, optional speed, optional extra information);
+$this->jquery->slideUp(target, optional speed, optional extra information);
+ $this->jquery->slideDown(target, optional speed, optional extra information);
+$this->jquery->slideToggle(target, optional speed, optional extra information);
- "target" will be any valid jQuery selector or selectors.
- "speed" is optional, and is set to either slow, normal, fast, or alternatively a number of milliseconds.
diff --git a/user_guide/libraries/language.html b/user_guide/libraries/language.html
index 1b253fa00..75863c2ac 100644
--- a/user_guide/libraries/language.html
+++ b/user_guide/libraries/language.html
@@ -60,30 +60,30 @@ Language Class
The Language Class provides functions to retrieve language files and lines of text for purposes of internationalization.
-In your CodeIgniter system folder you'll find one called language containing sets of language files. You can create
+
In your CodeIgniter system folder you'll find one called language containing sets of language files. You can create
your own language files as needed in order to display error and other messages in other languages.
-Language files are typically stored in your system/language directory. Alternately you can create a folder called language inside
-your application folder and store them there. CodeIgniter will look first in your application/language
-directory. If the directory does not exist or the specified language is not located there CI will instead look in your global
+
Language files are typically stored in your system/language directory. Alternately you can create a folder called language inside
+your application folder and store them there. CodeIgniter will look first in your application/language
+directory. If the directory does not exist or the specified language is not located there CI will instead look in your global
system/language folder.
-Note: Each language should be stored in its own folder. For example, the English files are located at:
+
Note: Each language should be stored in its own folder. For example, the English files are located at:
system/language/english
Creating Language Files
-Language files must be named with _lang.php as the file extension. For example, let's say you want to create a file
-containing error messages. You might name it: error_lang.php
+Language files must be named with _lang.php as the file extension. For example, let's say you want to create a file
+containing error messages. You might name it: error_lang.php
Within the file you will assign each line of text to an array called $lang with this prototype:
$lang['language_key'] = "The actual message to be shown";
Note: It's a good practice to use a common prefix for all messages in a given file to avoid collisions with
-similarly named items in other files. For example, if you are creating error messages you might prefix them with error_
+similarly named items in other files. For example, if you are creating error messages you might prefix them with error_
$lang['error_email_missing'] = "You must submit an email address";
$lang['error_url_missing'] = "You must submit a URL";
@@ -92,12 +92,12 @@ $lang['error_username_missing'] = "You must submit a username";
Loading A Language File
-In order to fetch a line from a particular file you must load the file first. Loading a language file is done with the following code:
+In order to fetch a line from a particular file you must load the file first. Loading a language file is done with the following code:
$this->lang->load('filename', 'language');
Where filename is the name of the file you wish to load (without the file extension), and language
-is the language set containing it (ie, english). If the second parameter is missing, the default language set in your
+is the language set containing it (ie, english). If the second parameter is missing, the default language set in your
application/config/config.php file will be used.
@@ -109,7 +109,7 @@ is the language set containing it (ie, english). If the second parameter is miss
Where language_key is the array key corresponding to the line you wish to show.
-Note: This function simply returns the line. It does not echo it for you.
+Note: This function simply returns the line. It does not echo it for you.
Using language lines as form labels
diff --git a/user_guide/libraries/loader.html b/user_guide/libraries/loader.html
index 50ec60c1f..1d93af5ed 100644
--- a/user_guide/libraries/loader.html
+++ b/user_guide/libraries/loader.html
@@ -58,7 +58,7 @@ Loader Class
Loader Class
-Loader, as the name suggests, is used to load elements. These elements can be libraries (classes) View files,
+
Loader, as the name suggests, is used to load elements. These elements can be libraries (classes) View files,
Helpers, Models, or your own files.
Note: This class is initialized automatically by the system so there is no need to do it manually.
@@ -69,7 +69,7 @@ Loader Class
$this->load->library('class_name', $config, 'object name')
-This function is used to load core classes. Where class_name is the name of the class you want to load.
+
This function is used to load core classes. Where class_name is the name of the class you want to load.
Note: We use the terms "class" and "library" interchangeably.
For example, if you would like to send email with CodeIgniter, the first step is to load the email class within your controller:
@@ -96,7 +96,7 @@ For example, if you have file located at:
Setting options
-The second (optional) parameter allows you to optionally pass configuration setting. You will typically pass these as an array:
+The second (optional) parameter allows you to optionally pass configuration setting. You will typically pass these as an array:
$config = array (
@@ -113,7 +113,7 @@ $this->load->library('email', $config);
Assigning a Library to a different object name
-If the third (optional) parameter is blank, the library will usually be assigned to an object with the same name as the library. For example, if the library is named Session, it
+
If the third (optional) parameter is blank, the library will usually be assigned to an object with the same name as the library. For example, if the library is named Session, it
will be assigned to a variable named $this->session.
If you prefer to set your own class names you can pass its value to the third parameter:
@@ -131,20 +131,20 @@ $this->my_session
$this->load->view('file_name', $data, true/false)
-This function is used to load your View files. If you haven't read the Views section of the
+
This function is used to load your View files. If you haven't read the Views section of the
user guide it is recommended that you do since it shows you how this function is typically used.
-The first parameter is required. It is the name of the view file you would like to load. Note: The .php file extension does not need to be specified unless you use something other than .php.
+The first parameter is required. It is the name of the view file you would like to load. Note: The .php file extension does not need to be specified unless you use something other than .php.
The second optional parameter can take
an associative array or an object as input, which it runs through the PHP extract function to
-convert to variables that can be used in your view files. Again, read the Views page to learn
+convert to variables that can be used in your view files. Again, read the Views page to learn
how this might be useful.
The third optional parameter lets you change the behavior of the function so that it returns data as a string
-rather than sending it to your browser. This can be useful if you want to process the data in some way. If you
-set the parameter to true (boolean) it will return data. The default behavior is false, which sends it
-to your browser. Remember to assign it to a variable if you want the data returned:
+rather than sending it to your browser. This can be useful if you want to process the data in some way. If you
+set the parameter to true (boolean) it will return data. The default behavior is false, which sends it
+to your browser. Remember to assign it to a variable if you want the data returned:
$string = $this->load->view('myfile', '', true);
@@ -159,7 +159,7 @@ to your browser. Remember to assign it to a variable if you want the data return
$this->fubar->function();
$this->load->database('options', true/false)
-This function lets you load the database class. The two parameters are optional. Please see the
+
This function lets you load the database class. The two parameters are optional. Please see the
database section for more info.
@@ -168,9 +168,9 @@ $this->fubar->function();
This function takes an associative array as input and generates variables using the PHP extract function. -This function produces the same result as using the second parameter of the $this->load->view() function above. The reason you might +This function produces the same result as using the second parameter of the $this->load->view() function above. The reason you might want to use this function independently is if you would like to set some global variables in the constructor of your controller -and have them become available in any view file loaded from any function. You can have multiple calls to this function. The data get cached +and have them become available in any view file loaded from any function. You can have multiple calls to this function. The data get cached and merged into one array for conversion to variables.
@@ -180,7 +180,7 @@ and merged into one array for conversion to variables.This is a generic file loading function. Supply the filepath and name in the first parameter and it will open and read the file. +
This is a generic file loading function. Supply the filepath and name in the first parameter and it will open and read the file. By default the data is sent to your browser, just like a View file, but if you set the second parameter to true (boolean) it will instead return the data as a string.
@@ -194,7 +194,7 @@ it will instead return the data as a string.An application package allows for the easy distribution of complete sets of resources in a single directory, complete with its own libraries, models, helpers, config, and language files. It is recommended that these packages be placed in the application/third_party folder. Below is a sample map of an package directory
+An application package allows for the easy distribution of complete sets of resources in a single directory, complete with its own libraries, models, helpers, config, and language files. It is recommended that these packages be placed in the application/third_party folder. Below is a sample map of an package directory
Whatever the purpose of the "Foo Bar" application package, it has its own config files, helpers, language files, libraries, and models. To use these resources in your controllers, you first need to tell the Loader that you are going to be loading resources from a package, by adding the package path.
+Whatever the purpose of the "Foo Bar" application package, it has its own config files, helpers, language files, libraries, and models. To use these resources in your controllers, you first need to tell the Loader that you are going to be loading resources from a package, by adding the package path.
Adding a package path instructs the Loader class to prepend a given path for subsequent requests for resources. As an example, the "Foo Bar" application package above has a library named Foo_bar.php. In our controller, we'd do the following:
+Adding a package path instructs the Loader class to prepend a given path for subsequent requests for resources. As an example, the "Foo Bar" application package above has a library named Foo_bar.php. In our controller, we'd do the following:
$this->load->add_package_path(APPPATH.'third_party/foo_bar/');
$this->load->library('foo_bar');
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.
+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.
By Default, package view files paths are set when add_package_path() is called. View paths are looped through, and once a match is encountered that view is loaded.
-In this instance, it is possible for view naming collisions within packages to occur, and possibly the incorrect package being loaded. To ensure against this, set an optional second parameter of FALSE when calling add_package_path().
+By Default, package view files paths are set when add_package_path() is called. View paths are looped through, and once a match is encountered that view is loaded.
+In this instance, it is possible for view naming collisions within packages to occur, and possibly the incorrect package being loaded. To ensure against this, set an optional second parameter of FALSE when calling add_package_path().
$this->load->add_package_path(APPPATH.'my_app', TRUE);
diff --git a/user_guide/libraries/output.html b/user_guide/libraries/output.html
index 8846e15ff..4d1f8d97a 100644
--- a/user_guide/libraries/output.html
+++ b/user_guide/libraries/output.html
@@ -58,7 +58,7 @@ Output Class
Output Class
-The Output class is a small class with one main function: To send the finalized web page to the requesting browser. It is
+
The Output class is a small class with one main function: To send the finalized web page to the requesting browser. It is
also responsible for caching your web pages, if you use that feature.
Note: This class is initialized automatically by the system so there is no need to do it manually.
@@ -70,7 +70,7 @@ It is possible, however, for you to manually intervene with the output if you ne
$this->output->set_output();
-Permits you to manually set the final output string. Usage example:
+Permits you to manually set the final output string. Usage example:
$this->output->set_output($data);
@@ -95,7 +95,7 @@ $this->output
$this->output->get_output();
-Permits you to manually retrieve any output that has been sent for storage in the output class. Usage example:
+Permits you to manually retrieve any output that has been sent for storage in the output class. Usage example:
$string = $this->output->get_output();
Note that data will only be retrievable from this function if it has been previously sent to the output class by one of the
@@ -104,7 +104,7 @@ CodeIgniter functions like $this->load->view().
$this->output->append_output();
-Appends data onto the output string. Usage example:
+Appends data onto the output string. Usage example:
$this->output->append_output($data);
@@ -112,7 +112,7 @@ CodeIgniter functions like $this->load->view().
$this->output->set_header();
-Permits you to manually set server headers, which the output class will send for you when outputting the final rendered display. Example:
+Permits you to manually set server headers, which the output class will send for you when outputting the final rendered display. Example:
$this->output->set_header("HTTP/1.0 200 OK");
@@ -125,10 +125,10 @@ $this->output->set_header("Pragma: no-cache");
$this->output->set_status_header(code, 'text');
-Permits you to manually set a server status header. Example:
+Permits you to manually set a server status header. Example:
$this->output->set_status_header('401');
-// Sets the header as: Unauthorized
+// Sets the header as: Unauthorized
See here for a full list of headers.
@@ -147,14 +147,14 @@ at the bottom of your pages for debugging and optimization purposes.Permits you to enable/disable specific sections of the Profiler when enabled. Please refer to the Profiler documentation for further information.
+Permits you to enable/disable specific sections of the Profiler when enabled. Please refer to the Profiler documentation for further information.
The CodeIgniter output library also controls caching. For more information, please see the caching documentation.
+The CodeIgniter output library also controls caching. For more information, please see the caching documentation.
CodeIgniter will parse the pseudo-variables {elapsed_time} and {memory_usage} in your output by default. To disable this, set the $parse_exec_vars class property to FALSE in your controller. +
CodeIgniter will parse the pseudo-variables {elapsed_time} and {memory_usage} in your output by default. To disable this, set the $parse_exec_vars class property to FALSE in your controller.
$this->output->parse_exec_vars = FALSE;
diff --git a/user_guide/libraries/pagination.html b/user_guide/libraries/pagination.html
index a6b9287a3..3c366a69f 100644
--- a/user_guide/libraries/pagination.html
+++ b/user_guide/libraries/pagination.html
@@ -72,26 +72,26 @@ Pagination Class
$this->load->library('pagination');
$config['base_url'] = 'http://example.com/index.php/test/page/';
$config['total_rows'] = 200;
-$config['per_page'] = 20;
+$config['per_page'] = 20;
$this->pagination->initialize($config);
-echo $this->pagination->create_links();
+echo $this->pagination->create_links();
The $config array contains your configuration variables. It is passed to the $this->pagination->initialize function as shown above. Although there are some twenty items you can configure, at -minimum you need the three shown. Here is a description of what those items represent:
+The $config array contains your configuration variables. It is passed to the $this->pagination->initialize function as shown above. Although there are some twenty items you can configure, at +minimum you need the three shown. Here is a description of what those items represent:
The create_links() function returns an empty string when there is no pagination to show.
@@ -100,7 +100,7 @@ minimum you need the three shown. Here is a description of what those items reprIf you prefer not to set preferences using the above method, you can instead put them into a config file. -Simply create a new file called pagination.php, add the $config +Simply create a new file called pagination.php, add the $config array in that file. Then save the file in: config/pagination.php and it will be used automatically. You will NOT need to use the $this->pagination->initialize function if you save your preferences in a config file.
@@ -122,9 +122,9 @@ something different you can specify it.By default, the pagination library assume you are using URI Segments, and constructs your links something like
http://example.com/index.php/test/page/20
If you have $config['enable_query_strings'] set to TRUE your links will automatically be re-written using Query Strings. This option can also be explictly set. Using $config['page_query_string'] set to TRUE, the pagination link will become.
+If you have $config['enable_query_strings'] set to TRUE your links will automatically be re-written using Query Strings. This option can also be explictly set. Using $config['page_query_string'] set to TRUE, the pagination link will become.
http://example.com/index.php?c=test&m=page&per_page=20
Note that "per_page" is the default query string passed, however can be configured using $config['query_string_segment'] = 'your_string'
+Note that "per_page" is the default query string passed, however can be configured using $config['query_string_segment'] = 'your_string'
If you would like to surround the entire pagination with some markup you can do it with these two prefs:
diff --git a/user_guide/libraries/parser.html b/user_guide/libraries/parser.html index 4f04aaf48..cb2f100a2 100644 --- a/user_guide/libraries/parser.html +++ b/user_guide/libraries/parser.html @@ -83,10 +83,10 @@ variables or variable tag pairs. If you've never used a template engine, pseudo- PHP from your templates (view files).Note: CodeIgniter does not require you to use this class -since using pure PHP in your view pages lets them run a little faster. However, some developers prefer to use a template engine if +since using pure PHP in your view pages lets them run a little faster. However, some developers prefer to use a template engine if they work with designers who they feel would find some confusion working with PHP.
-Also Note: The Template Parser Class is not a +
Also Note: The Template Parser Class is not a full-blown template parsing solution. We've kept it very lean on purpose in order to maintain maximum performance.
@@ -102,7 +102,7 @@ full-blown template parsing solution. We've kept it very lean on purpose in ordeThis method accepts a template name and data array as input, and it generates a parsed version. Example:
+This method accepts a template name and data array as input, and it generates a parsed version. Example:
$this->load->library('parser');
@@ -114,11 +114,11 @@ $data = array(
$this->parser->parse('blog_template', $data);
The first parameter contains the name of the view file (in this example the file would be called blog_template.php), -and the second parameter contains an associative array of data to be replaced in the template. In the above example, the +and the second parameter contains an associative array of data to be replaced in the template. In the above example, the template would contain two variables: {blog_title} and {blog_heading}
-There is no need to "echo" or do something with the data returned by $this->parser->parse(). It is automatically -passed to the output class to be sent to the browser. However, if you do want the data returned instead of sent to the output class you can +
There is no need to "echo" or do something with the data returned by $this->parser->parse(). It is automatically +passed to the output class to be sent to the browser. However, if you do want the data returned instead of sent to the output class you can pass TRUE (boolean) to the third parameter:
$string = $this->parser->parse('blog_template', $data, TRUE);
@@ -130,8 +130,8 @@ pass TRUE (boolean) to the third parameter:
The above example code allows simple variables to be replaced. What if you would like an entire block of variables to be -repeated, with each iteration containing new values? Consider the template example we showed at the top of the page:
+The above example code allows simple variables to be replaced. What if you would like an entire block of variables to be +repeated, with each iteration containing new values? Consider the template example we showed at the top of the page:
<html>
<head>
diff --git a/user_guide/libraries/security.html b/user_guide/libraries/security.html
index 0cb1d0cb1..735187459 100644
--- a/user_guide/libraries/security.html
+++ b/user_guide/libraries/security.html
@@ -63,11 +63,11 @@ Security Class
XSS Filtering
CodeIgniter comes with a Cross Site Scripting Hack prevention filter which can either run automatically to filter
-all POST and COOKIE data that is encountered, or you can run it on a per item basis. By default it does not
+all POST and COOKIE data that is encountered, or you can run it on a per item basis. By default it does not
run globally since it requires a bit of processing overhead, and since you may not need it in all cases.
The XSS filter looks for commonly used techniques to trigger Javascript or other types of code that attempt to hijack cookies
-or do other malicious things. If anything disallowed is encountered it is rendered safe by converting the data to character entities.
+or do other malicious things. If anything disallowed is encountered it is rendered safe by converting the data to character entities.
Note: This function should only be used to deal with data upon submission. It's not something that should be used for general runtime processing since it requires a fair amount of processing overhead.
@@ -88,7 +88,7 @@ Note: This function should only be used to deal with data upon submission. It's
Note: If you use the form validation class, it gives you the option of XSS filtering as well.
-An optional second parameter, is_image, allows this function to be used to test images for potential XSS attacks, useful for file upload security. When this second parameter is set to TRUE, instead of returning an altered string, the function returns TRUE if the image is safe, and FALSE if it contained potentially malicious information that a browser may attempt to execute.
+An optional second parameter, is_image, allows this function to be used to test images for potential XSS attacks, useful for file upload security. When this second parameter is set to TRUE, instead of returning an altered string, the function returns TRUE if the image is safe, and FALSE if it contained potentially malicious information that a browser may attempt to execute.
if ($this->security->xss_clean($file, TRUE) === FALSE)
{
@@ -98,7 +98,7 @@ Note: This function should only be used to deal with data upon submission. It's
$this->security->sanitize_filename()
-When accepting filenames from user input, it is best to sanitize them to prevent directory traversal and other security related issues. To do so, use the sanitize_filename() method of the Security class. Here is an example:
+When accepting filenames from user input, it is best to sanitize them to prevent directory traversal and other security related issues. To do so, use the sanitize_filename() method of the Security class. Here is an example:
$filename = $this->security->sanitize_filename($this->input->post('filename'));
diff --git a/user_guide/libraries/sessions.html b/user_guide/libraries/sessions.html
index bb8f1fc9b..a6f3c601c 100644
--- a/user_guide/libraries/sessions.html
+++ b/user_guide/libraries/sessions.html
@@ -61,7 +61,7 @@ Session Class
The Session class permits you maintain a user's "state" and track their activity while they browse your site.
The Session class stores session information for each user as serialized (and optionally encrypted) data in a cookie.
It can also store the session data in a database table for added security, as this permits the session ID in the
-user's cookie to be matched against the stored session ID. By default only the cookie is saved. If you choose to
+user's cookie to be matched against the stored session ID. By default only the cookie is saved. If you choose to
use the database option you'll need to create the session table as indicated below.
@@ -93,8 +93,8 @@ will cause it to read, create, and update sessions.
If sessions data does not exist (or if it has expired) a new session will be created and saved in the cookie.
If a session does exist, its information will be updated and the cookie will be updated. With each update, the session_id will be regenerated.
-It's important for you to understand that once initialized, the Session class runs automatically. There is nothing
-you need to do to cause the above behavior to happen. You can, as you'll see below, work with session data or
+
It's important for you to understand that once initialized, the Session class runs automatically. There is nothing
+you need to do to cause the above behavior to happen. You can, as you'll see below, work with session data or
even add your own data to a user's session, but the process of reading, writing, and updating a session is automatic.
@@ -106,7 +106,7 @@ even add your own data to a user's session, but the process of reading, writing,
- The user's unique Session ID (this is a statistically random string with very strong entropy, hashed with MD5 for portability, and regenerated (by default) every five minutes)
- The user's IP Address
- The user's User Agent data (the first 50 characters of the browser data string)
-- The "last activity" time stamp.
+- The "last activity" time stamp.
The above data is stored in a cookie as a serialized array with this prototype:
@@ -124,7 +124,7 @@ making the data highly secure and impervious to being read or altered by someone can be found here, although the Session class will take care of initializing and encrypting the data automatically. -Note: Session cookies are only updated every five minutes by default to reduce processor load. If you repeatedly reload a page +
Note: Session cookies are only updated every five minutes by default to reduce processor load. If you repeatedly reload a page you'll notice that the "last activity" time only updates if five minutes or more has passed since the last time the cookie was written. This time is configurable by changing the $config['sess_time_to_update'] line in your system/config/config.php file.
@@ -134,7 +134,7 @@ the cookie was written. This time is configurable by changing the $config['sess_$this->session->userdata('item');
-Where item is the array index corresponding to the item you wish to fetch. For example, to fetch the session ID you +
Where item is the array index corresponding to the item you wish to fetch. For example, to fetch the session ID you will do this:
$session_id = $this->session->userdata('session_id');
@@ -145,7 +145,7 @@ will do this:
A useful aspect of the session array is that you can add your own data to it and it will be stored in the user's cookie. -Why would you want to do this? Here's one example:
+Why would you want to do this? Here's one example:Let's say a particular user logs into your site. Once authenticated, you could add their username and email address to the session cookie, making that data globally available to you without @@ -155,7 +155,7 @@ having to run a database query when you need it.
$this->session->set_userdata($array);
-Where $array is an associative array containing your new data. Here's an example:
+Where $array is an associative array containing your new data. Here's an example:
$newdata = array(
@@ -167,7 +167,7 @@ having to run a database query when you need it.
If you want to add userdata one value at a time, set_userdata() also supports this syntax.
$this->session->set_userdata('some_name', 'some_value');
Note: Cookies can only hold 4KB of data, so be careful not to exceed the capacity. The +
Note: Cookies can only hold 4KB of data, so be careful not to exceed the capacity. The encryption process in particular produces a longer data string than the original so keep careful track of how much data you are storing.
Array ( - [session_id] => 4a5a5dca22728fb0a84364eeb405b601 - [ip_address] => 127.0.0.1 - [user_agent] => Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; - [last_activity] => 1303142623 + [session_id] => 4a5a5dca22728fb0a84364eeb405b601 + [ip_address] => 127.0.0.1 + [user_agent] => Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7; + [last_activity] => 1303142623 )@@ -206,20 +206,20 @@ $this->session->unset_userdata($array_items);
$this->session->keep_flashdata('item');
While the session data array stored in the user's cookie contains a Session ID, -unless you store session data in a database there is no way to validate it. For some applications that require little or no -security, session ID validation may not be needed, but if your application requires security, validation is mandatory. Otherwise, an old session +unless you store session data in a database there is no way to validate it. For some applications that require little or no +security, session ID validation may not be needed, but if your application requires security, validation is mandatory. Otherwise, an old session could be restored by a user modifying their cookies.
When session data is available in a database, every time a valid session is found in the user's cookie, a database -query is performed to match it. If the session ID does not match, the session is destroyed. Session IDs can never +query is performed to match it. If the session ID does not match, the session is destroyed. Session IDs can never be updated, they can only be generated when a new session is created.
-In order to store sessions, you must first create a database table for this purpose. Here is the basic +
In order to store sessions, you must first create a database table for this purpose. Here is the basic prototype (for MySQL) required by the session class:
To clear the current session:
$this->session->sess_destroy();
-Note: This function should be the last one called, and even flash variables will no longer be available. If you only want some items destroyed and not all, use unset_userdata().
+Note: This function should be the last one called, and even flash variables will no longer be available. If you only want some items destroyed and not all, use unset_userdata().
@@ -292,7 +292,7 @@ do not need to write your own routine to do it.The Table Class permits you to set a table template with which you can specify the design of your layout. Here is the template +
The Table Class permits you to set a table template with which you can specify the design of your layout. Here is the template prototype:
-$tmpl = array (
+$tmpl = array (
'table_open' => '<table border="0" cellpadding="4" cellspacing="0">',
'heading_row_start' => '<tr>',
@@ -159,14 +159,14 @@ $tmpl = array (
$this->table->set_template($tmpl);
-Note: You'll notice there are two sets of "row" blocks in the template. These permit you to create alternating row colors or design elements that alternate with each +
Note: You'll notice there are two sets of "row" blocks in the template. These permit you to create alternating row colors or design elements that alternate with each iteration of the row data.
-You are NOT required to submit a complete template. If you only need to change parts of the layout you can simply submit those elements. +
You are NOT required to submit a complete template. If you only need to change parts of the layout you can simply submit those elements. In this example, only the table opening tag is being changed:
-$tmpl = array ( 'table_open' => '<table border="1" cellpadding="2" cellspacing="1" class="mytable">' );
+$tmpl = array ( 'table_open' => '<table border="1" cellpadding="2" cellspacing="1" class="mytable">' );
$this->table->set_template($tmpl);
@@ -176,7 +176,7 @@ $this->table->set_template($tmpl);
Function Reference
$this->table->generate()
-Returns a string containing the generated table. Accepts an optional parameter which can be an array or a database result object.
+Returns a string containing the generated table. Accepts an optional parameter which can be an array or a database result object.
$this->table->set_caption()
@@ -186,19 +186,19 @@ $this->table->set_template($tmpl);
$this->table->set_heading()
-Permits you to set the table heading. You can submit an array or discrete params:
+Permits you to set the table heading. You can submit an array or discrete params:
$this->table->set_heading('Name', 'Color', 'Size');
$this->table->set_heading(array('Name', 'Color', 'Size'));
$this->table->add_row()
-Permits you to add a row to your table. You can submit an array or discrete params:
+Permits you to add a row to your table. You can submit an array or discrete params:
$this->table->add_row('Blue', 'Red', 'Green');
$this->table->add_row(array('Blue', 'Red', 'Green'));
-If you would like to set an individual cell's tag attributes, you can use an associative array for that cell. The associative key 'data' defines the cell's data. Any other key => val pairs are added as key='val' attributes to the tag:
+If you would like to set an individual cell's tag attributes, you can use an associative array for that cell. The associative key 'data' defines the cell's data. Any other key => val pairs are added as key='val' attributes to the tag:
$cell = array('data' => 'Blue', 'class' => 'highlight', 'colspan' => 2);
$this->table->add_row($cell, 'Red', 'Green');
@@ -211,8 +211,8 @@ $this->table->add_row($cell, 'Red', 'Green');
This function takes a one-dimensional array as input and creates
a multi-dimensional array with a depth equal to the number of
-columns desired. This allows a single array with many elements to be
-displayed in a table that has a fixed column count. Consider this example:
+columns desired. This allows a single array with many elements to be
+displayed in a table that has a fixed column count. Consider this example:
$list = array('one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve');
@@ -241,7 +241,7 @@ $this->table->generate($new_list);
Permits you to set your template. You can submit a full or partial template.
-$tmpl = array ( 'table_open' => '<table border="1" cellpadding="2" cellspacing="1" class="mytable">' );
+$tmpl = array ( 'table_open' => '<table border="1" cellpadding="2" cellspacing="1" class="mytable">' );
$this->table->set_template($tmpl);
@@ -250,7 +250,7 @@ $this->table->set_template($tmpl);
$this->table->set_empty()
-Let's you set a default value for use in any table cells that are empty. You might, for example, set a non-breaking space:
+Let's you set a default value for use in any table cells that are empty. You might, for example, set a non-breaking space:
$this->table->set_empty(" ");
@@ -258,7 +258,7 @@ $this->table->set_empty(" ");
$this->table->clear()
-Lets you clear the table heading and row data. If you need to show multiple tables with different data you should
+
Lets you clear the table heading and row data. If you need to show multiple tables with different data you should
to call this function after each table has been generated to empty the previous table information. Example:
diff --git a/user_guide/libraries/trackback.html b/user_guide/libraries/trackback.html
index 4f5ca6ce1..7f89b4f5e 100644
--- a/user_guide/libraries/trackback.html
+++ b/user_guide/libraries/trackback.html
@@ -101,29 +101,29 @@ else
ping_url - The URL of the site you are sending the Trackback to. You can send Trackbacks to multiple URLs by separating each URL with a comma.
url - The URL to YOUR site where the weblog entry can be seen.
title - The title of your weblog entry.
-excerpt - The content of your weblog entry. Note: the Trackback class will automatically send only the first 500 characters of your entry. It will also strip all HTML.
+excerpt - The content of your weblog entry. Note: the Trackback class will automatically send only the first 500 characters of your entry. It will also strip all HTML.
blog_name - The name of your weblog.
-charset - The character encoding your weblog is written in. If omitted, UTF-8 will be used.
+charset - The character encoding your weblog is written in. If omitted, UTF-8 will be used.
-The Trackback sending function returns TRUE/FALSE (boolean) on success or failure. If it fails, you can retrieve the error message using:
+The Trackback sending function returns TRUE/FALSE (boolean) on success or failure. If it fails, you can retrieve the error message using:
$this->trackback->display_errors();
Receiving Trackbacks
-Before you can receive Trackbacks you must create a weblog. If you don't have a blog yet there's no point in continuing.
+Before you can receive Trackbacks you must create a weblog. If you don't have a blog yet there's no point in continuing.
Receiving Trackbacks is a little more complex than sending them, only because you will need a database table in which to store them,
-and you will need to validate the incoming trackback data. You are encouraged to implement a thorough validation process to
-guard against spam and duplicate data. You may also want to limit the number of Trackbacks you allow from a particular IP within
-a given span of time to further curtail spam. The process of receiving a Trackback is quite simple;
+and you will need to validate the incoming trackback data. You are encouraged to implement a thorough validation process to
+guard against spam and duplicate data. You may also want to limit the number of Trackbacks you allow from a particular IP within
+a given span of time to further curtail spam. The process of receiving a Trackback is quite simple;
the validation is what takes most of the effort.
Your Ping URL
-In order to accept Trackbacks you must display a Trackback URL next to each one of your weblog entries. This will be the URL
+
In order to accept Trackbacks you must display a Trackback URL next to each one of your weblog entries. This will be the URL
that people will use to send you Trackbacks (we will refer to this as your "Ping URL").
Your Ping URL must point to a controller function where your Trackback receiving code is located, and the URL
@@ -140,7 +140,7 @@ Ping URLs will look something like this:
Creating a Trackback Table
-Before you can receive Trackbacks you must create a table in which to store them. Here is a basic prototype for such a table:
+Before you can receive Trackbacks you must create a table in which to store them. Here is a basic prototype for such a table:
CREATE TABLE trackbacks (
@@ -162,7 +162,7 @@ but to make the data more useful we've added a few more fields in the above tabl
Processing a Trackback
-Here is an example showing how you will receive and process a Trackback. The following
+
Here is an example showing how you will receive and process a Trackback. The following
code is intended for use within the controller function where you expect to receive Trackbacks.
$this->load->library('trackback');
@@ -196,7 +196,7 @@ $this->trackback->send_success();
Notes:
-The entry ID number is expected in the third segment of your URL. This is based on the URI example we gave earlier:
+The entry ID number is expected in the third segment of your URL. This is based on the URI example we gave earlier:
http://example.com/index.php/trackback/receive/entry_id
@@ -204,12 +204,12 @@ $this->trackback->send_success();
$this->uri->segment(3);
-In our Trackback receiving code above, if the third segment is missing, we will issue an error. Without a valid entry ID, there's no
+
In our Trackback receiving code above, if the third segment is missing, we will issue an error. Without a valid entry ID, there's no
reason to continue.
The $this->trackback->receive() function is simply a validation function that looks at the incoming data
and makes sure it contains the four pieces of data that are required (url, title, excerpt, blog_name).
-It returns TRUE on success and FALSE on failure. If it fails you will issue an error message.
+It returns TRUE on success and FALSE on failure. If it fails you will issue an error message.
The incoming Trackback data can be retrieved using this function:
diff --git a/user_guide/libraries/typography.html b/user_guide/libraries/typography.html
index 333f77a7d..895e76f7d 100644
--- a/user_guide/libraries/typography.html
+++ b/user_guide/libraries/typography.html
@@ -71,7 +71,7 @@ Typography Class
auto_typography()
-Formats text so that it is semantically and typographically correct HTML. Takes a string as input and returns it with
+
Formats text so that it is semantically and typographically correct HTML. Takes a string as input and returns it with
the following formatting:
@@ -133,7 +133,7 @@ This function is identical to the native PHP nl2br() function, except
protect_braced_quotes
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 protect_braced_quotes class property to TRUE.
+ and double quotes within curly braces. To enable this, set the protect_braced_quotes class property to TRUE.
Usage example:
diff --git a/user_guide/libraries/unit_testing.html b/user_guide/libraries/unit_testing.html
index a4305129f..5e0c4c16b 100644
--- a/user_guide/libraries/unit_testing.html
+++ b/user_guide/libraries/unit_testing.html
@@ -92,7 +92,7 @@ $test_name = 'Adds one plus one';
$this->unit->run($test, $expected_result, $test_name);
-The expected result you supply can either be a literal match, or a data type match. Here's an example of a literal:
+The expected result you supply can either be a literal match, or a data type match. Here's an example of a literal:
$this->unit->run('Foo', 'Foo');
@@ -100,8 +100,8 @@ $this->unit->run($test, $expected_result, $test_name);
$this->unit->run('Foo', 'is_string');
-Notice the use of "is_string" in the second parameter? This tells the function to evaluate whether your test is producing a string
-as the result. Here is a list of allowed comparison types:
+Notice the use of "is_string" in the second parameter? This tells the function to evaluate whether your test is producing a string
+as the result. Here is a list of allowed comparison types:
- is_object
@@ -129,18 +129,18 @@ To show a report directly simply echo or return the run function:
echo $this->unit->report();
-The report will be formatted in an HTML table for viewing. If you prefer the raw data you can retrieve an array using:
+The report will be formatted in an HTML table for viewing. If you prefer the raw data you can retrieve an array using:
echo $this->unit->result();
Strict Mode
-By default the unit test class evaluates literal matches loosely. Consider this example:
+By default the unit test class evaluates literal matches loosely. Consider this example:
$this->unit->run(1, TRUE);
-The test is evaluating an integer, but the expected result is a boolean. PHP, however, due to it's loose data-typing
+
The test is evaluating an integer, but the expected result is a boolean. PHP, however, due to it's loose data-typing
will evaluate the above code as TRUE using a normal equality test:
if (1 == TRUE) echo 'This evaluates as true';
@@ -184,8 +184,8 @@ You can customize which of these items get displayed by using $this->unit->
Creating a Template
-If you would like your test results formatted differently then the default you can set your own template. Here is an
-example of a simple template. Note the required pseudo-variables:
+If you would like your test results formatted differently then the default you can set your own template. Here is an
+example of a simple template. Note the required pseudo-variables:
$str = '
diff --git a/user_guide/libraries/uri.html b/user_guide/libraries/uri.html
index 884f4b955..e4e0f9d3f 100644
--- a/user_guide/libraries/uri.html
+++ b/user_guide/libraries/uri.html
@@ -106,7 +106,7 @@ re-routed URI in the event you are using CodeIgniter's $this->uri->uri_to_assoc(n)
-This function lets you turn URI segments into and associative array of key/value pairs. Consider this URI:
+This function lets you turn URI segments into and associative array of key/value pairs. Consider this URI:
index.php/user/search/name/joe/location/UK/gender/male
@@ -143,7 +143,7 @@ re-routed URI in the event you are using CodeIgniter's $this->uri->assoc_to_uri()
-Takes an associative array as input and generates a URI string from it. The array keys will be included in the string. Example:
+Takes an associative array as input and generates a URI string from it. The array keys will be included in the string. Example:
$array = array('product' => 'shoes', 'size' => 'large', 'color' => 'red');
$str = $this->uri->assoc_to_uri($array);
-// Produces: product/shoes/size/large/color/red
+// Produces: product/shoes/size/large/color/red
$this->uri->uri_string()
-Returns a string with the complete URI. For example, if this is your full URL:
+Returns a string with the complete URI. For example, if this is your full URL:
http://example.com/index.php/news/local/345
@@ -215,7 +215,7 @@ re-routed URI in the event you are using CodeIgniter's Note: The user agent library only contains the most common robot
-definitions. It is not a complete list of bots. There are hundreds of them so searching for each one would not be
+definitions. It is not a complete list of bots. There are hundreds of them so searching for each one would not be
very efficient. If you find that some bots that commonly visit your site are missing from the list you can add them to your
application/config/user_agents.php file.
@@ -176,7 +176,7 @@ very efficient. If you find that some bots that commonly visit your site are mis
$this->agent->agent_string()
-Returns a string containing the full user agent string. Typically it will be something like this:
+Returns a string containing the full user agent string. Typically it will be something like this:
Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en-US; rv:1.8.0.4) Gecko/20060613 Camino/1.0.2
diff --git a/user_guide/libraries/xmlrpc.html b/user_guide/libraries/xmlrpc.html
index f7aa6fe42..5ba851341 100644
--- a/user_guide/libraries/xmlrpc.html
+++ b/user_guide/libraries/xmlrpc.html
@@ -67,11 +67,11 @@ your own XML-RPC server to receive requests.
Quite simply it is a way for two computers to communicate over the internet using XML.
One computer, which we will call the client, sends an XML-RPC request to
-another computer, which we will call the server. Once the server receives and processes the request it
+another computer, which we will call the server. Once the server receives and processes the request it
will send back a response to the client.
For example, using the MetaWeblog API, an XML-RPC Client (usually a desktop publishing tool) will
-send a request to an XML-RPC Server running on your site. This request might be a new weblog entry
+send a request to an XML-RPC Server running on your site. This request might be a new weblog entry
being sent for publication, or it could be a request for an existing entry for editing.
When the XML-RPC Server receives this request it will examine it to determine which class/method should be called to process the request.
@@ -127,16 +127,16 @@ if ( ! $this->xmlrpc->send_request())
Explanation
-The above code initializes the XML-RPC class, sets the server URL and method to be called (weblogUpdates.ping). The
+
The above code initializes the XML-RPC class, sets the server URL and method to be called (weblogUpdates.ping). The
request (in this case, the title and URL of your site) is placed into an array for transportation, and
compiled using the request() function.
-Lastly, the full request is sent. If the send_request() method returns false we will display the error message
+Lastly, the full request is sent. If the send_request() method returns false we will display the error message
sent back from the XML-RPC Server.
Anatomy of a Request
-An XML-RPC request is simply the data you are sending to the XML-RPC server. Each piece of data in a request
-is referred to as a request parameter. The above example has two parameters:
+
An XML-RPC request is simply the data you are sending to the XML-RPC server. Each piece of data in a request
+is referred to as a request parameter. The above example has two parameters:
The URL and title of your site. When the XML-RPC server receives your request, it will look for parameters it requires.
Request parameters must be placed into an array for transportation, and each parameter can be one
@@ -161,7 +161,7 @@ $request = array (
$this->xmlrpc->request($request);
-The Data Types section below has a full list of data types.
+The Data Types section below has a full list of data types.
@@ -198,7 +198,7 @@ server will load the My_blog class and call the new_entry
If the request is for the update_post method, your
server will load the My_blog class and call the update_entry function.
-The function names in the above example are arbitrary. You'll decide what they should be called on your server,
+
The function names in the above example are arbitrary. You'll decide what they should be called on your server,
or if you are using standardized APIs, like the Blogger or MetaWeblog API, you'll use their function names.
There are two additional configuration keys you may make use of when initializing the server class: debug can be set to TRUE in order to enable debugging, and xss_clean may be set to FALSE to prevent sending data through the Security library's xss_clean function.
@@ -221,12 +221,12 @@ to exist with this prototype:
The $request variable is an object compiled by the Server, which contains the data sent by the XML-RPC Client.
-Using this object you will have access to the request parameters enabling you to process the request. When
+Using this object you will have access to the request parameters enabling you to process the request. When
you are done you will send a Response back to the Client.
-Below is a real-world example, using the Blogger API. One of the methods in the Blogger API is getUserInfo().
+
Below is a real-world example, using the Blogger API. One of the methods in the Blogger API is getUserInfo().
Using this method, an XML-RPC Client can send the Server a username and password, in return the Server sends
-back information about that particular user (nickname, user ID, email address, etc.). Here is how the processing
+back information about that particular user (nickname, user ID, email address, etc.). Here is how the processing
function might look:
@@ -272,14 +272,14 @@ In the above example, the output parameters will be the username and password.
Formatting a Response
-Similar to Requests, Responses must be formatted as an array. However, unlike requests, a response is an array
-that contains a single item. This item can be an array with several additional arrays, but there
-can be only one primary array index. In other words, the basic prototype is this:
+Similar to Requests, Responses must be formatted as an array. However, unlike requests, a response is an array
+that contains a single item. This item can be an array with several additional arrays, but there
+can be only one primary array index. In other words, the basic prototype is this:
-$response = array('Response data', 'array');
+$response = array('Response data', 'array');
Responses, however, usually contain multiple pieces of information. In order to accomplish this we must put the response into its own
-array so that the primary array continues to contain a single piece of data. Here's an example showing how this might be accomplished:
+array so that the primary array continues to contain a single piece of data. Here's an example showing how this might be accomplished:
$response = array (
@@ -293,9 +293,9 @@ $response = array (
);
-Notice that the above array is formatted as a struct. This is the most common data type for responses.
+Notice that the above array is formatted as a struct. This is the most common data type for responses.
-As with Requests, a response can be one of the seven data types listed in the Data Types section.
+As with Requests, a response can be one of the seven data types listed in the Data Types section.
Sending an Error Response
@@ -314,7 +314,7 @@ $response = array (
Creating Your Own Client and Server
To help you understand everything we've covered thus far, let's create a couple controllers that act as
-XML-RPC Client and Server. You'll use the Client to send a request to the Server and receive a response.
+XML-RPC Client and Server. You'll use the Client to send a request to the Server and receive a response.
The Client
@@ -352,7 +352,7 @@ class Xmlrpc_client extends CI_Controller {
}
?>
-Note: In the above code we are using a "url helper". You can find more information in the Helpers Functions page.
+Note: In the above code we are using a "url helper". You can find more information in the Helpers Functions page.
The Server
@@ -381,7 +381,7 @@ class Xmlrpc_server extends CI_Controller {
$response = array(
array(
- 'you_said' => $parameters['0'],
+ 'you_said' => $parameters['0'],
'i_respond' => 'Not bad at all.'),
'struct');
@@ -452,7 +452,7 @@ The Server receives the request and maps it to the "process" function, where a r
$this->xmlrpc->request($request);
$this->xmlrpc->send_request()
-The request sending function. Returns boolean TRUE or FALSE based on success for failure, enabling it to be used conditionally.
+The request sending function. Returns boolean TRUE or FALSE based on success for failure, enabling it to be used conditionally.
$this->xmlrpc->set_debug(TRUE);
Enables debugging, which will display a variety of information and error data helpful during development.
@@ -463,7 +463,7 @@ $this->xmlrpc->request($request);
echo $this->xmlrpc->display_error();
Returns the response from the remote server once request is received. The response will typically be an associative array.
+Returns the response from the remote server once request is received. The response will typically be an associative array.
$this->xmlrpc->display_response();
You are allowed multiple calls to this function in order to -add several files to your archive. Example:
+add several files to your archive. Example:
$name = 'mydata1.txt';
@@ -139,8 +139,8 @@ $this->zip->add_data($name, $data);
$this->zip->add_dir()
-Permits you to add a directory. Usually this function is unnecessary since you can place your data into folders when
-using $this->zip->add_data(), but if you would like to create an empty folder you can do so. Example:
+Permits you to add a directory. Usually this function is unnecessary since you can place your data into folders when
+using $this->zip->add_data(), but if you would like to create an empty folder you can do so. Example:
$this->zip->add_dir('myfolder'); // Creates a folder called "myfolder"
@@ -148,49 +148,49 @@ using $this->zip->add_data(), but if you would like to create an empt
$this->zip->read_file()
-Permits you to compress a file that already exists somewhere on your server. Supply a file path and the zip class will
+
Permits you to compress a file that already exists somewhere on your server. Supply a file path and the zip class will
read it and add it to the archive:
$path = '/path/to/photo.jpg';
$this->zip->read_file($path);
- // Download the file to your desktop. Name it "my_backup.zip"
+ // Download the file to your desktop. Name it "my_backup.zip"
$this->zip->download('my_backup.zip');
If you would like the Zip archive to maintain the directory structure of the file in it, pass TRUE (boolean) in the
-second parameter. Example:
+second parameter. Example:
$path = '/path/to/photo.jpg';
$this->zip->read_file($path, TRUE);
- // Download the file to your desktop. Name it "my_backup.zip"
+ // Download the file to your desktop. Name it "my_backup.zip"
$this->zip->download('my_backup.zip');
-In the above example, photo.jpg will be placed inside two folders: path/to/
+In the above example, photo.jpg will be placed inside two folders: path/to/
$this->zip->read_dir()
-Permits you to compress a folder (and its contents) that already exists somewhere on your server. Supply a file path to the
-directory and the zip class will recursively read it and recreate it as a Zip archive. All files contained within the
-supplied path will be encoded, as will any sub-folders contained within it. Example:
+Permits you to compress a folder (and its contents) that already exists somewhere on your server. Supply a file path to the
+directory and the zip class will recursively read it and recreate it as a Zip archive. All files contained within the
+supplied path will be encoded, as will any sub-folders contained within it. Example:
$path = '/path/to/your/directory/';
$this->zip->read_dir($path);
- // Download the file to your desktop. Name it "my_backup.zip"
+ // Download the file to your desktop. Name it "my_backup.zip"
$this->zip->download('my_backup.zip');
By default the Zip archive will place all directories listed in the first parameter inside the zip. If you want the tree preceding the target folder to be ignored
-you can pass FALSE (boolean) in the second parameter. Example:
+you can pass FALSE (boolean) in the second parameter. Example:
$path = '/path/to/your/directory/';
@@ -204,7 +204,7 @@ $this->zip->read_dir($path, FALSE);
$this->zip->archive()
-Writes the Zip-encoded file to a directory on your server. Submit a valid server path ending in the file name. Make sure the
+
Writes the Zip-encoded file to a directory on your server. Submit a valid server path ending in the file name. Make sure the
directory is writable (666 or 777 is usually OK). Example:
$this->zip->archive('/path/to/folder/myarchive.zip'); // Creates a file named myarchive.zip
@@ -223,7 +223,7 @@ that cause the download to happen and the file to be treated as binary.
$this->zip->get_zip()
-Returns the Zip-compressed file data. Generally you will not need this function unless you want to do something unique with the data.
+
Returns the Zip-compressed file data. Generally you will not need this function unless you want to do something unique with the data.
Example:
diff --git a/user_guide/license.html b/user_guide/license.html
index ecc5b500d..8f53851a7 100644
--- a/user_guide/license.html
+++ b/user_guide/license.html
@@ -63,7 +63,7 @@ License Agreement
Copyright (c) 2008 - 2011, EllisLab, Inc.
All rights reserved.
-This license is a legal agreement between you and EllisLab Inc. for the use of CodeIgniter Software (the "Software"). By obtaining the Software you agree to comply with the terms and conditions of this license.
+This license is a legal agreement between you and EllisLab Inc. for the use of CodeIgniter Software (the "Software"). By obtaining the Software you agree to comply with the terms and conditions of this license.
Permitted Use
You are permitted to use, copy, modify, and distribute the Software and its documentation, with or without modification, for any purpose, provided that the following conditions are met:
diff --git a/user_guide/nav/hacks.txt b/user_guide/nav/hacks.txt
index 183481b78..8c17f008a 100644
--- a/user_guide/nav/hacks.txt
+++ b/user_guide/nav/hacks.txt
@@ -1,6 +1,6 @@
I did the following hack in moo.fx.js:
-At line 79 in the toggle: function() function, I added:
+At line 79 in the toggle: function() function, I added:
document.getElementById('nav').style.display = 'block';
diff --git a/user_guide/nav/moo.fx.js b/user_guide/nav/moo.fx.js
index b21ee20e0..256371d19 100755
--- a/user_guide/nav/moo.fx.js
+++ b/user_guide/nav/moo.fx.js
@@ -25,8 +25,8 @@ fx.Base.prototype = {
},
step: function() {
- var time = (new Date).getTime();
- var Tpos = (time - this.startTime) / (this.duration);
+ var time = (new Date).getTime();
+ var Tpos = (time - this.startTime) / (this.duration);
if (time >= this.duration+this.startTime) {
this.now = this.to;
clearInterval (this.timer);
diff --git a/user_guide/nav/prototype.lite.js b/user_guide/nav/prototype.lite.js
index 857faae4d..e6c362279 100755
--- a/user_guide/nav/prototype.lite.js
+++ b/user_guide/nav/prototype.lite.js
@@ -1,9 +1,9 @@
-/* Prototype JavaScript framework
- * (c) 2005 Sam Stephenson
+/* Prototype JavaScript framework
+ * (c) 2005 Sam Stephenson
*
- * Prototype is freely distributable under the terms of an MIT-style license.
+ * Prototype is freely distributable under the terms of an MIT-style license.
*
- * For details, see the Prototype web site: http://prototype.conio.net/
+ * For details, see the Prototype web site: http://prototype.conio.net/
*
/*--------------------------------------------------------------------------*/
@@ -11,117 +11,117 @@
//note: this is a stripped down version of prototype, to be used with moo.fx by mad4milk (http://moofx.mad4milk.net).
var Class = {
- create: function() {
+ create: function() {
return function() {
- this.initialize.apply(this, arguments);
+ this.initialize.apply(this, arguments);
}
- }
+ }
}
Object.extend = function(destination, source) {
- for (property in source) {
+ for (property in source) {
destination[property] = source[property];
- }
- return destination;
+ }
+ return destination;
}
Function.prototype.bind = function(object) {
- var __method = this;
- return function() {
+ var __method = this;
+ return function() {
return __method.apply(object, arguments);
- }
+ }
}
function $() {
- var elements = new Array();
+ var elements = new Array();
- for (var i = 0; i < arguments.length; i++) {
+ for (var i = 0; i < arguments.length; i++) {
var element = arguments[i];
if (typeof element == 'string')
- element = document.getElementById(element);
+ element = document.getElementById(element);
if (arguments.length == 1)
- return element;
+ return element;
elements.push(element);
- }
+ }
- return elements;
+ return elements;
}
//-------------------------
document.getElementsByClassName = function(className) {
- var children = document.getElementsByTagName('*') || document.all;
- var elements = new Array();
+ var children = document.getElementsByTagName('*') || document.all;
+ var elements = new Array();
- for (var i = 0; i < children.length; i++) {
+ for (var i = 0; i < children.length; i++) {
var child = children[i];
var classNames = child.className.split(' ');
for (var j = 0; j < classNames.length; j++) {
- if (classNames[j] == className) {
+ if (classNames[j] == className) {
elements.push(child);
break;
- }
+ }
}
- }
+ }
- return elements;
+ return elements;
}
//-------------------------
if (!window.Element) {
- var Element = new Object();
+ var Element = new Object();
}
Object.extend(Element, {
- remove: function(element) {
+ remove: function(element) {
element = $(element);
element.parentNode.removeChild(element);
- },
+ },
- hasClassName: function(element, className) {
+ hasClassName: function(element, className) {
element = $(element);
if (!element)
- return;
+ return;
var a = element.className.split(' ');
for (var i = 0; i < a.length; i++) {
- if (a[i] == className)
+ if (a[i] == className)
return true;
}
return false;
- },
+ },
- addClassName: function(element, className) {
+ addClassName: function(element, className) {
element = $(element);
Element.removeClassName(element, className);
element.className += ' ' + className;
- },
+ },
- removeClassName: function(element, className) {
+ removeClassName: function(element, className) {
element = $(element);
if (!element)
- return;
+ return;
var newClassName = '';
var a = element.className.split(' ');
for (var i = 0; i < a.length; i++) {
- if (a[i] != className) {
+ if (a[i] != className) {
if (i > 0)
- newClassName += ' ';
+ newClassName += ' ';
newClassName += a[i];
- }
+ }
}
element.className = newClassName;
- },
+ },
- // removes whitespace-only text node children
- cleanWhitespace: function(element) {
+ // removes whitespace-only text node children
+ cleanWhitespace: function(element) {
element = $(element);
for (var i = 0; i < element.childNodes.length; i++) {
- var node = element.childNodes[i];
- if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
+ var node = element.childNodes[i];
+ if (node.nodeType == 3 && !/\S/.test(node.nodeValue))
Element.remove(node);
}
- }
+ }
});
\ No newline at end of file
diff --git a/user_guide/overview/appflow.html b/user_guide/overview/appflow.html
index 3b1c42e4c..bcbc43ff8 100644
--- a/user_guide/overview/appflow.html
+++ b/user_guide/overview/appflow.html
@@ -67,7 +67,7 @@ Appflow
The index.php serves as the front controller, initializing the base resources needed to run CodeIgniter.
The Router examines the HTTP request to determine what should be done with it.
If a cache file exists, it is sent directly to the browser, bypassing the normal system execution.
-Security. Before the application controller is loaded, the HTTP request and any user submitted data is filtered for security.
+Security. Before the application controller is loaded, the HTTP request and any user submitted data is filtered for security.
The Controller loads the model, core libraries, helpers, and any other resources needed to process the specific request.
The finalized View is rendered then sent to the web browser to be seen. If caching is enabled, the view is cached first so
that on subsequent requests it can be served.
diff --git a/user_guide/overview/at_a_glance.html b/user_guide/overview/at_a_glance.html
index 1175e7f42..b6b81d760 100644
--- a/user_guide/overview/at_a_glance.html
+++ b/user_guide/overview/at_a_glance.html
@@ -60,7 +60,7 @@ What is CodeIgniter?
CodeIgniter is an Application Framework
-CodeIgniter is a toolkit for people who build web applications using PHP. Its goal is to enable you to develop projects much faster than you could if you were writing code
+
CodeIgniter is a toolkit for people who build web applications using PHP. Its goal is to enable you to develop projects much faster than you could if you were writing code
from scratch, by providing a rich set of libraries for commonly needed tasks, as well as a simple interface and
logical structure to access these libraries. CodeIgniter lets you creatively focus on your project by
minimizing the amount of code needed for a given task.
@@ -70,7 +70,7 @@ minimizing the amount of code needed for a given task.
For more information please read the license agreement.
CodeIgniter is Light Weight
-Truly light weight. The core system requires only a few very small libraries. This is in stark contrast to many frameworks that require significantly more resources.
+
Truly light weight. The core system requires only a few very small libraries. This is in stark contrast to many frameworks that require significantly more resources.
Additional libraries are loaded dynamically upon request, based on your needs for a given process, so the base system
is very lean and quite fast.
@@ -84,7 +84,7 @@ is very lean and quite fast.
This is particularly good for projects in which designers are working with your template files, as the code these file contain will be minimized. We describe MVC in more detail on its own page.
CodeIgniter Generates Clean URLs
-The URLs generated by CodeIgniter are clean and search-engine friendly. Rather than using the standard "query string"
+
The URLs generated by CodeIgniter are clean and search-engine friendly. Rather than using the standard "query string"
approach to URLs that is synonymous with dynamic systems, CodeIgniter uses a segment-based approach:
example.com/news/article/345
@@ -92,7 +92,7 @@ approach to URLs that is synonymous with dynamic systems, CodeIgniter uses a seg
Note: By default the index.php file is included in the URL but it can be removed using a simple .htaccess file.
CodeIgniter Packs a Punch
-CodeIgniter comes with full-range of libraries that enable the most commonly needed web development tasks,
+
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
much more.
@@ -104,7 +104,7 @@ much more.
Although CodeIgniter does come with a simple template parser that can be optionally used, it does not force you to use one.
Template engines simply can not match the performance of native PHP, and the syntax that must be learned to use a template
-engine is usually only marginally easier than learning the basics of PHP. Consider this block of PHP code:
+engine is usually only marginally easier than learning the basics of PHP. Consider this block of PHP code:
<ul>
@@ -133,7 +133,7 @@ back into PHP to run. Since one of our goals is maximum performance, we
CodeIgniter is Thoroughly Documented
-Programmers love to code and hate to write documentation. We're no different, of course, but
+
Programmers love to code and hate to write documentation. We're no different, of course, but
since documentation is as important as the code itself,
we are committed to doing it. Our source code is extremely clean and well commented as well.
diff --git a/user_guide/overview/features.html b/user_guide/overview/features.html
index 4209463b1..e20219e0f 100644
--- a/user_guide/overview/features.html
+++ b/user_guide/overview/features.html
@@ -59,10 +59,10 @@ Features
CodeIgniter Features
Features in and of themselves are a very poor way to judge an application since they tell you nothing
-about the user experience, or how intuitively or intelligently it is designed. Features
+about the user experience, or how intuitively or intelligently it is designed. Features
don't reveal anything about the quality of the code, or the performance, or the attention to detail, or security practices.
The only way to really judge an app is to try it and get to know the code. Installing
-CodeIgniter is child's play so we encourage you to do just that. In the mean time here's a list of CodeIgniter's main features.
+CodeIgniter is child's play so we encourage you to do just that. In the mean time here's a list of CodeIgniter's main features.
- Model-View-Controller Based System
@@ -73,7 +73,7 @@ CodeIgniter is child's play so we encourage you to do just that. In the mean tim
- Security and XSS Filtering
- Session Management
- Email Sending Class. Supports Attachments, HTML/Text email, multiple protocols (sendmail, SMTP, and Mail) and more.
-- Image Manipulation Library (cropping, resizing, rotating, etc.). Supports GD, ImageMagick, and NetPBM
+- Image Manipulation Library (cropping, resizing, rotating, etc.). Supports GD, ImageMagick, and NetPBM
- File Uploading Class
- FTP Class
- Localization
diff --git a/user_guide/overview/getting_started.html b/user_guide/overview/getting_started.html
index 168332644..f120913f4 100644
--- a/user_guide/overview/getting_started.html
+++ b/user_guide/overview/getting_started.html
@@ -57,7 +57,7 @@ Getting Started
Getting Started With CodeIgniter
-Any software application requires some effort to learn. We've done our best to minimize the learning
+
Any software application requires some effort to learn. We've done our best to minimize the learning
curve while making the process as enjoyable as possible.
diff --git a/user_guide/overview/goals.html b/user_guide/overview/goals.html
index 7f1f7678e..754ecaae0 100644
--- a/user_guide/overview/goals.html
+++ b/user_guide/overview/goals.html
@@ -67,9 +67,9 @@ rejecting anything that doesn't further the stated objective.
From a technical and architectural standpoint, CodeIgniter was created with the following objectives:
-- Dynamic Instantiation. In CodeIgniter, components are loaded and routines executed only when requested, rather than globally. No assumptions are made by the system regarding what may be needed beyond the minimal core resources, so the system is very light-weight by default. The events, as triggered by the HTTP request, and the controllers and views you design will determine what is invoked.
-- Loose Coupling. Coupling is the degree to which components of a system rely on each other. The less components depend on each other the more reusable and flexible the system becomes. Our goal was a very loosely coupled system.
-- Component Singularity. Singularity is the degree to which components have a narrowly focused purpose. In CodeIgniter, each class and its functions are highly autonomous in order to allow maximum usefulness.
+- Dynamic Instantiation. In CodeIgniter, components are loaded and routines executed only when requested, rather than globally. No assumptions are made by the system regarding what may be needed beyond the minimal core resources, so the system is very light-weight by default. The events, as triggered by the HTTP request, and the controllers and views you design will determine what is invoked.
+- Loose Coupling. Coupling is the degree to which components of a system rely on each other. The less components depend on each other the more reusable and flexible the system becomes. Our goal was a very loosely coupled system.
+- Component Singularity. Singularity is the degree to which components have a narrowly focused purpose. In CodeIgniter, each class and its functions are highly autonomous in order to allow maximum usefulness.
CodeIgniter is a dynamically instantiated, loosely coupled system with high component singularity. It strives for simplicity, flexibility, and high performance in a small footprint package.
diff --git a/user_guide/overview/mvc.html b/user_guide/overview/mvc.html
index 9eb327a95..91cf64977 100644
--- a/user_guide/overview/mvc.html
+++ b/user_guide/overview/mvc.html
@@ -60,12 +60,12 @@ MVC
CodeIgniter is based on the Model-View-Controller development pattern.
-MVC is a software approach that separates application logic from presentation. In practice, it permits your web pages to contain minimal scripting since the presentation is separate from the PHP scripting.
+MVC is a software approach that separates application logic from presentation. In practice, it permits your web pages to contain minimal scripting since the presentation is separate from the PHP scripting.
- The Model represents your data structures. Typically your model classes will contain functions that help you
-retrieve, insert, and update information in your database.
-- The View is the information that is being presented to a user. A View will normally be a web page, but
+retrieve, insert, and update information in your database.
+- The View is the information that is being presented to a user. A View will normally be a web page, but
in CodeIgniter, a view can also be a page fragment like a header or footer. It can also be an RSS page, or any other type of "page".
- The Controller serves as an intermediary between the Model, the View,
and any other resources needed to process the HTTP request and generate a web page.
diff --git a/user_guide/userguide.css b/user_guide/userguide.css
index b08f4fb00..f93ff0d75 100644
--- a/user_guide/userguide.css
+++ b/user_guide/userguide.css
@@ -391,7 +391,7 @@ form {
.select {
background-color: #fff;
- font-size: 11px;
+ font-size: 11px;
font-weight: normal;
color: #333;
padding: 0;
--
cgit v1.2.3-24-g4f1b