summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitattributes22
-rw-r--r--.gitignore13
-rw-r--r--application/config/config.php2
-rw-r--r--application/config/database.php2
-rw-r--r--application/config/foreign_chars.php1
-rw-r--r--application/config/mimes.php6
-rw-r--r--application/config/user_agents.php1
-rw-r--r--composer.json12
-rw-r--r--system/core/Common.php2
-rw-r--r--system/core/Input.php18
-rw-r--r--system/core/Output.php2
-rw-r--r--system/database/DB_driver.php2
-rw-r--r--system/database/DB_utility.php4
-rw-r--r--system/database/drivers/oci8/oci8_driver.php2
-rw-r--r--system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php30
-rw-r--r--system/database/drivers/sqlite3/sqlite3_driver.php30
-rw-r--r--system/libraries/Cache/Cache.php22
-rw-r--r--system/libraries/Cache/drivers/Cache_redis.php4
-rw-r--r--system/libraries/Form_validation.php2
-rw-r--r--system/libraries/Ftp.php2
-rw-r--r--system/libraries/Image_lib.php40
-rw-r--r--system/libraries/Migration.php6
-rw-r--r--system/libraries/Session/drivers/Session_memcached_driver.php2
-rw-r--r--system/libraries/Session/drivers/Session_redis_driver.php2
-rw-r--r--user_guide_src/source/changelog.rst12
-rw-r--r--user_guide_src/source/database/utilities.rst4
-rw-r--r--user_guide_src/source/general/controllers.rst2
-rw-r--r--user_guide_src/source/general/environments.rst4
-rw-r--r--user_guide_src/source/general/reserved_names.rst1
-rw-r--r--user_guide_src/source/helpers/date_helper.rst2
-rw-r--r--user_guide_src/source/installation/upgrade_300.rst18
-rw-r--r--user_guide_src/source/libraries/caching.rst4
-rw-r--r--user_guide_src/source/libraries/config.rst4
-rw-r--r--user_guide_src/source/libraries/file_uploading.rst4
-rw-r--r--user_guide_src/source/libraries/form_validation.rst7
-rw-r--r--user_guide_src/source/libraries/image_lib.rst10
-rw-r--r--user_guide_src/source/libraries/migration.rst6
-rw-r--r--user_guide_src/source/libraries/security.rst8
-rw-r--r--user_guide_src/source/overview/features.rst4
-rw-r--r--user_guide_src/source/tutorial/create_news_items.rst4
-rw-r--r--user_guide_src/source/tutorial/news_section.rst62
-rw-r--r--user_guide_src/source/tutorial/static_pages.rst55
42 files changed, 260 insertions, 180 deletions
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 000000000..51fea4174
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,22 @@
+# This file tells which files and directories should be ignored and
+# NOT downloaded when using composer to pull down a project with
+# the --prefer-dist option selected. Used to remove development
+# specific files so user has a clean download.
+
+# git files
+.gitattributes export-ignore
+# .gitignore
+
+# helper config files
+.travis.yml export-ignore
+phpdoc.dist.xml export-ignore
+
+# Misc other files
+readme.rst
+
+# They don't want all of our tests...
+tests/codeigniter/ export-ignore
+tests/travis/ export-ignore
+
+# User Guide Source Files
+user_guide_src
diff --git a/.gitignore b/.gitignore
index 9edcfca6d..5982f9bad 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,4 +13,15 @@ user_guide_src/cilexer/build/*
user_guide_src/cilexer/dist/*
user_guide_src/cilexer/pycilexer.egg-info/*
/vendor/
-/nbproject/ \ No newline at end of file
+
+# IDE Files
+#-------------------------
+/nbproject/
+.idea/*
+
+## Sublime Text cache files
+*.tmlanguage.cache
+*.tmPreferences.cache
+*.stTheme.cache
+*.sublime-workspace
+*.sublime-project
diff --git a/application/config/config.php b/application/config/config.php
index f78371f13..94e5d28a9 100644
--- a/application/config/config.php
+++ b/application/config/config.php
@@ -192,8 +192,6 @@ $config['directory_trigger'] = 'd';
| Error Logging Threshold
|--------------------------------------------------------------------------
|
-| If you have enabled error logging, you can set an error threshold to
-| determine what gets logged. Threshold options are:
| You can enable error logging by setting a threshold over zero. The
| threshold determines what gets logged. Threshold options are:
|
diff --git a/application/config/database.php b/application/config/database.php
index 36ae83dda..26353cfb2 100644
--- a/application/config/database.php
+++ b/application/config/database.php
@@ -77,7 +77,7 @@ $db['default'] = array(
'dbdriver' => 'mysqli',
'dbprefix' => '',
'pconnect' => FALSE,
- 'db_debug' => TRUE,
+ 'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'utf8',
diff --git a/application/config/foreign_chars.php b/application/config/foreign_chars.php
index d02dea958..ac406e3d4 100644
--- a/application/config/foreign_chars.php
+++ b/application/config/foreign_chars.php
@@ -56,6 +56,7 @@ $foreign_characters = array(
'/ś|ŝ|ş|ș|š|ſ|σ|ς|с/' => 's',
'/Ț|Ţ|Ť|Ŧ|τ|Т/' => 'T',
'/ț|ţ|ť|ŧ|т/' => 't',
+ '/Þ|þ/' => 'th',
'/Ù|Ú|Û|Ũ|Ū|Ŭ|Ů|Ű|Ų|Ư|Ǔ|Ǖ|Ǘ|Ǚ|Ǜ|Ũ|Ủ|Ụ|Ừ|Ứ|Ữ|Ử|Ự|У/' => 'U',
'/ù|ú|û|ũ|ū|ŭ|ů|ű|ų|ư|ǔ|ǖ|ǘ|ǚ|ǜ|υ|ύ|ϋ|ủ|ụ|ừ|ứ|ữ|ử|ự|у/' => 'u',
'/Ý|Ÿ|Ŷ|Υ|Ύ|Ϋ|Ỳ|Ỹ|Ỷ|Ỵ|Й/' => 'Y',
diff --git a/application/config/mimes.php b/application/config/mimes.php
index 8eff4d2d5..78d8e53e3 100644
--- a/application/config/mimes.php
+++ b/application/config/mimes.php
@@ -127,7 +127,7 @@ return array(
'rsa' => 'application/x-pkcs7',
'cer' => array('application/pkix-cert', 'application/x-x509-ca-cert'),
'3g2' => 'video/3gpp2',
- '3gp' => 'video/3gp',
+ '3gp' => array('video/3gp', 'video/3gpp'),
'mp4' => 'video/mp4',
'm4a' => 'audio/x-m4a',
'f4v' => 'video/mp4',
@@ -152,5 +152,7 @@ return array(
'wma' => array('audio/x-ms-wma', 'video/x-ms-asf'),
'jar' => array('application/java-archive', 'application/x-java-application', 'application/x-jar', 'application/x-compressed'),
'svg' => array('image/svg+xml', 'application/xml', 'text/xml'),
- 'vcf' => 'text/x-vcard'
+ 'vcf' => 'text/x-vcard',
+ 'srt' => array('text/srt', 'text/plain'),
+ 'vtt' => array('text/vtt', 'text/plain')
);
diff --git a/application/config/user_agents.php b/application/config/user_agents.php
index 6f3295a70..2fd955435 100644
--- a/application/config/user_agents.php
+++ b/application/config/user_agents.php
@@ -62,6 +62,7 @@ $platforms = array(
$browsers = array(
'OPR' => 'Opera',
'Flock' => 'Flock',
+ 'Edge' => 'Spartan',
'Chrome' => 'Chrome',
// Opera 10+ always reports Opera/9.80 and appends Version/<real version> to the user agent string
'Opera.*?Version' => 'Opera',
diff --git a/composer.json b/composer.json
index 4ff60c57e..0653a7885 100644
--- a/composer.json
+++ b/composer.json
@@ -1,7 +1,15 @@
{
- "description" : "The CodeIgniter framework",
- "name" : "codeigniter/framework",
+ "description": "The CodeIgniter framework",
+ "name": "codeigniter/framework",
+ "type": "project",
+ "homepage": "http://codeigniter.com",
"license": "MIT",
+ "support": {
+ "forum": "http://forum.codeigniter.com/",
+ "wiki": "https://github.com/bcit-ci/CodeIgniter/wiki",
+ "irc": "irc://irc.freenode.net/codeigniter",
+ "source": "https://github.com/bcit-ci/CodeIgniter"
+ },
"require": {
"php": ">=5.2.4"
},
diff --git a/system/core/Common.php b/system/core/Common.php
index a81e45500..b850fd39a 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -749,7 +749,7 @@ if ( ! function_exists('html_escape'))
{
return $var;
}
-
+
if (is_array($var))
{
return array_map('html_escape', $var, array_fill(0, count($var), $double_encode));
diff --git a/system/core/Input.php b/system/core/Input.php
index 12332cf51..b0bbb7b8d 100644
--- a/system/core/Input.php
+++ b/system/core/Input.php
@@ -799,19 +799,27 @@ class CI_Input {
*/
public function get_request_header($index, $xss_clean = FALSE)
{
- if (empty($this->headers))
+ static $headers;
+
+ if ( ! isset($headers))
{
- $this->request_headers();
+ empty($this->headers) OR $this->request_headers();
+ foreach ($this->headers as $key => $value)
+ {
+ $headers[strtolower($key)] = $value;
+ }
}
- if ( ! isset($this->headers[$index]))
+ $index = strtolower($index);
+
+ if ( ! isset($headers[$index]))
{
return NULL;
}
return ($xss_clean === TRUE)
- ? $this->security->xss_clean($this->headers[$index])
- : $this->headers[$index];
+ ? $this->security->xss_clean($headers[$index])
+ : $headers[$index];
}
// --------------------------------------------------------------------
diff --git a/system/core/Output.php b/system/core/Output.php
index 02f66936c..e7d559a1d 100644
--- a/system/core/Output.php
+++ b/system/core/Output.php
@@ -674,7 +674,7 @@ class CI_Output {
$cache_info = unserialize($match[1]);
$expire = $cache_info['expire'];
- $last_modified = filemtime($cache_path);
+ $last_modified = filemtime($filepath);
// Has the file expired?
if ($_SERVER['REQUEST_TIME'] >= $expire && is_really_writable($cache_path))
diff --git a/system/database/DB_driver.php b/system/database/DB_driver.php
index 3d35c2d70..64ee880c8 100644
--- a/system/database/DB_driver.php
+++ b/system/database/DB_driver.php
@@ -1218,7 +1218,7 @@ abstract class CI_DB_driver {
/**
* Fetch Field Names
*
- * @param string the table name
+ * @param string $table Table name
* @return array
*/
public function list_fields($table)
diff --git a/system/database/DB_utility.php b/system/database/DB_utility.php
index 57356ac53..78398ea83 100644
--- a/system/database/DB_utility.php
+++ b/system/database/DB_utility.php
@@ -249,7 +249,7 @@ abstract class CI_DB_utility {
$out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $name).$enclosure.$delim;
}
- $out = substr(rtrim($out), 0, -strlen($delim)).$newline;
+ $out = substr($out, 0, -strlen($delim)).$newline;
// Next blast through the result array and build out the rows
while ($row = $query->unbuffered_row('array'))
@@ -258,7 +258,7 @@ abstract class CI_DB_utility {
{
$out .= $enclosure.str_replace($enclosure, $enclosure.$enclosure, $item).$enclosure.$delim;
}
- $out = substr(rtrim($out), 0, -strlen($delim)).$newline;
+ $out = substr($out, 0, -strlen($delim)).$newline;
}
return $out;
diff --git a/system/database/drivers/oci8/oci8_driver.php b/system/database/drivers/oci8/oci8_driver.php
index 4010995a1..b5cf26536 100644
--- a/system/database/drivers/oci8/oci8_driver.php
+++ b/system/database/drivers/oci8/oci8_driver.php
@@ -573,7 +573,7 @@ class CI_DB_oci8_driver extends CI_DB {
{
$default = '';
}
- $retval[$i]->default = $query[$i]->COLUMN_DEFAULT;
+ $retval[$i]->default = $default;
}
return $retval;
diff --git a/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php b/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php
index f07f49f84..d5ca741fd 100644
--- a/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php
+++ b/system/database/drivers/pdo/subdrivers/pdo_sqlite_driver.php
@@ -121,17 +121,31 @@ class CI_DB_pdo_sqlite_driver extends CI_DB_pdo_driver {
// --------------------------------------------------------------------
/**
- * Show column query
+ * Fetch Field Names
*
- * Generates a platform-specific query string so that the column names can be fetched
- *
- * @param string $table
- * @return string
+ * @param string $table Table name
+ * @return array
*/
- protected function _list_columns($table = '')
+ public function list_fields($table)
{
- // Not supported
- return FALSE;
+ // Is there a cached result?
+ if (isset($this->data_cache['field_names'][$table]))
+ {
+ return $this->data_cache['field_names'][$table];
+ }
+
+ if (($result = $this->query('PRAGMA TABLE_INFO('.$this->protect_identifiers($table, TRUE, NULL, FALSE).')')) === FALSE)
+ {
+ return FALSE;
+ }
+
+ $this->data_cache['field_names'][$table] = array();
+ foreach ($result as $row)
+ {
+ $this->data_cache['field_names'][$table][] = $row['name'];
+ }
+
+ return $this->data_cache['field_names'][$table];
}
// --------------------------------------------------------------------
diff --git a/system/database/drivers/sqlite3/sqlite3_driver.php b/system/database/drivers/sqlite3/sqlite3_driver.php
index fdbe94939..a7c6420bb 100644
--- a/system/database/drivers/sqlite3/sqlite3_driver.php
+++ b/system/database/drivers/sqlite3/sqlite3_driver.php
@@ -247,17 +247,31 @@ class CI_DB_sqlite3_driver extends CI_DB {
// --------------------------------------------------------------------
/**
- * Show column query
+ * Fetch Field Names
*
- * Generates a platform-specific query string so that the column names can be fetched
- *
- * @param string $table
- * @return string
+ * @param string $table Table name
+ * @return array
*/
- protected function _list_columns($table = '')
+ public function list_fields($table)
{
- // Not supported
- return FALSE;
+ // Is there a cached result?
+ if (isset($this->data_cache['field_names'][$table]))
+ {
+ return $this->data_cache['field_names'][$table];
+ }
+
+ if (($result = $this->query('PRAGMA TABLE_INFO('.$this->protect_identifiers($table, TRUE, NULL, FALSE).')')) === FALSE)
+ {
+ return FALSE;
+ }
+
+ $this->data_cache['field_names'][$table] = array();
+ foreach ($result as $row)
+ {
+ $this->data_cache['field_names'][$table][] = $row['name'];
+ }
+
+ return $this->data_cache['field_names'][$table];
}
// --------------------------------------------------------------------
diff --git a/system/libraries/Cache/Cache.php b/system/libraries/Cache/Cache.php
index 40ac70103..215a7c528 100644
--- a/system/libraries/Cache/Cache.php
+++ b/system/libraries/Cache/Cache.php
@@ -100,28 +100,10 @@ class CI_Cache extends CI_Driver_Library {
*/
public function __construct($config = array())
{
- $default_config = array(
- 'adapter',
- 'memcached'
- );
-
- foreach ($default_config as $key)
- {
- if (isset($config[$key]))
- {
- $param = '_'.$key;
-
- $this->{$param} = $config[$key];
- }
- }
-
+ isset($config['adapter']) && $this->_adapter = $config['adapter'];
+ isset($config['backup']) && $this->_backup_driver = $config['backup'];
isset($config['key_prefix']) && $this->key_prefix = $config['key_prefix'];
- if (isset($config['backup']) && in_array($config['backup'], $this->valid_drivers))
- {
- $this->_backup_driver = $config['backup'];
- }
-
// If the specified adapter isn't available, check the backup.
if ( ! $this->is_supported($this->_adapter))
{
diff --git a/system/libraries/Cache/drivers/Cache_redis.php b/system/libraries/Cache/drivers/Cache_redis.php
index b940b76cb..66966ba16 100644
--- a/system/libraries/Cache/drivers/Cache_redis.php
+++ b/system/libraries/Cache/drivers/Cache_redis.php
@@ -125,9 +125,7 @@ class CI_Cache_redis extends CI_Driver
$this->_redis->sRemove('_ci_redis_serialized', $id);
}
- return ($ttl)
- ? $this->_redis->setex($id, $ttl, $data)
- : $this->_redis->set($id, $data);
+ return $this->_redis->set($id, $data, $ttl);
}
// ------------------------------------------------------------------------
diff --git a/system/libraries/Form_validation.php b/system/libraries/Form_validation.php
index bb872c7cc..7599602c0 100644
--- a/system/libraries/Form_validation.php
+++ b/system/libraries/Form_validation.php
@@ -461,7 +461,7 @@ class CI_Form_validation {
{
$this->_field_data[$field]['postdata'] = $this->_reduce_array($validation_array, $row['keys']);
}
- elseif (isset($validation_array[$field]) && $validation_array[$field] !== '')
+ elseif (isset($validation_array[$field]))
{
$this->_field_data[$field]['postdata'] = $validation_array[$field];
}
diff --git a/system/libraries/Ftp.php b/system/libraries/Ftp.php
index af45bb55f..b53207577 100644
--- a/system/libraries/Ftp.php
+++ b/system/libraries/Ftp.php
@@ -490,7 +490,7 @@ class CI_FTP {
// so we'll recursively call delete_dir()
if ( ! preg_match('#/\.\.?$#', $list[$i]) && ! @ftp_delete($this->conn_id, $list[$i]))
{
- $this->delete_dir($list[$i]);
+ $this->delete_dir($filepath.$list[$i]);
}
}
}
diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index e056654bb..c69283a7c 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -845,7 +845,7 @@ class CI_Image_lib {
*/
public function image_process_imagemagick($action = 'resize')
{
- // Do we have a vaild library path?
+ // Do we have a vaild library path?
if ($this->library_path === '')
{
$this->set_error('imglib_libpath_invalid');
@@ -1010,7 +1010,7 @@ class CI_Image_lib {
// going to have to figure out how to determine the color
// of the alpha channel in a future release.
- $white = imagecolorallocate($src_img, 255, 255, 255);
+ $white = imagecolorallocate($src_img, 255, 255, 255);
// Rotate it!
$dst_img = imagerotate($src_img, $this->rotation_angle, $white);
@@ -1055,8 +1055,11 @@ class CI_Image_lib {
if ($this->rotation_angle === 'hor')
{
- for ($i = 0; $i < $height; $i++, $left = 0, $right = $width-1)
+ for ($i = 0; $i < $height; $i++)
{
+ $left = 0;
+ $right = $width - 1;
+
while ($left < $right)
{
$cl = imagecolorat($src_img, $left, $i);
@@ -1072,18 +1075,21 @@ class CI_Image_lib {
}
else
{
- for ($i = 0; $i < $width; $i++, $top = 0, $bot = $height-1)
+ for ($i = 0; $i < $width; $i++)
{
- while ($top < $bot)
+ $top = 0;
+ $bottom = $height - 1;
+
+ while ($top < $bottom)
{
$ct = imagecolorat($src_img, $i, $top);
- $cb = imagecolorat($src_img, $i, $bot);
+ $cb = imagecolorat($src_img, $i, $bottom);
imagesetpixel($src_img, $i, $top, $cb);
- imagesetpixel($src_img, $i, $bot, $ct);
+ imagesetpixel($src_img, $i, $bottom, $ct);
$top++;
- $bot--;
+ $bottom--;
}
}
}
@@ -1327,7 +1333,7 @@ class CI_Image_lib {
{
$y_axis += $this->orig_height - $fontheight - $this->wm_shadow_distance - ($fontheight / 2);
}
-
+
// Set horizontal alignment
if ($this->wm_hor_alignment === 'R')
{
@@ -1337,13 +1343,13 @@ class CI_Image_lib {
{
$x_axis += floor(($this->orig_width - ($fontwidth * strlen($this->wm_text))) / 2);
}
-
+
if ($this->wm_use_drop_shadow)
{
// Offset from text
$x_shad = $x_axis + $this->wm_shadow_distance;
$y_shad = $y_axis + $this->wm_shadow_distance;
-
+
/* Set RGB values for shadow
*
* First character is #, so we don't really need it.
@@ -1352,7 +1358,7 @@ class CI_Image_lib {
*/
$drp_color = str_split(substr($this->wm_shadow_color, 1, 6), 2);
$drp_color = imagecolorclosest($src_img, hexdec($drp_color[0]), hexdec($drp_color[1]), hexdec($drp_color[2]));
-
+
// Add the shadow to the source image
if ($this->wm_use_truetype)
{
@@ -1363,7 +1369,7 @@ class CI_Image_lib {
imagestring($src_img, $this->wm_font_size, $x_shad, $y_shad, $this->wm_text, $drp_color);
}
}
-
+
/* Set RGB values for text
*
* First character is #, so we don't really need it.
@@ -1382,7 +1388,7 @@ class CI_Image_lib {
{
imagestring($src_img, $this->wm_font_size, $x_axis, $y_axis, $this->wm_text, $txt_color);
}
-
+
// We can preserve transparency for PNG images
if ($this->image_type === 3)
{
@@ -1431,7 +1437,7 @@ class CI_Image_lib {
switch ($image_type)
{
- case 1 :
+ case 1:
if ( ! function_exists('imagecreatefromgif'))
{
$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_gif_not_supported'));
@@ -1439,7 +1445,7 @@ class CI_Image_lib {
}
return imagecreatefromgif($path);
- case 2 :
+ case 2:
if ( ! function_exists('imagecreatefromjpeg'))
{
$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_jpg_not_supported'));
@@ -1447,7 +1453,7 @@ class CI_Image_lib {
}
return imagecreatefromjpeg($path);
- case 3 :
+ case 3:
if ( ! function_exists('imagecreatefrompng'))
{
$this->set_error(array('imglib_unsupported_imagecreate', 'imglib_png_not_supported'));
diff --git a/system/libraries/Migration.php b/system/libraries/Migration.php
index ae36a3b45..45a3cbbce 100644
--- a/system/libraries/Migration.php
+++ b/system/libraries/Migration.php
@@ -191,7 +191,7 @@ class CI_Migration {
* choice
*
* @param string $target_version Target schema version
- * @return mixed TRUE if already latest, FALSE if failed, string if upgraded
+ * @return mixed TRUE if no migrations are found, current version string on success, FALSE on failure
*/
public function version($target_version)
{
@@ -294,7 +294,7 @@ class CI_Migration {
/**
* Sets the schema to the latest migration
*
- * @return mixed TRUE if already latest, FALSE if failed, string if upgraded
+ * @return mixed Current version string on success, FALSE on failure
*/
public function latest()
{
@@ -318,7 +318,7 @@ class CI_Migration {
/**
* Sets the schema to the migration version set in config
*
- * @return mixed TRUE if already current, FALSE if failed, string if upgraded
+ * @return mixed TRUE if no migrations are found, current version string on success, FALSE on failure
*/
public function current()
{
diff --git a/system/libraries/Session/drivers/Session_memcached_driver.php b/system/libraries/Session/drivers/Session_memcached_driver.php
index c7185ee44..97b860588 100644
--- a/system/libraries/Session/drivers/Session_memcached_driver.php
+++ b/system/libraries/Session/drivers/Session_memcached_driver.php
@@ -322,7 +322,7 @@ class CI_Session_memcached_driver extends CI_Session_driver implements SessionHa
$this->_lock_key = $lock_key;
break;
}
- while ($attempt++ < 30);
+ while (++$attempt < 30);
if ($attempt === 30)
{
diff --git a/system/libraries/Session/drivers/Session_redis_driver.php b/system/libraries/Session/drivers/Session_redis_driver.php
index 1ce101daf..b098cc441 100644
--- a/system/libraries/Session/drivers/Session_redis_driver.php
+++ b/system/libraries/Session/drivers/Session_redis_driver.php
@@ -336,7 +336,7 @@ class CI_Session_redis_driver extends CI_Session_driver implements SessionHandle
$this->_lock_key = $lock_key;
break;
}
- while ($attempt++ < 30);
+ while (++$attempt < 30);
if ($attempt === 30)
{
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 5454638ac..7e14152e3 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -11,6 +11,10 @@ Release Date: Not Released
- Added DoS mitigation to :php:func:`hash_pbkdf2()` :doc:`compatibility function <general/compatibility_functions>`.
+- Database
+
+ - Added ``list_fields()`` support for SQLite ('sqlite3' and 'pdo_sqlite' drivers).
+
Bug fixes for 3.0.1
-------------------
@@ -19,6 +23,14 @@ Bug fixes for 3.0.1
- Fixed a bug (#3761) - :doc:`URL Helper <helpers/url_helper>` function :php:func:`anchor()` didn't work with array inputs.
- Fixed a bug (#3773) - ``db_select()`` didn't work for MySQL with the PDO :doc:`Database <database/index>` driver.
- Fixed a bug (#3771) - :doc:`Form Validation Library <libraries/form_validation>` was looking for a 'form_validation_' prefix when trying to translate field name labels.
+- Fixed a bug (#3787) - :doc:`FTP Library <libraries/ftp>` method ``delete_dir()`` failed when the target has subdirectories.
+- Fixed a bug (#3801) - :doc:`Output Library <libraries/output>` method ``_display_cache()`` incorrectly looked for the last modified time of a directory instead of the cache file.
+- Fixed a bug (#3816) - :doc:`Form Validation Library <libraries/form_validation>` treated empty string values as non-existing ones.
+- Fixed a bug (#3823) - :doc:`Session Library <libraries/sessions>` drivers Redis and Memcached didn't properly handle locks that are blocking the request for more than 30 seconds.
+- Fixed a bug (#3846) - :doc:`Image Manipulation Library <libraries/image_lib>` method `image_mirror_gd()` didn't properly initialize its variables.
+- Fixed a bug (#3854) - `field_data()` didn't work properly with the Oracle (OCI8) database driver.
+- Fixed a bug in the :doc:`Database Utility Class <database/utilities>` method ``csv_from_result()`` didn't work with a whitespace CSV delimiter.
+- Fixed a bug (#3890) - :doc:`Input Library <libraries/input>` method ``get_request_header()`` treated header names as case-sensitive.
Version 3.0.0
=============
diff --git a/user_guide_src/source/database/utilities.rst b/user_guide_src/source/database/utilities.rst
index cc4aeb018..81b949dd7 100644
--- a/user_guide_src/source/database/utilities.rst
+++ b/user_guide_src/source/database/utilities.rst
@@ -18,7 +18,7 @@ Initializing the Utility Class
Load the Utility Class as follows::
- $this->load->dbutil()
+ $this->load->dbutil();
You can also pass another database object to the DB Utility loader, in case
the database you want to manage isn't the default one::
@@ -35,7 +35,7 @@ assigning it directly to ``$this->dbutil``.
Once initialized you will access the methods using the ``$this->dbutil``
object::
- $this->dbutil->some_method()
+ $this->dbutil->some_method();
****************************
Using the Database Utilities
diff --git a/user_guide_src/source/general/controllers.rst b/user_guide_src/source/general/controllers.rst
index bc8319dd8..7ab5a7f6a 100644
--- a/user_guide_src/source/general/controllers.rst
+++ b/user_guide_src/source/general/controllers.rst
@@ -138,7 +138,7 @@ present, as will be the case when only your site root URL is requested.
To specify a default controller, open your **application/config/routes.php**
file and set this variable::
- $route['default_controller'] = 'Blog';
+ $route['default_controller'] = 'blog';
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
diff --git a/user_guide_src/source/general/environments.rst b/user_guide_src/source/general/environments.rst
index f5a4f617e..7f030b6ef 100644
--- a/user_guide_src/source/general/environments.rst
+++ b/user_guide_src/source/general/environments.rst
@@ -48,5 +48,5 @@ Configuration Files
Optionally, you can have CodeIgniter load environment-specific
configuration files. This may be useful for managing things like
differing API keys across multiple environments. This is described in
-more detail in the environment section of the :doc:`Config
-Class <../libraries/config#environments>`_ documentation. \ No newline at end of file
+more detail in the environment section of the :doc:`Config Class
+<../libraries/config>`_ documentation. \ No newline at end of file
diff --git a/user_guide_src/source/general/reserved_names.rst b/user_guide_src/source/general/reserved_names.rst
index a7b0c3465..5d745cba6 100644
--- a/user_guide_src/source/general/reserved_names.rst
+++ b/user_guide_src/source/general/reserved_names.rst
@@ -75,6 +75,7 @@ Constants
- FOPEN_READ_WRITE_CREATE
- FOPEN_WRITE_CREATE_STRICT
- FOPEN_READ_WRITE_CREATE_STRICT
+- SHOW_DEBUG_BACKTRACE
- EXIT_SUCCESS
- EXIT_ERROR
- EXIT_CONFIG
diff --git a/user_guide_src/source/helpers/date_helper.rst b/user_guide_src/source/helpers/date_helper.rst
index e0f9f0033..a85da26a4 100644
--- a/user_guide_src/source/helpers/date_helper.rst
+++ b/user_guide_src/source/helpers/date_helper.rst
@@ -400,7 +400,7 @@ UM10 (UTC - 10:00) Hawaii-Aleutian Standard Time, Cook Islands
UM95 (UTC - 09:30) Marquesas Islands
UM9 (UTC - 09:00) Alaska Standard Time, Gambier Islands
UM8 (UTC - 08:00) Pacific Standard Time, Clipperton Island
-UM7 (UTC - 11:00) Mountain Standard Time
+UM7 (UTC - 07:00) Mountain Standard Time
UM6 (UTC - 06:00) Central Standard Time
UM5 (UTC - 05:00) Eastern Standard Time, Western Caribbean
UM45 (UTC - 04:30) Venezuelan Standard Time
diff --git a/user_guide_src/source/installation/upgrade_300.rst b/user_guide_src/source/installation/upgrade_300.rst
index a3d712482..de816b6c7 100644
--- a/user_guide_src/source/installation/upgrade_300.rst
+++ b/user_guide_src/source/installation/upgrade_300.rst
@@ -8,9 +8,13 @@ Before performing an update you should take your site offline by replacing the i
Step 1: Update your CodeIgniter files
*************************************
-Replace all files and directories in your "system" folder and replace
-your index.php file. If any modifications were made to your index.php
-they will need to be made fresh in this new one.
+**Replace** all files and directories in your *system/* directory and
+replace your index.php file. If any modifications were made to your
+index.php they will need to be made fresh in this new one.
+
+.. important:: You have to delete the old *system/* directory first and
+ then put the new one in its place. A simple copy-paste may cause
+ issues.
.. note:: If you have any custom developed files in these folders please
make copies of them first.
@@ -34,12 +38,12 @@ For example, if you have the following library file:
The same goes for driver libraries and extensions and/or overrides of CodeIgniter's
own libraries and core classes.
- application/libraries/MY_email.php
+ application/libraries/MY_email.php
application/core/MY_log.php
The above files should respectively be renamed to the following:
- application/libraries/MY_Email.php
+ application/libraries/MY_Email.php
application/core/MY_Log.php
Controllers:
@@ -76,9 +80,9 @@ Step 5: Move your Log class overrides or extensions
The Log Class is considered as a "core" class and is now located in the
**system/core/** directory. Therefore, in order for your Log class overrides
-or extensions to work, you need to move them to **application/core/**::
+or extensions to work, you need to move them to **application/core/**:
- application/libraries/Log.php -> application/core/Log.php
+ application/libraries/Log.php -> application/core/Log.php
application/libraries/MY_Log.php -> application/core/MY_Log.php
*****************************************
diff --git a/user_guide_src/source/libraries/caching.rst b/user_guide_src/source/libraries/caching.rst
index f54de5faf..a7081ec6b 100644
--- a/user_guide_src/source/libraries/caching.rst
+++ b/user_guide_src/source/libraries/caching.rst
@@ -18,7 +18,7 @@ requirements are not met.
Example Usage
*************
-The following example will load the cache driver, specify `APC <#apc>`_
+The following example will load the cache driver, specify `APC <#alternative-php-cache-apc-caching>`_
as the driver to use, and fall back to file-based caching if APC is not
available in the hosting environment.
@@ -66,7 +66,7 @@ Class Reference
hosting environment.
::
- if ($this->cache->apc->is_supported()
+ if ($this->cache->apc->is_supported())
{
if ($data = $this->cache->apc->get('my_cache'))
{
diff --git a/user_guide_src/source/libraries/config.rst b/user_guide_src/source/libraries/config.rst
index 3138e3403..a45cacdf5 100644
--- a/user_guide_src/source/libraries/config.rst
+++ b/user_guide_src/source/libraries/config.rst
@@ -92,9 +92,9 @@ Fetching Config Items
To retrieve an item from your config file, use the following function::
- $this->config->item('item name');
+ $this->config->item('item_name');
-Where item name is the $config array index you want to retrieve. For
+Where item_name is the $config array index you want to retrieve. For
example, to fetch your language choice you'll do this::
$lang = $this->config->item('language');
diff --git a/user_guide_src/source/libraries/file_uploading.rst b/user_guide_src/source/libraries/file_uploading.rst
index ea2fef7f2..6d2106be8 100644
--- a/user_guide_src/source/libraries/file_uploading.rst
+++ b/user_guide_src/source/libraries/file_uploading.rst
@@ -118,7 +118,7 @@ this code and save it to your **application/controllers/** directory::
$this->load->library('upload', $config);
- if ( ! $this->upload->do_upload())
+ if ( ! $this->upload->do_upload('userfile'))
{
$error = array('error' => $this->upload->display_errors());
@@ -352,4 +352,4 @@ Class Reference
image_height Image height
image_type Image type (usually the file name extension without the period)
image_size_str A string containing the width and height (useful to put into an image tag)
- ================ ==================================================================================================== \ No newline at end of file
+ ================ ====================================================================================================
diff --git a/user_guide_src/source/libraries/form_validation.rst b/user_guide_src/source/libraries/form_validation.rst
index da43a4bec..fa50c6dcf 100644
--- a/user_guide_src/source/libraries/form_validation.rst
+++ b/user_guide_src/source/libraries/form_validation.rst
@@ -327,15 +327,15 @@ can also prep your data in various ways. For example, you can set up
rules like this::
$this->form_validation->set_rules('username', 'Username', 'trim|required|min_length[5]|max_length[12]');
- $this->form_validation->set_rules('password', 'Password', 'trim|required|md5');
+ $this->form_validation->set_rules('password', 'Password', 'trim|required|min_length[8]');
$this->form_validation->set_rules('passconf', 'Password Confirmation', 'trim|required|matches[password]');
$this->form_validation->set_rules('email', 'Email', 'trim|required|valid_email');
In the above example, we are "trimming" the fields, checking for length
-where necessary and converting the password to MD5.
+where necessary and making sure that both password fields match.
**Any native PHP function that accepts one parameter can be used as a
-rule, like htmlspecialchars, trim, md5, etc.**
+rule, like ``htmlspecialchars()``, ``trim()``, etc.**
.. note:: You will generally want to use the prepping functions
**after** the validation rules so if there is an error, the
@@ -946,6 +946,7 @@ Rule Parameter Description
========================= ========== ============================================================================================= =======================
**required** No Returns FALSE if the form element is empty.
**matches** Yes Returns FALSE if the form element does not match the one in the parameter. matches[form_item]
+**regex_match** Yes Returns FALSE if the form element does not match the regular expression. regex_match[/regex/]
**differs** Yes Returns FALSE if the form element does not differ from the one in the parameter. differs[form_item]
**is_unique** Yes Returns FALSE if the form element is not unique to the table and field name in the is_unique[table.field]
parameter. Note: This rule requires :doc:`Query Builder <../database/query_builder>` to be
diff --git a/user_guide_src/source/libraries/image_lib.rst b/user_guide_src/source/libraries/image_lib.rst
index ae2c8478e..e5f7c000f 100644
--- a/user_guide_src/source/libraries/image_lib.rst
+++ b/user_guide_src/source/libraries/image_lib.rst
@@ -89,7 +89,7 @@ If they fail you can retrieve the error message using this function::
echo $this->image_lib->display_errors();
-A good practice is use the processing function conditionally, showing an
+A good practice is to use the processing function conditionally, showing an
error upon failure, like this::
if ( ! $this->image_lib->resize())
@@ -187,7 +187,7 @@ Two Types of Watermarking
There are two types of watermarking that you can use:
-- **Text**: The watermark message will be generating using text, either
+- **Text**: The watermark message will be generated using text, either
with a True Type font that you specify, or using the native text
output that the GD library supports. If you use the True Type version
your GD installation must be compiled with True Type support (most
@@ -231,7 +231,7 @@ bottom/center of the image, 20 pixels from the bottom of the image.
Watermarking Preferences
========================
-This table shown the preferences that are available for both types of
+This table shows the preferences that are available for both types of
watermarking (text or overlay)
======================= =================== ======================= ==========================================================================
@@ -264,7 +264,7 @@ Preference Default Value Options Description
Text Preferences
----------------
-This table shown the preferences that are available for the text type of
+This table shows the preferences that are available for the text type of
watermarking.
======================= =================== =================== ==========================================================================
@@ -289,7 +289,7 @@ Preference Default Value Options Description
Overlay Preferences
-------------------
-This table shown the preferences that are available for the overlay type
+This table shows the preferences that are available for the overlay type
of watermarking.
======================= =================== =================== ==========================================================================
diff --git a/user_guide_src/source/libraries/migration.rst b/user_guide_src/source/libraries/migration.rst
index 25be0c93c..97c72303c 100644
--- a/user_guide_src/source/libraries/migration.rst
+++ b/user_guide_src/source/libraries/migration.rst
@@ -88,7 +88,7 @@ as *20121031100537_add_blog.php*.
}
}
-Then in **application/config/migration.php** set ``$config['migration_version'] = 1;``.
+Then in **application/config/migration.php** set ``$config['migration_version'] = 20121031100537;``.
*************
Usage Example
@@ -164,7 +164,7 @@ Class Reference
.. php:method:: latest()
- :returns: TRUE if no migrations are found, current version string on success, FALSE on failure
+ :returns: Current version string on success, FALSE on failure
:rtype: mixed
This works much the same way as ``current()`` but instead of looking for
@@ -181,4 +181,4 @@ Class Reference
specific versions. It works just like ``current()`` but ignores ``$config['migration_version']``.
::
- $this->migration->version(5); \ No newline at end of file
+ $this->migration->version(5);
diff --git a/user_guide_src/source/libraries/security.rst b/user_guide_src/source/libraries/security.rst
index ac56fc589..305a8e57c 100644
--- a/user_guide_src/source/libraries/security.rst
+++ b/user_guide_src/source/libraries/security.rst
@@ -35,12 +35,6 @@ To filter data through the XSS filter use the ``xss_clean()`` method::
$data = $this->security->xss_clean($data);
-If you want the filter to run automatically every time it encounters
-POST or COOKIE data you can enable it by opening your
-application/config/config.php file and setting this::
-
- $config['global_xss_filtering'] = TRUE;
-
An optional second parameter, *is_image*, allows this function to be used
to test images for potential XSS attacks, useful for file upload
security. When this second parameter is set to TRUE, instead of
@@ -88,7 +82,7 @@ may alter this behavior by editing the following config parameter
::
- $config['csrf_regeneration'] = TRUE;
+ $config['csrf_regenerate'] = TRUE;
Select URIs can be whitelisted from csrf protection (for example API
endpoints expecting externally POSTed content). You can add these URIs
diff --git a/user_guide_src/source/overview/features.rst b/user_guide_src/source/overview/features.rst
index b230be9a3..f62546b61 100644
--- a/user_guide_src/source/overview/features.rst
+++ b/user_guide_src/source/overview/features.rst
@@ -8,8 +8,8 @@ how intuitively or intelligently it is designed. Features don't reveal
anything about the quality of the code, or the performance, or the
attention to detail, or security practices. The only way to really judge
an app is to try it and get to know the code.
-:doc:`Installing <../installation/>`_ CodeIgniter is child's play so we
-encourage you to do just that. In the mean time here's a list of
+:doc:`Installing <../installation/index>` CodeIgniter is child's play so
+we encourage you to do just that. In the mean time here's a list of
CodeIgniter's main features.
- Model-View-Controller Based System
diff --git a/user_guide_src/source/tutorial/create_news_items.rst b/user_guide_src/source/tutorial/create_news_items.rst
index 71d2080af..5c5270472 100644
--- a/user_guide_src/source/tutorial/create_news_items.rst
+++ b/user_guide_src/source/tutorial/create_news_items.rst
@@ -18,11 +18,11 @@ application/views/news/create.php.
::
- <h2><?php echo $title ?></h2>
+ <h2><?php echo $title; ?></h2>
<?php echo validation_errors(); ?>
- <?php echo form_open('news/create') ?>
+ <?php echo form_open('news/create'); ?>
<label for="title">Title</label>
<input type="input" name="title" /><br />
diff --git a/user_guide_src/source/tutorial/news_section.rst b/user_guide_src/source/tutorial/news_section.rst
index d8ebac4a3..286d620dc 100644
--- a/user_guide_src/source/tutorial/news_section.rst
+++ b/user_guide_src/source/tutorial/news_section.rst
@@ -15,10 +15,9 @@ should be placed in a model, so they can easily be reused later. Models
are the place where you retrieve, insert, and update information in your
database or other data stores. They represent your data.
-Open up the application/models directory and create a new file called
-News_model.php and add the following code. Make sure you've configured
-your database properly as described
-:doc:`here <../database/configuration>`.
+Open up the *application/models/* directory and create a new file called
+*News_model.php* and add the following code. Make sure you've configured
+your database properly as described :doc:`here <../database/configuration>`.
::
@@ -37,8 +36,8 @@ library. This will make the database class available through the
``$this->db`` object.
Before querying the database, a database schema has to be created.
-Connect to your database and run the SQL command below. Also add some
-seed records.
+Connect to your database and run the SQL command below (MySQL).
+Also add some seed records.
::
@@ -75,7 +74,7 @@ following code to your model.
With this code you can perform two different queries. You can get all
news records, or get a news item by its `slug <#>`_. You might have
-noticed that the $slug variable wasn't sanitized before running the
+noticed that the ``$slug`` variable wasn't sanitized before running the
query; :doc:`Query Builder <../database/query_builder>` does this for you.
Display the news
@@ -83,9 +82,9 @@ Display the news
Now that the queries are written, the model should be tied to the views
that are going to display the news items to the user. This could be done
-in our pages controller created earlier, but for the sake of clarity, a
-new "news" controller is defined. Create the new controller at
-application/controllers/News.php.
+in our ``Pages`` controller created earlier, but for the sake of clarity,
+a new ``News`` controller is defined. Create the new controller at
+*application/controllers/News.php*.
::
@@ -96,6 +95,7 @@ application/controllers/News.php.
{
parent::__construct();
$this->load->model('news_model');
+ $this->load->helper('url_helper');
}
public function index()
@@ -113,11 +113,13 @@ Looking at the code, you may see some similarity with the files we
created earlier. First, the ``__construct()`` method: it calls the
constructor of its parent class (``CI_Controller``) and loads the model,
so it can be used in all other methods in this controller.
+It also loads a collection of :doc:`URL Helper <../helpers/url_helper>`
+functions, because we'll use one of them in a view later.
-Next, there are two methods to view all news items and one for a
-specific news item. You can see that the $slug variable is passed to the
-model's method in the second method. The model is using this slug to
-identify the news item to be returned.
+Next, there are two methods to view all news items and one for a specific
+news item. You can see that the ``$slug`` variable is passed to the model's
+method in the second method. The model is using this slug to identify the
+news item to be returned.
Now the data is retrieved by the controller through our model, but
nothing is displayed yet. The next thing to do is passing this data to
@@ -136,35 +138,35 @@ the views.
}
The code above gets all news records from the model and assigns it to a
-variable. The value for the title is also assigned to the $data['title']
+variable. The value for the title is also assigned to the ``$data['title']``
element and all data is passed to the views. You now need to create a
-view to render the news items. Create application/views/news/index.php
+view to render the news items. Create *application/views/news/index.php*
and add the next piece of code.
::
- <h2><?php echo $title ?></h2>
+ <h2><?php echo $title; ?></h2>
<?php foreach ($news as $news_item): ?>
- <h3><?php echo $news_item['title'] ?></h3>
+ <h3><?php echo $news_item['title']; ?></h3>
<div class="main">
- <?php echo $news_item['text'] ?>
+ <?php echo $news_item['text']; ?>
</div>
- <p><a href="<?php echo $news_item['slug'] ?>">View article</a></p>
+ <p><a href="<?php echo site_url('news/'.$news_item['slug']); ?>">View article</a></p>
- <?php endforeach ?>
+ <?php endforeach; ?>
Here, each news item is looped and displayed to the user. You can see we
-wrote our template in PHP mixed with HTML. If you prefer to use a
-template language, you can use CodeIgniter's :doc:`Template
+wrote our template in PHP mixed with HTML. If you prefer to use a template
+language, you can use CodeIgniter's :doc:`Template
Parser <../libraries/parser>` class or a third party parser.
The news overview page is now done, but a page to display individual
news items is still absent. The model created earlier is made in such
way that it can easily be used for this functionality. You only need to
add some code to the controller and create a new view. Go back to the
-news controller and update ``view()`` with the following:
+``News`` controller and update ``view()`` with the following:
::
@@ -198,12 +200,12 @@ The only things left to do is create the corresponding view at
Routing
-------
-Because of the wildcard routing rule created earlier, you need an
-extra route to view the controller that you just made. Modify your
-routing file (application/config/routes.php) so it looks as follows.
-This makes sure the requests reaches the news controller instead of
-going directly to the pages controller. The first line routes URI's with
-a slug to the view method in the news controller.
+Because of the wildcard routing rule created earlier, you need an extra
+route to view the controller that you just made. Modify your routing file
+(*application/config/routes.php*) so it looks as follows.
+This makes sure the requests reaches the ``News`` controller instead of
+going directly to the ``Pages`` controller. The first line routes URI's
+with a slug to the ``view()`` method in the ``News`` controller.
::
diff --git a/user_guide_src/source/tutorial/static_pages.rst b/user_guide_src/source/tutorial/static_pages.rst
index 62b3469ad..66621471e 100644
--- a/user_guide_src/source/tutorial/static_pages.rst
+++ b/user_guide_src/source/tutorial/static_pages.rst
@@ -37,24 +37,24 @@ code.
}
}
-You have created a class named "pages", with a view method that accepts
-one argument named $page. The pages class is extending the
-CI_Controller class. This means that the new pages class can access the
-methods and variables defined in the CI_Controller class
-(system/core/Controller.php).
+You have created a class named ``Pages``, with a view method that accepts
+one argument named ``$page``. The ``Pages`` class is extending the
+``CI_Controller`` class. This means that the new pages class can access the
+methods and variables defined in the ``CI_Controller`` class
+(*system/core/Controller.php*).
The **controller is what will become the center of every request** to
your web application. In very technical CodeIgniter discussions, it may
be referred to as the *super object*. Like any php class, you refer to
-it within your controllers as $this. Referring to $this is how you will
-load libraries, views, and generally command the framework.
+it within your controllers as ``$this``. Referring to ``$this`` is how
+you will load libraries, views, and generally command the framework.
Now you've created your first method, it's time to make some basic page
templates. We will be creating two "views" (page templates) that act as
our page footer and header.
-Create the header at application/views/templates/header.php and add the
-following code.
+Create the header at *application/views/templates/header.php* and add
+the following code:
::
@@ -64,17 +64,17 @@ following code.
</head>
<body>
- <h1><?php echo $title ?></h1>
+ <h1><?php echo $title; ?></h1>
The header contains the basic HTML code that you'll want to display
before loading the main view, together with a heading. It will also
-output the $title variable, which we'll define later in the controller.
-Now create a footer at application/views/templates/footer.php that
+output the ``$title`` variable, which we'll define later in the controller.
+Now, create a footer at *application/views/templates/footer.php* that
includes the following code:
::
- <em>&copy; 2014</em>
+ <em>&copy; 2015</em>
</body>
</html>
@@ -83,12 +83,12 @@ Adding logic to the controller
Earlier you set up a controller with a ``view()`` method. The method
accepts one parameter, which is the name of the page to be loaded. The
-static page templates will be located in the application/views/pages/
+static page templates will be located in the *application/views/pages/*
directory.
-In that directory, create two files named home.php and about.php. Within
-those files, type some text − anything you'd like − and save them. If
-you like to be particularly un-original, try "Hello World!".
+In that directory, create two files named *home.php* and *about.php*.
+Within those files, type some text − anything you'd like − and save them.
+If you like to be particularly un-original, try "Hello World!".
In order to load those pages, you'll have to check whether the requested
page actually exists:
@@ -122,20 +122,21 @@ function that renders the default error page.
In the header template, the ``$title`` variable was used to customize the
page title. The value of title is defined in this method, but instead of
assigning the value to a variable, it is assigned to the title element
-in the $data array.
+in the ``$data`` array.
The last thing that has to be done is loading the views in the order
they should be displayed. The second parameter in the ``view()`` method is
used to pass values to the view. Each value in the ``$data`` array is
assigned to a variable with the name of its key. So the value of
-``$data['title']`` in the controller is equivalent to $title in the view.
+``$data['title']`` in the controller is equivalent to ``$title`` in the
+view.
Routing
-------
The controller is now functioning! Point your browser to
-[your-site-url]index.php/pages/view to see your page. When you visit
-index.php/pages/view/about you'll see the about page, again including
+``[your-site-url]index.php/pages/view`` to see your page. When you visit
+``index.php/pages/view/about`` you'll see the about page, again including
the header and footer.
Using custom routing rules, you have the power to map any URI to any
@@ -143,8 +144,8 @@ controller and method, and break free from the normal convention:
``http://example.com/[controller-class]/[controller-method]/[arguments]``
Let's do that. Open the routing file located at
-application/config/routes.php and add the following two lines. Remove
-all other code that sets any element in the $route array.
+*application/config/routes.php* and add the following two lines.
+Remove all other code that sets any element in the ``$route`` array.
::
@@ -161,9 +162,9 @@ arguments.
More information about routing can be found in the URI Routing
:doc:`documentation <../general/routing>`.
-Here, the second rule in the $routes array matches **any** request using
-the wildcard string (:any). and passes the parameter to the ``view()``
-method of the pages class.
+Here, the second rule in the ``$routes`` array matches **any** request
+using the wildcard string ``(:any)``. and passes the parameter to the
+``view()`` method of the ``Pages`` class.
-Now visit index.php/about. Did it get routed correctly to the ``view()``
+Now visit ``index.php/about``. Did it get routed correctly to the ``view()``
method in the pages controller? Awesome!