function &parse_css_properties($string, &$pipeline) { $property_collection =& new CSSPropertyCollection(); while ($string != '') { $string = parse_css_properties_property($string, $code); if (preg_match('/^\\s*:\\s*(.*?)$/si', $string, $matches)) { $string = $matches[1]; } $string = parse_css_properties_value($string, $value); if (preg_match('/^\\s*;\\s*(.*)$/si', $string, $matches)) { $string = $matches[1]; } $property =& CSSPropertyDeclaration::create($code, $value, $pipeline); if (!is_null($property)) { $property_collection->add_property($property); } } return $property_collection; }
function attr_body_link_before(&$root, &$pipeline) { $color = $root->get_attribute('link'); // -1000 means priority modifier; so, any real CSS rule will have more priority than // this fake rule $collection = new CSSPropertyCollection(); $collection->add_property(CSSPropertyDeclaration::create(CSS_COLOR, $color, $pipeline)); $rule = new CSSRule(array(SELECTOR_SEQUENCE, array(array(SELECTOR_TAG, 'a'), array(SELECTOR_PSEUDOCLASS_LINK_LOW_PRIORITY))), $collection, '', -1000); $css =& $pipeline->get_current_css(); $css->add_rule($rule, $pipeline); }