From c9a030dd08711f89a985504ce26378a315d7ff1f Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Sun, 18 Oct 2009 09:21:34 -0700 Subject: Add a menu item to manage the Identity drivers if there is more than one installed --- modules/gallery/libraries/Identity.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'modules/gallery/libraries') diff --git a/modules/gallery/libraries/Identity.php b/modules/gallery/libraries/Identity.php index 9eb4b83b..9e5f0bb5 100644 --- a/modules/gallery/libraries/Identity.php +++ b/modules/gallery/libraries/Identity.php @@ -24,6 +24,8 @@ class Identity_Core { protected static $instance; + protected static $active; + // Configuration protected $config; @@ -80,6 +82,26 @@ class Identity_Core { Kohana::log("debug", "Identity Library initialized"); } + /** + * Return a list of installed and activated Identity Drivers. + * + * @return boolean true if the driver supports updates; false if read only + */ + static function active() { + if (empty(self::$active)) { + $drivers = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS); + foreach (module::active() as $module) { + $module_name = $module->name; + if (file_exists(MODPATH . "{$module->name}/config/identity.php") && + ($info = module::info($module_name))) { + $drivers->$module_name = $info->description; + } + } + self::$active = $drivers; + } + return self::$active; + } + /** * Determine if if the current driver supports updates. * -- cgit v1.2.3