mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-31 19:30:21 +02:00
Add version extraction functionality
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1536 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -112,7 +112,16 @@ class ConfigSchema_StringHashReverseAdapter
|
||||
}
|
||||
|
||||
public function extractVersion($description) {
|
||||
return array($description, false);
|
||||
$regex = '/This directive (?:has been|was) available since (\d+\.\d+\.\d+)\./';
|
||||
$regex = str_replace(' ', '\s+', $regex); // allow any number of spaces between statements
|
||||
$ok = preg_match($regex, $description, $matches);
|
||||
if ($ok) {
|
||||
$version = $matches[1];
|
||||
} else {
|
||||
$version = false;
|
||||
}
|
||||
$description = preg_replace($regex, '', $description, 1);
|
||||
return array($description, $version);
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user