[ Index ]

PHP Cross Reference of DokuWiki




/lib/exe/ -> css.php (summary)

DokuWiki StyleSheet creator

Author: Andreas Gohr
License: GPL 2 (http://www.gnu.org/licenses/gpl.html)
File Size: 703 lines (21 kb)
Included or required: 3 times
Referenced: 2 times
Includes or requires: 1 file

Defines 1 class

DokuCssFile:: (9 methods):

Defines 9 functions


Class: DokuCssFile  - X-Ref

Helper class to abstract loading of css/less files

__construct($file)   X-Ref
No description

load($location = '')   X-Ref
Load the contents of the css/less file and adjust any relative paths/urls (relative to this file) to be
relative to the dokuwiki root: the web root (DOKU_BASE) for most files; the file system root (DOKU_INC)
for less files.

return: string the CSS/Less contents of the file
param: string $location base url for this file

getRelativePath()   X-Ref
Get the relative file system path of this file, relative to dokuwiki's root folder, DOKU_INC

return: string   relative file system path

replacements($match)   X-Ref
preg_replace callback to adjust relative urls from relative to this file to relative
to the appropriate dokuwiki root location as described in the code

return: string   see http://php.net/preg_replace_callback
param: array $match see http://php.net/preg_replace_callback

css_datauri($match)   X-Ref
Convert local image URLs to data URLs if the filesize is small

Callback for preg_replace_callback

return: string
param: array $match

css_pluginstyles($mediatype = 'screen')   X-Ref
Returns a list of possible Plugin Styles (no existance check here)

return: array
author: Andreas Gohr <andi@splitbrain.org>
param: string $mediatype

css_compress($css)   X-Ref
Very simple CSS optimizer

return: string
author: Andreas Gohr <andi@splitbrain.org>
param: string $css

css_comment_cb($matches)   X-Ref
Callback for css_compress()

Keeps short comments (< 5 chars) to maintain typical browser hacks

return: string
author: Andreas Gohr <andi@splitbrain.org>
param: array $matches

css_onelinecomment_cb($matches)   X-Ref
Callback for css_compress()

Strips one line comments but makes sure it will not destroy url() constructs with slashes

return: string
param: array $matches

Functions that are not part of a class:

css_out()   X-Ref
Output all needed Styles

author: Andreas Gohr <andi@splitbrain.org>

css_parseless($css)   X-Ref
Uses phpless to parse LESS in our CSS

most of this function is error handling to show a nice useful error when
LESS compilation fails

return: string
param: string $css

css_applystyle($css, $replacements)   X-Ref
Does placeholder replacements in the style according to
the ones defined in a templates style.ini file

This also adds the ini defined placeholders as less variables
(sans the surrounding __ and with a ini_ prefix)

return: string
author: Andreas Gohr <andi@splitbrain.org>
param: string $css
param: array $replacements array(placeholder => value)

css_filewrapper($mediatype, $files = [])   X-Ref
Wrapper for the files, content and mediatype for the event CSS_STYLES_INCLUDED

return: array
author: Gerry Weißbach <gerry.w@gammaproduction.de>
param: string $mediatype type ofthe current media files/content set
param: array $files set of files that define the current mediatype

css_defaultstyles()   X-Ref
Prints the @media encapsulated default styles of DokuWiki

This function is being called by a CSS_STYLES_INCLUDED event
The event can be distinguished by the mediatype which is:

author: Gerry Weißbach <gerry.w@gammaproduction.de>

css_interwiki()   X-Ref
Prints classes for interwikilinks

Interwiki links have two classes: 'interwiki' and 'iw_$name>' where
$name is the identifier given in the config. All Interwiki links get
an default style with a default icon. If a special icon is available
for an interwiki URL it is set in it's own class. Both classes can be
overwritten in the template or userstyles.

author: Andreas Gohr <andi@splitbrain.org>

css_filetypes()   X-Ref
Prints classes for file download links

author: Andreas Gohr <andi@splitbrain.org>

css_loadfile($file, $location = '')   X-Ref
Loads a given file and fixes relative URLs with the
given location prefix

return: string
param: string $file file system path
param: string $location