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.

41 lines
936 B

2 years ago
2 years ago
2 years ago
2 years ago
  1. <?php
  2. namespace Friendica\Module;
  3. use Friendica\BaseModule;
  4. use Friendica\Content;
  5. use Friendica\Core\Renderer;
  6. use Friendica\Core\System;
  7. use Friendica\DI;
  8. /**
  9. * Prints the possible Smilies of this node
  10. */
  11. class Smilies extends BaseModule
  12. {
  13. public static function rawContent(array $parameters = [])
  14. {
  15. $app = DI::app();
  16. if (!empty($app->argv[1]) && ($app->argv[1] === "json")) {
  17. $smilies = Content\Smilies::getList();
  18. $results = [];
  19. for ($i = 0; $i < count($smilies['texts']); $i++) {
  20. $results[] = ['text' => $smilies['texts'][$i], 'icon' => $smilies['icons'][$i]];
  21. }
  22. System::jsonExit($results);
  23. }
  24. }
  25. public static function content(array $parameters = [])
  26. {
  27. $smilies = Content\Smilies::getList();
  28. $count = count($smilies['texts'] ?? []);
  29. $tpl = Renderer::getMarkupTemplate('smilies.tpl');
  30. return Renderer::replaceMacros($tpl, [
  31. '$count' => $count,
  32. '$smilies' => $smilies,
  33. ]);
  34. }
  35. }