use wcf\data\user\group\UserGroup;
use wcf\system\importer\ImportHandler;
use wcf\system\request\LinkHandler;
-use wcf\system\Callback;
use wcf\system\Regex;
use wcf\util\FileUtil;
use wcf\util\PasswordUtil;
if ($quoteRegex === null) {
$quoteRegex = new Regex('\[quote="(.*?)" post=(\d+)\]', Regex::CASE_INSENSITIVE);
- $quoteCallback = new Callback(function ($matches) {
+ $quoteCallback = function ($matches) {
$username = str_replace(["\\", "'"], ["\\\\", "\'"], $matches[1]);
$postID = $matches[2];
$postLink = str_replace(["\\", "'"], ["\\\\", "\'"], $postLink);
return "[quote='".$username."','".$postLink."']";
- });
+ };
}
// use proper WCF 2 bbcode
use wcf\system\database\DatabaseException;
use wcf\system\importer\ImportHandler;
use wcf\system\request\LinkHandler;
-use wcf\system\Callback;
use wcf\system\Regex;
use wcf\system\WCF;
use wcf\util\ArrayUtil;
if ($videoRegex === null) {
$videoRegex = new Regex('\[video=[a-z]+\]');
$quoteRegex = new Regex('\[quote=\'(.*?)\' pid=\'(\d+)\' dateline=\'\d+\'\]');
- $quoteCallback = new Callback(function ($matches) {
+ $quoteCallback = function ($matches) {
$username = str_replace(["\\", "'"], ["\\\\", "\'"], $matches[1]);
$postID = $matches[2];
$postLink = str_replace(["\\", "'"], ["\\\\", "\'"], $postLink);
return "[quote='".$username."','".$postLink."']";
- });
+ };
$imgRegex = new Regex('\[img(?:=(\d)x\d)?(?: align=(left|right))?\](?:\r\n?|\n?)(https?://(?:[^<>"\']+?))\[/img\]');
- $imgCallback = new Callback(function ($matches) {
+ $imgCallback = function ($matches) {
$escapedLink = str_replace(["\\", "'"], ["\\\\", "\'"], $matches[3]);
if ($matches[1] && $matches[2]) {
return "[img='".$escapedLink."',".$matches[2].",".$matches[1]."][/img]";
else {
return "[img]".$matches[3]."[/img]";
}
- });
+ };
$attachmentRegex = new Regex('\[attachment=([0-9]+)\]');
}
use wcf\system\database\DatabaseException;
use wcf\system\importer\ImportHandler;
use wcf\system\request\LinkHandler;
-use wcf\system\Callback;
use wcf\system\Regex;
use wcf\system\WCF;
use wcf\util\ArrayUtil;
if ($sizeRegex === null) {
$quoteRegex = new Regex('\[quote author=(.*?) link=topic=\d+\.msg(\d+)#msg\\2 date=\d+\]');
- $quoteCallback = new Callback(function ($matches) {
+ $quoteCallback = function ($matches) {
$username = str_replace(["\\", "'"], ["\\\\", "\'"], $matches[1]);
$postID = $matches[2];
$postLink = str_replace(["\\", "'"], ["\\\\", "\'"], $postLink);
return "[quote='".$username."','".$postLink."']";
- });
+ };
$sizeRegex = new Regex('\[size=(8|10|12|14|18|24|34)pt\]');
}
use wcf\system\database\DatabaseException;
use wcf\system\importer\ImportHandler;
use wcf\system\request\LinkHandler;
-use wcf\system\Callback;
use wcf\system\Regex;
use wcf\system\WCF;
use wcf\util\ArrayUtil;
if ($quoteRegex === null) {
$quoteRegex = new Regex('\[quote=(.*?);(\d+)\]', Regex::CASE_INSENSITIVE);
- $quoteCallback = new Callback(function ($matches) {
+ $quoteCallback = function ($matches) {
$username = str_replace(["\\", "'"], ["\\\\", "\'"], $matches[1]);
$postID = $matches[2];
$postLink = str_replace(["\\", "'"], ["\\\\", "\'"], $postLink);
return "[quote='".$username."','".$postLink."']";
- });
+ };
$mediaRegex = new Regex('\[video=([a-z]+);([a-z0-9-_]+)\]', Regex::CASE_INSENSITIVE);
}
use wcf\system\database\DatabaseException;
use wcf\system\importer\ImportHandler;
use wcf\system\request\LinkHandler;
-use wcf\system\Callback;
use wcf\system\Regex;
use wcf\system\WCF;
use wcf\util\FileUtil;
if ($quoteRegex === null) {
$quoteRegex = new Regex('\[quote=(.*?);n(\d+)\]', Regex::CASE_INSENSITIVE);
- $quoteCallback = new Callback(function ($matches) {
+ $quoteCallback = function ($matches) {
$username = str_replace(["\\", "'"], ["\\\\", "\'"], $matches[1]);
$postID = $matches[2];
$postLink = str_replace(["\\", "'"], ["\\\\", "\'"], $postLink);
return "[quote='".$username."','".$postLink."']";
- });
+ };
$imgRegex = new Regex('\[img width=(\d+) height=\d+\](.*?)\[/img\]');
$mediaRegex = new Regex('\[video=([a-z]+);([a-z0-9-_]+)\]', Regex::CASE_INSENSITIVE);
use wcf\system\exception\SystemException;
use wcf\system\importer\ImportHandler;
use wcf\system\request\LinkHandler;
-use wcf\system\Callback;
use wcf\system\Regex;
use wcf\system\WCF;
use wcf\util\FileUtil;
if ($mediaRegex === null) {
$mediaRegex = new Regex('\[media=(youtube|vimeo|dailymotion)\]([a-zA-Z0-9_-]+)', Regex::CASE_INSENSITIVE);
- $mediaCallback = new Callback(function ($matches) {
+ $mediaCallback = function ($matches) {
switch ($matches[1]) {
case 'youtube':
$url = 'https://www.youtube.com/watch?v='.$matches[2];
}
return '[media]'.$url;
- });
+ };
$userRegex = new Regex('\[user=(\d+)\](.*?)\[/user\]', Regex::CASE_INSENSITIVE);
- $userCallback = new Callback(function ($matches) {
+ $userCallback = function ($matches) {
$userLink = LinkHandler::getInstance()->getLink('User', [
'userID' => $matches[1],
'forceFrontend' => true
$userLink = str_replace(["\\", "'"], ["\\\\", "\'"], $userLink);
return "[url='".$userLink."']".$matches[2]."[/url]";
- });
+ };
$quoteRegex = new Regex('\[quote=("?)(?P<username>[^,\]\n]*)(?:, post: (?P<postID>\d+)(?:, member: \d+)?)?\1\]', Regex::CASE_INSENSITIVE);
- $quoteCallback = new Callback(function ($matches) {
+ $quoteCallback = function ($matches) {
if (isset($matches['username']) && $matches['username']) {
$username = str_replace(["\\", "'"], ["\\\\", "\'"], $matches['username']);
return "[quote='".$username."']";
}
return "[quote]";
- });
+ };
}
$message = $mediaRegex->replace($message, $mediaCallback);