diff options
-rw-r--r-- | application/config/mimes.php | 2 | ||||
-rw-r--r-- | application/config/user_agents.php | 1 | ||||
-rwxr-xr-x | index.php | 14 | ||||
-rw-r--r-- | system/core/Loader.php | 16 | ||||
-rw-r--r-- | system/core/Output.php | 2 | ||||
-rw-r--r-- | system/core/Security.php | 2 | ||||
-rw-r--r-- | system/helpers/form_helper.php | 7 | ||||
-rw-r--r-- | system/libraries/Pagination.php | 3 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 1 | ||||
-rw-r--r-- | user_guide_src/source/libraries/loader.rst | 5 |
10 files changed, 36 insertions, 17 deletions
diff --git a/application/config/mimes.php b/application/config/mimes.php index ad3602126..27d4b2514 100644 --- a/application/config/mimes.php +++ b/application/config/mimes.php @@ -97,7 +97,7 @@ return array( 'ra' => 'audio/x-realaudio', 'rv' => 'video/vnd.rn-realvideo', 'wav' => array('audio/x-wav', 'audio/wave', 'audio/wav'), - 'bmp' => array('image/bmp', 'image/x-windows-bmp'), + 'bmp' => array('image/bmp', 'image/x-bmp', 'image/x-bitmap', 'image/x-xbitmap', 'image/x-win-bitmap', 'image/x-windows-bmp', 'image/ms-bmp', 'image/x-ms-bmp', 'application/bmp', 'application/x-bmp', 'application/x-win-bitmap'), 'gif' => 'image/gif', 'jpeg' => array('image/jpeg', 'image/pjpeg'), 'jpg' => array('image/jpeg', 'image/pjpeg'), diff --git a/application/config/user_agents.php b/application/config/user_agents.php index 5887a15be..899e96a94 100644 --- a/application/config/user_agents.php +++ b/application/config/user_agents.php @@ -81,6 +81,7 @@ $platforms = array( // The order of this array should NOT be changed. Many browsers return // multiple browser types so we want to identify the sub-type first. $browsers = array( + 'OPR' => 'Opera', 'Flock' => 'Flock', 'Chrome' => 'Chrome', 'Opera' => 'Opera', @@ -220,28 +220,28 @@ switch (ENVIRONMENT) $application_folder = $_temp; } - define('APPPATH', $application_folder.'/'); + define('APPPATH', $application_folder.DIRECTORY_SEPARATOR); } else { - if ( ! is_dir(BASEPATH.$application_folder.'/')) + if ( ! is_dir(BASEPATH.$application_folder.DIRECTORY_SEPARATOR)) { header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; exit(3); // EXIT_* constants not yet defined; 3 is EXIT_CONFIG. } - define('APPPATH', BASEPATH.$application_folder.'/'); + define('APPPATH', BASEPATH.$application_folder.DIRECTORY_SEPARATOR); } // The path to the "views" folder if ( ! is_dir($view_folder)) { - if ( ! empty($view_folder) && is_dir(APPPATH.$view_folder.'/')) + if ( ! empty($view_folder) && is_dir(APPPATH.$view_folder.DIRECTORY_SEPARATOR)) { $view_folder = APPPATH.$view_folder; } - elseif ( ! is_dir(APPPATH.'views/')) + elseif ( ! is_dir(APPPATH.'views'.DIRECTORY_SEPARATOR)) { header('HTTP/1.1 503 Service Unavailable.', TRUE, 503); echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: '.SELF; @@ -255,11 +255,11 @@ switch (ENVIRONMENT) if (($_temp = realpath($view_folder)) !== FALSE) { - $view_folder = $_temp.'/'; + $view_folder = $_temp.DIRECTORY_SEPARATOR; } else { - $view_folder = rtrim($view_folder, '/').'/'; + $view_folder = rtrim($view_folder, '/\\').DIRECTORY_SEPARATOR; } define('VIEWPATH', $view_folder); diff --git a/system/core/Loader.php b/system/core/Loader.php index 2eef9979c..70c1e4154 100644 --- a/system/core/Loader.php +++ b/system/core/Loader.php @@ -415,7 +415,7 @@ class CI_Loader { * to be extracted for use in the view * @param bool $return Whether to return the view output * or leave it to the Output class - * @return void + * @return void|string */ public function view($view, $vars = array(), $return = FALSE) { @@ -471,6 +471,20 @@ class CI_Loader { // -------------------------------------------------------------------- /** + * Clear Cached Variables + * + * Clears the cached variables. + * + * @return void + */ + public function clear_vars() + { + $this->_ci_cached_vars = array(); + } + + // -------------------------------------------------------------------- + + /** * Get Variable * * Check if a variable is set and retrieve it. diff --git a/system/core/Output.php b/system/core/Output.php index 7a5fb66f6..04209d920 100644 --- a/system/core/Output.php +++ b/system/core/Output.php @@ -847,7 +847,7 @@ class CI_Output { } // Remove CSS comments - $output = preg_replace('!/\*([^/][^*]*\*)*/(?!.+?["\'])!i', '', $output); + $output = preg_replace('@/\*([^/][^*]*\*)*/(?!.+?["\'])@i', '', $output); // Remove Javascript inline comments if ($has_tags === TRUE && strpos(strtolower($open_tag), 'script') !== FALSE) diff --git a/system/core/Security.php b/system/core/Security.php index 70cf3e013..368e17dc3 100644 --- a/system/core/Security.php +++ b/system/core/Security.php @@ -603,7 +603,7 @@ class CI_Security { */ public function strip_image_tags($str) { - return preg_replace(array('#<img\s+.*?src\s*=\s*["\'](.+?)["\'].*?\>#', '#<img\s+.*?src\s*=\s*(.+?).*?\>#'), '\\1', $str); + return preg_replace(array('#<img[\s/]+.*?src\s*=\s*["\'](.+?)["\'].*?\>#', '#<img[\s/]+.*?src\s*=\s*(.+?).*?\>#'), '\\1', $str); } // ---------------------------------------------------------------- diff --git a/system/helpers/form_helper.php b/system/helpers/form_helper.php index 0cc5bd157..85f1f4e01 100644 --- a/system/helpers/form_helper.php +++ b/system/helpers/form_helper.php @@ -328,11 +328,8 @@ if ( ! function_exists('form_dropdown')) { $selected = array($_POST[$name]); } - - if ($extra != '') - { - $extra = ' '.$extra; - } + + $extra = _attributes_to_string($extra); $multiple = (count($selected) > 1 && strpos($extra, 'multiple') === FALSE) ? ' multiple="multiple"' : ''; diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php index 10fb29dbd..c6ffd03d4 100644 --- a/system/libraries/Pagination.php +++ b/system/libraries/Pagination.php @@ -354,7 +354,8 @@ class CI_Pagination { public function create_links() { // If our item count or per-page total is zero there is no need to continue. - if ($this->total_rows === 0 OR $this->per_page === 0) + // Note: DO NOT change the operator to === here! + if ($this->total_rows == 0 OR $this->per_page == 0) { return ''; } diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 052624076..8f5cffcb0 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -382,6 +382,7 @@ Release Date: Not Released - Added support for model aliasing on autoload. - Changed method ``is_loaded()`` to ask for the (case sensitive) library name instead of its instance name. - Removed ``$_base_classes`` property and unified all class data in ``$_ci_classes`` instead. + - Added method ``clear_vars()`` to allow clearing the cached variables for views. - :doc:`Input Library <libraries/input>` changes include: diff --git a/user_guide_src/source/libraries/loader.rst b/user_guide_src/source/libraries/loader.rst index 19446a9c8..91db5afbd 100644 --- a/user_guide_src/source/libraries/loader.rst +++ b/user_guide_src/source/libraries/loader.rst @@ -234,6 +234,11 @@ $this->load->get_vars() This method retrieves all variables available to your views. +$this->load->clear_vars() +========================= + +Clears cached view variables. + $this->load->helper('file_name') ================================ |