From: Michael M Slusarz Date: Wed, 17 Nov 2010 06:41:24 +0000 (-0700) Subject: Have Horde_Themes_Element only accept array of options X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=a33ee94f5ad5e1138cdf52aba2ce8f5439f45944;p=horde.git Have Horde_Themes_Element only accept array of options --- diff --git a/framework/Core/lib/Horde/Themes.php b/framework/Core/lib/Horde/Themes.php index 86021d5ee..56763c58a 100644 --- a/framework/Core/lib/Horde/Themes.php +++ b/framework/Core/lib/Horde/Themes.php @@ -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( diff --git a/framework/Core/lib/Horde/Themes/Element.php b/framework/Core/lib/Horde/Themes/Element.php index 22dffc06a..b0cc614cd 100644 --- a/framework/Core/lib/Horde/Themes/Element.php +++ b/framework/Core/lib/Horde/Themes/Element.php @@ -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: *
      * '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.
      * 
*/ - 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'; }