/** * Finds all properties within a css string * * @author Anthony Short * @param $property string * @param $css string */ public function find_property($property) { if (preg_match_all('/(' . Scaffold_Utils::preg_quote($property) . ')\\s*\\:\\s*(.*?)\\s*\\;/sx', $this->string, $matches)) { return (array) $matches; } else { return array(); } }
function testPregQuote() { $string = "#selector-name.class {background: url(_images/blah.png); }"; $string = Scaffold_Utils::preg_quote($string); $this->assertEqual($string, '\\#selector\\-name\\.class\\s*\\{background\\:\\s*url\\(_images\\/blah\\.png\\);\\s*\\}'); }