Sitellite Application Framework
Class Tree         Index         All Elements

Class: CSS_Parser

Source Location: Program_Root/HTML/CSS_Parser.php

Class Overview

Parser
   |
   --CSS_Parser

Parses CSS data into 3-dimensional associative arrays. Properly handles multiple declaration blocks for the same element, but will only keep the final value of a property that is declared again, which should not be a problem for most cases. Also properly handles /* style comments.


Author(s)

Version

  • 1.0, 2003-01-18, $Id: Parser.php,v 1.2 2005/07/06 15:30:56 lux Exp $

Copyright

  • Copyright (C) 2001-2003, Simian Systems Inc.

Variables

Methods


Inherited Variables

Inherited Methods

Class: Parser

Parser::Parser()
Constructor method.
Parser::addInternal()
Alias of addToken().
Parser::addToken()
Defines a token whose callback function has the same name as
Parser::makeRegex()
Turns the $tokens list into a regular expression.
Parser::parse()
This is the mainloop of the parser.
Parser::_default()
This is the default token handler. It merely returns

Class Details

[line 31]
Parses CSS data into 3-dimensional associative arrays. Properly handles multiple declaration blocks for the same element, but will only keep the final value of a property that is declared again, which should not be a problem for most cases. Also properly handles /* style comments.

Example:


1 <?php
2
3 loader_import ('saf.HTML.CSS_Parser');
4
5 $css = new CSS_Parser ();
6
7 $css->parse ('a { text-decoration: none } div.content { line-height: 15px }');
8
9 info ($css->list['a']);
10
11 info ($css->getClasses ('div'));
12
13 ? >




Tags:

copyright:  Copyright (C) 2001-2003, Simian Systems Inc.
version:  1.0, 2003-01-18, $Id: Parser.php,v 1.2 2005/07/06 15:30:56 lux Exp $
author:  John Luxford <mailto:lux@simian.ca>


[ Top ]


Class Variables

$block =  false

[line 42]

Whether the parser is in a block or not.


Type:   mixed


[ Top ]

$comment =  false

[line 36]

Whether the parser is in a comment or not.


Type:   mixed


[ Top ]

$list = array ()

[line 49]

The structure created from the previous call to parse().



Tags:

access:  public

Type:   mixed


[ Top ]



Class Methods


constructor CSS_Parser [line 55]

CSS_Parser CSS_Parser( )

Constructor method.



[ Top ]

method getClasses [line 75]

array getClasses( [string $tag = false])

Returns an array of classes found in the CSS data. Optionally limits the classes to those that apply to the specified element.



Tags:

access:  public


Parameters:

string   $tag  

[ Top ]

method getIDs [line 105]

array getIDs( [string $tag = false])

Returns an array of IDs found in the CSS data. Optionally limits the IDs to those that apply to the specified element.



Tags:

access:  public


Parameters:

string   $tag  

[ Top ]

method getStyle [line 134]

array getStyle( string $tag)

Returns all of the stylesheet properties of the specified element.



Tags:

access:  public


Parameters:

string   $tag  

[ Top ]

method _block [line 185]

void _block( mixed $token, mixed $name)



[ Top ]

method _block_end [line 191]

void _block_end( mixed $token, mixed $name)



[ Top ]

method _comment [line 138]

void _comment( mixed $token, mixed $name)



[ Top ]

method _comment_end [line 142]

void _comment_end( mixed $token, mixed $name)



[ Top ]

method _default [line 146]

void _default( mixed $token, mixed $name)



Overrides Parser::_default() (This is the default token handler. It merely returns)

[ Top ]


Copyright © 2007, SIMIAN systems Inc.
All rights reserved. Privacy policy
Documentation generated on Tue, 13 Feb 2007 17:17:08 -0600 by Sitellite AppDoc and phpDocumentor 1.2.2