aboutsummaryrefslogtreecommitdiffstats
path: root/mod/parse_url.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-04-16 16:39:38 -0700
committerfriendica <info@friendica.com>2013-04-16 16:39:38 -0700
commit3c89d3160adfcbcc3f7b8055c3532de8d93fefd8 (patch)
tree22dc56e48aaa02ef479157894ec18ce4af66a1f5 /mod/parse_url.php
parent5c43c57ce1d60898b0104ddd405a6abe3c8b324c (diff)
downloadvolse-hubzilla-3c89d3160adfcbcc3f7b8055c3532de8d93fefd8.tar.gz
volse-hubzilla-3c89d3160adfcbcc3f7b8055c3532de8d93fefd8.tar.bz2
volse-hubzilla-3c89d3160adfcbcc3f7b8055c3532de8d93fefd8.zip
add Red detection to parse_url
Diffstat (limited to 'mod/parse_url.php')
-rw-r--r--mod/parse_url.php10
1 files changed, 9 insertions, 1 deletions
diff --git a/mod/parse_url.php b/mod/parse_url.php
index e7b9bb391..18e80ee3f 100644
--- a/mod/parse_url.php
+++ b/mod/parse_url.php
@@ -63,7 +63,7 @@ function parseurl_getsiteinfo($url) {
$header = $result['header'];
$body = $result['body'];
- $body = mb_convert_encoding($body, "UTF-8", $charset);
+ $body = mb_convert_encoding($body, 'UTF-8', 'UTF-8');
$body = mb_convert_encoding($body, 'HTML-ENTITIES', "UTF-8");
$doc = new DOMDocument();
@@ -99,6 +99,9 @@ function parseurl_getsiteinfo($url) {
$attr["content"] = html_entity_decode($attr["content"], ENT_QUOTES, "UTF-8");
switch (strtolower($attr["name"])) {
+ case 'generator':
+ $siteinfo['generator'] = $attr['content'];
+ break;
case "fulltitle":
$siteinfo["title"] = $attr["content"];
break;
@@ -274,6 +277,11 @@ function parse_url_content(&$a) {
$siteinfo = parseurl_getsiteinfo($url);
+ // If this is a Red site, use zrl rather than url so they get zids sent to them by default
+
+ if( x($siteinfo,'generator') && strpos($siteinfo['generator'],RED_PLATFORM . ' '))
+ $template = str_replace('url','zrl',$template);
+
if($siteinfo["title"] == "") {
echo sprintf($template,$url,$url,'') . $str_tags;
killme();