summaryrefslogtreecommitdiffstats
path: root/system/core
diff options
context:
space:
mode:
Diffstat (limited to 'system/core')
-rw-r--r--system/core/Common.php61
1 files changed, 48 insertions, 13 deletions
diff --git a/system/core/Common.php b/system/core/Common.php
index d1e8e77e9..db9fbeb9f 100644
--- a/system/core/Common.php
+++ b/system/core/Common.php
@@ -39,6 +39,8 @@
* @param string
* @return bool TRUE if the current version is $version or higher
*/
+if ( ! function_exists('is_php'))
+{
function is_php($version = '5.0.0')
{
static $_is_php;
@@ -51,6 +53,7 @@
return $_is_php[$version];
}
+}
// ------------------------------------------------------------------------
@@ -64,6 +67,8 @@
* @access private
* @return void
*/
+if ( ! function_exists('is_really_writable'))
+{
function is_really_writable($file)
{
// If we're on a Unix server with safe_mode off we call is_writable
@@ -96,6 +101,7 @@
fclose($fp);
return TRUE;
}
+}
// ------------------------------------------------------------------------
@@ -112,6 +118,8 @@
* @param string the class name prefix
* @return object
*/
+if ( ! function_exists('load_class'))
+{
function &load_class($class, $directory = 'libraries', $prefix = 'CI_')
{
static $_classes = array();
@@ -166,6 +174,7 @@
$_classes[$class] = new $name();
return $_classes[$class];
}
+}
// --------------------------------------------------------------------
@@ -176,6 +185,8 @@
* @access public
* @return array
*/
+if ( ! function_exists('is_loaded'))
+{
function is_loaded($class = '')
{
static $_is_loaded = array();
@@ -187,6 +198,7 @@
return $_is_loaded;
}
+}
// ------------------------------------------------------------------------
@@ -199,6 +211,8 @@
* @access private
* @return array
*/
+if ( ! function_exists('get_config'))
+{
function &get_config($replace = array())
{
static $_config;
@@ -242,6 +256,7 @@
return $_config[0] =& $config;
}
+}
// ------------------------------------------------------------------------
@@ -251,6 +266,8 @@
* @access public
* @return mixed
*/
+if ( ! function_exists('config_item'))
+{
function config_item($item)
{
static $_config_item = array();
@@ -268,6 +285,7 @@
return $_config_item[$item];
}
+}
// ------------------------------------------------------------------------
@@ -283,12 +301,15 @@
* @access public
* @return void
*/
+if ( ! function_exists('show_error'))
+{
function show_error($message, $status_code = 500, $heading = 'An Error Was Encountered')
{
$_error =& load_class('Exceptions', 'core');
echo $_error->show_error($heading, $message, 'error_general', $status_code);
exit;
}
+}
// ------------------------------------------------------------------------
@@ -302,12 +323,15 @@
* @access public
* @return void
*/
+if ( ! function_exists('show_404'))
+{
function show_404($page = '', $log_error = TRUE)
{
$_error =& load_class('Exceptions', 'core');
$_error->show_404($page, $log_error);
exit;
}
+}
// ------------------------------------------------------------------------
@@ -320,6 +344,8 @@
* @access public
* @return void
*/
+if ( ! function_exists('log_message'))
+{
function log_message($level = 'error', $message, $php_error = FALSE)
{
static $_log;
@@ -332,6 +358,7 @@
$_log =& load_class('Log');
$_log->write_log($level, $message, $php_error);
}
+}
// ------------------------------------------------------------------------
@@ -343,6 +370,8 @@
* @param string
* @return void
*/
+if ( ! function_exists('set_status_header'))
+{
function set_status_header($code = 200, $text = '')
{
$stati = array(
@@ -417,6 +446,7 @@
header("HTTP/1.1 {$code} {$text}", TRUE, $code);
}
}
+}
// --------------------------------------------------------------------
@@ -434,6 +464,8 @@
* @access private
* @return void
*/
+if ( ! function_exists('_exception_handler'))
+{
function _exception_handler($severity, $message, $filepath, $line)
{
// We don't bother with "strict" notices since they tend to fill up
@@ -463,19 +495,22 @@
$_error->log_exception($severity, $message, $filepath, $line);
}
+}
- // --------------------------------------------------------------------
-
- /**
- * Remove Invisible Characters
- *
- * This prevents sandwiching null characters
- * between ascii characters, like Java\0script.
- *
- * @access public
- * @param string
- * @return string
- */
+// --------------------------------------------------------------------
+
+/**
+ * Remove Invisible Characters
+ *
+ * This prevents sandwiching null characters
+ * between ascii characters, like Java\0script.
+ *
+ * @access public
+ * @param string
+ * @return string
+ */
+if ( ! function_exists('remove_invisible_characters'))
+{
function remove_invisible_characters($str, $url_encoded = TRUE)
{
$non_displayables = array();
@@ -499,7 +534,7 @@
return $str;
}
-
+}
/* End of file Common.php */
/* Location: ./system/core/Common.php */ \ No newline at end of file