| @@ -4,10 +4,10 @@ | ||
| 4 | 4 | * Plugin Name: EmailKit |
| 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 | - * Author URI: https://wpmet.com | |
| 9 | - * Version: 1.4.0 | |
| 8 | + * Author URI: https://wpmet.com | |
| 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 | */ |
| @@ -15,8 +15,9 @@ | ||
| 15 | 15 | exit; |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | 18 | require_once __DIR__ . '/vendor/autoload.php'; |
| 19 | +require_once __DIR__ . '/traits/singleton.php'; | |
| 19 | 20 | |
| 20 | 21 | /** |
| 21 | 22 | * The main plugin class |
| 22 | 23 | */ |
| @@ -37,9 +38,12 @@ | ||
| 37 | 38 | $this->define_constants(); |
| 38 | 39 | register_activation_hook(__FILE__, [$this, 'activate']); |
| 39 | 40 | register_deactivation_hook(__FILE__, [$this,'deactivate_emailkit']); |
| 40 | 41 | |
| 41 | - 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); | |
| 45 | + add_action( 'admin_enqueue_scripts',[$this, 'emailkit_global_assets'] ); | |
| 42 | 46 | } |
| 43 | 47 | |
| 44 | 48 | /** |
| 45 | 49 | * Initializes a singleton instance |
| @@ -65,20 +69,20 @@ | ||
| 65 | 69 | * @return void |
| 66 | 70 | */ |
| 67 | 71 | public function define_constants() |
| 68 | 72 | { |
| 69 | - define('EMAILKIT_VERSION', '1.4.0'); | |
| 73 | + define('EMAILKIT_VERSION', '1.6.9'); | |
| 70 | 74 | define('EMAILKIT_TEXTDOMAIN', 'emailkit'); |
| 71 | 75 | define('EMAILKIT_FILE', __FILE__); |
| 72 | 76 | define('EMAILKIT_PATH', __DIR__); |
| 73 | 77 | define('EMAILKIT_URL', trailingslashit(plugin_dir_url(EMAILKIT_FILE))); |
| 74 | 78 | define('EMAILKIT_DIR', trailingslashit(plugin_dir_path(__FILE__))); |
| 75 | - define('EMAILKIT_TEMAPLTE_DIR', EMAILKIT_DIR . '/includes/admin/'); | |
| 76 | - define('EMAILKIT_ASSETS', EMAILKIT_URL . '/assets'); | |
| 79 | + define('EMAILKIT_INC', EMAILKIT_URL . 'includes/'); | |
| 80 | + define('EMAILKIT_ADMIN', EMAILKIT_INC . 'Admin/'); | |
| 81 | + define('EMAILKIT_ASSETS', EMAILKIT_URL . 'assets'); | |
| 77 | 82 | define('EMAILKIT_CONFIG', []); |
| 78 | 83 | } |
| 79 | 84 | |
| 80 | - | |
| 81 | 85 | |
| 82 | 86 | /** |
| 83 | 87 | * Initialize the plugin |
| 84 | 88 | * |
| @@ -93,8 +97,36 @@ | ||
| 93 | 97 | do_action('emailkit/after_loaded'); |
| 94 | 98 | } |
| 95 | 99 | |
| 96 | 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 | + | |
| 123 | + public function emailkit_global_assets() | |
| 124 | + { | |
| 125 | + wp_enqueue_style('emailkit-admin-style', EMAILKIT_URL . 'assets/admin/css/emailkit-global.css', [], EMAILKIT_VERSION); | |
| 126 | + } | |
| 127 | + | |
| 128 | + /** | |
| 97 | 129 | * Do stuff upon plugin activation |
| 98 | 130 | */ |
| 99 | 131 | public function activate() |
| 100 | 132 | { |
| @@ -119,13 +151,16 @@ | ||
| 119 | 151 | $cpt->postType(); |
| 120 | 152 | $cpt->add_role(); |
| 121 | 153 | |
| 122 | 154 | flush_rewrite_rules(); |
| 155 | + | |
| 123 | 156 | } |
| 124 | 157 | |
| 125 | 158 | // Deactivate plugin |
| 126 | 159 | function deactivate_emailkit() { |
| 127 | 160 | } |
| 161 | + | |
| 162 | + | |
| 128 | 163 | } |
| 129 | 164 | /**. |
| 130 | 165 | * Initializes the main plugin |
| 131 | 166 | * |
| @@ -131,7 +166,5 @@ | ||
| 131 | 166 | * |
| 132 | 167 | * @return \EmailKit |
| 133 | 168 | */ |
| 134 | 169 | |
| 135 | - | |
| 136 | 170 | EmailKit::init(); |
| 137 | - | |