summaryrefslogtreecommitdiffstats
path: root/system/libraries/Driver.php
diff options
context:
space:
mode:
authorDarren Hill <dchill42@gmail.com>2011-08-30 21:40:27 +0200
committerDarren Hill <dchill42@gmail.com>2011-08-30 21:40:27 +0200
commitc4e266b87f39d521ff1002fefa9df809c6b9bd61 (patch)
tree212e27cd693c7b2005c765bb794d99d8156b65ee /system/libraries/Driver.php
parent70e61b5dc0b240c4a3341ca65ad9f2f5254df1b5 (diff)
Added Session driver with native PHP sessions and original-flavor CI cookie sessions
Diffstat (limited to 'system/libraries/Driver.php')
-rw-r--r--system/libraries/Driver.php42
1 files changed, 30 insertions, 12 deletions
diff --git a/system/libraries/Driver.php b/system/libraries/Driver.php
index 9881c1eec..e958fc67f 100644
--- a/system/libraries/Driver.php
+++ b/system/libraries/Driver.php
@@ -30,11 +30,32 @@
class CI_Driver_Library {
protected $valid_drivers = array();
- protected static $lib_name;
-
- // The first time a child is used it won't exist, so we instantiate it
- // subsequents calls will go straight to the proper child.
- function __get($child)
+ protected $lib_name;
+
+ /**
+ * Get magic method
+ *
+ * The first time a child is used it won't exist, so we instantiate it
+ * subsequents calls will go straight to the proper child.
+ *
+ * @param string Child class name
+ * @return object Child class
+ */
+ public function __get($child)
+ {
+ // Try to load the driver
+ return load_driver($child);
+ }
+
+ /**
+ * Load driver
+ *
+ * Separate load_driver call to support explicit driver load by library or user
+ *
+ * @param string Child class name
+ * @return object Child class
+ */
+ public function load_driver($child)
{
if ( ! isset($this->lib_name))
{
@@ -64,7 +85,7 @@ class CI_Driver_Library {
if (file_exists($filepath))
{
include_once $filepath;
- break;
+ break 2;
}
}
}
@@ -84,12 +105,9 @@ class CI_Driver_Library {
}
// The requested driver isn't valid!
- log_message('error', "Invalid driver requested: ".$child_class);
- show_error("Invalid driver requested: ".$child_class);
+ log_message('error', 'Invalid driver requested: '.$child_class);
+ show_error('Invalid driver requested: '.$child_class);
}
-
- // --------------------------------------------------------------------
-
}
// END CI_Driver_Library CLASS
@@ -226,4 +244,4 @@ class CI_Driver {
// END CI_Driver CLASS
/* End of file Driver.php */
-/* Location: ./system/libraries/Driver.php */ \ No newline at end of file
+/* Location: ./system/libraries/Driver.php */