diff options
author | Andrew <browner12@gmail.com> | 2014-02-17 19:24:00 +0100 |
---|---|---|
committer | Andrew <browner12@gmail.com> | 2014-02-17 19:24:00 +0100 |
commit | 63cb46b94c4dda33e036643fbca3d94e0ba079f0 (patch) | |
tree | a8bc36fa23e3a7de491223c896d9aadaf4e8c408 /user_guide_src | |
parent | b6d8b962e44202a74c9b9321a4a53f61a753fccf (diff) | |
parent | ffe8aded4d2210759fce3427ed04893e6c655006 (diff) |
Merge branch 'develop' into patch-1
Diffstat (limited to 'user_guide_src')
-rw-r--r-- | user_guide_src/cilexer/cilexer/cilexer.py | 2 | ||||
-rw-r--r-- | user_guide_src/source/_themes/eldocs/static/asset/css/common.css | 2 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 31 | ||||
-rw-r--r-- | user_guide_src/source/conf.py | 4 | ||||
-rw-r--r-- | user_guide_src/source/general/compatibility_functions.rst | 157 | ||||
-rw-r--r-- | user_guide_src/source/general/creating_libraries.rst | 3 | ||||
-rw-r--r-- | user_guide_src/source/general/index.rst | 1 | ||||
-rw-r--r-- | user_guide_src/source/general/reserved_names.rst | 3 | ||||
-rw-r--r-- | user_guide_src/source/libraries/calendar.rst | 4 | ||||
-rw-r--r-- | user_guide_src/source/libraries/cart.rst | 170 | ||||
-rw-r--r-- | user_guide_src/source/libraries/pagination.rst | 8 | ||||
-rw-r--r-- | user_guide_src/source/libraries/table.rst | 2 | ||||
-rw-r--r-- | user_guide_src/source/libraries/xmlrpc.rst | 131 | ||||
-rw-r--r-- | user_guide_src/source/tutorial/static_pages.rst | 2 |
14 files changed, 368 insertions, 152 deletions
diff --git a/user_guide_src/cilexer/cilexer/cilexer.py b/user_guide_src/cilexer/cilexer/cilexer.py index 1edc7e820..e9834ecb1 100644 --- a/user_guide_src/cilexer/cilexer/cilexer.py +++ b/user_guide_src/cilexer/cilexer/cilexer.py @@ -15,7 +15,7 @@ # through the world wide web, please send an email to # licensing@ellislab.com so we can send you a copy immediately. # -# Copyright (c) 2008 - 2013, EllisLab, Inc. (http://ellislab.com/) +# Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) # http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) diff --git a/user_guide_src/source/_themes/eldocs/static/asset/css/common.css b/user_guide_src/source/_themes/eldocs/static/asset/css/common.css index 962380b50..f0ce8c80c 100644 --- a/user_guide_src/source/_themes/eldocs/static/asset/css/common.css +++ b/user_guide_src/source/_themes/eldocs/static/asset/css/common.css @@ -16,7 +16,7 @@ If you did not receive a copy of the license and are unable to obtain it through the world wide web, please send an email to licensing@ellislab.com so we can send you a copy immediately. -Copyright (c) 2008 - 2013, EllisLab, Inc. (http://ellislab.com/) +Copyright (c) 2008 - 2014, EllisLab, Inc. (http://ellislab.com/) http://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 1e43ab23c..bda4cbab4 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -90,7 +90,8 @@ Release Date: Not Released - :doc:`Inflector Helper <helpers/inflector_helper>` changes include: - Changed :func:`humanize()` to allow passing an input separator as its second parameter. - - Refactored :func:`plural()` and :func:`singular()` to avoid double pluralization and support more words. + - Changed :func:`humanize()` and :func:`underscore()` to utilize `mbstring <http://php.net/mbstring>`_, if available. + - Changed :func:`plural()` and :func:`singular()` to avoid double pluralization and support more words. - :doc:`Download Helper <helpers/download_helper>` changes include: @@ -132,10 +133,14 @@ Release Date: Not Released - Added *colors* configuration to allow customization for the *background*, *border*, *text* and *grid* colors. - Added *filename* to the returned array elements. + - :doc:`Text Helper <helpers/text_helper>` changes include: + + - Changed the default tag for use in :func:`highlight_phrase()` to ``<mark>`` (formerly ``<strong>``). + - Changed :func:`character_limiter()`, :func:`word_wrap()` and :func:`ellipsize()` to utilize `mbstring <http://php.net/mbstring>`_ or `iconv <http://php.net/iconv>`_, if available. + - :doc:`Directory Helper <helpers/directory_helper>` :func:`directory_map()` will now append ``DIRECTORY_SEPARATOR`` to directory names in the returned array. - :doc:`Array Helper <helpers/array_helper>` :func:`element()` and :func:`elements()` now return NULL instead of FALSE when the required elements don't exist. - :doc:`Language Helper <helpers/language_helper>` :func:`lang()` now accepts an optional list of additional HTML attributes. - - Changed the default tag for use in :doc:`Text Helper <helpers/text_helper>` :func:`highlight_phrase()` to ``<mark>`` (formerly ``<strong>``). - Deprecated the :doc:`Email Helper <helpers/email_helper>` as its ``valid_email()``, ``send_email()`` functions are now only aliases for PHP native functions ``filter_var()`` and ``mail()`` respectively. - Database @@ -298,11 +303,12 @@ Release Date: Not Released - :doc:`Cart Library <libraries/cart>` changes include: - - ``insert()`` now auto-increments quantity for an item when inserted twice instead of resetting it, this is the default behaviour of large e-commerce sites. - - *Product Name* strictness can be disabled by switching the ``$product_name_safe`` property to FALSE. - Added method ``remove()`` to remove a cart item, updating with quantity of 0 seemed like a hack but has remained to retain compatibility. - Added method ``get_item()`` to enable retrieving data for a single cart item. - Added unicode support for product names. + - Added support for disabling product name strictness via the ``$product_name_safe`` property. + - Changed ``insert()`` method to auto-increment quantity for an item when inserted twice instead of resetting it. + - Changed ``update()`` method to support updating all properties attached to an item. - :doc:`Image Manipulation Library <libraries/image_lib>` changes include: @@ -361,11 +367,12 @@ Release Date: Not Released - :doc:`Pagination Library <libraries/pagination>` changes include: + - Deprecated usage of the "anchor_class" setting (use the new "attributes" setting instead). - Added method chaining support to ``initialize()`` method. - Added support for the anchor "rel" attribute. - Added support for setting custom attributes. - - Deprecated usage of the "anchor_class" setting (use the new "attributes" setting instead). - - Added $config['reuse_query_string'] to allow automatic repopulation of query string arguments, combined with normal URI segments. + - Added support for language translations of the *first_link*, *next_link*, *prev_link* and *last_link* values. + - Added ``$config['reuse_query_string']`` to allow automatic repopulation of query string arguments, combined with normal URI segments. - Removed the default `` `` from a number of the configuration variables. - :doc:`Profiler Library <general/profiling>` changes include: @@ -396,6 +403,7 @@ Release Date: Not Released - Added support for setting table class defaults in a config file. - :doc:`Zip Library <libraries/zip>` method ``read_file()`` can now also alter the original file path/name while adding files to an archive. + - :doc:`Trackback Library <libraries/trackback>` method ``receive()`` will now utilize ``iconv()`` if it is available but ``mb_convert_encoding()`` is not. - Core @@ -489,9 +497,17 @@ Release Date: Not Released - Language files are now loaded in a cascading style with the one in **system/** always loaded and overriden afterwards, if another one is found. - :doc:`Hooks Library <general/hooks>` changes include: + - Renamed method ``_call_hook()`` to ``call_hook()``. - Class instances are now stored in order to maintain their state. + - UTF-8 Library changes include: + + - ``UTF8_ENABLED`` now requires only one of `Multibyte String <http://php.net/mbstring>`_ or `iconv <http://php.net/iconv>`_ to be available instead of both. + - Changed method ``clean_string()`` to utilize ``mb_convert_encoding()`` if it is available but ``iconv()`` is not. + - Renamed method ``_is_ascii()`` to ``is_ascii()`` and made it public. + + - Added `compatibility layers <general/compatibility_functions>` for PHP's `mbstring <http://php.net/mbstring>`_ (limited support) and `password <http://php.net/password>`_ extensions. - Removed ``CI_CORE`` boolean constant from *CodeIgniter.php* (no longer Reactor and Core versions). - Log Library will now try to create the **log_path** directory if it doesn't exist. - Added support for HTTP-Only cookies with new config option *cookie_httponly* (default FALSE). @@ -693,6 +709,9 @@ Bug fixes for 3.0 - Fixed a bug (#2771) - :doc:`Security Library <libraries/security>` method ``xss_clean()`` didn't take into account HTML5 entities. - Fixed a bug in the :doc:`Session Library <libraries/sessions>` 'cookie' driver where authentication was not performed for encrypted cookies. - Fixed a bug (#2856) - ODBC method ``affected_rows()`` passed an incorrect value to ``odbc_num_rows()``. +- Fixed a bug (#43) :doc:`Image Manipulation Library <libraries/image_lib>` method ``text_watermark()`` didn't properly determine watermark placement. +- Fixed a bug where :doc:`HTML Table Library <libraries/table>` ignored its *auto_heading* setting if headings were not already set. +- Fixed a bug (#2364) - :doc:`Pagination Library <libraries/pagination>` appended the query string (if used) multiple times when there are successive calls to ``create_links()`` with no ``initialize()`` in between them. Version 2.1.4 ============= diff --git a/user_guide_src/source/conf.py b/user_guide_src/source/conf.py index 6d77db060..3f9b2e476 100644 --- a/user_guide_src/source/conf.py +++ b/user_guide_src/source/conf.py @@ -41,7 +41,7 @@ master_doc = 'index' # General information about the project. project = u'CodeIgniter' -copyright = u'2013, EllisLab, Inc.' +copyright = u'2014, EllisLab, Inc.' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -224,7 +224,7 @@ man_pages = [ epub_title = u'CodeIgniter' epub_author = u'EllisLab, Inc.' epub_publisher = u'EllisLab, Inc.' -epub_copyright = u'2013, EllisLab, Inc.' +epub_copyright = u'2014, EllisLab, Inc.' # The language of the text. It defaults to the language option # or en if the language is not set. diff --git a/user_guide_src/source/general/compatibility_functions.rst b/user_guide_src/source/general/compatibility_functions.rst new file mode 100644 index 000000000..e025d2aa3 --- /dev/null +++ b/user_guide_src/source/general/compatibility_functions.rst @@ -0,0 +1,157 @@ +####################### +Compatibility Functions +####################### + +CodeIgniter provides a set of compatibility functions that enable +you to use functions what are otherwise natively available in PHP, +but only in higher versions or depending on a certain extension. + +Being custom implementations, these functions will also have some +set of dependancies on their own, but are still useful if your +PHP setup doesn't offer them natively. + +.. note:: Much like the `common functions <common_functions>`, the + compatibility functions are always available, as long as + their dependancies are met. + +.. contents:: + :local: + +.. raw:: html + + <div class="custom-index container"></div> + +**************** +Password Hashing +**************** + +This set of compatibility functions offers a "backport" of PHP's +standard `Password Hashing extension <http://php.net/password>`_ +that is otherwise available only since PHP 5.5. + +Dependancies +============ + +- PHP 5.3.7 +- ``CRYPT_BLOWFISH`` support for ``crypt()`` + +Constants +========= + +- ``PASSWORD_BCRYPT`` +- ``PASSWORD_DEFAULT`` + +Function reference +================== + +.. function:: password_get_info($hash) + + :param string $hash: Password hash + :returns: Information about the hashed password + :rtype: array + + For more information, please refer to the `PHP manual for + password_get_info() <http://php.net/password_get_info>`_. + +.. function:: password_hash($password, $algo[, $options = array()]) + + :param string $password: Plain-text password + :param int $algo: Hashing algorithm + :param array $options: Hashing options + :returns: Hashed password or FALSE on failure + :rtype: string + + For more information, please refer to the `PHP manual for + password_hash() <http://php.net/password_hash>`_. + + .. note:: Unless you provide your own (and valid) salt, this function + has a further dependancy on an available CSPRNG source. Each + of the following would satisfy that: + - ``mcrypt_create_iv()`` with ``MCRYPT_DEV_URANDOM`` + - ``openssl_random_pseudo_bytes()`` + - /dev/arandom + - /dev/urandom + +.. function:: password_needs_rehash() + + :param string $hash: Password hash + :param int $algo: Hashing algorithm + :param array $options: Hashing options + :returns: TRUE if the hash should be rehashed to match the given algorithm and options, FALSE otherwise + :rtype: bool + + For more information, please refer to the `PHP manual for + password_needs_rehash() <http://php.net/password_needs_rehash>`_. + +.. function:: password_verify($password, $hash) + + :param string $password: Plain-text password + :param string $hash: Password hash + :returns: TRUE if the password matches the hash, FALSE if not + :rtype: bool + + For more information, please refer to the `PHP manual for + password_verify() <http://php.net/password_verify>`_. + +**************** +Multibyte String +**************** + +This set of compatibility functions offers limited support for PHP's +`Multibyte String extension <http://php.net/mbstring>`_. Because of +the limited alternative solutions, only a few functions are available. + +.. note:: When a character set parameter is ommited, + ``$config['charset']`` will be used. + +Dependancies +============ + +- `iconv <http://php.net/iconv>`_ extension + +.. important:: This dependancy is optional and these functions will + always be declared. If iconv is not available, they WILL + fall-back to their non-mbstring versions. + +.. important:: Where a character set is supplied, it must be + supported by iconv and in a format that it recognizes. + +.. note:: For you own dependancy check on the actual mbstring + extension, use the ``MB_ENABLED`` constant. + +Function reference +================== + +.. function:: mb_strlen($str[, $encoding = NULL]) + + :param string $str: Input string + :param string $encoding: Character set + :returns: Number of characters in the input string or FALSE on failure + :rtype: string + + For more information, please refer to the `PHP manual for + mb_strlen() <http://php.net/mb_strlen>`_. + +.. function:: mb_strpos($haystack, $needle[, $offset = 0[, $encoding = NULL]]) + + :param string $haystack: String to search in + :param string $needle: Part of string to search for + :param int $offset: Search offset + :param string $encoding: Character set + :returns: Numeric character position of where $needle was found or FALSE if not found + :rtype: mixed + + For more information, please refer to the `PHP manual for + mb_strpos() <http://php.net/mb_strpos>`_. + +.. function:: mb_substr($str, $start[, $length = NULL[, $encoding = NULL]]) + + :param string $str: Input string + :param int $start: Position of first character + :param int $length: Maximum number of characters + :param string $encoding: Character set + :returns: Portion of $str specified by $start and $length or FALSE on failure + :rtype: string + + For more information, please refer to the `PHP manual for + mb_substr() <http://php.net/mb_substr>`_.
\ No newline at end of file diff --git a/user_guide_src/source/general/creating_libraries.rst b/user_guide_src/source/general/creating_libraries.rst index 4beb600da..a1e1b3e78 100644 --- a/user_guide_src/source/general/creating_libraries.rst +++ b/user_guide_src/source/general/creating_libraries.rst @@ -44,7 +44,8 @@ The Class File Classes should have this basic prototype:: - <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed'); + <?php + defined('BASEPATH') OR exit('No direct script access allowed'); class Someclass { diff --git a/user_guide_src/source/general/index.rst b/user_guide_src/source/general/index.rst index 2bc684a1d..195c4a98a 100644 --- a/user_guide_src/source/general/index.rst +++ b/user_guide_src/source/general/index.rst @@ -20,6 +20,7 @@ General Topics hooks autoloader common_functions + compatibility_functions routing errors Caching <caching> diff --git a/user_guide_src/source/general/reserved_names.rst b/user_guide_src/source/general/reserved_names.rst index a767651fb..81a05ace6 100644 --- a/user_guide_src/source/general/reserved_names.rst +++ b/user_guide_src/source/general/reserved_names.rst @@ -61,6 +61,9 @@ Constants - APPPATH - VIEWPATH - CI_VERSION +- MB_ENABLED +- ICONV_ENABLED +- UTF8_ENABLED - FILE_READ_MODE - FILE_WRITE_MODE - DIR_READ_MODE diff --git a/user_guide_src/source/libraries/calendar.rst b/user_guide_src/source/libraries/calendar.rst index 65a447a3d..2263aa404 100644 --- a/user_guide_src/source/libraries/calendar.rst +++ b/user_guide_src/source/libraries/calendar.rst @@ -248,14 +248,14 @@ Class Reference you submit 13 as the month, the year will increment and the month will become January:: - print_r($this->calendar->adjust_date(13, 2013)); + print_r($this->calendar->adjust_date(13, 2014)); outputs:: Array ( [month] => '01' - [year] => '2014' + [year] => '2015' ) .. method:: get_total_days($month, $year) diff --git a/user_guide_src/source/libraries/cart.rst b/user_guide_src/source/libraries/cart.rst index fb92c280a..d7d495967 100644 --- a/user_guide_src/source/libraries/cart.rst +++ b/user_guide_src/source/libraries/cart.rst @@ -33,7 +33,7 @@ Initializing the Shopping Cart Class utilize a database. To initialize the Shopping Cart Class in your controller constructor, -use the $this->load->library function:: +use the ``$this->load->library()`` method:: $this->load->library('cart'); @@ -49,16 +49,16 @@ Adding an Item to The Cart ========================== To add an item to the shopping cart, simply pass an array with the -product information to the $this->cart->insert() function, as shown +product information to the ``$this->cart->insert()`` method, as shown below:: $data = array( - 'id' => 'sku_123ABC', - 'qty' => 1, - 'price' => 39.95, - 'name' => 'T-Shirt', - 'options' => array('Size' => 'L', 'Color' => 'Red') - ); + 'id' => 'sku_123ABC', + 'qty' => 1, + 'price' => 39.95, + 'name' => 'T-Shirt', + 'options' => array('Size' => 'L', 'Color' => 'Red') + ); $this->cart->insert($data); @@ -88,7 +88,19 @@ array will be stored in the session. However, it is best to standardize your data among all your products in order to make displaying the information in a table easier. -The insert() method will return the $rowid if you successfully insert a +:: + + $data = array( + 'id' => 'sku_123ABC', + 'qty' => 1, + 'price' => 39.95, + 'name' => 'T-Shirt', + 'coupon' => 'XMAS-50OFF' + ); + + $this->cart->insert($data); + +The ``insert()`` method will return the $rowid if you successfully insert a single item. Adding Multiple Items to The Cart @@ -102,26 +114,26 @@ same page. :: $data = array( - array( - 'id' => 'sku_123ABC', - 'qty' => 1, - 'price' => 39.95, - 'name' => 'T-Shirt', - 'options' => array('Size' => 'L', 'Color' => 'Red') - ), - array( - 'id' => 'sku_567ZYX', - 'qty' => 1, - 'price' => 9.95, - 'name' => 'Coffee Mug' - ), - array( - 'id' => 'sku_965QRS', - 'qty' => 1, - 'price' => 29.95, - 'name' => 'Shot Glass' - ) - ); + array( + 'id' => 'sku_123ABC', + 'qty' => 1, + 'price' => 39.95, + 'name' => 'T-Shirt', + 'options' => array('Size' => 'L', 'Color' => 'Red') + ), + array( + 'id' => 'sku_567ZYX', + 'qty' => 1, + 'price' => 9.95, + 'name' => 'Coffee Mug' + ), + array( + 'id' => 'sku_965QRS', + 'qty' => 1, + 'price' => 29.95, + 'name' => 'Shot Glass' + ) + ); $this->cart->insert($data); @@ -136,15 +148,15 @@ helper </helpers/form_helper>`. :: - <?php echo form_open('path/to/controller/update/function'); ?> + <?php echo form_open('path/to/controller/update/method'); ?> <table cellpadding="6" cellspacing="1" style="width:100%" border="0"> <tr> - <th>QTY</th> - <th>Item Description</th> - <th style="text-align:right">Item Price</th> - <th style="text-align:right">Sub-Total</th> + <th>QTY</th> + <th>Item Description</th> + <th style="text-align:right">Item Price</th> + <th style="text-align:right">Sub-Total</th> </tr> <?php $i = 1; ?> @@ -154,9 +166,9 @@ helper </helpers/form_helper>`. <?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']; ?> + <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): ?> @@ -170,9 +182,9 @@ helper </helpers/form_helper>`. <?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> + </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> </tr> <?php $i++; ?> @@ -180,9 +192,9 @@ helper </helpers/form_helper>`. <?php endforeach; ?> <tr> - <td colspan="2"> </td> - <td class="right"><strong>Total</strong></td> - <td class="right">$<?php echo $this->cart->format_number($this->cart->total()); ?></td> + <td colspan="2"> </td> + <td class="right"><strong>Total</strong></td> + <td class="right">$<?php echo $this->cart->format_number($this->cart->total()); ?></td> </tr> </table> @@ -193,8 +205,8 @@ Updating The Cart ================= To update the information in your cart, you must pass an array -containing the Row ID and quantity to the $this->cart->update() -function: +containing the Row ID and quantity to the ``$this->cart->update()`` +method. .. note:: If the quantity is set to zero, the item will be removed from the cart. @@ -202,38 +214,52 @@ function: :: $data = array( - 'rowid' => 'b99ccdf16028f015540f341130b6d8ec', - 'qty' => 3 - ); + 'rowid' => 'b99ccdf16028f015540f341130b6d8ec', + 'qty' => 3 + ); $this->cart->update($data); // Or a multi-dimensional array $data = array( - array( - 'rowid' => 'b99ccdf16028f015540f341130b6d8ec', - 'qty' => 3 - ), - array( - 'rowid' => 'xw82g9q3r495893iajdh473990rikw23', - 'qty' => 4 - ), - array( - 'rowid' => 'fh4kdkkkaoe30njgoe92rkdkkobec333', - 'qty' => 2 - ) - ); + array( + 'rowid' => 'b99ccdf16028f015540f341130b6d8ec', + 'qty' => 3 + ), + array( + 'rowid' => 'xw82g9q3r495893iajdh473990rikw23', + 'qty' => 4 + ), + array( + 'rowid' => 'fh4kdkkkaoe30njgoe92rkdkkobec333', + 'qty' => 2 + ) + ); + + $this->cart->update($data); + +You may also update any property you have previously defined when +inserting the item such as options, price or other custom fields. + +:: + + $data = array( + 'rowid' => 'b99ccdf16028f015540f341130b6d8ec', + 'qty' => 1, + 'price' => 49.95, + 'coupon' => NULL + ); $this->cart->update($data); What is a Row ID? ***************** -The row ID is a unique identifier that is -generated by the cart code when an item is added to the cart. The reason -a unique ID is created is so that identical products with different -options can be managed by the cart. +The row ID is a unique identifier that is generated by the cart code +when an item is added to the cart. The reason a unique ID is created +is so that identical products with different options can be managed +by the cart. For example, let's say someone buys two identical t-shirts (same product ID), but in different sizes. The product ID (and other attributes) will @@ -247,9 +273,9 @@ In nearly all cases, updating the cart will be something the user does via the "view cart" page, so as a developer, it is unlikely that you will ever have to concern yourself with the "row ID", other than making sure your "view cart" page contains this information in a hidden form -field, and making sure it gets passed to the update function when the -update form is submitted. Please examine the construction of the "view -cart" page above for more information. +field, and making sure it gets passed to the ``update()`` method when +the update form is submitted. Please examine the construction of the +"view cart" page above for more information. *************** @@ -289,10 +315,10 @@ Class Reference :returns: TRUE on success, FALSE on failure :rtype: bool - This method permits the quantity of a given item to be changed. + This method permits changing the properties of a given item. Typically it is called from the "view cart" page if a user makes changes - to the quantity before checkout. That array must contain the product ID - and quantity for each item. + to the quantity before checkout. That array must contain the rowid + and qty for each item. .. method:: remove($rowid) @@ -347,7 +373,7 @@ Class Reference Returns TRUE (boolean) if a particular row in the cart contains options. This method is designed to be used in a loop with ``contents()``, since - you must pass the rowid to this function, as shown in the Displaying + you must pass the rowid to this method, as shown in the Displaying the Cart example above. .. method:: product_options([$row_id = '']) diff --git a/user_guide_src/source/libraries/pagination.rst b/user_guide_src/source/libraries/pagination.rst index ee12d9e6f..d8d31f8c5 100644 --- a/user_guide_src/source/libraries/pagination.rst +++ b/user_guide_src/source/libraries/pagination.rst @@ -165,6 +165,8 @@ $config['first_link'] = 'First'; The text you would like shown in the "first" link on the left. If you do not want this link rendered, you can set its value to FALSE. +.. note:: This value can also be translated via a language file. + $config['first_tag_open'] = '<div>'; ==================================== @@ -185,6 +187,8 @@ $config['last_link'] = 'Last'; The text you would like shown in the "last" link on the right. If you do not want this link rendered, you can set its value to FALSE. +.. note:: This value can also be translated via a language file. + $config['last_tag_open'] = '<div>'; =================================== @@ -205,6 +209,8 @@ $config['next_link'] = '>'; The text you would like shown in the "next" page link. If you do not want this link rendered, you can set its value to FALSE. +.. note:: This value can also be translated via a language file. + $config['next_tag_open'] = '<div>'; =================================== @@ -225,6 +231,8 @@ $config['prev_link'] = '<'; The text you would like shown in the "previous" page link. If you do not want this link rendered, you can set its value to FALSE. +.. note:: This value can also be translated via a language file. + $config['prev_tag_open'] = '<div>'; =================================== diff --git a/user_guide_src/source/libraries/table.rst b/user_guide_src/source/libraries/table.rst index 6e011083e..9d95eddfc 100644 --- a/user_guide_src/source/libraries/table.rst +++ b/user_guide_src/source/libraries/table.rst @@ -139,7 +139,7 @@ Class Reference .. class:: CI_Table - .. attribute:: $function = FALSE + .. attribute:: $function = NULL Allows you to specify a native PHP function or a valid function array object to be applied to all cell data. :: diff --git a/user_guide_src/source/libraries/xmlrpc.rst b/user_guide_src/source/libraries/xmlrpc.rst index 2cf548750..c2e9a1113 100644 --- a/user_guide_src/source/libraries/xmlrpc.rst +++ b/user_guide_src/source/libraries/xmlrpc.rst @@ -123,12 +123,12 @@ If you use data types other than strings, or if you have several different data types, you will place each parameter into its own array, with the data type in the second position:: - $request = array ( - array('John', 'string'), - array('Doe', 'string'), - array(FALSE, 'boolean'), - array(12345, 'int') - ); + $request = array( + array('John', 'string'), + array('Doe', 'string'), + array(FALSE, 'boolean'), + array(12345, 'int') + ); $this->xmlrpc->request($request); The `Data Types <#datatypes>`_ section below has a full list of data @@ -171,7 +171,7 @@ not part of the CodeIgniter super object. In other words, if an XML-RPC Client sends a request for the new_post method, your server will load the My_blog class and call the new_entry function. If the request is for the update_post method, your server -will load the My_blog class and call the update_entry function. +will load the My_blog class and call the ``update_entry()`` method. 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 @@ -181,7 +181,7 @@ 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. +data through the Security library's ``xss_clean()`` method. Processing Server Requests ========================== @@ -207,49 +207,52 @@ 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(). Using this method, an XML-RPC +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 function might look:: class My_blog extends CI_Controller { - function getUserInfo($request) - { - $username = 'smitty'; - $password = 'secretsmittypass'; + public function getUserInfo($request) + { + $username = 'smitty'; + $password = 'secretsmittypass'; - $this->load->library('xmlrpc'); + $this->load->library('xmlrpc'); - $parameters = $request->output_parameters(); + $parameters = $request->output_parameters(); - if ($parameters['1'] != $username AND $parameters['2'] != $password) - { - return $this->xmlrpc->send_error_message('100', 'Invalid Access'); - } + if ($parameters[1] != $username && $parameters[2] != $password) + { + return $this->xmlrpc->send_error_message('100', 'Invalid Access'); + } - $response = array(array('nickname' => array('Smitty','string'), - 'userid' => array('99','string'), - 'url' => array('http://yoursite.com','string'), - 'email' => array('jsmith@yoursite.com','string'), - 'lastname' => array('Smith','string'), - 'firstname' => array('John','string') - ), - 'struct'); + $response = array( + array( + 'nickname' => array('Smitty', 'string'), + 'userid' => array('99', 'string'), + 'url' => array('http://yoursite.com', 'string'), + 'email' => array('jsmith@yoursite.com', 'string'), + 'lastname' => array('Smith', 'string'), + 'firstname' => array('John', 'string') + ), + 'struct' + ); - return $this->xmlrpc->send_response($response); - } + return $this->xmlrpc->send_response($response); + } } Notes: ------ -The output_parameters() function retrieves an indexed array +The ``output_parameters()`` method retrieves an indexed array corresponding to the request parameters sent by the client. In the above example, the output parameters will be the username and password. If the username and password sent by the client were not valid, and -error message is returned using send_error_message(). +error message is returned using ``send_error_message()``. If the operation was successful, the client will be sent back a response array containing the user's info. @@ -263,22 +266,22 @@ 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:: - $response = array ( - array( - 'first_name' => array('John', 'string'), - 'last_name' => array('Doe', 'string'), - 'member_id' => array(123435, 'int'), - 'todo_list' => array(array('clean house', 'call mom', 'water plants'), 'array'), - ), - 'struct' - ); + $response = array( + array( + 'first_name' => array('John', 'string'), + 'last_name' => array('Doe', 'string'), + 'member_id' => array(123435, 'int'), + 'todo_list' => array(array('clean house', 'call mom', 'water plants'), 'array'), + ), + 'struct' + ); Notice that the above array is formatted as a struct. This is the most common data type for responses. @@ -373,17 +376,16 @@ folder:: $parameters = $request->output_parameters(); $response = array( - array( - 'you_said' => $parameters[0], - 'i_respond' => 'Not bad at all.' - ), - 'struct' - ); + array( + 'you_said' => $parameters[0], + 'i_respond' => 'Not bad at all.' + ), + 'struct' + ); return $this->xmlrpc->send_response($response); } } - ?> Try it! @@ -398,7 +400,7 @@ back to you. The client you created sends a message ("How's is going?") to the server, along with a request for the "Greetings" method. The Server -receives the request and maps it to the "process" function, where a +receives the request and maps it to the ``process()`` method, where a response is sent back. Using Associative Arrays In a Request Parameter @@ -408,22 +410,21 @@ If you wish to use an associative array in your method parameters you will need to use a struct datatype:: $request = array( - array( - // Param 0 - array( - 'name'=>'John' - ), - 'struct' - ), - array( - // Param 1 - array( - 'size'=>'large', - 'shape'=>'round' - ), - 'struct' - ) - ); + array( + // Param 0 + array('name' => 'John'), + 'struct' + ), + array( + // Param 1 + array( + 'size' => 'large', + 'shape'=>'round' + ), + 'struct' + ) + ); + $this->xmlrpc->request($request); You can retrieve the associative array when processing the request in diff --git a/user_guide_src/source/tutorial/static_pages.rst b/user_guide_src/source/tutorial/static_pages.rst index 330a50ecf..36bcd2df9 100644 --- a/user_guide_src/source/tutorial/static_pages.rst +++ b/user_guide_src/source/tutorial/static_pages.rst @@ -72,7 +72,7 @@ includes the following code: :: - <em>© 2013</em> + <em>© 2014</em> </body> <html> |