diff options
Diffstat (limited to 'include/text.php')
-rw-r--r-- | include/text.php | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/include/text.php b/include/text.php index 6ab8fc1ce..27dd94bc5 100644 --- a/include/text.php +++ b/include/text.php @@ -528,9 +528,8 @@ function unxmlify($s) { * will limit the results to the correct items for the current page. * The actual page handling is then accomplished at the application layer. * - * @param App &$a */ -function paginate(&$a) { +function paginate() { $o = ''; $stripped = preg_replace('/(&page=[0-9]*)/','',App::$query_string); @@ -895,6 +894,7 @@ function get_tags($s) { // ignore anything in [style= ] $s = preg_replace('/\[style=(.*?)\]/sm','',$s); + // ignore anything in [color= ], because it may contain color codes which are mistaken for tags $s = preg_replace('/\[color=(.*?)\]/sm','',$s); @@ -3062,7 +3062,10 @@ function handle_tag(&$body, &$str_tags, $profile_uid, $tag, $in_network = true) $bb_tag = (($xc['xchan_network'] === 'zot6') ? 'zrl' : 'url'); $newtag = '@' . (($exclusive) ? '!' : '') . '[' . $bb_tag . '=' . $profile . ']' . $newname . '[/' . $bb_tag . ']'; - $body = str_replace('@' . (($exclusive) ? '!' : '') . $name, $newtag, $body); + + // Replace tag but make sure to not replace something in the middle of a word + $body = preg_replace('/(?<![a-zA-Z0-9=\/])' . preg_quote($tag, '/') . '/', $newtag, $body); + // $body = str_replace('@' . (($exclusive) ? '!' : '') . $name, $newtag, $body); // append tag to str_tags if(! stristr($str_tags,$newtag)) { @@ -3105,7 +3108,9 @@ function handle_tag(&$body, &$str_tags, $profile_uid, $tag, $in_network = true) $channel = App::get_channel(); if($channel) { $newtag = '@' . (($exclusive) ? '!' : '') . '[zrl=' . z_root() . '/channel/' . $channel['channel_address'] . ']' . $newname . '[/zrl]'; - $body = str_replace('@' . (($exclusive) ? '!' : '') . $name, $newtag, $body); + // Replace tag but make sure to not replace something in the middle of a word + $body = preg_replace('/(?<![a-zA-Z0-9=\/])' . preg_quote($tag, '/') . '/', $newtag, $body); + // $body = str_replace('@' . (($exclusive) ? '!' : '') . $name, $newtag, $body); } } } @@ -3126,7 +3131,9 @@ function handle_tag(&$body, &$str_tags, $profile_uid, $tag, $in_network = true) */ if ($termtype === TERM_MENTION) { $newtag = '@' . (($exclusive) ? '!' : '') . '[zrl=' . $profile . ']' . $newname . '[/zrl]'; - $body = str_replace('@' . (($exclusive) ? '!' : '') . $name, $newtag, $body); + // Replace tag but make sure to not replace something in the middle of a word + $body = preg_replace('/(?<![a-zA-Z0-9=\/])' . preg_quote($tag, '/') . '/', $newtag, $body); + // $body = str_replace('@' . (($exclusive) ? '!' : '') . $name, $newtag, $body); } // append tag to str_tags |