2012-02-16 02:13:41 +00:00
|
|
|
<?php
|
2016-02-01 16:43:12 +00:00
|
|
|
/**
|
|
|
|
* @file mod/smilies.php
|
|
|
|
*/
|
2017-04-30 04:07:00 +00:00
|
|
|
use Friendica\App;
|
2017-11-11 12:21:15 +00:00
|
|
|
use Friendica\Content\Smilies;
|
2018-01-27 16:59:10 +00:00
|
|
|
use Friendica\Core\System;
|
2016-02-01 16:43:12 +00:00
|
|
|
|
2017-11-19 21:14:16 +00:00
|
|
|
/**
|
2019-01-07 06:07:42 +00:00
|
|
|
* @param App $a App
|
2018-07-14 09:14:11 +00:00
|
|
|
* @return string
|
2019-01-07 06:07:42 +00:00
|
|
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
2017-11-19 21:14:16 +00:00
|
|
|
*/
|
|
|
|
function smilies_content(App $a)
|
2017-11-11 12:21:15 +00:00
|
|
|
{
|
2018-07-14 09:14:11 +00:00
|
|
|
$smilies = Smilies::getList();
|
2018-08-17 03:19:42 +00:00
|
|
|
if (!empty($a->argv[1]) && ($a->argv[1] === "json")) {
|
2018-01-15 13:05:12 +00:00
|
|
|
$results = [];
|
2018-07-14 09:14:11 +00:00
|
|
|
for ($i = 0; $i < count($smilies['texts']); $i++) {
|
|
|
|
$results[] = ['text' => $smilies['texts'][$i], 'icon' => $smilies['icons'][$i]];
|
2016-02-01 16:43:12 +00:00
|
|
|
}
|
2018-01-27 16:59:10 +00:00
|
|
|
System::jsonExit($results);
|
2017-04-30 04:01:26 +00:00
|
|
|
} else {
|
2018-07-14 09:14:11 +00:00
|
|
|
$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;
|
2016-02-01 16:43:12 +00:00
|
|
|
}
|
|
|
|
}
|