Merge remote-tracking branch 'upstream/dev' into wiki

This commit is contained in:
Andrew Manning 2016-06-05 16:52:02 -04:00
commit 08a9553ccc
7 changed files with 27 additions and 21 deletions

View File

@ -35,7 +35,7 @@ class React extends \Zotlabs\Web\Controller {
$n['parent_mid'] = $i[0]['mid']; $n['parent_mid'] = $i[0]['mid'];
$n['mid'] = item_message_id(); $n['mid'] = item_message_id();
$n['verb'] = ACTIVITY_REACT . '#' . $emoji; $n['verb'] = ACTIVITY_REACT . '#' . $emoji;
$n['body'] = "\n\n[zmg]" . z_root() . '/images/emoji/' . $emoji . '.png[/zmg]' . "\n\n"; $n['body'] = "\n\n[zmg=32x32]" . z_root() . '/images/emoji/' . $emoji . '.png[/zmg]' . "\n\n";
$n['author_xchan'] = $channel['channel_hash']; $n['author_xchan'] = $channel['channel_hash'];
$x = item_store($n); $x = item_store($n);

View File

@ -784,6 +784,7 @@ class App {
public static $content; public static $content;
public static $data = array(); public static $data = array();
public static $error = false; public static $error = false;
public static $emojitab = false;
public static $cmd; public static $cmd;
public static $argv; public static $argv;
public static $argc; public static $argc;

View File

@ -66,19 +66,6 @@ function bb_unspacefy_and_trim($st) {
} }
function bb_emoji($mtch) {
$s = strtolower($mtch[1]);
if(strpos($s,'x')) {
$e = substr($s,strpos($s,'x')+1);
if(file_exists('images/emoji/' . $e . '.png')) {
return '<img width="24" height="24" src="' . z_root() . '/images/emoji/' . $e . '.png" alt="emoji" />';
}
else {
return $mtch[0];
}
}
}
function bb_extract_images($body) { function bb_extract_images($body) {
$saved_image = array(); $saved_image = array();
@ -1014,7 +1001,6 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false)
$Text = preg_replace_callback("/\[pre\](.*?)\[\/pre\]/ism", 'bb_unspacefy_and_trim', $Text); $Text = preg_replace_callback("/\[pre\](.*?)\[\/pre\]/ism", 'bb_unspacefy_and_trim', $Text);
} }
$Text = preg_replace_callback('/\[\&amp\;([#a-z0-9]+)\;\]/', 'bb_emoji', $Text);
$Text = preg_replace('/\[\&amp\;([#a-z0-9]+)\;\]/', '&$1;', $Text); $Text = preg_replace('/\[\&amp\;([#a-z0-9]+)\;\]/', '&$1;', $Text);
// fix any escaped ampersands that may have been converted into links // fix any escaped ampersands that may have been converted into links

View File

@ -1183,7 +1183,7 @@ function encode_item_terms($terms,$mirror = false) {
if($terms) { if($terms) {
foreach($terms as $term) { foreach($terms as $term) {
if(in_array($term['ttype'],$allowed_export_terms)) if(in_array($term['ttype'],$allowed_export_terms))
$ret[] = array('tag' => $term['term'], 'url' => $term['url'], 'ttype' => termtype($term['type'])); $ret[] = array('tag' => $term['term'], 'url' => $term['url'], 'type' => termtype($term['ttype']));
} }
} }
@ -1240,11 +1240,9 @@ function decode_tags($t) {
$ret = array(); $ret = array();
foreach($t as $x) { foreach($t as $x) {
$tag = array(); $tag = array();
if(array_key_exists('type',$x))
$x['ttype'] = $x['type'];
$tag['term'] = htmlspecialchars($x['tag'], ENT_COMPAT, 'UTF-8', false); $tag['term'] = htmlspecialchars($x['tag'], ENT_COMPAT, 'UTF-8', false);
$tag['url'] = htmlspecialchars($x['url'], ENT_COMPAT, 'UTF-8', false); $tag['url'] = htmlspecialchars($x['url'], ENT_COMPAT, 'UTF-8', false);
switch($x['ttype']) { switch($x['type']) {
case 'hashtag': case 'hashtag':
$tag['ttype'] = TERM_HASHTAG; $tag['ttype'] = TERM_HASHTAG;
break; break;

View File

@ -1115,8 +1115,8 @@ function list_smilies() {
':coffee', ':coffee',
':facepalm', ':facepalm',
':like', ':like',
':dislike' ':dislike',
':hubzilla'
); );
$icons = array( $icons = array(
@ -1152,9 +1152,24 @@ function list_smilies() {
'<img class="smiley" src="' . z_root() . '/images/smiley-facepalm.gif" alt=":facepalm" />', '<img class="smiley" src="' . z_root() . '/images/smiley-facepalm.gif" alt=":facepalm" />',
'<img class="smiley" src="' . z_root() . '/images/like.gif" alt=":like" />', '<img class="smiley" src="' . z_root() . '/images/like.gif" alt=":like" />',
'<img class="smiley" src="' . z_root() . '/images/dislike.gif" alt=":dislike" />', '<img class="smiley" src="' . z_root() . '/images/dislike.gif" alt=":dislike" />',
'<img class="smiley" src="' . z_root() . '/images/hz-16.png" alt=":hubzilla" />',
); );
$x = get_config('feature','emoji');
if($x === false)
$x = 1;
if($x) {
if(! App::$emojitab)
App::$emojitab = json_decode(file_get_contents('library/emoji.json'),true);
foreach(App::$emojitab as $e) {
if(strpos($e['shortname'],':tone') === 0)
continue;
$texts[] = $e['shortname'];
$icons[] = '<img class="smiley emoji" height="16" width="16" src="images/emoji/' . $e['unicode'] . '.png' . '" alt="' . $e['name'] . '" />';
}
}
$params = array('texts' => $texts, 'icons' => $icons); $params = array('texts' => $texts, 'icons' => $icons);
call_hooks('smilie', $params); call_hooks('smilie', $params);

1
library/emoji.json Normal file

File diff suppressed because one or more lines are too long

View File

@ -312,3 +312,8 @@ code.inline-code {
.overline { .overline {
text-decoration: overline; text-decoration: overline;
} }
img.smiley.emoji:hover {
width: 32px;
height: 32px;
}