diff options
author | Steven Wittens <steven@10.no-reply.drupal.org> | 2007-01-11 03:29:15 +0000 |
---|---|---|
committer | Steven Wittens <steven@10.no-reply.drupal.org> | 2007-01-11 03:29:15 +0000 |
commit | c4c9d2a5d5b433f1e6f46e290487bb5685bdb560 (patch) | |
tree | 0fb587e6c548e1def29d1a233e7eaff529e80e8f | |
parent | dea04b3d19f3f2a25a5b1fb8c78aec5f315e5b1c (diff) | |
download | brdo-c4c9d2a5d5b433f1e6f46e290487bb5685bdb560.tar.gz brdo-c4c9d2a5d5b433f1e6f46e290487bb5685bdb560.tar.bz2 |
#108363: Faster tag parsing (preg_match to strpos).
-rw-r--r-- | modules/taxonomy/taxonomy.module | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/taxonomy/taxonomy.module b/modules/taxonomy/taxonomy.module index 45876d794..1d713145e 100644 --- a/modules/taxonomy/taxonomy.module +++ b/modules/taxonomy/taxonomy.module @@ -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); } |