X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=mod%2Fparse_url.php;h=02fbfa1b7db07a5e63c37eea9211fbf88222fc8f;hb=0cdf0ba422076f731a5801708879d5344439494a;hp=a14379e7096da14cbb13b86fb022c71dbd7a79b3;hpb=a298a1f8d59b5cbc331aae66a5e46d3308dd7e43;p=friendica.git diff --git a/mod/parse_url.php b/mod/parse_url.php index a14379e709..02fbfa1b7d 100644 --- a/mod/parse_url.php +++ b/mod/parse_url.php @@ -11,11 +11,10 @@ */ use Friendica\App; use Friendica\Core\Addon; +use Friendica\Core\Logger; use Friendica\Util\Network; use Friendica\Util\ParseUrl; -require_once 'include/items.php'; - function parse_url_content(App $a) { $text = null; @@ -46,15 +45,15 @@ function parse_url_content(App $a) // Add url scheme if it is missing $arrurl = parse_url($url); - if (!x($arrurl, 'scheme')) { - if (x($arrurl, 'host')) { + if (empty($arrurl['scheme'])) { + if (!empty($arrurl['host'])) { $url = 'http:' . $url; } else { $url = 'http://' . $url; } } - logger($url); + Logger::log($url); // Check if the URL is an image, video or audio file. If so format // the URL with the corresponding BBCode media tag @@ -93,6 +92,7 @@ function parse_url_content(App $a) } } + $template = '[bookmark=%s]%s[/bookmark]%s'; $arr = ['url' => $url, 'text' => '']; @@ -113,7 +113,7 @@ function parse_url_content(App $a) $result = sprintf($template, $url, ($title) ? $title : $url, $text) . $str_tags; - logger('(unparsed): returns: ' . $result); + Logger::log('(unparsed): returns: ' . $result); echo $result; exit(); @@ -124,6 +124,12 @@ function parse_url_content(App $a) unset($siteinfo['keywords']); + // Bypass attachment if parse url for a comment + if (!empty($_GET['noAttachment'])) { + echo $br . '[url=' . $url . ']' . $siteinfo['title'] . '[/url]'; + exit(); + } + // Format it as BBCode attachment $info = add_page_info_data($siteinfo);