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.

39 lines
696B

  1. <?php
  2. /**
  3. * @file src/Module/Hashtag.php
  4. */
  5. namespace Friendica\Module;
  6. use Friendica\BaseModule;
  7. use Friendica\Core\System;
  8. use Friendica\Database\DBA;
  9. use Friendica\Util\Strings;
  10. /**
  11. * Hashtag module.
  12. */
  13. class Hashtag extends BaseModule
  14. {
  15. public static function content()
  16. {
  17. $result = [];
  18. $t = Strings::escapeHtml($_REQUEST['t']);
  19. if (empty($t)) {
  20. System::jsonExit($result);
  21. }
  22. $taglist = DBA::p("SELECT DISTINCT(`term`) FROM `term` WHERE `term` LIKE ? AND `type` = ? ORDER BY `term`",
  23. $t . '%',
  24. intval(TERM_HASHTAG)
  25. );
  26. while ($tag = DBA::fetch($taglist)) {
  27. $result[] = ['text' => $tag['term']];
  28. }
  29. DBA::close($taglist);
  30. System::jsonExit($result);
  31. }
  32. }