mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 06:13:58 -07:00
Fix bb-code.
Не работал bb-code вида [url]yandex.ru[/url]. Пофиксил.
This commit is contained in:
parent
5ff735e0c8
commit
f86c369809
1 changed files with 6 additions and 1 deletions
|
@ -576,7 +576,7 @@ class bbcode
|
|||
|
||||
// [url]
|
||||
$url_exp = '[\w\#!$%&~/.\-;:=,?@а-яА-Я\[\]+]+?';
|
||||
$text = preg_replace_callback("#\[url\](https?://$url_exp)\[/url\]#isu", array(&$this, 'url_callback'), $text);
|
||||
$text = preg_replace_callback("#\[url\]((?:https?://)?$url_exp)\[/url\]#isu", array(&$this, 'url_callback'), $text);
|
||||
$text = preg_replace_callback("#\[url\](www\.$url_exp)\[/url\]#isu", array(&$this, 'url_callback'), $text);
|
||||
$text = preg_replace_callback("#\[url=(https?://$url_exp)\]([^?\n\t].*?)\[/url\]#isu", array(&$this, 'url_callback'), $text);
|
||||
$text = preg_replace_callback("#\[url=(www\.$url_exp)\]([^?\n\t].*?)\[/url\]#isu", array(&$this, 'url_callback'), $text);
|
||||
|
@ -704,6 +704,11 @@ class bbcode
|
|||
$url = trim($m[1]);
|
||||
$url_name = (isset($m[2])) ? trim($m[2]) : $url;
|
||||
|
||||
|
||||
if (!preg_match("#^http://#", $url)) {
|
||||
$url = 'http://' . $url;
|
||||
}
|
||||
|
||||
if (in_array(parse_url($url, PHP_URL_HOST), $bb_cfg['nofollow']['allowed_url']) || $bb_cfg['nofollow']['disabled'])
|
||||
{
|
||||
$link = "<a href=\"$url\" class=\"postLink\">$url_name</a>";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue