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