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 import_declaration($declaration) { $syntax_property = $declaration->get_property(); $code = CSS::name2code($syntax_property->get_name()); if (is_null($code)) { return null; } $handler = CSS::get_handler($code); $property = new CSSPropertyDeclaration(); $property->set_code($code); $expr = $declaration->get_expr(); $property->set_value($handler->parse($expr->to_string(), $this->get_pipeline(), $expr)); $property->set_important($declaration->get_important()); return $property; }
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); }