| @@ -5,9 +5,9 @@ | ||
| 5 | 5 | * Plugin URI: https://wpmet.com/plugin/emailkit/ |
| 6 | 6 | * Description: EmailKit is the most-complete drag-and-drop Email template builder. |
| 7 | 7 | * Author: wpmet |
| 8 | 8 | * Author URI: https://wpmet.com |
| 9 | - * Version: 1.5.5 | |
| 9 | + * Version: 1.6.9 | |
| 10 | 10 | * Text Domain: emailkit |
| 11 | 11 | * License: GPLv3 |
| 12 | 12 | * License URI: https://www.gnu.org/licenses/gpl-3.0.txt |
| 13 | 13 | */ |
| @@ -38,9 +38,11 @@ | ||
| 38 | 38 | $this->define_constants(); |
| 39 | 39 | register_activation_hook(__FILE__, [$this, 'activate']); |
| 40 | 40 | register_deactivation_hook(__FILE__, [$this,'deactivate_emailkit']); |
| 41 | 41 | |
| 42 | - add_action('plugins_loaded', [$this, 'init_plugin']); | |
| 42 | + add_action('plugins_loaded', [$this, 'init_plugin'], 112); | |
| 43 | + add_action('init', [$this, 'load_textdomain'], 0); | |
| 44 | + add_action('init', [$this, 'init_promotional'], 10); | |
| 43 | 45 | add_action( 'admin_enqueue_scripts',[$this, 'emailkit_global_assets'] ); |
| 44 | 46 | } |
| 45 | 47 | |
| 46 | 48 | /** |
| @@ -67,9 +69,9 @@ | ||
| 67 | 69 | * @return void |
| 68 | 70 | */ |
| 69 | 71 | public function define_constants() |
| 70 | 72 | { |
| 71 | - define('EMAILKIT_VERSION', '1.5.5'); | |
| 73 | + define('EMAILKIT_VERSION', '1.6.9'); | |
| 72 | 74 | define('EMAILKIT_TEXTDOMAIN', 'emailkit'); |
| 73 | 75 | define('EMAILKIT_FILE', __FILE__); |
| 74 | 76 | define('EMAILKIT_PATH', __DIR__); |
| 75 | 77 | define('EMAILKIT_URL', trailingslashit(plugin_dir_url(EMAILKIT_FILE))); |
| @@ -79,8 +81,9 @@ | ||
| 79 | 81 | define('EMAILKIT_ASSETS', EMAILKIT_URL . 'assets'); |
| 80 | 82 | define('EMAILKIT_CONFIG', []); |
| 81 | 83 | } |
| 82 | 84 | |
| 85 | + | |
| 83 | 86 | /** |
| 84 | 87 | * Initialize the plugin |
| 85 | 88 | * |
| 86 | 89 | * @return void |
| @@ -89,13 +92,35 @@ | ||
| 89 | 92 | { |
| 90 | 93 | do_action('emailkit/before_loaded'); |
| 91 | 94 | |
| 92 | 95 | new EmailKit\Admin(); |
| 93 | - (new EmailKit\Promotional\Promotional())->init(); | |
| 94 | 96 | |
| 95 | 97 | do_action('emailkit/after_loaded'); |
| 96 | 98 | } |
| 97 | 99 | |
| 100 | + /** | |
| 101 | + * Load the plugin translations | |
| 102 | + * | |
| 103 | + * @return void | |
| 104 | + */ | |
| 105 | + public function load_textdomain() | |
| 106 | + { | |
| 107 | + load_plugin_textdomain('emailkit', false, dirname(plugin_basename(EMAILKIT_FILE)) . '/languages'); | |
| 108 | + } | |
| 109 | + | |
| 110 | + /** | |
| 111 | + * Initialize the promotional classes | |
| 112 | + * | |
| 113 | + * Runs on `init` because these classes translate strings while booting, | |
| 114 | + * and translations must not be loaded before `init`. | |
| 115 | + * | |
| 116 | + * @return void | |
| 117 | + */ | |
| 118 | + public function init_promotional() | |
| 119 | + { | |
| 120 | + (new EmailKit\Promotional\Promotional())->init(); | |
| 121 | + } | |
| 122 | + | |
| 98 | 123 | public function emailkit_global_assets() |
| 99 | 124 | { |
| 100 | 125 | wp_enqueue_style('emailkit-admin-style', EMAILKIT_URL . 'assets/admin/css/emailkit-global.css', [], EMAILKIT_VERSION); |
| 101 | 126 | } |
| @@ -126,8 +151,9 @@ | ||
| 126 | 151 | $cpt->postType(); |
| 127 | 152 | $cpt->add_role(); |
| 128 | 153 | |
| 129 | 154 | flush_rewrite_rules(); |
| 155 | + | |
| 130 | 156 | } |
| 131 | 157 | |
| 132 | 158 | // Deactivate plugin |
| 133 | 159 | function deactivate_emailkit() { |
| @@ -141,5 +167,4 @@ | ||
| 141 | 167 | * @return \EmailKit |
| 142 | 168 | */ |
| 143 | 169 | |
| 144 | 170 | EmailKit::init(); |
| 145 | - | |