Не нравятся результаты поиска? Попробуйте другой поиск!
DLE FAQ » Все вопросы » Общие вопросы по PHP » вместо [url=http:// ] - [url=steam:// ]

вместо [url=http:// ] - [url=steam:// ]


     10.07.2012    URL    Все вопросы » Общие вопросы по PHP    3084

вопрос
когда добавляю url через bb код, получается постоянно
[url=http://steam://connect/188.40.55.177:27016]connect steam[/url]


а нужно без http://

чтоб было так:
[url=steam://connect/188.40.55.177:27016]connect steam[/url]


как реализовать?

Ответил: nowheremany


parse.class.php

$source = preg_replace("#(^|\s|>)((http|https|ftp)://\w+[^\s\[\]\<]+)#i", '\\1[url]\\2[/url]', $source);

заменить на
$source = preg_replace("#(^|\s|>)((http|https|ftp|steam)://\w+[^\s\[\]\<]+)#i", '\\1[url]\\2[/url]', $source);


$txt = preg_replace( "#<!--dle_leech_begin--><a href=[\"'](http://|https://|ftp://|ed2k://|news://|magnet:)?(\S.+?)['\"].*?" . ">(.+?)</a><!--dle_leech_end-->#ie", "\$this->decode_leech('\\1\\2', '\\3')", $txt );

на
$txt = preg_replace( "#<!--dle_leech_begin--><a href=[\"'](http://|https://|ftp://|ed2k://|news://|magnet:|steam://)?(\S.+?)['\"].*?" . ">(.+?)</a><!--dle_leech_end-->#ie", "\$this->decode_leech('\\1\\2', '\\3')", $txt );


            $txt = preg_replace( "#<noindex><a href=[\"'](http://|https://|ftp://|ed2k://|news://|magnet:)?(\S.+?)['\"].*?" . ">(.+?)</a></noindex>#ie", "\$this->decode_url('\\1\\2', '\\3')", $txt );
            $txt = preg_replace( "#<a href=[\"'](http://|https://|ftp://|ed2k://|news://|magnet:)?(\S.+?)['\"].*?" . ">(.+?)</a>#ie", "\$this->decode_url('\\1\\2', '\\3')", $txt );

на
            $txt = preg_replace( "#<noindex><a href=[\"'](http://|https://|ftp://|ed2k://|news://|magnet:|steam://)?(\S.+?)['\"].*?" . ">(.+?)</a></noindex>#ie", "\$this->decode_url('\\1\\2', '\\3')", $txt );
            $txt = preg_replace( "#<a href=[\"'](http://|https://|ftp://|ed2k://|news://|magnet:|steam://)?(\S.+?)['\"].*?" . ">(.+?)</a>#ie", "\$this->decode_url('\\1\\2', '\\3')", $txt );


        if( ! preg_match( "#^(http|news|https|ed2k|ftp|aim|mms)://|(magnet:?)#", $url['html'] ) AND $url['html'][0] != "/" AND $url['html'][0] != "#") {
            $url['html'] = 'http://' . $url['html'];
        }

на
        if( ! preg_match( "#^(http|news|https|ed2k|ftp|aim|mms|steam)://|(magnet:?)#", $url['html'] ) AND $url['html'][0] != "/" AND $url['html'][0] != "#") {
            $url['html'] = 'http://' . $url['html'];
        }

2 комментария

xoxa99
Юзер

xoxa99 - 10 июля 2012 10:38 -

Спасибище)

f1est0
Юзер

f1est0 - 27 июля 2017 15:38 -

А что править в версии 1.13? Второго и Третьего пунктов, нету в новом parse.class.php

Чтобы комментировать - войдите или зарегистрируйтесь на сайте

Похожие вопросы

наверх