From 119d94f829ea54e6c3d2f9d03c46d9b74e8a453e Mon Sep 17 00:00:00 2001 From: vlakoff Date: Sat, 12 Apr 2014 07:32:54 +0200 Subject: Small documentation update As the error templates are now by default inside the views folder. --- user_guide_src/source/general/managing_apps.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/user_guide_src/source/general/managing_apps.rst b/user_guide_src/source/general/managing_apps.rst index 3ca0e03a7..4861ba71a 100644 --- a/user_guide_src/source/general/managing_apps.rst +++ b/user_guide_src/source/general/managing_apps.rst @@ -40,14 +40,12 @@ and "bar". You could structure your application directories like this:: applications/foo/ applications/foo/config/ applications/foo/controllers/ - applications/foo/errors/ applications/foo/libraries/ applications/foo/models/ applications/foo/views/ applications/bar/ applications/bar/config/ applications/bar/controllers/ - applications/bar/errors/ applications/bar/libraries/ applications/bar/models/ applications/bar/views/ -- cgit v1.2.3-24-g4f1b From cdf3dfae82acf2dde5db1adb3b87c642a894d4d4 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Sat, 12 Apr 2014 07:33:42 +0200 Subject: Make the error templates path configurable --- application/config/config.php | 11 +++++++++++ system/core/Exceptions.php | 17 +++++++++++++++-- user_guide_src/source/changelog.rst | 1 + 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/application/config/config.php b/application/config/config.php index ae89715c0..069162097 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -253,6 +253,17 @@ $config['log_file_extension'] = ''; */ $config['log_date_format'] = 'Y-m-d H:i:s'; +/* +|-------------------------------------------------------------------------- +| Error Templates Directory Path +|-------------------------------------------------------------------------- +| +| Leave this BLANK unless you would like to set something other than the default +| application/views/errors/ folder. Use a full server path with trailing slash. +| +*/ +$config['error_templates_path'] = ''; + /* |-------------------------------------------------------------------------- | Cache Directory Path diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 041869641..398459d54 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -44,6 +44,13 @@ class CI_Exceptions { */ public $ob_level; + /** + * Path to the error templates + * + * @var string + */ + protected $_templates_path; + /** * List if available error levels * @@ -73,6 +80,12 @@ class CI_Exceptions { { $this->ob_level = ob_get_level(); // Note: Do not log messages from this constructor. + + $config =& get_config(); + + $this->_templates_path = (isset($config['error_templates_path']) && $config['error_templates_path'] !== '') + ? $config['error_templates_path'] + : VIEWPATH.'errors'.DIRECTORY_SEPARATOR; } // -------------------------------------------------------------------- @@ -162,7 +175,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(VIEWPATH.'errors'.DIRECTORY_SEPARATOR.$template.'.php'); + include($this->_templates_path.$template.'.php'); $buffer = ob_get_contents(); ob_end_clean(); return $buffer; @@ -205,7 +218,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include(VIEWPATH.'errors'.DIRECTORY_SEPARATOR.$template.'.php'); + include($this->_templates_path.$template.'.php'); $buffer = ob_get_contents(); ob_end_clean(); echo $buffer; diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 9d3ceb08e..48a20ee6f 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -48,6 +48,7 @@ Release Date: Not Released - Removed previously deprecated EXT constant. - Updated all classes to be written in PHP 5 style, with visibility declarations and no ``var`` usage for properties. - Moved error templates to *application/views/errors/*. + - Made error templates path configurable using ``$config['error_templates_path']``. - Moved the Log class to *application/core/* - Global config files are loaded first, then environment ones. Environment config keys overwrite base ones, allowing to only set the keys we want changed per environment. - Changed detection of ``$view_folder`` so that if it's not found in the current path, it will now also be searched for under the application folder. -- cgit v1.2.3-24-g4f1b From 05079dd53e6c52925ddbf25bdf948775ee383ef8 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Sat, 12 Apr 2014 07:34:39 +0200 Subject: Group error templates entries in changelog --- user_guide_src/source/changelog.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 48a20ee6f..5cee05bba 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -48,6 +48,7 @@ Release Date: Not Released - Removed previously deprecated EXT constant. - Updated all classes to be written in PHP 5 style, with visibility declarations and no ``var`` usage for properties. - Moved error templates to *application/views/errors/*. + - Added support non-HTML error templates for CLI applications. - Made error templates path configurable using ``$config['error_templates_path']``. - Moved the Log class to *application/core/* - Global config files are loaded first, then environment ones. Environment config keys overwrite base ones, allowing to only set the keys we want changed per environment. @@ -57,7 +58,6 @@ Release Date: Not Released - Changed environment defaults to report all errors in *development* and only fatal ones in *testing*, *production* but only display them in *development*. - Updated *ip_address* database field lengths from 16 to 45 for supporting IPv6 address on :doc:`Trackback Library ` and :doc:`Captcha Helper `. - Removed *cheatsheets* and *quick_reference* PDFs from the documentation. - - Added support non-HTML error templates for CLI applications. - Added availability checks where usage of dangerous functions like ``eval()`` and ``exec()`` is required. - Added support for changing the file extension of log files using ``$config['log_file_extension']``. - Added support for turning newline standardization on/off via ``$config['standardize_newlines']``. -- cgit v1.2.3-24-g4f1b From 511a6b8eb67e34820c1b9446cfc8891b52df90c7 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Mon, 14 Apr 2014 14:33:55 +0200 Subject: Rename config item "error_templates_path" to "error_views_path" --- application/config/config.php | 4 ++-- system/core/Exceptions.php | 4 ++-- user_guide_src/source/changelog.rst | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/application/config/config.php b/application/config/config.php index 069162097..85d8da08a 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -255,14 +255,14 @@ $config['log_date_format'] = 'Y-m-d H:i:s'; /* |-------------------------------------------------------------------------- -| Error Templates Directory Path +| Error Views Directory Path |-------------------------------------------------------------------------- | | Leave this BLANK unless you would like to set something other than the default | application/views/errors/ folder. Use a full server path with trailing slash. | */ -$config['error_templates_path'] = ''; +$config['error_views_path'] = ''; /* |-------------------------------------------------------------------------- diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 398459d54..0c247f916 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -83,8 +83,8 @@ class CI_Exceptions { $config =& get_config(); - $this->_templates_path = (isset($config['error_templates_path']) && $config['error_templates_path'] !== '') - ? $config['error_templates_path'] + $this->_templates_path = (isset($config['error_views_path']) && $config['error_views_path'] !== '') + ? $config['error_views_path'] : VIEWPATH.'errors'.DIRECTORY_SEPARATOR; } diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 5cee05bba..a4669773f 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -49,7 +49,7 @@ Release Date: Not Released - Updated all classes to be written in PHP 5 style, with visibility declarations and no ``var`` usage for properties. - Moved error templates to *application/views/errors/*. - Added support non-HTML error templates for CLI applications. - - Made error templates path configurable using ``$config['error_templates_path']``. + - Made error templates path configurable using ``$config['error_views_path']``. - Moved the Log class to *application/core/* - Global config files are loaded first, then environment ones. Environment config keys overwrite base ones, allowing to only set the keys we want changed per environment. - Changed detection of ``$view_folder`` so that if it's not found in the current path, it will now also be searched for under the application folder. -- cgit v1.2.3-24-g4f1b From 08ea83bb19146eab8e792acc35f02f6e8d055894 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Mon, 14 Apr 2014 14:34:06 +0200 Subject: Different method for handling "error_views_path" config item --- system/core/Exceptions.php | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/system/core/Exceptions.php b/system/core/Exceptions.php index 0c247f916..5bcb7c1c5 100644 --- a/system/core/Exceptions.php +++ b/system/core/Exceptions.php @@ -44,13 +44,6 @@ class CI_Exceptions { */ public $ob_level; - /** - * Path to the error templates - * - * @var string - */ - protected $_templates_path; - /** * List if available error levels * @@ -80,12 +73,6 @@ class CI_Exceptions { { $this->ob_level = ob_get_level(); // Note: Do not log messages from this constructor. - - $config =& get_config(); - - $this->_templates_path = (isset($config['error_views_path']) && $config['error_views_path'] !== '') - ? $config['error_views_path'] - : VIEWPATH.'errors'.DIRECTORY_SEPARATOR; } // -------------------------------------------------------------------- @@ -158,6 +145,10 @@ class CI_Exceptions { */ public function show_error($heading, $message, $template = 'error_general', $status_code = 500) { + $templates_path = config_item('error_views_path') + ? config_item('error_views_path') + : VIEWPATH.'errors'.DIRECTORY_SEPARATOR; + if (is_cli()) { $message = "\t".(is_array($message) ? implode("\n\t", $message) : $message); @@ -175,7 +166,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include($this->_templates_path.$template.'.php'); + include($templates_path.$template.'.php'); $buffer = ob_get_contents(); ob_end_clean(); return $buffer; @@ -194,6 +185,10 @@ class CI_Exceptions { */ public function show_php_error($severity, $message, $filepath, $line) { + $templates_path = config_item('error_views_path') + ? config_item('error_views_path') + : VIEWPATH.'errors'.DIRECTORY_SEPARATOR; + $severity = isset($this->levels[$severity]) ? $this->levels[$severity] : $severity; // For safety reasons we don't show the full file path in non-CLI requests @@ -218,7 +213,7 @@ class CI_Exceptions { ob_end_flush(); } ob_start(); - include($this->_templates_path.$template.'.php'); + include($templates_path.$template.'.php'); $buffer = ob_get_contents(); ob_end_clean(); echo $buffer; -- cgit v1.2.3-24-g4f1b From 6cf456da85ffcae78884d9244877f9b7e259c9b4 Mon Sep 17 00:00:00 2001 From: vlakoff Date: Mon, 14 Apr 2014 14:38:29 +0200 Subject: Replace "folder" with "directory" in config.php --- application/config/config.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/application/config/config.php b/application/config/config.php index 85d8da08a..ba6867fb7 100644 --- a/application/config/config.php +++ b/application/config/config.php @@ -223,7 +223,7 @@ $config['log_threshold'] = 0; |-------------------------------------------------------------------------- | | Leave this BLANK unless you would like to set something other than the default -| application/logs/ folder. Use a full server path with trailing slash. +| application/logs/ directory. Use a full server path with trailing slash. | */ $config['log_path'] = ''; @@ -259,7 +259,7 @@ $config['log_date_format'] = 'Y-m-d H:i:s'; |-------------------------------------------------------------------------- | | Leave this BLANK unless you would like to set something other than the default -| application/views/errors/ folder. Use a full server path with trailing slash. +| application/views/errors/ directory. Use a full server path with trailing slash. | */ $config['error_views_path'] = ''; @@ -270,7 +270,7 @@ $config['error_views_path'] = ''; |-------------------------------------------------------------------------- | | Leave this BLANK unless you would like to set something other than the default -| application/cache/ folder. Use a full server path with trailing slash. +| application/cache/ directory. Use a full server path with trailing slash. | */ $config['cache_path'] = ''; -- cgit v1.2.3-24-g4f1b From 787fe1384287ff3a2360815036e70a9a79c714da Mon Sep 17 00:00:00 2001 From: vlakoff Date: Mon, 14 Apr 2014 14:45:36 +0200 Subject: Uniformization in smiley helper documentation oversight from 20292311636837e120d205e470e41826820feb46 --- user_guide_src/source/helpers/smiley_helper.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/user_guide_src/source/helpers/smiley_helper.rst b/user_guide_src/source/helpers/smiley_helper.rst index b98084089..e7a5724a8 100644 --- a/user_guide_src/source/helpers/smiley_helper.rst +++ b/user_guide_src/source/helpers/smiley_helper.rst @@ -75,7 +75,7 @@ the :doc:`Table Class <../libraries/table>`:: } -In your **application/views/** folder, create a file called **smiley_view.php** +In your **application/views/** directory, create a file called **smiley_view.php** and place this code in it:: -- cgit v1.2.3-24-g4f1b