JavaScript Editor Javascript validator     Web page editor 


API -- Application Programming Interface

Initialize parser/writer options

With the class constructor, you have ability to set many options :

Tip: HTML_CSS 1.4.0+ users may now set a single option directly like that:
require_once 'HTML/CSS.php';

$css = new HTML_CSS();

// with PHP5 only
$css->allowduplicates = true;

// with PHP4 use
$css->__set('allowduplicates', true);

Handle selector and property values

Read and write single selector or even descendant selector is made easy with : HTML_CSS::getStyle() and HTML_CSS::setStyle()

Grouping selectors

The most advanced/complex functions are those which handle group of selectors HTML_CSS::createGroup() , HTML_CSS::unsetGroup() , HTML_CSS::getGroupStyle() , HTML_CSS::setGroupStyle() , HTML_CSS::addGroupSelector() , HTML_CSS::removeGroupSelector() , HTML_CSS::setSameStyle()

Parsing data sources

Handle data sources are so easy than just one call of these three methods : HTML_CSS::parseString() , HTML_CSS::parseFile() , and HTML_CSS::parseData()

Checking data sources

Check validity of data source is now possible if you run HTML_CSS with PHP5. Use this function : HTML_CSS::validate()


Send result directly to browser, send it to file or capture to a PHP variable, you will certainly use one of them. HTML_CSS::toArray() , HTML_CSS::toInline() , HTML_CSS::toFile() , HTML_CSS::toString() , HTML_CSS::display() , HTML_CSS::getContentDisposition() , and HTML_CSS::setContentDisposition()

Searching for selectors and/or properties

Ability to find if a selector or a property (with perl-compatible pattern) is already defined with HTML_CSS::grepStyle()

Important: This function is available since version 1.1.0

Handle At-Rules

List of at-rules supported can be obtained by call to function HTML_CSS::getAtRulesList()

Important: All these related at-rules functions are available since version 1.5.0

Distinguish simple declarative at-rules (without declaration style blocks) : @charset, @import, @namespace, handled by : HTML_CSS::createAtRule() and HTML_CSS::unsetAtRule()

And conditional/informative at-rules (with declaration style blocks) : @media, @page, @font-face, handled by : HTML_CSS::getAtRuleStyle() and HTML_CSS::setAtRuleStyle()

JavaScript Editor Javascript validator     Web page editor