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 = "")