diff --git a/mod/smilies.php b/mod/smilies.php deleted file mode 100644 index bbb7de2e2e..0000000000 --- a/mod/smilies.php +++ /dev/null @@ -1,32 +0,0 @@ -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 = '
'; - for ($x = 0; $x < count($smilies['texts']); $x ++) { - $s .= '
' . $smilies['texts'][$x] . '
' . $smilies['icons'][$x] . '
'; - } - $s .= '
'; - - return $s; - } -} diff --git a/src/App/Router.php b/src/App/Router.php index 1dffb6b406..30375667a3 100644 --- a/src/App/Router.php +++ b/src/App/Router.php @@ -165,6 +165,7 @@ class Router }); $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); diff --git a/src/Module/Smilies.php b/src/Module/Smilies.php new file mode 100644 index 0000000000..df4b4e1cd0 --- /dev/null +++ b/src/Module/Smilies.php @@ -0,0 +1,39 @@ + $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); + } + } +} diff --git a/view/templates/smilies.tpl b/view/templates/smilies.tpl new file mode 100644 index 0000000000..6f9fda83b4 --- /dev/null +++ b/view/templates/smilies.tpl @@ -0,0 +1,10 @@ +
+
+ {{for $i=0 to $count}} +
+
{{$smilies.texts[$i] nofilter}}
+
{{$smilies.icons[$i] nofilter}}
+
+ {{/for}} +
+