get the Ansel_Storage instance from the injector.
authorMichael J. Rubinsky <mrubinsk@horde.org>
Sat, 5 Jun 2010 21:03:21 +0000 (17:03 -0400)
committerMichael J. Rubinsky <mrubinsk@horde.org>
Sat, 5 Jun 2010 21:03:21 +0000 (17:03 -0400)
Yes, it's still global - that part still needs refactoring.

ansel/lib/Api.php

index fef8849..f46e6db 100644 (file)
@@ -721,7 +721,7 @@ class Ansel_Api extends Horde_Registry_Api
         /* If no app is given use Ansel's own gallery which is initialized in
         base.php */
         if (!is_null($app)) {
-            $GLOBALS['ansel_storage'] = new Ansel_Storage($app);
+           $GLOBALS['ansel_storage'] = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope($app);
         }
 
         return Ansel::selectGalleries($default, $perm, null, $parent, $allLevels,
@@ -755,7 +755,7 @@ class Ansel_Api extends Horde_Registry_Api
         /* If no app is given use Ansel's own gallery which is initialized in
         base.php */
         if (!is_null($app)) {
-            $GLOBALS['ansel_storage'] = new Ansel_Storage($app);
+            $GLOBALS['ansel_storage'] = $GLOBALS['injector']->getInstance('Ansel_Storage')->getScope($app);
         }
 
         /* Determine the default gallery when none is given. The first gallery in