- if (strpos($tag, '#') === 0) {
- if (strpos($tag, '[url=')) {
- continue;
- }
-
- // don't link tags that are already embedded in links
- if (preg_match('/\[(.*?)' . preg_quote($tag, '/') . '(.*?)\]/', $body)) {
- continue;
- }
- if (preg_match('/\[(.*?)\]\((.*?)' . preg_quote($tag, '/') . '(.*?)\)/', $body)) {
- continue;
- }
-
- $basetag = str_replace('_', ' ', substr($tag, 1));
- $url = '#[url=' . $a->get_baseurl() . '/search?tag=' . rawurlencode($basetag) . ']' . $basetag . '[/url]';
- $body = str_replace($tag, $url, $body);
- $tags_arr["#" . $basetag] = $url;
- } elseif (strpos($tag, '@') === 0) {
- if (strpos($tag, '[url=')) {
- continue;
- }
+ // don't link tags that are already embedded in links
+ if (preg_match('/\[(.*?)' . preg_quote($tag, '/') . '(.*?)\]/', $body)) {
+ continue;
+ }
+ if (preg_match('/\[(.*?)\]\((.*?)' . preg_quote($tag, '/') . '(.*?)\)/', $body)) {
+ continue;
+ }