Emoji picker and theme updates

This commit is contained in:
Daisuke
2020-04-09 20:16:32 -05:00
parent 814854576c
commit cf0ba1244d
18 changed files with 383 additions and 1815 deletions

View File

@ -64,6 +64,41 @@ function emojify($string, $emojis, $size = 40) {
}
function emoji_list($val){
$emojilist = api_get("/custom_emojis");
$c = 0;
foreach ($emojilist as $emoji){
if (starts_with($emoji['shortcode'],$val) && $c < 50){
$return .= "<img style='margin:1px;' src='".$emoji['static_url']."' class='emoji' title='".$emoji['shortcode']."' height=40>";
$c++;
}
}
if ($c < 50){
foreach ($emojilist as $emoji){
if ((contains($emoji['shortcode'],$val) && !starts_with($emoji['shortcode'],$val)) && $c < 50){
$return .= "<img style='margin:1px;' src='".$emoji['static_url']."' class='emoji' title='".$emoji['shortcode']."' height=40>";
$c++;
}
}
}
return $return;
}
function starts_with($string,$search){
if (substr($string,0,strlen($search)) == $search){
return true;
}
return false;
}
function contains($string,$search){
if (is_numeric(strpos($string,$search))){
return true;
}
return false;
}
/* this function fetches the context (the previous posts and replies) of a specified post
$post = ID of the post.
*/