<?php
/**
- * @copyright Copyright (C) 2020, Friendica
+ * @copyright Copyright (C) 2010-2023, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\Util\Strings;
-use Friendica\Model\Tag;
-use Friendica\Model\Term;
/**
* Hashtag module.
*/
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(Tag::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);