diff options
Diffstat (limited to 'user_guide/libraries')
-rw-r--r-- | user_guide/libraries/calendar.html | 2 | ||||
-rw-r--r-- | user_guide/libraries/cart.html | 18 | ||||
-rw-r--r-- | user_guide/libraries/email.html | 4 | ||||
-rw-r--r-- | user_guide/libraries/file_uploading.html | 18 | ||||
-rw-r--r-- | user_guide/libraries/form_validation.html | 30 | ||||
-rw-r--r-- | user_guide/libraries/ftp.html | 12 | ||||
-rw-r--r-- | user_guide/libraries/image_lib.html | 2 | ||||
-rw-r--r-- | user_guide/libraries/loader.html | 6 | ||||
-rw-r--r-- | user_guide/libraries/output.html | 4 | ||||
-rw-r--r-- | user_guide/libraries/pagination.html | 2 | ||||
-rw-r--r-- | user_guide/libraries/security.html | 5 | ||||
-rw-r--r-- | user_guide/libraries/table.html | 8 | ||||
-rw-r--r-- | user_guide/libraries/typography.html | 2 | ||||
-rw-r--r-- | user_guide/libraries/unit_testing.html | 2 | ||||
-rw-r--r-- | user_guide/libraries/xmlrpc.html | 32 |
15 files changed, 76 insertions, 71 deletions
diff --git a/user_guide/libraries/calendar.html b/user_guide/libraries/calendar.html index 74a8619bf..2c052424d 100644 --- a/user_guide/libraries/calendar.html +++ b/user_guide/libraries/calendar.html @@ -114,7 +114,7 @@ how data passed to your cells is handled so you can pass different types of info <h2>Setting Display Preferences</h2> -<p>There are seven preferences you can set to control various aspects of the calendar. Preferences are set by passing an +<p>There are seven preferences you can set to control various aspects of the calendar. Preferences are set by passing an array of preferences in the second parameter of the loading function. Here is an example:</p> diff --git a/user_guide/libraries/cart.html b/user_guide/libraries/cart.html index 0dcf04acc..fb5f6621c 100644 --- a/user_guide/libraries/cart.html +++ b/user_guide/libraries/cart.html @@ -58,7 +58,7 @@ Shopping Cart Class <h1>Shopping Cart Class</h1> -<p>The Cart Class permits items to be added to a session that stays active while a user is browsing your site. +<p>The Cart Class permits items to be added to a session that stays active while a user is browsing your site. These items can be retrieved and displayed in a standard "shopping cart" format, allowing the user to update the quantity or remove items from the cart.</p> <p>Please note that the Cart Class ONLY provides the core "cart" functionality. It does not provide shipping, credit card authorization, or other processing components.</p> @@ -109,7 +109,7 @@ It is intended to be used in cases where your product has options associated wit <li><strong>options</strong> - Any additional attributes that are needed to identify the product. These must be passed via an array. </ul> -<p>In addition to the five indexes above, there are two reserved words: <dfn>rowid</dfn> and <dfn>subtotal</dfn>. These are used internally by the Cart class, so +<p>In addition to the five indexes above, there are two reserved words: <dfn>rowid</dfn> and <dfn>subtotal</dfn>. These are used internally by the Cart class, so please do NOT use those words as index names when inserting data into the cart.</p> <p>Your array may contain additional data. Anything you include in your array will be stored in the session. However, it is best to standardize your data among @@ -181,24 +181,24 @@ $this->cart->insert($data); <?php foreach($this->cart->contents() as $items): ?> <?php echo form_hidden($i.'[rowid]', $items['rowid']); ?> - + <tr> <td><?php echo form_input(array('name' => $i.'[qty]', 'value' => $items['qty'], 'maxlength' => '3', 'size' => '5')); ?></td> <td> <?php echo $items['name']; ?> - + <?php if ($this->cart->has_options($items['rowid']) == TRUE): ?> - + <p> <?php foreach ($this->cart->product_options($items['rowid']) as $option_name => $option_value): ?> - + <strong><?php echo $option_name; ?>:</strong> <?php echo $option_value; ?><br /> - + <?php endforeach; ?> </p> - + <?php endif; ?> - + </td> <td style="text-align:right"><?php echo $this->cart->format_number($items['price']); ?></td> <td style="text-align:right">$<?php echo $this->cart->format_number($items['subtotal']); ?></td> diff --git a/user_guide/libraries/email.html b/user_guide/libraries/email.html index e144826be..b863ef4c1 100644 --- a/user_guide/libraries/email.html +++ b/user_guide/libraries/email.html @@ -83,7 +83,7 @@ Email Class <code>$this->load->library('email');<br /> <br /> -$this->email->from('your@example.com', 'Your Name');<br /> +$this->email->from('your@example.com', 'Your Name');<br /> $this->email->to('someone@example.com'); <br /> $this->email->cc('another@another-example.com'); <br /> $this->email->bcc('them@their-example.com'); <br /> @@ -233,7 +233,7 @@ in a loop, permitting the data to be reset between cycles.</p> <code>foreach ($list as $name => $address)<br /> {<br /> $this->email->clear();<br /><br /> - + $this->email->to($address);<br /> $this->email->from('your@example.com');<br /> $this->email->subject('Here is your info '.$name);<br /> diff --git a/user_guide/libraries/file_uploading.html b/user_guide/libraries/file_uploading.html index 31041341f..254b2666a 100644 --- a/user_guide/libraries/file_uploading.html +++ b/user_guide/libraries/file_uploading.html @@ -145,15 +145,15 @@ folder:</p> <textarea class="textarea" style="width:100%" cols="50" rows="43"><?php class Upload extends Controller { - + function Upload() { parent::Controller(); $this->load->helper(array('form', 'url')); } - + function index() - { + { $this->load->view('upload_form', array('error' => ' ' )); } @@ -164,22 +164,22 @@ class Upload extends Controller { $config['max_size'] = '100'; $config['max_width'] = '1024'; $config['max_height'] = '768'; - + $this->load->library('upload', $config); - + if ( ! $this->upload->do_upload()) { $error = array('error' => $this->upload->display_errors()); - + $this->load->view('upload_form', $error); - } + } else { $data = array('upload_data' => $this->upload->data()); - + $this->load->view('upload_success', $data); } - } + } } ?></textarea> diff --git a/user_guide/libraries/form_validation.html b/user_guide/libraries/form_validation.html index 2099135a0..1d0b57181 100644 --- a/user_guide/libraries/form_validation.html +++ b/user_guide/libraries/form_validation.html @@ -106,7 +106,7 @@ have left the old class in the library so applications currently using it will n <ol> <li>A form is displayed.</li> <li>You fill it in and submit it.</li> -<li>If you submitted something invalid, or perhaps missed a required item, the form is redisplayed containing your data +<li>If you submitted something invalid, or perhaps missed a required item, the form is redisplayed containing your data along with an error message describing the problem.</li> <li>This process continues until you have submitted a valid form.</li> </ol> @@ -225,13 +225,13 @@ folder:</p> <textarea class="textarea" style="width:100%" cols="50" rows="21"><?php class Form extends Controller { - + function index() { $this->load->helper(array('form', 'url')); - + $this->load->library('form_validation'); - + if ($this->form_validation->run() == FALSE) { $this->load->view('myform'); @@ -316,18 +316,18 @@ $this->form_validation->set_rules('email', 'Email', 'required');<br /> <textarea class="textarea" style="width:100%" cols="50" rows="28"><?php class Form extends Controller { - + function index() { $this->load->helper(array('form', 'url')); - + $this->load->library('form_validation'); - + $this->form_validation->set_rules('username', 'Username', 'required'); $this->form_validation->set_rules('password', 'Password', 'required'); $this->form_validation->set_rules('passconf', 'Password Confirmation', 'required'); $this->form_validation->set_rules('email', 'Email', 'required'); - + if ($this->form_validation->run() == FALSE) { $this->load->view('myform'); @@ -518,18 +518,18 @@ create a callback function that does that. Let's create a example of this.</p> <textarea class="textarea" style="width:100%" cols="50" rows="44"><?php class Form extends Controller { - + function index() { $this->load->helper(array('form', 'url')); - + $this->load->library('form_validation'); - + $this->form_validation->set_rules('username', 'Username', 'callback_username_check'); $this->form_validation->set_rules('password', 'Password', 'required'); $this->form_validation->set_rules('passconf', 'Password Confirmation', 'required'); $this->form_validation->set_rules('email', 'Email', 'required'); - + if ($this->form_validation->run() == FALSE) { $this->load->view('myform'); @@ -539,7 +539,7 @@ class Form extends Controller { $this->load->view('formsuccess'); } } - + function username_check($str) { if ($str == 'test') @@ -552,7 +552,7 @@ class Form extends Controller { return TRUE; } } - + } ?></textarea> @@ -616,7 +616,7 @@ $this->form_validation->set_rules('first_name', '<kbd>lang:</kbd>first_name', 'r <a name="errordelimiters"></a> <h2>Changing the Error Delimiters</h2> -<p>By default, the Form Validation class adds a paragraph tag (<p>) around each error message shown. You can either change these delimiters globally or +<p>By default, the Form Validation class adds a paragraph tag (<p>) around each error message shown. You can either change these delimiters globally or individually.</p> <ol> diff --git a/user_guide/libraries/ftp.html b/user_guide/libraries/ftp.html index a46b155b9..493177655 100644 --- a/user_guide/libraries/ftp.html +++ b/user_guide/libraries/ftp.html @@ -82,7 +82,7 @@ $this->load->library('ftp');<br /> $config['hostname'] = 'ftp.example.com';<br /> $config['username'] = 'your-username';<br /> $config['password'] = 'your-password';<br /> -$config['debug'] = TRUE;<br /> +$config['debug'] = TRUE;<br /> <br /> $this->ftp->connect($config);<br /> <br /> @@ -101,7 +101,7 @@ $this->load->library('ftp');<br /> $config['hostname'] = 'ftp.example.com';<br /> $config['username'] = 'your-username';<br /> $config['password'] = 'your-password';<br /> -$config['debug'] = TRUE;<br /> +$config['debug'] = TRUE;<br /> <br /> $this->ftp->connect($config);<br /> <br /> @@ -121,7 +121,7 @@ $this->load->library('ftp');<br /> $config['hostname'] = 'ftp.example.com';<br /> $config['username'] = 'your-username';<br /> $config['password'] = 'your-password';<br /> -$config['debug'] = TRUE;<br /> +$config['debug'] = TRUE;<br /> <br /> $this->ftp->connect($config);<br /> <br /> @@ -231,7 +231,7 @@ $this->ftp->delete_file('/public_html/joe/blog.html'); <h2>$this->ftp->delete_dir()</h2> <p>Lets you delete a directory and everything it contains. Supply the source path to the directory with a trailing slash.</p> -<p class="important"><strong>Important</strong> Be VERY careful with this function. It will recursively delete +<p class="important"><strong>Important</strong> Be VERY careful with this function. It will recursively delete <b>everything</b> within the supplied path, including sub-folders and all files. Make absolutely sure your path is correct. Try using the <kbd>list_files()</kbd> function first to verify that your path is correct.</p> @@ -242,7 +242,7 @@ $this->ftp->delete_dir('/public_html/path/to/folder/'); <h2>$this->ftp->list_files()</h2> -<p>Permits you to retrieve a list of files on your server returned as an <dfn>array</dfn>. You must supply +<p>Permits you to retrieve a list of files on your server returned as an <dfn>array</dfn>. You must supply the path to the desired directory.</p> <code> @@ -254,7 +254,7 @@ print_r($list); <h2>$this->ftp->mirror()</h2> -<p>Recursively reads a local folder and everything it contains (including sub-folders) and creates a +<p>Recursively reads a local folder and everything it contains (including sub-folders) and creates a mirror via FTP based on it. Whatever the directory structure of the original file path will be recreated on the server. You must supply a source path and a destination path:</p> diff --git a/user_guide/libraries/image_lib.html b/user_guide/libraries/image_lib.html index 3dce50bf2..98ed4f6dd 100644 --- a/user_guide/libraries/image_lib.html +++ b/user_guide/libraries/image_lib.html @@ -447,7 +447,7 @@ calling the watermark function. Here is an example:</p> <code> $config['source_image'] = '/path/to/image/mypic.jpg';<br /> -$config['wm_text'] = 'Copyright 2006 - John Doe';<br /> +$config['wm_text'] = 'Copyright 2006 - John Doe';<br /> $config['wm_type'] = 'text';<br /> $config['wm_font_path'] = './system/fonts/texb.ttf';<br /> $config['wm_font_size'] = '16';<br /> diff --git a/user_guide/libraries/loader.html b/user_guide/libraries/loader.html index 1d5a47f40..34e3929a9 100644 --- a/user_guide/libraries/loader.html +++ b/user_guide/libraries/loader.html @@ -78,8 +78,8 @@ Note: We use the terms "class" and "library" interchangeably.</p> <p>Once loaded, the library will be ready for use, using <kbd>$this->email-></kbd><samp><em>some_function</em>()</samp>.</p> -<p>Library files can be stored in subdirectories within the main "libraries" folder, or within your personal <dfn>application/libraries</dfn> folder. -To load a file located in a subdirectory, simply include the path, relative to the "libraries" folder. +<p>Library files can be stored in subdirectories within the main "libraries" folder, or within your personal <dfn>application/libraries</dfn> folder. +To load a file located in a subdirectory, simply include the path, relative to the "libraries" folder. For example, if you have file located at:</p> <code>libraries/flavors/chocolate.php</code> @@ -217,7 +217,7 @@ $this->load->library('foo_bar');</code> <p>When your controller is finished using resources from an application package, and particularly if you have other application packages you want to work with, you may wish to remove the package path so the Loader no longer looks in that folder for resources. To remove the last path added, simply call the method with no parameters.</p> <h3>$this->load->remove_package_path()</h3> - + <p>Or to remove a specific package path, specify the same path previously given to <kbd>add_package_path() for a package.</kbd>:</p> <code>$this->load->remove_package_path(<var>APPPATH</var>.'third_party/<var>foo_bar</var>/');</code> diff --git a/user_guide/libraries/output.html b/user_guide/libraries/output.html index eeb278371..a1427de7b 100644 --- a/user_guide/libraries/output.html +++ b/user_guide/libraries/output.html @@ -140,9 +140,9 @@ at the bottom of your pages for debugging and optimization purposes.</p> <h2>Parsing Execution Variables</h2> <p>CodeIgniter will parse the pseudo-variables <var>{elapsed_time}</var> and <var>{memory_usage}</var> in your output by default. To disable this, set the <var>$parse_exec_vars</var> class property to <var>FALSE</var> in your controller. - + <code>$this->output->parse_exec_vars = FALSE;</code> - + </div> <!-- END CONTENT --> diff --git a/user_guide/libraries/pagination.html b/user_guide/libraries/pagination.html index 521b708b1..42c102c8d 100644 --- a/user_guide/libraries/pagination.html +++ b/user_guide/libraries/pagination.html @@ -69,7 +69,7 @@ Pagination Class <p>Here is a simple example showing how to create pagination in one of your <a href="../general/controllers.html">controller</a> functions:</p> <code> -$this->load->library('pagination');<br /><br /> +$this->load->library('pagination');<br /><br /> $config['base_url'] = 'http://example.com/index.php/test/page/';<br /> $config['total_rows'] = '200';<br /> $config['per_page'] = '20'; diff --git a/user_guide/libraries/security.html b/user_guide/libraries/security.html index a50d94846..6d6216d95 100644 --- a/user_guide/libraries/security.html +++ b/user_guide/libraries/security.html @@ -102,6 +102,11 @@ Note: This function should only be used to deal with data upon submission. It's <code>$filename = $this->security->sanitize_filename($this->input->post('filename'));</code> +<p>If it is acceptable for the user input to include relative paths, e.g. <kbd>file/in/some/approved/folder.txt</kbd>, you can set the second optional parameter, + <samp>$relative_path</samp> to TRUE.</p> + +<code>$filename = $this->security->sanitize_filename($this->input->post('filename'), TRUE);</code> + <!-- @todo write docs for CSRF methods --> </div> diff --git a/user_guide/libraries/table.html b/user_guide/libraries/table.html index f1a46fca0..e90aca3d2 100644 --- a/user_guide/libraries/table.html +++ b/user_guide/libraries/table.html @@ -83,7 +83,7 @@ $data = array(<br /> array('John', 'Green', 'Medium') <br /> );<br /> <br /> -echo $this->table->generate($data); +echo $this->table->generate($data); </code> <p>Here is an example of a table created from a database query result. The table class will automatically generate the @@ -95,7 +95,7 @@ $this->load->library('table');<br /> <br /> $query = $this->db->query("SELECT * FROM my_table");<br /> <br /> -echo $this->table->generate($query); +echo $this->table->generate($query); </code> @@ -110,7 +110,7 @@ $this->table->add_row('Fred', 'Blue', 'Small');<br /> $this->table->add_row('Mary', 'Red', 'Large');<br /> $this->table->add_row('John', 'Green', 'Medium');<br /> <br /> -echo $this->table->generate(); +echo $this->table->generate(); </code> <p>Here is the same example, except instead of individual parameters, arrays are used:</p> @@ -124,7 +124,7 @@ $this->table->add_row(array('Fred', 'Blue', 'Small'));<br /> $this->table->add_row(array('Mary', 'Red', 'Large'));<br /> $this->table->add_row(array('John', 'Green', 'Medium'));<br /> <br /> -echo $this->table->generate(); +echo $this->table->generate(); </code> diff --git a/user_guide/libraries/typography.html b/user_guide/libraries/typography.html index 2675fa759..e78af5f9a 100644 --- a/user_guide/libraries/typography.html +++ b/user_guide/libraries/typography.html @@ -134,7 +134,7 @@ This function is identical to the native PHP <dfn>nl2br()</dfn> function, except <p>When using the Typography library in conjunction with the Template Parser library it can often be desirable to protect single and double quotes within curly braces. To enable this, set the <kbd>protect_braced_quotes</kbd> class property to <samp>TRUE</samp>.</p> - + <p>Usage example:</p> <code>$this->load->library('typography');<br /> diff --git a/user_guide/libraries/unit_testing.html b/user_guide/libraries/unit_testing.html index 0e7d1d696..84db54431 100644 --- a/user_guide/libraries/unit_testing.html +++ b/user_guide/libraries/unit_testing.html @@ -81,7 +81,7 @@ to determine if it is producing the correct data type and result. <h2>$this->unit->run( <var>test</var>, <var>expected result</var>, '<var>test name</var>', '<var>notes</var>');</h2> -<p>Where <var>test</var> is the result of the code you wish to test, <var>expected result</var> is the data type you expect, +<p>Where <var>test</var> is the result of the code you wish to test, <var>expected result</var> is the data type you expect, <var>test name</var> is an optional name you can give your test, and <var>notes</var> are optional notes. Example:</p> <code>$test = 1 + 1;<br /> diff --git a/user_guide/libraries/xmlrpc.html b/user_guide/libraries/xmlrpc.html index 8d1dbdf5f..971ab0296 100644 --- a/user_guide/libraries/xmlrpc.html +++ b/user_guide/libraries/xmlrpc.html @@ -192,7 +192,7 @@ The allowed methods are on the left side of the array. When either of those are <p>The '<var>object</var>' key is a special key that you pass an instantiated class object with, which is necessary when the method you are mapping to is not part of the CodeIgniter super object.</p> - + <p>In other words, if an XML-RPC Client sends a request for the <var>new_post</var> method, your server will load the <dfn>My_blog</dfn> class and call the <dfn>new_entry</dfn> function. If the request is for the <var>update_post</var> method, your @@ -202,7 +202,7 @@ server will load the <dfn>My_blog</dfn> class and call the <dfn>update_entry</df or if you are using standardized APIs, like the Blogger or MetaWeblog API, you'll use their function names.</p> <p>There are two additional configuration keys you may make use of when initializing the server class: <var>debug</var> can be set to TRUE in order to enable debugging, and <var>xss_clean</var> may be set to FALSE to prevent sending data through the Security library's xss_clean function. - + <h2>Processing Server Requests</h2> <p>When the XML-RPC Server receives a request and loads the class/method for processing, it will pass @@ -324,20 +324,20 @@ In it, place this code and save it to your <samp>applications/controllers/</samp <textarea class="textarea" style="width:100%" cols="50" rows="32"><?php class Xmlrpc_client extends Controller { - + function index() - { + { $this->load->helper('url'); $server_url = site_url('xmlrpc_server'); - + $this->load->library('xmlrpc'); - + $this->xmlrpc->server($server_url, 80); $this->xmlrpc->method('Greetings'); - + $request = array('How is it going?'); - $this->xmlrpc->request($request); - + $this->xmlrpc->request($request); + if ( ! $this->xmlrpc->send_request()) { echo $this->xmlrpc->display_error(); @@ -367,24 +367,24 @@ class Xmlrpc_server extends Controller { { $this->load->library('xmlrpc'); $this->load->library('xmlrpcs'); - + $config['functions']['Greetings'] = array('function' => 'Xmlrpc_server.process'); - + $this->xmlrpcs->initialize($config); $this->xmlrpcs->serve(); } - - + + function process($request) { $parameters = $request->output_parameters(); - + $response = array( array( 'you_said' => $parameters['0'], 'i_respond' => 'Not bad at all.'), 'struct'); - + return $this->xmlrpc->send_response($response); } } @@ -422,7 +422,7 @@ The Server receives the request and maps it to the "process" function, where a r )<br /> );<br /> $this->xmlrpc->request($request);</code> - + <p>You can retrieve the associative array when processing the request in the Server.</p> <code>$parameters = $request->output_parameters();<br /> |