summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authoradmin <devnull@localhost>2006-10-09 19:36:45 +0200
committeradmin <devnull@localhost>2006-10-09 19:36:45 +0200
commit2f0bac87c73febde8019e7cbab541905bcb0e5dd (patch)
treeaf7a205f00ef4eb17ff0f56a38a54ff1be069168 /system
parent3822194cde4614137a54eecb1e1fcc86672e84a1 (diff)
Diffstat (limited to 'system')
-rw-r--r--system/libraries/Loader.php29
-rw-r--r--system/libraries/User_agent.php3
2 files changed, 14 insertions, 18 deletions
diff --git a/system/libraries/Loader.php b/system/libraries/Loader.php
index 05ee93959..452e39dfa 100644
--- a/system/libraries/Loader.php
+++ b/system/libraries/Loader.php
@@ -65,15 +65,15 @@ class CI_Loader {
*
* @access public
* @param string the name of the class
- * @param mixed any initialization parameters
+ * @param sring the optional class variable name to assign the library to
* @return void
*/
- function library($class, $param = NULL)
+ function library($class, $varname = NULL)
{
if ($class == '')
return;
- $this->_ci_load_class($class, $param);
+ $this->_ci_load_class($class, $varname);
$this->_ci_assign_to_models();
}
@@ -595,7 +595,7 @@ class CI_Loader {
* @param mixed any additional parameters
* @return void
*/
- function _ci_load_class($class, $params = NULL)
+ function _ci_load_class($class, $varname = NULL)
{
// Prep the class name
$class = strtolower(str_replace(EXT, '', $class));
@@ -627,7 +627,7 @@ class CI_Loader {
}
}
- return $this->_ci_init_class($filename, 'MY_', $params);
+ return $this->_ci_init_class($filename, 'MY_', $varname);
}
// Lets search for the requested library file and load it.
@@ -642,7 +642,7 @@ class CI_Loader {
if (file_exists($path.'libraries/'.$filename.EXT))
{
include_once($path.'libraries/'.$filename.EXT);
- return $this->_ci_init_class($filename, '', $params);
+ return $this->_ci_init_class($filename, '', $varname);
}
}
}
@@ -662,15 +662,12 @@ class CI_Loader {
* @param string
* @return null
*/
- function _ci_init_class($class, $prefix = '', $config = NULL)
+ function _ci_init_class($class, $prefix = '', $varname = NULL)
{
// Is there an associated config file for this class?
- if ($config == NULL)
+ if (file_exists(APPPATH.'config/'.$class.EXT))
{
- if (file_exists(APPPATH.'config/'.$class.EXT))
- {
- include_once(APPPATH.'config/'.$class.EXT);
- }
+ include_once(APPPATH.'config/'.$class.EXT);
}
if ($prefix == '')
@@ -682,17 +679,17 @@ class CI_Loader {
$name = $prefix.$class;
}
- $varname = ( ! isset($remap[$class])) ? $class : $remap[$class];
- $varname = strtolower($varname);
+ $classvar = ( ! is_null($varname)) ? $varname : strtolower($class);
+
// Instantiate the class
if ($config !== NULL)
{
- $this->CI->$varname = new $name($config);
+ $this->CI->$classvar = new $name($config);
}
else
{
- $this->CI->$varname = new $name;
+ $this->CI->$classvar = new $name;
}
}
diff --git a/system/libraries/User_agent.php b/system/libraries/User_agent.php
index 21162388a..39e12327f 100644
--- a/system/libraries/User_agent.php
+++ b/system/libraries/User_agent.php
@@ -113,8 +113,7 @@ class CI_User_agent {
unset($robots);
$return = TRUE;
}
-
-
+
return $return;
}