cvs: pear /Auth_PrefManager2 PrefManager2.php
| From: | Jon Wood | Date: | Tue, 29 Jun 2004 16:48:11 +0000 |
| Subject: | cvs: pear /Auth_PrefManager2 PrefManager2.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-21258@lists.php.net to get a copy of this message | ||
jellybob Tue Jun 29 12:48:11 2004 EDT
Modified files:
/pear/Auth_PrefManager2 PrefManager2.php
Log:
Make it possible to preload a container.
http://cvs.php.net/diff.php/pear/Auth_PrefManager2/PrefManager2.php?r1=1.4&r2=1.5&ty=u
Index: pear/Auth_PrefManager2/PrefManager2.php
diff -u pear/Auth_PrefManager2/PrefManager2.php:1.4 pear/Auth_PrefManager2/PrefManager2.php:1.5
--- pear/Auth_PrefManager2/PrefManager2.php:1.4 Tue Jun 29 08:30:48 2004
+++ pear/Auth_PrefManager2/PrefManager2.php Tue Jun 29 12:48:11 2004
@@ -15,7 +15,7 @@
// | Paul M. Jones <pmjones@ciaweb.net> |
// +----------------------------------------------------------------------+
//
-// $Id: PrefManager2.php,v 1.4 2004/06/29 12:30:48 jellybob Exp $
+// $Id: PrefManager2.php,v 1.5 2004/06/29 16:48:11 jellybob Exp $
/**
* Used for error handling.
@@ -110,6 +110,9 @@
* Creates an instance of PrefManager, with the options specified, and data
* access being done by the specified container.
*
+ * If your using a custom container you can include it before calling
+ * the factory method and it will be used without any further setup.
+ *
* @param string $container The container to use.
* @param array $options An associative array of options to pass to the
* container.
@@ -120,18 +123,23 @@
*/
function &factory($container, $options = array())
{
+ $class = "Auth_PrefManager2_${container}";
$file = "Auth/PrefManager2/${container}.php";
-
- if ($options['debug']) {
- $include = include_once($file);
- } else {
- $include = @include_once($file);
- }
- if ($include) {
- $class = "Auth_PrefManager2_${container}";
- if (class_exists($class)) {
- return new $class($options);
+ if (class_exists($class)) {
+ return new $class($options);
+ } else {
+ if ($options['debug']) {
+ $include = include_once($file);
+ } else {
+ $include = @include_once($file);
+ }
+
+ if ($include) {
+ $class = "Auth_PrefManager2_${container}";
+ if (class_exists($class)) {
+ return new $class($options);
+ }
}
}