Friendica Communications Platform (please note that this is a clone of the repository at github, issues are handled there) https://friendi.ca
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

38 lines
718 B

<?php
/**
* @file src/Module/Hashtag.php
*/
namespace Friendica\Module;
use Friendica\BaseModule;
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Util\Strings;
/**
* Hashtag module.
*/
class Hashtag extends BaseModule
{
public static function content(array $parameters = [])
{
$result = [];
$t = Strings::escapeHtml($_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)) {
$result[] = ['text' => $tag['term']];
}
DBA::close($taglist);
System::jsonExit($result);
}
}