Created hashtags from keywords now are links. URL are cleaned from tracking data.

This commit is contained in:
Michael Vogel 2014-10-03 13:02:15 +02:00
parent 904f8ac422
commit 759f199b6f
2 changed files with 13 additions and 4 deletions

View file

@ -908,7 +908,7 @@ function add_page_info($url, $no_photos = false, $photo = "", $keywords = false)
return(""); return("");
if (($data["type"] != "photo") AND is_string($data["title"])) 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 != "")) if (($data["type"] != "video") AND ($photo != ""))
$text .= '[img]'.$photo.'[/img]'; $text .= '[img]'.$photo.'[/img]';
@ -921,9 +921,14 @@ function add_page_info($url, $no_photos = false, $photo = "", $keywords = false)
$text .= "[quote]".$data["text"]."[/quote]"; $text .= "[quote]".$data["text"]."[/quote]";
$hashtags = ""; $hashtags = "";
if ($keywords AND isset($data["keywords"])) if ($keywords AND isset($data["keywords"])) {
foreach ($data["keywords"] AS $keyword) $a = get_app();
$hashtags .= "#".str_replace(" ", "", $keyword)." "; $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); return("\n[class=type-".$data["type"]."]".$text."[/class]".$hashtags);
} }

View file

@ -51,6 +51,7 @@ function completeurl($url, $scheme) {
} }
function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $count = 1) { function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $count = 1) {
require_once("include/network.php");
$a = get_app(); $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 = trim($url, '"'); $url = trim($url, '"');
$url = original_url($url);
$siteinfo["url"] = $url; $siteinfo["url"] = $url;
$siteinfo["type"] = "link"; $siteinfo["type"] = "link";