mirror of
https://github.com/Mibew/emoji-plugin.git
synced 2025-01-22 09:30:33 +03:00
Add "ignore_emoticons" option
This commit is contained in:
parent
a771330773
commit
37795b5f9a
22
Plugin.php
22
Plugin.php
@ -32,6 +32,27 @@ use Symfony\Component\HttpFoundation\Request;
|
|||||||
*/
|
*/
|
||||||
class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\PluginInterface
|
class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\PluginInterface
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* List of the plugin configs.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected $config;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class constructor.
|
||||||
|
*
|
||||||
|
* @param array $config List of the plugin config. The following options are
|
||||||
|
* supported:
|
||||||
|
* - 'ignore_emoticons': boolean, if set to true, the plugin only converts
|
||||||
|
* :emoji: and ignore emoticons like :-) and ;D. The default value is
|
||||||
|
* false.
|
||||||
|
*/
|
||||||
|
public function __construct($config)
|
||||||
|
{
|
||||||
|
$this->config = $config + array('ignore_emoticons' => false);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The plugin does not need extra initialization thus it is always ready to
|
* The plugin does not need extra initialization thus it is always ready to
|
||||||
* work.
|
* work.
|
||||||
@ -100,6 +121,7 @@ class Plugin extends \Mibew\Plugin\AbstractPlugin implements \Mibew\Plugin\Plugi
|
|||||||
$args['plugins']['MibewEmoji'] = array(
|
$args['plugins']['MibewEmoji'] = array(
|
||||||
'imagesDir' => ($request->getBasePath() . '/' . $this->getFilesPath()
|
'imagesDir' => ($request->getBasePath() . '/' . $this->getFilesPath()
|
||||||
. '/components/emojify.js/images/emoji'),
|
. '/components/emojify.js/images/emoji'),
|
||||||
|
'ignoreEmoticons' => $this->config['ignore_emoticons'],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
17
README.md
17
README.md
@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
It replaces emojis codes with images in chat messages. The full list of supported emojis can be found at http://www.emoji-cheat-sheet.com/
|
It replaces emojis codes with images in chat messages. The full list of supported emojis can be found at http://www.emoji-cheat-sheet.com/
|
||||||
|
|
||||||
|
Emoticons like :-) and ;D are also supported.
|
||||||
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@ -14,9 +16,24 @@ If the "plugins" stucture looks like `plugins: []` it will become:
|
|||||||
plugins:
|
plugins:
|
||||||
-
|
-
|
||||||
name: "Mibew:Emoji"
|
name: "Mibew:Emoji"
|
||||||
|
config: # Plugin's configurations are described below
|
||||||
|
ignore_emoticons: false
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Plugin's configurations
|
||||||
|
|
||||||
|
The plugin can be configured with values in "`<Mibew root>`/configs/config.yml" file.
|
||||||
|
|
||||||
|
### config.ignore_emoticons
|
||||||
|
|
||||||
|
Type: `Boolean`
|
||||||
|
|
||||||
|
Default: `false`
|
||||||
|
|
||||||
|
If set to true, the plugin only converts :emoji: and ignore emoticons like :-) and ;D. This value is optional and can be skipped.
|
||||||
|
|
||||||
|
|
||||||
## Build from sources
|
## Build from sources
|
||||||
|
|
||||||
There are several actions one should do before use the latest version of the plugin from the repository:
|
There are several actions one should do before use the latest version of the plugin from the repository:
|
||||||
|
@ -37,7 +37,10 @@
|
|||||||
Mibew.Application.Invitation.on(eventsMap);
|
Mibew.Application.Invitation.on(eventsMap);
|
||||||
|
|
||||||
module.addInitializer(function() {
|
module.addInitializer(function() {
|
||||||
emojify.setConfig({'img_dir': Mibew.PluginOptions.MibewEmoji.imagesDir});
|
emojify.setConfig({
|
||||||
|
img_dir: Mibew.PluginOptions.MibewEmoji.imagesDir,
|
||||||
|
ignore_emoticons: Mibew.PluginOptions.MibewEmoji.ignoreEmoticons
|
||||||
|
});
|
||||||
|
|
||||||
// Update message body right after it is added to the messages
|
// Update message body right after it is added to the messages
|
||||||
// collection.
|
// collection.
|
||||||
|
Loading…
Reference in New Issue
Block a user