HTML_CSS
[ class tree: HTML_CSS ] [ index: HTML_CSS ] [ all elements ]

Class: HTML_CSS

Source Location: /HTML_CSS-1.2.0/CSS.php

Class Overview

HTML_Common
   |
   --HTML_CSS

Base class for CSS definitions


Author(s):

Version:

  • Release: 1.2.0

Copyright:

  • 2003-2007 Klaus Guenther, Laurent Laville

Methods


Inherited Variables

Inherited Methods


Class Details

[line 79]
Base class for CSS definitions

This class handles the details for creating properly constructed CSS declarations.



[ Top ]


Method Detail

HTML_CSS (Constructor)   [line 272]

HTML_CSS HTML_CSS( [array $attributes = array()], [array $errorPrefs = array()])

Class constructor
  • Since: 0.2.0
  • Access: public

Parameters:

array   $attributes   —  (optional) Pass options to the constructor. Valid options are :
  • xhtml (sets xhtml compliance),
  • tab (sets indent string),
  • filename (name of file to be parsed),
  • cache (determines whether the nocache headers are sent),
  • oneline (whether to output each definition on one line),
  • groupsfirst (determines whether to output groups before elements)
  • allowduplicates (allow to have duplicate rules in selector)
array   $errorPrefs   —  (optional) has to configure error handler

[ Top ]

addGroupSelector   [line 730]

void|PEAR_Error addGroupSelector( mixed $group, string $selectors)

Adds a selector to a CSS definition group.
  • Since: 0.3.0
  • Throws: HTML_CSS_ERROR_NO_GROUP, HTML_CSS_ERROR_INVALID_INPUT
  • Access: public

Parameters:

mixed   $group   —  CSS definition group identifier
string   $selectors   —  Selector(s) to be defined, comma delimited.

[ Top ]

apiVersion   [line 316]

string apiVersion( )

Returns the current API version Since 1.0.0 a string is returned rather than a float (for previous versions).
  • Return: compatible with php.version_compare()
  • Since: 0.2.0
  • Access: public

[ Top ]

collapseInternalSpaces   [line 481]

string collapseInternalSpaces( string $subject)

Strips excess spaces in string.
  • Since: 0.3.2
  • Access: protected

Parameters:

string   $subject   —  string to format

[ Top ]

createGroup   [line 522]

mixed|PEAR_Error createGroup( string $selectors, [mixed $group = null])

Creates a new CSS definition group. Returns an integer identifying the group.
  • See: HTML_CSS::unsetGroup()
  • Throws: HTML_CSS_ERROR_INVALID_INPUT, HTML_CSS_ERROR_INVALID_GROUP
  • Since: 0.3.0
  • Access: public

Parameters:

string   $selectors   —  Selector(s) to be defined, comma delimited.
mixed   $group   —  (optional) Group identifier. If not passed, will return an automatically assigned integer.

[ Top ]

display   [line 1510]

void display( )

Outputs the stylesheet to the browser.

[ Top ]

getCharset   [line 1119]

string getCharset( )

Returns the charset encoding string

[ Top ]

getGroupStyle   [line 676]

mixed|PEAR_Error getGroupStyle( mixed $group, string $property)

Returns a CSS definition for a CSS definition group
  • See: HTML_CSS::setGroupStyle()
  • Throws: HTML_CSS_ERROR_INVALID_INPUT, HTML_CSS_ERROR_NO_GROUP, HTML_CSS_ERROR_NO_ELEMENT
  • Since: 0.3.0
  • Access: public

Parameters:

mixed   $group   —  CSS definition group identifier
string   $property   —  Property defined

[ Top ]

getStyle   [line 879]

mixed|PEAR_Error getStyle( string $element, string $property)

Retrieves the value of a CSS property
  • See: HTML_CSS::setStyle()
  • Throws: HTML_CSS_ERROR_INVALID_INPUT, HTML_CSS_ERROR_NO_ELEMENT, HTML_CSS_ERROR_NO_ELEMENT_PROPERTY
  • Since: 0.3.0
  • Access: public

Parameters:

string   $element   —  Element (or class) to be defined
string   $property   —  Property defined

[ Top ]

grepStyle   [line 946]

array|PEAR_Error grepStyle( string $elmPattern, [string $proPattern = null])

Return array entries of styles that match patterns (Perl compatible)

Parameters:

string   $elmPattern   —  Element or class pattern to retrieve
string   $proPattern   —  (optional) Property pattern to retrieve

[ Top ]

isError   [line 1630]

boolean isError( )

Determine whether there is an error
  • Return: TRUE if error raised, FALSE otherwise
  • Since: 1.0.0RC2
  • Access: public

[ Top ]

parseData   [line 1273]

void|PEAR_Error parseData( array $styles, [bool $duplicates = null])

Parse data sources, file(s) or string(s), that contains CSS information

Parameters:

array   $styles   —  data sources to parse
bool   $duplicates   —  (optional) Allow or disallow duplicates.

[ Top ]

parseFile   [line 1227]

void|PEAR_Error parseFile( string $filename, [bool $duplicates = null])

Parse a file that contains CSS information
  • See: HTML_CSS::parseString()
  • Throws: HTML_CSS_ERROR_INVALID_INPUT, HTML_CSS_ERROR_NO_FILE
  • Since: 0.3.0
  • Access: public

Parameters:

string   $filename   —  file to parse
bool   $duplicates   —  (optional) Allow or disallow duplicates.

[ Top ]

parseSelectors   [line 379]

mixed|PEAR_Error parseSelectors( string $selectors, [int $outputMode = 0])

Parses a string containing selector(s).

It processes it and returns an array or string containing modified selectors (depends on XHTML compliance setting; defaults to ensure lowercase element names)

  • Since: 0.3.2
  • Throws: HTML_CSS_ERROR_INVALID_INPUT
  • Access: protected

Parameters:

string   $selectors   —  Selector string
int   $outputMode   —  (optional) 0 = string; 1 = array; 2 = deep array

[ Top ]

parseString   [line 1136]

void|PEAR_Error parseString( string $str, [bool $duplicates = null])

Parse a textstring that contains css information

Parameters:

string   $str   —  text string to parse
bool   $duplicates   —  (optional) Allows or disallows duplicate style definitions

[ Top ]

raiseError   [line 1616]

object PEAR_Error raiseError( )

A basic wrapper around the default PEAR_Error object
  • Return: when default error handler is used
  • See: _errorHandler()
  • Since: 0.3.3
  • Access: public

[ Top ]

removeGroupSelector   [line 766]

void|PEAR_Error removeGroupSelector( mixed $group, string $selectors)

Removes a selector from a group.
  • Since: 0.3.0
  • Throws: HTML_CSS_ERROR_NO_GROUP, HTML_CSS_ERROR_INVALID_INPUT
  • Access: public

Parameters:

mixed   $group   —  CSS definition group identifier
string   $selectors   —  Selector(s) to be removed, comma delimited.

[ Top ]

setCache   [line 1073]

void|PEAR_Error setCache( [bool $cache = true])

Defines if the document should be cached by the browser. Defaults to false.
  • Since: 0.2.0
  • Throws: HTML_CSS_ERROR_INVALID_INPUT
  • Access: public

Parameters:

bool   $cache   —  (optional)

[ Top ]

setCharset   [line 1098]

void|PEAR_Error setCharset( [string $type = 'iso-8859-1'])

Defines the charset for the file. defaults to ISO-8859-1 because of CSS1 compatability issue for older browsers.

Parameters:

string   $type   —  (optional) Charset encoding; defaults to ISO-8859-1.

[ Top ]

setGroupStyle   [line 612]

void|int|PEAR_Error setGroupStyle( mixed $group, string $property, string $value, [bool $duplicates = null])

Sets or adds a CSS definition for a CSS definition group
  • Return: Returns an integer if duplicates are allowed.
  • See: HTML_CSS::getGroupStyle()
  • Throws: HTML_CSS_ERROR_INVALID_INPUT, HTML_CSS_ERROR_NO_GROUP
  • Since: 0.3.0
  • Access: public

Parameters:

mixed   $group   —  CSS definition group identifier
string   $property   —  Property defined
string   $value   —  Value assigned
bool   $duplicates   —  (optional) Allow or disallow duplicates.

[ Top ]

setOutputGroupsFirst   [line 353]

void|PEAR_Error setOutputGroupsFirst( bool $value)

Determines whether groups are output before elements or not
  • Since: 0.3.3
  • Throws: HTML_CSS_ERROR_INVALID_INPUT
  • Access: public

Parameters:

bool   $value   — 

[ Top ]

setSameStyle   [line 1022]

void|PEAR_Error setSameStyle( string $new, string $old)

Sets or changes the properties of new selectors to the values of an existing selector
  • Since: 0.2.0
  • Throws: HTML_CSS_ERROR_INVALID_INPUT, HTML_CSS_ERROR_NO_ELEMENT
  • Access: public

Parameters:

string   $old   —  Selector that is already defined
string   $new   —  New selector(s) that should share the same definitions, separated by commas

[ Top ]

setSingleLineOutput   [line 331]

void|PEAR_Error setSingleLineOutput( bool $value)

Determines whether definitions are output single line or multiline
  • Since: 0.3.3
  • Throws: HTML_CSS_ERROR_INVALID_INPUT
  • Access: public

Parameters:

bool   $value   — 

[ Top ]

setStyle   [line 812]

void|PEAR_Error setStyle( string $element, string $property, string $value, [bool $duplicates = null])

Sets or adds a CSS definition

Parameters:

string   $element   —  Element (or class) to be defined
string   $property   —  Property defined
string   $value   —  Value assigned
bool   $duplicates   —  (optional) Allow or disallow duplicates.

[ Top ]

setXhtmlCompliance   [line 497]

void|PEAR_Error setXhtmlCompliance( bool $value)

Sets XHTML compliance
  • Since: 0.3.2
  • Throws: HTML_CSS_ERROR_INVALID_INPUT
  • Access: public

Parameters:

bool   $value   —  Boolean value

[ Top ]

toArray   [line 1313]

array toArray( )

Returns the array of CSS properties
  • Since: 0.2.0
  • Access: public

[ Top ]

toFile   [line 1393]

void|PEAR_Error toFile( string $filename)

Generates CSS and stores it in a file.
  • See: HTML_CSS::toString()
  • Throws: HTML_CSS_ERROR_INVALID_INPUT, HTML_CSS_ERROR_WRITE_FILE
  • Since: 0.3.0
  • Access: public

Parameters:

string   $filename   —  Name of file that content the stylesheet

[ Top ]

toInline   [line 1335]

string|PEAR_Error toInline( string $element)

Generates and returns the CSS properties of an element or class as a string for inline use.
  • Since: 0.2.0
  • Throws: HTML_CSS_ERROR_INVALID_INPUT
  • Access: public

Parameters:

string   $element   —  Element or class for which inline CSS should be generated

[ Top ]

toString   [line 1423]

string toString( )

Generates and returns the complete CSS as a string.
  • Since: 0.2.0
  • Access: public

[ Top ]

unsetGroup   [line 565]

void|PEAR_Error unsetGroup( mixed $group)

Sets or adds a CSS definition for a CSS definition group
  • See: HTML_CSS::createGroup()
  • Throws: HTML_CSS_ERROR_INVALID_INPUT, HTML_CSS_ERROR_NO_GROUP
  • Since: 0.3.0
  • Access: public

Parameters:

mixed   $group   —  CSS definition group identifier

[ Top ]


Documentation generated on Mon, 11 Mar 2019 15:03:15 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright Š PHP Group 2004.