\Horde_Themes_Css

This class provides an interface to handling CSS stylesheets for Horde applications.

Copyright 2010-2017 Horde LLC (http://www.horde.org/)

See the enclosed file LICENSE for license information (LGPL). If you did not receive this file, see http://www.horde.org/licenses/lgpl21.

Summary

Methods
Properties
Constants
addStylesheet()
addThemeStylesheet()
getStylesheetUrls()
getStylesheets()
getBaseStylesheetList()
loadCssFiles()
No public properties found
CSS_URL_REGEX
No protected methods found
$_cacheid
$_cssFiles
$_cssThemeFiles
N/A
No private methods found
No private properties found
N/A

Constants

CSS_URL_REGEX

CSS_URL_REGEX

Properties

$_cacheid

$_cacheid : string

The theme cache ID.

Type

string

$_cssFiles

$_cssFiles : array

A list of additional stylesheet files to add to the output.

Type

array

$_cssThemeFiles

$_cssThemeFiles : array

A list of additional themed stylesheet files to add to the output.

Type

array

Methods

addStylesheet()

addStylesheet(string  $file, string  $url) 

Adds an external stylesheet to the output.

Parameters

string $file

The CSS filepath.

string $url

The CSS URL.

addThemeStylesheet()

addThemeStylesheet(string  $file) 

Adds a themed stylesheet to the output.

Parameters

string $file

The stylesheet name.

getStylesheetUrls()

getStylesheetUrls(array  $opts = array()) : array

Generate the stylesheet URLs needed to display the current page.

Honors configuration choices as to stylesheet caching.

Parameters

array $opts

Additional options:

  - app: (string) The current application.
  - nobase: (boolean) If true, don't load base stylesheets.
  - nocache: (boolean) If true, don't load files from cache.
  - 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.

Returns

array —

The list of URLs to display (Horde_Url objects).

getStylesheets()

getStylesheets(mixed  $theme = '', array  $opts = array()) : array

Return the list of base stylesheets to display.

Parameters

mixed $theme

The theme to use; specify an empty value to retrieve the theme from user preferences, and false for no theme.

array $opts

Additional options:

  - app: (string) The current application.
  - nobase: (boolean) If true, don't load base stylesheets.
  - 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.

Returns

array —

An array of 2-element array arrays containing 2 keys:

  - app: (string) App of the CSS file.
  - fs: (string) Filesystem location of stylesheet.
  - uri: (string) URI of stylesheet.

getBaseStylesheetList()

getBaseStylesheetList() : array

Returns the list of base stylesheets, based on the current language and browser settings.

Returns

array —

A list of base CSS files to load.

loadCssFiles()

loadCssFiles(array  $files) : string

Loads CSS files, cleans up the input, and concatenates to a string.

Parameters

array $files

List of CSS files as returned from getStylesheets().

Returns

string —

CSS data.