optionally allow zrl usage from specific markdown sources
This commit is contained in:
@@ -72,7 +72,7 @@ function bb_tag_preg_replace($pattern, $replace, $name, $s) {
|
||||
// So we'll use that to convert to HTML, then convert the HTML back to bbcode,
|
||||
// and then clean up a few Diaspora specific constructs.
|
||||
|
||||
function diaspora2bb($s) {
|
||||
function diaspora2bb($s,$use_zrl = false) {
|
||||
|
||||
|
||||
$s = html_entity_decode($s,ENT_COMPAT,'UTF-8');
|
||||
@@ -106,7 +106,14 @@ function diaspora2bb($s) {
|
||||
$s = str_replace('♲',html_entity_decode('♲',ENT_QUOTES,'UTF-8'),$s);
|
||||
|
||||
// Convert everything that looks like a link to a link
|
||||
$s = preg_replace("/([^\]\=]|^)(https?\:\/\/)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url=$2$3]$2$3[/url]',$s);
|
||||
if($use_zrl) {
|
||||
$s = str_replace(array('[img','/img]'),array('[zmg','/zmg]'),$s);
|
||||
$s = preg_replace("/([^\]\=]|^)(https?\:\/\/)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[zrl=$2$3]$2$3[/zrl]',$s);
|
||||
}
|
||||
else {
|
||||
$s = preg_replace("/([^\]\=]|^)(https?\:\/\/)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url=$2$3]$2$3[/url]',$s);
|
||||
|
||||
}
|
||||
|
||||
//$s = preg_replace("/([^\]\=]|^)(https?\:\/\/)(vimeo|youtu|www\.youtube|soundcloud)([a-zA-Z0-9\:\/\-\?\&\;\.\=\_\~\#\%\$\!\+\,]+)/ism", '$1[url=$2$3$4]$2$3$4[/url]',$s);
|
||||
$s = bb_tag_preg_replace("/\[url\=?(.*?)\]https?:\/\/www.youtube.com\/watch\?v\=(.*?)\[\/url\]/ism",'[youtube]$2[/youtube]','url',$s);
|
||||
|
||||
Reference in New Issue
Block a user