We now store the tags in two separate tables
This commit is contained in:
parent
d3f4e4d629
commit
db657b0149
8 changed files with 121 additions and 98 deletions
|
@ -141,31 +141,44 @@ function query_page_info($url, $photo = "", $keywords = false, $keyword_blacklis
|
|||
return $data;
|
||||
}
|
||||
|
||||
function add_page_keywords($url, $photo = "", $keywords = false, $keyword_blacklist = "", $return_array = false)
|
||||
function add_page_keywords($url, $photo = "", $keywords = false, $keyword_blacklist = "")
|
||||
{
|
||||
$data = query_page_info($url, $photo, $keywords, $keyword_blacklist);
|
||||
if (empty($data['keywords']) || !is_array($data['keywords'])) {
|
||||
return '';
|
||||
}
|
||||
|
||||
$tags = "";
|
||||
$taglist = [];
|
||||
if (isset($data["keywords"]) && count($data["keywords"])) {
|
||||
foreach ($data["keywords"] as $keyword) {
|
||||
$hashtag = str_replace([" ", "+", "/", ".", "#", "'"],
|
||||
["", "", "", "", "", ""], $keyword);
|
||||
foreach ($data["keywords"] as $keyword) {
|
||||
$hashtag = str_replace([" ", "+", "/", ".", "#", "'"],
|
||||
["", "", "", "", "", ""], $keyword);
|
||||
|
||||
if ($tags != "") {
|
||||
$tags .= ", ";
|
||||
}
|
||||
|
||||
$tags .= "#[url=" . DI::baseUrl() . "/search?tag=" . $hashtag . "]" . $hashtag . "[/url]";
|
||||
$taglist[] = $hashtag;
|
||||
if ($tags != "") {
|
||||
$tags .= ", ";
|
||||
}
|
||||
|
||||
$tags .= "#[url=" . DI::baseUrl() . "/search?tag=" . $hashtag . "]" . $hashtag . "[/url]";
|
||||
}
|
||||
|
||||
if ($return_array) {
|
||||
return $taglist;
|
||||
} else {
|
||||
return $tags;
|
||||
return $tags;
|
||||
}
|
||||
|
||||
function get_page_keywords($url, $photo = "", $keywords = false, $keyword_blacklist = "")
|
||||
{
|
||||
$data = query_page_info($url, $photo, $keywords, $keyword_blacklist);
|
||||
if (empty($data['keywords']) || !is_array($data['keywords'])) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$taglist = [];
|
||||
foreach ($data['keywords'] as $keyword) {
|
||||
$hashtag = str_replace([" ", "+", "/", ".", "#", "'"],
|
||||
["", "", "", "", "", ""], $keyword);
|
||||
|
||||
$taglist[] = $hashtag;
|
||||
}
|
||||
|
||||
return $taglist;
|
||||
}
|
||||
|
||||
function add_page_info($url, $no_photos = false, $photo = "", $keywords = false, $keyword_blacklist = "")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue