From d6ce32ef7885579ba0503bc7a826ded2ddac4d71 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 11 Mar 2015 17:31:15 -0700 Subject: parse_url changes for oembed/zvideo/etc. --- mod/parse_url.php | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) (limited to 'mod/parse_url.php') diff --git a/mod/parse_url.php b/mod/parse_url.php index 49d5cae76..b6c0559f9 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -1,5 +1,6 @@ true, 'nobody' => true)); if($result['success']) { $hdrs=array(); @@ -261,25 +264,31 @@ function parse_url_content(&$a) { if (array_key_exists('Content-Type', $hdrs)) $type = $hdrs['Content-Type']; if($type) { - if(in_array($type,array('image/jpeg','image/gif','image/png'))) { - $s = $br . '[img]' . $url . '[/img]' . $br; - $s = preg_replace_callback('/\[img(.*?)\](.*?)\[\/img\]/ism','red_zrlify_img_callback',$s); - echo $s; + $zrl = is_matrix_url($url); + if(stripos($type,'image/') !== false) { + if($zrl) + echo $br . '[zmg]' . $url . '[/zmg]' . $br; + else + echo $br . '[img]' . $url . '[/img]' . $br; killme(); } if(stripos($type,'video/') !== false) { - echo $br . '[video]' . $url . '[/video]' . $br; + if($zrl) + echo $br . '[zvideo]' . $url . '[/zvideo]' . $br; + else + echo $br . '[video]' . $url . '[/video]' . $br; killme(); } if(stripos($type,'audio/') !== false) { - echo $br . '[audio]' . $url . '[/audio]' . $br; + if($zrl) + echo $br . '[zaudio]' . $url . '[/zaudio]' . $br; + else + echo $br . '[audio]' . $url . '[/audio]' . $br; killme(); } } } - logger('parse_url: ' . $url); - $template = $br . '#^[url=%s]%s[/url]%s' . $br; $arr = array('url' => $url, 'text' => ''); @@ -291,6 +300,11 @@ function parse_url_content(&$a) { killme(); } + $x = oembed_process($url); + if($x) { + echo $x; + killme(); + } if($url && $title && $text) { -- cgit v1.2.3