Commit c4c9d2a5 authored by Steven Wittens's avatar Steven Wittens
Browse files

#108363: Faster tag parsing (preg_match to strpos).

parent dea04b3d
......@@ -685,8 +685,8 @@ function taxonomy_form_alter($form_id, &$form) {
if ($term->vid == $vocabulary->vid) {
// Commas and quotes in terms are special cases, so encode 'em.
if (preg_match('/,/', $term->name) || preg_match('/"/', $term->name)) {
$term->name = '"'.preg_replace('/"/', '""', $term->name).'"';
if (strpos($term->name, ',') !== FALSE || strpos($term->name, '"') !== FALSE) {
$term->name = '"'.str_replace('"', '""', $term->name).'"';
}
$typed_terms[] = $term->name;
......@@ -1480,8 +1480,8 @@ function taxonomy_autocomplete($vid, $string = '') {
while ($tag = db_fetch_object($result)) {
$n = $tag->name;
// Commas and quotes in terms are special cases, so encode 'em.
if (preg_match('/,/', $tag->name) || preg_match('/"/', $tag->name)) {
$n = '"'. preg_replace('/"/', '""', $tag->name) .'"';
if (strpos($tag->name, ',') !== FALSE || strpos($tag->name, '"') !== FALSE) {
$n = '"'. str_replace('"', '""', $tag->name) .'"';
}
$matches[$prefix . $n] = check_plain($tag->name);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment