Skip to content
This repository has been archived by the owner on Jul 23, 2019. It is now read-only.

Commit

Permalink
3.0.1 library patch
Browse files Browse the repository at this point in the history
  • Loading branch information
caseyahenson committed Apr 24, 2017
1 parent 844221d commit 07955d3
Show file tree
Hide file tree
Showing 9 changed files with 193 additions and 160 deletions.
4 changes: 2 additions & 2 deletions bower.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "emojione",
"version": "3.0",
"version": "3.0.1",
"main": [
"assets/css/emojione.css",
"extras/css/emojione.css",
"lib/js/emojione.js"
],
"ignore": [
Expand Down
2 changes: 1 addition & 1 deletion emoji.json

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ module.exports = function(grunt) {
uglify: {
options: {
// the banner is inserted at the top of the output
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n',
mangle: false,
ASCIIOnly: true
},
dist: {
files: {
Expand Down
3 changes: 2 additions & 1 deletion lib/js/emojione.js

Large diffs are not rendered by default.

15 changes: 9 additions & 6 deletions lib/js/emojione.min.js

Large diffs are not rendered by default.

90 changes: 58 additions & 32 deletions lib/php/src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,16 +221,15 @@ public function shortnameToUnicodeCallback($m)
$unicode_replace = $ruleset->getUnicodeReplace();
$shortcode_replace = $ruleset->getShortcodeReplace();

$shortname = strtoupper($m[1]);
$shortname = strtolower($m[1]);

if (!array_key_exists($shortname, $shortcode_replace)) {
return $m[0];
}


$unicode = $shortcode_replace[$shortname][0];

return $unicode;
return $this->convert($unicode);
}
}

Expand Down Expand Up @@ -293,10 +292,19 @@ public function asciiToUnicodeCallback($m)
{
$ruleset = $this->getRuleset();
$ascii_replace = $ruleset->getAsciiReplace();

$shortname = $m[3];
$unicode = $ascii_replace[$shortname];
return $m[2].$this->convert($unicode);
$shortcode_replace = $ruleset->getShortcodeReplace();
$ascii = $m[3];

if ( empty($ascii_replace[$ascii]) )
{
return $m[3];
}
else
{
$shortname = $ascii_replace[$ascii];
$uc_output = $shortcode_replace[$shortname][0];
return $m[2].$this->convert($uc_output);
}
}
}

Expand All @@ -317,8 +325,16 @@ public function asciiToShortnameCallback($m)

$shortcode_replace = array_flip(array_reverse($ruleset->getShortcodeReplace()));
$shortname = $m[3];
$unicode = $ascii_replace[$shortname];
return $m[2].$shortcode_replace[$unicode];

if ( empty($ascii_replace[$shortname]) )
{
return $m[3];
}
else
{
$unicode = $ascii_replace[$shortname];
return $m[2].$shortcode_replace[$unicode];
}
}
}

Expand All @@ -338,29 +354,39 @@ public function asciiToImageCallback($m)
$ascii_replace = $ruleset->getAsciiReplace();
$shortcode_replace = $ruleset->getShortcodeReplace();

$shortname = html_entity_decode($m[3]);
$unicode = $ascii_replace[$shortname];
$category = $shortcode_replace[$shortname][3];
$titleTag = $this->imageTitleTag ? 'title="'.htmlspecialchars($shortname).'"' : '';

// unicode char or shortname for the alt tag? (unicode is better for copying and pasting the resulting text)
if ($this->unicodeAlt)
{
$alt = $this->convert($unicode);
}
else
{
$alt = htmlspecialchars($shortname);
}

if ($this->sprites)
{
return $m[2].'<span class="emojione emojione-32-'.$category.' _'.$unicode.'" '.$titleTag.'>'.$alt.'</span>';
}
else
{
return $m[2].'<img class="emojione" alt="'.$alt.'" '.$titleTag.' src="'.$this->imagePathPNG.$unicode.'.png"/>';
}
$ascii = html_entity_decode($m[3]);

if ( empty($ascii_replace[$ascii]) )
{
return $m[3];
}
else
{
$shortname = $ascii_replace[$ascii];
$unicode = $shortcode_replace[$shortname][2];
$uc_output = $shortcode_replace[$shortname][0];
$category = $shortcode_replace[$shortname][3];
$titleTag = $this->imageTitleTag ? 'title="'.htmlspecialchars($shortname).'"' : '';

// unicode char or shortname for the alt tag? (unicode is better for copying and pasting the resulting text)
if ($this->unicodeAlt)
{
$alt = $this->convert($uc_output);
}
else
{
$alt = htmlspecialchars($ascii);
}

if ($this->sprites)
{
return $m[2].'<span class="emojione emojione-32-'.$category.' _'.$unicode.'" '.$titleTag.'>'.$alt.'</span>';
}
else
{
return $m[2].'<img class="emojione" alt="'.$alt.'" '.$titleTag.' src="'.$this->imagePathPNG.$unicode.'.png"/>';
}
}
}
}

Expand Down
231 changes: 116 additions & 115 deletions lib/php/src/Ruleset.php
Original file line number Diff line number Diff line change
Expand Up @@ -3647,120 +3647,121 @@ class Ruleset implements RulesetInterface
);

protected $ascii_replace = array(
'*\\0/*' => '1f646',
'\\0/' => '1f646',
'*\\O/*' => '1f646',
'\\O/' => '1f646',
'O:-)' => '1f607',
'0:-3' => '1f607',
'0:3' => '1f607',
'0:-)' => '1f607',
'0:)' => '1f607',
'0;^)' => '1f607',
'O:)' => '1f607',
'O;-)' => '1f607',
'O=)' => '1f607',
'0;-)' => '1f607',
'O:-3' => '1f607',
'O:3' => '1f607',
'</3' => '1f494',
'B-)' => '1f60e',
'B)' => '1f60e',
'8)' => '1f60e',
'8-)' => '1f60e',
'B-D' => '1f60e',
'8-D' => '1f60e',
'-_-' => '1f611',
'-__-' => '1f611',
'-___-' => '1f611',
'>:\\' => '1f615',
'>:/' => '1f615',
':-/' => '1f615',
':-.' => '1f615',
':/' => '1f615',
':\\' => '1f615',
'=/' => '1f615',
'=\\' => '1f615',
':L' => '1f615',
'=L' => '1f615',
':-O' => '1f62e',
':O' => '1f62e',
'O_O' => '1f62e',
'>:O' => '1f62e',
':-X' => '1f636',
':X' => '1f636',
':-#' => '1f636',
':#' => '1f636',
'=X' => '1f636',
'=#' => '1f636',
':\')' => '1f602',
':\'-)' => '1f602',
'\':)' => '1f605',
'\':-)' => '1f605',
'\'=)' => '1f605',
'\':D' => '1f605',
'\':-D' => '1f605',
'\'=D' => '1f605',
'>:)' => '1f606',
'>;)' => '1f606',
'>:-)' => '1f606',
'>=)' => '1f606',
'\':(' => '1f613',
'\':-(' => '1f613',
'\'=(' => '1f613',
'>:P' => '1f61c',
'X-P' => '1f61c',
'>:[' => '1f61e',
':-(' => '1f61e',
':(' => '1f61e',
':-[' => '1f61e',
':[' => '1f61e',
'=(' => '1f61e',
'>:(' => '1f620',
'>:-(' => '1f620',
':@' => '1f620',
':\'(' => '1f622',
':\'-(' => '1f622',
';(' => '1f622',
';-(' => '1f622',
'>.<' => '1f623',
'#-)' => '1f635',
'#)' => '1f635',
'%-)' => '1f635',
'%)' => '1f635',
'X)' => '1f635',
'X-)' => '1f635',
':)' => '1f642',
':-)' => '1f642',
'=]' => '1f642',
'=)' => '1f642',
':]' => '1f642',
':P' => '1f61b',
':-P' => '1f61b',
'=P' => '1f61b',
':-Þ' => '1f61b',
':Þ' => '1f61b',
':-b' => '1f61b',
':b' => '1f61b',
'<3' => '2764-fe0f',
':D' => '1f603',
':-D' => '1f603',
'=D' => '1f603',
';)' => '1f609',
';-)' => '1f609',
'*-)' => '1f609',
'*)' => '1f609',
';-]' => '1f609',
';]' => '1f609',
';D' => '1f609',
';^)' => '1f609',
':*' => '1f618',
':-*' => '1f618',
'=*' => '1f618',
':^*' => '1f618',
'D:' => '1f628',
':$' => '1f633',
'=$' => '1f633'
'*\\0/*' => ':person_gesturing_ok:',
'\\0/' => ':person_gesturing_ok:',
'*\\O/*' => ':person_gesturing_ok:',
'\\O/' => ':person_gesturing_ok:',
'O:-)' => ':innocent:',
'0:-3' => ':innocent:',
'0:3' => ':innocent:',
'0:-)' => ':innocent:',
'0:)' => ':innocent:',
'0;^)' => ':innocent:',
'O:)' => ':innocent:',
'O;-)' => ':innocent:',
'O=)' => ':innocent:',
'0;-)' => ':innocent:',
'O:-3' => ':innocent:',
'O:3' => ':innocent:',
'</3' => ':broken_heart:',
'B-)' => ':sunglasses:',
'B)' => ':sunglasses:',
'8)' => ':sunglasses:',
'8-)' => ':sunglasses:',
'B-D' => ':sunglasses:',
'8-D' => ':sunglasses:',
'-_-' => ':expressionless:',
'-__-' => ':expressionless:',
'-___-' => ':expressionless:',
'>:\\' => ':confused:',
'>:/' => ':confused:',
':-/' => ':confused:',
':-.' => ':confused:',
':/' => ':confused:',
':\\' => ':confused:',
'=/' => ':confused:',
'=\\' => ':confused:',
':L' => ':confused:',
'=L' => ':confused:',
':-O' => ':open_mouth:',
':O' => ':open_mouth:',
'O_O' => ':open_mouth:',
'>:O' => ':open_mouth:',
':-X' => ':no_mouth:',
':X' => ':no_mouth:',
':-#' => ':no_mouth:',
':#' => ':no_mouth:',
'=X' => ':no_mouth:',
'=#' => ':no_mouth:',
':\')' => ':joy:',
':\'-)' => ':joy:',
'\':)' => ':sweat_smile:',
'\':-)' => ':sweat_smile:',
'\'=)' => ':sweat_smile:',
'\':D' => ':sweat_smile:',
'\':-D' => ':sweat_smile:',
'\'=D' => ':sweat_smile:',
'>:)' => ':laughing:',
'>;)' => ':laughing:',
'>:-)' => ':laughing:',
'>=)' => ':laughing:',
'\':(' => ':sweat:',
'\':-(' => ':sweat:',
'\'=(' => ':sweat:',
'>:P' => ':stuck_out_tongue_winking_eye:',
'X-P' => ':stuck_out_tongue_winking_eye:',
'>:[' => ':disappointed:',
':-(' => ':disappointed:',
':(' => ':disappointed:',
':-[' => ':disappointed:',
':[' => ':disappointed:',
'=(' => ':disappointed:',
'>:(' => ':angry:',
'>:-(' => ':angry:',
':@' => ':angry:',
':\'(' => ':cry:',
':\'-(' => ':cry:',
';(' => ':cry:',
';-(' => ':cry:',
'>.<' => ':persevere:',
'#-)' => ':dizzy_face:',
'#)' => ':dizzy_face:',
'%-)' => ':dizzy_face:',
'%)' => ':dizzy_face:',
'X)' => ':dizzy_face:',
'X-)' => ':dizzy_face:',
':)' => ':slight_smile:',
':-)' => ':slight_smile:',
'=]' => ':slight_smile:',
'=)' => ':slight_smile:',
':]' => ':slight_smile:',
':P' => ':stuck_out_tongue:',
':-P' => ':stuck_out_tongue:',
'=P' => ':stuck_out_tongue:',
':-Þ' => ':stuck_out_tongue:',
':Þ' => ':stuck_out_tongue:',
':-b' => ':stuck_out_tongue:',
':b' => ':stuck_out_tongue:',
'<3' => ':heart:',
':D' => ':smiley:',
':-D' => ':smiley:',
'=D' => ':smiley:',
';)' => ':wink:',
';-)' => ':wink:',
'*-)' => ':wink:',
'*)' => ':wink:',
';-]' => ':wink:',
';]' => ':wink:',
';D' => ':wink:',
';^)' => ':wink:',
':*' => ':kissing_heart:',
':-*' => ':kissing_heart:',
'=*' => ':kissing_heart:',
':^*' => ':kissing_heart:',
'D:' => ':fearful:',
':$' => ':flushed:',
'=$' => ':flushed:',
'(y)' => ':thumbsup:'
);

protected $unicode_replace = array(
Expand Down Expand Up @@ -7950,7 +7951,7 @@ class Ruleset implements RulesetInterface
"\x39" => ":digit_nine:"
);

protected $asciiRegexp = '(\\<3|&lt;3|\\<\\/3|&lt;\\/3|\\:\'\\)|\\:\'\\-\\)|\\:D|\\:\\-D|\\=D|\\:\\)|\\:\\-\\)|\\=\\]|\\=\\)|\\:\\]|\'\\:\\)|\'\\:\\-\\)|\'\\=\\)|\'\\:D|\'\\:\\-D|\'\\=D|\\>\\:\\)|&gt;\\:\\)|\\>;\\)|&gt;;\\)|\\>\\:\\-\\)|&gt;\\:\\-\\)|\\>\\=\\)|&gt;\\=\\)|;\\)|;\\-\\)|\\*\\-\\)|\\*\\)|;\\-\\]|;\\]|;D|;\\^\\)|\'\\:\\(|\'\\:\\-\\(|\'\\=\\(|\\:\\*|\\:\\-\\*|\\=\\*|\\:\\^\\*|\\>\\:P|&gt;\\:P|X\\-P|x\\-p|\\>\\:\\[|&gt;\\:\\[|\\:\\-\\(|\\:\\(|\\:\\-\\[|\\:\\[|\\=\\(|\\>\\:\\(|&gt;\\:\\(|\\>\\:\\-\\(|&gt;\\:\\-\\(|\\:@|\\:\'\\(|\\:\'\\-\\(|;\\(|;\\-\\(|\\>\\.\\<|&gt;\\.&lt;|D\\:|\\:\\$|\\=\\$|#\\-\\)|#\\)|%\\-\\)|%\\)|X\\)|X\\-\\)|\\*\\\\0\\/\\*|\\\\0\\/|\\*\\\\O\\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