From: Michael M Slusarz Date: Tue, 9 Mar 2010 01:41:19 +0000 (-0700) Subject: Add additional options to stylesheet generation functions. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=877eab360ff1537cca9ce466856f64ef3d0c8c59;p=horde.git Add additional options to stylesheet generation functions. --- diff --git a/framework/Core/lib/Horde/Themes.php b/framework/Core/lib/Horde/Themes.php index 44a767f21..b1a02bf51 100644 --- a/framework/Core/lib/Horde/Themes.php +++ b/framework/Core/lib/Horde/Themes.php @@ -19,8 +19,13 @@ class Horde_Themes * @param array $options Additional options: *
      * 'additional' - (array) TODO
+     * 'nohorde' - (boolean) If true, don't load files from Horde.
      * 'sub' - (string) A subdirectory containing additional CSS files to
      *         load as an overlay to the base CSS files.
+     * 'subonly' - (boolean) If true, only load the files in 'sub', not
+     *             the default theme files.
+     * 'theme' - (string) Use this theme instead of the default.
+     * 'themeonly' - (boolean) If true, only load the theme files.
      * 
*/ static public function includeStylesheetFiles($options = array()) @@ -30,7 +35,7 @@ class Horde_Themes $themesfs = $registry->get('themesfs'); $themesuri = $registry->get('themesuri'); - $css = self::getStylesheets($prefs->getValue('theme'), $options); + $css = self::getStylesheets(isset($options['theme']) ? $options['theme'] : $prefs->getValue('theme'), $options); $css_out = array(); if (!empty($options['additional'])) { @@ -141,8 +146,12 @@ class Horde_Themes * @param array $options Additional options: *
      * 'app' - (string) The current application.
+     * 'nohorde' - (boolean) If true, don't load files from Horde.
      * 'sub' - (string) A subdirectory containing additional CSS files to
      *         load as an overlay to the base CSS files.
+     * 'subonly' - (boolean) If true, only load the files in 'sub', not
+     *             the default theme files.
+     * 'themeonly' - (boolean) If true, only load the theme files.
      * 
* * @return array TODO @@ -192,7 +201,11 @@ class Horde_Themes $curr_app = empty($options['app']) ? $GLOBALS['registry']->getApp() : $options['app']; - $apps = array_unique(array('horde', $curr_app)); + if (empty($options['nohorde'])) { + $apps = array_unique(array('horde', $curr_app)); + } else { + $apps = ($curr_app == 'horde') ? array() : array($curr_app); + } $sub = empty($options['sub']) ? null : $options['sub']; foreach ($apps as $app) { @@ -200,13 +213,19 @@ class Horde_Themes $themes_uri = Horde::url($GLOBALS['registry']->get('themesuri', $app), false, -1) . '/'; foreach ($css_list as $css_name) { - $css[$themes_fs . $css_name . '.css'] = $themes_uri . $css_name . '.css'; + if (empty($options['subonly'])) { + $css[$themes_fs . $css_name . '.css'] = $themes_uri . $css_name . '.css'; + } + if ($sub && ($app == $curr_app)) { $css[$themes_fs . $sub . '/' . $css_name . '.css'] = $themes_uri . $sub . '/' . $css_name . '.css'; } if (!empty($theme)) { - $css[$themes_fs . $theme . '/' . $css_name . '.css'] = $themes_uri . $theme . '/' . $css_name . '.css'; + if (empty($options['subonly'])) { + $css[$themes_fs . $theme . '/' . $css_name . '.css'] = $themes_uri . $theme . '/' . $css_name . '.css'; + } + if ($sub && ($app == $curr_app)) { $css[$themes_fs . $theme . '/' . $sub . '/' . $css_name . '.css'] = $themes_uri . $theme . '/' . $sub . '/' . $css_name . '.css'; }