summaryrefslogtreecommitdiffstats
path: root/user_guide_src/source/general
diff options
context:
space:
mode:
authorDiederikLascaris <info@runesa.nl>2017-01-22 21:45:15 +0100
committerDiederikLascaris <info@runesa.nl>2017-01-22 21:45:15 +0100
commit312efeba32d532878c536fd28e75f39d61a9dade (patch)
tree71ae4aaca33a9d34a789d6d375acd2594160123a /user_guide_src/source/general
parent947f1a06093a52a32b703ee795e52c22cd66363a (diff)
parent44c7af639ac1726780b64fb5a6cb6fca2df8b651 (diff)
Merge branch 'develop' of git://github.com/bcit-ci/CodeIgniter into develop
Diffstat (limited to 'user_guide_src/source/general')
-rw-r--r--user_guide_src/source/general/cli.rst6
-rw-r--r--user_guide_src/source/general/common_functions.rst8
-rw-r--r--user_guide_src/source/general/compatibility_functions.rst44
-rw-r--r--user_guide_src/source/general/controllers.rst22
-rw-r--r--user_guide_src/source/general/core_classes.rst1
-rw-r--r--user_guide_src/source/general/errors.rst3
-rw-r--r--user_guide_src/source/general/hooks.rst4
-rw-r--r--user_guide_src/source/general/models.rst8
-rw-r--r--user_guide_src/source/general/requirements.rst8
-rw-r--r--user_guide_src/source/general/routing.rst36
-rw-r--r--user_guide_src/source/general/security.rst10
-rw-r--r--user_guide_src/source/general/styleguide.rst6
12 files changed, 60 insertions, 96 deletions
diff --git a/user_guide_src/source/general/cli.rst b/user_guide_src/source/general/cli.rst
index b45be1aa8..764a6b835 100644
--- a/user_guide_src/source/general/cli.rst
+++ b/user_guide_src/source/general/cli.rst
@@ -47,11 +47,11 @@ in it::
Then save the file to your *application/controllers/* folder.
-Now normally you would visit the your site using a URL similar to this::
+Now normally you would visit the site using a URL similar to this::
example.com/index.php/tools/message/to
-Instead, we are going to open Terminal in Mac/Linux or go to Run > "cmd"
+Instead, we are going to open the terminal in Mac/Linux or go to Run > "cmd"
in Windows and navigate to our CodeIgniter project.
.. code-block:: bash
@@ -75,4 +75,4 @@ That's it!
That, in a nutshell, is all there is to know about controllers on the
command line. Remember that this is just a normal controller, so routing
-and ``_remap()`` works fine. \ No newline at end of file
+and ``_remap()`` works fine.
diff --git a/user_guide_src/source/general/common_functions.rst b/user_guide_src/source/general/common_functions.rst
index 6d6744cf7..77b0df14e 100644
--- a/user_guide_src/source/general/common_functions.rst
+++ b/user_guide_src/source/general/common_functions.rst
@@ -24,9 +24,9 @@ loading any libraries or helpers.
Example::
- if (is_php('5.3'))
+ if (is_php('5.5'))
{
- $str = quoted_printable_encode($str);
+ echo json_last_error_msg();
}
Returns boolean TRUE if the installed version of PHP is equal to or
@@ -101,7 +101,7 @@ loading any libraries or helpers.
.. php:function:: set_status_header($code[, $text = ''])
- :param int $code: HTTP Reponse status code
+ :param int $code: HTTP Response status code
:param string $text: A custom message to set with the status code
:rtype: void
@@ -185,4 +185,4 @@ loading any libraries or helpers.
.. note:: This function was introduced because Suhosin terminated
script execution, but this turned out to be a bug. A fix
has been available for some time (version 0.9.34), but is
- unfortunately not released yet. \ No newline at end of file
+ unfortunately not released yet.
diff --git a/user_guide_src/source/general/compatibility_functions.rst b/user_guide_src/source/general/compatibility_functions.rst
index 434b0982f..522e43f60 100644
--- a/user_guide_src/source/general/compatibility_functions.rst
+++ b/user_guide_src/source/general/compatibility_functions.rst
@@ -10,7 +10,7 @@ Being custom implementations, these functions will also have some
set of dependencies 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
+.. note:: Much like the :doc:`common functions <common_functions>`, the
compatibility functions are always available, as long as
their dependencies are met.
@@ -32,7 +32,6 @@ that is otherwise available only since PHP 5.5.
Dependencies
============
-- PHP 5.3.7
- ``CRYPT_BLOWFISH`` support for ``crypt()``
Constants
@@ -221,44 +220,3 @@ Function reference
For more information, please refer to the `PHP manual for
array_column() <http://php.net/array_column>`_.
-
-.. php:function:: array_replace(array $array1[, ...])
-
- :param array $array1: Array in which to replace elements
- :param array ...: Array (or multiple ones) from which to extract elements
- :returns: Modified array
- :rtype: array
-
- For more information, please refer to the `PHP manual for
- array_replace() <http://php.net/array_replace>`_.
-
-.. php:function:: array_replace_recursive(array $array1[, ...])
-
- :param array $array1: Array in which to replace elements
- :param array ...: Array (or multiple ones) from which to extract elements
- :returns: Modified array
- :rtype: array
-
- For more information, please refer to the `PHP manual for
- array_replace_recursive() <http://php.net/array_replace_recursive>`_.
-
- .. important:: Only PHP's native function can detect endless recursion.
- Unless you are running PHP 5.3+, be careful with references!
-
-.. php:function:: hex2bin($data)
-
- :param array $data: Hexadecimal representation of data
- :returns: Binary representation of the given data
- :rtype: string
-
- For more information, please refer to the `PHP manual for hex2bin()
- <http://php.net/hex2bin>`_.
-
-.. php:function:: quoted_printable_encode($str)
-
- :param string $str: Input string
- :returns: 8bit-encoded string
- :rtype: string
-
- For more information, please refer to the `PHP manual for
- quoted_printable_encode() <http://php.net/quoted_printable_encode>`_. \ No newline at end of file
diff --git a/user_guide_src/source/general/controllers.rst b/user_guide_src/source/general/controllers.rst
index 7ab5a7f6a..5a111d8dc 100644
--- a/user_guide_src/source/general/controllers.rst
+++ b/user_guide_src/source/general/controllers.rst
@@ -140,9 +140,12 @@ file and set this variable::
$route['default_controller'] = 'blog';
-Where Blog is the name of the controller class you want used. If you now
+Where 'blog' is the name of the controller class you want used. If you now
load your main index.php file without specifying any URI segments you'll
-see your Hello World message by default.
+see your "Hello World" message by default.
+
+For more information, please refer to the "Reserved Routes" section of the
+:doc:`URI Routing <routing>` documentation.
Remapping Method Calls
======================
@@ -263,12 +266,12 @@ Trying to access it via the URL, like this, will not work::
Organizing Your Controllers into Sub-directories
================================================
-If you are building a large application you might find it convenient to
-organize your controllers into sub-directories. CodeIgniter permits you
-to do this.
+If you are building a large application you might want to hierarchically
+organize or structure your controllers into sub-directories. CodeIgniter
+permits you to do this.
-Simply create folders within your *application/controllers/* directory
-and place your controller classes within them.
+Simply create sub-directories under the main *application/controllers/*
+one and place your controller classes within them.
.. note:: When using this feature the first segment of your URI must
specify the folder. For example, let's say you have a controller located
@@ -281,8 +284,9 @@ and place your controller classes within them.
example.com/index.php/products/shoes/show/123
Each of your sub-directories may contain a default controller which will be
-called if the URL contains only the sub-folder. Simply name your default
-controller as specified in your *application/config/routes.php* file.
+called if the URL contains *only* the sub-directory. Simply put a controller
+in there that matches the name of your 'default_controller' as specified in
+your *application/config/routes.php* file.
CodeIgniter also permits you to remap your URIs using its :doc:`URI
Routing <routing>` feature.
diff --git a/user_guide_src/source/general/core_classes.rst b/user_guide_src/source/general/core_classes.rst
index 07c0b00ba..79f73ef06 100644
--- a/user_guide_src/source/general/core_classes.rst
+++ b/user_guide_src/source/general/core_classes.rst
@@ -101,6 +101,7 @@ your new class in your application controller's constructors.
public function __construct()
{
parent::__construct();
+ // Your own constructor code
}
public function index()
diff --git a/user_guide_src/source/general/errors.rst b/user_guide_src/source/general/errors.rst
index 9c190feb1..a1cc3517a 100644
--- a/user_guide_src/source/general/errors.rst
+++ b/user_guide_src/source/general/errors.rst
@@ -78,11 +78,10 @@ The following functions let you generate errors:
CodeIgniter automatically logs any ``show_404()`` calls. Setting the
optional second parameter to FALSE will skip logging.
-.. php:function:: log_message($level, $message, $php_error = FALSE)
+.. php:function:: log_message($level, $message)
:param string $level: Log level: 'error', 'debug' or 'info'
:param string $message: Message to log
- :param bool $php_error: Whether we're logging a native PHP error message
:rtype: void
This function lets you write messages to your log files. You must
diff --git a/user_guide_src/source/general/hooks.rst b/user_guide_src/source/general/hooks.rst
index ffe3fef39..6cc3407a3 100644
--- a/user_guide_src/source/general/hooks.rst
+++ b/user_guide_src/source/general/hooks.rst
@@ -56,8 +56,8 @@ defined in your associative hook array:
- **params** Any parameters you wish to pass to your script. This item
is optional.
-If you're running PHP 5.3+, you can also use lambda/anoymous functions
-(or closures) as hooks, with a simpler syntax::
+You can also use lambda/anoymous functions (or closures) as hooks, with
+a simpler syntax::
$hook['post_controller'] = function()
{
diff --git a/user_guide_src/source/general/models.rst b/user_guide_src/source/general/models.rst
index 1cfe736de..eb842e927 100644
--- a/user_guide_src/source/general/models.rst
+++ b/user_guide_src/source/general/models.rst
@@ -22,12 +22,6 @@ model class might look like::
public $content;
public $date;
- public function __construct()
- {
- // Call the CI_Model constructor
- parent::__construct();
- }
-
public function get_last_ten_entries()
{
$query = $this->db->get('entries', 10);
@@ -76,6 +70,7 @@ The basic prototype for a model class is this::
public function __construct()
{
parent::__construct();
+ // Your own constructor code
}
}
@@ -91,6 +86,7 @@ The file name must match the class name. For example, if this is your class::
public function __construct()
{
parent::__construct();
+ // Your own constructor code
}
}
diff --git a/user_guide_src/source/general/requirements.rst b/user_guide_src/source/general/requirements.rst
index f90cdd30d..982a6014f 100644
--- a/user_guide_src/source/general/requirements.rst
+++ b/user_guide_src/source/general/requirements.rst
@@ -2,9 +2,9 @@
Server Requirements
###################
-`PHP <http://php.net/>`_ version 5.4 or newer is recommended.
+`PHP <http://php.net/>`_ version 5.6 or newer is recommended.
-It should work on 5.2.4 as well, but we strongly advise you NOT to run
+It should work on 5.4.8 as well, but we strongly advise you NOT to run
such old versions of PHP, because of potential security and performance
issues, as well as missing features.
@@ -15,7 +15,7 @@ Currently supported databases are:
- Oracle via the *oci8* and *pdo* drivers
- PostgreSQL via the *postgre* and *pdo* drivers
- MS SQL via the *mssql*, *sqlsrv* (version 2005 and above only) and *pdo* drivers
- - SQLite via the *sqlite* (version 2), *sqlite3* (version 3) and *pdo* drivers
+ - SQLite via the *sqlite3* and *pdo* drivers
- CUBRID via the *cubrid* and *pdo* drivers
- Interbase/Firebird via the *ibase* and *pdo* drivers
- - ODBC via the *odbc* and *pdo* drivers (you should know that ODBC is actually an abstraction layer) \ No newline at end of file
+ - ODBC via the *odbc* and *pdo* drivers (you should know that ODBC is actually an abstraction layer)
diff --git a/user_guide_src/source/general/routing.rst b/user_guide_src/source/general/routing.rst
index 766e0b2ab..b53a85d31 100644
--- a/user_guide_src/source/general/routing.rst
+++ b/user_guide_src/source/general/routing.rst
@@ -113,18 +113,19 @@ A typical RegEx route might look something like this::
In the above example, a URI similar to products/shirts/123 would instead
call the "shirts" controller class and the "id_123" method.
-With regular expressions, you can also catch a segment containing a
-forward slash ('/'), which would usually represent the delimiter between
-multiple segments.
-
+With regular expressions, you can also catch multiple segments at once.
For example, if a user accesses a password protected area of your web
application and you wish to be able to redirect them back to the same
page after they log in, you may find this example useful::
$route['login/(.+)'] = 'auth/login/$1';
+.. note:: In the above example, if the ``$1`` placeholder contains a
+ slash, it will still be split into multiple parameters when
+ passed to ``Auth::login()``.
+
For those of you who don't know regular expressions and want to learn
-more about them, `regular-expressions.info <http://www.regular-expressions.info/>`
+more about them, `regular-expressions.info <http://www.regular-expressions.info/>`_
might be a good starting point.
.. note:: You can also mix and match wildcards with regular expressions.
@@ -132,8 +133,8 @@ might be a good starting point.
Callbacks
=========
-If you are using PHP >= 5.3 you can use callbacks in place of the normal
-routing rules to process the back-references. Example::
+You can also use callbacks in place of the normal routing rules to process
+the back-references. Example::
$route['products/([a-zA-Z]+)/edit/(\d+)'] = function ($product_type, $id)
{
@@ -170,11 +171,16 @@ There are three reserved routes::
$route['default_controller'] = 'welcome';
-This route indicates which controller class should be loaded if the URI
-contains no data, which will be the case when people load your root URL.
-In the above example, the "welcome" class would be loaded. You are
-encouraged to always have a default route otherwise a 404 page will
-appear by default.
+This route points to the action that should be executed if the URI contains
+no data, which will be the case when people load your root URL.
+The setting accepts a **controller/method** value and ``index()`` would be
+the default method if you don't specify one. In the above example, it is
+``Welcome::index()`` that would be called.
+
+.. note:: You can NOT use a directory as a part of this setting!
+
+You are encouraged to always have a default route as otherwise a 404 page
+will appear by default.
::
@@ -182,11 +188,13 @@ appear by default.
This route indicates which controller class should be loaded if the
requested controller is not found. It will override the default 404
-error page. It won't affect to the ``show_404()`` function, which will
+error page. Same per-directory rules as with 'default_controller'
+apply here as well.
+
+It won't affect to the ``show_404()`` function, which will
continue loading the default *error_404.php* file at
*application/views/errors/error_404.php*.
-
::
$route['translate_uri_dashes'] = FALSE;
diff --git a/user_guide_src/source/general/security.rst b/user_guide_src/source/general/security.rst
index d4120d162..744a2c934 100644
--- a/user_guide_src/source/general/security.rst
+++ b/user_guide_src/source/general/security.rst
@@ -5,6 +5,9 @@ Security
This page describes some "best practices" regarding web security, and
details CodeIgniter's internal security features.
+.. note:: If you came here looking for a security contact, please refer to
+ our `Contribution Guide <../contributing/index>`.
+
URI Security
============
@@ -130,12 +133,7 @@ with that. Please read below.
in PHP's own `Password Hashing <http://php.net/password>`_ functions.
Please use them, even if you're not running PHP 5.5+, CodeIgniter
- provides them for you as long as you're running at least PHP version
- 5.3.7 (and if you don't meet that requirement - please, upgrade).
-
- If you're one of the really unlucky people who can't even upgrade to a
- more recent PHP version, use `hash_pbkdf() <http://php.net/hash_pbkdf2>`,
- which we also provide in our compatibility layer.
+ provides them for you.
- DO NOT ever display or send a password in plain-text format!
diff --git a/user_guide_src/source/general/styleguide.rst b/user_guide_src/source/general/styleguide.rst
index 7704a59c5..5f25a5ae4 100644
--- a/user_guide_src/source/general/styleguide.rst
+++ b/user_guide_src/source/general/styleguide.rst
@@ -345,8 +345,8 @@ inability for CodeIgniter to send proper headers.
Compatibility
=============
-CodeIgniter recommends PHP 5.4 or newer to be used, but it should be
-compatible with PHP 5.2.4. Your code must either be compatible with this
+CodeIgniter recommends PHP 5.6 or newer to be used, but it should be
+compatible with PHP 5.4.8. Your code must either be compatible with this
requirement, provide a suitable fallback, or be an optional feature that
dies quietly without affecting a user's application.
@@ -633,4 +633,4 @@ Whenever appropriate, provide function argument defaults, which helps
prevent PHP errors with mistaken calls and provides common fallback
values which can save a few lines of code. Example::
- function foo($bar = '', $baz = FALSE) \ No newline at end of file
+ function foo($bar = '', $baz = FALSE)