1
0
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:
Edward Z. Yang
2008-02-10 01:33:40 +00:00
parent d00cb1e64d
commit 3d56c1253b
2 changed files with 24 additions and 3 deletions

View File

@@ -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);
}
}