When "local_search" is activated, then point all hashtags to the local server
This commit is contained in:
parent
5c5db12706
commit
f8946c9e0a
2 changed files with 8 additions and 9 deletions
|
@ -1178,13 +1178,14 @@ function item_body_set_hashtags(&$item) {
|
||||||
|
|
||||||
$URLSearchString = "^\[\]";
|
$URLSearchString = "^\[\]";
|
||||||
|
|
||||||
/// @TODO old-lost code?
|
// All hashtags should point to the home server if "local_search" is activated
|
||||||
// All hashtags should point to the home server
|
if (Config::get('system', 'local_search')) {
|
||||||
//$item["body"] = preg_replace("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
|
$item["body"] = preg_replace("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
|
||||||
// "#[url=".App::get_baseurl()."/search?tag=$2]$2[/url]", $item["body"]);
|
"#[url=".App::get_baseurl()."/search?tag=$2]$2[/url]", $item["body"]);
|
||||||
|
|
||||||
//$item["tag"] = preg_replace("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
|
$item["tag"] = preg_replace("/#\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
|
||||||
// "#[url=".App::get_baseurl()."/search?tag=$2]$2[/url]", $item["tag"]);
|
"#[url=".App::get_baseurl()."/search?tag=$2]$2[/url]", $item["tag"]);
|
||||||
|
}
|
||||||
|
|
||||||
// mask hashtags inside of url, bookmarks and attachments to avoid urls in urls
|
// mask hashtags inside of url, bookmarks and attachments to avoid urls in urls
|
||||||
$item["body"] = preg_replace_callback("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
|
$item["body"] = preg_replace_callback("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
|
||||||
|
|
|
@ -8,8 +8,6 @@ function create_tags_from_item($itemid) {
|
||||||
$profile_base_friendica = $profile_data['host'].$profile_data['path']."/profile/";
|
$profile_base_friendica = $profile_data['host'].$profile_data['path']."/profile/";
|
||||||
$profile_base_diaspora = $profile_data['host'].$profile_data['path']."/u/";
|
$profile_base_diaspora = $profile_data['host'].$profile_data['path']."/u/";
|
||||||
|
|
||||||
$searchpath = App::get_baseurl()."/search?tag=";
|
|
||||||
|
|
||||||
$messages = q("SELECT `guid`, `uid`, `id`, `edited`, `deleted`, `created`, `received`, `title`, `body`, `tag`, `parent` FROM `item` WHERE `id` = %d LIMIT 1", intval($itemid));
|
$messages = q("SELECT `guid`, `uid`, `id`, `edited`, `deleted`, `created`, `received`, `title`, `body`, `tag`, `parent` FROM `item` WHERE `id` = %d LIMIT 1", intval($itemid));
|
||||||
|
|
||||||
if (!$messages)
|
if (!$messages)
|
||||||
|
@ -46,7 +44,7 @@ function create_tags_from_item($itemid) {
|
||||||
$pattern = "/\W\#([^\[].*?)[\s'\".,:;\?!\[\]\/]/ism";
|
$pattern = "/\W\#([^\[].*?)[\s'\".,:;\?!\[\]\/]/ism";
|
||||||
if (preg_match_all($pattern, $data, $matches))
|
if (preg_match_all($pattern, $data, $matches))
|
||||||
foreach ($matches[1] as $match)
|
foreach ($matches[1] as $match)
|
||||||
$tags["#".strtolower($match)] = ""; // $searchpath.strtolower($match);
|
$tags["#".strtolower($match)] = "";
|
||||||
|
|
||||||
$pattern = "/\W([\#@])\[url\=(.*?)\](.*?)\[\/url\]/ism";
|
$pattern = "/\W([\#@])\[url\=(.*?)\](.*?)\[\/url\]/ism";
|
||||||
if (preg_match_all($pattern, $data, $matches, PREG_SET_ORDER)) {
|
if (preg_match_all($pattern, $data, $matches, PREG_SET_ORDER)) {
|
||||||
|
|
Loading…
Reference in a new issue