Horde_Themes_Css
in package
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.
Tags
Table of Contents
Constants
- CSS_URL_REGEX = '/url\s*\(["\']?(.*?)["\']?\)/i'
Properties
- $_cacheid : string
- The theme cache ID.
- $_cssFiles : array<string|int, mixed>
- A list of additional stylesheet files to add to the output.
- $_cssThemeFiles : array<string|int, mixed>
- A list of additional themed stylesheet files to add to the output.
Methods
- addStylesheet() : mixed
- Adds an external stylesheet to the output.
- addThemeStylesheet() : mixed
- Adds a themed stylesheet to the output.
- getBaseStylesheetList() : array<string|int, mixed>
- Returns the list of base stylesheets, based on the current language and browser settings.
- getStylesheets() : array<string|int, mixed>
- Return the list of base stylesheets to display.
- getStylesheetUrls() : array<string|int, mixed>
- Generate the stylesheet URLs needed to display the current page.
- loadCssFiles() : string
- Loads CSS files, cleans up the input, and concatenates to a string.
Constants
CSS_URL_REGEX
public
mixed
CSS_URL_REGEX
= '/url\s*\(["\']?(.*?)["\']?\)/i'
Tags
Properties
$_cacheid
The theme cache ID.
protected
string
$_cacheid
$_cssFiles
A list of additional stylesheet files to add to the output.
protected
array<string|int, mixed>
$_cssFiles
= array()
$_cssThemeFiles
A list of additional themed stylesheet files to add to the output.
protected
array<string|int, mixed>
$_cssThemeFiles
= array()
Methods
addStylesheet()
Adds an external stylesheet to the output.
public
addStylesheet(string $file, string $url) : mixed
Parameters
- $file : string
-
The CSS filepath.
- $url : string
-
The CSS URL.
addThemeStylesheet()
Adds a themed stylesheet to the output.
public
addThemeStylesheet(string $file) : mixed
Parameters
- $file : string
-
The stylesheet name.
getBaseStylesheetList()
Returns the list of base stylesheets, based on the current language and browser settings.
public
getBaseStylesheetList() : array<string|int, mixed>
Return values
array<string|int, mixed> —A list of base CSS files to load.
getStylesheets()
Return the list of base stylesheets to display.
public
getStylesheets([mixed $theme = '' ][, array<string|int, mixed> $opts = array() ]) : array<string|int, mixed>
Parameters
- $theme : mixed = ''
-
The theme to use; specify an empty value to retrieve the theme from user preferences, and false for no theme.
- $opts : array<string|int, mixed> = array()
-
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.
Return values
array<string|int, mixed> —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.
getStylesheetUrls()
Generate the stylesheet URLs needed to display the current page.
public
getStylesheetUrls([array<string|int, mixed> $opts = array() ]) : array<string|int, mixed>
Honors configuration choices as to stylesheet caching.
Parameters
- $opts : array<string|int, mixed> = array()
-
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.
Return values
array<string|int, mixed> —The list of URLs to display (Horde_Url objects).
loadCssFiles()
Loads CSS files, cleans up the input, and concatenates to a string.
public
loadCssFiles(array<string|int, mixed> $files) : string
Use Horde_Themes_Css_Compress instead.
Parameters
- $files : array<string|int, mixed>
-
List of CSS files as returned from getStylesheets().
Return values
string —CSS data.