Stop using deprecated `Callback` class
authorMatthias Schmidt <gravatronics@live.com>
Sun, 20 Nov 2016 15:10:26 +0000 (16:10 +0100)
committerMatthias Schmidt <gravatronics@live.com>
Sun, 20 Nov 2016 15:10:26 +0000 (16:10 +0100)
files/lib/system/exporter/Kunena3xExporter.class.php
files/lib/system/exporter/MyBB16xExporter.class.php
files/lib/system/exporter/SMF2xExporter.class.php
files/lib/system/exporter/VB3or4xExporter.class.php
files/lib/system/exporter/VB5xExporter.class.php
files/lib/system/exporter/XF12xExporter.class.php

index cca1592d91e05464a5b136bca463cba82e370a71..b2f2032e7aadf1d59330651f3647aa3f8c65c3cf 100644 (file)
@@ -3,7 +3,6 @@ namespace wcf\system\exporter;
 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;
@@ -500,7 +499,7 @@ class Kunena3xExporter extends AbstractExporter {
                
                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];
                                
@@ -512,7 +511,7 @@ class Kunena3xExporter extends AbstractExporter {
                                $postLink = str_replace(["\\", "'"], ["\\\\", "\'"], $postLink);
                                
                                return "[quote='".$username."','".$postLink."']";
-                       });
+                       };
                }
                
                // use proper WCF 2 bbcode
index d11ae7f294196bc7803c4d8f0ec104be0c0065c9..4b949da3fe5fdcf95279468791e2b2fd65d0dffd 100644 (file)
@@ -11,7 +11,6 @@ use wcf\system\database\util\PreparedStatementConditionBuilder;
 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;
@@ -1304,7 +1303,7 @@ class MyBB16xExporter extends AbstractExporter {
                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];
                                
@@ -1316,9 +1315,9 @@ class MyBB16xExporter extends AbstractExporter {
                                $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]";
@@ -1332,7 +1331,7 @@ class MyBB16xExporter extends AbstractExporter {
                                else {
                                        return "[img]".$matches[3]."[/img]";
                                }
-                       });
+                       };
                        
                        $attachmentRegex = new Regex('\[attachment=([0-9]+)\]');
                }
index 1f0c4cb11e8737b76d153e60ef58ac823c6f4ce1..4b02853cdd0fb5677c775ebd96dd66ec274ae117 100644 (file)
@@ -7,7 +7,6 @@ use wcf\system\database\util\PreparedStatementConditionBuilder;
 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;
@@ -1373,7 +1372,7 @@ class SMF2xExporter extends AbstractExporter {
                
                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];
                                
@@ -1385,7 +1384,7 @@ class SMF2xExporter extends AbstractExporter {
                                $postLink = str_replace(["\\", "'"], ["\\\\", "\'"], $postLink);
                                
                                return "[quote='".$username."','".$postLink."']";
-                       });
+                       };
                        
                        $sizeRegex = new Regex('\[size=(8|10|12|14|18|24|34)pt\]');
                }
index 46592c399cfb0149dbf4f7b914a9a4b2fc50d4d1..0a2021b5a6fc28e886b4c2513d6bec122d4879f2 100644 (file)
@@ -9,7 +9,6 @@ use wcf\data\user\option\UserOption;
 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;
@@ -1972,7 +1971,7 @@ class VB3or4xExporter extends AbstractExporter {
                
                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];
                                
@@ -1984,7 +1983,7 @@ class VB3or4xExporter extends AbstractExporter {
                                $postLink = str_replace(["\\", "'"], ["\\\\", "\'"], $postLink);
                                
                                return "[quote='".$username."','".$postLink."']";
-                       });
+                       };
                        $mediaRegex = new Regex('\[video=([a-z]+);([a-z0-9-_]+)\]', Regex::CASE_INSENSITIVE);
                }
                
index ded2ffe63a33130be4b68c305ea1f3e45ccdebcd..d57d484321da9af9d438e7825494d4c812b9930a 100644 (file)
@@ -5,7 +5,6 @@ use wcf\data\user\group\UserGroup;
 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;
@@ -756,7 +755,7 @@ class VB5xExporter extends AbstractExporter {
                
                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];
                                
@@ -768,7 +767,7 @@ class VB5xExporter extends AbstractExporter {
                                $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);
index 6ef27dcf0670014fad394becc79b1a544374dbc6..76f4779d6f9d9535e1ec89a0d57f90759b43377a 100644 (file)
@@ -10,7 +10,6 @@ use wcf\system\database\util\PreparedStatementConditionBuilder;
 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;
@@ -1520,7 +1519,7 @@ class XF12xExporter extends AbstractExporter {
                
                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];
@@ -1534,10 +1533,10 @@ class XF12xExporter extends AbstractExporter {
                                }
                                
                                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
@@ -1546,10 +1545,10 @@ class XF12xExporter extends AbstractExporter {
                                $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']);
                                        
@@ -1567,7 +1566,7 @@ class XF12xExporter extends AbstractExporter {
                                        return "[quote='".$username."']";
                                }
                                return "[quote]";
-                       });
+                       };
                }
                
                $message = $mediaRegex->replace($message, $mediaCallback);