[ Index ]

PHP Cross Reference of Unnamed Project

title

Body

[close]

/lib/ -> csslib.php (summary)

This file contains CSS related class, and function for the CSS optimiser. Please see the {@link css_optimiser} class for greater detail.

Copyright: 2012 Sam Hemelryk
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 4998 lines (162 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 53 classes

css_optimiser:: (21 methods):
  process()
  produce_css()
  optimise()
  get_stats()
  has_errors()
  get_errors()
  output_errors_css()
  output_stats_css()
  reset_stats()
  is_pretty()
  get_indent()
  increase_indent()
  decrease_indent()
  get_separator()
  media()
  keyframe()
  rule()
  selectors()
  selector()
  styles()
  style()

core_css_consolidatable_style:: (1 method):
  consolidate()

css_selector:: (6 methods):
  init()
  __construct()
  add()
  get_selector_count()
  out()
  is_basic()

css_rule:: (24 methods):
  init()
  __construct()
  add_selector()
  add_style()
  add_styles()
  get_selectors()
  get_styles()
  out()
  get_consolidated_styles()
  split_by_selector()
  split_by_style()
  get_style_hash()
  get_selector_hash()
  get_selector_count()
  has_errors()
  get_error_string()
  is_reset_rule()
  add_rule()
  get_rules()
  organise_rules_by_selectors()
  count_rules()
  count_selectors()
  has_errors()
  get_errors()

css_media:: (4 methods):
  __construct()
  out()
  get_types()
  get_reset_rules()

css_keyframe:: (21 methods):
  __construct()
  get_for()
  get_name()
  out()
  init_automatic()
  __construct()
  set_value()
  is_valid()
  get_name()
  get_value()
  out()
  clean_value()
  consolidate_to()
  set_error()
  has_error()
  get_last_error()
  is_special_empty_value()
  allows_multiple_values()
  is_important()
  set_important()
  set_actual_name()

css_style_generic:: (1 method):
  clean_value()

css_style_color:: (5 methods):
  init()
  clean_value()
  out()
  shrink_value()
  is_valid()

css_style_width:: (3 methods):
  is_valid()
  clean_value()
  init()

css_style_margin:: (2 methods):
  init()
  consolidate()

css_style_margintop:: (2 methods):
  init()
  consolidate_to()

css_style_marginright:: (2 methods):
  init()
  consolidate_to()

css_style_marginbottom:: (2 methods):
  init()
  consolidate_to()

css_style_marginleft:: (2 methods):
  init()
  consolidate_to()

css_style_border:: (5 methods):
  init()
  consolidate()
  consolidate_to()
  consolidate_styles_by_direction()
  build_style_string()

css_style_bordercolor:: (4 methods):
  init()
  consolidate_to()
  clean_value()
  out()

css_style_borderleft:: (2 methods):
  init()
  consolidate_to()

css_style_borderright:: (2 methods):
  init()
  consolidate_to()

css_style_bordertop:: (2 methods):
  init()
  consolidate_to()

css_style_borderbottom:: (2 methods):
  init()
  consolidate_to()

css_style_borderwidth:: (5 methods):
  init()
  consolidate_to()
  is_valid()
  clean_value()
  is_border_width()

css_style_borderstyle:: (2 methods):
  init()
  consolidate_to()

css_style_bordertopcolor:: (2 methods):
  init()
  consolidate_to()

css_style_borderleftcolor:: (2 methods):
  init()
  consolidate_to()

css_style_borderrightcolor:: (2 methods):
  init()
  consolidate_to()

css_style_borderbottomcolor:: (2 methods):
  init()
  consolidate_to()

css_style_bordertopwidth:: (2 methods):
  init()
  consolidate_to()

css_style_borderleftwidth:: (2 methods):
  init()
  consolidate_to()

css_style_borderrightwidth:: (2 methods):
  init()
  consolidate_to()

css_style_borderbottomwidth:: (2 methods):
  init()
  consolidate_to()

css_style_bordertopstyle:: (2 methods):
  init()
  consolidate_to()

css_style_borderleftstyle:: (2 methods):
  init()
  consolidate_to()

css_style_borderrightstyle:: (2 methods):
  init()
  consolidate_to()

css_style_borderbottomstyle:: (2 methods):
  init()
  consolidate_to()

css_style_background:: (3 methods):
  init()
  replace_bracket_placeholders()
  consolidate()

css_style_background_advanced:: (2 methods):
  init()
  allows_multiple_values()

css_style_backgroundcolor:: (4 methods):
  init()
  consolidate_to()
  is_special_empty_value()
  is_valid()

css_style_backgroundimage:: (4 methods):
  init()
  consolidate_to()
  is_special_empty_value()
  is_valid()

css_style_backgroundimage_advanced:: (2 methods):
  init()
  allows_multiple_values()

css_style_backgroundrepeat:: (4 methods):
  init()
  consolidate_to()
  is_special_empty_value()
  is_valid()

css_style_backgroundattachment:: (4 methods):
  init()
  consolidate_to()
  is_special_empty_value()
  is_valid()

css_style_backgroundposition:: (4 methods):
  init()
  consolidate_to()
  is_special_empty_value()
  is_valid()

css_style_backgroundsize:: (2 methods):
  init()
  consolidate_to()

css_style_backgroundclip:: (2 methods):
  init()
  consolidate_to()

css_style_backgroundorigin:: (2 methods):
  init()
  consolidate_to()

css_style_padding:: (2 methods):
  init()
  consolidate()

css_style_paddingtop:: (2 methods):
  init()
  consolidate_to()

css_style_paddingright:: (2 methods):
  init()
  consolidate_to()

css_style_paddingbottom:: (2 methods):
  init()
  consolidate_to()

css_style_paddingleft:: (2 methods):
  init()
  consolidate_to()

css_style_cursor:: (2 methods):
  init()
  clean_value()

css_style_verticalalign:: (2 methods):
  init()
  clean_value()

css_style_float:: (2 methods):
  init()
  clean_value()

Defines 2 functions

  css_store_css()
  css_write_file()
  css_chunk_by_selector_count()
  css_send_cached_css()
  css_send_cached_css_content()
  css_send_uncached_css()
  css_send_unmodified()
  css_send_css_not_found()
  css_is_colour()
  css_is_width()
  css_sort_by_count()

Class: css_optimiser  - X-Ref

A basic CSS optimiser that strips out unwanted things and then processes CSS organising and cleaning styles.

This CSS optimiser works by reading through a CSS string one character at a
time and building an object structure of the CSS.
As part of that processing styles are expanded out as much as they can be to
ensure we collect all mappings, at the end of the processing those styles are
then combined into an optimised form to keep them as short as possible.

process($css)   X-Ref
Processes incoming CSS optimising it and then returning it.

param: string $css The raw CSS to optimise
return: string The optimised CSS

produce_css($charset, array $imports, array $medias, array $keyframes)   X-Ref
Produces CSS for the given charset, imports, media, and keyframes

param: string $charset
param: array $imports
param: css_media[] $medias
param: css_keyframe[] $keyframes
return: string

optimise(css_rule_collection $media)   X-Ref
Optimises the CSS rules within a rule collection of one form or another

param: css_rule_collection $media
return: void This function acts in reference

get_stats()   X-Ref
Returns an array of stats from the last processing run

return: string

has_errors()   X-Ref
Returns true if any errors have occured during processing

return: bool

get_errors($clear = false)   X-Ref
Returns an array of errors that have occured

param: bool $clear If set to true the errors will be cleared after being returned.
return: array

output_errors_css()   X-Ref
Returns any errors as a string that can be included in CSS.

return: string

output_stats_css()   X-Ref
Returns a string to display stats about the last generation within CSS output

return: string

reset_stats()   X-Ref
Resets the stats ready for another fresh processing


is_pretty()   X-Ref
Returns true if the output should still maintain minimum formatting.

return: bool

get_indent()   X-Ref
Returns the indenting char to use for indenting things nicely.

return: string

increase_indent()   X-Ref
Increases the current indent


decrease_indent()   X-Ref
Decreases the current indent


get_separator()   X-Ref
Returns the string to use as a separator

return: string

media($typestring, array &$rules)   X-Ref
Returns CSS for media

param: string $typestring
param: css_rule[] $rules An array of css_rule objects
return: string

keyframe($for, $name, array &$rules)   X-Ref
Returns CSS for a keyframe

param: string $for The desired declaration. e.g. keyframes, -moz-keyframes, -webkit-keyframes
param: string $name The name for the keyframe
param: css_rule[] $rules An array of rules belonging to the keyframe
return: string

rule($selector, $styles)   X-Ref
Returns CSS for a rule

param: string $selector
param: string $styles
return: string

selectors(array $selectors)   X-Ref
Returns CSS for the selectors of a rule

param: css_selector[] $selectors Array of css_selector objects
return: string

selector(array $components)   X-Ref
Returns a selector given the components that make it up.

param: array $components
return: string

styles(array $styles)   X-Ref
Returns a CSS string for the provided styles

param: css_style[] $styles Array of css_style objects
return: string

style($name, $value, $important = false)   X-Ref
Returns a style CSS

param: string $name
param: string $value
param: bool $important
return: string

Interface: core_css_consolidatable_style  - X-Ref

A consolidatable style interface.

Class that implement this have a short-hand notation for specifying multiple styles.

consolidate(array $styles)   X-Ref
Used to consolidate several styles into a single "short-hand" style.

param: array $styles
return: mixed

Class: css_selector  - X-Ref

A structure to represent a CSS selector.

The selector is the classes, id, elements, and psuedo bits that make up a CSS
rule.

init()   X-Ref
Initialises a new CSS selector

return: css_selector

__construct()   X-Ref
CSS selectors can only be created through the init method above.


add($selector)   X-Ref
Adds a selector to the end of the current selector

param: string $selector

get_selector_count()   X-Ref
Returns the number of individual components that make up this selector

return: int

out()   X-Ref
Returns the selector for use in a CSS rule

return: string

is_basic()   X-Ref
Returns true is all of the selectors act only upon basic elements (no classes/ids)

return: bool

Class: css_rule  - X-Ref

A structure to represent a CSS rule.

init()   X-Ref
Created a new CSS rule. This is the only way to create a new CSS rule externally.

return: css_rule

__construct($selector = null, array $styles = array()   X-Ref
Constructs a new css rule.

param: string $selector The selector or array of selectors that make up this rule.
param: css_style[] $styles An array of styles that belong to this rule.

add_selector(css_selector $selector)   X-Ref
Adds a new CSS selector to this rule

e.g. $rule->add_selector('.one #two.two');

param: css_selector $selector Adds a CSS selector to this rule.

add_style($style)   X-Ref
Adds a new CSS style to this rule.

param: css_style|string $style Adds a new style to this rule

add_styles(array $styles)   X-Ref
An easy method of adding several styles at once. Just calls add_style.

This method simply iterates over the array and calls {@link css_rule::add_style()}
with each.

param: css_style[] $styles Adds an array of styles

get_selectors()   X-Ref
Returns the array of selectors

return: css_selector[]

get_styles()   X-Ref
Returns the array of styles

return: css_style[]

out()   X-Ref
Outputs this rule as a fragment of CSS

return: string

get_consolidated_styles()   X-Ref
Consolidates all styles associated with this rule

return: css_style[] An array of consolidated styles

split_by_selector()   X-Ref
Splits this rules into an array of CSS rules. One for each of the selectors
that make up this rule.

return: css_rule[]

split_by_style()   X-Ref
Splits this rule into an array of rules. One for each of the styles that
make up this rule

return: css_rule[] Array of css_rule objects

get_style_hash()   X-Ref
Gets a hash for the styles of this rule

return: string

get_selector_hash()   X-Ref
Gets a hash for the selectors of this rule

return: string

get_selector_count()   X-Ref
Gets the number of selectors that make up this rule.

return: int

has_errors()   X-Ref
Returns true if there are any errors with this rule.

return: bool

get_error_string()   X-Ref
Returns the error strings that were recorded when processing this rule.

Before calling this function you should first call {@link css_rule::has_errors()}
to make sure there are errors (hopefully there arn't).

return: string

is_reset_rule()   X-Ref
Returns true if this rule could be considered a reset rule.

A reset rule is a rule that acts upon an HTML element and does not include any other parts to its selector.

return: bool

add_rule(css_rule $newrule)   X-Ref
Adds a new CSS rule to this collection instance

param: css_rule $newrule

get_rules()   X-Ref
Returns the rules used by this collection

return: css_rule[]

organise_rules_by_selectors()   X-Ref
Organises rules by gropuing selectors based upon the styles and consolidating
those selectors into single rules.

return: bool True if the CSS was optimised by this method

count_rules()   X-Ref
Returns the total number of rules that exist within this collection

return: int

count_selectors()   X-Ref
Returns the total number of selectors that exist within this collection

return: int

has_errors()   X-Ref
Returns true if the collection has any rules that have errors

return: boolean

get_errors()   X-Ref
Returns any errors that have happened within rules in this collection.

return: string[]

Class: css_media  - X-Ref

A media class to organise rules by the media they apply to.

__construct($for = 'all')   X-Ref
Initalises a new media instance

param: string $for The media that the contained rules are destined for.

out()   X-Ref
Returns the CSS for this media and all of its rules.

return: string

get_types()   X-Ref
Returns an array of media that this media instance applies to

return: array

get_reset_rules($remove = false)   X-Ref
Returns all of the reset rules known by this media set.

param: bool $remove If set to true reset rules will be removed before being returned.
return: array

Class: css_keyframe  - X-Ref

A media class to organise rules by the media they apply to.

__construct($for, $name)   X-Ref
Constructs a new keyframe

param: string $for The directive e.g. keyframes, -moz-keyframes, -webkit-keyframes
param: string $name The name for the keyframes

get_for()   X-Ref
Returns the directive of this keyframe

e.g. keyframes, -moz-keyframes, -webkit-keyframes
return: string

get_name()   X-Ref
Returns the name of this keyframe

return: string

out()   X-Ref
Returns the CSS for this collection of keyframes and all of its rules.

return: string

init_automatic($name, $value)   X-Ref
Initialises a new style.

This is the only public way to create a style to ensure they that appropriate
style class is used if it exists.

param: string $name The name of the style.
param: string $value The value of the style.
return: css_style_generic

__construct($name, $value)   X-Ref
Creates a new style when given its name and value

param: string $name The name of the style.
param: string $value The value of the style.

set_value($value)   X-Ref
Sets the value for the style

param: string $value

is_valid()   X-Ref
Returns true if the value associated with this style is valid

return: bool

get_name()   X-Ref
Returns the name for the style

return: string

get_value($includeimportant = true)   X-Ref
Returns the value for the style

param: bool $includeimportant If set to true and the rule is important !important postfix will be used.
return: string

out($value = null)   X-Ref
Returns the style ready for use in CSS

param: string|null $value A value to use to override the value for this style.
return: string

clean_value($value)   X-Ref
This can be overridden by a specific style allowing it to clean its values
consistently.

param: mixed $value
return: mixed

consolidate_to()   X-Ref
If this particular style can be consolidated into another style this function
should return the style that it can be consolidated into.

return: string|null

set_error($message)   X-Ref
Sets the last error message.

param: string $message

has_error()   X-Ref
Returns true if an error has occured

return: bool

get_last_error()   X-Ref
Returns the last error that occured or null if no errors have happened.

return: string

is_special_empty_value()   X-Ref
Returns true if the value for this style is the special null value.

This should only be overriden in circumstances where a shorthand style can lead
to move explicit styles being overwritten. Not a common place occurenace.

Example:
This occurs if the shorthand background property was used but no proper value
was specified for this style.
This leads to a null value being used unless otherwise overridden.

return: bool

allows_multiple_values()   X-Ref
Returns true if this style permits multiple values.

This occurs for styles such as background image that can have browser specific values that need to be maintained because
of course we don't know what browser the user is using, and optimisation occurs before caching.
Thus we must always server all values we encounter in the order we encounter them for when this is set to true.

return: boolean False by default, true if the style supports muliple values.

is_important()   X-Ref
Returns true if this style was marked important.

return: bool

set_important($important = true)   X-Ref
Sets the important flag for this style and its current value.

param: bool $important

set_actual_name($name)   X-Ref
Sets the actual name used within the style.

This method allows us to support browser hacks like *width:0;

param: string $name

Class: css_style_generic  - X-Ref

A generic CSS style class to use when a more specific class does not exist.

clean_value($value)   X-Ref
Cleans incoming values for typical things that can be optimised.

param: mixed $value Cleans the provided value optimising it if possible
return: string

Class: css_style_color  - X-Ref

A colour CSS style

init($value)   X-Ref
Creates a new colour style

param: mixed $value Initialises a new colour style
return: css_style_color

clean_value($value)   X-Ref
Cleans the colour unifing it to a 6 char hash colour if possible
Doing this allows us to associate identical colours being specified in
different ways. e.g. Red, red, #F00, and #F00000

param: mixed $value Cleans the provided value optimising it if possible
return: string

out($overridevalue = null)   X-Ref
Returns the colour style for use within CSS.
Will return an optimised hash colour.

e.g #123456
#123 instead of #112233
#F00 instead of red

param: string $overridevalue If provided then this value will be used instead
return: string

shrink_value($value)   X-Ref
Shrinks the colour value is possible.

param: string $value Shrinks the current value to an optimial form if possible
return: string

is_valid()   X-Ref
Returns true if the value is a valid colour.

return: bool

Class: css_style_width  - X-Ref

A width style

is_valid()   X-Ref
Checks if the width is valid

return: bool

clean_value($value)   X-Ref
Cleans the provided value

param: mixed $value Cleans the provided value optimising it if possible
return: string

init($value)   X-Ref
Initialises a new width style

param: mixed $value The value this style has
return: css_style_width

Class: css_style_margin  - X-Ref

A margin style

init($value)   X-Ref
Initialises a margin style.

In this case we split the margin into several other margin styles so that
we can properly condense overrides and then reconsolidate them later into
an optimal form.

param: string $value The value the style has
return: array An array of margin values that can later be consolidated

consolidate(array $styles)   X-Ref
Consolidates individual margin styles into a single margin style

param: css_style[] $styles
return: css_style[] An array of consolidated styles

Class: css_style_margintop  - X-Ref

A margin top style

init($value)   X-Ref
A simple init, just a single style

param: string $value The value the style has
return: css_style_margintop

consolidate_to()   X-Ref
This style can be consolidated into a single margin style

return: string

Class: css_style_marginright  - X-Ref

A margin right style

init($value)   X-Ref
A simple init, just a single style

param: string $value The value the style has
return: css_style_margintop

consolidate_to()   X-Ref
This style can be consolidated into a single margin style

return: string

Class: css_style_marginbottom  - X-Ref

A margin bottom style

init($value)   X-Ref
A simple init, just a single style

param: string $value The value the style has
return: css_style_margintop

consolidate_to()   X-Ref
This style can be consolidated into a single margin style

return: string

Class: css_style_marginleft  - X-Ref

A margin left style

init($value)   X-Ref
A simple init, just a single style

param: string $value The value the style has
return: css_style_margintop

consolidate_to()   X-Ref
This style can be consolidated into a single margin style

return: string

Class: css_style_border  - X-Ref

A border style

init($value)   X-Ref
Initalises the border style into an array of individual style compontents

param: string $value The value the style has
return: css_style_bordercolor

consolidate(array $styles)   X-Ref
Consolidates all border styles into a single style

param: css_style[] $styles An array of border styles
return: css_style[] An optimised array of border styles

consolidate_to()   X-Ref
Border styles get consolidated to a single border style.

return: string

consolidate_styles_by_direction(&$array, $class, $style,$top, $right = null, $bottom = null, $left = null)   X-Ref
Consolidates a series of border styles into an optimised array of border
styles by looking at the direction of the border and prioritising that
during the optimisation.

param: array $array An array to add styles into during consolidation. Passed by reference.
param: string $class The class type to initalise
param: string $style The style to create
param: string|array $top The top value
param: string $right The right value
param: string $bottom The bottom value
param: string $left The left value
return: bool

build_style_string(&$array, $class, $cssstyle, $width = null, $style = null, $color = null)   X-Ref
Builds a border style for a set of width, style, and colour values

param: array $array An array into which the generated style is added
param: string $class The class type to initialise
param: string $cssstyle The style to use
param: string $width The width of the border
param: string $style The style of the border
param: string $color The colour of the border
return: bool

Class: css_style_bordercolor  - X-Ref

A border colour style

init($value)   X-Ref
Creates a new border colour style

Based upon the colour style

param: mixed $value
return: Array of css_style_bordercolor

consolidate_to()   X-Ref
Consolidate this to a single border style

return: string

clean_value($value)   X-Ref
Cleans the value

param: string $value Cleans the provided value optimising it if possible
return: string

out($overridevalue = null)   X-Ref
Outputs this style

param: string $overridevalue
return: string

Class: css_style_borderleft  - X-Ref

A border left style

init($value)   X-Ref
Initialises the border left style into individual components

param: string $value
return: array Array of css_style_borderleftwidth|css_style_borderleftstyle|css_style_borderleftcolor

consolidate_to()   X-Ref
Consolidate this to a single border style

return: string

Class: css_style_borderright  - X-Ref

A border right style

init($value)   X-Ref
Initialises the border right style into individual components

param: string $value The value of the style
return: array Array of css_style_borderrightwidth|css_style_borderrightstyle|css_style_borderrightcolor

consolidate_to()   X-Ref
Consolidate this to a single border style

return: string

Class: css_style_bordertop  - X-Ref

A border top style

init($value)   X-Ref
Initialises the border top style into individual components

param: string $value The value of the style
return: array Array of css_style_bordertopwidth|css_style_bordertopstyle|css_style_bordertopcolor

consolidate_to()   X-Ref
Consolidate this to a single border style

return: string

Class: css_style_borderbottom  - X-Ref

A border bottom style

init($value)   X-Ref
Initialises the border bottom style into individual components

param: string $value The value of the style
return: array Array of css_style_borderbottomwidth|css_style_borderbottomstyle|css_style_borderbottomcolor

consolidate_to()   X-Ref
Consolidate this to a single border style

return: string

Class: css_style_borderwidth  - X-Ref

A border width style

init($value)   X-Ref
Creates a new border colour style

Based upon the colour style

param: string $value The value of the style
return: array Array of css_style_border*width

consolidate_to()   X-Ref
Consolidate this to a single border style

return: string

is_valid()   X-Ref
Checks if the width is valid

return: bool

clean_value($value)   X-Ref
Cleans the provided value

param: mixed $value Cleans the provided value optimising it if possible
return: string

is_border_width($value)   X-Ref
Returns true if the provided value is a permitted border width

param: string $value The value to check
return: bool

Class: css_style_borderstyle  - X-Ref

A border style style

init($value)   X-Ref
Creates a new border colour style

Based upon the colour style

param: string $value The value of the style
return: array Array of css_style_border*style

consolidate_to()   X-Ref
Consolidate this to a single border style

return: string

Class: css_style_bordertopcolor  - X-Ref

A border top colour style

init($value)   X-Ref
Initialises this style object

param: string $value The value of the style
return: css_style_bordertopcolor

consolidate_to()   X-Ref
Consolidate this to a single border style

return: string

Class: css_style_borderleftcolor  - X-Ref

A border left colour style

init($value)   X-Ref
Initialises this style object

param: string $value The value of the style
return: css_style_borderleftcolor

consolidate_to()   X-Ref
Consolidate this to a single border style

return: string

Class: css_style_borderrightcolor  - X-Ref

A border right colour style

init($value)   X-Ref
Initialises this style object

param: string $value The value of the style
return: css_style_borderrightcolor

consolidate_to()   X-Ref
Consolidate this to a single border style

return: string

Class: css_style_borderbottomcolor  - X-Ref

A border bottom colour style

init($value)   X-Ref
Initialises this style object

param: string $value The value of the style
return: css_style_borderbottomcolor

consolidate_to()   X-Ref
Consolidate this to a single border style

return: string

Class: css_style_bordertopwidth  - X-Ref

A border width top style

init($value)   X-Ref
Initialises this style object

param: string $value The value of the style
return: css_style_bordertopwidth

consolidate_to()   X-Ref
Consolidate this to a single border style

return: string

Class: css_style_borderleftwidth  - X-Ref

A border width left style

init($value)   X-Ref
Initialises this style object

param: string $value The value of the style
return: css_style_borderleftwidth

consolidate_to()   X-Ref
Consolidate this to a single border style

return: string

Class: css_style_borderrightwidth  - X-Ref

A border width right style

init($value)   X-Ref
Initialises this style object

param: string $value The value of the style
return: css_style_borderrightwidth

consolidate_to()   X-Ref
Consolidate this to a single border style

return: string

Class: css_style_borderbottomwidth  - X-Ref

A border width bottom style

init($value)   X-Ref
Initialises this style object

param: string $value The value of the style
return: css_style_borderbottomwidth

consolidate_to()   X-Ref
Consolidate this to a single border style

return: string

Class: css_style_bordertopstyle  - X-Ref

A border top style

init($value)   X-Ref
Initialises this style object

param: string $value The value of the style
return: css_style_bordertopstyle

consolidate_to()   X-Ref
Consolidate this to a single border style

return: string

Class: css_style_borderleftstyle  - X-Ref

A border left style

init($value)   X-Ref
Initialises this style object

param: string $value The value of the style
return: css_style_borderleftstyle

consolidate_to()   X-Ref
Consolidate this to a single border style

return: string

Class: css_style_borderrightstyle  - X-Ref

A border right style

init($value)   X-Ref
Initialises this style object

param: string $value The value of the style
return: css_style_borderrightstyle

consolidate_to()   X-Ref
Consolidate this to a single border style

return: string

Class: css_style_borderbottomstyle  - X-Ref

A border bottom style

init($value)   X-Ref
Initialises this style object

param: string $value The value for the style
return: css_style_borderbottomstyle

consolidate_to()   X-Ref
Consolidate this to a single border style

return: string

Class: css_style_background  - X-Ref

A background style

init($value)   X-Ref
Initialises a background style

param: string $value The value of the style
return: array An array of background component.

replace_bracket_placeholders($value, array $placeholders)   X-Ref
Static helper method to switch in bracket replacements

param: string $value
param: array $placeholders
return: string

consolidate(array $styles)   X-Ref
Consolidates background styles into a single background style

param: css_style_background[] $styles Consolidates the provided array of background styles
return: css_style[] Consolidated optimised background styles

Class: css_style_background_advanced  - X-Ref

A advanced background style that allows multiple values to preserve unknown entities

init($value)   X-Ref
Creates a new background colour style

param: string $value The value of the style
return: css_style_backgroundimage

allows_multiple_values()   X-Ref
Returns true because the advanced background image supports multiple values.
e.g. -webkit-linear-gradient and -moz-linear-gradient.

return: boolean

Class: css_style_backgroundcolor  - X-Ref

A background colour style.

Based upon the colour style.

init($value)   X-Ref
Creates a new background colour style

param: string $value The value of the style
return: css_style_backgroundcolor

consolidate_to()   X-Ref
css_style_backgroundcolor consolidates to css_style_background

return: string

is_special_empty_value()   X-Ref
Returns true if the value for this style is the special null value.

This occurs if the shorthand background property was used but no proper value
was specified for this style.
This leads to a null value being used unless otherwise overridden.

return: bool

is_valid()   X-Ref
Returns true if the value for this style is valid

return: bool

Class: css_style_backgroundimage  - X-Ref

A background image style.

init($value)   X-Ref
Creates a new background image style

param: string $value The value of the style
return: css_style_backgroundimage

consolidate_to()   X-Ref
Consolidates this style into a single background style

return: string

is_special_empty_value()   X-Ref
Returns true if the value for this style is the special null value.

This occurs if the shorthand background property was used but no proper value
was specified for this style.
This leads to a null value being used unless otherwise overridden.

return: bool

is_valid()   X-Ref
Returns true if the value for this style is valid

return: bool

Class: css_style_backgroundimage_advanced  - X-Ref

A background image style that supports multiple values and masquerades as a background-image

init($value)   X-Ref
Creates a new background colour style

param: string $value The value of the style
return: css_style_backgroundimage

allows_multiple_values()   X-Ref
Returns true because the advanced background image supports multiple values.
e.g. -webkit-linear-gradient and -moz-linear-gradient.

return: boolean

Class: css_style_backgroundrepeat  - X-Ref

A background repeat style.

init($value)   X-Ref
Creates a new background colour style

param: string $value The value of the style
return: css_style_backgroundrepeat

consolidate_to()   X-Ref
Consolidates this style into a single background style

return: string

is_special_empty_value()   X-Ref
Returns true if the value for this style is the special null value.

This occurs if the shorthand background property was used but no proper value
was specified for this style.
This leads to a null value being used unless otherwise overridden.

return: bool

is_valid()   X-Ref
Returns true if the value for this style is valid

return: bool

Class: css_style_backgroundattachment  - X-Ref

A background attachment style.

init($value)   X-Ref
Creates a new background colour style

param: string $value The value of the style
return: css_style_backgroundattachment

consolidate_to()   X-Ref
Consolidates this style into a single background style

return: string

is_special_empty_value()   X-Ref
Returns true if the value for this style is the special null value.

This occurs if the shorthand background property was used but no proper value
was specified for this style.
This leads to a null value being used unless otherwise overridden.

return: bool

is_valid()   X-Ref
Returns true if the value for this style is valid

return: bool

Class: css_style_backgroundposition  - X-Ref

A background position style.

init($value)   X-Ref
Creates a new background colour style

param: string $value The value of the style
return: css_style_backgroundposition

consolidate_to()   X-Ref
Consolidates this style into a single background style

return: string

is_special_empty_value()   X-Ref
Returns true if the value for this style is the special null value.

This occurs if the shorthand background property was used but no proper value
was specified for this style.
This leads to a null value being used unless otherwise overridden.

return: bool

is_valid()   X-Ref
Returns true if the value for this style is valid

return: bool

Class: css_style_backgroundsize  - X-Ref

A background size style.

init($value)   X-Ref
Creates a new background size style

param: string $value The value of the style
return: css_style_backgroundposition

consolidate_to()   X-Ref
Consolidates this style into a single background style

return: string

Class: css_style_backgroundclip  - X-Ref

A background clip style.

init($value)   X-Ref
Creates a new background clip style

param: string $value The value of the style
return: css_style_backgroundposition

consolidate_to()   X-Ref
Consolidates this style into a single background style

return: string

Class: css_style_backgroundorigin  - X-Ref

A background origin style.

init($value)   X-Ref
Creates a new background origin style

param: string $value The value of the style
return: css_style_backgroundposition

consolidate_to()   X-Ref
Consolidates this style into a single background style

return: string

Class: css_style_padding  - X-Ref

A padding style.

init($value)   X-Ref
Initialises this padding style into several individual padding styles

param: string $value The value fo the style
return: array An array of padding styles

consolidate(array $styles)   X-Ref
Consolidates several padding styles into a single style.

param: css_style_padding[] $styles Array of padding styles
return: css_style[] Optimised+consolidated array of padding styles

Class: css_style_paddingtop  - X-Ref

A padding top style.

init($value)   X-Ref
Initialises this style

param: string $value The value of the style
return: css_style_paddingtop

consolidate_to()   X-Ref
Consolidates this style into a single padding style

return: string

Class: css_style_paddingright  - X-Ref

A padding right style.

init($value)   X-Ref
Initialises this style

param: string $value The value of the style
return: css_style_paddingright

consolidate_to()   X-Ref
Consolidates this style into a single padding style

return: string

Class: css_style_paddingbottom  - X-Ref

A padding bottom style.

init($value)   X-Ref
Initialises this style

param: string $value The value of the style
return: css_style_paddingbottom

consolidate_to()   X-Ref
Consolidates this style into a single padding style

return: string

Class: css_style_paddingleft  - X-Ref

A padding left style.

init($value)   X-Ref
Initialises this style

param: string $value The value of the style
return: css_style_paddingleft

consolidate_to()   X-Ref
Consolidates this style into a single padding style

return: string

Class: css_style_cursor  - X-Ref

A cursor style.

init($value)   X-Ref
Initialises a new cursor style

param: string $value
return: css_style_cursor

clean_value($value)   X-Ref
Cleans the given value and returns it.

param: string $value
return: string

Class: css_style_verticalalign  - X-Ref

A vertical alignment style.

init($value)   X-Ref
Initialises a new vertical alignment style

param: string $value
return: css_style_verticalalign

clean_value($value)   X-Ref
Cleans the given value and returns it.

param: string $value
return: string

Class: css_style_float  - X-Ref

A float style.

init($value)   X-Ref
Initialises a new float style

param: string $value
return: css_style_float

clean_value($value)   X-Ref
Cleans the given value and returns it.

param: string $value
return: string

Functions
Functions that are not part of a class:

css_store_css(theme_config $theme, $csspath, $csscontent, $chunk = false, $chunkurl = null)   X-Ref
Stores CSS in a file at the given path.

This function either succeeds or throws an exception.

param: theme_config $theme The theme that the CSS belongs to.
param: string $csspath The path to store the CSS at.
param: string $csscontent the complete CSS in one string
param: bool $chunk If set to true these files will be chunked to ensure
param: string $chunkurl If the CSS is be chunked then we need to know the URL

css_write_file($filename, $content)   X-Ref
Writes a CSS file.

param: string $filename
param: string $content

css_chunk_by_selector_count($css, $importurl, $maxselectors = 4095, $buffer = 50)   X-Ref
Takes CSS and chunks it if the number of selectors within it exceeds $maxselectors.

The chunking will not split a group of selectors, or a media query. That means that
if n > $maxselectors and there are n selectors grouped together,
they will not be chunked and you could end up with more selectors than desired.
The same applies for a media query that has more than n selectors.

Also, as we do not split group of selectors or media queries, the chunking might
not be as optimal as it could be, having files with less selectors than it could
potentially contain.

String functions used here are not compliant with unicode characters. But that is
not an issue as the syntax of CSS is using ASCII codes. Even if we have unicode
characters in comments, or in the property 'content: ""', it will behave correcly.

Please note that this strips out the comments if chunking happens.

param: string $css The CSS to chunk.
param: string $importurl The URL to use for import statements.
param: int $maxselectors The number of selectors to limit a chunk to.
param: int $buffer Not used any more.
return: array An array of CSS chunks.

css_send_cached_css($csspath, $etag)   X-Ref
Sends a cached CSS file

This function sends the cached CSS file. Remember it is generated on the first
request, then optimised/minified, and finally cached for serving.

param: string $csspath The path to the CSS file we want to serve.
param: string $etag The revision to make sure we utilise any caches.

css_send_cached_css_content($csscontent, $etag)   X-Ref
Sends a cached CSS content

param: string $csscontent The actual CSS markup.
param: string $etag The revision to make sure we utilise any caches.

css_send_uncached_css($css)   X-Ref
Sends CSS directly without caching it.

This function takes a raw CSS string, optimises it if required, and then
serves it.
Turning both themedesignermode and CSS optimiser on at the same time is awful
for performance because of the optimiser running here. However it was done so
that theme designers could utilise the optimised output during development to
help them optimise their CSS... not that they should write lazy CSS.

param: string $css

css_send_unmodified($lastmodified, $etag)   X-Ref
Send file not modified headers

param: int $lastmodified
param: string $etag

css_send_css_not_found()   X-Ref
Sends a 404 message about CSS not being found.


css_is_colour($value)   X-Ref
Determines if the given value is a valid CSS colour.

A CSS colour can be one of the following:
- Hex colour:  #AA66BB
- RGB colour:  rgb(0-255, 0-255, 0-255)
- RGBA colour: rgba(0-255, 0-255, 0-255, 0-1)
- HSL colour:  hsl(0-360, 0-100%, 0-100%)
- HSLA colour: hsla(0-360, 0-100%, 0-100%, 0-1)

Or a recognised browser colour mapping {@link css_optimiser::$htmlcolours}

param: string $value The colour value to check
return: bool

css_is_width($value)   X-Ref
Returns true is the passed value looks like a CSS width.
In order to pass this test the value must be purely numerical or end with a
valid CSS unit term.

param: string|int $value
return: boolean

css_sort_by_count(array $a, array $b)   X-Ref
A simple sorting function to sort two array values on the number of items they contain

param: array $a
param: array $b
return: int



Generated: Thu Aug 11 10:00:09 2016 Cross-referenced by PHPXref 0.7.1