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

Class: HTML_CSS

Source Location: /HTML_CSS-1.4.0/CSS.php

Class Overview

HTML_Common
   |
   --HTML_CSS

Base class for CSS definitions


Author(s):

Version:

  • Release: 1.4.0

Copyright:

  • 2003-2007 Klaus Guenther, Laurent Laville

Methods


Inherited Variables

Inherited Methods


Class Details

[line 81]
Base class for CSS definitions

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



[ Top ]


Method Detail

HTML_CSS (Constructor)   [line 271]

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

Class constructor (ZE1)
  • 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 ]

__construct (Constructor)   [line 297]

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

Class constructor (ZE2)
  • Since: 1.4.0
  • Access: protected

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 817]

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 332]

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 565]

string collapseInternalSpaces( string $subject)

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

Parameters:

string   $subject   —  string to format

[ Top ]

createGroup   [line 609]

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 1698]

void display( )

Outputs the stylesheet to the browser.

[ Top ]

getCache   [line 1184]

boolean getCache( )

Returns the cache option value

[ Top ]

getCharset   [line 1277]

string getCharset( )

Returns the charset encoding string

[ Top ]

getContentDisposition   [line 1240]

mixed getContentDisposition( )

Returns the Content-Disposition header ability (inline filename)

[ Top ]

getGroupStyle   [line 763]

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 966]

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 1035]

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 1840]

boolean isError( )

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

[ Top ]

parseData   [line 1458]

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 1417]

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 463]

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 1295]

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 1825]

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 853]

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 1164]

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) flag to true to cache result, false otherwise

[ Top ]

setCharset   [line 1257]

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 ]

setContentDisposition   [line 1204]

void|PEAR_Error setContentDisposition( [bool $enable = true], [string $filename = ''])

Defines the Content-Disposition filename for the browser output.

Defaults to basename($_SERVER['PHP_SELF']).'.css'


Parameters:

bool   $enable   —  (optional)
string   $filename   —  (optional)

[ Top ]

setGroupStyle   [line 699]

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 ]

setLineEnd   [line 397]

void setLineEnd( string $style)

Sets the line end style to Windows, Mac, Unix or a custom string.
  • Since: 1.4.0
  • Access: public

Parameters:

string   $style   —  "win", "mac", "unix" or custom string.

[ Top ]

setOutputGroupsFirst   [line 436]

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   —  flag to true if groups are output before elements, false otherwise

[ Top ]

setSameStyle   [line 1113]

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   $new   —  New selector(s) that should share the same definitions, separated by commas
string   $old   —  Selector that is already defined

[ Top ]

setSingleLineOutput   [line 413]

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   —  flag to true if single line, false for multiline

[ Top ]

setStyle   [line 899]

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 ]

setTab   [line 382]

void setTab( string $string)

Sets the string used to indent HTML
  • Since: 1.4.0
  • Access: public

Parameters:

string   $string   —  String used to indent ("\11", "\t", ' ', etc.).

[ Top ]

setXhtmlCompliance   [line 582]

void|PEAR_Error setXhtmlCompliance( bool $value)

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

Parameters:

bool   $value   —  flag to true if XHTML compliance needed, false otherwise

[ Top ]

toArray   [line 1498]

array toArray( )

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

[ Top ]

toFile   [line 1580]

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 1522]

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 1610]

string toString( )

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

[ Top ]

unsetGroup   [line 652]

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 ]

__get   [line 363]

mixed __get( string $option)

Gets options for the class.
  • Since: 1.4.0
  • Access: public

Parameters:

string   $option   —  Name of option to set

[ Top ]

__set   [line 347]

void __set( string $option, string $val)

Sets options for the class.
  • Since: 1.4.0
  • Access: public

Parameters:

string   $option   —  Name of option to set
string   $val   —  Value of option to set

[ Top ]


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