]> git.mxchange.org Git - friendica.git/blobdiff - src/Module/Hashtag.php
Remove DI dependency from Module\Contact\Profile
[friendica.git] / src / Module / Hashtag.php
index 50719774fb51cb5f3595e8c3adf5e7567b62e756..0c4c41c7e17c002334069025c9a17b8f82ed2333 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2023, the Friendica project
  *
  * @license GNU AGPL version 3 or any later version
  *
@@ -31,22 +31,22 @@ use Friendica\Util\Strings;
  */
 class Hashtag extends BaseModule
 {
-
-       public static function content(array $parameters = [])
+       protected function rawContent(array $request = [])
        {
                $result = [];
 
-               $t = Strings::escapeHtml($_REQUEST['t']);
-               if (empty($t)) {
+               if (empty($request['t'])) {
                        System::jsonExit($result);
                }
 
-               $taglist = DBA::p("SELECT DISTINCT(`term`) FROM `term` WHERE `term` LIKE ? AND `type` = ? ORDER BY `term`",
-                       $t . '%',
-                       intval(TERM_HASHTAG)
+               $taglist = DBA::select(
+                       'tag',
+                       ['name'],
+                       ["`name` LIKE ?", Strings::escapeHtml($request['t']) . "%"],
+                       ['order' => ['name'], 'limit' => 100]
                );
                while ($tag = DBA::fetch($taglist)) {
-                       $result[] = ['text' => $tag['term']];
+                       $result[] = ['text' => $tag['name']];
                }
                DBA::close($taglist);