Packages:
lithron
csstidy


Classes:

Class csstidy


CSS Parser class

This class represents a CSS parser which reads CSS code and saves it in an array. In opposite to most other CSS parsers, it does not use regular expressions and thus has full CSS2 support and a higher reliability. Additional to that it applies some optimisations and fixes to the CSS code. An online version should be available here: http://cdburnerxp.se/cssparse/css_optimiser.php

Author: Florian Schmitz (floele at gmail dot com) 2005-2006

Method Summary
bool
escaped ( &$string, integer $pos, string $string)
Checks if a character is escaped (and returns true if it is)
mixed
get_cfg ( string $setting)
Get the value of a setting.
string
gvw_important ( string $value)
Returns a value without !important
bool
is_important ( &$value, string $value)
Checks if $value is !important.
void
is_token ( &$string, integer $i, string $string)
Checks if there is a token at the current position
void
load_template ( string $content, bool $from_file)
Loads a new template
bool
parse ( string $string)
Parses CSS in $string. The code is saved as array in $this->css
void
parse_from_url ( string $url)
Starts parsing from URL
bool;
property_is_valid ( string $property)
Checks if a property is valid
bool
set_cfg ( string $setting, mixed $value)
Set the value of a setting.

Method Details

escaped

public bool escaped ( &$string , integer $pos , string $string )

Checks if a character is escaped (and returns true if it is)

Input
&$string
integer$pos
string$string
Output
Exception

get_cfg

public mixed get_cfg (string $setting )

Get the value of a setting.

Input
string$setting
Output
Exception

gvw_important

public string gvw_important (string $value )

Returns a value without !important

Input
string$value
Output
Exception

is_important

public bool is_important ( &$value , string $value )

Checks if $value is !important.

Input
&$value
string$value
Output
Exception

is_token

public void is_token ( &$string , integer $i , string $string )

Checks if there is a token at the current position

Input
&$string
integer$i
string$string
Output
Exception

load_template

public void load_template (string $content , bool $from_file )

Loads a new template

Input
string$contenteither filename (if $from_file == true), content of a template file, "high_compression", "highest_compression", "low_compression", or "default"
bool$from_fileuses $content as filename if true
Output
Exception

parse

public bool parse (string $string )

Parses CSS in $string. The code is saved as array in $this->css

Input
string$stringthe CSS code
Output
Exception

parse_from_url

public void parse_from_url (string $url )

Starts parsing from URL

Input
string$url
Output
Exception

property_is_valid

public bool; property_is_valid (string $property )

Checks if a property is valid

Input
string$property
Output
Exception

set_cfg

public bool set_cfg (string $setting , mixed $value )

Set the value of a setting.

Input
string$setting
mixed$value
Output
Exception