├── .editorconfig ├── .gitignore ├── .npmignore ├── .travis.yml ├── .versions ├── CONTRIBUTING.md ├── INSTALLATION.md ├── LICENSE.md ├── README.md ├── UPGRADE.md ├── USAGE.md ├── bower.json ├── categories.json ├── composer.json ├── emoji.json ├── emoji_strategy.json ├── examples ├── JAVASCRIPT.md ├── OTHER.md ├── PHP.md └── README.md ├── extras ├── alpha-codes │ ├── CHANGELOG.md │ ├── LICENSE.md │ ├── README.md │ ├── eac.csv │ └── eac.json ├── category_icons │ ├── activity.svg │ ├── diversity.svg │ ├── flags.svg │ ├── food.svg │ ├── nature.svg │ ├── objects.svg │ ├── people.svg │ ├── recent.svg │ ├── symbols.svg │ └── travel.svg ├── css │ ├── emojione-awesome.css │ ├── emojione.css │ └── emojione.min.css └── fonts │ └── README.md ├── gruntfile.js ├── lib ├── android │ ├── README.md │ ├── com │ │ └── emojione │ │ │ └── Emojione.java │ └── generator │ │ ├── .gitignore │ │ ├── Emojione.java │ │ ├── generate.js │ │ └── package.json ├── emojione-awesome │ ├── README.md │ ├── _emojione-awesome.map.scss │ ├── emojione-awesome.scss │ └── generate.js ├── ios │ ├── README.md │ ├── generator │ │ ├── .gitignore │ │ ├── Emojione.m │ │ ├── generate.js │ │ └── package.json │ └── src │ │ ├── Emojione.h │ │ └── Emojione.m ├── js │ ├── emojione.js │ ├── emojione.min.js │ └── tests │ │ ├── generate.js │ │ ├── template.html │ │ ├── tests.html │ │ └── validate.json ├── meteor │ ├── emojione-client.js │ ├── post-export.js │ └── pre-export.js ├── php │ ├── autoload.php │ ├── phpunit.xml.dist │ ├── src │ │ ├── Client.php │ │ ├── ClientInterface.php │ │ ├── Emojione.php │ │ ├── Ruleset.php │ │ └── RulesetInterface.php │ └── test │ │ ├── ConversionTest.php │ │ ├── EmojiTest.php │ │ ├── EmojioneTest.php │ │ └── SpriteTest.php ├── python │ ├── MANIFEST │ ├── README.md │ ├── emojipy │ │ ├── __init__.py │ │ ├── create_ruleset.py │ │ ├── emojipy.py │ │ ├── generated.py │ │ ├── ruleset.py │ │ └── tests │ │ │ ├── __init__.py │ │ │ ├── test_conversion.py │ │ │ ├── test_emojione.py │ │ │ ├── test_ruleset.py │ │ │ └── test_sprite.py │ ├── setup.py │ └── tox.ini ├── swift │ ├── Emojione.playground │ │ ├── Contents.swift │ │ ├── contents.xcplayground │ │ └── playground.xcworkspace │ │ │ ├── contents.xcworkspacedata │ │ │ └── xcuserdata │ │ │ └── rafaelks.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ ├── README.md │ ├── generator │ │ ├── .gitignore │ │ ├── Emojione.swift │ │ ├── generate.js │ │ └── package.json │ └── src │ │ └── Emojione.swift └── tests.md ├── package.js └── package.json /.editorconfig: -------------------------------------------------------------------------------- 1 | # http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | [*] 7 | charset = "utf8" 8 | 9 | 10 | [*.css] 11 | indent_style = space 12 | indent_size = 2 13 | trim_trailing_whitespace = true 14 | 15 | 16 | [*.html] 17 | indent_style = space 18 | indent_size = 4 19 | trim_trailing_whitespace = true 20 | 21 | 22 | [*.js] 23 | indent_style = space 24 | indent_size = 4 25 | trim_trailing_whitespace = true 26 | 27 | 28 | [*.json] 29 | indent_style = space 30 | indent_size = 4 31 | trim_trailing_whitespace = true 32 | 33 | 34 | [*.php] 35 | indent_style = space 36 | indent_size = 4 37 | trim_trailing_whitespace = true -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .idea 3 | .idea/ 4 | /.idea/ 5 | node_modules/ 6 | /node_modules/ 7 | node_modules 8 | .sass-cache 9 | lib/js/tests.html 10 | *.pyc 11 | .tox/ 12 | build/ 13 | emojipy-*/ 14 | emojipy.egg-info/ 15 | npm-debug.log 16 | lib/js/tests/npm-debug.log 17 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | demos 2 | lib/php 3 | lib/js/tests.html 4 | lib/js/js-test 5 | lib/validate.yml 6 | composer.json 7 | .gitignore 8 | emojis.json 9 | .idea 10 | node_modules 11 | .sass-cache 12 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - 5.4 5 | - 5.5 6 | - 5.6 7 | - 7.0 8 | - 7.1 9 | 10 | before_script: 11 | - travis_retry composer self-update 12 | - travis_retry composer install --no-interaction --prefer-source 13 | - npm install -g grunt-cli 14 | - npm install grunt-contrib-qunit 15 | - npm install grunt 16 | 17 | script: 18 | - vendor/bin/phpunit -c lib/php/phpunit.xml.dist 19 | - npm test 20 | -------------------------------------------------------------------------------- /.versions: -------------------------------------------------------------------------------- 1 | babel-compiler@7.1.1 2 | babel-runtime@1.2.4 3 | base64@1.0.11 4 | blaze@2.1.8 5 | blaze-tools@1.0.10 6 | caching-compiler@1.1.12 7 | caching-html-compiler@1.0.6 8 | check@1.3.1 9 | deps@1.0.12 10 | diff-sequence@1.1.0 11 | dynamic-import@0.4.2 12 | ecmascript@0.11.1 13 | ecmascript-runtime@0.7.0 14 | ecmascript-runtime-client@0.7.1 15 | ecmascript-runtime-server@0.7.0 16 | ejson@1.1.0 17 | emojione:emojione@4.0.0 18 | html-tools@1.0.11 19 | htmljs@1.0.11 20 | http@1.4.1 21 | id-map@1.1.0 22 | jquery@1.11.10 23 | meteor@1.9.0 24 | modern-browsers@0.1.1 25 | modules@0.12.2 26 | modules-runtime@0.10.0 27 | mongo-id@1.0.7 28 | observe-sequence@1.0.16 29 | promise@0.11.1 30 | random@1.1.0 31 | reactive-var@1.0.11 32 | spacebars@1.0.12 33 | spacebars-compiler@1.1.0 34 | templating@1.1.12_1 35 | templating-tools@1.1.1 36 | tracker@1.2.0 37 | underscore@1.0.10 38 | url@1.2.0 39 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## How to contribute to the EmojiOne library 2 | --- 3 | ### code format 4 | * Try to maintain the general code convention currently found in the library. 5 | 6 | ### bugs 7 | * Check the current issues to be sure the bug hasn't already been reported. 8 | * If you've written a patch for the bug submit a pull request including your patch. 9 | * Include a brief description of the issue and how your patch will solve it. 10 | * If there are tests available in the library run your patch through them before submitting your pull request. If no tests are available in the library test the patch as thoroughly as possible before submitting. 11 | 12 | ### emoji art 13 | * We unfortunately cannot accept submissions for emoji art revisions. 14 | * Design suggestions are welcome. They will be considered by the designers. There's no guarantee they will be adopted. 15 | * Notes on visual errors are also accepted. 16 | * Please see the [emojione-assets repo](https://www.github.com/emojione/emojione-assets) for more information on submitting artwork suggestions or visual errors. 17 | 18 | 19 | Thank you for your interest in contributing to this library. 20 | 21 | Regards, 22 | EmojiOne Team 23 | -------------------------------------------------------------------------------- /INSTALLATION.md: -------------------------------------------------------------------------------- 1 | ### Installation 2 | 3 | We've teamed up with [JSDelivr](http://www.jsdelivr.com/#!emojione) to provide a simple way to install these emoji on any javascript-enabled website. Add the following script and stylesheet links to the head of your webpage: 4 | 5 | ``` 6 | <script src="https://cdn.jsdelivr.net/npm/emojione@4.0.0/lib/js/emojione.min.js"></script> 7 | <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/emojione@4.0.0/extras/css/emojione.min.css"/> 8 | ``` 9 | 10 | Quick installs can also be done using NPM and Bower (for the Javascript toolkit) or Composer (for the PHP toolkit). **If you wish to serve image assets locally you'll need to install [emojione-assets](https://www.github.com/emojione/emojione-assets) and include the pngs and/or sprites into your project.** Many of our [demos](https://demos.emojione.com/latest/) use assets locally simply by pointing the `imagePathPNG` variable to your local asset location. 11 | 12 | #### NPM 13 | ``` 14 | > npm install emojione 15 | ``` 16 | 17 | #### Bower 18 | ``` 19 | > bower install emojione 20 | ``` 21 | 22 | 23 | #### Composer 24 | ``` 25 | $ composer require emojione/emojione 26 | ``` 27 | 28 | #### Meteor 29 | ``` 30 | meteor add emojione:emojione 31 | ``` 32 | 33 | ### Version 2 Installation 34 | EmojiOne version 2 is no longer supported or distributed. 35 | 36 | 37 | ### Character Encoding — UTF-8 38 | 39 | If you're getting serious about implementing emoji into your website, you will want to consider your web stack's character encoding. You should make sure that all connection points are using the same encoding. There are a lot of options and configuration possibilities here, so you'll have to figure what works best for your own situation. 40 | 41 | A quick Google search will bring up a lot of information on how to get your entire web stack to use UTF-8, which is needed to properly handle Unicode emoji. 42 | 43 | To get you started, here's a nice guide: [UTF-8: The Secret of Character Encoding](http://htmlpurifier.org/docs/enduser-utf8.html). 44 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | #### EmojiOne Artwork 2 | 3 | * Applies to all PNG files found in the emojione-assets repo as well as any adaptations made. 4 | * Free license: [emojione.com/licenses/free](https://www.emojione.com/licenses/free) 5 | * Premium license: [emojione.com/licenses/premium](https://www.emojione.com/licenses/premium) 6 | 7 | 8 | #### EmojiOne Non-Artwork 9 | 10 | * Applies to the Javascript, JSON, PHP, CSS, HTML files, and everything else not covered under the artwork license above, found in both the emojione and emojione-assets repos. 11 | * License: MIT 12 | * Complete Legal Terms: http://opensource.org/licenses/MIT 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # This repository is now maintained as JoyPixels/emoji-toolkit. 2 | You'll find the latest version of our resources at [emoji-toolkit](https://github.com/joypixels/emoji-toolkit). Please see the [UPGRADE README](https://github.com/joypixels/emoji-toolkit/blob/master/UPGRADE.md) for important information on what's changed from this repository. Thank you! 3 | 4 | #  5 | 6 | > [](https://www.npmjs.com/package/emojione) [](https://www.npmjs.com/package/emojione) [](https://www.jsdelivr.com/package/npm/emojione) 7 | 8 | A set of libraries to help users find and replace native system emojis with EmojiOne in their app or website. 9 | 10 | 11 | ## What's Included? 12 | 13 | - This project includes libraries used to convert emoji into various formats, including conversion to EmojiOne emoji images. 14 | - All libraries included here are available free under the MIT license. 15 | 16 | 17 | ## License to Use EmojiOne Images 18 | 19 | ### EmojiOne Version 4 20 | EmojiOne Version 4 is available under the same licensing structure as Version 3. Please see below for more details. 21 | 22 | ### EmojiOne Version 3+ 23 | 24 | EmojiOne launched version 3.0 in 2017, which has several licensing options available. PNG 32px, 64px, and 128px as well as 32px and 64px sprites are available for digital use, with attribution. See [https://www.emojione.com/licenses/free](https://www.emojione.com/licenses/free) for more information on usage and attribution requirements. 25 | 26 | *Premium Licenses are available for larger PNG assets and SVG assets, for digital and print use (within budget constraints).* See [https://www.emojione.com/licenses/premium](https://www.emojione.com/licenses/premium) for more information or to obtain a Premium License. 27 | 28 | For product/retail licensing, visit [https://www.joypixels.com](https://www.joypixels.com). 29 | 30 | ### EmojiOne Version 2 31 | 32 | EmojiOne version 2 is no longer supported or distributed. Please see [UPGRADE.md](UPGRADE.md) for instructions on upgrading from version 2 to version 3. Version 2 was bound by the [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/). 33 | 34 | 35 | ## Installation 36 | To install emojione, please refer to the guide at [INSTALLATION.md](INSTALLATION.md). **Version 3 introduces many potentially-breaking changes.** Refer to the [UPGRADE.md](UPGRADE.md) documentation for more details. 37 | 38 | 39 | ## Contributing 40 | Please see [CONTRIBUTING.md](CONTRIBUTING.md) for more info on contributing to the emojione project. For artwork comments and questions please see the emojione-assets repo. 41 | 42 | ## Usage 43 | You'll find basic usage examples here in the [/examples/](examples/) directory, and links to usage demos in [USAGE.md](USAGE.md). 44 | 45 | 46 | ## Information 47 | 48 | ### Bug reports 49 | 50 | If you discover any bugs, feel free to create an issue on GitHub. We also welcome the open-source community to contribute to the project by forking it and issuing pull requests. 51 | 52 | * https://github.com/emojione/emojione/issues 53 | 54 | 55 | ### Contact 56 | 57 | If you have any questions, comments, or concerns you are welcome to contact us. 58 | 59 | * [](https://gitter.im/emojione/emojione?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) 60 | * [support@emojione.com](mailto:support@emojione.com) 61 | * http://emojione.com 62 | * https://twitter.com/emojione 63 | 64 | 65 | ### Alternatives 66 | We sincerely hope that you choose to use EmojiOne and support our project, but if you feel like it's not for you, please have a look at these possible alternatives: 67 | 68 | * https://github.com/hassankhan/emojify.js 69 | * https://github.com/emojidex/ (used to be known as [Phantom Open Emoji](https://github.com/Genshin/PhantomOpenEmoji)) 70 | * https://github.com/iamcal/emoji-data (with [PHP](https://github.com/iamcal/php-emoji) and [Javascript](https://github.com/iamcal/js-emoji) interfaces) 71 | * https://github.com/node-modules/emoji 72 | * https://github.com/steveklabnik/emoji 73 | * https://github.com/rockerhieu/emojicon 74 | * https://github.com/HenrikJoreteg/emoji-images 75 | * https://github.com/frissdiegurke/emoji-parser 76 | * https://github.com/muan/emojilib 77 | * https://github.com/kcthota/emoji4j 78 | -------------------------------------------------------------------------------- /UPGRADE.md: -------------------------------------------------------------------------------- 1 | # Upgrading from emojione v2 to emojione v3+ 2 | 3 | * emojione v3 brought about several breaking changes and new considerations 4 | * please review EmojiOne Licensing for more information on using SVG or PNG (larger than 128px) assets 5 | 6 | ## Libraries 7 | **JS** 8 | - Deprecated vars: 9 | - [emojione.js] imagePathSVG, imagePathSVGSprites, imageType (now defaulted to png) 10 | - Tests also updated (added explicit protocol for cdn, included previously-added title attribute to img tag) 11 | - Added vars: 12 | - emojiVersion (str) 13 | - emojiSize (str) 14 | - greedyMatch (bool) 15 | - blacklistChars (bool) 16 | - spriteSize (str) 17 | - riskyMatchAscii (bool) 18 | - fileExtension (str) 19 | 20 | **PHP** 21 | - Deprecated vars: 22 | - [src/Client.php] imagePathSVG, imagePathSVGSprites 23 | - [src/Emojione.php] imagePathSVG, imagePathSVGSprites, imageType 24 | - Added vars: 25 | - emojiVersion (str) 26 | - emojiSize (str) 27 | - greedyMatch (bool) 28 | - blacklistChars (str) 29 | - spriteSize (str) 30 | - riskyMatchAscii (bool) 31 | - fileExtension (str) 32 | - Tests 33 | - [tests/ConversionTest.php] removed testSmileyInsideAnObject() 34 | - [tests/ConversionTest.php] removed testShortnameInsideOfObjectTag() 35 | 36 | ## Demos 37 | Replaced by ‘examples’. Contains code snippets of each of the functions previously demonstrated. Updated demos can be found at <a href="https://demos.emojione.com/latest"></a>. 38 | 39 | ## JSON Files 40 | **EMOJI.JSON (updated)** 41 | - primary key is now *base code point* rather than shortname 42 | - base code point is the full unicode code point minus VS16 and ZWJ 43 | - base code point is used as an identifier for emoji file names (PNG) as well as within sprites (CSS) 44 | - **name** (str) 45 | - **unicode_version** (num) - floating-point number indicating initial Unicode release 46 | - **category** (str) - key for `category` property in `emoji_categories.json` 47 | - **emoji_order** (num) is now simply **order** (num) 48 | - **display** (num) determines whether an emoji should be shown on a keyboard 49 | - **shortname** (str) colon-encapsulated, snake_case representation of the emoji name 50 | - **aliases** (array) is now **shortname_alternates** (array) alternative (including previously-used) shortnames 51 | - **aliases_ascii** (array) is now **ascii** (array) 52 | - **diversity** (str) is either `null` or the base code point of the corresponding Fitzpatrick Emoji Modifier 53 | - **diversities** (array) contains the base code points of the diversity children for a diversity parent (non-diverse, diversity base) 54 | - **gender** (str) is either `null` or the base code point of the corresponding male/female emoji symbol 55 | - **genders** (array) contains the base code points of the gender children for a gender parent (gender-neutral, gender base) 56 | - **unicode** (str) and **unicode_alt** (str) are depricated. code points are now organized within **code_points** (array) 57 | - **base** (str) is identical to the primary key 58 | - **fully_qualified** (str) represents code point according to [this Unicode documentation](http://unicode.org/Public/emoji/11.0/emoji-test.txt) 59 | - **non_fully_qualified** (str) derived from same documentation as FQ. NFQ code point convention is used for PNG file names in font file builds 60 | - **output** (str) is the recommended code point to use for conversion to native unicode 61 | - **match_default** (array) contains one or more code points used to identify native unicode 62 | - **match_greedy** (array) contains one or more code points used to identify potential native unicode variants 63 | - note: the match_greedy code point(s) may replace non-emoji variants producing undesired results 64 | - **decimal** (str) replaces **code_decimal** (str) 65 | - **keywords** (array) 66 | 67 | **EMOJI_STRATEGY.JSON (updated)** 68 | - primary key is now *base code point* rather than short name 69 | - **aliases** (str) is now **shortname_alternates** (array) 70 | - **keywords** (str) is now **keywords** (array) 71 | - **unicode** (str) is now **unicode_output** (str) 72 | 73 | **EMOJI_CATEGORIES.JSON (new)** 74 | - **order** (str) 75 | - **category** (str) 76 | - **category_label** (str) 77 | 78 | ## Shortname Changes 79 | Along with the many changes to emojione version 3.0 comes a number of shortname updates. **Any shortnames that change will still appear as an alternate shortname (or alias) in the data files.** You can view the complete list of primary shortname changes in the [extras/alpha-codes readme](extras/alpha-codes/). 80 | -------------------------------------------------------------------------------- /USAGE.md: -------------------------------------------------------------------------------- 1 | # emojione Usage 2 | 3 | ## Object Properties 4 | 5 | Both PHP and JavaScript libraries now have wider range of available properties. The following are available for both libraries. 6 | 7 | - `emojiVersion` (str) - Used only to direct CDN path. This is a 2-digit version (e.g. '3.1'). Not recommended for usage below 3.0.0. 8 | - `emojiSize` (str) **Default: `32`** - Used only to direct CDN path for non-sprite PNG usage. Available options are '32', '64', and '128'. 9 | - `imagePathPNG` (str) - Defaults to CDN (jsdelivr) path. Setting as alternate path overwrites `emojiSize` option. 10 | - `fileExtension` (str) - Defaults to .png. Set to '.svg' if using premium assets (.svg) locally. 11 | - `greedyMatch` (bool) **Default: `false`** - When `true`, matches non-fully-qualified Unicode values. 12 | - `blacklistChars` (str) **Default: `''`** - Comma-separated list of characters that should not be replaced. For example, setting to `'#,*'` ensures pound and asterisk symbols are not replaced. 13 | - `imageTitleTag` (bool) **Default: `true`** - When `false`, removes title attribute from <img> tag. 14 | - `sprites` (bool) **Default: `false`** - When `true`, sprite markup will be used. Sprite CSS and PNG assets must be additionally included. 15 | - `spriteSize` (str) **Default `32`** - Alternate size is `64`. 16 | - `unicodeAlt` (bool) **Default `false`** - When `true`, sets unicode char as alt attribute for ability to copy image as unicode. 17 | - `ascii` (bool) **Default `false`** - When `true`, matches ASCII characters (in `unicodeToImage` and `shortnameToImage` functions). 18 | - `riskyMatchAscii` (bool) **Default `false`** - When `true`, matches ASCII characters not encapsulated by spaces. Can cause issues when matching (e.g. `C://filepath` or `<button>.</button>` both contain ASCII chars). 19 | 20 | 21 | ## Usage Examples 22 | 23 | Below there are some examples of how you will actually use the libraries to convert Unicode emoji characters to :shortnames: and :shortnames: to emoji images. 24 | 25 | 26 | ### Javascript Conversion 27 | 28 | 29 | **[.toShort\(str\)](https://demos.emojione.com/latest/jstoshort.html)** - _native unicode -> shortnames_ 30 | 31 | This demo shows you how to take native unicode emoji input, such as that from your mobile device, and translate it to their corresponding shortnames. (we recommend this for database storage) 32 | 33 | **[.shortnameToImage\(str\)](https://demos.emojione.com/latest/jsshortnametoimage.html)** - _shortname -> images_ 34 | 35 | This demo shows you how to take input containing only shortnames and translate it directly to EmojiOne images. (when displaying the unified input to clients) 36 | 37 | **[.toImage\(str\)](https://demos.emojione.com/latest/jstoimage.html)** - _native unicode + shortnames -> images (mixed input)_ 38 | 39 | This demo shows you how to take input containing both native unicode emoji and shortnames, and translate it into EmojiOne images for display. 40 | 41 | 42 | ### PHP Conversion 43 | 44 | ##### As of version 1.4.1 this library syntax has changed. 45 | 46 | **[toShort\($str\)](https://demos.emojione.com/latest/phptoshort.php)** - _native unicode -> shortnames_ 47 | 48 | This demo shows you how to take native unicode emoji input, such as that from your mobile device, and translate it to their corresponding shortnames. (we recommend this for database storage) 49 | 50 | **[shortnameToImage\($str\)](https://demos.emojione.com/latest/phpshortnametoimage.php)** - _shortname -> images_ 51 | 52 | This demo shows you how to take input containing only shortnames and translate it directly to EmojiOne images. (when displaying the unified input to clients) 53 | 54 | **[toImage\($str\)](https://demos.emojione.com/latest/phptoimage.php)** - _native unicode + shortnames -> images (mixed input)_ 55 | 56 | This demo shows you how to take input containing both native unicode emoji and shortnames, and translate it into EmojiOne images for display. 57 | 58 | 59 | ##### Note: As of version 1.4.1 the following implementation has been deprecated. It's included in the library for backwards compatibility but will be removed at a later date. 60 | 61 | **[::toShort\($str\)](https://demos.emojione.com/1.4.0/phptoshort.php)** - _native unicode -> shortnames_ 62 | 63 | This demo shows you how to take native unicode emoji input, such as that from your mobile device, and translate it to their corresponding shortnames. (we recommend this for database storage) 64 | 65 | **[::shortnameToImage\($str\)](https://demos.emojione.com/1.4.0/phpshortnametoimage.php)** - _shortname -> images_ 66 | 67 | This demo shows you how to take input containing only shortnames and translate it directly to EmojiOne images. (when displaying the unified input to clients) 68 | 69 | **[::unicodeToImage\($str\)](https://demos.emojione.com/1.4.0/phpunicodetoimage.php)** - _native unicode -> images_ 70 | 71 | This demo shows you how to take native unicode emoji input, such as that from your mobile device, and translate it directly to EmojiOne images. (would be great for a live editor preview) 72 | 73 | **[::toImage\($str\)](https://demos.emojione.com/1.4.0/phptoimage.php)** - _native unicode + shortnames -> images (mixed input)_ 74 | 75 | This demo shows you how to take input containing both native unicode emoji and shortnames, and translate it into EmojiOne images for display. 76 | 77 | ### Meteor Conversion 78 | 79 | #### Template helpers 80 | 81 | ```handlebars 82 | My emoji {{> emojione ':beers:'}} text. 83 | ``` 84 | 85 | Or 86 | 87 | ```handlebars 88 | {{#emojione}}My emoji :beers: text.{{/emojione}} 89 | ``` 90 | 91 | ### Swift Conversion 92 | 93 | ```swift 94 | Emojione.transform(string: "Rocket.Chat: :rocket:") 95 | ``` 96 | 97 | ### Extras 98 | 99 | **[shortnameToUnicode(str)](https://demos.emojione.com/latest/shortnametounicode.html)** 100 | 101 | Change from shortnames to native unicode emoji. 102 | 103 | **[Shortname Autocomplete](https://demos.emojione.com/latest/autocomplete.html)** 104 | 105 | Easily add shortname autocomplete functionality to any text input on your page. 106 | 107 | **[ASCII Smiley Conversion](https://demos.emojione.com/latest/ascii-smileys.html)** 108 | 109 | With one quick step you can start converting common ASCII smileys to their corresponding images. 110 | 111 | **[Alternate Alt Tags](https://demos.emojione.com/latest/alternate-alt-tags.html)** 112 | 113 | Change from the native unicode emoji in the resulting alt tags to their shortnames instead. 114 | 115 | **[Live Preview Box](https://demos.emojione.com/latest/live-preview.html)** 116 | 117 | Display converted Emoji in a preview box as the user is typing. 118 | 119 | **[Conversion HTML Class](https://demos.emojione.com/latest/class-convert.html)** 120 | 121 | Stick a class of .emojione-convert on any HTML element and automatically convert native unicode emoji and/or shortnames to images after page load. 122 | 123 | **[Convert on Form Submission](https://demos.emojione.com/latest/convert-on-submit.html)** 124 | 125 | Converts unicode input to shortnames once the user submits the form. 126 | 127 | **[Sprites (PNG)](https://demos.emojione.com/latest/sprites-png.html)** 128 | 129 | With an additional CSS file you can use EmojiOne as resizable PNG sprites (up to 64x64). 130 | 131 | **[Sprites (SVG)](https://demos.emojione.com/latest/sprites-svg.html)** 132 | 133 | This sprite method requires no extra CSS, and is infinitely resizable. 134 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "emojione", 3 | "version": "4.0.0", 4 | "main": [ 5 | "extras/css/emojione.css", 6 | "lib/js/emojione.js" 7 | ], 8 | "ignore": [ 9 | "demos/", 10 | "lib/php/", 11 | ".gitignore", 12 | ".npmignore", 13 | "composer.json", 14 | "package.json" 15 | ], 16 | "keywords": [ 17 | "emojione", 18 | "EmojiOne", 19 | "emoji", 20 | "emojis", 21 | "emoticons", 22 | "smileys", 23 | "smilies", 24 | "unicode", 25 | "emoji set" 26 | ] 27 | } -------------------------------------------------------------------------------- /categories.json: -------------------------------------------------------------------------------- 1 | [{"order":1,"category":"people","category_label":"Smileys & People"},{"order":2,"category":"nature","category_label":"Animals & Nature"},{"order":3,"category":"food","category_label":"Food & Drink"},{"order":4,"category":"activity","category_label":"Activity"},{"order":5,"category":"travel","category_label":"Travel & Places"},{"order":6,"category":"objects","category_label":"Objects"},{"order":7,"category":"symbols","category_label":"Symbols"},{"order":8,"category":"flags","category_label":"Flags"}] -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "emojione/emojione", 3 | "type": "library", 4 | "description": "EmojiOne is a complete set of emojis designed for the web. It includes libraries to easily convert unicode characters to shortnames (:smile:) and shortnames to our custom emoji images. PNG format provided for the emoji images.", 5 | "keywords": ["emojione","EmojiOne","emoji","emojis","emoticons","smileys","smilies","unicode"], 6 | "homepage": "http://www.emojione.com", 7 | "license": "(CC-BY-4.0 and MIT)", 8 | "autoload": { 9 | "psr-4": { 10 | "Emojione\\": "lib/php/src" 11 | } 12 | }, 13 | "require": { 14 | "php": ">=5.3" 15 | }, 16 | "require-dev": { 17 | "phpunit/phpunit": "~4.6 || ~5.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /examples/JAVASCRIPT.md: -------------------------------------------------------------------------------- 1 | # EmojiOne 2 | 3 | ## **Javascript Implementation Examples** 4 | 5 | The following Javascript code snippets demonstrate common usages of EmojiOne within your project. 6 | 7 | ---------- 8 | 9 | ## .shortnameToImage(str) 10 | *Convert Shortnames to Images* 11 | 12 | If you've chosen to unify your inputted text so that it contains only shortnames then this is the function (or its matching PHP function) you will want to use to convert the shortnames images when displaying it to the client. 13 | 14 | **HTML:** 15 | `<input type="button" value="Convert" onclick="convert()"/>` 16 | 17 | **Javascript Snippet** 18 | ```javascript 19 | function convert() { 20 | var input = document.getElementById('inputText').value; 21 | var output = emojione.shortnameToImage(input); 22 | document.getElementById('outputText').innerHTML = output; 23 | } 24 | ``` 25 | 26 | ---------- 27 | 28 | ## .toImage(str) 29 | *Convert Native Unicode Emoji and Shortnames Directly to Images* 30 | 31 | This function is simply a shorthand for **.unicodeToImage(str)** and **.shortnameToImage(str)**. First it will convert native unicode emoji directly to images and then convert any shortnames to images. This function can be useful to take mixed input and convert it directly to images if, for example, you wanted to give clients a live preview of their inputted text. Also, if your source text contains both unicode characters and shortnames (you didn't unify it) then this function will be useful to you. 32 | 33 | **HTML:** 34 | `<input type="button" value="Convert" onclick="convert()"/>` 35 | 36 | **Javascript Snippet** 37 | ```javascript 38 | function convert() { 39 | var input = document.getElementById('inputText').value; 40 | var output = emojione.toImage(input); 41 | document.getElementById('outputText').innerHTML = output; 42 | } 43 | ``` 44 | 45 | ---------- 46 | 47 | ## .toShort(str) 48 | *Convert Native Unicode Emoji to Shortnames* 49 | 50 | Our recommendation is to unify all user inputted text by converting native unicode emoji, such as those inputted by mobile devices, to their corresponding shortnames. This demo shows you how to use the **.toShort(str)** Javascript function provided in our toolkit to do just that. 51 | 52 | **HTML:** 53 | `<input type="button" value="Convert" onclick="convert()"/>` 54 | 55 | **Javascript Snippet** 56 | ```javascript 57 | function convert() { 58 | var input = document.getElementById('inputText').value; 59 | var output = emojione.toShort(input); 60 | document.getElementById('outputText').innerHTML = output; 61 | } 62 | ``` 63 | 64 | ---------- 65 | 66 | ## .shortnameToUnicode(str) 67 | *Convert Shortnames to Native Unicode* 68 | 69 | If you'd like to convert shortnames back to native unicode emoji characters, you can use this function. 70 | 71 | **Javascript Snippet** 72 | ````javascript 73 | function convert() { 74 | var input = document.getElementById('inputText').value; 75 | var output = emojione.shortnameToUnicode(input); 76 | document.getElementById('outputText').innerHTML = output; 77 | } 78 | ```` -------------------------------------------------------------------------------- /examples/PHP.md: -------------------------------------------------------------------------------- 1 | # EmojiOne 2 | 3 | ## **PHP Implementation Examples** 4 | 5 | The following PHP code snippets demonstrate common usages of EmojiOne within your project. 6 | 7 | ---------- 8 | 9 | ## shortnameToImage($str) 10 | *Convert Shortnames to Images* 11 | 12 | If you've chosen to unify your inputted text so that it contains only shortnames then this is the function (or its matching Javascript function) you will want to use to convert the shortnames images when displaying it to the client. 13 | 14 | **PHP Snippet** 15 | ```php 16 | namespace Emojione; 17 | 18 | // include the PHP library (if not autoloaded) 19 | require('./../lib/php/autoload.php'); 20 | 21 | $client = new Client(new Ruleset()); 22 | 23 | // ############################################### 24 | // if you want to host the images somewhere else 25 | // you can easily change the default paths 26 | $client->imagePathPNG = './../assets/png/'; // defaults to jsdelivr's free CDN 27 | // ############################################### 28 | 29 | if(isset($_POST['inputText'])) { 30 | echo $client->shortnameToImage($_POST['inputText']); 31 | } 32 | ``` 33 | 34 | ---------- 35 | 36 | ## toImage($str) 37 | *Convert Native Unicode Emoji and Shortnames Directly to Images* 38 | 39 | This function is simply a shorthand for **unicodeToImage($str)** and **shortnameToImage($str)**. First it will convert native unicode emoji directly to images and then convert any shortnames to images. This function can be useful to take mixed input and convert it directly to images if, for example, you have native unicode emoji stored in your database alongside shortnames. 40 | 41 | **PHP Snippet** 42 | ```php 43 | namespace Emojione; 44 | 45 | // include the PHP library (if not autoloaded) 46 | require('./../lib/php/autoload.php'); 47 | 48 | $client = new Client(new Ruleset()); 49 | 50 | // ############################################### 51 | // if you want to host the images somewhere else 52 | // you can easily change the default paths 53 | $client->imagePathPNG = './../assets/png/'; // defaults to jsdelivr's free CDN 54 | // ############################################### 55 | 56 | if(isset($_POST['inputText'])) { 57 | echo $client->toImage($_POST['inputText']); 58 | } 59 | ``` 60 | 61 | ---------- 62 | 63 | ## toShort($str) 64 | *Convert Native Unicode Emoji to Shortnames* 65 | 66 | Our recommendation is to unify all user inputted text by converting native unicode emoji, such as those inputted by mobile devices, to their corresponding shortnames. This demo shows you how to use the **toShort($str)** PHP function provided in our toolkit to do just that. 67 | 68 | **PHP Snippet** 69 | ```php 70 | namespace Emojione; 71 | 72 | // include the PHP library (if not autoloaded) 73 | require('./../lib/php/autoload.php'); 74 | 75 | $client = new Client(new Ruleset()); 76 | 77 | if(isset($_POST['inputText'])) { 78 | echo $client->toShort($_POST['inputText']); 79 | } 80 | ``` 81 | 82 | ---------- 83 | 84 | ## shortnameToUnicode($str) 85 | *Convert Shortnames to Native Unicode* 86 | 87 | If you'd like to convert shortnames back to native unicode emoji characters, you can use this function. 88 | 89 | **PHP Snippet** 90 | ```php 91 | namespace Emojione; 92 | 93 | // include the PHP library (if not autoloaded) 94 | require('./../lib/php/autoload.php'); 95 | 96 | $client = new Client(new Ruleset()); 97 | 98 | if(isset($_POST['inputText'])) { 99 | echo $client->shortnameToUnicode($_POST['inputText']); 100 | } 101 | ``` -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | # EmojiOne 2 | 3 | ## **Project Implementation Examples** 4 | 5 | To assist you in getting started with EmojiOne in your project, we've included examples of our core functionalities; primarily Javascript and PHP. Specific examples for other libraries like iOS and Android may be available within their library roots directories. 6 | 7 | *See JAVASCIPT.md, PHP.md, and OTHER.md documents within this directory.* 8 | 9 | ---------- 10 | 11 | ## Demos 12 | 13 | You may also want to visit our <a href="https://demos.emojione.com/latest/" target="_blank">Live Demos</a> to see the examples in action. -------------------------------------------------------------------------------- /extras/alpha-codes/CHANGELOG.md: -------------------------------------------------------------------------------- 1 | changelog 2 | --------- 3 | 4 | ####UPDATE 2017-06-30 5 | * additions 6 | * Unicode 10 charcters 7 | 8 | * changes 9 | * inclusion of output code point attribute, used to generate native Unicode 10 | 11 | 12 | ####UPDATE 2017-04-15 13 | * additions 14 | * gender based roles 15 | * aliases for diversity naming convention (e.g. tone1 = light_skin_tone) 16 | 17 | * changes 18 | * in a previous version, csv columns were renamed to more closely match the json attribute labels. now we've updated "alpha code" to "alpha_code" for closer alignment 19 | * we've removed the versioning from this data set now that it's part of the emojione repo 20 | 21 | 22 | ####1.1 / 2016-07-19 23 | 24 | * additions 25 | * all of unicode 9 26 | * :gay_pride_flag: 27 | 28 | * important note 29 | * because aliases are pipe-delimited strings, we have removed square bracket encapsulation and replaced with double-quote encapsulation 30 | 31 | ####0.9 / 2016-04-05 32 | 33 | * additions 34 | * :paw_prints: alias to paw prints 35 | * :thumbup: alias to thumbs up sign 36 | * :thumbup_tone1: alias to thumbs up sign tone 1 37 | * :thumbup_tone2: alias to thumbs up sign tone 2 38 | * :thumbup_tone3: alias to thumbs up sign tone 3 39 | * :thumbup_tone4: alias to thumbs up sign tone 4 40 | * :thumbup_tone5: alias to thumbs up sign tone 5 41 | * :thumbdown: alias to thumbs down sign 42 | * :thumbdown_tone1: alias to thumbs down sign tone 1 43 | * :thumbdown_tone2: alias to thumbs down sign tone 2 44 | * :thumbdown_tone3: alias to thumbs down sign tone 3 45 | * :thumbdown_tone4: alias to thumbs down sign tone 4 46 | * :thumbdown_tone5: alias to thumbs down sign tone 5 47 | 48 | ####0.8 / 2015-12-17 49 | 50 | * Initial commit 51 | -------------------------------------------------------------------------------- /extras/alpha-codes/LICENSE.md: -------------------------------------------------------------------------------- 1 | #### License 2 | 3 | * License: MIT 4 | * Complete Legal Terms: http://opensource.org/licenses/MIT -------------------------------------------------------------------------------- /extras/alpha-codes/README.md: -------------------------------------------------------------------------------- 1 | # Emoji Alpha Codes 2 | 3 | ### WHAT ARE EMOJI ALPHA CODES? 4 | 5 | An EAC (some know them as cheat codes, shortnames, or short codes) are emoji keywords wrapped in colons such as :emoji: as an alternative/convenient method to inserting emoij graphics directly into message forms without having to use a separate emoji picker or pasting the emoji unicode. 6 | 7 | ### PURPOSE OF THIS DATA 8 | 9 | The purpose is to unify various alpha code lists into a single table developers could contribute to and share. With a few different tables floating around, we've done our best to organize and de-fragment the tables. To do this, we've divided the codes into a primary and secondary category. The single "primary" EAC code is the main identifier and the "secondary" EAC code(s) are alternatives. This gives the site developer the option to allow either a primary or secondary code to be entered to call a single emoji. 10 | 11 | Our goal here is to help everyone involved and we appreciate contributions to this list. Please know we don't recommend the primary EAC's change unless there's a major reason for it. 12 | 13 | ### THE FILES 14 | 15 | We've included the current list of emoji alpha codes in two formats, json and csv. In each file the data is primarily arranged by unicode code point. The files are structured as such. 16 | 17 | ##### JSON 18 | 19 | ``` 20 | { 21 | "1f600": { 22 | "output": "1f601", 23 | "name": "grinning face", 24 | "alpha_code": ":grinning:", 25 | "aliases": "" 26 | }, 27 | "1f642": { 28 | "output": "1f642", 29 | "name": "slightly smiling face", 30 | "alpha_code": ":slight_smile:", 31 | "aliases": ":slightly_smiling_face:" 32 | }, 33 | "1f36e": { 34 | "output": "1f46e", 35 | "name": "custard", 36 | "alpha_code": ":custard:", 37 | "aliases": ":pudding:|:flan:" 38 | } 39 | } 40 | ``` 41 | 42 | ##### CSV 43 | 44 | ``` 45 | “unicode”, "output", “name”, "alpha_code”, “aliases” 46 | ``` 47 | 48 | ### LICENSE 49 | 50 | * License: MIT 51 | * Complete Legal Terms: http://opensource.org/licenses/MIT 52 | 53 | ### PRIMARY SHORTNAME CHANGES 54 | The following is a list of shortnames that have been moved into the ":aliases:" column and replaced by a new primary shortname (alpha code), as of the emojione 3.0 update (April 2017). 55 | 56 | ``` 57 | Previous Shortname,New Shortname 58 | 59 | :golfer:,:person_golfing: 60 | 61 | :man_with_turban:,:person_wearing_turban: 62 | 63 | :man_with_turban_tone1:,:person_wearing_turban_tone1: 64 | 65 | :man_with_turban_tone2:,:person_wearing_turban_tone2: 66 | 67 | :man_with_turban_tone3:,:person_wearing_turban_tone3: 68 | 69 | :man_with_turban_tone4:,:person_wearing_turban_tone4: 70 | 71 | :man_with_turban_tone5:,:person_wearing_turban_tone5: 72 | 73 | :man_with_gua_pi_mao:,:man_with_chinese_cap: 74 | 75 | :man_with_gua_pi_mao_tone1:,:man_with_chinese_cap_tone1: 76 | 77 | :man_with_gua_pi_mao_tone2:,:man_with_chinese_cap_tone2: 78 | 79 | :man_with_gua_pi_mao_tone3:,:man_with_chinese_cap_tone3: 80 | 81 | :man_with_gua_pi_mao_tone4:,:man_with_chinese_cap_tone4: 82 | 83 | :man_with_gua_pi_mao_tone5:,:man_with_chinese_cap_tone5: 84 | 85 | :dancers:,:people_with_bunny_ears_partying: 86 | 87 | :runner:,:person_running: 88 | 89 | :runner_tone1:,:person_running_tone1: 90 | 91 | :runner_tone2:,:person_running_tone2: 92 | 93 | :runner_tone3:,:person_running_tone3: 94 | 95 | :runner_tone4:,:person_running_tone4: 96 | 97 | :runner_tone5:,:person_running_tone5: 98 | 99 | :walking:,:person_walking: 100 | 101 | :walking_tone1:,:person_walking_tone1: 102 | 103 | :walking_tone2:,:person_walking_tone2: 104 | 105 | :walking_tone3:,:person_walking_tone3: 106 | 107 | :walking_tone4:,:person_walking_tone4: 108 | 109 | :walking_tone5:,:person_walking_tone5: 110 | 111 | :haircut:,:person_getting_haircut: 112 | 113 | :haircut_tone1:,:person_getting_haircut_tone1: 114 | 115 | :haircut_tone2:,:person_getting_haircut_tone2: 116 | 117 | :haircut_tone3:,:person_getting_haircut_tone3: 118 | 119 | :haircut_tone4:,:person_getting_haircut_tone4: 120 | 121 | :haircut_tone5:,:person_getting_haircut_tone5: 122 | 123 | :massage:,:person_getting_massage: 124 | 125 | :massage_tone1:,:person_getting_massage_tone1: 126 | 127 | :massage_tone2:,:person_getting_massage_tone2: 128 | 129 | :massage_tone3:,:person_getting_massage_tone3: 130 | 131 | :massage_tone4:,:person_getting_massage_tone4: 132 | 133 | :massage_tone5:,:person_getting_massage_tone5: 134 | 135 | :shrug:,:person_shrugging: 136 | 137 | :shrug_tone1:,:person_shrugging_tone1: 138 | 139 | :shrug_tone2:,:person_shrugging_tone2: 140 | 141 | :shrug_tone3:,:person_shrugging_tone3: 142 | 143 | :shrug_tone4:,:person_shrugging_tone4: 144 | 145 | :shrug_tone5:,:person_shrugging_tone5: 146 | 147 | :face_palm:,:person_facepalming: 148 | 149 | :face_palm_tone1:,:person_facepalming_tone1: 150 | 151 | :face_palm_tone2:,:person_facepalming_tone2: 152 | 153 | :face_palm_tone3:,:person_facepalming_tone3: 154 | 155 | :face_palm_tone4:,:person_facepalming_tone4: 156 | 157 | :face_palm_tone5:,:person_facepalming_tone5: 158 | 159 | :wrestlers:,:people_wrestling: 160 | 161 | :cop:,:police_officer: 162 | 163 | :cop_tone1:,:police_officer_tone1: 164 | 165 | :cop_tone2:,:police_officer_tone2: 166 | 167 | :cop_tone3:,:police_officer_tone3: 168 | 169 | :cop_tone4:,:police_officer_tone4: 170 | 171 | :cop_tone5:,:police_officer_tone5: 172 | 173 | :spy:,:detective: 174 | 175 | :spy_tone1:,:detective_tone1: 176 | 177 | :spy_tone2:,:detective_tone2: 178 | 179 | :spy_tone3:,:detective_tone3: 180 | 181 | :spy_tone4:,:detective_tone4: 182 | 183 | :spy_tone5:,:detective_tone5: 184 | 185 | :guardsman:,:guard: 186 | 187 | :guardsman_tone1:,:guard_tone1: 188 | 189 | :guardsman_tone2:,:guard_tone2: 190 | 191 | :guardsman_tone3:,:guard_tone3: 192 | 193 | :guardsman_tone4:,:guard_tone4: 194 | 195 | :guardsman_tone5:,:guard_tone5: 196 | 197 | :person_with_blond_hair:,:blond_haired_person: 198 | 199 | :person_with_blond_hair_tone1:,:blond_haired_person_tone1: 200 | 201 | :person_with_blond_hair_tone2:,:blond_haired_person_tone2: 202 | 203 | :person_with_blond_hair_tone3:,:blond_haired_person_tone3: 204 | 205 | :person_with_blond_hair_tone4:,:blond_haired_person_tone4: 206 | 207 | :person_with_blond_hair_tone5:,:blond_haired_person_tone5: 208 | 209 | :person_with_pouting_face:,:person_pouting: 210 | 211 | :person_with_pouting_face_tone1:,:person_pouting_tone1: 212 | 213 | :person_with_pouting_face_tone2:,:person_pouting_tone2: 214 | 215 | :person_with_pouting_face_tone3:,:person_pouting_tone3: 216 | 217 | :person_with_pouting_face_tone4:,:person_pouting_tone4: 218 | 219 | :person_with_pouting_face_tone5:,:person_pouting_tone5: 220 | 221 | :no_good:,:person_gesturing_no: 222 | 223 | :no_good_tone1:,:person_gesturing_no_tone1: 224 | 225 | :no_good_tone2:,:person_gesturing_no_tone2: 226 | 227 | :no_good_tone3:,:person_gesturing_no_tone3: 228 | 229 | :no_good_tone4:,:person_gesturing_no_tone4: 230 | 231 | :no_good_tone5:,:person_gesturing_no_tone5: 232 | 233 | :ok_woman:,:person_gesturing_ok: 234 | 235 | :ok_woman_tone1:,:person_gesturing_ok_tone1: 236 | 237 | :ok_woman_tone2:,:person_gesturing_ok_tone2: 238 | 239 | :ok_woman_tone3:,:person_gesturing_ok_tone3: 240 | 241 | :ok_woman_tone4:,:person_gesturing_ok_tone4: 242 | 243 | :ok_woman_tone5:,:person_gesturing_ok_tone5: 244 | 245 | :information_desk_person:,:person_tipping_hand: 246 | 247 | :information_desk_person_tone1:,:person_tipping_hand_tone1: 248 | 249 | :information_desk_person_tone2:,:person_tipping_hand_tone2: 250 | 251 | :information_desk_person_tone3:,:person_tipping_hand_tone3: 252 | 253 | :information_desk_person_tone4:,:person_tipping_hand_tone4: 254 | 255 | :information_desk_person_tone5:,:person_tipping_hand_tone5: 256 | 257 | :raising_hand:,:person_raising_hand: 258 | 259 | :raising_hand_tone1:,:person_raising_hand_tone1: 260 | 261 | :raising_hand_tone2:,:person_raising_hand_tone2: 262 | 263 | :raising_hand_tone3:,:person_raising_hand_tone3: 264 | 265 | :raising_hand_tone4:,:person_raising_hand_tone4: 266 | 267 | :raising_hand_tone5:,:person_raising_hand_tone5: 268 | 269 | :bow:,:person_bowing: 270 | 271 | :bow_tone1:,:person_bowing_tone1: 272 | 273 | :bow_tone2:,:person_bowing_tone2: 274 | 275 | :bow_tone3:,:person_bowing_tone3: 276 | 277 | :bow_tone4:,:person_bowing_tone4: 278 | 279 | :bow_tone5:,:person_bowing_tone5: 280 | 281 | :fencer:,:person_fencing: 282 | 283 | :surfer:,:person_surfing: 284 | 285 | :surfer_tone1:,:person_surfing_tone1: 286 | 287 | :surfer_tone2:,:person_surfing_tone2: 288 | 289 | :surfer_tone3:,:person_surfing_tone3: 290 | 291 | :surfer_tone4:,:person_surfing_tone4: 292 | 293 | :surfer_tone5:,:person_surfing_tone5: 294 | 295 | :rowboat:,:person_rowing_boat: 296 | 297 | :rowboat_tone1:,:person_rowing_boat_tone1: 298 | 299 | :rowboat_tone2:,:person_rowing_boat_tone2: 300 | 301 | :rowboat_tone3:,:person_rowing_boat_tone3: 302 | 303 | :rowboat_tone4:,:person_rowing_boat_tone4: 304 | 305 | :rowboat_tone5:,:person_rowing_boat_tone5: 306 | 307 | :swimmer:,:person_swimming: 308 | 309 | :swimmer_tone1:,:person_swimming_tone1: 310 | 311 | :swimmer_tone2:,:person_swimming_tone2: 312 | 313 | :swimmer_tone3:,:person_swimming_tone3: 314 | 315 | :swimmer_tone4:,:person_swimming_tone4: 316 | 317 | :swimmer_tone5:,:person_swimming_tone5: 318 | 319 | :basketball_player:,:person_bouncing_ball: 320 | 321 | :basketball_player_tone1:,:person_bouncing_ball_tone1: 322 | 323 | :basketball_player_tone2:,:person_bouncing_ball_tone2: 324 | 325 | :basketball_player_tone3:,:person_bouncing_ball_tone3: 326 | 327 | :basketball_player_tone4:,:person_bouncing_ball_tone4: 328 | 329 | :basketball_player_tone5:,:person_bouncing_ball_tone5: 330 | 331 | :lifter:,:person_lifting_weights: 332 | 333 | :lifter_tone1:,:person_lifting_weights_tone1: 334 | 335 | :lifter_tone2:,:person_lifting_weights_tone2: 336 | 337 | :lifter_tone3:,:person_lifting_weights_tone3: 338 | 339 | :lifter_tone4:,:person_lifting_weights_tone4: 340 | 341 | :lifter_tone5:,:person_lifting_weights_tone5: 342 | 343 | :bicyclist:,:person_biking: 344 | 345 | :bicyclist_tone1:,:person_biking_tone1: 346 | 347 | :bicyclist_tone2:,:person_biking_tone2: 348 | 349 | :bicyclist_tone3:,:person_biking_tone3: 350 | 351 | :bicyclist_tone4:,:person_biking_tone4: 352 | 353 | :bicyclist_tone5:,:person_biking_tone5: 354 | 355 | :mountain_bicyclist:,:person_mountain_biking: 356 | 357 | :mountain_bicyclist_tone1:,:person_mountain_biking_tone1: 358 | 359 | :mountain_bicyclist_tone2:,:person_mountain_biking_tone2: 360 | 361 | :mountain_bicyclist_tone3:,:person_mountain_biking_tone3: 362 | 363 | :mountain_bicyclist_tone4:,:person_mountain_biking_tone4: 364 | 365 | :mountain_bicyclist_tone5:,:person_mountain_biking_tone5: 366 | 367 | :water_polo:,:person_playing_water_polo: 368 | 369 | :water_polo_tone1:,:person_playing_water_polo_tone1: 370 | 371 | :water_polo_tone2:,:person_playing_water_polo_tone2: 372 | 373 | :water_polo_tone3:,:person_playing_water_polo_tone3: 374 | 375 | :water_polo_tone4:,:person_playing_water_polo_tone4: 376 | 377 | :water_polo_tone5:,:person_playing_water_polo_tone5: 378 | 379 | :handball:,:person_playing_handball: 380 | 381 | :handball_tone1:,:person_playing_handball_tone1: 382 | 383 | :handball_tone2:,:person_playing_handball_tone2: 384 | 385 | :handball_tone3:,:person_playing_handball_tone3: 386 | 387 | :handball_tone4:,:person_playing_handball_tone4: 388 | 389 | :handball_tone5:,:person_playing_handball_tone5: 390 | 391 | :juggling:,:person_juggling: 392 | 393 | :juggling_tone1:,:person_juggling_tone1: 394 | 395 | :juggling_tone2:,:person_juggling_tone2: 396 | 397 | :juggling_tone3:,:person_juggling_tone3: 398 | 399 | :juggling_tone4:,:person_juggling_tone4: 400 | 401 | :juggling_tone5:,:person_juggling_tone5: 402 | 403 | :levitating:,:man_in_business_suit_levitating: 404 | 405 | :cartwheel:,:person_doing_cartwheel: 406 | 407 | :cartwheel_tone1:,:person_doing_cartwheel_tone1: 408 | 409 | :cartwheel_tone2:,:person_doing_cartwheel_tone2: 410 | 411 | :cartwheel_tone3:,:person_doing_cartwheel_tone3: 412 | 413 | :cartwheel_tone4:,:person_doing_cartwheel_tone4: 414 | 415 | :cartwheel_tone5:,:person_doing_cartwheel_tone5: 416 | ``` 417 | -------------------------------------------------------------------------------- /extras/category_icons/activity.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> 3 | <svg version="1.1" 4 | id="Слой_1" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" 5 | xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" 6 | viewBox="-374.034 286.28 24 24" style="enable-background:new -374.034 286.28 24 24;" xml:space="preserve"> 7 | <style type="text/css"> 8 | .st0{fill:url(#SVGID_1_);} 9 | .st1{fill:#1A1626;} 10 | .st2{fill:url(#SVGID_2_);} 11 | .st3{fill:#B3C2C6;} 12 | .st4{opacity:0.3;fill:url(#SVGID_3_);enable-background:new ;} 13 | </style> 14 | <g> 15 | 16 | <radialGradient id="SVGID_1_" cx="-273.9293" cy="283.2144" r="13.0467" gradientTransform="matrix(1.0506 0 0 -1.0506 35.403 593.0075)" gradientUnits="userSpaceOnUse"> 17 | <stop offset="0" style="stop-color:#FF8800"/> 18 | <stop offset="0.2913" style="stop-color:#FC8500"/> 19 | <stop offset="0.5282" style="stop-color:#F27E00"/> 20 | <stop offset="0.7453" style="stop-color:#E17000"/> 21 | <stop offset="0.9273" style="stop-color:#CC6000"/> 22 | </radialGradient> 23 | <circle class="st0" cx="-250.215" cy="298.28" r="12"/> 24 | <path class="st1" d="M-244.272,301.023c-4.416-1.463-8.23-2.726-9.737-5.76c-0.101-0.203-0.184-0.412-0.252-0.625 25 | c5.741-2.206,12.524-2.715,15.4-0.253c-0.1-0.292-0.21-0.578-0.332-0.858c-1.388-0.942-3.755-1.482-6.411-1.374 26 | c-2.78,0.113-5.943,0.798-8.805,1.88c-0.214-1.258,0.104-2.612,0.929-3.808c1.42-2.058,3.935-3.264,6.918-3.377 27 | c-0.37-0.118-0.747-0.219-1.132-0.301c-3.021,0.281-5.06,1.528-6.299,3.325c-0.947,1.374-1.292,2.942-1.006,4.393 28 | c-0.489,0.197-0.969,0.405-1.434,0.625c-0.347,0.164-0.68,0.332-1,0.502c-0.325-1.315-0.498-2.592-0.481-3.762 29 | c0.015-0.992,0.181-2.171,0.744-3.128c-0.271,0.193-0.533,0.397-0.787,0.612c-1.009,2.316-0.405,5.122-0.032,6.584 30 | c-0.627,0.358-1.196,0.726-1.704,1.103c-0.324-1.153-0.808-2.243-1.572-3.21c-0.096,0.226-0.185,0.456-0.267,0.688 31 | c0.626,0.89,1.029,1.887,1.303,2.941c-0.871,0.719-1.521,1.461-1.934,2.206c0.028,0.302,0.068,0.601,0.119,0.896 32 | c0.352-0.701,0.924-1.523,1.971-2.432c0.252,1.21,0.368,2.478,0.481,3.729c0.169,1.869,0.4,4.327,1.315,5.553 33 | c0.325,0.295,0.667,0.573,1.024,0.831c-1.277-1.573-1.487-3.885-1.718-6.44c-0.125-1.382-0.252-2.782-0.557-4.116 34 | c0.5-0.384,1.071-0.761,1.708-1.13c0.515,1.8,1.29,3.686,2.28,5.49c1.993,3.633,4.65,7.323,8.641,8.011 35 | c0.342-0.098,0.678-0.211,1.008-0.339c-0.762-0.01-1.56-0.218-2.392-0.626c-3.698-1.818-7.505-7.55-8.986-12.843 36 | c0.35-0.189,0.718-0.375,1.104-0.557c0.432-0.204,0.874-0.398,1.323-0.582c0.075,0.228,0.167,0.453,0.276,0.672 37 | c1.622,3.266,5.551,4.568,10.099,6.074c1.663,0.551,3.37,1.117,5.095,1.813c0.089-0.188,0.174-0.377,0.253-0.57 38 | C-240.869,302.152-242.592,301.58-244.272,301.023z"/> 39 | </g> 40 | <path d="M-362.034,286.471c-6.512,0-11.81,5.297-11.81,11.809c0,6.511,5.298,11.809,11.81,11.809s11.81-5.298,11.81-11.809 41 | C-350.224,291.768-355.522,286.471-362.034,286.471z M-352.229,302.031c-1.178-0.464-3.67-1.406-7.588-2.693 42 | c-1.718-0.564-3.107-1.309-4.131-2.213c-0.637-0.565-1.089-1.286-1.357-2.063c1.248-0.442,2.674-0.83,4.321-1.11 43 | c4.701-0.8,7.352-0.115,8.773,0.628c0.436,1.153,0.686,2.398,0.686,3.702C-351.525,299.603-351.781,300.864-352.229,302.031z 44 | M-353.059,292.841c-2.134-0.667-4.857-0.732-8.144-0.171c-1.647,0.281-3.087,0.666-4.363,1.108 45 | c-0.042-0.673,0.051-1.352,0.309-1.984c1.096-2.679,4.346-3.48,5.691-3.701c0.01-0.002,0.017-0.008,0.027-0.01 46 | C-356.801,288.753-354.487,290.495-353.059,292.841z M-368.421,289.954c1.534-1.179,3.395-1.949,5.428-2.134 47 | c-1.378,0.675-2.759,1.753-3.466,3.483c-0.389,0.953-0.497,1.968-0.373,2.956c-0.609,0.253-1.174,0.516-1.693,0.788 48 | C-369.016,292.507-368.69,290.799-368.421,289.954z M-370.03,291.478c-0.098,1.091-0.059,2.513,0.32,4.243 49 | c-0.337,0.21-0.656,0.42-0.947,0.63c-0.376-1.065-0.797-1.794-1.05-2.176C-371.287,293.188-370.716,292.283-370.03,291.478z 50 | M-371.271,299.562c0.061,0.609,0.105,1.16,0.147,1.669c0.089,1.08,0.167,1.988,0.343,2.862c-0.846-1.269-1.413-2.733-1.641-4.307 51 | c0.237-0.31,0.571-0.701,1.024-1.139C-371.348,298.938-371.303,299.24-371.271,299.562z M-372.525,297.938 52 | c0.023-0.71,0.115-1.402,0.273-2.071c0.171,0.365,0.347,0.812,0.509,1.338C-372.039,297.461-372.295,297.705-372.525,297.938z 53 | M-368.472,306.568c-0.009-0.02-0.009-0.042-0.02-0.062c-1.045-1.829-1.154-3.166-1.336-5.382c-0.042-0.516-0.088-1.074-0.15-1.691 54 | c-0.064-0.641-0.172-1.217-0.297-1.751c0.276-0.212,0.581-0.427,0.909-0.643c0.346,1.167,0.836,2.446,1.535,3.844 55 | c2.354,4.709,4.82,6.874,6.733,7.859c-0.309,0.027-0.62,0.047-0.936,0.047C-364.46,308.788-366.691,307.954-368.472,306.568z 56 | M-358.651,308.219c-0.029-0.009-0.054-0.027-0.085-0.032c-1.616-0.252-4.795-1.612-7.933-7.888c-0.73-1.46-1.223-2.776-1.55-3.95 57 | c0.512-0.281,1.074-0.555,1.691-0.817c0.342,0.96,0.913,1.851,1.718,2.565c1.156,1.023,2.699,1.856,4.586,2.475 58 | c3.835,1.26,6.278,2.181,7.461,2.645C-354.011,305.551-356.115,307.353-358.651,308.219z"/> 59 | <g> 60 | 61 | <radialGradient id="SVGID_2_" cx="-298.1872" cy="283.9428" r="11.9595" gradientTransform="matrix(1.0506 0 0 -1.0506 35.403 593.0075)" gradientUnits="userSpaceOnUse"> 62 | <stop offset="0.2727" style="stop-color:#FAFDFF"/> 63 | <stop offset="0.4936" style="stop-color:#F7FAFC"/> 64 | <stop offset="0.6732" style="stop-color:#EDF2F4"/> 65 | <stop offset="0.8379" style="stop-color:#DCE3E7"/> 66 | <stop offset="0.9273" style="stop-color:#CFD8DD"/> 67 | </radialGradient> 68 | <circle class="st2" cx="-275.882" cy="297.28" r="11"/> 69 | <path class="st3" d="M-279.516,290.078c-2.133-0.776-3.766-0.544-3.783-0.542l-0.041-0.272c0.069-0.01,1.72-0.244,3.917,0.555 70 | L-279.516,290.078z"/> 71 | <path class="st3" d="M-266.591,293.035c-3.241-1.925-5.943-1.651-5.97-1.649l-0.03-0.273c0.114-0.013,2.823-0.286,6.141,1.686 72 | L-266.591,293.035z"/> 73 | <path class="st3" d="M-272.771,301.55c-0.621-2.033-2.623-7.077-2.643-7.128l0.256-0.102c0.02,0.051,2.026,5.105,2.651,7.149 74 | L-272.771,301.55z"/> 75 | <path class="st3" d="M-268.521,301.522l-0.183-0.206c2.195-1.944,2.77-4.569,2.775-4.594l0.269,0.056 76 | C-265.682,296.889-266.255,299.515-268.521,301.522z"/> 77 | <path class="st3" d="M-275.166,304.799c-4.634-0.194-7.09-1.654-7.193-1.716l0.143-0.235c0.024,0.015,2.505,1.485,7.062,1.676 78 | L-275.166,304.799z"/> 79 | <path class="st3" d="M-283.976,299.317l-0.243-0.128c0.014-0.028,1.497-2.83,4.711-6.083l0.195,0.193 80 | C-282.498,296.524-283.961,299.289-283.976,299.317z"/> 81 | <path class="st3" d="M-275.562,288.15c0.005-0.012,0.491-1.07,1.092-1.777c-0.107-0.014-0.215-0.029-0.324-0.039 82 | c-0.569,0.721-0.996,1.653-1.019,1.702L-275.562,288.15z"/> 83 | <path class="st3" d="M-269.523,305.4c0.283,0.087,0.616,0.13,0.889,0.151c0.097-0.084,0.191-0.171,0.285-0.259 84 | c-0.274-0.011-0.736-0.045-1.093-0.155L-269.523,305.4z"/> 85 | <path class="st3" d="M-273.057,306.556l-0.264-0.076c-0.004,0.015-0.387,1.29-1.865,1.776c0.274-0.017,0.545-0.044,0.814-0.082 86 | C-273.356,307.539-273.061,306.569-273.057,306.556z"/> 87 | <path class="st3" d="M-286.617,297.886l0.272-0.039c-0.29-2.006-0.046-3.595,0.256-4.667c-0.298,0.74-0.517,1.518-0.649,2.327 88 | C-286.769,296.218-286.744,297.01-286.617,297.886z"/> 89 | <path class="st1" d="M-268.219,301.032c-0.455-0.019-3.69-0.329-4.843-0.711c-0.386,0.456-3.079,3.552-3.881,4.186 90 | c0.283,0.38,1.581,2.177,3.176,3.002c0.505-0.069,2.905-0.458,4.914-2.123C-268.177,303.46-268.097,302.384-268.219,301.032z"/> 91 | <path class="st1" d="M-271.62,291.248c-0.309-0.456-2.326-3.071-3.747-3.69c-0.612,0.1-3.627,0.693-5.368,1.982 92 | c-0.094,1.066-0.1,3.557,0.172,4.956c0.562,0.104,3.552,0.649,5.768,1.05C-274.269,294.813-272.204,292.033-271.62,291.248z"/> 93 | <path class="st1" d="M-282.727,288.673c-1.442,1.148-2.589,2.649-3.309,4.374c0.569-0.979,2.227-3.251,3.078-3.644 94 | C-283.004,289.02-282.822,288.802-282.727,288.673z"/> 95 | <path class="st1" d="M-283.357,298.053c-1.192-0.145-2.959-0.776-3.195-0.917c-0.208,0.428-0.252,0.712-0.298,0.916 96 | c0.202,2.915,1.54,5.517,3.574,7.367c0.055-0.682,1.791-1.719,2.071-1.928C-282.26,301.956-283.221,298.595-283.357,298.053z"/> 97 | <path class="st1" d="M-267.707,289.921c0.435,0.617,0.378,1.471-0.195,2.318c1.261,2.028,1.808,5.02,1.847,5.372 98 | c0.51-0.177,1.086,0.041,1.155,0.292c0.012-0.207,0.019-0.415,0.019-0.624C-264.882,294.45-265.951,291.869-267.707,289.921z"/> 99 | 100 | <radialGradient id="SVGID_3_" cx="639.9374" cy="854.3203" r="8.0916" gradientTransform="matrix(0.3583 0.4654 0.7924 -0.61 -1185.5491 516.2996)" gradientUnits="userSpaceOnUse"> 101 | <stop offset="0" style="stop-color:#FFFFFF"/> 102 | <stop offset="1" style="stop-color:#FFFFFF;stop-opacity:0"/> 103 | </radialGradient> 104 | <path class="st4" d="M-276.397,296.757c-3.541,2.726-7.71,3.25-9.311,1.17c-1.602-2.08-0.029-5.976,3.512-8.702 105 | s7.71-3.25,9.311-1.17C-271.283,290.135-272.855,294.031-276.397,296.757z"/> 106 | </g> 107 | </svg> 108 | -------------------------------------------------------------------------------- /extras/category_icons/diversity.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> 2 | <svg 3 | xmlns:dc="http://purl.org/dc/elements/1.1/" 4 | xmlns:cc="http://creativecommons.org/ns#" 5 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 6 | xmlns:svg="http://www.w3.org/2000/svg" 7 | xmlns="http://www.w3.org/2000/svg" 8 | id="svg2" 9 | viewBox="0 0 32 32" 10 | height="32" 11 | width="32" 12 | version="1.1"> 13 | <metadata 14 | id="metadata10"> 15 | <rdf:RDF> 16 | <cc:Work 17 | rdf:about=""> 18 | <dc:format>image/svg+xml</dc:format> 19 | <dc:type 20 | rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> 21 | <dc:title></dc:title> 22 | </cc:Work> 23 | </rdf:RDF> 24 | </metadata> 25 | <defs 26 | id="defs8" /> 27 | <path 28 | id="path4" 29 | d="M14 8c0-1.105 0.895-2 2-2s2 0.895 2 2c0 1.105-0.895 2-2 2s-2-0.895-2-2zM16 0c-8.837 0-16 7.163-16 16s7.163 16 16 16 16-7.163 16-16-7.163-16-16-16zM16 26c-1.105 0-2-0.895-2-2s0.895-2 2-2c1.105 0 2 0.895 2 2s-0.895 2-2 2zM16 16c-3.59 0-6.5 2.91-6.5 6.5s2.91 6.5 6.5 6.5c-7.18 0-13-5.82-13-13s5.82-13 13-13c3.59 0 6.5 2.91 6.5 6.5s-2.91 6.5-6.5 6.5z" /> 30 | </svg> 31 | -------------------------------------------------------------------------------- /extras/category_icons/flags.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> 3 | <svg version="1.1" 4 | id="Слой_1" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:cc="http://creativecommons.org/ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:dc="http://purl.org/dc/elements/1.1/" 5 | xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" 6 | viewBox="-370.6 286.3 24 24" style="enable-background:new -370.6 286.3 24 24;" xml:space="preserve"> 7 | <path d="M-348.5,292.7c-3.2-2.3-6.3-2.1-9.4-1.9c-3.5,0.2-6.8,0.4-10.1-3c0,0,0,0,0,0v-0.2c0-0.4-0.3-0.7-0.7-0.7s-0.7,0.3-0.7,0.7 8 | V309c0,0.4,0.3,0.7,0.7,0.7s0.7-0.3,0.7-0.7v-7c0.6,0.2,1.2,0.3,1.9,0.3c3,0,5.8-1.9,8.7-3.8c2.7-1.8,5.5-3.7,8.2-3.6 9 | c0.5,0,1-0.3,1.2-0.8C-347.9,293.6-348,293-348.5,292.7z M-358.2,297.4c-3.4,2.3-6.6,4.4-9.8,3.2v-11c3.4,3,6.9,2.8,10.2,2.6 10 | c2.8-0.2,5.5-0.3,8.2,1.4C-352.5,293.6-355.4,295.5-358.2,297.4z"/> 11 | </svg> 12 | -------------------------------------------------------------------------------- /extras/category_icons/food.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> 3 | <svg version="1.1" 4 | id="Слой_1" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" 5 | xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" 6 | viewBox="-417.263 286.28 24 24" style="enable-background:new -417.263 286.28 24 24;" xml:space="preserve"> 7 | <g> 8 | <path d="M-393.767,303.396c0-0.382-0.149-0.914-0.752-1.439c0.199-0.307,0.316-0.652,0.316-1.044c0-2.985-3.069-5.414-6.841-5.414 9 | c-0.822,0-1.607,0.121-2.338,0.332c0.14-1.334,0.254-2.142,0.295-2.434l0.033-0.246c0-0.733-0.535-1.478-3.935-1.736l0.877-2.943 10 | l5.089,0.765c0.356,0.054,0.686-0.19,0.739-0.546c0.054-0.355-0.191-0.686-0.546-0.739l-5.226-0.786 11 | c-0.554-0.082-1.104,0.263-1.264,0.804l-1.007,3.377c-0.487-0.016-1.003-0.027-1.582-0.027c-6.039,0-6.853,0.926-6.853,1.832 12 | l0.031,0.244c0.295,2.521,0.839,7.809,1.532,14.89c0.002,0.019,0.012,0.035,0.016,0.053c0.094,0.67,0.965,0.823,2.016,0.931 13 | c0.863,0.089,2.021,0.138,3.258,0.138c3.375,0,4.594-0.267,5.038-0.598c0.942,0.367,2.181,0.598,3.825,0.598 14 | c4.858,0,6.245-1.991,6.552-3.659c0.015-0.076,0.03-0.304,0.041-0.5c0,0,0.011-0.377-0.012-0.456 15 | C-394.024,304.394-393.767,303.929-393.767,303.396z M-407.021,303.396c0-0.157,0.161-0.359,0.427-0.558 16 | c0.295,0.177,0.644,0.347,1.08,0.498c1.189,0.412,2.777,0.639,4.469,0.639c1.997,0,4.204-0.323,5.558-1.132 17 | c0.262,0.197,0.419,0.397,0.419,0.553c0,0.608-2.11,1.792-5.977,1.792S-407.021,304.004-407.021,303.396z M-395.502,300.912 18 | c0,0.852-2.227,1.763-5.542,1.763s-5.542-0.911-5.542-1.763c0-2.269,2.486-4.114,5.542-4.114 19 | C-397.988,296.798-395.502,298.644-395.502,300.912z M-405.301,292.942c-0.551,0.083-1.32,0.144-2.196,0.182l0.128-0.428 20 | C-406.461,292.756-405.78,292.845-405.301,292.942z M-408.708,292.635l-0.158,0.53c-2.109,0.036-4.42-0.038-5.645-0.223 21 | c0.849-0.172,2.297-0.323,4.605-0.323C-409.476,292.619-409.081,292.625-408.708,292.635z M-413.933,307.844 22 | c-0.61-6.221-1.101-11.027-1.407-13.747c0.387,0.097,0.853,0.155,1.352,0.206c1.081,0.111,2.53,0.172,4.082,0.172 23 | c2.933,0,4.534-0.157,5.415-0.38c-0.068,0.538-0.155,1.289-0.251,2.269c-1.888,0.965-3.143,2.641-3.143,4.548 24 | c0,0.311,0.085,0.673,0.322,1.039c-0.608,0.528-0.757,1.061-0.757,1.444c0,0.534,0.258,0.999,0.697,1.397 25 | c-0.023,0.078-0.013,0.449-0.013,0.449c0.01,0.195,0.026,0.426,0.04,0.504c0.135,0.734,0.48,1.53,1.237,2.192 26 | C-408.192,308.196-412.769,308.164-413.933,307.844z M-401.043,308.106c-3.134,0-4.896-0.851-5.25-2.51 27 | c1.391,0.588,3.324,0.892,5.249,0.892c1.925,0,3.857-0.304,5.248-0.892C-396.159,307.259-397.918,308.106-401.043,308.106z"/> 28 | <circle cx="-397.252" cy="300.406" r="0.588"/> 29 | <circle cx="-401.151" cy="301.26" r="0.588"/> 30 | <circle cx="-404.836" cy="300.406" r="0.588"/> 31 | <circle cx="-402.731" cy="298.478" r="0.588"/> 32 | <circle cx="-399.523" cy="298.478" r="0.588"/> 33 | </g> 34 | </svg> 35 | -------------------------------------------------------------------------------- /extras/category_icons/nature.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> 3 | <svg version="1.1" 4 | id="Слой_1" xmlns:cc="http://creativecommons.org/ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" 5 | xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" 6 | viewBox="-243.5 286.28 24 24" enable-background="new -243.5 286.28 24 24" xml:space="preserve"> 7 | <g> 8 | <path d="M-219.75,305.024l-0.031-0.957c-0.005-0.148-0.124-3.574-1.288-6.818c0.654-2.156,1.299-9.727-0.311-10.484 9 | c-1.981-0.93-5.527,1.601-7.634,3.358c-1.786-0.504-3.178-0.506-4.972,0c-2.108-1.758-5.652-4.288-7.634-3.358 10 | c-1.612,0.757-0.966,8.327-0.311,10.483c-1.165,3.244-1.284,6.67-1.288,6.818l-0.029,0.957l0.896-0.337 11 | c0.012-0.004,0.811-0.3,1.81-0.425c-0.546,0.886-0.864,1.883-0.915,2.048l-0.526,1.711l1.494-0.987 12 | c1.088-0.717,2.972-1.525,3.556-0.984c0.217,0.201,0.351,0.555,0.507,0.967c0.475,1.257,1.128,2.979,4.928,2.983 13 | c3.798-0.004,4.451-1.726,4.926-2.983c0.156-0.412,0.29-0.767,0.508-0.968c0.587-0.546,2.468,0.268,3.555,0.984l1.495,0.987 14 | l-0.528-1.711c-0.051-0.165-0.37-1.162-0.915-2.048c0.999,0.125,1.798,0.421,1.81,0.425L-219.75,305.024z M-223.97,302.957 15 | l-1.906,0.202l1.643,0.987c0.263,0.157,0.528,0.509,0.764,0.921c-1.137-0.478-2.564-0.796-3.467,0.04 16 | c-0.439,0.406-0.64,0.939-0.836,1.455c-0.418,1.107-0.814,2.152-3.726,2.154c-2.914-0.002-3.309-1.047-3.728-2.154 17 | c-0.196-0.516-0.397-1.049-0.835-1.454c-0.406-0.376-0.918-0.52-1.462-0.52c-0.666,0-1.381,0.215-2.007,0.479 18 | c0.235-0.413,0.499-0.764,0.763-0.922l1.645-0.987l-1.907-0.202c-1.05-0.112-2.115,0.069-2.844,0.25 19 | c0.113-1.243,0.419-3.576,1.224-5.725l0.086-0.229l-0.088-0.228c-0.785-2.031-0.897-8.197-0.351-9.128 20 | c1.019-0.356,3.639,1.034,6.454,3.428l0.269,0.229l0.337-0.105c0.888-0.277,1.733-0.424,2.443-0.424 21 | c0.712,0,1.556,0.147,2.442,0.424l0.338,0.106l0.269-0.229c2.812-2.394,5.434-3.786,6.454-3.428 22 | c0.546,0.932,0.433,7.098-0.351,9.129l-0.088,0.228l0.086,0.229c0.803,2.148,1.111,4.48,1.224,5.724 23 | C-221.855,303.027-222.915,302.845-223.97,302.957z"/> 24 | <path d="M-231.5,304.314c-1.372,0-2.486,0.219-2.486,1.365c0,0.912,1.98,1.721,2.486,1.721c0.508,0,2.485-0.808,2.485-1.721 25 | C-229.015,304.534-230.126,304.314-231.5,304.314z"/> 26 | <ellipse cx="-235.816" cy="299.071" rx="1.665" ry="2.141"/> 27 | <ellipse cx="-227.184" cy="299.072" rx="1.665" ry="2.14"/> 28 | <path d="M-236.935,292.221c-0.402-0.887-1.01-1.691-1.758-2.326l-1.365-1.16l0.318,1.764c0.001,0.006,0.08,0.45,0.124,1.099 29 | c-0.091-0.027-0.182-0.048-0.276-0.064l-0.935-0.158l0.201,0.927c0.002,0.01,0.22,1.046,0.017,2.324 30 | c-0.056,0.35,0.183,0.679,0.533,0.735c0.034,0.005,0.067,0.008,0.101,0.008c0.31,0,0.582-0.225,0.633-0.541 31 | c0.085-0.531,0.108-1.025,0.102-1.445l0.889,0.954l0.042-1.566c0.004-0.141,0.006-0.28,0.005-0.414 32 | c0.079,0.142,0.146,0.274,0.2,0.394c0.146,0.322,0.527,0.464,0.849,0.319C-236.931,292.924-236.789,292.544-236.935,292.221z"/> 33 | <path d="M-222.375,292.304l0.201-0.929l-0.935,0.16c-0.094,0.016-0.186,0.037-0.276,0.064c0.044-0.649,0.123-1.093,0.124-1.099 34 | l0.318-1.764l-1.365,1.16c-0.946,0.803-1.477,1.708-1.757,2.326c-0.147,0.323-0.003,0.703,0.32,0.849 35 | c0.321,0.145,0.702,0.004,0.849-0.32c0.054-0.119,0.12-0.251,0.199-0.392c-0.001,0.135,0.001,0.273,0.005,0.414l0.042,1.568 36 | l0.889-0.956c-0.006,0.42,0.017,0.914,0.102,1.445c0.05,0.316,0.323,0.541,0.633,0.541c0.034,0,0.067-0.002,0.101-0.008 37 | c0.35-0.056,0.589-0.385,0.533-0.735C-222.594,293.35-222.377,292.314-222.375,292.304z"/> 38 | </g> 39 | </svg> 40 | -------------------------------------------------------------------------------- /extras/category_icons/objects.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> 3 | <svg version="1.1" 4 | id="Слой_1" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" 5 | xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" 6 | viewBox="-219.75 286.28 24 24" style="enable-background:new -219.75 286.28 24 24;" xml:space="preserve"> 7 | <path d="M-207.75,286.42c-4.539,0-8.232,3.282-8.232,7.315c0,2.194,1.165,3.995,2.291,5.737c0.461,0.714,0.896,1.387,1.237,2.066 8 | c0.103,0.203,0.1,0.362,0.096,0.582c-0.005,0.33-0.011,0.808,0.428,1.273c0.119,0.656,0.492,2.655,0.745,3.395 9 | c0.153,0.449,0.469,0.83,0.896,1.13v0.056c0,1.194,1.143,2.167,2.546,2.167s2.546-0.973,2.546-2.167v-0.056 10 | c0.428-0.3,0.744-0.68,0.896-1.129c0.255-0.747,0.631-2.77,0.747-3.411c0.425-0.46,0.417-0.932,0.412-1.258 11 | c-0.004-0.22-0.007-0.379,0.096-0.582c0.341-0.679,0.776-1.353,1.237-2.065c1.126-1.742,2.291-3.543,2.291-5.738 12 | C-199.518,289.702-203.211,286.42-207.75,286.42z M-210.487,304.039c1.74,0.465,3.747,0.466,5.487-0.001 13 | c-0.06,0.31-0.127,0.643-0.194,0.961c-2.262,0.775-4.417,0.221-5.098,0.002C-210.36,304.682-210.427,304.349-210.487,304.039z 14 | M-207.777,303.084c-0.32-1.199-1.187-4.02-1.496-5.02c0.876-0.481,1.304-0.733,1.522-0.874c0.219,0.141,0.646,0.393,1.522,0.874 15 | c-0.309,1-1.176,3.823-1.496,5.021C-207.741,303.084-207.759,303.084-207.777,303.084z M-207.722,307.324h-0.044 16 | c-1.028-0.005-1.9-0.366-2.147-0.873c0.58,0.133,1.352,0.256,2.242,0.256c0.648,0,1.358-0.074,2.093-0.248 17 | C-205.83,306.961-206.698,307.319-207.722,307.324z M-206.93,308.624c-0.439,0.268-1.188,0.268-1.627,0h0.813h0.001H-206.93z 18 | M-202.9,298.768c-0.46,0.71-0.935,1.446-1.308,2.187c-0.246,0.489-0.239,0.894-0.233,1.188c0.004,0.234,0.001,0.289-0.075,0.363 19 | c-0.562,0.224-1.183,0.378-1.829,0.471c0.37-1.309,1.086-3.64,1.36-4.525c0.251-0.074,0.547-0.192,0.758-0.373 20 | c0.41-0.378,0.593-0.886,0.502-1.385c-0.073-0.432-0.397-0.789-0.816-0.908c-0.223-0.068-0.444-0.073-0.743,0.003 21 | c-0.185,0.065-0.352,0.17-0.492,0.311c-0.169,0.175-0.278,0.348-0.365,0.523c-0.162-0.091-0.317-0.178-0.451-0.254 22 | c0.061-0.123,0.138-0.304,0.163-0.523c0.033-0.279-0.029-0.563-0.182-0.805c-0.164-0.255-0.389-0.439-0.689-0.552 23 | c-0.277-0.094-0.607-0.101-0.916,0.008c-0.28,0.106-0.505,0.289-0.673,0.552c-0.146,0.233-0.208,0.515-0.177,0.797 24 | c0.026,0.215,0.099,0.389,0.163,0.521c-0.137,0.078-0.29,0.166-0.45,0.255c-0.082-0.165-0.194-0.344-0.37-0.526 25 | c-0.132-0.134-0.301-0.24-0.554-0.326c-0.234-0.056-0.457-0.051-0.668,0.014c-0.429,0.123-0.753,0.48-0.823,0.901 26 | c-0.095,0.508,0.088,1.018,0.519,1.412c0.199,0.17,0.489,0.284,0.738,0.356c0.274,0.885,0.99,3.215,1.359,4.523 27 | c-0.65-0.094-1.274-0.25-1.837-0.476c-0.069-0.07-0.071-0.128-0.067-0.356c0.006-0.295,0.013-0.699-0.233-1.188 28 | c-0.373-0.742-0.849-1.477-1.308-2.188c-1.024-1.583-2.082-3.22-2.082-5.031c0-3.317,3.109-6.016,6.932-6.016 29 | s6.932,2.699,6.932,6.016C-200.818,295.546-201.877,297.184-202.9,298.768z"/> 30 | </svg> 31 | -------------------------------------------------------------------------------- /extras/category_icons/people.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> 3 | <svg version="1.1" 4 | id="Слой_1" xmlns:cc="http://creativecommons.org/ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" 5 | xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" 6 | viewBox="-322.458 286.28 24 24" enable-background="new -322.458 286.28 24 24" xml:space="preserve"> 7 | <g> 8 | <path d="M-310.458,286.663c-6.406,0-11.618,5.211-11.618,11.618c0,6.406,5.212,11.618,11.618,11.618 9 | c6.405,0,11.617-5.212,11.617-11.618C-298.841,291.874-304.053,286.663-310.458,286.663z M-310.458,308.597 10 | c-5.689,0-10.317-4.628-10.317-10.317c0-5.689,4.628-10.318,10.317-10.318c5.688,0,10.316,4.628,10.316,10.318 11 | C-300.142,303.969-304.77,308.597-310.458,308.597z"/> 12 | <circle cx="-314.114" cy="296.269" r="1.645"/> 13 | <circle cx="-306.802" cy="296.269" r="1.645"/> 14 | <path d="M-305.709,301.348c-2.893,2.007-6.608,2.006-9.499,0c-0.409-0.283-0.46,0.023-0.333,0.264c2.14,4.093,8.027,4.092,10.168,0 15 | C-305.248,301.37-305.298,301.064-305.709,301.348z"/> 16 | </g> 17 | </svg> 18 | -------------------------------------------------------------------------------- /extras/category_icons/recent.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" standalone="no"?> 2 | <svg 3 | xmlns:dc="http://purl.org/dc/elements/1.1/" 4 | xmlns:cc="http://creativecommons.org/ns#" 5 | xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 6 | xmlns:svg="http://www.w3.org/2000/svg" 7 | xmlns="http://www.w3.org/2000/svg" 8 | xml:space="preserve" 9 | enable-background="new 0 0 24 24" 10 | viewBox="0 0 24 24" 11 | height="24px" 12 | width="24px" 13 | y="0px" 14 | x="0px" 15 | id="Слой_1" 16 | version="1.1"><metadata 17 | id="metadata8433"><rdf:RDF><cc:Work 18 | rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type 19 | rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs 20 | id="defs8431" /><g 21 | id="g8421"><path 22 | id="polygon8423" 23 | d="M 13,4 11,4 10.999,11 9,11 l 0,2 2,0 0,2 2,0 0,-2 4,0 0,-2 -4,0 z" 24 | style="fill:#000000;fill-opacity:1" /><g 25 | id="g8425"><path 26 | style="fill:#000000;fill-opacity:1" 27 | id="path8427" 28 | d="M12,0C5.373,0,0,5.373,0,12s5.373,12,12,12s12-5.373,12-12S18.627,0,12,0 M12,22C6.486,22,2,17.514,2,12 S6.486,2,12,2s10,4.486,10,10S17.514,22,12,22" 29 | fill="#010202" /></g></g></svg> -------------------------------------------------------------------------------- /extras/category_icons/symbols.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> 3 | <svg version="1.1" 4 | id="Слой_1" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 5 | xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" 6 | viewBox="-408 286.28 24 24" style="enable-background:new -408 286.28 24 24;" xml:space="preserve"> 7 | <g> 8 | <g> 9 | <path d="M-385.49,300.152c-0.254-0.254-0.666-0.254-0.92,0l-7.751,7.751c-0.254,0.254-0.254,0.666,0,0.92 10 | c0.127,0.127,0.294,0.19,0.46,0.19s0.333-0.063,0.46-0.19l7.751-7.751C-385.237,300.818-385.237,300.406-385.49,300.152z"/> 11 | <path d="M-392.708,303.888c0.585,0,1.171-0.223,1.616-0.668c0.89-0.891,0.89-2.34,0-3.229c-0.892-0.892-2.342-0.89-3.231,0 12 | c-0.89,0.89-0.89,2.339,0.001,3.23C-393.878,303.665-393.293,303.888-392.708,303.888z M-393.405,300.91 13 | c0.186-0.187,0.433-0.289,0.696-0.289s0.51,0.103,0.695,0.289c0.384,0.383,0.384,1.007,0.001,1.391 14 | c-0.384,0.383-1.009,0.385-1.393,0.001C-393.788,301.917-393.788,301.293-393.405,300.91z"/> 15 | <path d="M-385.327,305.755c-0.891-0.891-2.34-0.89-3.23,0.001c-0.89,0.891-0.89,2.34,0,3.229c0.432,0.433,1.005,0.67,1.615,0.67 16 | s1.184-0.237,1.614-0.669c0.433-0.432,0.67-1.005,0.67-1.615C-384.659,306.761-384.896,306.186-385.327,305.755z 17 | M-386.247,308.066c-0.371,0.371-1.02,0.372-1.391-0.001c-0.384-0.383-0.384-1.007,0-1.391c0.186-0.186,0.433-0.288,0.695-0.288 18 | s0.51,0.103,0.695,0.288c0.187,0.186,0.289,0.433,0.289,0.695S-386.061,307.88-386.247,308.066z"/> 19 | </g> 20 | <path d="M-398.294,306.82l0.557-0.453c0.277-0.225,0.318-0.629,0.09-0.903c-0.228-0.276-0.639-0.315-0.914-0.089l-0.757,0.614 21 | l-2.961-2.402c0.423-0.323,0.935-0.73,1.163-0.977c0.27-0.291,0.4-0.673,0.4-1.169c0-1.205-1.145-2.184-2.551-2.184 22 | c-1.405,0-2.55,0.979-2.55,2.184c0,0.554,0.24,1.081,0.709,1.512l0.756,0.613l-1.331,1.08l-0.001,0.001 23 | c-0.688,0.559-1.067,1.313-1.066,2.123c0,0.81,0.379,1.564,1.067,2.121c0.678,0.55,1.547,0.825,2.416,0.825 24 | c0.87,0,1.739-0.275,2.417-0.825l1.531-1.242l1.488,1.207c0.12,0.098,0.267,0.147,0.412,0.147c0.188,0,0.374-0.08,0.502-0.236 25 | c0.229-0.274,0.188-0.679-0.09-0.903L-398.294,306.82z M-404.251,301.989c-0.121-0.112-0.265-0.297-0.265-0.547 26 | c0-0.487,0.571-0.899,1.249-0.899s1.25,0.411,1.25,0.899c0,0.215-0.04,0.282-0.058,0.301l-0.001,0.001 27 | c-0.175,0.189-0.729,0.624-1.235,1.007l-0.017-0.014l0,0L-404.251,301.989z M-401.673,307.901c-0.863,0.7-2.321,0.698-3.185,0 28 | c-0.382-0.31-0.592-0.711-0.592-1.129c0-0.419,0.21-0.82,0.593-1.131l1.53-1.241l2.984,2.421L-401.673,307.901z"/> 29 | <g> 30 | <path d="M-401.76,296.597l-1.12-0.908c-2.905-2.346-4.505-3.639-4.505-5.611c0-1.471,0.935-2.686,2.383-3.095 31 | c1.197-0.34,2.414-0.042,3.241,0.743c0.827-0.784,2.044-1.082,3.243-0.743c1.447,0.41,2.383,1.625,2.383,3.095 32 | c0,1.972-1.6,3.264-4.505,5.61L-401.76,296.597z M-404.027,288.057c-0.223,0-0.442,0.031-0.645,0.089 33 | c-0.726,0.205-1.503,0.821-1.503,1.932c0,1.395,1.355,2.49,4.054,4.671l0.36,0.292l0.362-0.293 34 | c2.699-2.181,4.054-3.275,4.054-4.67c0-1.111-0.776-1.727-1.503-1.932c-0.795-0.227-1.846-0.05-2.399,0.849l-0.515,0.836 35 | l-0.515-0.837C-402.688,288.325-403.375,288.057-404.027,288.057z"/> 36 | </g> 37 | <path d="M-385.448,287.738c-0.901-0.894-2.182-0.893-2.24-0.894h-1.171v5.379c-0.652-0.408-1.51-0.661-2.473-0.661 38 | c-2.078,0-3.705,1.14-3.705,2.596c0,1.455,1.627,2.596,3.705,2.596s3.705-1.14,3.705-2.596v-6.08 39 | c0.196,0.013,0.86,0.087,1.311,0.534c0.312,0.309,0.469,0.76,0.469,1.337c0,0.34,0.276,0.616,0.616,0.616s0.616-0.276,0.616-0.616 40 | C-384.613,289.031-384.895,288.287-385.448,287.738z M-391.331,295.522c-1.457,0-2.473-0.719-2.473-1.364 41 | c0-0.645,1.016-1.364,2.473-1.364s2.473,0.719,2.473,1.364S-389.875,295.522-391.331,295.522z"/> 42 | </g> 43 | </svg> 44 | -------------------------------------------------------------------------------- /extras/category_icons/travel.svg: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="utf-8"?> 2 | <!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) --> 3 | <svg version="1.1" 4 | id="Слой_1" xmlns:cc="http://creativecommons.org/ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:dc="http://purl.org/dc/elements/1.1/" 5 | xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="24px" height="24px" 6 | viewBox="-278.583 314.162 24 24" enable-background="new -278.583 314.162 24 24" xml:space="preserve"> 7 | <g> 8 | <path d="M-254.972,323.47c0-0.544-0.294-1.435-2.163-1.588c-0.133-0.395-0.245-0.8-0.354-1.194 9 | c-0.312-1.121-0.605-2.181-1.328-2.938c-1.139-1.192-3.533-1.729-7.767-1.737c-4.231,0.009-6.627,0.545-7.767,1.738 10 | c-0.722,0.757-1.016,1.814-1.327,2.936c-0.109,0.396-0.222,0.801-0.355,1.196c-1.868,0.153-2.162,1.044-2.162,1.588 11 | c0,0.439,0.17,1.173,1.2,1.583c-0.127,1.666-0.106,4.17-0.095,5.731l0.006,0.967c0,0.023,0.003,0.043,0.004,0.065 12 | c-0.002,0.018-0.011,0.034-0.011,0.053v3.023c0,0.783,0.656,1.42,1.463,1.42h2.029c0.807,0,1.463-0.638,1.463-1.421v-0.873 13 | c1.429,0.074,3.24,0.101,5.553,0.101c2.31,0,4.12-0.027,5.549-0.101v0.872c0,0.783,0.656,1.421,1.462,1.421h2.03 14 | c0.806,0,1.462-0.637,1.462-1.42v-3.626l0.003-0.483c0.012-1.561,0.032-4.064-0.095-5.73 15 | C-255.141,324.643-254.972,323.909-254.972,323.47z M-257.513,324.658c0.141,1.264,0.15,3.413,0.142,5.092h-0.013 16 | c0,0.693-1.466,1.069-9.199,1.069c-7.734,0-9.2-0.375-9.2-1.068h-0.013c-0.009-1.679,0-3.828,0.142-5.093l0.045-0.403h18.051 17 | L-257.513,324.658z M-274.425,321.033c0.267-0.959,0.519-1.865,1.015-2.386c0.839-0.879,3.137-1.328,6.826-1.335 18 | c3.691,0.007,5.988,0.456,6.826,1.334c0.497,0.521,0.749,1.429,1.016,2.389c0.155,0.558,0.314,1.134,0.537,1.709l0.081,0.21 19 | h-16.921l0.081-0.21C-274.74,322.169-274.58,321.592-274.425,321.033z M-273.436,334.892c0,0.057-0.066,0.12-0.162,0.12h-2.029 20 | c-0.096,0-0.162-0.063-0.162-0.119v-1.399c0.547,0.198,1.313,0.338,2.354,0.434V334.892z M-275.783,331.751l-0.002-0.256 21 | c1.375,0.495,4.079,0.625,9.202,0.625c5.122,0,7.826-0.129,9.201-0.625l-0.002,0.255c0,0.693-1.466,1.069-9.199,1.069 22 | C-274.317,332.819-275.783,332.444-275.783,331.751z M-257.542,335.012h-2.03c-0.097,0-0.161-0.062-0.161-0.12v-0.964 23 | c1.04-0.096,1.805-0.235,2.353-0.433v1.398C-257.381,334.949-257.447,335.012-257.542,335.012z"/> 24 | <path d="M-272.79,330.163c1.377,0,2.376-0.625,2.376-1.485c0-1.207-1.605-2.738-3.41-2.738c-0.895,0-1.544,0.749-1.544,1.781 25 | c0,0.604,0.23,1.202,0.632,1.643C-274.404,329.727-273.796,330.163-272.79,330.163z M-273.824,327.24 26 | c1.085,0,1.999,0.927,2.101,1.363c-0.118,0.094-0.473,0.259-1.066,0.259c-0.427,0-0.759-0.126-0.985-0.375 27 | c-0.187-0.204-0.293-0.483-0.293-0.767C-274.068,327.587-274.024,327.24-273.824,327.24z"/> 28 | <path d="M-260.377,330.163c1.007,0,1.614-0.436,1.946-0.801c0.401-0.44,0.632-1.039,0.632-1.643c0-1.031-0.648-1.78-1.543-1.78 29 | c-1.805,0-3.411,1.532-3.411,2.739C-262.753,329.539-261.754,330.163-260.377,330.163z M-259.342,327.24 30 | c0.199,0,0.243,0.347,0.243,0.479c0,0.284-0.106,0.563-0.292,0.768c-0.228,0.249-0.56,0.375-0.986,0.375 31 | c-0.593,0-0.948-0.164-1.066-0.259C-261.341,328.167-260.427,327.24-259.342,327.24z"/> 32 | </g> 33 | </svg> 34 | -------------------------------------------------------------------------------- /extras/css/emojione.css: -------------------------------------------------------------------------------- 1 | .emojione { 2 | /* Emoji Sizing */ 3 | font-size: inherit; 4 | height: 3ex; 5 | width: 3.1ex; 6 | min-height: 20px; 7 | min-width: 20px; 8 | 9 | /* Inline alignment adjust the margins */ 10 | display: inline-block; 11 | margin: -.2ex .15em .2ex; 12 | line-height: normal; 13 | vertical-align: middle; 14 | } 15 | 16 | img.emojione { 17 | /* prevent img stretch */ 18 | width: auto; 19 | } -------------------------------------------------------------------------------- /extras/css/emojione.min.css: -------------------------------------------------------------------------------- 1 | .emojione{font-size:inherit;height:3ex;width:3.1ex;min-height:20px;min-width:20px;display:inline-block;margin:-.2ex .15em .2ex;line-height:normal;vertical-align:middle}img.emojione{width:auto} -------------------------------------------------------------------------------- /extras/fonts/README.md: -------------------------------------------------------------------------------- 1 | ## EmojiOne Fonts 2 | 3 | There's no better way to port our emoji into your device than through a native font. We don't have the resources ourselves to construct fonts, so we'll depend on helpful contributions from the open source community. 4 | 5 | > Note: Due to their size, the font files have been removed from this repo and instead will be attached to releases on our repo that hosts the artwork and related assets, [emojione-assets](https://github.com/emojione/emojione-assets). 6 | > 7 | > Please go here to download the font files: [emojione-assets/releases](https://github.com/emojione/emojione-assets/releases) 8 | ### Google Font - [emojione-android.ttf](https://github.com/emojione/emojione-assets/releases/download/4.5/emojione-android.ttf) 9 | 10 | * Compatible with rooted Android devices and Linux. 11 | * Updated Sept 12, 2018 12 | * Developers using the font within their app, please review [this issue](https://github.com/Ranks/emojione/issues/385) regarding proper display of digits. 13 | 14 | Android Setup Help: 15 | * We recommend Emoji Switcher (now free for EmojiOne): https://play.google.com/store/apps/details?id=com.stevenschoen.emojiswitcher&hl=en 16 | * Reddit Thread: https://www.reddit.com/r/Android/comments/3xezb9/emojione_on_android/ 17 | * Must have a rooted Android phone. 18 | 19 | Linux Setup Help: 20 | 21 | * ArchLinux users are advised to install [AUR package](https://aur.archlinux.org/packages/ttf-emojione/) 22 | * Alternatively setup the font manually: 23 | * Place the file in `~/.local/share/fonts/` 24 | * Create the following fontconfig file: [latest](https://aur.archlinux.org/cgit/aur.git/tree/70-emojione-color.conf?h=ttf-emojione) ([snapshot](https://github.com/maximbaz/dotfiles/blob/c893a835372c927eba9ec7e086e76b64f6210d8c/.config/fontconfig/conf.d/70-emojione-color.conf)) 25 | * Update fontconfig cache with `$ fc-cache -f; sudo fc-cache -f` 26 | * The font seems to be working now in Chrome and Firefox, as well as in many other apps! 27 | 28 | ### Apple Font 29 | 30 | **For latest apple devices** 31 | - [emojione-mac.ttc](https://github.com/emojione/emojione-assets/releases/download/4.5/emojione-mac.ttc) 32 | - [emojione-ios.ttc](https://github.com/emojione/emojione-assets/releases/download/4.5/emojione-ios.ttc) 33 | 34 | * Compatible with Mac OSX, and iOS devices (iPhone, iPad). 35 | * Rename font to Apple Color Emoji.ttc for Mac OSX. 36 | * Rename font to AppleColorEmoji@2x.ttc for iOS, jailbreak required. 37 | * Updated Oct 29, 2018 38 | 39 | 40 | **Mac OS System Instructions:** 41 | 1.) Manual 42 | - Simply move the Mac compatible font into `~/Library/Fonts/Apple Color Emoji.ttc`. You should immediately see a new version of the Apple Color Emoji font in your Fontbook, and it will be useable immediately. 43 | 44 | **iOS System Instructions:** 45 | 1.) Manual 46 | - Take a look at [PoomSmarts Guide](https://poomsmart.github.io/repo/emoji10.html) Option #3: Manual 47 | 48 | 2.) Installable 49 | Cydia is a package manager app for rooted/jailbroken iOS devices(iPhone, iPod, iPad) and is based on Debian APT [(Advanced Packaging Tool)](https://en.wikipedia.org/wiki/APT_(Debian)) 50 | Tap [Add EmojiPort Fonts](cydia://url/https://cydia.saurik.com/api/share#?source=https://vxbakerxv.github.io/repo/) cydia source for "EmojiOne 2018". 51 | 52 | App Instructions: 53 | This has not been fully tested/confirmed but may work in app projects. 54 | Extract TTF from TTC and create new FontFamily name 'EmojiOne'. After that you should be able to drop the font in your project and use UIFont to call that newly created FontFamily name. 55 | [otc2otf.py](https://github.com/adobe-type-tools/afdko/tree/develop/python/afdko) Adobe standalone python script to extract fonts from a TTC 56 | [fontname.py](https://github.com/chrissimpkins/fontname.py) FontTools python script to change name table in a TTF. 57 | You can also use High-Logic FontCreator to do the above tasks. 58 | 59 | ### EmojiOne SVG-based Color Fonts 60 | Through a cooperative effort with Adobe Systems, EmojiOne created black and white versions of the emoji set which were used, in part, to generate this font. Using these fonts with Firefox or Microsoft Edge, you can enjoy full-color EmojiOne emoji. Black and white images will show as the fall back for systems that are not able to render color SVG fonts. The font is available in the following formats: 61 | 62 | * Open Type Font: [emojione-svg.otf](https://github.com/emojione/emojione-assets/releases/download/3.1.2/emojione-svg.otf) 63 | * Web Open Font Format: [emojione-svg.woff](https://github.com/emojione/emojione-assets/releases/download/3.1.2/emojione-svg.woff) 64 | * Web Open Font Format 2.0: [emojione-svg.woff2](https://github.com/emojione/emojione-assets/releases/download/3.1.2/emojione-svg.woff2) 65 | 66 | --- 67 | 68 | ### Contributions 69 | * If you have a font to add, please submit a pull request. 70 | * Please thoroughly test the files the best you can. 71 | * Let us know how you'd like to be acknowledged. 72 | 73 | ### Warranty & Disclaimer 74 | * These files are very raw and not fully tested. 75 | * We provide no guarantees that the font will function on your device. 76 | 77 | ### Acknowledgements 78 | * Google Font: Thanks to Miguel Sousa from Adobe Systems, [Maxim Baz](https://github.com/maximbaz) and [Albert Chang](https://github.com/mxalbert1996). 79 | * Apple Font: Thanks to Philip (@pw5a29) and Cody (@vXBaKeRXv). 80 | -------------------------------------------------------------------------------- /gruntfile.js: -------------------------------------------------------------------------------- 1 | module.exports = function(grunt) { 2 | grunt.initConfig({ 3 | pkg: grunt.file.readJSON('package.json'), 4 | jshint: { 5 | files: ['gruntfile.js', 'lib/js/emojione.js'] 6 | }, 7 | jsonlint: { 8 | files: { 9 | src: ['emoji.json','emoji_strategy.json'] 10 | } 11 | }, 12 | // BUILD EMOJI ONE AWESOME CSS (SASS -> CSS) 13 | sass: { 14 | dist: { 15 | files: { 16 | 'extras/css/emojione-awesome.css': 'lib/emojione-awesome/emojione-awesome.scss' 17 | } 18 | } 19 | }, 20 | uglify: { 21 | options: { 22 | // the banner is inserted at the top of the output 23 | banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n', 24 | mangle: false, 25 | ASCIIOnly: true 26 | }, 27 | dist: { 28 | files: { 29 | 'lib/js/<%= pkg.name %>.min.js': ['lib/js/<%= pkg.name %>.js'] 30 | } 31 | } 32 | }, 33 | // Minify Project CSS 34 | cssmin: { 35 | target: { 36 | files: { 37 | 'extras/css/emojione.min.css': ['extras/css/emojione.css'] 38 | } 39 | } 40 | }, 41 | watch: { 42 | files: ['<%= jshint.files %>'], 43 | tasks: ['jshint'] 44 | }, 45 | // run QUnit tests 46 | qunit: { 47 | all: ['lib/js/tests/tests.html'] 48 | } 49 | 50 | }); 51 | grunt.loadNpmTasks('grunt-contrib-sass'); 52 | grunt.loadNpmTasks('grunt-contrib-uglify'); 53 | grunt.loadNpmTasks('grunt-contrib-jshint'); 54 | grunt.loadNpmTasks('grunt-jsonlint'); 55 | grunt.loadNpmTasks('grunt-contrib-watch'); 56 | grunt.loadNpmTasks('grunt-contrib-cssmin'); 57 | grunt.loadNpmTasks('grunt-contrib-qunit'); 58 | grunt.registerTask('default', ['jshint','jsonlint', 'sass', 'uglify', 'cssmin']); 59 | grunt.registerTask('travis', ['qunit']); 60 | }; -------------------------------------------------------------------------------- /lib/android/README.md: -------------------------------------------------------------------------------- 1 | # Emojione utility for Android 2 | 3 | 4 | ### How to use 5 | 6 | This utility provides a method to convert from shortname to unicode characters (natively supported from Android 4.1 - API Level 16): 7 | 8 | `Emojione.shortnameToUnicode()` 9 | 10 | 11 | ### How to re-generate mapping 12 | 13 | ``` 14 | cd lib/android/generator 15 | npm install 16 | node generate.js 17 | ``` 18 | -------------------------------------------------------------------------------- /lib/android/generator/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /lib/android/generator/Emojione.java: -------------------------------------------------------------------------------- 1 | package com.emojione; 2 | 3 | import android.os.Build; 4 | 5 | import java.util.HashMap; 6 | import java.util.regex.Matcher; 7 | import java.util.regex.Pattern; 8 | 9 | public abstract class Emojione 10 | { 11 | private static final HashMap<String, String> _shortNameToUnicode = new HashMap<String, String>(); 12 | private static final Pattern SHORTNAME_PATTERN = Pattern.compile(":([-+\\w]+):"); 13 | 14 | /** 15 | * Replace shortnames to unicode characters. 16 | */ 17 | public static String shortnameToUnicode(String input, boolean removeIfUnsupported) 18 | { 19 | Matcher matcher = SHORTNAME_PATTERN.matcher(input); 20 | boolean supported = Build.VERSION.SDK_INT >= 16; 21 | 22 | while (matcher.find()) { 23 | String unicode = _shortNameToUnicode.get(matcher.group(1)); 24 | if (unicode == null) { 25 | continue; 26 | } 27 | 28 | if (supported) { 29 | input = input.replace(":" + matcher.group(1) + ":", unicode); 30 | } else if (!supported && removeIfUnsupported) { 31 | input = input.replace(":" + matcher.group(1) + ":", ""); 32 | } 33 | } 34 | 35 | return input; 36 | } 37 | 38 | 39 | static { 40 | <%= mapping %> 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /lib/android/generator/generate.js: -------------------------------------------------------------------------------- 1 | var util = require("util"), 2 | fs = require("fs"), 3 | _ = require("underscore"); 4 | 5 | 6 | // Load emojis 7 | var emojis = require("../../../emoji_strategy.json"); 8 | 9 | // Generate Java mapping 10 | var mapping = _(emojis).map(function(data, unicode) { 11 | // Get codepoints 12 | var codepoints = _(unicode.split("-")).map(function (code) { 13 | return "0x" + code; 14 | }); 15 | 16 | return '_shortNameToUnicode.put("' + data.shortname.slice(1, -1) + '", new String(new int[] {' + codepoints.join(',') + '}, 0, ' + codepoints.length + '));'; 17 | }).join("\n "); 18 | 19 | // Generate Java class from template 20 | var input = fs.readFileSync("./Emojione.java"); 21 | var output = _(input.toString()).template()({ mapping: mapping }); 22 | 23 | // Write Java class to file 24 | var output_path = "../com/emojione/Emojione.java"; 25 | fs.writeFileSync(output_path, output); 26 | 27 | console.log("Generated " + output_path); -------------------------------------------------------------------------------- /lib/android/generator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "emojione-android", 3 | "version": "0.1.0", 4 | "dependencies": { 5 | "underscore": "^1.7.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /lib/emojione-awesome/README.md: -------------------------------------------------------------------------------- 1 | # Emojione Awesome 2 | 3 | 4 | ### How to use 5 | 6 | In the same vein as Font-Awesome, Emojione Awesome is for front end developers who just wanna drop an emoji on a page without using any sorts of scripts. 7 | Uses human-friendly class names (based on emoji shortcodes). View a full list of shortcodes at www.emoji.codes 8 | 9 | 10 | ``` 11 | <!-- Coffee Emoji --> 12 | <i class="e1a-coffee"></i> 13 | ``` 14 | 15 | Additional classes let you modify size: 16 | 17 | ``` 18 | <!-- Coffee Emoji (small) --> 19 | <i class="e1a-coffee e1a-sm"></i> 20 | 21 | <!-- Coffee Emoji (medium) --> 22 | <i class="e1a-coffee e1a-med"></i> 23 | 24 | <!-- Coffee Emoji (large) --> 25 | <i class="e1a-coffee e1a-lg"></i> 26 | 27 | ``` 28 | 29 | 30 | # Thanks 31 | 32 | Special Thanks to Michael Hartmann for creating these scripts for us! 33 | 34 | 35 | ### How to generate mapping 36 | 37 | ``` 38 | cd lib/emojione-awesome 39 | node generate.js 40 | 41 | ``` 42 | 43 | ### How to compile scss 44 | 45 | Once you've generated the mapping you can build the css files via grunt. 46 | The compiled styles are output into /extras/css/emojione-awesome.css 47 | 48 | ``` 49 | npm install grunt grunt-contrib-sass 50 | grunt sass 51 | ``` -------------------------------------------------------------------------------- /lib/emojione-awesome/emojione-awesome.scss: -------------------------------------------------------------------------------- 1 | [class*=e1a-] { 2 | display: inline-block; 3 | width: 1em; 4 | height: 1em; 5 | margin: -.2ex .05em 0 .1em; 6 | line-height: normal; 7 | vertical-align: middle; 8 | background-repeat: no-repeat; 9 | background-position: center center; 10 | background-size: 1em 1em; 11 | } 12 | 13 | $size-map: ( 14 | "sm": 1, 15 | "med": 2, 16 | "lg": 4 17 | ); 18 | 19 | @each $name, $size in $size-map { 20 | .e1a-#{$name} { 21 | width: 32px * $size; 22 | height: 32px * $size; 23 | margin: -.2ex * $size .05em * $size 0 .1em * $size; 24 | background-size: 1em * $size 1em * $size; 25 | } 26 | } 27 | 28 | @import '_emojione-awesome.map'; 29 | 30 | @each $code, $name in $emoji-map { 31 | 32 | .e1a-#{$name} { 33 | background-image: url("https://cdn.jsdelivr.net/emojione/assets/4.5/png/128/#{$code}.png"); 34 | } 35 | 36 | .e1a-rel-#{$name} { 37 | background-image: url("emojione/assets/4.5/png/128/#{$code}.png"); 38 | } 39 | } -------------------------------------------------------------------------------- /lib/emojione-awesome/generate.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | 3 | // Load emojis 4 | var emojis = JSON.parse(fs.readFileSync('../../emoji_strategy.json'), 'utf8'); 5 | 6 | // Generate .scss mapping 7 | var mapping = ''; 8 | 9 | for (var key in emojis) { 10 | if (emojis.hasOwnProperty(key)) 11 | mapping += '"' + key + '": "' + emojis[key].shortname.slice(1, -1) + "\",\n"; 12 | } 13 | 14 | mapping = "$emoji-map: (\n" + mapping; 15 | mapping = mapping.substr(0, mapping.length - 2) + "\n);"; 16 | 17 | // Write .scss file 18 | var output_path = '../../lib/emojione-awesome/_emojione-awesome.map.scss'; 19 | fs.writeFileSync(output_path, mapping); 20 | 21 | console.log('Generated ' + output_path); -------------------------------------------------------------------------------- /lib/ios/README.md: -------------------------------------------------------------------------------- 1 | # Emojione utility for iOS 2 | 3 | 4 | ### How to use 5 | 6 | This utility provides a method to convert from shortname to unicode characters (natively supported from iOS 6). 7 | 8 | 9 | ### How to re-generate mapping 10 | 11 | ``` 12 | cd lib/ios/generator 13 | npm install 14 | node generate.js 15 | ``` 16 | -------------------------------------------------------------------------------- /lib/ios/generator/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /lib/ios/generator/Emojione.m: -------------------------------------------------------------------------------- 1 | // 2 | // Emojione.m 3 | // 4 | // Created by Alessandro Calzavara on 16/12/14. 5 | // Copyright (c) 2014 Spreaker, Inc. 6 | // 7 | 8 | #import "Emojione.h" 9 | 10 | @implementation Emojione 11 | 12 | + (NSString *)shortnameToUnicode:(NSString *)string 13 | { 14 | static NSDictionary * emojiMapping; 15 | static dispatch_once_t onceToken; 16 | dispatch_once(&onceToken, ^{ 17 | emojiMapping = [self _loadShortNameToUnicode]; 18 | }); 19 | 20 | NSString * SHORTNAME_PATTERN = @":([-+\\w]+):"; 21 | 22 | NSMutableString * unicodeString = [string mutableCopy]; 23 | NSError * error = nil; 24 | NSRegularExpression * regex = [NSRegularExpression regularExpressionWithPattern:SHORTNAME_PATTERN 25 | options:0 26 | error:&error]; 27 | 28 | NSAssert(!error, @"Unable to create regex: ", error); 29 | 30 | NSArray * matches = [regex matchesInString:unicodeString 31 | options:0 32 | range:NSMakeRange(0, [unicodeString length])]; 33 | 34 | for (NSTextCheckingResult * result in [matches reverseObjectEnumerator]) { 35 | 36 | if ([result numberOfRanges] < 2) { 37 | continue; 38 | } 39 | 40 | // Range 0: full shortname 41 | // Range 1: shortname without : 42 | 43 | NSString * shortname = [string substringWithRange:[result rangeAtIndex:1]]; 44 | NSString * emoji = [emojiMapping objectForKey:shortname]; 45 | if (emoji) { 46 | [unicodeString replaceCharactersInRange:[result rangeAtIndex:0] 47 | withString:emoji]; 48 | } 49 | } 50 | 51 | return unicodeString; 52 | } 53 | 54 | + (NSDictionary *)_loadShortNameToUnicode 55 | { 56 | // Mapping generated by script. 57 | 58 | return @{ 59 | <%= mapping %> 60 | }; 61 | } 62 | 63 | @end 64 | -------------------------------------------------------------------------------- /lib/ios/generator/generate.js: -------------------------------------------------------------------------------- 1 | var util = require("util"), 2 | fs = require("fs"), 3 | _ = require("underscore"); 4 | 5 | 6 | // Load emojis 7 | var emojis = require("../../../emoji_strategy.json"); 8 | 9 | // Generate Objective-C mapping 10 | var mapping = _(emojis).map(function(data, unicode) { 11 | // Get chars 12 | var chars = _(unicode.split("-")).map(function (code) { 13 | // Handle invalid unicode char for C99 14 | // http://c0x.coding-guidelines.com/6.4.3.html 15 | if (code < 160) { 16 | return String.fromCharCode(parseInt(code, 16)); 17 | } 18 | 19 | return "\\U" + Array(8 - code.length + 1).join("0") + code; 20 | }); 21 | 22 | return '@"' + data.shortname.slice(1, -1) + '" : @"' + chars.join('') + '",'; 23 | }).join("\n "); 24 | 25 | // Generate Objective-C class from template 26 | var input = fs.readFileSync("./Emojione.m"); 27 | var output = _(input.toString()).template()({ mapping: mapping }); 28 | 29 | // Write Objective-C class to file 30 | var output_path = "../src/Emojione.m"; 31 | fs.writeFileSync(output_path, output); 32 | 33 | console.log("Generated " + output_path); -------------------------------------------------------------------------------- /lib/ios/generator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "emojione-ios", 3 | "version": "0.1.0", 4 | "dependencies": { 5 | "underscore": "^1.7.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /lib/ios/src/Emojione.h: -------------------------------------------------------------------------------- 1 | // 2 | // Emojione.h 3 | // 4 | // Created by Alessandro Calzavara on 16/12/14. 5 | // Copyright (c) 2014 Spreaker, Inc. 6 | // 7 | 8 | #import <Foundation/Foundation.h> 9 | 10 | @interface Emojione : NSObject 11 | 12 | + (NSString *)shortnameToUnicode:(NSString *)string; 13 | 14 | @end -------------------------------------------------------------------------------- /lib/js/tests/generate.js: -------------------------------------------------------------------------------- 1 | // These tests are meant to develop over time. 2 | // New tests can be added to validate.json 3 | // Regenerate the tests.html file with the following command 'node generate.js' 4 | // underscore.js is required. It can be installed with 'npm install underscore' 5 | 6 | var fs = require('fs'); 7 | var _ = require('underscore'); 8 | 9 | // load emojis 10 | var emojis = JSON.parse(fs.readFileSync('validate.json'), 'utf8'); 11 | 12 | // load template 13 | var data = fs.readFileSync('template.html'); 14 | 15 | data = data.toString(); 16 | 17 | var template = _.template(data); 18 | 19 | var testFile = template(emojis); 20 | 21 | // write test file 22 | var output_path = 'tests.html'; 23 | fs.writeFileSync(output_path, testFile); 24 | 25 | console.log('Generated ' + output_path); -------------------------------------------------------------------------------- /lib/js/tests/template.html: -------------------------------------------------------------------------------- 1 | <!DOCTYPE html> 2 | <html> 3 | <head> 4 | <meta charset="utf-8" /> 5 | <link rel="stylesheet" href="https://cdn.jsdelivr.net/qunit/1.14.0/qunit.css" type="text/css" media="screen" /> 6 | </head> 7 | <body> 8 | <div id="qunit"></div> 9 | <div id="qunit-fixture"></div> 10 | <script src="http://cdn.jsdelivr.net/qunit/1.14.0/qunit.js"></script> 11 | <script src="../emojione.js"></script> 12 | <script> 13 | <% _.each(data, function(collection) { %> 14 | QUnit.module("<%= collection.module %>"); 15 | <% _.each(collection.tests, function(test) { %> 16 | QUnit.test( "<%= test.description %>", function( assert ) { 17 | assert.equal(emojione.<%= collection.module %>("<%= test.text %>"), "<%= test.expected %>"); 18 | }); 19 | <% }); %> 20 | <% }); %> 21 | </script> 22 | </body> 23 | </html> 24 | -------------------------------------------------------------------------------- /lib/js/tests/tests.html: -------------------------------------------------------------------------------- 1 | <!DOCTYPE html> 2 | <html> 3 | <head> 4 | <meta charset="utf-8" /> 5 | <link rel="stylesheet" href="https://cdn.jsdelivr.net/qunit/1.14.0/qunit.css" type="text/css" media="screen" /> 6 | </head> 7 | <body> 8 | <div id="qunit"></div> 9 | <div id="qunit-fixture"></div> 10 | <script src="http://cdn.jsdelivr.net/qunit/1.14.0/qunit.js"></script> 11 | <script src="../emojione.js"></script> 12 | <script> 13 | 14 | QUnit.module("toImage"); 15 | 16 | QUnit.test( "test toImage", function( assert ) { 17 | assert.equal(emojione.toImage("Hello world! 😄 :smile:"), "Hello world! <img class=\"emojione\" alt=\"😄\" title=\":smile:\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f604.png\"/> <img class=\"emojione\" alt=\"😄\" title=\":smile:\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f604.png\"/>"); 18 | }); 19 | 20 | QUnit.test( "mixed ascii, regular unicode and duplicate emoji", function( assert ) { 21 | assert.equal(emojione.toImage(":alien: is 👽 and 저 is not :alien: or :alien: also :randomy: is not emoji"), "<img class=\"emojione\" alt=\"👽\" title=\":alien:\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\"/> is <img class=\"emojione\" alt=\"👽\" title=\":alien:\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\"/> and 저 is not <img class=\"emojione\" alt=\"👽\" title=\":alien:\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\"/> or <img class=\"emojione\" alt=\"👽\" title=\":alien:\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\"/> also :randomy: is not emoji"); 22 | }); 23 | 24 | 25 | QUnit.module("unifyUnicode"); 26 | 27 | QUnit.test( "test unifyUnicode", function( assert ) { 28 | assert.equal(emojione.unifyUnicode("Hello world! 😄 :smile:"), "Hello world! 😄 😄"); 29 | }); 30 | 31 | QUnit.test( "mixed ascii, regular unicode and duplicate emoji", function( assert ) { 32 | assert.equal(emojione.unifyUnicode(":alien: is 👽 and 저 is not :alien: or :alien: also :randomy: is not emoji"), "👽 is 👽 and 저 is not 👽 or 👽 also :randomy: is not emoji"); 33 | }); 34 | 35 | QUnit.test( "multiline emoji string", function( assert ) { 36 | assert.equal(emojione.unifyUnicode(":dancer:\ 37 | :dancer:"), "💃\ 38 | 💃"); 39 | }); 40 | 41 | QUnit.test( "triple emoji string", function( assert ) { 42 | assert.equal(emojione.unifyUnicode(":dancer::dancer::alien:"), "💃💃👽"); 43 | }); 44 | 45 | 46 | QUnit.module("shortnameToUnicode"); 47 | 48 | QUnit.test( "single unicode character conversion", function( assert ) { 49 | assert.equal(emojione.shortnameToUnicode("Hello world! 😄 :smile:"), "Hello world! 😄 😄"); 50 | }); 51 | 52 | QUnit.test( "shortname at start of sentence with apostrophe", function( assert ) { 53 | assert.equal(emojione.shortnameToUnicode(":snail:'s are cool!"), "🐌's are cool!"); 54 | }); 55 | 56 | QUnit.test( "shortname shares a colon", function( assert ) { 57 | assert.equal(emojione.shortnameToUnicode(":invalid:snail:"), ":invalid🐌"); 58 | }); 59 | 60 | QUnit.test( "mixed ascii, regular unicode and duplicate emoji", function( assert ) { 61 | assert.equal(emojione.shortnameToUnicode(":alien: is 👽 and 저 is not :alien: or :alien: also :randomy: is not emoji"), "👽 is 👽 and 저 is not 👽 or 👽 also :randomy: is not emoji"); 62 | }); 63 | 64 | QUnit.test( "multiline emoji string", function( assert ) { 65 | assert.equal(emojione.shortnameToUnicode(":dancer:\n:dancer:"), "💃\n💃"); 66 | }); 67 | 68 | QUnit.test( "triple emoji string", function( assert ) { 69 | assert.equal(emojione.shortnameToUnicode(":dancer::dancer::alien:"), "💃💃👽"); 70 | }); 71 | 72 | 73 | QUnit.module("shortnameToImage"); 74 | 75 | QUnit.test( "single shortname character conversion", function( assert ) { 76 | assert.equal(emojione.shortnameToImage("Hello world! 😄 :smile:"), "Hello world! 😄 <img class=\"emojione\" alt=\"😄\" title=\":smile:\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f604.png\"/>"); 77 | }); 78 | 79 | QUnit.test( "shortname at start of sentence with apostrophe", function( assert ) { 80 | assert.equal(emojione.shortnameToImage(":snail:'s are cool!"), "<img class=\"emojione\" alt=\"🐌\" title=\":snail:\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f40c.png\"/>'s are cool!"); 81 | }); 82 | 83 | QUnit.test( "shortname shares a colon", function( assert ) { 84 | assert.equal(emojione.shortnameToImage(":invalid:snail:"), ":invalid<img class=\"emojione\" alt=\"🐌\" title=\":snail:\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f40c.png\"/>"); 85 | }); 86 | 87 | QUnit.test( "mixed ascii, regular unicode and duplicate emoji", function( assert ) { 88 | assert.equal(emojione.shortnameToImage(":alien: is 👽 and 저 is not :alien: or :alien: also :randomy: is not emoji"), "<img class=\"emojione\" alt=\"👽\" title=\":alien:\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\"/> is 👽 and 저 is not <img class=\"emojione\" alt=\"👽\" title=\":alien:\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\"/> or <img class=\"emojione\" alt=\"👽\" title=\":alien:\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\"/> also :randomy: is not emoji"); 89 | }); 90 | 91 | QUnit.test( "multiline emoji string", function( assert ) { 92 | assert.equal(emojione.shortnameToImage(":dancer:\n:dancer:"), "<img class=\"emojione\" alt=\"💃\" title=\":dancer:\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f483.png\"/>\n<img class=\"emojione\" alt=\"💃\" title=\":dancer:\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f483.png\"/>"); 93 | }); 94 | 95 | QUnit.test( "triple emoji string", function( assert ) { 96 | assert.equal(emojione.shortnameToImage(":dancer::dancer::alien:"), "<img class=\"emojione\" alt=\"💃\" title=\":dancer:\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f483.png\"/><img class=\"emojione\" alt=\"💃\" title=\":dancer:\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f483.png\"/><img class=\"emojione\" alt=\"👽\" title=\":alien:\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\"/>"); 97 | }); 98 | 99 | 100 | QUnit.module("toShort"); 101 | 102 | QUnit.test( "single unicode character conversion", function( assert ) { 103 | assert.equal(emojione.toShort("Hello world! 😄 :smile:"), "Hello world! :smile: :smile:"); 104 | }); 105 | 106 | QUnit.test( "mixed ascii, regular unicode and duplicate emoji", function( assert ) { 107 | assert.equal(emojione.toShort("👽 is not :alien: and 저 is not 👽 or 👽"), ":alien: is not :alien: and 저 is not :alien: or :alien:"); 108 | }); 109 | 110 | QUnit.test( "multiline emoji string", function( assert ) { 111 | assert.equal(emojione.toShort("💃\n💃"), ":dancer:\n:dancer:"); 112 | }); 113 | 114 | QUnit.test( "alias vs. canonical", function( assert ) { 115 | assert.equal(emojione.toShort("🇯🇵 どうもありがとう"), ":flag_jp: どうもありがとう"); 116 | }); 117 | 118 | QUnit.test( "unicode character conversion within excluded tag", function( assert ) { 119 | assert.equal(emojione.toShort("<div>😄</div>"), "<div>:smile:</div>"); 120 | }); 121 | 122 | 123 | QUnit.module("toImage"); 124 | 125 | QUnit.test( "single character shortname conversion", function( assert ) { 126 | assert.equal(emojione.toImage("Hello world! 😄 :smile:"), "Hello world! <img class=\"emojione\" alt=\"😄\" title=\":smile:\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f604.png\"/> <img class=\"emojione\" alt=\"😄\" title=\":smile:\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f604.png\"/>"); 127 | }); 128 | 129 | QUnit.test( "shortname shares a colon", function( assert ) { 130 | assert.equal(emojione.toImage(":invalid:snail:"), ":invalid<img class=\"emojione\" alt=\"🐌\" title=\":snail:\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f40c.png\"/>"); 131 | }); 132 | 133 | QUnit.test( "single unicode character conversion", function( assert ) { 134 | assert.equal(emojione.toImage("🐌"), "<img class=\"emojione\" alt=\"🐌\" title=\":snail:\" src=\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f40c.png\"/>"); 135 | }); 136 | 137 | 138 | </script> 139 | </body> 140 | </html> 141 | -------------------------------------------------------------------------------- /lib/js/tests/validate.json: -------------------------------------------------------------------------------- 1 | { 2 | "data": [ 3 | { 4 | "module":"toImage", 5 | "tests": [ 6 | { 7 | "description": "test toImage", 8 | "text": "Hello world! 😄 :smile:", 9 | "expected": "Hello world! <img class=\\\"emojione\\\" alt=\\\"😄\\\" title=\\\":smile:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f604.png\\\"/> <img class=\\\"emojione\\\" alt=\\\"😄\\\" title=\\\":smile:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f604.png\\\"/>" 10 | }, 11 | { 12 | "description": "mixed ascii, regular unicode and duplicate emoji", 13 | "text": ":alien: is 👽 and 저 is not :alien: or :alien: also :randomy: is not emoji", 14 | "expected": "<img class=\\\"emojione\\\" alt=\\\"👽\\\" title=\\\":alien:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\\\"/> is <img class=\\\"emojione\\\" alt=\\\"👽\\\" title=\\\":alien:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\\\"/> and 저 is not <img class=\\\"emojione\\\" alt=\\\"👽\\\" title=\\\":alien:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\\\"/> or <img class=\\\"emojione\\\" alt=\\\"👽\\\" title=\\\":alien:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\\\"/> also :randomy: is not emoji" 15 | } 16 | ] 17 | }, 18 | { 19 | "module":"unifyUnicode", 20 | "tests": [ 21 | { 22 | "description": "test unifyUnicode", 23 | "text": "Hello world! 😄 :smile:", 24 | "expected": "Hello world! 😄 😄" 25 | }, 26 | { 27 | "description": "mixed ascii, regular unicode and duplicate emoji", 28 | "text": ":alien: is 👽 and 저 is not :alien: or :alien: also :randomy: is not emoji", 29 | "expected": "👽 is 👽 and 저 is not 👽 or 👽 also :randomy: is not emoji" 30 | }, 31 | { 32 | "description": "multiline emoji string", 33 | "text": ":dancer:\\\n:dancer:", 34 | "expected": "💃\\\n💃" 35 | }, 36 | { 37 | "description": "triple emoji string", 38 | "text": ":dancer::dancer::alien:", 39 | "expected": "💃💃👽" 40 | } 41 | ] 42 | }, 43 | { 44 | "module": "shortnameToUnicode", 45 | "tests": [ 46 | { 47 | "description": "single unicode character conversion", 48 | "text": "Hello world! 😄 :smile:", 49 | "expected": "Hello world! 😄 😄" 50 | }, 51 | { 52 | "description": "shortname at start of sentence with apostrophe", 53 | "text": ":snail:'s are cool!", 54 | "expected": "🐌's are cool!" 55 | }, 56 | { 57 | "description": "shortname shares a colon", 58 | "text": ":invalid:snail:", 59 | "expected": ":invalid🐌" 60 | }, 61 | { 62 | "description": "mixed ascii, regular unicode and duplicate emoji", 63 | "text": ":alien: is 👽 and 저 is not :alien: or :alien: also :randomy: is not emoji", 64 | "expected": "👽 is 👽 and 저 is not 👽 or 👽 also :randomy: is not emoji" 65 | }, 66 | { 67 | "description": "multiline emoji string", 68 | "text": ":dancer:\\n:dancer:", 69 | "expected": "💃\\n💃" 70 | }, 71 | { 72 | "description": "triple emoji string", 73 | "text": ":dancer::dancer::alien:", 74 | "expected": "💃💃👽" 75 | } 76 | ] 77 | }, 78 | { 79 | "module": "shortnameToImage", 80 | "tests": [ 81 | { 82 | "description": "single shortname character conversion", 83 | "text": "Hello world! 😄 :smile:", 84 | "expected": "Hello world! 😄 <img class=\\\"emojione\\\" alt=\\\"😄\\\" title=\\\":smile:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f604.png\\\"/>" 85 | }, 86 | { 87 | "description": "shortname at start of sentence with apostrophe", 88 | "text": ":snail:'s are cool!", 89 | "expected": "<img class=\\\"emojione\\\" alt=\\\"🐌\\\" title=\\\":snail:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f40c.png\\\"/>'s are cool!" 90 | }, 91 | { 92 | "description": "shortname shares a colon", 93 | "text": ":invalid:snail:", 94 | "expected": ":invalid<img class=\\\"emojione\\\" alt=\\\"🐌\\\" title=\\\":snail:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f40c.png\\\"/>" 95 | }, 96 | { 97 | "description": "mixed ascii, regular unicode and duplicate emoji", 98 | "text": ":alien: is 👽 and 저 is not :alien: or :alien: also :randomy: is not emoji", 99 | "expected": "<img class=\\\"emojione\\\" alt=\\\"👽\\\" title=\\\":alien:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\\\"/> is 👽 and 저 is not <img class=\\\"emojione\\\" alt=\\\"👽\\\" title=\\\":alien:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\\\"/> or <img class=\\\"emojione\\\" alt=\\\"👽\\\" title=\\\":alien:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\\\"/> also :randomy: is not emoji" 100 | }, 101 | { 102 | "description": "multiline emoji string", 103 | "text": ":dancer:\\n:dancer:", 104 | "expected": "<img class=\\\"emojione\\\" alt=\\\"💃\\\" title=\\\":dancer:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f483.png\\\"/>\\n<img class=\\\"emojione\\\" alt=\\\"💃\\\" title=\\\":dancer:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f483.png\\\"/>" 105 | }, 106 | { 107 | "description": "triple emoji string", 108 | "text": ":dancer::dancer::alien:", 109 | "expected": "<img class=\\\"emojione\\\" alt=\\\"💃\\\" title=\\\":dancer:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f483.png\\\"/><img class=\\\"emojione\\\" alt=\\\"💃\\\" title=\\\":dancer:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f483.png\\\"/><img class=\\\"emojione\\\" alt=\\\"👽\\\" title=\\\":alien:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f47d.png\\\"/>" 110 | } 111 | ] 112 | }, 113 | { 114 | "module": "toShort", 115 | "tests": [ 116 | { 117 | "description": "single unicode character conversion", 118 | "text": "Hello world! 😄 :smile:", 119 | "expected": "Hello world! :smile: :smile:" 120 | }, 121 | { 122 | "description": "mixed ascii, regular unicode and duplicate emoji", 123 | "text": "👽 is not :alien: and 저 is not 👽 or 👽", 124 | "expected": ":alien: is not :alien: and 저 is not :alien: or :alien:" 125 | }, 126 | { 127 | "description": "multiline emoji string", 128 | "text": "💃\\n💃", 129 | "expected": ":dancer:\\n:dancer:" 130 | }, 131 | { 132 | "description": "alias vs. canonical", 133 | "text": "🇯🇵 どうもありがとう", 134 | "expected": ":flag_jp: どうもありがとう" 135 | }, 136 | { 137 | "description": "unicode character conversion within excluded tag", 138 | "text": "<div>😄</div>", 139 | "expected": "<div>:smile:</div>" 140 | } 141 | ] 142 | }, 143 | { 144 | "module": "toImage", 145 | "tests": [ 146 | { 147 | "description": "single character shortname conversion", 148 | "text": "Hello world! 😄 :smile:", 149 | "expected": "Hello world! <img class=\\\"emojione\\\" alt=\\\"😄\\\" title=\\\":smile:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f604.png\\\"/> <img class=\\\"emojione\\\" alt=\\\"😄\\\" title=\\\":smile:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f604.png\\\"/>" 150 | }, 151 | { 152 | "description": "shortname shares a colon", 153 | "text": ":invalid:snail:", 154 | "expected": ":invalid<img class=\\\"emojione\\\" alt=\\\"🐌\\\" title=\\\":snail:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f40c.png\\\"/>" 155 | }, 156 | { 157 | "description": "single unicode character conversion", 158 | "text": "🐌", 159 | "expected": "<img class=\\\"emojione\\\" alt=\\\"🐌\\\" title=\\\":snail:\\\" src=\\\"https://cdn.jsdelivr.net/emojione/assets/4.5/png/64/1f40c.png\\\"/>" 160 | } 161 | ] 162 | } 163 | ] 164 | } -------------------------------------------------------------------------------- /lib/meteor/emojione-client.js: -------------------------------------------------------------------------------- 1 | Template.registerHelper('emojione', new Template('emojione', function () { 2 | var view = this; 3 | var content; 4 | 5 | if (view.templateContentBlock) { 6 | // this is for the block usage eg: {{#emoji}}:smile:{{/emoji}} 7 | content = Blaze._toText(view.templateContentBlock, HTML.TEXTMODE.STRING); 8 | } else { 9 | // this is for the direct usage eg: {{> emoji ':blush:'}} 10 | content = Blaze.getData(view); 11 | } 12 | 13 | return HTML.Raw(emojione.toImage(content)); 14 | })); 15 | -------------------------------------------------------------------------------- /lib/meteor/post-export.js: -------------------------------------------------------------------------------- 1 | emojione = module.exports; 2 | -------------------------------------------------------------------------------- /lib/meteor/pre-export.js: -------------------------------------------------------------------------------- 1 | module = {}; 2 | -------------------------------------------------------------------------------- /lib/php/autoload.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | require_once(__DIR__ . '/src/RulesetInterface.php'); 4 | require_once(__DIR__ . '/src/ClientInterface.php'); 5 | require_once(__DIR__ . '/src/Client.php'); 6 | require_once(__DIR__ . '/src/Ruleset.php'); 7 | require_once(__DIR__ . '/src/Emojione.php'); 8 | -------------------------------------------------------------------------------- /lib/php/phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <phpunit colors="true" convertNoticesToExceptions="true" convertWarningsToExceptions="true" stopOnError="false" stopOnFailure="false" stopOnIncomplete="false" stopOnSkipped="false"> 3 | <testsuites> 4 | <testsuite name="all"> 5 | <directory suffix="Test.php">test/</directory> 6 | </testsuite> 7 | </testsuites> 8 | <filter> 9 | <whitelist> 10 | <directory suffix=".php">src/</directory> 11 | </whitelist> 12 | </filter> 13 | </phpunit> 14 | 15 | -------------------------------------------------------------------------------- /lib/php/src/Client.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | namespace Emojione; 4 | 5 | /** 6 | * Client for Emojione 7 | */ 8 | 9 | class Client implements ClientInterface 10 | { 11 | public $ascii = false; // convert ascii smileys? 12 | public $riskyMatchAscii = false; // set true to match ascii without leading/trailing space char 13 | public $shortcodes = true; // convert shortcodes? 14 | public $unicodeAlt = true; // use the unicode char as the alt attribute (makes copy and pasting the resulting text better) 15 | public $emojiVersion = '4.5'; 16 | public $emojiSize = '32'; //available sizes are '32', '64', and '128' 17 | public $greedyMatch = false; 18 | public $blacklistChars = ''; 19 | public $sprites = false; 20 | public $spriteSize = '32'; // available sizes are '32' and '64' 21 | public $imagePathPNG = 'https://cdn.jsdelivr.net/emojione/assets'; 22 | public $fileExtension = '.png'; 23 | public $imageTitleTag = true; 24 | public $unicode_replaceWith = false; 25 | public $ignoredRegexp = '<object[^>]*>.*?<\/object>|<span[^>]*>.*?<\/span>|<(?:object|embed|svg|img|div|span|p|a)[^>]*>'; 26 | public $unicodeRegexp = '(?:[\x{1F3F3}|\x{1F3F4}]\x{FE0F}?\x{200D}?[\x{1F308}|\x{2620}]\x{FE0F}?)|(?:\x{1F441}\x{FE0F}?\x{200D}?\x{1F5E8}\x{FE0F}?)|(?:[\x{1f468}|\x{1f469}]\x{200d}\x{2764}\x{fe0f}?\x{200d}[\x{1f48b}\x{200d}]*[\x{1f468}|\x{1f469}])|(?:[\x{1f468}|\x{1f469}]\x{200d}[\x{1f468}|\x{1f469}]\x{200d}[\x{1f466}|\x{1f467}]\x{200d}[\x{1f466}|\x{1f467}])|(?:[\x{1f468}|\x{1f469}]\x{200d}[\x{1f466}|\x{1f467}]\x{200d}[\x{1f466}|\x{1f467}])|(?:[\x{1f468}|\x{1f469}]\x{200d}[\x{1f468}|\x{1f469}]\x{200d}[\x{1f466}|\x{1f467}])|(?:[\x{1f468}|\x{1f469}]\x{200d}[\x{1f466}|\x{1f467}])|(?:[\x{1F9B8}|\x{1F9B9}]+[\x{1F3FB}-\x{1F3FF}]?\x{200D}[\x{2640}-\x{2642}]?\x{FE0F}?)|(?:[\x{1F468}|\x{1F469}]+[\x{1F3FB}-\x{1F3FF}]?\x{200D}[\x{1F9B0}-\x{1F9B3}]+\x{FE0F}?)|[\x{0023}-\x{0039}]\x{FE0F}?\x{20e3}|(?:\x{1F3F4}[\x{E0060}-\x{E00FF}]{1,6})|[\x{1F1E0}-\x{1F1FF}]{2}|(?:[\x{1F468}|\x{1F469}]\x{FE0F}?[\x{1F3FB}-\x{1F3FF}]?\x{200D}?[\x{2695}|\x{2696}|\x{2708}|\x{1F4BB}|\x{1F4BC}|\x{1F527}|\x{1F52C}|\x{1F680}|\x{1F692}|\x{1F33E}|\x{1F3EB}|\x{1F3EC}|\x{1f373}|\x{1f393}|\x{1f3a4}|\x{1f3ed}|\x{1f3a8}]\x{FE0F}?)|[\x{1F468}-\x{1F469}\x{1F9D0}-\x{1F9DF}][\x{1F3FA}-\x{1F3FF}]?\x{200D}?[\x{2640}\x{2642}\x{2695}\x{2696}\x{2708}]?\x{FE0F}?|(?:[\x{1F9B5}|\x{1F9B6}]+[\x{1F3FB}-\x{1F3FF}]+)|(?:[\x{1f46e}\x{1F468}\x{1F469}\x{1f575}\x{1f471}-\x{1f487}\x{1F645}-\x{1F64E}\x{1F926}\x{1F937}]|[\x{1F460}-\x{1F482}\x{1F3C3}-\x{1F3CC}\x{26F9}\x{1F486}\x{1F487}\x{1F6A3}-\x{1F6B6}\x{1F938}-\x{1F93E}]|\x{1F46F})\x{FE0F}?[\x{1F3FA}-\x{1F3FF}]?\x{200D}?[\x{2640}\x{2642}]?\x{FE0F}?|(?:[\x{26F9}\x{261D}\x{270A}-\x{270D}\x{1F385}-\x{1F3CC}\x{1F442}-\x{1F4AA}\x{1F574}-\x{1F596}\x{1F645}-\x{1F64F}\x{1F6A3}-\x{1F6CC}\x{1F918}-\x{1F93E}]\x{FE0F}?[\x{1F3FA}-\x{1F3FF}])|(?:[\x{2194}-\x{2199}\x{21a9}-\x{21aa}]\x{FE0F}?|[\x{0023}-\x{002a}]|[\x{3030}\x{303d}]\x{FE0F}?|(?:[\x{1F170}-\x{1F171}]|[\x{1F17E}-\x{1F17F}]|\x{1F18E}|[\x{1F191}-\x{1F19A}]|[\x{1F1E6}-\x{1F1FF}])\x{FE0F}?|\x{24c2}\x{FE0F}?|[\x{3297}\x{3299}]\x{FE0F}?|(?:[\x{1F201}-\x{1F202}]|\x{1F21A}|\x{1F22F}|[\x{1F232}-\x{1F23A}]|[\x{1F250}-\x{1F251}])\x{FE0F}?|[\x{203c}\x{2049}]\x{FE0F}?|[\x{25aa}-\x{25ab}\x{25b6}\x{25c0}\x{25fb}-\x{25fe}]\x{FE0F}?|[\x{00a9}\x{00ae}]\x{FE0F}?|[\x{2122}\x{2139}]\x{FE0F}?|\x{1F004}\x{FE0F}?|[\x{2b05}-\x{2b07}\x{2b1b}-\x{2b1c}\x{2b50}\x{2b55}]\x{FE0F}?|[\x{231a}-\x{231b}\x{2328}\x{23cf}\x{23e9}-\x{23f3}\x{23f8}-\x{23fa}]\x{FE0F}?|\x{1F0CF}|[\x{2934}\x{2935}]\x{FE0F}?)|[\x{2700}-\x{27bf}]\x{FE0F}?|[\x{1F000}-\x{1F6FF}\x{1F900}-\x{1F9FF}]\x{FE0F}?|[\x{2600}-\x{26ff}]\x{FE0F}?|(?:[\x{1F466}-\x{1F469}]+\x{FE0F}?[\x{1F3FB}-\x{1F3FF}]?)|[\x{0030}-\x{0039}]\x{FE0F}'; 27 | public $shortcodeRegexp = ':([-+\\w]+):'; 28 | public $startTime = 0; 29 | public $endTime = 0; 30 | 31 | protected $ruleset = null; 32 | 33 | public function __construct(RulesetInterface $ruleset = null) 34 | { 35 | if ( ! is_null($ruleset) ) 36 | { 37 | $this->ruleset = $ruleset; 38 | } 39 | 40 | $this->imagePathPNG = $this->imagePathPNG . '/' . $this->emojiVersion . '/png/' . $this->emojiSize . '/'; 41 | $this->spriteSize = ($this->spriteSize == '32' || $this->spriteSize == '64') ? $this->spriteSize : '32'; 42 | } 43 | 44 | // ########################################## 45 | // ######## core methods 46 | // ########################################## 47 | 48 | /** 49 | * First pass changes unicode characters into emoji shortnames. 50 | * Second pass changes shortnames into emoji markup. 51 | * 52 | * @param string $string The input string. 53 | * @return string String with appropriate html for rendering emoji. 54 | */ 55 | public function toImage($string) 56 | { 57 | //$string = $this->unicodeToImage($string); 58 | $string = $this->toShort($string); 59 | $string = $this->shortnameToImage($string); 60 | return $string; 61 | } 62 | 63 | /** 64 | * Uses toShort to transform all unicode into a standard shortname 65 | * then transforms the shortname into unicode. 66 | * This is done for standardization when converting several unicode types. 67 | * 68 | * @param string $string The input string. 69 | * @return string String with standardized unicode. 70 | */ 71 | public function unifyUnicode($string) 72 | { 73 | $string = $this->toShort($string); 74 | $string = $this->shortnameToUnicode($string); 75 | return $string; 76 | } 77 | 78 | /** 79 | * This will output unicode from shortname input. 80 | * If Client/$ascii is true it will also output unicode from ascii. 81 | * This is useful for sending emojis back to mobile devices. 82 | * 83 | * @param string $string The input string. 84 | * @return string String with unicode replacements. 85 | */ 86 | public function shortnameToUnicode($string) 87 | { 88 | if ($this->shortcodes) 89 | { 90 | $string = preg_replace_callback('/'.$this->ignoredRegexp.'|('.$this->shortcodeRegexp.')/Si', array($this, 'shortnameToUnicodeCallback'), $string); 91 | } 92 | 93 | if ($this->ascii) 94 | { 95 | $ruleset = $this->getRuleset(); 96 | $asciiRegexp = $ruleset->getAsciiRegexp(); 97 | $asciiRX = ($this->riskyMatchAscii) ? '|(()'.$asciiRegexp.'())' : '|((\\s|^)'.$asciiRegexp.'(?=\\s|$|[!,.?]))'; 98 | 99 | $string = preg_replace_callback('/'.$this->ignoredRegexp.$asciiRX.'/S', array($this, 'asciiToUnicodeCallback'), $string); 100 | } 101 | 102 | return $string; 103 | } 104 | 105 | /** 106 | * This will replace shortnames with their ascii equivalent. 107 | * ex. :wink: --> ;^) 108 | * This is useful for systems that don't support unicode or images. 109 | * 110 | * @param string $string The input string. 111 | * @return string String with ascii replacements. 112 | */ 113 | public function shortnameToAscii($string) 114 | { 115 | $string = preg_replace_callback('/'.$this->ignoredRegexp.'|('.$this->shortcodeRegexp.')/Si', array($this, 'shortnameToAsciiCallback'), $string); 116 | 117 | return $string; 118 | } 119 | 120 | /** 121 | * This will replace ascii with their shortname equivalent, it bases on reversed ::shortnameToAsciiCallback 122 | * ex. :) --> :slight_smile: 123 | * This is useful for systems that don't ascii emoji. 124 | * 125 | * @param string $string The input ascii. 126 | * @return string String with shortname replacements. 127 | */ 128 | public function asciiToShortname($string) 129 | { 130 | $ruleset = $this->getRuleset(); 131 | $asciiRegexp = $ruleset->getAsciiRegexp(); 132 | $asciiRX = ($this->riskyMatchAscii) ? '|(()'.$asciiRegexp.'())' : '|((\\s|^)'.$asciiRegexp.'(?=\\s|$|[!,.?]))'; 133 | 134 | return preg_replace_callback('/'.$this->ignoredRegexp.$asciiRX.'/S', array($this, 'asciiToShortnameCallback'), $string); 135 | } 136 | 137 | /** 138 | * This will output image markup from shortname input. 139 | * 140 | * @param string $string The input string. 141 | * @return string String with appropriate html for rendering emoji. 142 | */ 143 | public function shortnameToImage($string) 144 | { 145 | if ($this->shortcodes) 146 | { 147 | $string = preg_replace_callback('/'.$this->ignoredRegexp.'|('.$this->shortcodeRegexp.')/Si', array($this, 'shortnameToImageCallback'), $string); 148 | } 149 | 150 | if ($this->ascii) 151 | { 152 | $ruleset = $this->getRuleset(); 153 | $asciiRegexp = $ruleset->getAsciiRegexp(); 154 | $asciiRX = ($this->riskyMatchAscii) ? '|(()'.$asciiRegexp.'())' : '|((\\s|^)'.$asciiRegexp.'(?=\\s|$|[!,.?]))'; 155 | 156 | $string = preg_replace_callback('/'.$this->ignoredRegexp.$asciiRX.'/S', array($this, 'asciiToImageCallback'), $string); 157 | } 158 | 159 | return $string; 160 | } 161 | 162 | /** 163 | * This will return the shortname from unicode input. 164 | * 165 | * @param string $string The input string. 166 | * @return string shortname 167 | */ 168 | public function toShort($string) 169 | { 170 | return preg_replace_callback('/'.$this->ignoredRegexp.'|'.$this->unicodeRegexp.'/u', array($this, 'toShortCallback'), $string); 171 | } 172 | 173 | /** 174 | * This method has been deprecated as of 4.0 175 | * 176 | * @param string $string The input string. 177 | * @return string returns input string. 178 | */ 179 | public function unicodeToImage($string) 180 | { 181 | return $string; 182 | } 183 | 184 | // ########################################## 185 | // ######## preg_replace callbacks 186 | // ########################################## 187 | 188 | /** 189 | * @param array $m Results of preg_replace_callback(). 190 | * @return string Ascii replacement result. 191 | */ 192 | public function shortnameToAsciiCallback($m) 193 | { 194 | if ((!is_array($m)) || (!isset($m[1])) || (empty($m[1]))) 195 | { 196 | return $m[0]; 197 | } 198 | else 199 | { 200 | $ruleset = $this->getRuleset(); 201 | $shortcode_replace = $ruleset->getShortcodeReplace(); 202 | $ascii_replace = $ruleset->getAsciiReplace(); 203 | 204 | $aflipped = array_flip($ascii_replace); 205 | 206 | $shortname = $m[0]; 207 | 208 | if (!isset($shortcode_replace[$shortname])) 209 | { 210 | return $m[0]; 211 | } 212 | 213 | $unicode = $shortcode_replace[$shortname][0]; 214 | 215 | return isset($aflipped[$unicode]) ? $aflipped[$unicode] : $m[0]; 216 | } 217 | } 218 | 219 | /** 220 | * @param array $m Results of preg_replace_callback(). 221 | * @return string Unicode replacement result. 222 | */ 223 | public function shortnameToUnicodeCallback($m) 224 | { 225 | if ((!is_array($m)) || (!isset($m[1])) || (empty($m[1]))) { 226 | return $m[0]; 227 | } 228 | else { 229 | $ruleset = $this->getRuleset(); 230 | $unicode_replace = $ruleset->getUnicodeReplace(); 231 | $shortcode_replace = $ruleset->getShortcodeReplace(); 232 | 233 | $shortname = strtolower($m[1]); 234 | 235 | if (!array_key_exists($shortname, $shortcode_replace)) { 236 | return $m[0]; 237 | } 238 | 239 | $unicode = $shortcode_replace[$shortname][0]; 240 | 241 | return $this->convert($unicode); 242 | } 243 | } 244 | 245 | /** 246 | * @param array $m Results of preg_replace_callback(). 247 | * @return string Image HTML replacement result. 248 | */ 249 | public function shortnameToImageCallback($m) 250 | { 251 | if ((!is_array($m)) || (!isset($m[1])) || (empty($m[1]))) { 252 | return $m[0]; 253 | } 254 | else { 255 | $ruleset = $this->getRuleset(); 256 | $shortcode_replace = $ruleset->getShortcodeReplace(); 257 | 258 | $shortname = $m[1]; 259 | 260 | if (!isset($shortcode_replace[$shortname])) 261 | { 262 | return $m[0]; 263 | } 264 | 265 | $unicode = $shortcode_replace[$shortname][0]; 266 | $filename = $shortcode_replace[$shortname][2]; 267 | $category = (strpos($filename, '-1f3f') !== false) ? 'diversity' : $shortcode_replace[$shortname][3]; 268 | $titleTag = $this->imageTitleTag ? 'title="'.htmlspecialchars($shortname).'"' : ''; 269 | 270 | if ($this->unicodeAlt) 271 | { 272 | $alt = $this->convert($unicode); 273 | } 274 | else 275 | { 276 | $alt = $shortname; 277 | } 278 | 279 | if ($this->sprites) 280 | { 281 | return '<span class="emojione emojione-'.$this->spriteSize.'-'.$category.' _'.$filename.'" '.$titleTag.'>'.$alt.'</span>'; 282 | } 283 | else 284 | { 285 | return '<img class="emojione" alt="'.$alt.'" '.$titleTag.' src="' . $this->imagePathPNG . $filename . $this->fileExtension . '"/>'; 286 | } 287 | } 288 | } 289 | 290 | /** 291 | * @param array $m Results of preg_replace_callback(). 292 | * @return string Unicode replacement result. 293 | */ 294 | public function asciiToUnicodeCallback($m) 295 | { 296 | if ((!is_array($m)) || (!isset($m[3])) || (empty($m[3]))) 297 | { 298 | return $m[0]; 299 | } 300 | else 301 | { 302 | $ruleset = $this->getRuleset(); 303 | $ascii_replace = $ruleset->getAsciiReplace(); 304 | $shortcode_replace = $ruleset->getShortcodeReplace(); 305 | $ascii = $m[3]; 306 | 307 | if ( empty($ascii_replace[$ascii]) ) 308 | { 309 | return $m[3]; 310 | } 311 | else 312 | { 313 | $shortname = $ascii_replace[$ascii]; 314 | $uc_output = $shortcode_replace[$shortname][0]; 315 | return $m[2].$this->convert($uc_output); 316 | } 317 | } 318 | } 319 | 320 | /** 321 | * @param array $m Results of preg_replace_callback(). 322 | * @return string Shortname replacement result. 323 | */ 324 | public function asciiToShortnameCallback($m) 325 | { 326 | if ((!is_array($m)) || (!isset($m[3])) || (empty($m[3]))) 327 | { 328 | return $m[0]; 329 | } 330 | else 331 | { 332 | $ruleset = $this->getRuleset(); 333 | $ascii_replace = $ruleset->getAsciiReplace(); 334 | 335 | $shortcode_replace = array_flip(array_reverse($ruleset->getShortcodeReplace())); 336 | $shortname = $m[3]; 337 | 338 | if ( empty($ascii_replace[$shortname]) ) 339 | { 340 | return $m[3]; 341 | } 342 | else 343 | { 344 | $unicode = $ascii_replace[$shortname]; 345 | return $m[2].$shortcode_replace[$unicode]; 346 | } 347 | } 348 | } 349 | 350 | /** 351 | * @param array $m Results of preg_replace_callback(). 352 | * @return string Image HTML replacement result. 353 | */ 354 | public function asciiToImageCallback($m) 355 | { 356 | if ((!is_array($m)) || (!isset($m[3])) || (empty($m[3]))) 357 | { 358 | return $m[0]; 359 | } 360 | else 361 | { 362 | $ruleset = $this->getRuleset(); 363 | $ascii_replace = $ruleset->getAsciiReplace(); 364 | $shortcode_replace = $ruleset->getShortcodeReplace(); 365 | 366 | $ascii = html_entity_decode($m[3]); 367 | 368 | if ( empty($ascii_replace[$ascii]) ) 369 | { 370 | return $m[3]; 371 | } 372 | else 373 | { 374 | $shortname = $ascii_replace[$ascii]; 375 | $filename = $shortcode_replace[$shortname][2]; 376 | $uc_output = $shortcode_replace[$shortname][0]; 377 | $category = (strpos($filename, '-1f3f') !== false) ? 'diversity' : $shortcode_replace[$shortname][3]; 378 | $titleTag = $this->imageTitleTag ? 'title="'.htmlspecialchars($shortname).'"' : ''; 379 | 380 | // unicode char or shortname for the alt tag? (unicode is better for copying and pasting the resulting text) 381 | if ($this->unicodeAlt) 382 | { 383 | $alt = $this->convert($uc_output); 384 | } 385 | else 386 | { 387 | $alt = htmlspecialchars($ascii); 388 | } 389 | 390 | if ($this->sprites) 391 | { 392 | return $m[2].'<span class="emojione emojione-'.$this->spriteSize.'-'.$category.' _'.$filename.'" '.$titleTag.'>'.$alt.'</span>'; 393 | } 394 | else 395 | { 396 | return $m[2].'<img class="emojione" alt="'.$alt.'" '.$titleTag.' src="' . $this->imagePathPNG . $filename . $this->fileExtension .'"/>'; 397 | } 398 | } 399 | } 400 | } 401 | 402 | /** 403 | * @param array $m Results of preg_replace_callback(). 404 | * @return string shortname result 405 | */ 406 | public function toShortCallback($m) 407 | { 408 | if ((!is_array($m)) || (!isset($m[0])) || (empty($m[0]))) 409 | { 410 | return $m[0]; 411 | } 412 | else 413 | { 414 | $ruleset = $this->getRuleset(); 415 | $unicode_replace = $ruleset->getUnicodeReplace(); 416 | 417 | $unicode = $m[0]; 418 | 419 | if ( !array_key_exists($unicode, $unicode_replace) ) 420 | { 421 | return $m[0]; 422 | } 423 | 424 | return $unicode_replace[$unicode]; 425 | } 426 | } 427 | 428 | // ########################################## 429 | // ######## helper methods 430 | // ########################################## 431 | 432 | /** 433 | * Converts from unicode to hexadecimal NCR. 434 | * 435 | * @param string $unicode unicode character/s 436 | * @return string hexadecimal NCR 437 | * */ 438 | public function convert($unicode) 439 | { 440 | if (stristr($unicode,'-')) 441 | { 442 | $pairs = explode('-',$unicode); 443 | return '&#x'.implode(';&#x',$pairs).';'; 444 | } 445 | else 446 | { 447 | return '&#x'.$unicode.';'; 448 | } 449 | } 450 | 451 | /** 452 | * Get the Ruleset 453 | * 454 | * @return RulesetInterface The Ruleset 455 | */ 456 | public function getRuleset() 457 | { 458 | if ( $this->ruleset === null ) 459 | { 460 | $this->ruleset = new Ruleset; 461 | } 462 | 463 | return $this->ruleset; 464 | } 465 | } -------------------------------------------------------------------------------- /lib/php/src/ClientInterface.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | namespace Emojione; 4 | 5 | 6 | interface ClientInterface 7 | { 8 | /** 9 | * First pass changes unicode characters into emoji markup. 10 | * Second pass changes any shortnames into emoji markup. 11 | * 12 | * @param string $string The input string. 13 | * @return string String with appropriate html for rendering emoji. 14 | */ 15 | public function toImage($string); 16 | 17 | /** 18 | * Uses toShort to transform all unicode into a standard shortname 19 | * then transforms the shortname into unicode. 20 | * This is done for standardization when converting several unicode types. 21 | * 22 | * @param string $string The input string. 23 | * @return string String with standardized unicode. 24 | */ 25 | public function unifyUnicode($string); 26 | 27 | /** 28 | * This will output unicode from shortname input. 29 | * If Client/$ascii is true it will also output unicode from ascii. 30 | * This is useful for sending emojis back to mobile devices. 31 | * 32 | * @param string $string The input string. 33 | * @return string String with unicode replacements. 34 | */ 35 | public function shortnameToUnicode($string); 36 | 37 | /** 38 | * This will replace shortnames with their ascii equivalent. 39 | * ex. :wink: --> ;^) 40 | * This is useful for systems that don't support unicode or images. 41 | * 42 | * @param string $string The input string. 43 | * @return string String with ascii replacements. 44 | */ 45 | public function shortnameToAscii($string); 46 | 47 | /** 48 | * This will output image markup from shortname input. 49 | * 50 | * @param string $string The input string. 51 | * @return string String with appropriate html for rendering emoji. 52 | */ 53 | public function shortnameToImage($string); 54 | 55 | /** 56 | * This will return the shortname from unicode input. 57 | * 58 | * @param string $string The input string. 59 | * @return string shortname 60 | */ 61 | public function toShort($string); 62 | 63 | /** 64 | * This will output image markup from unicode input. 65 | * 66 | * @param string $string The input string. 67 | * @return string String with appropriate html for rendering emoji. 68 | */ 69 | public function unicodeToImage($string); 70 | } -------------------------------------------------------------------------------- /lib/php/src/Emojione.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | namespace Emojione; 4 | 5 | class Emojione 6 | { 7 | public static $ascii = false; // convert ascii smileys? 8 | public static $riskyMatchAscii = false; // set true to match ascii without leading/trailing space char 9 | public static $unicodeAlt = true; // use the unicode char as the alt attribute (makes copy and pasting the resulting text better) 10 | public static $emojiVersion = '4.5'; 11 | public static $emojiSize = '32'; 12 | public static $greedyMatch = false; 13 | public static $blacklistChars = ''; 14 | public static $sprites = false; 15 | public static $spriteSize = '32'; 16 | public static $imagePathPNG = 'https://cdn.jsdelivr.net/emojione/assets/'; 17 | public static $fileExtension = '.png'; 18 | public static $imageTitleTag = true; 19 | public static $ignoredRegexp = '<object[^>]*>.*?<\/object>|<span[^>]*>.*?<\/span>|<(?:object|embed|svg|img|div|span|p|a)[^>]*>'; 20 | public static $unicodeRegexp = '(?:[\x{1F3F3}|\x{1F3F4}]\x{FE0F}?\x{200D}?[\x{1F308}|\x{2620}]\x{FE0F}?)|(?:\x{1F441}\x{FE0F}?\x{200D}?\x{1F5E8}\x{FE0F}?)|(?:[\x{1f468}|\x{1f469}]\x{200d}\x{2764}\x{fe0f}?\x{200d}[\x{1f48b}\x{200d}]*[\x{1f468}|\x{1f469}])|(?:[\x{1f468}|\x{1f469}]\x{200d}[\x{1f468}|\x{1f469}]\x{200d}[\x{1f466}|\x{1f467}]\x{200d}[\x{1f466}|\x{1f467}])|(?:[\x{1f468}|\x{1f469}]\x{200d}[\x{1f466}|\x{1f467}]\x{200d}[\x{1f466}|\x{1f467}])|(?:[\x{1f468}|\x{1f469}]\x{200d}[\x{1f468}|\x{1f469}]\x{200d}[\x{1f466}|\x{1f467}])|(?:[\x{1f468}|\x{1f469}]\x{200d}[\x{1f466}|\x{1f467}])|(?:[\x{1F9B8}|\x{1F9B9}]+[\x{1F3FB}-\x{1F3FF}]?\x{200D}[\x{2640}-\x{2642}]?\x{FE0F}?)|(?:[\x{1F468}|\x{1F469}]+[\x{1F3FB}-\x{1F3FF}]?\x{200D}[\x{1F9B0}-\x{1F9B3}]+\x{FE0F}?)|[\x{0023}-\x{0039}]\x{FE0F}?\x{20e3}|(?:\x{1F3F4}[\x{E0060}-\x{E00FF}]{1,6})|[\x{1F1E0}-\x{1F1FF}]{2}|(?:[\x{1F468}|\x{1F469}]\x{FE0F}?[\x{1F3FB}-\x{1F3FF}]?\x{200D}?[\x{2695}|\x{2696}|\x{2708}|\x{1F4BB}|\x{1F4BC}|\x{1F527}|\x{1F52C}|\x{1F680}|\x{1F692}|\x{1F33E}|\x{1F3EB}|\x{1F3EC}|\x{1f373}|\x{1f393}|\x{1f3a4}|\x{1f3ed}|\x{1f3a8}]\x{FE0F}?)|[\x{1F468}-\x{1F469}\x{1F9D0}-\x{1F9DF}][\x{1F3FA}-\x{1F3FF}]?\x{200D}?[\x{2640}\x{2642}\x{2695}\x{2696}\x{2708}]?\x{FE0F}?|(?:[\x{1F9B5}|\x{1F9B6}]+[\x{1F3FB}-\x{1F3FF}]+)|(?:[\x{1f46e}\x{1F468}\x{1F469}\x{1f575}\x{1f471}-\x{1f487}\x{1F645}-\x{1F64E}\x{1F926}\x{1F937}]|[\x{1F460}-\x{1F482}\x{1F3C3}-\x{1F3CC}\x{26F9}\x{1F486}\x{1F487}\x{1F6A3}-\x{1F6B6}\x{1F938}-\x{1F93E}]|\x{1F46F})\x{FE0F}?[\x{1F3FA}-\x{1F3FF}]?\x{200D}?[\x{2640}\x{2642}]?\x{FE0F}?|(?:[\x{26F9}\x{261D}\x{270A}-\x{270D}\x{1F385}-\x{1F3CC}\x{1F442}-\x{1F4AA}\x{1F574}-\x{1F596}\x{1F645}-\x{1F64F}\x{1F6A3}-\x{1F6CC}\x{1F918}-\x{1F93E}]\x{FE0F}?[\x{1F3FA}-\x{1F3FF}])|(?:[\x{2194}-\x{2199}\x{21a9}-\x{21aa}]\x{FE0F}?|[\x{0023}-\x{002a}]|[\x{3030}\x{303d}]\x{FE0F}?|(?:[\x{1F170}-\x{1F171}]|[\x{1F17E}-\x{1F17F}]|\x{1F18E}|[\x{1F191}-\x{1F19A}]|[\x{1F1E6}-\x{1F1FF}])\x{FE0F}?|\x{24c2}\x{FE0F}?|[\x{3297}\x{3299}]\x{FE0F}?|(?:[\x{1F201}-\x{1F202}]|\x{1F21A}|\x{1F22F}|[\x{1F232}-\x{1F23A}]|[\x{1F250}-\x{1F251}])\x{FE0F}?|[\x{203c}\x{2049}]\x{FE0F}?|[\x{25aa}-\x{25ab}\x{25b6}\x{25c0}\x{25fb}-\x{25fe}]\x{FE0F}?|[\x{00a9}\x{00ae}]\x{FE0F}?|[\x{2122}\x{2139}]\x{FE0F}?|\x{1F004}\x{FE0F}?|[\x{2b05}-\x{2b07}\x{2b1b}-\x{2b1c}\x{2b50}\x{2b55}]\x{FE0F}?|[\x{231a}-\x{231b}\x{2328}\x{23cf}\x{23e9}-\x{23f3}\x{23f8}-\x{23fa}]\x{FE0F}?|\x{1F0CF}|[\x{2934}\x{2935}]\x{FE0F}?)|[\x{2700}-\x{27bf}]\x{FE0F}?|[\x{1F000}-\x{1F6FF}\x{1F900}-\x{1F9FF}]\x{FE0F}?|[\x{2600}-\x{26ff}]\x{FE0F}?|(?:[\x{1F466}-\x{1F469}]+\x{FE0F}?[\x{1F3FB}-\x{1F3FF}]?)|[\x{0030}-\x{0039}]\x{FE0F}'; 21 | public static $shortcodeRegexp = ':([-+\\w]+):'; 22 | 23 | protected static $client = null; 24 | 25 | /** 26 | * Magic caller 27 | * 28 | * @throws \BadMethodCallException If the method doesn't exists in client 29 | */ 30 | public static function __callStatic($method, $args) 31 | { 32 | $client = static::getClient(); 33 | 34 | // DEPRECATED 35 | static::updateConfig($client); 36 | 37 | if ( ! method_exists($client, $method) ) 38 | { 39 | throw new \BadMethodCallException('The method "' . $method . '" does not exist.'); 40 | } 41 | 42 | return call_user_func_array(array($client, $method), $args); 43 | 44 | } 45 | 46 | /** 47 | * Get the Client 48 | * 49 | * @return ClientInterface The Client 50 | */ 51 | public static function getClient() 52 | { 53 | if ( static::$client === null ) 54 | { 55 | static::setClient(new Client); 56 | } 57 | 58 | return static::$client; 59 | } 60 | 61 | /** 62 | * Set the Client 63 | * 64 | * @param ClientInterface $client The Client 65 | * @return void 66 | */ 67 | public static function setClient(ClientInterface $client) 68 | { 69 | // DEPRECATED 70 | static::loadConfig($client); 71 | 72 | static::$client = $client; 73 | } 74 | 75 | /** 76 | * Load config from Client 77 | * 78 | * @deprecated 79 | * 80 | * @param ClientInterface $client The Client 81 | * @return self 82 | */ 83 | protected static function loadConfig(ClientInterface $client) 84 | { 85 | static::$ascii = $client->ascii; 86 | static::$riskyMatchAscii = $client->riskyMatchAscii; 87 | static::$unicodeAlt = $client->unicodeAlt; 88 | static::$emojiVersion = $client->emojiVersion; 89 | static::$emojiSize = $client->emojiSize; 90 | static::$greedyMatch = $client->greedyMatch; 91 | static::$blacklistChars = $client->blacklistChars; 92 | static::$sprites = $client->sprites; 93 | static::$spriteSize = $client->spriteSize; 94 | static::$imagePathPNG = $client->imagePathPNG; 95 | static::$fileExtension = $client->fileExtension; 96 | static::$imageTitleTag = $client->imageTitleTag; 97 | static::$ignoredRegexp = $client->ignoredRegexp; 98 | static::$unicodeRegexp = $client->unicodeRegexp; 99 | static::$shortcodeRegexp = $client->shortcodeRegexp; 100 | } 101 | 102 | /** 103 | * Update config in Client 104 | * 105 | * @deprecated 106 | * 107 | * @param ClientInterface $client The Client 108 | * @return self 109 | */ 110 | protected static function updateConfig(ClientInterface $client) 111 | { 112 | $client->ascii = static::$ascii; 113 | $client->riskyMatchAscii = static::$riskyMatchAscii; 114 | $client->unicodeAlt = static::$unicodeAlt; 115 | $client->emojiVersion = static::$emojiVersion; 116 | $client->emojiSize = static::$emojiSize; 117 | $client->greedyMatch = static::$greedyMatch; 118 | $client->blacklistChars = static::$blacklistChars; 119 | $client->sprites = static::$sprites; 120 | $client->spriteSize = static::$spriteSize; 121 | $client->imagePathPNG = static::$imagePathPNG; 122 | $client->fileExtension = static::$fileExtension; 123 | $client->imageTitleTag = static::$imageTitleTag; 124 | $client->ignoredRegexp = static::$ignoredRegexp; 125 | $client->unicodeRegexp = static::$unicodeRegexp; 126 | $client->shortcodeRegexp = static::$shortcodeRegexp; 127 | } 128 | } -------------------------------------------------------------------------------- /lib/php/src/RulesetInterface.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | namespace Emojione; 4 | 5 | interface RulesetInterface 6 | { 7 | /** 8 | * Returns the shortcode unicode replacement rules 9 | * 10 | * @return array The shortcode unicode rules 11 | */ 12 | public function getShortcodeReplace(); 13 | 14 | /** 15 | * Returns the ascii unicode replacement rules 16 | * 17 | * @return array The ascii unicode rules 18 | */ 19 | public function getAsciiReplace(); 20 | 21 | /** 22 | * Returns the unicode shortcode replacement rules 23 | * 24 | * @return array The unicode shortcode rules 25 | */ 26 | public function getUnicodeReplace(); 27 | 28 | /** 29 | * Returns the unicode shortcode greedy replacement rules 30 | * 31 | * @return array The unicode shortcode greedy rules 32 | */ 33 | public function getUnicodeReplaceGreedy(); 34 | 35 | /** 36 | * Returns the regexp to find ascii smilies 37 | * 38 | * @return string The regexp 39 | */ 40 | public function getAsciiRegexp(); 41 | } -------------------------------------------------------------------------------- /lib/php/test/ConversionTest.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | /* 4 | Tests based on lib/tests.md 5 | */ 6 | 7 | namespace Emojione\Test; 8 | 9 | use Emojione\Emojione; 10 | 11 | class ConversionTest extends \PHPUnit_Framework_TestCase 12 | { 13 | 14 | private $emojiVersion = '4.5'; 15 | 16 | /** 17 | * test single unicode character 18 | * 19 | * @return void 20 | */ 21 | public function testSingleUnicodeCharacter() 22 | { 23 | $unicode = '🐌'; 24 | $shortname = ':snail:'; 25 | $image = '<img class="emojione" alt="🐌" title=":snail:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f40c.png"/>'; 26 | $image_fix = '<img class="emojione" alt="🐌" title=":snail:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f40c.png"/>'; 27 | 28 | $this->assertEquals(Emojione::toShort($unicode), $shortname); 29 | $this->assertEquals(Emojione::shortnameToImage($shortname), $image_fix); 30 | $this->assertEquals(Emojione::shortnameToUnicode($shortname), $unicode); 31 | $this->assertEquals(Emojione::unicodeToImage($unicode), $image); 32 | $this->assertEquals(Emojione::toImage($unicode), $image); 33 | $this->assertEquals(Emojione::toImage($shortname), $image_fix); 34 | } 35 | 36 | /** 37 | * test shortname mid sentence 38 | * 39 | * @return void 40 | */ 41 | public function testShortnameInsideSentence() 42 | { 43 | $unicode = 'The 🦄 is EmojiOne\'s official mascot.'; 44 | $shortname = 'The :unicorn: is EmojiOne\'s official mascot.'; 45 | $image = 'The <img class="emojione" alt="🦄" title=":unicorn:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f984.png"/> is EmojiOne\'s official mascot.'; 46 | $image_fix = 'The <img class="emojione" alt="🦄" title=":unicorn:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f984.png"/> is EmojiOne\'s official mascot.'; 47 | 48 | $this->assertEquals(Emojione::toShort($unicode), $shortname); 49 | $this->assertEquals(Emojione::shortnameToImage($shortname), $image_fix); 50 | $this->assertEquals(Emojione::shortnameToUnicode($shortname), $unicode); 51 | $this->assertEquals(Emojione::unicodeToImage($unicode), $image); 52 | $this->assertEquals(Emojione::toImage($unicode), $image); 53 | $this->assertEquals(Emojione::toImage($shortname), $image_fix); 54 | } 55 | 56 | /** 57 | * test shortname mid sentence with a comma 58 | * 59 | * @return void 60 | */ 61 | public function testShortnameInsideSentenceWithComma() 62 | { 63 | $unicode = 'The 🦄, is EmojiOne\'s official mascot.'; 64 | $shortname = 'The :unicorn:, is EmojiOne\'s official mascot.'; 65 | $image = 'The <img class="emojione" alt="🦄" title=":unicorn:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f984.png"/>, is EmojiOne\'s official mascot.'; 66 | $image_fix = 'The <img class="emojione" alt="🦄" title=":unicorn:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f984.png"/>, is EmojiOne\'s official mascot.'; 67 | 68 | $this->assertEquals(Emojione::toShort($unicode), $shortname); 69 | $this->assertEquals(Emojione::shortnameToImage($shortname), $image_fix); 70 | $this->assertEquals(Emojione::shortnameToUnicode($shortname), $unicode); 71 | $this->assertEquals(Emojione::unicodeToImage($unicode), $image); 72 | $this->assertEquals(Emojione::toImage($unicode), $image); 73 | $this->assertEquals(Emojione::toImage($shortname), $image_fix); 74 | } 75 | 76 | /** 77 | * test shortname at start of sentence 78 | * 79 | * @return void 80 | */ 81 | public function testShortnameAtStartOfSentence() 82 | { 83 | $unicode = '🐌 mail.'; 84 | $shortname = ':snail: mail.'; 85 | $image = '<img class="emojione" alt="🐌" title=":snail:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f40c.png"/> mail.'; 86 | $image_fix = '<img class="emojione" alt="🐌" title=":snail:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f40c.png"/> mail.'; 87 | 88 | $this->assertEquals(Emojione::toShort($unicode), $shortname); 89 | $this->assertEquals(Emojione::shortnameToImage($shortname), $image_fix); 90 | $this->assertEquals(Emojione::shortnameToUnicode($shortname), $unicode); 91 | $this->assertEquals(Emojione::unicodeToImage($unicode), $image); 92 | $this->assertEquals(Emojione::toImage($unicode), $image); 93 | $this->assertEquals(Emojione::toImage($shortname), $image_fix); 94 | } 95 | 96 | /** 97 | * test shortname at start of sentence with apostrophe 98 | * 99 | * @return void 100 | */ 101 | public function testShortnameAtStartOfSentenceWithApostrophe() 102 | { 103 | $unicode = '🐌\'s are cool!'; 104 | $shortname = ':snail:\'s are cool!'; 105 | $image = '<img class="emojione" alt="🐌" title=":snail:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f40c.png"/>\'s are cool!'; 106 | $image_fix = '<img class="emojione" alt="🐌" title=":snail:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f40c.png"/>\'s are cool!'; 107 | 108 | $this->assertEquals(Emojione::toShort($unicode), $shortname); 109 | $this->assertEquals(Emojione::shortnameToImage($shortname), $image_fix); 110 | $this->assertEquals(Emojione::shortnameToUnicode($shortname), $unicode); 111 | $this->assertEquals(Emojione::unicodeToImage($unicode), $image); 112 | $this->assertEquals(Emojione::toImage($unicode), $image); 113 | $this->assertEquals(Emojione::toImage($shortname), $image_fix); 114 | } 115 | 116 | /** 117 | * test shortname at end of sentence 118 | * 119 | * @return void 120 | */ 121 | public function testShortnameAtEndOfSentence() 122 | { 123 | $unicode = 'EmojiOne\'s official mascot is 🦄.'; 124 | $shortname = 'EmojiOne\'s official mascot is :unicorn:.'; 125 | $image = 'EmojiOne\'s official mascot is <img class="emojione" alt="🦄" title=":unicorn:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f984.png"/>.'; 126 | $image_fix = 'EmojiOne\'s official mascot is <img class="emojione" alt="🦄" title=":unicorn:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f984.png"/>.'; 127 | 128 | $this->assertEquals(Emojione::toShort($unicode), $shortname); 129 | $this->assertEquals(Emojione::shortnameToImage($shortname), $image_fix); 130 | $this->assertEquals(Emojione::shortnameToUnicode($shortname), $unicode); 131 | $this->assertEquals(Emojione::unicodeToImage($unicode), $image); 132 | $this->assertEquals(Emojione::toImage($unicode), $image); 133 | $this->assertEquals(Emojione::toImage($shortname), $image_fix); 134 | } 135 | 136 | /** 137 | * test shortname at end of sentence with alternate punctuation 138 | * 139 | * @return void 140 | */ 141 | public function testShortnameAtEndOfSentenceWithAlternatePunctuation() 142 | { 143 | $unicode = 'EmojiOne\'s official mascot is 🦄!'; 144 | $shortname = 'EmojiOne\'s official mascot is :unicorn:!'; 145 | $image = 'EmojiOne\'s official mascot is <img class="emojione" alt="🦄" title=":unicorn:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f984.png"/>!'; 146 | $image_fix = 'EmojiOne\'s official mascot is <img class="emojione" alt="🦄" title=":unicorn:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f984.png"/>!'; 147 | 148 | $this->assertEquals(Emojione::toShort($unicode), $shortname); 149 | $this->assertEquals(Emojione::shortnameToImage($shortname), $image_fix); 150 | $this->assertEquals(Emojione::shortnameToUnicode($shortname), $unicode); 151 | $this->assertEquals(Emojione::unicodeToImage($unicode), $image); 152 | $this->assertEquals(Emojione::toImage($unicode), $image); 153 | $this->assertEquals(Emojione::toImage($shortname), $image_fix); 154 | } 155 | 156 | /** 157 | * test shortname at end of sentence with preceeding colon 158 | * 159 | * @return void 160 | */ 161 | public function testShortnameAtEndOfSentenceWithPreceedingColon() 162 | { 163 | $unicode = 'EmojiOne\'s official mascot: 🦄'; 164 | $shortname = 'EmojiOne\'s official mascot: :unicorn:'; 165 | $image = 'EmojiOne\'s official mascot: <img class="emojione" alt="🦄" title=":unicorn:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f984.png"/>'; 166 | $image_fix = 'EmojiOne\'s official mascot: <img class="emojione" alt="🦄" title=":unicorn:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f984.png"/>'; 167 | 168 | $this->assertEquals(Emojione::toShort($unicode), $shortname); 169 | $this->assertEquals(Emojione::shortnameToImage($shortname), $image_fix); 170 | $this->assertEquals(Emojione::shortnameToUnicode($shortname), $unicode); 171 | $this->assertEquals(Emojione::unicodeToImage($unicode), $image); 172 | $this->assertEquals(Emojione::toImage($unicode), $image); 173 | $this->assertEquals(Emojione::toImage($shortname), $image_fix); 174 | } 175 | 176 | /** 177 | * shortname inside of IMG tag 178 | * 179 | * @return void 180 | */ 181 | public function testShortnameInsideOfImgTag() 182 | { 183 | $unicode = 'The <img class="emojione" alt="🦄" title=":unicorn:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f984.png" /> is EmojiOne\'s official mascot.'; 184 | $shortname = 'The <img class="emojione" alt=":unicorn:" title=":unicorn:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f984.png" /> is EmojiOne\'s official mascot.'; 185 | 186 | $this->assertEquals(Emojione::toShort($unicode), $unicode); 187 | $this->assertEquals(Emojione::shortnameToImage($shortname), $shortname); 188 | $this->assertEquals(Emojione::shortnameToUnicode($shortname), $shortname); 189 | $this->assertEquals(Emojione::unicodeToImage($unicode), $unicode); 190 | $this->assertEquals(Emojione::toImage($unicode), $unicode); 191 | $this->assertEquals(Emojione::toImage($shortname), $shortname); 192 | } 193 | 194 | /** 195 | * test single ascii character 196 | * 197 | * @return void 198 | */ 199 | public function testSingleSmiley() 200 | { 201 | // enable ASCII conversion 202 | $default_ascii = Emojione::$ascii; 203 | Emojione::$ascii = true; 204 | 205 | $ascii = ':-)'; 206 | $unicode = '🙂'; 207 | $unicode_fix = '🙂'; 208 | $shortname = ':slight_smile:'; 209 | $image = '<img class="emojione" alt="🙂" title=":slight_smile:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f642.png"/>'; 210 | 211 | $this->assertEquals(Emojione::shortnameToImage($shortname), $image); 212 | $this->assertEquals(Emojione::shortnameToImage($ascii), $image); 213 | $this->assertEquals(Emojione::toImage($shortname), $image); 214 | $this->assertEquals(Emojione::toImage($ascii), $image); 215 | $this->assertEquals(Emojione::shortnameToAscii($shortname), ':]'); 216 | $this->assertEquals(Emojione::unifyUnicode($ascii), $unicode_fix); 217 | $this->assertEquals(Emojione::unifyUnicode($shortname), $unicode); 218 | 219 | // back to default ASCII conversion 220 | Emojione::$ascii = $default_ascii; 221 | } 222 | 223 | /** 224 | * test single smiley with incorrect case (shouldn't convert) 225 | * 226 | * @return void 227 | */ 228 | public function testSingleSmileyWithIncorrectCase() 229 | { 230 | // enable ASCII conversion 231 | $default_ascii = Emojione::$ascii; 232 | Emojione::$ascii = true; 233 | 234 | $ascii = ':d'; 235 | 236 | $this->assertEquals(Emojione::shortnameToImage($ascii), $ascii); 237 | $this->assertEquals(Emojione::toImage($ascii), $ascii); 238 | $this->assertEquals(Emojione::unifyUnicode($ascii), $ascii); 239 | 240 | // back to default ASCII conversion 241 | Emojione::$ascii = $default_ascii; 242 | } 243 | 244 | /** 245 | * test multiple smileys 246 | * 247 | * @return void 248 | */ 249 | public function testMultipleSmilies() 250 | { 251 | // enable ASCII conversion 252 | $default_ascii = Emojione::$ascii; 253 | Emojione::$ascii = true; 254 | 255 | $ascii = ';) :p :*'; 256 | $ascii_fix = ';^) d: :^*'; 257 | $unicode = '😉 😛 😘'; 258 | $unicode_fix = '😉 😛 😘'; 259 | $shortname = ':wink: :stuck_out_tongue: :kissing_heart:'; 260 | $image = '<img class="emojione" alt="😉" title=":wink:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f609.png"/> <img class="emojione" alt="😛" title=":stuck_out_tongue:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f61b.png"/> <img class="emojione" alt="😘" title=":kissing_heart:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f618.png"/>'; 261 | 262 | $this->assertEquals(Emojione::shortnameToImage($shortname), $image); 263 | $this->assertEquals(Emojione::shortnameToImage($ascii), $image); 264 | $this->assertEquals(Emojione::toImage($shortname), $image); 265 | $this->assertEquals(Emojione::toImage($ascii), $image); 266 | $this->assertEquals(Emojione::shortnameToAscii($shortname), $ascii_fix); 267 | $this->assertEquals(Emojione::unifyUnicode($ascii), $unicode_fix); 268 | $this->assertEquals(Emojione::unifyUnicode($shortname), $unicode); 269 | 270 | // back to default ASCII conversion 271 | Emojione::$ascii = $default_ascii; 272 | } 273 | 274 | /** 275 | * test smiley to start a sentence 276 | * 277 | * @return void 278 | */ 279 | public function testSmileyAtSentenceStart() 280 | { 281 | // enable ASCII conversion 282 | $default_ascii = Emojione::$ascii; 283 | Emojione::$ascii = true; 284 | 285 | $ascii = ':\\ is our confused smiley.'; 286 | $ascii_fix = '=L is our confused smiley.'; 287 | $unicode = '😕 is our confused smiley.'; 288 | $unicode_fix = '😕 is our confused smiley.'; 289 | $shortname = ':confused: is our confused smiley.'; 290 | $image = '<img class="emojione" alt="😕" title=":confused:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f615.png"/> is our confused smiley.'; 291 | 292 | $this->assertEquals(Emojione::shortnameToImage($shortname), $image); 293 | $this->assertEquals(Emojione::shortnameToImage($ascii), $image); 294 | $this->assertEquals(Emojione::toImage($shortname), $image); 295 | $this->assertEquals(Emojione::toImage($ascii), $image); 296 | $this->assertEquals(Emojione::shortnameToAscii($shortname), $ascii_fix); 297 | $this->assertEquals(Emojione::unifyUnicode($ascii), $unicode_fix); 298 | $this->assertEquals(Emojione::unifyUnicode($shortname), $unicode); 299 | 300 | // back to default ASCII conversion 301 | Emojione::$ascii = $default_ascii; 302 | } 303 | 304 | /** 305 | * test smiley to end a sentence 306 | * 307 | * @return void 308 | */ 309 | public function testSmileyAtSentenceEnd() 310 | { 311 | // enable ASCII conversion 312 | $default_ascii = Emojione::$ascii; 313 | Emojione::$ascii = true; 314 | 315 | $ascii = 'Our smiley to represent joy is :\')'; 316 | $ascii_fix = 'Our smiley to represent joy is :\'-)'; 317 | $unicode = 'Our smiley to represent joy is 😂'; 318 | $unicode_fix = 'Our smiley to represent joy is 😂'; 319 | $shortname = 'Our smiley to represent joy is :joy:'; 320 | $image = 'Our smiley to represent joy is <img class="emojione" alt="😂" title=":joy:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f602.png"/>'; 321 | 322 | $this->assertEquals(Emojione::shortnameToImage($shortname), $image); 323 | $this->assertEquals(Emojione::shortnameToImage($ascii), $image); 324 | $this->assertEquals(Emojione::toImage($shortname), $image); 325 | $this->assertEquals(Emojione::toImage($ascii), $image); 326 | $this->assertEquals(Emojione::shortnameToAscii($shortname), $ascii_fix); 327 | $this->assertEquals(Emojione::unifyUnicode($ascii), $unicode_fix); 328 | $this->assertEquals(Emojione::unifyUnicode($shortname), $unicode); 329 | 330 | // back to default ASCII conversion 331 | Emojione::$ascii = $default_ascii; 332 | } 333 | 334 | /** 335 | * test smiley to end a sentence with puncuation 336 | * 337 | * @return void 338 | */ 339 | public function testSmileyAtSentenceEndWithPunctuation() 340 | { 341 | // enable ASCII conversion 342 | $default_ascii = Emojione::$ascii; 343 | Emojione::$ascii = true; 344 | 345 | $ascii = 'The reverse is the joy smiley is the cry smiley :\'(.'; 346 | $ascii_fix = 'The reverse is the joy smiley is the cry smiley ;-(.'; 347 | $unicode = 'The reverse is the joy smiley is the cry smiley 😢.'; 348 | $unicode_fix = 'The reverse is the joy smiley is the cry smiley 😢.'; 349 | $shortname = 'The reverse is the joy smiley is the cry smiley :cry:.'; 350 | $image = 'The reverse is the joy smiley is the cry smiley <img class="emojione" alt="😢" title=":cry:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f622.png"/>.'; 351 | 352 | $this->assertEquals(Emojione::shortnameToImage($shortname), $image); 353 | $this->assertEquals(Emojione::shortnameToImage($ascii), $image); 354 | $this->assertEquals(Emojione::toImage($shortname), $image); 355 | $this->assertEquals(Emojione::toImage($ascii), $image); 356 | $this->assertEquals(Emojione::shortnameToAscii($shortname), $ascii_fix); 357 | $this->assertEquals(Emojione::unifyUnicode($ascii), $unicode_fix); 358 | $this->assertEquals(Emojione::unifyUnicode($shortname), $unicode); 359 | 360 | // back to default ASCII conversion 361 | Emojione::$ascii = $default_ascii; 362 | } 363 | 364 | /** 365 | * test smiley to end a sentence with preceeding puncuration 366 | * 367 | * @return void 368 | */ 369 | public function testSmileyAtSentenceEndWithPreceedingPunctuation() 370 | { 371 | // enable ASCII conversion 372 | $default_ascii = Emojione::$ascii; 373 | Emojione::$ascii = true; 374 | 375 | $ascii = 'This is the "flushed" smiley: :$.'; 376 | $ascii_fix = 'This is the "flushed" smiley: =$.'; 377 | $unicode = 'This is the "flushed" smiley: 😳.'; 378 | $unicode_fix = 'This is the "flushed" smiley: 😳.'; 379 | $shortname = 'This is the "flushed" smiley: :flushed:.'; 380 | $image = 'This is the "flushed" smiley: <img class="emojione" alt="😳" title=":flushed:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f633.png"/>.'; 381 | 382 | $this->assertEquals(Emojione::shortnameToImage($shortname), $image); 383 | $this->assertEquals(Emojione::shortnameToImage($ascii), $image); 384 | $this->assertEquals(Emojione::toImage($shortname), $image); 385 | $this->assertEquals(Emojione::toImage($ascii), $image); 386 | $this->assertEquals(Emojione::shortnameToAscii($shortname), $ascii_fix); 387 | $this->assertEquals(Emojione::unifyUnicode($ascii), $unicode_fix); 388 | $this->assertEquals(Emojione::unifyUnicode($shortname), $unicode); 389 | 390 | // back to default ASCII conversion 391 | Emojione::$ascii = $default_ascii; 392 | } 393 | 394 | /** 395 | * test smiley inside of an IMG tag (shouldn't convert anything inside of the tag) 396 | * 397 | * @return void 398 | */ 399 | public function testSmileyInsideAnImgTag() 400 | { 401 | // enable ASCII conversion 402 | $default_ascii = Emojione::$ascii; 403 | Emojione::$ascii = true; 404 | 405 | $image = 'Smile <img class="emojione" alt=":)" title=":smile:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f642.png" /> because it\'s going to be a good day.'; 406 | 407 | $this->assertEquals(Emojione::shortnameToImage($image), $image); 408 | $this->assertEquals(Emojione::toImage($image), $image); 409 | $this->assertEquals(Emojione::shortnameToAscii($image), $image); 410 | $this->assertEquals(Emojione::unifyUnicode($image), $image); 411 | 412 | // back to default ASCII conversion 413 | Emojione::$ascii = $default_ascii; 414 | } 415 | 416 | /** 417 | * test typical username password fail (shouldn't convert the user:pass, but should convert the last :p) 418 | * 419 | * @return void 420 | */ 421 | public function testTypicalUsernamePasswordFail() 422 | { 423 | // enable ASCII conversion 424 | $default_ascii = Emojione::$ascii; 425 | Emojione::$ascii = true; 426 | 427 | $ascii = 'Please log-in with user:pass as your credentials :P.'; 428 | $ascii_fix = 'Please log-in with user:pass as your credentials d:.'; 429 | $unicode = 'Please log-in with user:pass as your credentials 😛.'; 430 | $unicode_fix = 'Please log-in with user:pass as your credentials 😛.'; 431 | $shortname = 'Please log-in with user:pass as your credentials :stuck_out_tongue:.'; 432 | $image = 'Please log-in with user:pass as your credentials <img class="emojione" alt="😛" title=":stuck_out_tongue:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f61b.png"/>.'; 433 | 434 | $this->assertEquals(Emojione::shortnameToImage($shortname), $image); 435 | $this->assertEquals(Emojione::shortnameToImage($ascii), $image); 436 | $this->assertEquals(Emojione::toImage($shortname), $image); 437 | $this->assertEquals(Emojione::toImage($ascii), $image); 438 | $this->assertEquals(Emojione::shortnameToAscii($shortname), $ascii_fix); 439 | $this->assertEquals(Emojione::unifyUnicode($ascii), $unicode_fix); 440 | $this->assertEquals(Emojione::unifyUnicode($shortname), $unicode); 441 | 442 | // back to default ASCII conversion 443 | Emojione::$ascii = $default_ascii; 444 | } 445 | 446 | /** 447 | * test shouldn't replace an ascii smiley in a URL (shouldn't replace :/) 448 | * 449 | * @return void 450 | */ 451 | public function testSmileyInAnUrl() 452 | { 453 | // enable ASCII conversion 454 | $default_ascii = Emojione::$ascii; 455 | Emojione::$ascii = true; 456 | 457 | $ascii = 'Check out http://www.emojione.com'; 458 | 459 | $this->assertEquals(Emojione::shortnameToImage($ascii), $ascii); 460 | $this->assertEquals(Emojione::toImage($ascii), $ascii); 461 | $this->assertEquals(Emojione::shortnameToAscii($ascii), $ascii); 462 | $this->assertEquals(Emojione::unifyUnicode($ascii), $ascii); 463 | 464 | // back to default ASCII conversion 465 | Emojione::$ascii = $default_ascii; 466 | } 467 | } 468 | -------------------------------------------------------------------------------- /lib/php/test/EmojiTest.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | namespace Emojione\Test; 4 | 5 | use Emojione\Emojione; 6 | 7 | /** 8 | * Tests all Emojis from emoji.json 9 | */ 10 | class EmojiTest extends \PHPUnit_Framework_TestCase 11 | { 12 | private $emojiVersion = '4.5'; 13 | 14 | public function emojiProvider() 15 | { 16 | $file = dirname (__FILE__).'/../../../emoji.json'; 17 | 18 | $string = file_get_contents($file); 19 | 20 | $json = json_decode($string, true); 21 | 22 | $data = array(); 23 | 24 | foreach($json as $emoji) 25 | { 26 | $data[] = array( 27 | $emoji['shortname'], 28 | $emoji['unicode'], 29 | ); 30 | } 31 | 32 | return $data; 33 | } 34 | 35 | /** 36 | * test all Emojis and shortcodes 37 | * 38 | * @dataProvider emojiProvider 39 | * 40 | * @return void 41 | */ 42 | public function testEmojis($shortname, $simple_unicode) 43 | { 44 | $shortcode_replace = Emojione::getClient()->getRuleset()->getShortcodeReplace(); 45 | $unicode_replace = Emojione::getClient()->getRuleset()->getUnicodeReplace(); 46 | 47 | $unicode = Emojione::shortnameToUnicode($shortname); 48 | 49 | $this->assertNotTrue($unicode === $shortname); 50 | 51 | $this->assertTrue(isset($shortcode_replace[$shortname])); 52 | $this->assertEquals($shortcode_replace[$shortname], $simple_unicode); 53 | $this->assertTrue(in_array($unicode, $unicode_replace)); 54 | $this->assertEquals($unicode_replace[$shortname], $unicode); 55 | 56 | $convert_unicode = strtolower(Emojione::convert($simple_unicode)); 57 | 58 | $image_template = '<img class="emojione" alt="%1$s" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/%2$s.png"/>'; 59 | 60 | $image = sprintf($image_template, $convert_unicode, $simple_unicode); 61 | 62 | $this->assertEquals(Emojione::toImage($shortname), $image); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /lib/php/test/EmojioneTest.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | namespace Emojione\Test; 4 | 5 | use Emojione\Emojione; 6 | 7 | class EmojioneTest extends \PHPUnit_Framework_TestCase 8 | { 9 | 10 | private $emojiVersion = '4.5'; 11 | 12 | public function emojiProvider() 13 | { 14 | $file = dirname (__FILE__).'/../../../emoji.json'; 15 | 16 | $string = file_get_contents($file); 17 | 18 | $json = json_decode($string, true); 19 | 20 | $data = array(); 21 | 22 | foreach($json as $emoji) 23 | { 24 | if(isset($emoji['aliases_ascii']) && is_array($emoji['aliases_ascii'])){ 25 | foreach($emoji['aliases_ascii'] as $ascii) 26 | $data[] = array( 27 | $ascii, 28 | $emoji['shortname'] 29 | ); 30 | } 31 | } 32 | return $data; 33 | } 34 | 35 | /** 36 | * test Emojione::toImage() 37 | * 38 | * @return void 39 | */ 40 | public function testToImage() 41 | { 42 | $test = 'Hello world! 😄 :smile:'; 43 | $expected = 'Hello world! <img class="emojione" alt="😄" title=":smile:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f604.png"/> <img class="emojione" alt="😄" title=":smile:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f604.png"/>'; 44 | 45 | $this->assertEquals(Emojione::toImage($test), $expected); 46 | } 47 | 48 | /** 49 | * test Emojione::unifyUnicode() 50 | * 51 | * @return void 52 | */ 53 | public function testUnifyUnicode() 54 | { 55 | $test = 'Hello world! 😄 :smile:'; 56 | $expected = 'Hello world! 😄 😄'; 57 | 58 | $this->assertEquals(Emojione::unifyUnicode($test), $expected); 59 | } 60 | 61 | /** 62 | * test Emojione::shortnameToUnicode() 63 | * 64 | * @return void 65 | */ 66 | public function testShortnameToUnicode() 67 | { 68 | $test = 'Hello world! 😄 :smile:'; 69 | $expected = 'Hello world! 😄 😄'; 70 | 71 | $this->assertEquals(Emojione::shortnameToUnicode($test), $expected); 72 | } 73 | 74 | 75 | /** 76 | * test Emojione::shortnameToAscii() 77 | * 78 | * @return void 79 | */ 80 | public function testShortnameToAscii() 81 | { 82 | $test = 'Hello world! 🙂 :slight_smile:'; 83 | $expected = 'Hello world! 🙂 :]'; 84 | 85 | $this->assertEquals(Emojione::shortnameToAscii($test), $expected); 86 | } 87 | 88 | /** 89 | * test Emojione::shortnameToImage() 90 | * 91 | * @return void 92 | */ 93 | public function testShortnameToImage() 94 | { 95 | $test = 'Hello world! 😄 :smile:'; 96 | $expected = 'Hello world! 😄 <img class="emojione" alt="😄" title=":smile:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f604.png"/>'; 97 | 98 | $this->assertEquals(Emojione::shortnameToImage($test), $expected); 99 | } 100 | 101 | /** 102 | * test Emojione::toShort() 103 | * 104 | * @return void 105 | */ 106 | public function testToShort() 107 | { 108 | $test = 'Hello world! 😄 :smile:'; 109 | $expected = 'Hello world! :smile: :smile:'; 110 | 111 | $this->assertEquals(Emojione::toShort($test), $expected); 112 | } 113 | /** 114 | * 115 | * test Emojione::asciiToShortname() 116 | * 117 | * @return void 118 | */ 119 | public function testAsciiToShortname() 120 | { 121 | $test = 'Hello world! :) :D ;) :smile:'; 122 | $expected = 'Hello world! :slight_smile: :smiley: :wink: :smile:'; 123 | 124 | $this->assertEquals(Emojione::asciiToShortname($test), $expected); 125 | } 126 | 127 | /** 128 | * Test Ascii to shortnames with dataProvider 129 | * 130 | * @dataProvider emojiProvider 131 | */ 132 | public function testAsciiToShortnameWithDataProvider($ascii, $shortname) 133 | { 134 | $this->assertEquals($shortname, Emojione::asciiToShortname($ascii)); 135 | } 136 | 137 | /** 138 | * test Emojione::unicodeToImage() 139 | * 140 | * @return void 141 | */ 142 | public function testUnicodeToImage() 143 | { 144 | $test = 'Hello world! 😄 :smile:'; 145 | $expected = 'Hello world! <img class="emojione" alt="😄" title=":smile:" src="https://cdn.jsdelivr.net/emojione/assets/' . $this->emojiVersion . '/png/32/1f604.png"/> :smile:'; 146 | 147 | $this->assertEquals(Emojione::unicodeToImage($test), $expected); 148 | } 149 | } 150 | -------------------------------------------------------------------------------- /lib/php/test/SpriteTest.php: -------------------------------------------------------------------------------- 1 | <?php 2 | 3 | namespace Emojione\Test; 4 | 5 | use Emojione\Emojione; 6 | use Emojione\Client; 7 | 8 | class SpriteTest extends \PHPUnit_Framework_TestCase 9 | { 10 | 11 | /** 12 | * prepare SpriteTest 13 | */ 14 | protected function setUp() 15 | { 16 | $client = new Client; 17 | $client->sprites = true; 18 | $client->unicodeAlt = true; 19 | Emojione::setClient($client); 20 | } 21 | 22 | /** 23 | * prepare SpriteTest 24 | */ 25 | protected function tearDown() 26 | { 27 | Emojione::setClient(new Client); 28 | } 29 | 30 | /** 31 | * test Emojione::toImage() 32 | * 33 | * @return void 34 | */ 35 | public function testToImage() 36 | { 37 | $test = 'Hello world! 😄 :smile:'; 38 | $expected = 'Hello world! <span class="emojione emojione-32-people _1f604" title=":smile:">😄</span> <span class="emojione emojione-32-people _1f604" title=":smile:">😄</span>'; 39 | 40 | $this->assertEquals(Emojione::toImage($test), $expected); 41 | } 42 | 43 | /** 44 | * test Emojione::shortnameToImage() 45 | * 46 | * @return void 47 | */ 48 | public function testShortnameToImage() 49 | { 50 | $test = 'Hello world! 😄 :smile:'; 51 | $expected = 'Hello world! 😄 <span class="emojione emojione-32-people _1f604" title=":smile:">😄</span>'; 52 | 53 | $this->assertEquals(Emojione::shortnameToImage($test), $expected); 54 | } 55 | 56 | /** 57 | * test Emojione::unicodeToImage() 58 | * 59 | * @return void 60 | */ 61 | public function testUnicodeToImage() 62 | { 63 | $test = 'Hello world! 😄 :smile:'; 64 | $expected = 'Hello world! <span class="emojione emojione-32-people _1f604" title=":smile:">😄</span> :smile:'; 65 | 66 | $this->assertEquals(Emojione::unicodeToImage($test), $expected); 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /lib/python/MANIFEST: -------------------------------------------------------------------------------- 1 | # file GENERATED by distutils, do NOT edit 2 | setup.py 3 | emojipy/__init__.py 4 | emojipy/emojipy.py 5 | -------------------------------------------------------------------------------- /lib/python/README.md: -------------------------------------------------------------------------------- 1 | # emojipy 2 | Python library for working with emoji 3 | -------------------------------------------------------------------------------- /lib/python/emojipy/__init__.py: -------------------------------------------------------------------------------- 1 | from .emojipy import Emoji 2 | from . import ruleset 3 | 4 | __all__ = [Emoji, ruleset] 5 | -------------------------------------------------------------------------------- /lib/python/emojipy/create_ruleset.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8; -*- 3 | 4 | # This is autogenerated python file DO NOT try to edit 5 | 6 | /* [[[cog 7 | import cog 8 | import json 9 | 10 | json_package_path = '../../../emoji.json' 11 | 12 | data_dict = json.loads(open(json_package_path).read()) 13 | 14 | unicode_replace = {} 15 | shortcode_replace = {} 16 | ascii_replace = {} 17 | category_replace = {} 18 | 19 | for key, value in data_dict.items(): 20 | unicode_hex = value['code_points']['base'] 21 | ascii = value['ascii'] 22 | shortname = value['shortname'] 23 | if ascii: 24 | for item in ascii: 25 | ascii_replace[item] = unicode_hex 26 | shortcode_replace[shortname] = unicode_hex 27 | category_replace[shortname] = value['category'] 28 | 29 | if '-' not in unicode_hex: 30 | unicode_char = chr(int(unicode_hex, 16)) 31 | unicode_replace[unicode_char.encode('utf-8')] = shortname 32 | else: 33 | parts = unicode_hex.split('-') 34 | unicode_char = ''.join(chr(int(part, 16)) for part in parts) 35 | unicode_replace[unicode_char.encode('utf-8')] = shortname 36 | 37 | print(unicode_replace) 38 | print(shortcode_replace) 39 | print(ascii_replace) 40 | print(category_replace) 41 | cog.out('unicode_replace = %s\n\n' % unicode_replace) 42 | cog.out('shortcode_replace = %s\n\n' % shortcode_replace) 43 | cog.out('ascii_replace = %s\n\n' % ascii_replace) 44 | cog.out('category_replace = %s\n\n' % category_replace) 45 | ]]] */ 46 | //[[[end]]] 47 | -------------------------------------------------------------------------------- /lib/python/emojipy/emojipy.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; -*- 2 | 3 | from __future__ import unicode_literals 4 | import re 5 | import six 6 | if six.PY3: 7 | from html import escape, unescape 8 | else: 9 | from cgi import escape 10 | from HTMLParser import HTMLParser 11 | import struct 12 | unescape = HTMLParser.unescape 13 | chr = unichr 14 | 15 | from .ruleset import unicode_replace,\ 16 | shortcode_replace, ascii_replace, category_replace 17 | 18 | 19 | class Emoji(object): 20 | 21 | ascii = False 22 | unicode_alt = True 23 | sprites = False 24 | image_png_path = 'https://cdn.jsdelivr.net/emojione/assets/3.1/png/64/' 25 | ignored_regexp = '<object[^>]*>.*?<\/object>|<span[^>]*>.*?<\/span>|<(?:object|embed|svg|img|div|span|p|a)[^>]*>' 26 | unicode_regexp = "(" + '|'.join([re.escape(x.decode("utf-8")) for x in sorted(unicode_replace.keys(), key=len, reverse=True)]) + ")" 27 | shortcode_regexp = ':([-+\\w]+):' 28 | ascii_regexp = '(\\<3|<3|\\<\\/3|<\\/3|\\:\'\\)|\\:\'\\-\\)|\\:D|\\:\\-D|\\=D|\\:\\)|\\:\\-\\)|\\=\\]|\\=\\)|\\:\\]|\'\\:\\)|\'\\:\\-\\)|\'\\=\\)|\'\\:D|\'\\:\\-D|\'\\=D|\\>\\:\\)|>\\:\\)|\\>;\\)|>;\\)|\\>\\:\\-\\)|>\\:\\-\\)|\\>\\=\\)|>\\=\\)|;\\)|;\\-\\)|\\*\\-\\)|\\*\\)|;\\-\\]|;\\]|;D|;\\^\\)|\'\\:\\(|\'\\:\\-\\(|\'\\=\\(|\\:\\*|\\:\\-\\*|\\=\\*|\\:\\^\\*|\\>\\:P|>\\:P|X\\-P|x\\-p|\\>\\:\\[|>\\:\\[|\\:\\-\\(|\\:\\(|\\:\\-\\[|\\:\\[|\\=\\(|\\>\\:\\(|>\\:\\(|\\>\\:\\-\\(|>\\:\\-\\(|\\:@|\\:\'\\(|\\:\'\\-\\(|;\\(|;\\-\\(|\\>\\.\\<|>\\.<|\\:\\$|\\=\\$|#\\-\\)|#\\)|%\\-\\)|%\\)|X\\)|X\\-\\)|\\*\\\\0\\/\\*|\\\\0\\/|\\*\\\\O\\/\\*|\\\\O\\/|O\\:\\-\\)|0\\:\\-3|0\\:3|0\\:\\-\\)|0\\:\\)|0;\\^\\)|O\\:\\-\\)|O\\:\\)|O;\\-\\)|O\\=\\)|0;\\-\\)|O\\:\\-3|O\\:3|B\\-\\)|B\\)|8\\)|8\\-\\)|B\\-D|8\\-D|\\-_\\-|\\-__\\-|\\-___\\-|\\>\\:\\\\|>\\:\\\\|\\>\\:\\/|>\\:\\/|\\:\\-\\/|\\:\\-\\.|\\:\\/|\\:\\\\|\\=\\/|\\=\\\\|\\:L|\\=L|\\:P|\\:\\-P|\\=P|\\:\\-p|\\:p|\\=p|\\:\\-Þ|\\:\\-Þ|\\:Þ|\\:Þ|\\:þ|\\:þ|\\:\\-þ|\\:\\-þ|\\:\\-b|\\:b|d\\:|\\:\\-O|\\:O|\\:\\-o|\\:o|O_O|\\>\\:O|>\\:O|\\:\\-X|\\:X|\\:\\-#|\\:#|\\=X|\\=x|\\:x|\\:\\-x|\\=#)' 29 | shortcode_compiled = re.compile(ignored_regexp+"|("+shortcode_regexp+")", 30 | re.IGNORECASE) 31 | unicode_compiled = re.compile(ignored_regexp+"|("+unicode_regexp+")", 32 | re.UNICODE) 33 | ascii_compiled = re.compile(ignored_regexp+"|("+ascii_regexp+")", 34 | re.IGNORECASE) 35 | 36 | @classmethod 37 | def to_image(cls, text): 38 | text = cls.unicode_to_image(text) 39 | text = cls.shortcode_to_image(text) 40 | 41 | return text 42 | 43 | @classmethod 44 | def unicode_to_image(cls, text): 45 | def replace_unicode(match): 46 | unicode_char = text[match.start():match.end()] 47 | unicode_encoded = unicode_char.encode('utf-8') 48 | if not unicode_encoded or unicode_encoded not in unicode_replace: 49 | return unicode_char # unsupported unicode char 50 | shortcode = unicode_replace[unicode_encoded] 51 | if cls.unicode_alt: 52 | alt = unicode_char 53 | else: 54 | alt = shortcode 55 | filename = shortcode_replace[shortcode] 56 | category = category_replace[shortcode] 57 | 58 | if cls.sprites: 59 | return '<span class="emojione emojione-32-%s _%s" title="%s">%s</span>'\ 60 | % (category, filename, escape(shortcode), alt) 61 | else: 62 | return '<img class="emojione" alt="%s" src="%s"/>' % ( 63 | alt, 64 | cls.image_png_path+filename+'.png' 65 | ) 66 | 67 | text = re.sub(cls.unicode_compiled, replace_unicode, text) 68 | return text 69 | 70 | @classmethod 71 | def shortcode_to_image(cls, text): 72 | def replace_shortcode(match): 73 | shortcode = text[match.start():match.end()] 74 | if not shortcode or shortcode not in shortcode_replace: 75 | return shortcode 76 | unicode = shortcode_replace[shortcode] 77 | if cls.unicode_alt: 78 | alt = cls.convert(unicode) 79 | else: 80 | alt = shortcode 81 | filename = shortcode_replace[shortcode] 82 | category = category_replace[shortcode] 83 | 84 | if cls.sprites: 85 | return '<span class="emojione emojione-32-%s _%s" title="%s">%s</span>'\ 86 | % (category, filename, escape(shortcode), alt) 87 | else: 88 | return '<img class="emojione" alt="%s" src="%s"/>' % ( 89 | alt, 90 | cls.image_png_path+filename+'.png' 91 | ) 92 | 93 | text = re.sub(cls.shortcode_compiled, replace_shortcode, text) 94 | if cls.ascii: 95 | return cls.ascii_to_image(text) 96 | return text 97 | 98 | @classmethod 99 | def shortcode_to_ascii(cls, text): 100 | def replace_shortcode(match): 101 | shortcode = text[match.start():match.end()] 102 | if not shortcode or shortcode not in shortcode_replace: 103 | return shortcode 104 | unicode = shortcode_replace[shortcode] 105 | reverse_ascii_unicode = {v: k for k, v in ascii_replace.items()} 106 | if unicode in reverse_ascii_unicode: 107 | return reverse_ascii_unicode[unicode] 108 | return shortcode 109 | 110 | return re.sub(cls.shortcode_compiled, replace_shortcode, text) 111 | 112 | @classmethod 113 | def shortcode_to_unicode(cls, text): 114 | def replace_shortcode(match): 115 | shortcode = text[match.start():match.end()] 116 | if not shortcode or shortcode not in shortcode_replace: 117 | return shortcode 118 | flipped_unicode_replace = {v: k for k, v in unicode_replace.items()} 119 | if shortcode in flipped_unicode_replace: 120 | return flipped_unicode_replace[shortcode].decode('utf8') 121 | return shortcode 122 | text = re.sub(cls.shortcode_compiled, replace_shortcode, text) 123 | if cls.ascii: 124 | return cls.ascii_to_unicode(text) 125 | return text 126 | 127 | @classmethod 128 | def ascii_to_unicode(cls, text): 129 | def replace_ascii(match): 130 | ascii = text[match.start():match.end()] 131 | ascii = unescape(ascii) # convert escaped HTML entities back to original chars 132 | if not ascii or ascii not in ascii_replace: 133 | return ascii 134 | return cls.convert(ascii_replace[ascii]) 135 | return re.sub(cls.ascii_compiled, replace_ascii, text) 136 | 137 | @classmethod 138 | def ascii_to_image(cls, text): 139 | def replace_ascii(match): 140 | ascii = text[match.start():match.end()] 141 | ascii = unescape(ascii) # convert escaped HTML entities back to original chars 142 | if not ascii or ascii not in ascii_replace: 143 | return ascii 144 | unicode = ascii_replace[ascii] 145 | if cls.unicode_alt: 146 | alt = cls.convert(unicode) 147 | else: 148 | alt = escape(ascii) 149 | 150 | return '<img class="emojione" alt="%s" src="%s"/>' % ( 151 | alt, 152 | cls.image_png_path+unicode+'.png' 153 | ) 154 | return re.sub(cls.ascii_compiled, replace_ascii, text) 155 | 156 | @classmethod 157 | def convert(cls, hex_unicode): 158 | 159 | def char(i): 160 | try: 161 | return chr(i) 162 | except ValueError: 163 | return struct.pack('i', i).decode('utf-32') 164 | 165 | """ 166 | Convert a unicode in hex string to actual unicode char 167 | """ 168 | 169 | if '-' not in hex_unicode: 170 | return char(int(hex_unicode, 16)) 171 | parts = hex_unicode.split('-') 172 | return ''.join(char(int(x, 16)) for x in parts) 173 | -------------------------------------------------------------------------------- /lib/python/emojipy/tests/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joypixels/emojione/e4f140d8781b78e5f2623ed31dda3d50abf53285/lib/python/emojipy/tests/__init__.py -------------------------------------------------------------------------------- /lib/python/emojipy/tests/test_conversion.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; -*- 2 | 3 | from __future__ import unicode_literals 4 | from unittest import TestCase 5 | from emojipy import Emoji 6 | 7 | 8 | class ConversionTests(TestCase): 9 | """ 10 | Test possible conversions from different kinds of input with 11 | unicode or shortname at different places 12 | """ 13 | def setUp(self): 14 | self.emoji = Emoji 15 | self.emoji.sprites = False 16 | 17 | def test_single_unicode_char(self): 18 | unicode = '🐌' 19 | shortcode = ':snail:' 20 | image = '<img class="emojione" alt="🐌" src="https://cdn.jsdelivr.net/emojione/assets/3.1/png/64/1f40c.png"/>' 21 | self.assertEqual(Emoji.unicode_to_image(unicode), image) 22 | self.assertEqual(Emoji.shortcode_to_image(shortcode), image) 23 | 24 | def test_emoji_inside_sentence(self): 25 | unicode = 'The 🐌 is EmojiOne\'s original mascot.' 26 | shortcode = 'The :snail: is EmojiOne\'s original mascot.' 27 | image = 'The <img class="emojione" alt="🐌" src="https://cdn.jsdelivr.net/emojione/assets/3.1/png/64/1f40c.png"/> is EmojiOne\'s original mascot.' 28 | self.assertEqual(Emoji.unicode_to_image(unicode), image) 29 | self.assertEqual(Emoji.shortcode_to_image(shortcode), image) 30 | 31 | def test_emoji_inside_sentence_with_comma(self): 32 | unicode = 'The 🐌, is EmojiOne\'s original mascot.' 33 | shortcode = 'The :snail:, is EmojiOne\'s original mascot.' 34 | image = 'The <img class="emojione" alt="🐌" src="https://cdn.jsdelivr.net/emojione/assets/3.1/png/64/1f40c.png"/>, is EmojiOne\'s original mascot.' 35 | self.assertEqual(Emoji.unicode_to_image(unicode), image) 36 | self.assertEqual(Emoji.shortcode_to_image(shortcode), image) 37 | 38 | def test_emoji_at_start_of_sentence(self): 39 | unicode = '🐌 mail.' 40 | shortcode = ':snail: mail.' 41 | image = '<img class="emojione" alt="🐌" src="https://cdn.jsdelivr.net/emojione/assets/3.1/png/64/1f40c.png"/> mail.' 42 | self.assertEqual(Emoji.unicode_to_image(unicode), image) 43 | self.assertEqual(Emoji.shortcode_to_image(shortcode), image) 44 | 45 | def test_emoji_at_start_of_sentence_with_apostrophe(self): 46 | unicode = '🐌\'s are cool!' 47 | shortcode = ':snail:\'s are cool!' 48 | image = '<img class="emojione" alt="🐌" src="https://cdn.jsdelivr.net/emojione/assets/3.1/png/64/1f40c.png"/>\'s are cool!' 49 | self.assertEqual(Emoji.unicode_to_image(unicode), image) 50 | self.assertEqual(Emoji.shortcode_to_image(shortcode), image) 51 | 52 | def test_emoji_at_end_of_sentence(self): 53 | unicode = 'EmojiOne\'s original mascot is 🐌.' 54 | shortcode = 'EmojiOne\'s original mascot is :snail:.' 55 | image = 'EmojiOne\'s original mascot is <img class="emojione" alt="🐌" src="https://cdn.jsdelivr.net/emojione/assets/3.1/png/64/1f40c.png"/>.' 56 | self.assertEqual(Emoji.unicode_to_image(unicode), image) 57 | self.assertEqual(Emoji.shortcode_to_image(shortcode), image) 58 | 59 | def test_emoji_at_end_of_sentence_with_alternate_punctuation(self): 60 | unicode = 'EmojiOne\'s original mascot is 🐌!' 61 | shortcode = 'EmojiOne\'s original mascot is :snail:!' 62 | image = 'EmojiOne\'s original mascot is <img class="emojione" alt="🐌" src="https://cdn.jsdelivr.net/emojione/assets/3.1/png/64/1f40c.png"/>!' 63 | self.assertEqual(Emoji.unicode_to_image(unicode), image) 64 | self.assertEqual(Emoji.shortcode_to_image(shortcode), image) 65 | 66 | def test_emoji_at_end_of_sentence_with_preceeding_colon(self): 67 | unicode = 'EmojiOne\'s original mascot: 🐌' 68 | shortcode = 'EmojiOne\'s original mascot: :snail:' 69 | image = 'EmojiOne\'s original mascot: <img class="emojione" alt="🐌" src="https://cdn.jsdelivr.net/emojione/assets/3.1/png/64/1f40c.png"/>' 70 | self.assertEqual(Emoji.unicode_to_image(unicode), image) 71 | self.assertEqual(Emoji.shortcode_to_image(shortcode), image) 72 | 73 | def test_emoji_inside_img_tag(self): 74 | unicode = 'The <img class="emojione" alt="🐌" src="https://cdn.jsdelivr.net/emojione/assets/3.1/png/64/1f40c.png"/> is EmojiOne\'s original mascot.'; 75 | self.assertEqual(Emoji.unicode_to_image(unicode), unicode) 76 | self.assertEqual(Emoji.shortcode_to_image(unicode), unicode) 77 | 78 | def test_ascii_char(self): 79 | ascii = ">:/" 80 | image = '<img class="emojione" alt="😕" src="https://cdn.jsdelivr.net/emojione/assets/3.1/png/64/1f615.png"/>' 81 | self.assertEqual(Emoji.ascii_to_image(ascii), image) 82 | -------------------------------------------------------------------------------- /lib/python/emojipy/tests/test_emojione.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; -*- 2 | 3 | from __future__ import unicode_literals 4 | from unittest import TestCase 5 | from emojipy import Emoji 6 | 7 | 8 | class EmojipyTest(TestCase): 9 | def setUp(self): 10 | pass 11 | 12 | def test_unicode_to_image(self): 13 | txt = 'Hello world! 😄 :smile:' 14 | expected = """Hello world! <img class="emojione" alt="😄" src="https://cdn.jsdelivr.net/emojione/assets/3.1/png/64/1f604.png"/> :smile:""" 15 | 16 | self.assertEqual(Emoji.unicode_to_image(txt), expected) 17 | 18 | def test_shortcode_to_image(self): 19 | txt = 'Hello world! 😄 :smile:' 20 | expected = """Hello world! 😄 <img class="emojione" alt="😄" src="https://cdn.jsdelivr.net/emojione/assets/3.1/png/64/1f604.png"/>""" 21 | self.assertEqual(Emoji.shortcode_to_image(txt), expected) 22 | Emoji.unicode_alt = False 23 | expected = """Hello world! 😄 <img class="emojione" alt=":smile:" src="https://cdn.jsdelivr.net/emojione/assets/3.1/png/64/1f604.png"/>""" 24 | self.assertEqual(Emoji.shortcode_to_image(txt), expected) 25 | Emoji.unicode_alt = True 26 | 27 | def test_shortcode_to_ascii(self): 28 | txt = 'Hello world! 😄 :slight_smile:' 29 | expected = [ 30 | 'Hello world! 😄 :]', 31 | 'Hello world! 😄 :-)', 32 | 'Hello world! 😄 =)', 33 | 'Hello world! 😄 :)', 34 | 'Hello world! 😄 =]' 35 | ] 36 | 37 | output = Emoji.shortcode_to_ascii(txt) 38 | self.assertIn(output, expected) 39 | -------------------------------------------------------------------------------- /lib/python/emojipy/tests/test_ruleset.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8; -*- 3 | 4 | from __future__ import unicode_literals 5 | from unittest import TestCase 6 | import json 7 | 8 | from emojipy.ruleset import ascii_replace,\ 9 | unicode_replace, shortcode_replace, category_replace 10 | 11 | json_path = '../../emoji.json' 12 | 13 | 14 | class MappingTests(TestCase): 15 | def setUp(self): 16 | self.ascii_list = [] 17 | with open(json_path) as json_file: 18 | content = json_file.read() 19 | self.json_dict = json.loads(content) 20 | self.emoji_count = len(self.json_dict) 21 | for key, value in self.json_dict.items(): 22 | self.ascii_list.extend(value['ascii']) 23 | 24 | def test_unicode_count(self): 25 | self.assertEqual(self.emoji_count, len(unicode_replace)) 26 | self.assertEqual(len(ascii_replace), len(self.ascii_list)) 27 | self.assertEqual(len(shortcode_replace), len(unicode_replace)) 28 | -------------------------------------------------------------------------------- /lib/python/emojipy/tests/test_sprite.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; -*- 2 | 3 | from __future__ import unicode_literals 4 | from emojipy import Emoji 5 | from unittest import TestCase 6 | 7 | 8 | class SpriteTest(TestCase): 9 | def setUp(self): 10 | self.emoji = Emoji 11 | self.emoji.sprites = True 12 | self.emoji.unicode_alt = True 13 | 14 | def test_unicode_to_image(self): 15 | """ 16 | Test 'unicode_to_image' method with 'sprites' enabled 17 | """ 18 | 19 | text = 'Hello world! 😄 :smile:' 20 | expected = 'Hello world! <span class="emojione emojione-32-people _1f604" title=":smile:">😄</span> :smile:' 21 | 22 | self.assertEqual(self.emoji.unicode_to_image(text), expected) 23 | -------------------------------------------------------------------------------- /lib/python/setup.py: -------------------------------------------------------------------------------- 1 | # -*- coding: utf-8; -*- 2 | 3 | from setuptools import setup 4 | 5 | setup(name='emojipy', 6 | version='0.1', 7 | description='Python wrapper for emojione', 8 | author='Kaviraj Kanagaraj', 9 | author_email='kaviraj@launchyard.com', 10 | packages=['emojipy',], 11 | test_suite='emojipy.tests', 12 | ) 13 | -------------------------------------------------------------------------------- /lib/python/tox.ini: -------------------------------------------------------------------------------- 1 | # Tox (http://tox.testrun.org/) is a tool for running tests 2 | # in multiple virtualenvs. This configuration file will run the 3 | # test suite on all supported python versions. To use it, "pip install tox" 4 | # and then run "tox" from this directory. 5 | 6 | [tox] 7 | envlist = py27, py34 8 | 9 | [testenv] 10 | commands = {envpython} setup.py test 11 | deps = six 12 | 13 | -------------------------------------------------------------------------------- /lib/swift/Emojione.playground/contents.xcplayground: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8" standalone="yes"?> 2 | <playground version='5.0' target-platform='ios'> 3 | <timeline fileName='timeline.xctimeline'/> 4 | </playground> -------------------------------------------------------------------------------- /lib/swift/Emojione.playground/playground.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | <?xml version="1.0" encoding="UTF-8"?> 2 | <Workspace 3 | version = "1.0"> 4 | <FileRef 5 | location = "self:"> 6 | </FileRef> 7 | </Workspace> 8 | -------------------------------------------------------------------------------- /lib/swift/Emojione.playground/playground.xcworkspace/xcuserdata/rafaelks.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/joypixels/emojione/e4f140d8781b78e5f2623ed31dda3d50abf53285/lib/swift/Emojione.playground/playground.xcworkspace/xcuserdata/rafaelks.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /lib/swift/README.md: -------------------------------------------------------------------------------- 1 | # Emojione utility for Swift 2 | 3 | 4 | ### How to use 5 | 6 | This utility provides a method to convert from shortname to unicode characters. 7 | 8 | ### How to re-generate mapping 9 | 10 | ``` 11 | cd lib/swift/generator 12 | npm install 13 | node generate.js 14 | ``` 15 | -------------------------------------------------------------------------------- /lib/swift/generator/.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /lib/swift/generator/Emojione.swift: -------------------------------------------------------------------------------- 1 | // 2 | // Emojione.swift 3 | // 4 | // Created by Rafael Kellermann Streit (@rafaelks) on 10/10/16. 5 | // Copyright (c) 2016. 6 | // 7 | 8 | import Foundation 9 | 10 | struct Emojione { 11 | static let values = [ 12 | <%= mapping %> 13 | ] 14 | 15 | static func transform(string: String) -> String { 16 | let oldString = string as NSString 17 | var transformedString = string as NSString 18 | 19 | let regex = try! NSRegularExpression(pattern: ":([-+\\w]+):", options: []) 20 | let matches = regex.matches(in: transformedString as String, options: [], range: NSMakeRange(0, transformedString.length)) 21 | 22 | for result in matches { 23 | guard result.numberOfRanges == 2 else { continue } 24 | 25 | let shortname = oldString.substring(with: result.rangeAt(1)) 26 | if let emoji = values[shortname] { 27 | transformedString = transformedString.replacingOccurrences(of: ":\(shortname):", with: emoji) as NSString 28 | } 29 | } 30 | 31 | return transformedString as String 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /lib/swift/generator/generate.js: -------------------------------------------------------------------------------- 1 | var util = require("util"), 2 | fs = require("fs"), 3 | _ = require("underscore"); 4 | 5 | 6 | // Load emojis 7 | var emojis = require("../../../emoji_strategy.json"); 8 | 9 | // Generate Objective-C mapping 10 | var mapping = _(emojis).map(function(data, unicode) { 11 | // Get chars 12 | var chars = _(unicode.split("-")).map(function (code) { 13 | // Handle invalid unicode char for C99 14 | // http://c0x.coding-guidelines.com/6.4.3.html 15 | if (code < 160) { 16 | return String.fromCharCode(parseInt(code, 16)); 17 | } 18 | 19 | return "\\u{" + Array(8 - code.length + 1).join("0") + code + "}"; 20 | }); 21 | 22 | return '"' + data.shortname.slice(1, -1) + '": "' + chars.join('') + '",'; 23 | }).join("\n "); 24 | 25 | // Generate Objective-C class from template 26 | var input = fs.readFileSync("./Emojione.swift"); 27 | var output = _(input.toString()).template()({ mapping: mapping }); 28 | 29 | // Write Objective-C class to file 30 | var output_path = "../src/Emojione.swift"; 31 | fs.writeFileSync(output_path, output); 32 | 33 | console.log("Generated " + output_path); -------------------------------------------------------------------------------- /lib/swift/generator/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "emojione-ios", 3 | "version": "0.1.0", 4 | "dependencies": { 5 | "underscore": "^1.7.0" 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /lib/tests.md: -------------------------------------------------------------------------------- 1 | ## Unicode Conversion 2 | 3 | ``` 4 | # single character 5 | 🐌 6 | 7 | # character mid sentence 8 | The 🦄 is EmojiOne's official mascot. 9 | 10 | # character mid sentence with a comma 11 | The 🦄, is EmojiOne's official mascot. 12 | 13 | # character at start of sentence 14 | 🐌 mail. 15 | 16 | # character at start of sentence with apostrophe 17 | 🐌's are cool! 18 | 19 | # character at end of sentence 20 | EmojiOne's official mascot is 🦄. 21 | 22 | # character at end of sentence with alternate puncuation 23 | EmojiOne's official mascot is 🦄! 24 | 25 | # character at end of sentence with preceeding colon 26 | EmojiOne's official mascot: 🦄 27 | 28 | # character inside of IMG tag 29 | The <img class="emojione" alt="🦄" title=":unicorn:" src="https://cdn.jsdelivr.net/emojione/assets/3.1/png/32/1f984.png" /> is EmojiOne's official mascot. 30 | 31 | ``` 32 | 33 | 34 | ## Shortname Conversion 35 | 36 | ``` 37 | # single shortname 38 | :snail: 39 | 40 | # shortname mid sentence 41 | The :unicorn: is EmojiOne's official mascot. 42 | 43 | # shortname mid sentence with a comma 44 | The :unicorn:, is EmojiOne's official mascot. 45 | 46 | # shortname at start of sentence 47 | :snail: mail. 48 | 49 | # shortname at start of sentence with apostrophe 50 | :snail:'s are cool! 51 | 52 | # shortname at end of sentence 53 | EmojiOne's official mascot is :unicorn:. 54 | 55 | # shortname at end of sentence with alternate puncuation 56 | EmojiOne's official mascot is :unicorn:! 57 | 58 | # shortname at end of sentence with preceeding colon 59 | EmojiOne's official mascot: :unicorn: 60 | 61 | # shortname inside of IMG tag 62 | The <img class="emojione" alt=":unicorn:" title=":unicorn:" src="https://cdn.jsdelivr.net/emojione/assets/3.1/png/32/1f984.png" /> is EmojiOne's official mascot. 63 | 64 | ``` 65 | 66 | ## ASCII Conversion 67 | 68 | ```html 69 | # single smiley 70 | :D 71 | 72 | # single smiley with incorrect case (shouldn't convert) 73 | :d 74 | 75 | # multiple smileys 76 | ;) :p :* 77 | 78 | # smiley to start a sentence 79 | :\ is our confused smiley. 80 | 81 | # smiley to end a sentence 82 | Our smiley to represent joy is :') 83 | 84 | # smiley to end a sentence with puncuation 85 | The reverse is the joy smiley is the cry smiley :'(. 86 | 87 | # smiley to end a sentence with preceeding punctuation 88 | This is the "flushed" smiley: :$. 89 | 90 | # smiley inside of an IMG tag (shouldn't convert anything inside of the tag) 91 | Smile <img class="emojione" alt=":)" title=":smile:" src="https://cdn.jsdelivr.net/emojione/assets/3.1/png/32/1f604.png" /> because it's going to be a good day. 92 | 93 | # typical username password fail (shouldn't convert the user:pass, but should convert the last :p) 94 | Please log-in with user:pass as your credentials :P. 95 | 96 | # shouldn't replace an ascii smiley in a URL (shouldn't replace :/) 97 | Check out https://www.emojione.com 98 | 99 | ``` 100 | -------------------------------------------------------------------------------- /package.js: -------------------------------------------------------------------------------- 1 | Package.describe({ 2 | name: 'emojione:emojione', 3 | summary: 'Meteor Package of the https://www.emojione.com/ set.', 4 | version: '4.5.0', 5 | git: 'https://github.com/emojione/emojione.git' 6 | }); 7 | 8 | Package.onUse(function(api) { 9 | api.versionsFrom('1.0.2.1'); 10 | 11 | api.addFiles([ 12 | 'lib/meteor/pre-export.js', 13 | 'lib/js/emojione.js', 14 | 'lib/meteor/post-export.js' 15 | ]); 16 | 17 | api.use([ 18 | 'blaze', 19 | 'htmljs', 20 | 'templating' 21 | ], 'client'); 22 | 23 | api.addFiles([ 24 | 'lib/meteor/emojione-client.js', 25 | 'extras/css/emojione.css', 26 | 'extras/css/emojione-awesome.css' 27 | ], 'client'); 28 | 29 | api.addAssets('../emojione-assets/sprites/emojione-sprite-32.min.css', 'client'); 30 | api.addAssets('../emojione-assets/sprites/emojione-sprite-32-activity.png', 'client'); 31 | api.addAssets('../emojione-assets/sprites/emojione-sprite-32-diversity.png', 'client'); 32 | api.addAssets('../emojione-assets/sprites/emojione-sprite-32-flags.png', 'client'); 33 | api.addAssets('../emojione-assets/sprites/emojione-sprite-32-food.png', 'client'); 34 | api.addAssets('../emojione-assets/sprites/emojione-sprite-32-nature.png', 'client'); 35 | api.addAssets('../emojione-assets/sprites/emojione-sprite-32-objects.png', 'client'); 36 | api.addAssets('../emojione-assets/sprites/emojione-sprite-32-people.png', 'client'); 37 | api.addAssets('../emojione-assets/sprites/emojione-sprite-32-regional.png', 'client'); 38 | api.addAssets('../emojione-assets/sprites/emojione-sprite-32-symbols.png', 'client'); 39 | api.addAssets('../emojione-assets/sprites/emojione-sprite-32-travel.png', 'client'); 40 | 41 | api.export('emojione'); 42 | }); 43 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "emojione", 3 | "version": "4.5.0", 4 | "description": "EmojiOne is a complete set of emojis designed for the web. It includes libraries to easily convert unicode characters to shortnames (:smile:) and shortnames to our custom emoji images. PNG formats provided for the emoji images.", 5 | "author": "EmojiOne <support@emojione.com> (https://www.emojione.com)", 6 | "main": "lib/js/emojione.js", 7 | "keywords": [ 8 | "emojione", 9 | "EmojiOne", 10 | "emoji", 11 | "emojis", 12 | "emoticons", 13 | "smileys", 14 | "smilies", 15 | "unicode", 16 | "emoji set" 17 | ], 18 | "homepage": "https://www.emojione.com", 19 | "licenses": { 20 | "type": "(MIT)", 21 | "url": "https://github.com/emojione/emojione/blob/master/LICENSE.md" 22 | }, 23 | "repository": { 24 | "type": "git", 25 | "url": "https://github.com/emojione/emojione.git" 26 | }, 27 | "bugs": "https://github.com/emojione/emojione/issues", 28 | "devDependencies": { 29 | "grunt": "^0.4.5", 30 | "grunt-contrib-cssmin": "^0.12.2", 31 | "grunt-contrib-jshint": "^0.11.0", 32 | "grunt-contrib-qunit": "^0.5.2", 33 | "grunt-contrib-sass": "^0.9.2", 34 | "grunt-contrib-uglify": "^0.8.0", 35 | "grunt-contrib-watch": "^0.6.1", 36 | "grunt-jsonlint": "^1.0.4" 37 | }, 38 | "scripts": { 39 | "test": "grunt travis" 40 | } 41 | } 42 | --------------------------------------------------------------------------------