[ Index ]

PHP Cross Reference of DokuWiki

title

Body

[close]

/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: 0 times
Includes or requires: 1 file
 inc/init.php

Defines 1 class

DokuCssFile:: (9 methods):
  __construct()
  load()
  getRelativePath()
  replacements()
  css_datauri()
  css_pluginstyles()
  css_compress()
  css_comment_cb()
  css_onelinecomment_cb()

Defines 9 functions

  css_out()
  css_parseless()
  css_applystyle()
  css_filewrapper()
  css_defaultstyles()
  css_interwiki()
  css_filetypes()
  css_loadfile()

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.

param: string $location base url for this file
return: string the CSS/Less contents of the 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

param: array $match see http://php.net/preg_replace_callback
return: string   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

param: array $match
return: string

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

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

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

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

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

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

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

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

param: array $matches
return: string

Functions
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

param: string $css
return: string

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)

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

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

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
return: array

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:
DW_DEFAULT

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

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