if ($stopoembed == true) {
return preg_replace("/\[embed\](.+?)\[\/embed\]/is", "<!-- oembed $1 --><i>" . DI::l10n()->t('Embedding disabled') . " : $1</i><!-- /oembed $1 -->", $text);
}
- return preg_replace_callback("/\[embed\](.+?)\[\/embed\]/is", ['self', 'replaceCallback'], $text);
+ return preg_replace_callback("/\[embed\](.+?)\[\/embed\]/is", [self::class, 'replaceCallback'], $text);
}
/**
return $text;
}
- $text = preg_replace_callback('/<(pre)>(.*?)<\/pre>/ism', 'self::encode', $text);
- $text = preg_replace_callback('/<(code)>(.*?)<\/code>/ism', 'self::encode', $text);
+ $text = preg_replace_callback('/<(pre)>(.*?)<\/pre>/ism', [self::class, 'encode'], $text);
+ $text = preg_replace_callback('/<(code)>(.*?)<\/code>/ism', [self::class, 'encode'], $text);
if ($no_images) {
$cleaned = ['texts' => [], 'icons' => []];
$smilies = $cleaned;
}
- $text = preg_replace_callback('/<(3+)/', 'self::heartReplaceCallback', $text);
+ $text = preg_replace_callback('/<(3+)/', [self::class, 'heartReplaceCallback'], $text);
$text = self::strOrigReplace($smilies['texts'], $smilies['icons'], $text);
- $text = preg_replace_callback('/<(code)>(.*?)<\/code>/ism', 'self::decode', $text);
- $text = preg_replace_callback('/<(pre)>(.*?)<\/pre>/ism', 'self::decode', $text);
+ $text = preg_replace_callback('/<(code)>(.*?)<\/code>/ism', [self::class, 'decode'], $text);
+ $text = preg_replace_callback('/<(pre)>(.*?)<\/pre>/ism', [self::class, 'decode'], $text);
return $text;
}
public static function cleanPictureLinks(string $text): string
{
DI::profiler()->startRecording('rendering');
- $return = preg_replace_callback("&\[url=([^\[\]]*)\]\[img=(.*)\](.*)\[\/img\]\[\/url\]&Usi", 'self::cleanPictureLinksCallback', $text);
- $return = preg_replace_callback("&\[url=([^\[\]]*)\]\[img\](.*)\[\/img\]\[\/url\]&Usi", 'self::cleanPictureLinksCallback', $return);
+ $return = preg_replace_callback("&\[url=([^\[\]]*)\]\[img=(.*)\](.*)\[\/img\]\[\/url\]&Usi", [self::class, 'cleanPictureLinksCallback'], $text);
+ $return = preg_replace_callback("&\[url=([^\[\]]*)\]\[img\](.*)\[\/img\]\[\/url\]&Usi", [self::class, 'cleanPictureLinksCallback'], $return);
DI::profiler()->stopRecording();
return $return;
}
{
DI::profiler()->startRecording('rendering');
$regexp = "/([@!])\[url\=([^\[\]]*)\].*?\[\/url\]/ism";
- $body = preg_replace_callback($regexp, ['self', 'mentionCallback'], $body);
+ $body = preg_replace_callback($regexp, [self::class, 'mentionCallback'], $body);
DI::profiler()->stopRecording();
return $body;
}
if (!$for_plaintext) {
if (in_array($simple_html, [self::OSTATUS, self::MASTODON_API, self::TWITTER_API, self::ACTIVITYPUB])) {
- $text = preg_replace_callback("/\[url\](.*?)\[\/url\]/ism", 'self::convertUrlForActivityPubCallback', $text);
- $text = preg_replace_callback("/\[url\=(.*?)\](.*?)\[\/url\]/ism", 'self::convertUrlForActivityPubCallback', $text);
+ $text = preg_replace_callback("/\[url\](.*?)\[\/url\]/ism", [self::class, 'convertUrlForActivityPubCallback'], $text);
+ $text = preg_replace_callback("/\[url\=(.*?)\](.*?)\[\/url\]/ism", [self::class, 'convertUrlForActivityPubCallback'], $text);
}
} else {
$text = preg_replace("(\[url\](.*?)\[\/url\])ism", " $1 ", $text);
- $text = preg_replace_callback("&\[url=([^\[\]]*)\]\[img\](.*)\[\/img\]\[\/url\]&Usi", 'self::removePictureLinksCallback', $text);
+ $text = preg_replace_callback("&\[url=([^\[\]]*)\]\[img\](.*)\[\/img\]\[\/url\]&Usi", [self::class, 'removePictureLinksCallback'], $text);
}
// Bookmarks in red - will be converted to bookmarks in friendica
"[bookmark=$1]$2[/bookmark]", $text);
if (in_array($simple_html, [self::OSTATUS, self::TWITTER])) {
- $text = preg_replace_callback("/([^#@!])\[url\=([^\]]*)\](.*?)\[\/url\]/ism", "self::expandLinksCallback", $text);
+ $text = preg_replace_callback("/([^#@!])\[url\=([^\]]*)\](.*?)\[\/url\]/ism", [self::class, 'expandLinksCallback'], $text);
//$text = preg_replace("/[^#@!]\[url\=([^\]]*)\](.*?)\[\/url\]/ism", ' $2 [url]$1[/url]', $text);
$text = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", ' $2 [url]$1[/url]', $text);
}
$url_search_string = "^\[\]";
$text = preg_replace_callback(
"/([@!])\[(.*?)\]\(([$url_search_string]*?)\)/ism",
- ['self', 'bbCodeMention2DiasporaCallback'],
+ [self::class, 'bbCodeMention2DiasporaCallback'],
$text
);
}
// the quotes, e.g.:
//
// concat("'foo'", '"', "bar")
- return 'concat(' . implode(', \'"\', ', array_map(['self', 'xpathQuote'], explode('"', $value))) . ')';
+ return 'concat(' . implode(', \'"\', ', array_map([self::class, 'xpathQuote'], explode('"', $value))) . ')';
}
/**
$x ++;
}
- usort($tags, 'self::tagsSort');
+ usort($tags, [self::class, 'tagsSort']);
$range = max(0.01, $max - $min) * 1.0001;
for ($x = 0; $x < count($tags); $x ++) {
public static function buildTableString(array $tables): string
{
// Quote each entry
- return implode(',', array_map(['self', 'quoteIdentifier'], $tables));
+ return implode(',', array_map([self::class, 'quoteIdentifier'], $tables));
}
/**
{
$groupby_string = '';
if (!empty($params['group_by'])) {
- $groupby_string = " GROUP BY " . implode(', ', array_map(['self', 'quoteIdentifier'], $params['group_by']));
+ $groupby_string = " GROUP BY " . implode(', ', array_map([self::class, 'quoteIdentifier'], $params['group_by']));
}
$order_string = '';
public static function sortByDate(array $event_list): array
{
- usort($event_list, ['self', 'compareDatesCallback']);
+ usort($event_list, [self::class, 'compareDatesCallback']);
return $event_list;
}
*
* } elseif (($type == 'Article') && empty($data['summary'])) {
* $regexp = "/[@!]\[url\=([^\[\]]*)\].*?\[\/url\]/ism";
- * $summary = preg_replace_callback($regexp, ['self', 'mentionAddrCallback'], $body);
+ * $summary = preg_replace_callback($regexp, [self::class, 'mentionAddrCallback'], $body);
* $data['summary'] = BBCode::toPlaintext(Plaintext::shorten(self::removePictures($summary), 1000));
* }
*/
$arr_tags = str_getcsv($string);
if (count($arr_tags)) {
// add the # sign to every tag
- array_walk($arr_tags, ['self', 'arrAddHashes']);
+ array_walk($arr_tags, [self::class, 'arrAddHashes']);
return $arr_tags;
}
{
$html = str_replace(Strings::normaliseLink(DI::baseUrl()) . '/', DI::baseUrl() . '/', $html);
- return preg_replace_callback('/(<img [^>]*src *= *["\'])([^"\']+)(["\'][^>]*>)/siU', 'self::replaceUrl', $html);
+ return preg_replace_callback('/(<img [^>]*src *= *["\'])([^"\']+)(["\'][^>]*>)/siU', [self::class, 'replaceUrl'], $html);
}
/**