friendica/src/Module/Hashtag.php

41 lines
707 B
PHP
Raw Normal View History

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