2018-03-16 12:55:26 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* @file src/Module/Hashtag.php
|
|
|
|
*/
|
|
|
|
namespace Friendica\Module;
|
|
|
|
|
|
|
|
use Friendica\BaseModule;
|
|
|
|
use Friendica\Core\System;
|
2018-07-20 12:19:26 +00:00
|
|
|
use Friendica\Database\DBA;
|
2018-03-16 12:55:26 +00:00
|
|
|
|
2018-03-16 13:44:51 +00:00
|
|
|
require_once 'include/dba.php';
|
|
|
|
require_once 'include/text.php';
|
|
|
|
|
2018-03-16 12:55:26 +00:00
|
|
|
/**
|
|
|
|
* Hashtag module.
|
|
|
|
*/
|
2018-03-16 13:27:04 +00:00
|
|
|
class Hashtag extends BaseModule
|
2018-03-16 12:55:26 +00:00
|
|
|
{
|
2018-03-16 13:27:04 +00:00
|
|
|
|
|
|
|
public static function content()
|
|
|
|
{
|
2018-03-16 12:55:26 +00:00
|
|
|
$result = [];
|
|
|
|
|
|
|
|
$t = escape_tags($_REQUEST['t']);
|
|
|
|
if (empty($t)) {
|
|
|
|
System::jsonExit($result);
|
|
|
|
}
|
|
|
|
|
2018-07-20 12:19:26 +00:00
|
|
|
$taglist = DBA::p("SELECT DISTINCT(`term`) FROM `term` WHERE `term` LIKE ? AND `type` = ? ORDER BY `term`",
|
2018-03-16 12:55:26 +00:00
|
|
|
$t . '%',
|
|
|
|
intval(TERM_HASHTAG)
|
|
|
|
);
|
2018-07-20 12:19:26 +00:00
|
|
|
while ($tag = DBA::fetch($taglist)) {
|
2018-03-29 04:47:14 +00:00
|
|
|
$result[] = ['text' => $tag['term']];
|
2018-03-16 12:55:26 +00:00
|
|
|
}
|
2018-07-20 12:19:26 +00:00
|
|
|
DBA::close($taglist);
|
2018-03-16 12:55:26 +00:00
|
|
|
|
|
|
|
System::jsonExit($result);
|
|
|
|
}
|
|
|
|
}
|