Have Horde_Themes_Element only accept array of options
authorMichael M Slusarz <slusarz@curecanti.org>
Wed, 17 Nov 2010 06:41:24 +0000 (23:41 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Wed, 17 Nov 2010 06:41:24 +0000 (23:41 -0700)
framework/Core/lib/Horde/Themes.php
framework/Core/lib/Horde/Themes/Element.php

index 86021d5..56763c5 100644 (file)
@@ -34,6 +34,10 @@ class Horde_Themes
      */
     static public function img($name = null, $options = array())
     {
+        if (is_string($options)) {
+            $options = array('app' => $options);
+        }
+
         return new Horde_Themes_Image($name, $options);
     }
 
@@ -58,6 +62,10 @@ class Horde_Themes
      */
     static public function sound($name = null, $options = array())
     {
+        if (is_string($options)) {
+            $options = array('app' => $options);
+        }
+
         return new Horde_Themes_Sound($name, $options);
     }
 
@@ -74,6 +82,7 @@ class Horde_Themes
         if (is_null($app)) {
             $app = $GLOBALS['registry']->getApp();
         }
+
         /* Do search in reverse order - app + theme sounds have the highest
          * priority and will overwrite previous sound definitions. */
         $locations = array(
index 22dffc0..b0cc614 100644 (file)
@@ -54,9 +54,7 @@ class Horde_Themes_Element
      *
      * @param string $name    The element name. If null, will return the
      *                        element directory.
-     * @param mixed $options  Additional options. If a string, is taken to be
-     *                        the 'app' parameter. If an array, the following
-     *                        options are available:
+     * @param array $options  Additional options:
      * <pre>
      * 'app' - (string) Use this application instead of the current app.
      * 'data' - (array) Contains 2 elements: 'fs' - filesystem path,
@@ -68,19 +66,15 @@ class Horde_Themes_Element
      * 'uri' - (string) Use this as the URI value.
      * </pre>
      */
-    public function __construct($name = '', $options = array())
+    public function __construct($name = '', array $options = array())
     {
+
+        $this->app = empty($options['app'])
+            ? $GLOBALS['registry']->getApp()
+            : $options['app'];
         $this->_name = $name;
+        $this->_opts = $options;
 
-        if (is_string($options)) {
-            $this->app = $options;
-            $this->_opts = array();
-        } else {
-            $this->app = empty($options['app'])
-                ? $GLOBALS['registry']->getApp()
-                : $options['app'];
-            $this->_opts = $options;
-        }
         if ($GLOBALS['registry']->get('status', $this->app) == 'heading') {
             $this->app = 'horde';
         }