From bde25d971bfbf4a54f1d40eedfd3290ebb5f91e5 Mon Sep 17 00:00:00 2001 From: Greg Aker Date: Tue, 21 Dec 2010 09:31:21 -0600 Subject: Initial commit of Caching Driver. --- user_guide/libraries/caching.html | 193 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 193 insertions(+) create mode 100644 user_guide/libraries/caching.html (limited to 'user_guide/libraries') diff --git a/user_guide/libraries/caching.html b/user_guide/libraries/caching.html new file mode 100644 index 000000000..e4651dc4a --- /dev/null +++ b/user_guide/libraries/caching.html @@ -0,0 +1,193 @@ + + + + + +Caching Driver : CodeIgniter User Guide + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +

CodeIgniter User Guide Version 2.0.0

+
+ + + + + + + + + +
+ + +
+ + + +
+ +

Caching Driver

+ +

CodeIgniter features wrappers around some of the most popular forms of fast and dynamic caching. All but file-based caching require specific server requirements, and a Fatal Exception will be thrown if server requirements are not met.

+ +

Table of Contents

+ + +

Available Drivers

+ + +

Example Usage

+ +

The following example will load the cache driver, specify APC as the driver to use, and fall back to file-based caching if APC is not available in the hosting environment.

+ + +$this->load->driver('cache', array('adapter' => 'apc', 'backup' => 'file'));
+
+if ( ! $foo = $this->cache->get('foo'))
+{
+     echo 'Saving to the cache!<br />';
+     $foo = 'foobarbaz!';
+
+     // Save into the cache for 5 minutes
+     $this->cache->save('foo', $foo, 300);
+}
+
+echo $foo; +
+ +

Function Reference

+ +

is_supported(driver['string'])

+ +

This function is automatically called when accessing drivers via $this->cache->get(). However, if the individual drivers are used, make sure to call this function to ensure the driver is supported in the hosting environment.

+ + +if ($this->cache->apc->is_supported())
+{
+     if ($data = $this->cache->apc->get('my_cache'))
+     {
+          // do things.
+     }
+} +
+ +

get(id['string'])

+ +

This function will attempt to fetch an item from the cache store. If the item does not exist, the function will return FALSE.

+$foo = $this->cache->get('my_cached_item'); + +

save(id['string'], data['mixed'], ttl['int'])

+ +

This function will save an item to the cache store. If saving fails, the function will return FALSE.

+

The optional third parameter (Time To Live) defaults to 60 seconds.

+$this->cache->save('cache_item_id', 'data_to_cache'); + +

delete(id['string'])

+ +

This function will delete a specific item from the cache store. If item deletion fails, the function will return FALSE.

+$this->cache->delete('cache_item_id'); + +

clean()

+ +

This function will 'clean' the entire cache. If the deletion of the cache files fails, the function will return FALSE.

+ +$this->cache->clean(); + +

cache_info()

+ +

This function will return information on the entire cache.

+ +var_dump($this->cache->cache_info()); + +

get_metadata(id['string'])

+ +

This function will return detailed information on a specific item in the cache.

+ +var_dump($this->cache->get_metadata('my_cached_item')); + +

Drivers

+ +

Alternative PHP Cache (APC) Caching

+ +

All of the functions listed above can be accessed without passing a specific adapter to the driver loader as follows:

+$this->load->driver('cache');
+ $this->cache->apc->save('foo', 'bar', 10);
+

For more information on APC, please see http://php.net/apc

+ +

File-based Caching

+ +

Unlike caching from the Output Class, the driver file-based caching allows for pieces of view files to be cached. Use this with care, and make sure to benchmark your application, as a point can come where disk I/O will negate positive gains by caching.

+ +

All of the functions listed above can be accessed without passing a specific adapter to the driver loader as follows:

+$this->load->driver('cache');
+ $this->cache->file->save('foo', 'bar', 10);
+ +

Memcached Caching

+ +

Multiple Memcached servers can be specified in the memcached.php configuration file, located in the application/config/ directory. + +

All of the functions listed above can be accessed without passing a specific adapter to the driver loader as follows:

+$this->load->driver('cache');
+ $this->cache->memcached->save('foo', 'bar', 10);
+ +

For more information on Memcached, please see http://php.net/memcached

+ +

Dummy Cache

+ +

This is a caching backend that will always 'miss.' It stores no data, but lets you keep your caching code in place in environments that don't support your chosen cache.

+ +
+ + + + + + + \ No newline at end of file -- cgit v1.2.3-24-g4f1b From 5808bad28e58f8b534f1fc269c7713351a7b6845 Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Mon, 27 Dec 2010 13:51:10 -0500 Subject: Fixed version in file uploading docs. Fixes: #255 --- user_guide/libraries/file_uploading.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'user_guide/libraries') diff --git a/user_guide/libraries/file_uploading.html b/user_guide/libraries/file_uploading.html index 00bc0c076..54725d035 100644 --- a/user_guide/libraries/file_uploading.html +++ b/user_guide/libraries/file_uploading.html @@ -28,7 +28,7 @@
- +

CodeIgniter User Guide Version 1.7.2

CodeIgniter User Guide Version 2.0.0

-- cgit v1.2.3-24-g4f1b From 2e3b0a958fdf236e17b8e3cc6c5f42ea7e873d85 Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Tue, 28 Dec 2010 10:33:48 -0500 Subject: js and css was loaded via absolute url instead of pointing relative. Fixes #289 --- user_guide/libraries/table.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'user_guide/libraries') diff --git a/user_guide/libraries/table.html b/user_guide/libraries/table.html index 574110807..094d7aac6 100644 --- a/user_guide/libraries/table.html +++ b/user_guide/libraries/table.html @@ -4,12 +4,12 @@ CodeIgniter User Guide : HTML Table Class - + - - - - + + + + -- cgit v1.2.3-24-g4f1b From dac1b468d5432ff9166fe221ac520b5050a65f0e Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Thu, 6 Jan 2011 17:40:10 +0000 Subject: Altered User agent library so that is_browser(), is_mobile() and is_robot() can optionally check for a specific browser or mobile device. --- user_guide/libraries/user_agent.html | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'user_guide/libraries') diff --git a/user_guide/libraries/user_agent.html b/user_guide/libraries/user_agent.html index 944f1ed86..d2f79d2ec 100644 --- a/user_guide/libraries/user_agent.html +++ b/user_guide/libraries/user_agent.html @@ -111,9 +111,34 @@ echo $this->agent->platform(); // Platform info (Windows, Linux, Mac, etc.)

$this->agent->is_browser()

Returns TRUE/FALSE (boolean) if the user agent is a known web browser.

+ if ($this->agent->is_browser('Safari'))
+{
+    echo 'You are using Safari.';
+}
+else if ($this->agent->is_browser())
+{
+    echo 'You are using a browser.';
+}
+ +

Note:  The string "Safari" in this example is an array key in the list of browser definitions. +You can find this list in application/config/user_agents.php if you want to add new browsers or change the stings.

+

$this->agent->is_mobile()

Returns TRUE/FALSE (boolean) if the user agent is a known mobile device.

+ if ($this->agent->is_mobile('iphone'))
+{
+    $this->load->view('iphone/home');
+}
+else if ($this->agent->is_mobile())
+{
+    $this->load->view('mobile/home');
+}
+else
+{
+    $this->load->view('web/home');
+}
+

$this->agent->is_robot()

Returns TRUE/FALSE (boolean) if the user agent is a known robot.

-- cgit v1.2.3-24-g4f1b From 42aa95bfee77baa6d4fe2728c4a02c61b7a3cac1 Mon Sep 17 00:00:00 2001 From: joelcox Date: Sun, 16 Jan 2011 18:16:21 +0100 Subject: Added documentation for environments --- user_guide/libraries/config.html | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'user_guide/libraries') diff --git a/user_guide/libraries/config.html b/user_guide/libraries/config.html index bfb679457..10892de38 100644 --- a/user_guide/libraries/config.html +++ b/user_guide/libraries/config.html @@ -150,6 +150,23 @@ $site_name = $blog_config['site_name'];

Where item_name is the $config array index you want to change, and item_value is its value.

+

Environments

+ +

You can set the environment of you application and load config items depending on the current environment. It also disables PHP from displaying errors in environments other than development. To set your environment, open index.php, located at the root and change the ENVIRONMENT constant. By default, there is support for a development, test and production environment.

+ + +define('ENVIRONMENT', 'development'); + + +

To make a config file environment-aware, copy the file from application/config/ to application/config/development/, depending on the environment the config file belongs to. You can place the following configuration files in environment folders:

+ +
    +
  • Default config files
  • +
  • Database config files
  • +
  • Custom config files
  • +
+ +

Note: CodeIgniter always tries to load the config file for the current environment first. If the file does not exist, the global config file (i.e. application/config/) is loaded. This means you are not obligated to place all your config files (but rather the files that change per environment) in an environment folder.

Helper Functions

-- cgit v1.2.3-24-g4f1b From 700205ad5cb6c00596ad82d5ed282f516add5481 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Fri, 28 Jan 2011 07:44:28 -0600 Subject: updating copyrights to 2011 --- user_guide/libraries/benchmark.html | 2 +- user_guide/libraries/caching.html | 2 +- user_guide/libraries/calendar.html | 2 +- user_guide/libraries/cart.html | 2 +- user_guide/libraries/config.html | 2 +- user_guide/libraries/email.html | 2 +- user_guide/libraries/encryption.html | 2 +- user_guide/libraries/file_uploading.html | 2 +- user_guide/libraries/form_validation.html | 2 +- user_guide/libraries/ftp.html | 2 +- user_guide/libraries/image_lib.html | 2 +- user_guide/libraries/input.html | 2 +- user_guide/libraries/javascript.html | 2 +- user_guide/libraries/jquery.html | 2 +- user_guide/libraries/language.html | 2 +- user_guide/libraries/loader.html | 2 +- user_guide/libraries/output.html | 2 +- user_guide/libraries/pagination.html | 2 +- user_guide/libraries/parser.html | 2 +- user_guide/libraries/security.html | 2 +- user_guide/libraries/sessions.html | 2 +- user_guide/libraries/table.html | 2 +- user_guide/libraries/trackback.html | 2 +- user_guide/libraries/typography.html | 2 +- user_guide/libraries/unit_testing.html | 2 +- user_guide/libraries/uri.html | 2 +- user_guide/libraries/user_agent.html | 2 +- user_guide/libraries/xmlrpc.html | 2 +- user_guide/libraries/zip.html | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) (limited to 'user_guide/libraries') diff --git a/user_guide/libraries/benchmark.html b/user_guide/libraries/benchmark.html index 05f7cc0e9..e8182d080 100644 --- a/user_guide/libraries/benchmark.html +++ b/user_guide/libraries/benchmark.html @@ -191,7 +191,7 @@ Previous Topic:  Writing Documentaio User Guide Home   ·   Next Topic:  Calendar Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/caching.html b/user_guide/libraries/caching.html index e4651dc4a..3d3354436 100644 --- a/user_guide/libraries/caching.html +++ b/user_guide/libraries/caching.html @@ -186,7 +186,7 @@ Previous Topic:  Error Handling User Guide Home   ·   Next Topic:  Profiling Your Application

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/calendar.html b/user_guide/libraries/calendar.html index 2c052424d..347b3d92b 100644 --- a/user_guide/libraries/calendar.html +++ b/user_guide/libraries/calendar.html @@ -242,7 +242,7 @@ Previous Topic:  Benchmark Class User Guide Home   ·   Next Topic:  Cart Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/cart.html b/user_guide/libraries/cart.html index ba95b24c5..bc0721bb4 100644 --- a/user_guide/libraries/cart.html +++ b/user_guide/libraries/cart.html @@ -339,7 +339,7 @@ Previous Topic:  Calendar Class User Guide Home   ·   Next Topic:  Config Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/config.html b/user_guide/libraries/config.html index bfb679457..6b48b2515 100644 --- a/user_guide/libraries/config.html +++ b/user_guide/libraries/config.html @@ -174,7 +174,7 @@ Previous Topic:  Calendaring Class User Guide Home   ·   Next Topic:  Database Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/email.html b/user_guide/libraries/email.html index b863ef4c1..a02d6587f 100644 --- a/user_guide/libraries/email.html +++ b/user_guide/libraries/email.html @@ -300,7 +300,7 @@ Previous Topic:  Database Class User Guide Home   ·   Next Topic:  Encryption Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/encryption.html b/user_guide/libraries/encryption.html index fbffd63c6..f6fb2b81d 100644 --- a/user_guide/libraries/encryption.html +++ b/user_guide/libraries/encryption.html @@ -217,7 +217,7 @@ Previous Topic:  Email Class User Guide Home   ·   Next Topic:  File Uploading Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/file_uploading.html b/user_guide/libraries/file_uploading.html index 54725d035..c5eab4695 100644 --- a/user_guide/libraries/file_uploading.html +++ b/user_guide/libraries/file_uploading.html @@ -444,7 +444,7 @@ Previous Topic:  Encryption Helper User Guide Home   ·   Next Topic:  Form Validation Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  Ellislab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  Ellislab, Inc.

diff --git a/user_guide/libraries/form_validation.html b/user_guide/libraries/form_validation.html index eae2036c1..935dca61f 100644 --- a/user_guide/libraries/form_validation.html +++ b/user_guide/libraries/form_validation.html @@ -1211,7 +1211,7 @@ Previous Topic:  File Uploading ClassUser Guide Home   ·   Next Topic:  FTP Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/ftp.html b/user_guide/libraries/ftp.html index 493177655..e3c06741d 100644 --- a/user_guide/libraries/ftp.html +++ b/user_guide/libraries/ftp.html @@ -309,7 +309,7 @@ Previous Topic:  Form Validation Class< User Guide Home   ·   Next Topic:  HTML Table Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/image_lib.html b/user_guide/libraries/image_lib.html index 98ed4f6dd..0f023cff1 100644 --- a/user_guide/libraries/image_lib.html +++ b/user_guide/libraries/image_lib.html @@ -660,7 +660,7 @@ Previous Topic:  HTML Table Class User Guide Home   ·   Next Topic:  Input Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/input.html b/user_guide/libraries/input.html index d838cf020..552c49afd 100644 --- a/user_guide/libraries/input.html +++ b/user_guide/libraries/input.html @@ -262,7 +262,7 @@ Previous Topic:  Image Manipulation Class User Guide Home   ·   Next Topic:  Loader Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/javascript.html b/user_guide/libraries/javascript.html index 0f1d0a090..b5041e5b8 100644 --- a/user_guide/libraries/javascript.html +++ b/user_guide/libraries/javascript.html @@ -97,7 +97,7 @@ Previous Topic:  Input Class Top of Page   ·   User Guide Home   ·   Next Topic:  Language Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/jquery.html b/user_guide/libraries/jquery.html index d8307f347..732999c57 100644 --- a/user_guide/libraries/jquery.html +++ b/user_guide/libraries/jquery.html @@ -229,7 +229,7 @@ Previous Topic:  Input Class Top of Page   ·   User Guide Home   ·   Next Topic:  Language Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/language.html b/user_guide/libraries/language.html index c37f00926..dfdccad04 100644 --- a/user_guide/libraries/language.html +++ b/user_guide/libraries/language.html @@ -130,7 +130,7 @@ Previous Topic:  Loader Class User Guide Home   ·   Next Topic:  Output Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/loader.html b/user_guide/libraries/loader.html index 34e3929a9..af312f4aa 100644 --- a/user_guide/libraries/loader.html +++ b/user_guide/libraries/loader.html @@ -248,7 +248,7 @@ Previous Topic:  Input Class User Guide Home   ·   Next Topic:  Language Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/output.html b/user_guide/libraries/output.html index a1427de7b..ab8f1d683 100644 --- a/user_guide/libraries/output.html +++ b/user_guide/libraries/output.html @@ -155,7 +155,7 @@ Previous Topic:  Language Class User Guide Home   ·   Next Topic:  Pagination Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/pagination.html b/user_guide/libraries/pagination.html index 42c102c8d..da07c79be 100644 --- a/user_guide/libraries/pagination.html +++ b/user_guide/libraries/pagination.html @@ -222,7 +222,7 @@ Previous Topic:  Output Class User Guide Home   ·   Next Topic:  Session Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/parser.html b/user_guide/libraries/parser.html index ece61c1fa..5bb403a7f 100644 --- a/user_guide/libraries/parser.html +++ b/user_guide/libraries/parser.html @@ -205,7 +205,7 @@ Previous Topic:  Trackback Class User Guide Home   ·   Next Topic:  Typography

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/security.html b/user_guide/libraries/security.html index 6d6216d95..5cd274787 100644 --- a/user_guide/libraries/security.html +++ b/user_guide/libraries/security.html @@ -121,7 +121,7 @@ Previous Topic:  Pagination Class User Guide Home   ·   Next Topic:  Session Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/sessions.html b/user_guide/libraries/sessions.html index 2d295d72e..c8757995c 100644 --- a/user_guide/libraries/sessions.html +++ b/user_guide/libraries/sessions.html @@ -315,7 +315,7 @@ Previous Topic:  Security Class User Guide Home   ·   Next Topic:  Trackback Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/table.html b/user_guide/libraries/table.html index 094d7aac6..9de70775a 100644 --- a/user_guide/libraries/table.html +++ b/user_guide/libraries/table.html @@ -308,7 +308,7 @@ Previous Topic:  FTP Class   &mi User Guide Home   ·   Next Topic:  Image Manipulation Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/trackback.html b/user_guide/libraries/trackback.html index a07b8d1f8..32b1ee258 100644 --- a/user_guide/libraries/trackback.html +++ b/user_guide/libraries/trackback.html @@ -239,7 +239,7 @@ Previous Topic:  Session Class User Guide Home   ·   Next Topic:  Template Parser Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/typography.html b/user_guide/libraries/typography.html index e78af5f9a..9c4272b37 100644 --- a/user_guide/libraries/typography.html +++ b/user_guide/libraries/typography.html @@ -153,7 +153,7 @@ Previous Topic:  Template Parser User Guide Home   ·   Next Topic:  Unit Testing Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/unit_testing.html b/user_guide/libraries/unit_testing.html index 84db54431..49c5881e1 100644 --- a/user_guide/libraries/unit_testing.html +++ b/user_guide/libraries/unit_testing.html @@ -219,7 +219,7 @@ Previous Topic:  Typography Class User Guide Home   ·   Next Topic:  URI Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/uri.html b/user_guide/libraries/uri.html index b2f5ac3d9..0dbaffa49 100644 --- a/user_guide/libraries/uri.html +++ b/user_guide/libraries/uri.html @@ -245,7 +245,7 @@ Previous Topic:  Unit Testing Class User Guide Home   ·   Next Topic:  User Agent Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/user_agent.html b/user_guide/libraries/user_agent.html index d2f79d2ec..8989fb2e1 100644 --- a/user_guide/libraries/user_agent.html +++ b/user_guide/libraries/user_agent.html @@ -219,7 +219,7 @@ Previous Topic:  URI Class User Guide Home   ·   Next Topic:  XML-RPC Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/xmlrpc.html b/user_guide/libraries/xmlrpc.html index 87ca09480..7a8934d39 100644 --- a/user_guide/libraries/xmlrpc.html +++ b/user_guide/libraries/xmlrpc.html @@ -512,7 +512,7 @@ Previous Topic:  User Agent Class User Guide Home   ·   Next Topic:  Zip Encoding Class

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

diff --git a/user_guide/libraries/zip.html b/user_guide/libraries/zip.html index d57dd48ac..48e2562be 100644 --- a/user_guide/libraries/zip.html +++ b/user_guide/libraries/zip.html @@ -281,7 +281,7 @@ Previous Topic:   XML-RPC Class User Guide Home   ·   Next Topic:  Array Helper

-

CodeIgniter  ·  Copyright © 2006-2010  ·  EllisLab, Inc.

+

CodeIgniter  ·  Copyright © 2006 - 2011  ·  EllisLab, Inc.

-- cgit v1.2.3-24-g4f1b From 1c97d565c47eb2a3b0802a9b0202deb5b5fe6760 Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Fri, 28 Jan 2011 13:34:50 -0500 Subject: Added csrf to security docs --- user_guide/libraries/security.html | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'user_guide/libraries') diff --git a/user_guide/libraries/security.html b/user_guide/libraries/security.html index 5cd274787..943f72a0f 100644 --- a/user_guide/libraries/security.html +++ b/user_guide/libraries/security.html @@ -104,11 +104,18 @@ Note: This function should only be used to deal with data upon submission. It's

If it is acceptable for the user input to include relative paths, e.g. file/in/some/approved/folder.txt, you can set the second optional parameter, $relative_path to TRUE.

- + $filename = $this->security->sanitize_filename($this->input->post('filename'), TRUE); +

Cross-site request forgery (CSRF)

+ +

You can enable csrf protection by opening your application/config/config.php file and setting this:

+$config['csrf_protection'] = TRUE; + +

If you use the form helper the form_open() function will automatically insert a hidden csrf field in your forms.

+ -- cgit v1.2.3-24-g4f1b From d709c394bbc918283e09f501363559b665fa2a24 Mon Sep 17 00:00:00 2001 From: Pascal Kriete Date: Fri, 28 Jan 2011 14:56:26 -0500 Subject: Wrong branch, and the drivers were not alphabetical. --- user_guide/libraries/javascript.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'user_guide/libraries') diff --git a/user_guide/libraries/javascript.html b/user_guide/libraries/javascript.html index b5041e5b8..864efc82d 100644 --- a/user_guide/libraries/javascript.html +++ b/user_guide/libraries/javascript.html @@ -2,7 +2,7 @@ -CodeIgniter User Guide : Input Class +CodeIgniter User Guide : JavaScript Class @@ -55,6 +55,7 @@ Input Class
+

Note: This driver is experimental. Its feature set and implementation may change in future releases.


Javascript Class

Rewrite this paragraph: jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages. CodeIgniter provides a library to help you with certain common functions that you may want to use within jQuery. Please note that CodeIgniter does not require the jQuery library to run, and that any scripting library will work equally well. The jQuery library is simply presented as a convenience if you choose to use it.

-- cgit v1.2.3-24-g4f1b From 9d3ad267e8e8f2972ceea05c4281b0234ed3efb4 Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Fri, 28 Jan 2011 14:06:58 -0600 Subject: some cleanup for the javascript class docs --- user_guide/libraries/javascript.html | 153 ++++++++++++++++++++++- user_guide/libraries/jquery.html | 236 ----------------------------------- 2 files changed, 147 insertions(+), 242 deletions(-) delete mode 100644 user_guide/libraries/jquery.html (limited to 'user_guide/libraries') diff --git a/user_guide/libraries/javascript.html b/user_guide/libraries/javascript.html index 864efc82d..55ad18907 100644 --- a/user_guide/libraries/javascript.html +++ b/user_guide/libraries/javascript.html @@ -58,9 +58,9 @@ Input Class

Note: This driver is experimental. Its feature set and implementation may change in future releases.


Javascript Class

-

Rewrite this paragraph: jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages. CodeIgniter provides a library to help you with certain common functions that you may want to use within jQuery. Please note that CodeIgniter does not require the jQuery library to run, and that any scripting library will work equally well. The jQuery library is simply presented as a convenience if you choose to use it.

+

CodeIgniter provides a library to help you with certain common functions that you may want to use with Javascript. Please note that CodeIgniter does not require the jQuery library to run, and that any scripting library will work equally well. The jQuery library is simply presented as a convenience if you choose to use it.

Initializing the Class

-

To initialize the jQuery class manually in your controller constructor, use the $this->load->library function. Currently, the only available library is jQuery, which will automatically be loaded like this:

+

To initialize the Javascript class manually in your controller constructor, use the $this->load->library function. Currently, the only available library is jQuery, which will automatically be loaded like this:

$this->load->library('javascript'); @@ -73,20 +73,161 @@ Input Class

Once loaded, the jQuery library object will be available using: $this->javascript

Setup and Configuration

Set these variables in your view

-

As a javascript library, your files must be available to your application. For your convenience, the needed files to run this library are available for download from our site.

-

As javascript is a client side language, the library must be able to write content into your final output. This generally means a view. You'll need to include the following variables in the <head> sections of your output.

+

As a Javascript library, your files must be available to your application.

+

As Javascript is a client side language, the library must be able to write content into your final output. This generally means a view. You'll need to include the following variables in the <head> sections of your output.

<?php echo $library_src;?>
<?php echo $script_head;?>

$library_src, is where the actual library file will be loaded, as well as any subsequent plugin script calls; $script_head is where specific events, functions and other commands will be rendered.

Set the path to the librarys with config items

-

There are some configuration items in javascript library. These can either be set in application/config.php, within its own confg/javascript.php file, or within any controller usings the set_item() function.

+

There are some configuration items in Javascript library. These can either be set in application/config.php, within its own config/javascript.php file, or within any controller usings the set_item() function.

An image to be used as an "ajax loader", or progress indicator. Without one, the simple text message of "loading" will appear when Ajax calls need to be made.

$config['javascript_location'] = 'http://localhost/codeigniter/themes/js/jquery/');
$config['javascript_ajax_img'] = 'images/ajax-loader.gif';

If you keep your files in the same directories they were downloaded from, then you need not set this configuration items.

-

For information on outputting events, effects, etc., refer to the jQuery Class documentation.

+

The jQuery Class

+ +

To initialize the jQuery class manually in your controller constructor, use the $this->load->library function:

+ +$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:

+ +$this->load->library('jquery', FALSE); + +

Once loaded, the jQuery library object will be available using: $this->jquery

+ +

jQuery Events

+ +

Events are set using the following syntax.

+ +

$this->jquery->event('element_path', code_to_run());

+ +

In the above example:

+ +
    +
  • "event" is any of blur, change, click, dblclick, error, focus, hover, keydown, keyup, load, mousedown, mouseup, mouseover, mouseup, resize, scroll, or unload.
  • +
  • "element_path" is any valid jQuery selector. Due to jQuery's unique selector syntax, this is usually an element id, or CSS selector. For example "#notice_area" would effect <div id="notice_area">, and "#content a.notice" would effect all anchors with a class of "notice" in the div with id "content".
  • +
  • "code_to_run()" is script your write yourself, or an action such as an effect from the jQuery library below.
  • +
+ +

Effects

+ +

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 +$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);

+ +
    +
  • "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.
  • +
  • "extra information" is optional, and could include a callback, or other additional information.
  • +
+ +

toggle()

+ +

toggle() will change the visibility of an item to the opposite of its current state, hiding visible elements, and revealing hidden ones.

+

$this->jquery->toggle(target);

+
    +
  • "target" will be any valid jQuery selector or selectors.
  • +
+ +

animate()

+ +

$this->jquery->animate(target, parameters, optional speed, optional extra information);

+
    +
  • "target" will be any valid jQuery selector or selectors.
  • +
  • "paramters" in jQuery would generally include a series of CSS properties that you wish to change.
  • +
  • "speed" is optional, and is set to either slow, normal, fast, or alternatively a number of milliseconds.
  • +
  • "extra information" is optional, and could include a callback, or other additional information.
  • +
+

For a full summary, see http://docs.jquery.com/Effects/animate

+

Here is an example of an animate() called on a div with an id of "note", and triggered by a click using the jQuery library's click() event.

+

$params = array(
+ 'height' => 80,
+ 'width' => '50%',
+ 'marginLeft' => 125
+);
+$this->jquery->click('#trigger', $this->jquery->animate('#note', $params, normal));

+ +

fadeIn() / fadeOut()

+ +

$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.
  • +
  • "extra information" is optional, and could include a callback, or other additional information.
  • +
+ +

toggleClass()

+ +

This function will add or remove a CSS class to its target.

+

$this->jquery->toggleClass(target, class)

+
    +
  • "target" will be any valid jQuery selector or selectors.
  • +
  • "class" is any CSS classname. Note that this class must be defined and available in a CSS that is already loaded.
  • +
+ +

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);

+
    +
  • "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.
  • +
  • "extra information" is optional, and could include a callback, or other additional information.
  • +
+ +

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);

+
    +
  • "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.
  • +
  • "extra information" is optional, and could include a callback, or other additional information.
  • +
+ +

Plugins

+ +

+ +

Some select jQuery plugins are made available using this library.

+ +

corner()

+

Used to add distinct corners to page elements. For full details see http://www.malsup.com/jquery/corner/

+

$this->jquery->corner(target, corner_style);

+
    +
  • "target" will be any valid jQuery selector or selectors.
  • +
  • "corner_style" is optional, and can be set to any valid style such as round, sharp, bevel, bite, dog, etc. Individual corners can be set by following the style with a space and using "tl" (top left), "tr" (top right), "bl" (bottom left), or "br" (bottom right).
  • +
+

$this->jquery->corner("#note", "cool tl br");

+ +

tablesorter()

+ +

description to come

+ +

modal()

+ +

description to come

+ +

calendar()

+ +

description to come

+
diff --git a/user_guide/libraries/jquery.html b/user_guide/libraries/jquery.html deleted file mode 100644 index 732999c57..000000000 --- a/user_guide/libraries/jquery.html +++ /dev/null @@ -1,236 +0,0 @@ - - - - -CodeIgniter User Guide : Input Class - - - - - - - - - - - - - - - - - - - - - - -
- - - - - -

CodeIgniter User Guide Version 2.0.0

-
- - - - - - - - - -
- - -
- - - -
- - -

jQuery Class

- -

jQuery is a fast, concise, JavaScript Library that simplifies how you traverse HTML documents, handle events, perform animations, and add Ajax interactions to your web pages. CodeIgniter provides a library to help you with certain common functions that you may want to use within jQuery. Please note that CodeIgniter does not require the jQuery library to run, and that any scripting library will work equally well. The jQuery library is simply presented as a convenience if you choose to use it.

- -

Initializing the Class

- -

To initialize the jQuery class manually in your controller constructor, use the $this->load->library function:

- -$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:

- -$this->load->library('jquery', FALSE); - -

Once loaded, the jQuery library object will be available using: $this->jquery

- -

Setup and Configuration

- -

As a javascript library, jquery.js must be available to your application. For your convenience, the needed files to run this library are available for download from our site.

- -

As javascript is a client side language, the library must be able to write content into your final output. This generally means a view. You'll need to include the following variables in the <head> sections of your output.

- -

<?php echo $jquery_script;?>
-<?php echo $script_head;?>

- -

There are 2 configuration items in jQuery library. These can either be set in application/config.php, or within any controller. The first is the path from the root of your site to the jquery library ('js' is the default) and the second is an image to be used as an "ajax loader", or progress indicator. Without one, the simple text message of "loading" will appear when Ajax calls need to be made.

- -

$config['javascript_folder'] = 'js';
- $config['javascript_ajax_img'] = 'images/ajax-loader.gif';

- -

If you keep your files in the same directories they were downloaded from, then you needed set this configuration items.

- -

Events

- -

Events are set using the following syntax.

- -

$this->jquery->event('element_path', code_to_run());

- -

In the above example:

- -
    -
  • "event" is any of blur, change, click, dblclick, error, focus, hover, keydown, keyup, load, mousedown, mouseup, mouseover, mouseup, resize, scroll, or unload.
  • -
  • "element_path" is any valid jQuery selector. Due to jQuery's unique selector syntax, this is usually an element id, or CSS selector. For example "#notice_area" would effect <div id="notice_area">, and "#content a.notice" would effect all anchors with a class of "notice" in the div with id "content".
  • -
  • "code_to_run()" is script your write yourself, or an action such as an effect from the jQuery library below.
  • -
- -

Effects

- -

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 -$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);

- -
    -
  • "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.
  • -
  • "extra information" is optional, and could include a callback, or other additional information.
  • -
- -

toggle()

- -

toggle() will change the visibility of an item to the opposite of its current state, hiding visible elements, and revealing hidden ones.

-

$this->jquery->toggle(target);

-
    -
  • "target" will be any valid jQuery selector or selectors.
  • -
- -

animate()

- -

$this->jquery->animate(target, parameters, optional speed, optional extra information);

-
    -
  • "target" will be any valid jQuery selector or selectors.
  • -
  • "paramters" in jQuery would generally include a series of CSS properties that you wish to change.
  • -
  • "speed" is optional, and is set to either slow, normal, fast, or alternatively a number of milliseconds.
  • -
  • "extra information" is optional, and could include a callback, or other additional information.
  • -
-

For a full summary, see http://docs.jquery.com/Effects/animate

-

Here is an example of an animate() called on a div with an id of "note", and triggered by a click using the jQuery library's click() event.

-

$params = array(
- 'height' => 80,
- 'width' => '50%',
- 'marginLeft' => 125
-);
-$this->jquery->click('#trigger', $this->jquery->animate('#note', $params, normal));

- -

fadeIn() / fadeOut()

- -

$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.
  • -
  • "extra information" is optional, and could include a callback, or other additional information.
  • -
- -

toggleClass()

- -

This function will add or remove a CSS class to its target.

-

$this->jquery->toggleClass(target, class)

-
    -
  • "target" will be any valid jQuery selector or selectors.
  • -
  • "class" is any CSS classname. Note that this class must be defined and available in a CSS that is already loaded.
  • -
- -

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);

-
    -
  • "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.
  • -
  • "extra information" is optional, and could include a callback, or other additional information.
  • -
- -

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);

-
    -
  • "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.
  • -
  • "extra information" is optional, and could include a callback, or other additional information.
  • -
- -

Plugins

- -

- -

Some select jQuery plugins are made available using this library.

- -

corner()

-

Used to add distinct corners to page elements. For full details see http://www.malsup.com/jquery/corner/

-

$this->jquery->corner(target, corner_style);

-
    -
  • "target" will be any valid jQuery selector or selectors.
  • -
  • "corner_style" is optional, and can be set to any valid style such as round, sharp, bevel, bite, dog, etc. Individual corners can be set by following the style with a space and using "tl" (top left), "tr" (top right), "bl" (bottom left), or "br" (bottom right).
  • -
-

$this->jquery->corner("#note", "cool tl br");

- -

tablesorter()

- -

description to come

- -

modal()

- -

description to come

- -

calendar()

- -

description to come

- -
- - - - - - - \ No newline at end of file -- cgit v1.2.3-24-g4f1b From d91d0f7544967869248743c7ca663159d93628f5 Mon Sep 17 00:00:00 2001 From: Eric Barnes Date: Sun, 30 Jan 2011 20:47:42 -0500 Subject: Fixed breadcrumb and removed errand parentheses. --- user_guide/libraries/javascript.html | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'user_guide/libraries') diff --git a/user_guide/libraries/javascript.html b/user_guide/libraries/javascript.html index 55ad18907..18b7181b0 100644 --- a/user_guide/libraries/javascript.html +++ b/user_guide/libraries/javascript.html @@ -2,7 +2,7 @@ -CodeIgniter User Guide : JavaScript Class +JavaScript Driver : CodeIgniter User Guide @@ -42,7 +42,8 @@ CodeIgniter Home  ›  User Guide Home  ›  -Input Class +Drivers  ›  +JavaScript Driver
Search User Guide   
@@ -57,7 +58,7 @@ Input Class

Note: This driver is experimental. Its feature set and implementation may change in future releases.


-

Javascript Class

+

Javascript Driver

CodeIgniter provides a library to help you with certain common functions that you may want to use with Javascript. Please note that CodeIgniter does not require the jQuery library to run, and that any scripting library will work equally well. The jQuery library is simply presented as a convenience if you choose to use it.

Initializing the Class

To initialize the Javascript class manually in your controller constructor, use the $this->load->library function. Currently, the only available library is jQuery, which will automatically be loaded like this:

@@ -82,7 +83,7 @@ Input Class

Set the path to the librarys with config items

There are some configuration items in Javascript library. These can either be set in application/config.php, within its own config/javascript.php file, or within any controller usings the set_item() function.

An image to be used as an "ajax loader", or progress indicator. Without one, the simple text message of "loading" will appear when Ajax calls need to be made.

-

$config['javascript_location'] = 'http://localhost/codeigniter/themes/js/jquery/');
+

$config['javascript_location'] = 'http://localhost/codeigniter/themes/js/jquery/';
$config['javascript_ajax_img'] = 'images/ajax-loader.gif';

If you keep your files in the same directories they were downloaded from, then you need not set this configuration items.

-- cgit v1.2.3-24-g4f1b From ef112c0830df4a31563351125888b0d522a1c965 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Mon, 7 Feb 2011 13:01:47 +0000 Subject: Added decimal, less_than and greater_than rules to the Form validation Class. --- user_guide/libraries/form_validation.html | 310 ++++++++++++++++-------------- 1 file changed, 169 insertions(+), 141 deletions(-) (limited to 'user_guide/libraries') diff --git a/user_guide/libraries/form_validation.html b/user_guide/libraries/form_validation.html index 935dca61f..d6120054b 100644 --- a/user_guide/libraries/form_validation.html +++ b/user_guide/libraries/form_validation.html @@ -924,118 +924,146 @@ POST array:

The following is a list of all the native rules that are available to use:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
RuleParameterDescriptionExample
requiredNoReturns FALSE if the form element is empty. 
matchesYesReturns FALSE if the form element does not match the one in the parameter.matches[form_item]
min_lengthYesReturns FALSE if the form element is shorter then the parameter value.min_length[6]
max_lengthYesReturns FALSE if the form element is longer then the parameter value.max_length[12]
exact_lengthYesReturns FALSE if the form element is not exactly the parameter value.exact_length[8]
alphaNoReturns FALSE if the form element contains anything other than alphabetical characters. 
alpha_numericNoReturns FALSE if the form element contains anything other than alpha-numeric characters. 
alpha_dashNoReturns FALSE if the form element contains anything other than alpha-numeric characters, underscores or dashes. 
numericNoReturns FALSE if the form element contains anything other than numeric characters. 
integerNoReturns FALSE if the form element contains anything other than an integer. 
is_naturalNoReturns FALSE if the form element contains anything other than a natural number: 0, 1, 2, 3, etc. 
is_natural_no_zeroNoReturns FALSE if the form element contains anything other than a natural number, but not zero: 1, 2, 3, etc. 
valid_emailNoReturns FALSE if the form element does not contain a valid email address. 
valid_emailsNoReturns FALSE if any value provided in a comma separated list is not a valid email. 
valid_ipNoReturns FALSE if the supplied IP is not valid. 
valid_base64NoReturns FALSE if the supplied string contains anything other than valid Base64 characters. 
RuleParameterDescriptionExample
requiredNoReturns FALSE if the form element is empty. 
matchesYesReturns FALSE if the form element does not match the one in the parameter.matches[form_item]
min_lengthYesReturns FALSE if the form element is shorter then the parameter value.min_length[6]
max_lengthYesReturns FALSE if the form element is longer then the parameter value.max_length[12]
exact_lengthYesReturns FALSE if the form element is not exactly the parameter value.exact_length[8]
greater_thanYesReturns FALSE if the form element is less than the parameter value or not numeric.greater_than[8]
less_thanYesReturns FALSE if the form element is greater than the parameter value or not numeric.less_than[8]
alphaNoReturns FALSE if the form element contains anything other than alphabetical characters. 
alpha_numericNoReturns FALSE if the form element contains anything other than alpha-numeric characters. 
alpha_dashNoReturns FALSE if the form element contains anything other than alpha-numeric characters, underscores or dashes. 
numericNoReturns FALSE if the form element contains anything other than numeric characters. 
integerNoReturns FALSE if the form element contains anything other than an integer. 
decimalYesReturns FALSE if the form element is not exactly the parameter value. 
is_naturalNoReturns FALSE if the form element contains anything other than a natural number: 0, 1, 2, 3, etc. 
is_natural_no_zeroNoReturns FALSE if the form element contains anything other than a natural number, but not zero: 1, 2, 3, etc. 
valid_emailNoReturns FALSE if the form element does not contain a valid email address. 
valid_emailsNoReturns FALSE if any value provided in a comma separated list is not a valid email. 
valid_ipNoReturns FALSE if the supplied IP is not valid. 
valid_base64NoReturns FALSE if the supplied string contains anything other than valid Base64 characters. 
@@ -1058,36 +1086,36 @@ POST array:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameParameterDescription
xss_cleanNoRuns the data through the XSS filtering function, described in the Input Class page.
prep_for_formNoConverts special characters so that HTML data can be shown in a form field without breaking it.
prep_urlNoAdds "http://" to URLs if missing.
strip_image_tagsNoStrips the HTML from image tags leaving the raw URL.
encode_php_tagsNoConverts PHP tags to entities.
NameParameterDescription
xss_cleanNoRuns the data through the XSS filtering function, described in the Input Class page.
prep_for_formNoConverts special characters so that HTML data can be shown in a form field without breaking it.
prep_urlNoAdds "http://" to URLs if missing.
strip_image_tagsNoStrips the HTML from image tags leaving the raw URL.
encode_php_tagsNoConverts PHP tags to entities.
-- cgit v1.2.3-24-g4f1b From ff1cfa1ae5c5440bfde35c36ecb4cdcd73cd3966 Mon Sep 17 00:00:00 2001 From: vascopj Date: Sun, 13 Feb 2011 21:30:19 +0000 Subject: Updated the post method and added the new functionality to the get method also Updated the documentation --- user_guide/libraries/input.html | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'user_guide/libraries') diff --git a/user_guide/libraries/input.html b/user_guide/libraries/input.html index 552c49afd..4faecd768 100644 --- a/user_guide/libraries/input.html +++ b/user_guide/libraries/input.html @@ -132,12 +132,32 @@ else
$this->input->post('some_data', TRUE); +

To return an array of all POST items call without any parameters.

+

To return all POST items and pass them through the XSS filter leave the first parameter blank while setting the second parameter to boolean;

+

The function returns FALSE (boolean) if there are no items in the POST.

+ + + $this->input->post(); // returns all POST items with XSS filter +
+ $this->input->post('', FALSE); // returns all POST items without XSS +
+

$this->input->get()

This function is identical to the post function, only it fetches get data:

$this->input->get('some_data', TRUE); +

To return an array of all GET items call without any parameters.

+

To return all GET items and pass them through the XSS filter leave the first parameter blank while setting the second parameter to boolean;

+

The function returns FALSE (boolean) if there are no items in the GET.

+ + + $this->input->get(); // returns all GET items with XSS filter +
+ $this->input->get('', FALSE); // returns all GET items without XSS filtering +
+

$this->input->get_post()

This function will search through both the post and get streams for data, looking first in post, and then in get:

-- cgit v1.2.3-24-g4f1b From feba2de9287ed2c5d43e555fc52ce2bdedfed0d9 Mon Sep 17 00:00:00 2001 From: Pascal Kriete Date: Mon, 14 Feb 2011 13:25:30 -0500 Subject: Whitespace tweaks to put code examples in line with our guidelines --- user_guide/libraries/cart.html | 2 +- user_guide/libraries/file_uploading.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'user_guide/libraries') diff --git a/user_guide/libraries/cart.html b/user_guide/libraries/cart.html index bc0721bb4..fe87a23f2 100644 --- a/user_guide/libraries/cart.html +++ b/user_guide/libraries/cart.html @@ -178,7 +178,7 @@ $this->cart->insert($data); <?php $i = 1; ?> -<?php foreach($this->cart->contents() as $items): ?> +<?php foreach ($this->cart->contents() as $items): ?> <?php echo form_hidden($i.'[rowid]', $items['rowid']); ?> diff --git a/user_guide/libraries/file_uploading.html b/user_guide/libraries/file_uploading.html index c5eab4695..5c3162819 100644 --- a/user_guide/libraries/file_uploading.html +++ b/user_guide/libraries/file_uploading.html @@ -125,7 +125,7 @@ In it, place this code and save it to your applications/views/ fold <h3>Your file was successfully uploaded!</h3> <ul> -<?php foreach($upload_data as $item => $value):?> +<?php foreach ($upload_data as $item => $value):?> <li><?php echo $item;?>: <?php echo $value;?></li> <?php endforeach; ?> </ul> -- cgit v1.2.3-24-g4f1b From d8d1e24eee56d2466c91ecd72b3c8932eb3d0639 Mon Sep 17 00:00:00 2001 From: Phil Sturgeon Date: Wed, 16 Feb 2011 17:23:16 +0000 Subject: Secure cookies can now be made with the set_cookie() helper and Input Class method. --- user_guide/libraries/input.html | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'user_guide/libraries') diff --git a/user_guide/libraries/input.html b/user_guide/libraries/input.html index 4faecd768..844e99ab8 100644 --- a/user_guide/libraries/input.html +++ b/user_guide/libraries/input.html @@ -187,13 +187,14 @@ Array Method, and Discrete Parameters:

Using this method, an associative array is passed to the first parameter:

$cookie = array(
-                   'name'   => 'The Cookie Name',
-                   'value'  => 'The Value',
-                   'expire' => '86500',
-                   'domain' => '.some-domain.com',
-                   'path'   => '/',
-                   'prefix' => 'myprefix_',
-               );
+    'name'   => 'The Cookie Name',
+    'value'  => 'The Value',
+    'expire' => '86500',
+    'domain' => '.some-domain.com',
+    'path'   => '/',
+    'prefix' => 'myprefix_',
+    'secure' => TRUE
+);

$this->input->set_cookie($cookie);
@@ -208,12 +209,13 @@ 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

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.

Discrete Parameters

If you prefer, you can set the cookie by passing data using individual parameters:

-$this->input->set_cookie($name, $value, $expire, $domain, $path, $prefix); +$this->input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure);

$this->input->get_cookie()

-- cgit v1.2.3-24-g4f1b