| @@ -64,24 +64,15 @@ | ||
| 64 | 64 | |
| 65 | 65 | public function run() |
| 66 | 66 | { |
| 67 | 67 | $this->load_macros(); |
| 68 | - add_action('init', function(){ | |
| 69 | - (new I18n())->load_plugin_textdomain(); | |
| 70 | - $this->register_post_type(); | |
| 71 | - Installer::get_instance()->upgrade(); | |
| 72 | - $this->define_front_hooks(); | |
| 73 | - }); | |
| 68 | + $this->setLocale(); | |
| 69 | + Installer::get_instance()->upgrade(); | |
| 70 | + $this->register_post_type(); | |
| 74 | 71 | $this->define_admin_hooks(); |
| 75 | - $this->define_ip_logs_cleanup_hook(); | |
| 76 | - | |
| 72 | + $this->define_front_hooks(); | |
| 77 | 73 | } |
| 78 | 74 | |
| 79 | - | |
| 80 | - function define_ip_logs_cleanup_hook(){ | |
| 81 | - add_action( IP_Log_Manager::CLEANUP_ACTION, array( new IP_Log_Manager(), 'cleanup_ip_logs' ) ); | |
| 82 | - } | |
| 83 | - | |
| 84 | 75 | /** |
| 85 | 76 | * Autoload the required dependencies for this plugin. |
| 86 | 77 | * |
| 87 | 78 | * @since 1.0.0 |
| @@ -113,8 +104,27 @@ | ||
| 113 | 104 | |
| 114 | 105 | } |
| 115 | 106 | |
| 116 | 107 | /** |
| 108 | + * Define the locale for this plugin for internationalization. | |
| 109 | + * | |
| 110 | + * @since 1.0.0 | |
| 111 | + * @access private | |
| 112 | + */ | |
| 113 | + private function setLocale() | |
| 114 | + { | |
| 115 | + | |
| 116 | + add_action( | |
| 117 | + 'plugins_loaded', | |
| 118 | + [ | |
| 119 | + new I18n(), | |
| 120 | + 'load_plugin_textdomain', | |
| 121 | + ] | |
| 122 | + ); | |
| 123 | + } | |
| 124 | + | |
| 125 | + | |
| 126 | + /** | |
| 117 | 127 | * Register all of the hooks related to the admin area functionality |
| 118 | 128 | * of the plugin. |
| 119 | 129 | * |
| 120 | 130 | * @since 1.0.0 |
| @@ -200,27 +210,27 @@ | ||
| 200 | 210 | |
| 201 | 211 | public function register_post_type() |
| 202 | 212 | { |
| 203 | 213 | $args = array( |
| 204 | - 'label' => __( 'All', 'hurrytimer' ), | |
| 214 | + 'label' => __( 'All', DOMAIN ), | |
| 205 | 215 | 'labels' => array( |
| 206 | - 'name' => __( 'Campaigns', 'hurrytimer' ), | |
| 207 | - 'singular_name' => __( 'Campaign', 'hurrytimer' ), | |
| 208 | - 'add_new' => __( 'Add Campaign', 'hurrytimer' ), | |
| 209 | - 'add_new_item' => __( 'Add Campaign', 'hurrytimer' ), | |
| 210 | - 'edit' => __( 'Edit', 'hurrytimer' ), | |
| 211 | - 'edit_item' => __( 'Edit Campaign', 'hurrytimer' ), | |
| 212 | - 'new_item' => __( 'New Campaign', 'hurrytimer' ), | |
| 213 | - 'view' => __( 'View Campaign', 'hurrytimer' ), | |
| 214 | - 'view_item' => __( 'View Campaign', 'hurrytimer' ), | |
| 215 | - 'search_items' => __( 'Search Campaign', 'hurrytimer' ), | |
| 216 | - 'not_found' => __( 'No Campaign', 'hurrytimer' ), | |
| 216 | + 'name' => __( 'Campaigns', DOMAIN ), | |
| 217 | + 'singular_name' => __( 'Campaign', DOMAIN ), | |
| 218 | + 'add_new' => __( 'Add Campaign', DOMAIN ), | |
| 219 | + 'add_new_item' => __( 'Add Campaign', DOMAIN ), | |
| 220 | + 'edit' => __( 'Edit', DOMAIN ), | |
| 221 | + 'edit_item' => __( 'Edit Campaign', DOMAIN ), | |
| 222 | + 'new_item' => __( 'New Campaign', DOMAIN ), | |
| 223 | + 'view' => __( 'View Campaign', DOMAIN ), | |
| 224 | + 'view_item' => __( 'View Campaign', DOMAIN ), | |
| 225 | + 'search_items' => __( 'Search Campaign', DOMAIN ), | |
| 226 | + 'not_found' => __( 'No Campaign', DOMAIN ), | |
| 217 | 227 | 'not_found_in_trash' => __( |
| 218 | - 'No campaign found in trash', | |
| 219 | - 'hurrytimer' | |
| 228 | + 'No Countdown Timer found in trash', | |
| 229 | + DOMAIN | |
| 220 | 230 | ), |
| 221 | - 'parent' => __( 'Parent Campaign', 'hurrytimer' ), | |
| 222 | - 'menu_name' => __( 'All Campaigns', 'hurrytimer' ), | |
| 231 | + 'parent' => __( 'Parent Campaign', DOMAIN ), | |
| 232 | + 'menu_name' => __( 'All Campaigns', DOMAIN ), | |
| 223 | 233 | ), |
| 224 | 234 | 'public' => false, |
| 225 | 235 | 'show_ui' => true, |
| 226 | 236 | 'publicly_queryable' => false, |