Conditions | 2 |
Paths | 2 |
Total Lines | 31 |
Code Lines | 16 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
18 | function load_email_log( $plugin_file ) { |
||
19 | global $email_log; |
||
20 | |||
21 | $plugin_dir = plugin_dir_path( $plugin_file ); |
||
22 | |||
23 | // setup autoloader. |
||
24 | require_once 'include/EmailLogAutoloader.php'; |
||
25 | |||
26 | $loader = new \EmailLog\EmailLogAutoloader(); |
||
27 | $loader->add_namespace( 'EmailLog', $plugin_dir . 'include' ); |
||
28 | |||
29 | if ( file_exists( $plugin_dir . 'tests/' ) ) { |
||
30 | // if tests are present, then add them. |
||
31 | $loader->add_namespace( 'EmailLog', $plugin_dir . 'tests/wp-tests' ); |
||
32 | } |
||
33 | |||
34 | $loader->add_file( $plugin_dir . 'include/Util/helper.php' ); |
||
35 | |||
36 | $loader->register(); |
||
37 | |||
38 | $email_log = new \EmailLog\Core\EmailLog( $plugin_file ); |
||
39 | $email_log->table_manager = new \EmailLog\Core\DB\TableManager(); |
||
40 | $email_log->logger = new \EmailLog\Core\EmailLogger(); |
||
41 | $email_log->ui_manager = new \EmailLog\Core\UI\UIManager( $plugin_file ); |
||
42 | |||
43 | // `register_activation_hook` can't be called from inside any hook. |
||
44 | register_activation_hook( $plugin_file, array( $email_log->table_manager, 'on_activate' ) ); |
||
45 | |||
46 | // Load the plugin |
||
47 | add_action( 'wp_loaded', array( $email_log, 'load' ) ); |
||
48 | } |
||
49 | |||
64 |