/** * Caches code bbcodes to avoid parsing of urls inside them. * * @param string $text * @return string */ private static function cacheCodes($text) { if (self::$sourceCodeRegEx === null) { self::$sourceCodeRegEx = implode('|', WCF::getCache()->get('bbcodes', 'sourceCodes')); } if (!empty(self::$sourceCodeRegEx)) { self::$cachedCodes = array(); $text = preg_replace_callback("~(\\[(" . self::$sourceCodeRegEx . ")\n\t\t\t\t(?:=\n\t\t\t\t\t(?:\\'[^\\'\\\\]*(?:\\\\.[^\\'\\\\]*)*\\'|[^,\\]]*)\n\t\t\t\t\t(?:,(?:\\'[^\\'\\\\]*(?:\\\\.[^\\'\\\\]*)*\\'|[^,\\]]*))*\n\t\t\t\t)?\\])\n\t\t\t\t(.*?)\n\t\t\t\t(?:\\[/\\2\\])~six", array('URLParser', 'cacheCodesCallback'), $text); } return $text; }