diff --git a/composer.json b/composer.json index f08d5cb..b92c08a 100644 --- a/composer.json +++ b/composer.json @@ -2,13 +2,13 @@ "name": "sybrew/emoji-settings", "description": "Emoji Settings adds an option to your WordPress Writing Settings page to disable or enable emojis.", "keywords": [ - "seo", + "emoji", "wordpress", "plugin" ], "type": "wordpress-plugin", "license": "GPL-3.0-only", - "homepage": "https://theseoframework.com/", + "homepage": "https://wordpress.org/plugins/emoji-settings/", "authors": [ { "name": "Sybre Waaijer", @@ -33,11 +33,6 @@ "php:autofix": "composer install && vendor/bin/phpcbf", "php:lint:errors": "composer install && vendor/bin/phpcs -p -s --runtime-set ignore_warnings_on_exit 1" }, - "support": { - "docs": "https://theseoframework.com/docs/", - "forum": "https://wordpress.org/support/plugin/autodescription/", - "wiki": "https://github.com/sybrew/the-seo-framework/wiki" - }, "minimum-stability": "dev", "prefer-stable": true } diff --git a/emojisettings.php b/emojisettings.php index 6063420..1e28c39 100644 --- a/emojisettings.php +++ b/emojisettings.php @@ -32,32 +32,19 @@ * along with this program. If not, see . */ -\add_action( 'plugins_loaded', __NAMESPACE__ . '\\_load_settings_locale' ); +\add_action( 'plugins_loaded', __NAMESPACE__ . '\\init', 5 ); /** - * Plugin locale 'emoji-settings' - * - * File located in plugin folder emoji-settings/language/ - * - * @since 2.0.0 - */ -function _load_settings_locale() { - \load_plugin_textdomain( 'emoji-settings', false, basename( __DIR__ ) . '/language/' ); -} - -\add_action( 'plugins_loaded', __NAMESPACE__ . '\\get_class', 5 ); -/** - * Loads and caches Emoji_Settings class. + * Loads and memoizes Emoji_Settings class. * * @since 2.0.0 * @action plugins_loaded * @priority 5 Use anything above 5, or any action later than plugins_loaded and * you can access the class and functions. * - * @return object + * @return CyberWire\Emoji_Settings\Emoji_Settings */ -function get_class() { +function init() { - //* Cache the class. Do not run everything more than once. static $class = null; /** @@ -85,6 +72,14 @@ class Emoji_Settings { * @since 1.0.0 */ public function __construct() { + + // File located in plugin folder emoji-settings/language/ + \load_plugin_textdomain( + 'emoji-settings', + false, + \dirname( \plugin_basename( __FILE__ ) ) . '/language' + ); + \add_action( 'init', [ $this, 'disable_emojis' ], 4 ); \add_filter( 'admin_init', [ $this, '_register_fields' ] ); } @@ -170,9 +165,6 @@ public function fields_html() { * @return array $options The options to save. */ public function wp_32453_support( $options ) { - - // When smilies are enabled, but emojis are disabled, disable smilies. - // phpcs:disable, WordPress.Security.NonceVerification -- checked by default settings page handler. if ( '1' === ( $_POST['use_smilies'] ?? null ) // Smilies are enabled. && '1' !== ( $_POST['enable_emoji'] ?? null ) // But emojis are disabled. diff --git a/language/emoji-settings.pot b/language/emoji-settings.pot index 2a18964..dbc2bff 100644 --- a/language/emoji-settings.pot +++ b/language/emoji-settings.pot @@ -9,7 +9,7 @@ msgstr "" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2022-11-19T14:06:41+00:00\n" +"POT-Creation-Date: 2022-11-20T04:58:34+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.4.0\n" "X-Domain: emoji-settings\n" @@ -34,11 +34,11 @@ msgstr "" msgid "https://cyberwire.nl/" msgstr "" -#: emojisettings.php:131 -#: emojisettings.php:152 +#: emojisettings.php:126 +#: emojisettings.php:147 msgid "Emoji Conversion" msgstr "" -#: emojisettings.php:158 +#: emojisettings.php:153 msgid "Enable text to emoji conversion" msgstr "" diff --git a/readme.txt b/readme.txt index 73fedc6..37a6d15 100644 --- a/readme.txt +++ b/readme.txt @@ -1,39 +1,38 @@ === Emoji Settings === Contributors: Cybr -Tags: Emoji, emojis, emoticon, script, tinymce, mail -Requires at least: 4.2.0 +Tags: Emoji, emojis, emoticon, script, tinymce, mail, scrips, prefetch, twemoji +Requires at least: 5.5 Tested up to: 6.1 Stable tag: 2.0.0 Requires PHP: 7.2.0 License: GPLv3 License URI: http://www.gnu.org/licenses/gpl-3.0.html -Emoji Settings adds an option to your Writing Settings page to enable or disable emoji conversion to images. +Emoji Settings adds an option to your Writing Settings page to toggle emoji conversion to images. == Description == -**Simply enable or disable emojis conversion with an option.** +**Quickly enable or disable emojis conversion with an option.** -This plugin stops the conversion of ASCII smilies like `:)` and `:D` to images on any WordPress installation. +When you disable the option, Emoji Settings stops the conversion of ASCII smilies like `:)` and `:D` to images on any WordPress installation. This plugin also prevents changing real emojis to Twemoji (Twitter) images. It achieves this by removing several default WordPress scripts. You can find the option at "Settings > Writing" (`/wp-admin/options-writing.php`). -This plugin does not prevent real emojis from being stored and printed. +This plugin does not prevent real emojis (inserted via an emoji keyboard) from being stored and outputted on your website. -= Emojis are enabled by default = += Emoji conversion enabled by default = -This plugin has been written with a WordPress.com-like environment in mind. We want to give users the option but not override default WordPress behavior. If you or your user wishes to disable emojis for their site, they can do so in their dashboard. +I wrote this plugin with a WordPress.com-like environment in mind, giving users an option without overriding standard WordPress behavior. -You can override standard behavior via filter `cw_emoji_overrides`. Refer to the code for instructions. +You can change this behavior via filter `cw_emoji_overrides`. Refer to the code for instructions. -= Does more than "Disable Emojis (GDPR friendly)" = += Does more than "Disable Emojis" = -This plugin also fixes incorrect Character Encoding on WordPress installations installed before 4.3.0 when emojis are disabled. -This plugin also removes the conversion of emojis in the admin area, for example, from post titles. +Emoji Settings also fixes Character Encoding issues on sites originally installed with WP 4.2 or lower. And this plugin correctly removes the conversion of emojis in the admin area, for example, from post titles. = Translating = -You can submit your translations via the sidebar on this page. +You can contribute by translating Emoji Settings via the sidebar on this page. == Installation == @@ -42,15 +41,27 @@ You can submit your translations via the sidebar on this page. 1. You can now disable emojis through the admin menu under `wp-admin/options-writing.php`. 1. That's it! Enjoy! +== Frequently Asked Questions == + += How do I disable emojis by default = + +You can implement this filter to achieve that: + +`add_filter( 'cw_emoji_overrides', function( $overrides ) { + $overrides['default'] = '0'; // Set disabled by default. + return $overrides; +} );` + == Changelog == = 2.0.0 = * Rewritten for improved performance. -* All function and class names have changed due to added namespacing, hence the major version bump. * Now requires PHP 7.2 or later. +* Now requires WP 5.5 or later, because it adds tests against PHP support. +* All function and class names have changed due to added namespacing, hence the major version bump. * Added filter `cw_emoji_overrides`, accepts array `[ 'default' => string 1|0, 'force_support' => ?bool ]`. * Removed confusing filter `the_emoji_options`. -* Changed the option label from "Enable emoji support" to "Enable emoji conversion"; this plugin prevents the conversion, it does not prevent actual emojis from being stored and printed. +* Changed the option label from "Enable emoji support" to "Enable emoji conversion": this plugin prevents the conversion; it does not prevent actual emojis from being stored and printed. = 1.2.0 = * Now properly removes the detection script and styles from all admin screens.