From c48879ead5a083a0316892601d73d6ae84021d19 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Tue, 24 Feb 2015 22:03:08 +0100 Subject: [PATCH] Improved detection of mentions --- wcfsetup/install/files/lib/system/bbcode/PreParser.class.php | 4 ++-- .../system/event/listener/PreParserAtUserListener.class.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wcfsetup/install/files/lib/system/bbcode/PreParser.class.php b/wcfsetup/install/files/lib/system/bbcode/PreParser.class.php index e0794aa1b9..dec6cc6d3e 100644 --- a/wcfsetup/install/files/lib/system/bbcode/PreParser.class.php +++ b/wcfsetup/install/files/lib/system/bbcode/PreParser.class.php @@ -180,7 +180,7 @@ class PreParser extends SingletonFactory { (?:\[/\\2\])", Regex::DOT_ALL | Regex::IGNORE_WHITESPACE | Regex::CASE_INSENSITIVE); $callback = new Callback(function ($matches) { - return StringStack::pushToStringStack($matches[0], 'preParserCode'); + return '['.StringStack::pushToStringStack(mb_substr($matches[0], 1, -1), 'preParserCode', "\0\0\0").']'; }); } @@ -219,7 +219,7 @@ class PreParser extends SingletonFactory { (?:\[/\\1\])", Regex::DOT_ALL | Regex::IGNORE_WHITESPACE | Regex::CASE_INSENSITIVE); $callback = new Callback(function ($matches) { - return StringStack::pushToStringStack($matches[0], 'urlBBCodes'); + return '['.StringStack::pushToStringStack(mb_substr($matches[0], 1, -1), 'preParserCode', "\0\0\0").']'; }); } diff --git a/wcfsetup/install/files/lib/system/event/listener/PreParserAtUserListener.class.php b/wcfsetup/install/files/lib/system/event/listener/PreParserAtUserListener.class.php index ae795a1232..ae79a0a4b3 100644 --- a/wcfsetup/install/files/lib/system/event/listener/PreParserAtUserListener.class.php +++ b/wcfsetup/install/files/lib/system/event/listener/PreParserAtUserListener.class.php @@ -32,14 +32,14 @@ class PreParserAtUserListener implements IParameterizedEventListener { static $userRegex = null; if ($userRegex === null) { $userRegex = new Regex(" - (?<=^|\s) # either at start of string, or after whitespace + (?:^|(?<=\s|\])) # either at start of string, or after whitespace @ ( ([^',\s][^,\s]{2,})(?:\s[^,\s]+)? # either at most two strings, not containing # whitespace or the comma, not starting with a single quote # separated by a single whitespace character | - '(?:''|[^'])*' # or a string delimited by single quotes + '(?:''|[^']){3,}' # or a string delimited by single quotes ) ", Regex::IGNORE_WHITESPACE); } -- 2.20.1