function detect_border_value_type($value) { $color = _parse_color_declaration($value, $success); if ($success) { return BORDER_VALUE_COLOR; } // if (preg_match("/\b(transparent|black|silver|gray|white|maroon|red|purple|fuchsia|green|lime|olive|yellow|navy|blue|teal|aqua|rgb(.*?))\b/i",$value)) { return BORDER_VALUE_COLOR; }; // // We must detect hecadecimal values separately, as #-sign will not match the \b metacharacter at the beginning of previous regexp // if (preg_match("/#([[:xdigit:]]{3}|[[:xdigit:]]{6})\b/i",$value)) { return BORDER_VALUE_COLOR; }; // Note that unit name is in general not required, so that we can meet rule like "border: 0" in CSS! if (preg_match("/\\b(thin|medium|thick|[+-]?\\d+(.\\d*)?(em|ex|px|in|cm|mm|pt|pc)?)\\b/i", $value)) { return BORDER_VALUE_WIDTH; } if (preg_match("/\\b(none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset)\\b/", $value)) { return BORDER_VALUE_STYLE; } return; }
function &parse_color_declaration($decl) { $color = _parse_color_declaration($decl, $success); $color_obj =& new Color($color, is_transparent($color)); return $color_obj; }