Class to output CSS data quickly for public facing pages.

This class is not designed to be used with the MVC structure; this allows us to significantly reduce the amount of overhead in a request.

This class is entirely self sufficient. It handles parsing the input, getting the data, rendering it, and manipulating HTTP headers.

package XenForo_CssOutput

 Methods

Constructor.

__construct(array $input) 

Parameters

$input

array

Array of input. Style and CSS will be pulled from this.

Creates the CSS property access debug string from a list of invalid style propery accesses.

createDebugErrorString(array $invalidPropertyAccess) : string

Parameters

$invalidPropertyAccess

array

Format: [group] => true ..OR.. [group][value] => true

Returns

string

Outputs the specified CSS.

displayCss(string $css) 

Also outputs the necessary HTTP headers.

Parameters

$css

string

Gets debug output for errors as CSS rules that will change the display of the page to make it clear errors occurred.

getDebugErrorsAsCss(array $errors) : string

Parameters

$errors

array

Collection of errors: [template name] => error text

Returns

string

Returns a regular expression that matches SINGLE SHADOW text-shadow rules.

getTextShadowRegex() : string

Used to fix a Chrome rendering 'feature'.

link http://code.google.com/p/chromium/issues/detail?id=23440

Returns

string

handleIfModifiedSinceHeader()

handleIfModifiedSinceHeader(array $server) 

Parameters

$server

Parses the style ID and the list of CSS out of the specified array of input.

parseInput(array $input) 

The style ID will be found in "style" and CSS list in "css". The CSS should be comma-delimited.

Parameters

$input

array

prepareCssForOutput()

prepareCssForOutput($css, $direction, $minify) 

Parameters

$css

$direction

$minify

Renders the CSS and returns it.

renderCss() : string

Returns

string

Renders the CSS from a collection of Template objects.

renderCssFromObjects(array $templates, boolean $withDebug) : string

Parameters

$templates

array

Array of XenForo_Template_Abstract objects

$withDebug

boolean

If true, output debug CSS when invalid properties are accessed

Returns

string

Static helper to execute a full request for CSS output.

run() 

This will instantiate the object, pull the data from $_REQUEST, and then output the CSS.

Translates CSS rules for use by current browsers.

translateCssRules(string $output) : string

Parameters

$output

string

Returns

string

Handles replacement of an rgba() color with a link to the rgba.php image file that will generate a 10x10 PNG to show the image.

_handleRgbaReplacement(array $match) : string

Parameters

$match

array

Match from regex

Returns

string

Does any preperations necessary for outputting to be done.

_prepareForOutput() 

 Properties

 

Array of CSS templates that have been requested.

$_cssRequested : array

These will have ".css" appended to them and requested as templates.

 

List of user display styles to write out username CSS.

$_displayStyles : array

 

The timestamp of the last modification, according to the input.

$_inputModifiedDate : integer

(Used to compare to If-Modified-Since header.)

 

List of smilie sprite styles to write out sprite CSS.

$_smilieSprites : array

 

Style ID the CSS will be retrieved from.

$_styleId : integer

 

Date of the last modification to the style.

$_styleModifiedDate : integer

Used to output Last-Modified header.

 

The direction in which text should be rendered.

$_textDirection : string

Either ltr or rtl.