]> git.mxchange.org Git - friendica.git/commitdiff
Created hashtags from keywords now are links. URL are cleaned from tracking data.
authorMichael Vogel <icarus@dabo.de>
Fri, 3 Oct 2014 11:02:15 +0000 (13:02 +0200)
committerMichael Vogel <icarus@dabo.de>
Fri, 3 Oct 2014 11:02:15 +0000 (13:02 +0200)
include/items.php
mod/parse_url.php

index 4d6d6dcb14824d677a57ea5db17edd74637d6b00..0d37fa1a6ed0a0ce4dd6b5a243d3fcbaf595dc7f 100644 (file)
@@ -908,7 +908,7 @@ function add_page_info($url, $no_photos = false, $photo = "", $keywords = false)
                return("");
 
        if (($data["type"] != "photo") AND is_string($data["title"]))
-               $text .= "[bookmark=".$url."]".trim($data["title"])."[/bookmark]";
+               $text .= "[bookmark=".$data["url"]."]".trim($data["title"])."[/bookmark]";
 
        if (($data["type"] != "video") AND ($photo != ""))
                $text .= '[img]'.$photo.'[/img]';
@@ -921,9 +921,14 @@ function add_page_info($url, $no_photos = false, $photo = "", $keywords = false)
                $text .= "[quote]".$data["text"]."[/quote]";
 
        $hashtags = "";
-       if ($keywords AND isset($data["keywords"]))
-               foreach ($data["keywords"] AS $keyword)
-                       $hashtags .= "#".str_replace(" ", "", $keyword)." ";
+       if ($keywords AND isset($data["keywords"])) {
+               $a = get_app();
+               $hashtags = "\n";
+               foreach ($data["keywords"] AS $keyword) {
+                       $hashtag = str_replace(" ", "", $keyword);
+                       $hashtags .= "#[url=".$a->get_baseurl()."/search?tag=".rawurlencode($hashtag)."]".$hashtag."[/url] ";
+               }
+       }
 
        return("\n[class=type-".$data["type"]."]".$text."[/class]".$hashtags);
 }
index d314c6c67ff09190036ffb1753faeeb67f2e1329..4830be5d6f078b9d7e8700f1b8d81cf6351a9172 100644 (file)
@@ -51,6 +51,7 @@ function completeurl($url, $scheme) {
 }
 
 function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $count = 1) {
+       require_once("include/network.php");
 
        $a = get_app();
 
@@ -63,6 +64,9 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
 
        $url = trim($url, "'");
        $url = trim($url, '"');
+
+       $url = original_url($url);
+
        $siteinfo["url"] = $url;
        $siteinfo["type"] = "link";