+++ /dev/null
-<?php
-/**
- * @file mod/smilies.php
- */
-use Friendica\App;
-use Friendica\Content\Smilies;
-use Friendica\Core\System;
-
-/**
- * @param App $a App
- * @return string
- * @throws \Friendica\Network\HTTPException\InternalServerErrorException
- */
-function smilies_content(App $a)
-{
- $smilies = Smilies::getList();
- if (!empty($a->argv[1]) && ($a->argv[1] === "json")) {
- $results = [];
- for ($i = 0; $i < count($smilies['texts']); $i++) {
- $results[] = ['text' => $smilies['texts'][$i], 'icon' => $smilies['icons'][$i]];
- }
- System::jsonExit($results);
- } else {
- $s = '<div class="smiley-sample">';
- for ($x = 0; $x < count($smilies['texts']); $x ++) {
- $s .= '<dl><dt>' . $smilies['texts'][$x] . '</dt><dd>' . $smilies['icons'][$x] . '</dd></dl>';
- }
- $s .= '</div>';
-
- return $s;
- }
-}
});
$this->routeCollector->addRoute(['GET', 'POST'], '/register', Module\Register::class);
$this->routeCollector->addRoute(['GET'], '/rsd.xml', Module\ReallySimpleDiscovery::class);
+ $this->routeCollector->addRoute(['GET'], '/smilies[/json]', Module\Smilies::class);
$this->routeCollector->addRoute(['GET'], '/statistics.json', Module\Statistics::class);
$this->routeCollector->addRoute(['GET'], '/tos', Module\Tos::class);
$this->routeCollector->addRoute(['GET'], '/webfinger', Module\WebFinger::class);
--- /dev/null
+<?php
+
+namespace Friendica\Module;
+
+use Friendica\BaseModule;
+use Friendica\Core\Renderer;
+use Friendica\Core\System;
+
+/**
+ * Prints the possible Smilies of this node
+ */
+class Smilies extends BaseModule
+{
+ public static function content()
+ {
+ $smilies = \Friendica\Content\Smilies::getList();
+ $count = count(defaults($smilies, 'texts', []));
+
+ $tpl = Renderer::getMarkupTemplate('smilies.tpl');
+ return Renderer::replaceMacros($tpl, [
+ '$count' => $count,
+ '$smilies' => $smilies,
+ ]);
+ }
+
+ public static function rawContent()
+ {
+ $app = self::getApp();
+ $smilies = \Friendica\Content\Smilies::getList();
+
+ if (!empty($app->argv[1]) && ($app->argv[1] === "json")) {
+ $results = [];
+ for ($i = 0; $i < count($smilies['texts']); $i++) {
+ $results[] = ['text' => $smilies['texts'][$i], 'icon' => $smilies['icons'][$i]];
+ }
+ System::jsonExit($results);
+ }
+ }
+}
--- /dev/null
+<div id="smilies" class="generic-page-wrapper">
+ <div class="smiley-sample">
+ {{for $i=0 to $count}}
+ <dl>
+ <dt>{{$smilies.texts[$i] nofilter}}</dt>
+ <dd>{{$smilies.icons[$i] nofilter}}</dd>
+ </dl>
+ {{/for}}
+ </div>
+</div>