com.lokorin.dfcrafters.lib
[ class tree: com.lokorin.dfcrafters.lib ] [ index: com.lokorin.dfcrafters.lib ] [ all elements ]

Class: CssHandler

Source Location: /_includes/lib_css.php

Class Overview


A class that handles everything that has to do with CSS, all CSS files that are to be included are recorded by this class. The appropriate actions are then taken to make sure that each of the files are then handled correctly when the page should be displayed. Implements the singleton pattern.


Author(s):

  • Andreas Launila

Variables

Constants

Methods



Class Details

[line 51]
A class that handles everything that has to do with CSS, all CSS files that are to be included are recorded by this class. The appropriate actions are then taken to make sure that each of the files are then handled correctly when the page should be displayed. Implements the singleton pattern.



Tags:

author:  Andreas Launila


[ Top ]


Class Variables

$cssNames =

[line 61]

The names of all CSS files that should be included when displaying the page.



Tags:

access:  private

Type:   mixed


[ Top ]

$cssValues =

[line 72]

The CSS values as a tree structure. The array may contain arrays, in which case the key is the name of the node. The array may also contain textual values, which are leaves.



Tags:

access:  private

Type:   array


[ Top ]

$instance =

[line 56]

The one and only instance of the class.



Tags:

access:  private
static:  

Type:   CssHandler


[ Top ]



Class Methods


constructor __construct [line 89]

CssHandler __construct( )

Constructor for CssConverter. Adds itself as additional head information to the page.



Tags:

access:  private


[ Top ]

method convertTemplate [line 136]

string convertTemplate( string $template)

Converts a string containing a CSS template to a string representing a real CSS file.



Tags:

return:  The corresponding CSS (without any special tokens).
access:  private
throws:  IllegalArgumentException If the template contains unexpected variables.


Parameters:

string   $template   A string with CSS but with added tokens that have special meaning, making it a CSS template.

[ Top ]

method getCssLink [line 100]

void getCssLink( $cssName $cssName)

Gets the XHTML link that represents the specified CSS name.



Tags:

access:  private


Parameters:

$cssName   $cssName   The name of the CSS file to which the link should be created.

[ Top ]

method getHeadAddition [line 318]

void getHeadAddition( )

Gets all the CSS links that should be added.



Tags:

access:  public


[ Top ]

method getInstance [line 78]

CssTemplateConverter getInstance( )

Gets the one and only instance of the class.



Tags:

return:  The one and only instance.
access:  public
static:  


[ Top ]

method getToken [line 277]

string getToken( array $steps)

Gets the token that represents the steps take. It's the token that should be replaced in any text by the corresponding value.



Tags:

return:  The corresponding token.
access:  private


Parameters:

array   $steps   The steps that have been taken to get to the value. The elements should be sorted in the order that they have been traversed. I.e. the namespace should be first, then the first subcat and so on.

[ Top ]

method getValue [line 245]

string getValue( array $steps)

Gets the CSS value that correspond to the specified steps.



Tags:

return:  The corresponding CSS value.
access:  private
throws:  NoSuchElementException If the specified steps do not correspond to an existing CSS value.
throws:  IllegalArgumentException If the steps didn't end at a leaf.


Parameters:

array   $steps   The steps that have been taken to get to the value. The elements should be sorted in the order that they have been traversed. I.e. the namespace should be first, then the first subcat and so on.

[ Top ]

method includeCss [line 295]

void includeCss( string $cssName)

Ensures that a css file with the specified name is included in the page output.



Tags:

access:  public


Parameters:

string   $cssName   The name of the css file without the .css extension, i.e. 'form' if one wants to ensure that the file in the css dir named 'form.css' is included.

[ Top ]

method loadCssValueTree [line 166]

array loadCssValueTree( )

Loads all CSS values into a tree structure. The resulting tree structure reflects the XML resource file, but does not contain the root node.



Tags:

return:  An array containing a tree structure. The array may contain arrays, in which case the key is the name of the node. The array may also contain textual values, which are leaves.
access:  private
throws:  IOException If the CSS value files can't be accessed.


[ Top ]

method parseCssValueNode [line 187]

array parseCssValueNode( SimpleXmlElement $node)

Recursivly parses a css value node and turns it into an array structure.



Tags:

return:  An array tree structure representing the node. Each array in the structure is a subnode and each value that is not an array represents a leaf.
access:  private


Parameters:

SimpleXmlElement   $node   The node that should be parsed.

[ Top ]

method replaceCssValues [line 214]

string replaceCssValues( string $text, array $values, array $steps)

Replaces all css values defined by the specified array in the specified text. The values are represented in the css text as $namespace:subcat:value, the subcat may or may not be used, any number of subctegories can be used after the namespace but before the value.



Tags:

return:  The text but with the css values replaced.
access:  private


Parameters:

string   $text   The text in which values should be replaced.
array   $values   The values that shpould be replaced, the array may contain subarrays, which are also processed.
array   $steps   The steps that have been taken so far. The elements should be sorted in the order that they have been traversed. I.e. the namespace should be first, then the first subcat and so on.

[ Top ]

method stripCssExtension [line 121]

string stripCssExtension( string $text)

Strips any .css extensions that occur last in a specified text.



Tags:

return:  Text without a .css extension.
access:  private


Parameters:

string   $text   The text from which .css extensions should be stripped.

[ Top ]


Class Constants

CSS_VALUE_FILE_NAME =  'cssValues.xml'

[line 65]

The name of the XML resource file that contains all CSS values.


[ Top ]



Documentation generated on Tue, 10 Jan 2006 17:06:26 +0100 by phpDocumentor 1.3.0RC4