]> git.mxchange.org Git - friendica.git/blob - src/Module/Hashtag.php
Add support for legacy $lang config in App->loadConfig
[friendica.git] / src / Module / Hashtag.php
1 <?php
2 /**
3  * @file src/Module/Hashtag.php
4  */
5 namespace Friendica\Module;
6
7 use Friendica\BaseModule;
8 use Friendica\Core\System;
9 use dba;
10
11 require_once 'include/dba.php';
12 require_once 'include/text.php';
13
14 /**
15  * Hashtag module.
16  */
17 class Hashtag extends BaseModule
18 {
19
20         public static function content()
21         {
22                 $result = [];
23
24                 $t = escape_tags($_REQUEST['t']);
25                 if (empty($t)) {
26                         System::jsonExit($result);
27                 }
28
29                 $taglist = dba::p("SELECT DISTINCT(`term`) FROM `term` WHERE `term` LIKE ? AND `type` = ? ORDER BY `term`",
30                         $t . '%',
31                         intval(TERM_HASHTAG)
32                 );
33                 while ($tag = dba::fetch($taglist)) {
34                         $result[] = ['text' => $tag['term']];
35                 }
36                 dba::close($taglist);
37
38                 System::jsonExit($result);
39         }
40 }