DB
5 years ago
Request
5 years ago
UI
5 years ago
Check_Email_Admin_Capability_Giver.php
5 years ago
Check_Email_Log.php
5 years ago
Check_Email_Logger.php
5 years ago
Check_Email_Review.php
5 years ago
Loadie.php
5 years ago
Check_Email_Log.php
79 lines
| 1 | <?php namespace CheckEmail\Core; |
| 2 | |
| 3 | use CheckEmail\Core\DB\Check_Email_Table_Manager; |
| 4 | use CheckEmail\CheckEmailLogAutoloader; |
| 5 | |
| 6 | /** |
| 7 | * The main plugin class. |
| 8 | */ |
| 9 | class Check_Email_Log { |
| 10 | |
| 11 | const VERSION = '1.0.0'; |
| 12 | |
| 13 | private $loaded = false; |
| 14 | |
| 15 | private $plugin_file; |
| 16 | |
| 17 | public $translations_path; |
| 18 | |
| 19 | public $loader; |
| 20 | |
| 21 | public $table_manager; |
| 22 | |
| 23 | private $loadies = array(); |
| 24 | |
| 25 | public function __construct( $file, $loader, $table_manager ) { |
| 26 | $this->plugin_file = $file; |
| 27 | $this->loader = $loader; |
| 28 | $this->table_manager = $table_manager; |
| 29 | |
| 30 | $this->add_loadie( $table_manager ); |
| 31 | |
| 32 | $this->translations_path = dirname( plugin_basename( $this->plugin_file ) ) . '/languages/' ; |
| 33 | } |
| 34 | |
| 35 | public function add_loadie( $loadie ) { |
| 36 | if ( $this->loaded ) { |
| 37 | return false; |
| 38 | } |
| 39 | |
| 40 | if ( ! $loadie instanceof Loadie ) { |
| 41 | return false; |
| 42 | } |
| 43 | |
| 44 | $this->loadies[] = $loadie; |
| 45 | |
| 46 | return true; |
| 47 | } |
| 48 | |
| 49 | public function load() { |
| 50 | if ( $this->loaded ) { |
| 51 | return; |
| 52 | } |
| 53 | |
| 54 | load_plugin_textdomain( 'check-email', false, $this->translations_path ); |
| 55 | |
| 56 | $this->table_manager->load(); |
| 57 | |
| 58 | foreach ( $this->loadies as $loadie ) { |
| 59 | $loadie->load(); |
| 60 | } |
| 61 | |
| 62 | $this->loaded = true; |
| 63 | |
| 64 | do_action( 'check_email_loaded' ); |
| 65 | } |
| 66 | |
| 67 | public function get_version() { |
| 68 | return self::VERSION; |
| 69 | } |
| 70 | |
| 71 | public function get_plugin_path() { |
| 72 | return plugin_dir_path( $this->plugin_file ); |
| 73 | } |
| 74 | |
| 75 | public function get_plugin_file() { |
| 76 | return $this->plugin_file; |
| 77 | } |
| 78 | } |
| 79 |