1 | <?php |
||
54 | /** |
||
55 | * Deactivate Email Log. |
||
56 | * |
||
57 | * @since 2.0 |
||
58 | */ |
||
59 | function email_log_deactivate() { |
||
62 | |||
63 | add_action( 'admin_init', 'email_log_deactivate' ); |
||
64 | |||
65 | return; |
||
66 | } |
||
67 | |||
68 | global $email_log; |
||
69 | |||
70 | // setup autoloader. |
||
71 | require_once 'include/EmailLogAutoloader.php'; |
||
72 | |||
73 | $loader = new \EmailLog\EmailLogAutoloader(); |
||
74 | $loader->register(); |
||
75 | |||
76 | $plugin_dir = plugin_dir_path( __FILE__ ); |
||
77 | $loader->add_namespace( 'EmailLog', $plugin_dir . 'include' ); |
||
78 | |||
79 | if ( file_exists( $plugin_dir . 'tests/' ) ) { |
||
80 | // if tests are present, then add them. |
||
81 | $loader->add_namespace( 'EmailLog', $plugin_dir . 'tests/wp-tests' ); |
||
82 | } |
||
83 | |||
84 | $email_log = new \EmailLog\Core\EmailLog( __FILE__ ); |
||
85 | add_action( 'wp_loaded', array( $email_log, 'load' ) ); |
||
86 | |||
87 | /** |
||
88 | * Return the global instance of Email Log plugin. |
||
89 | * Eventually the EmailLog class might become singleton. |
||
90 | * |
||
91 | * @since 2.0 |
||
92 | * |
||
93 | * @global EmailLog $email_log |
||
94 | * @return \EmailLog\Core\EmailLog |
||
95 | */ |
||
96 | function email_log() { |
||
101 | |||
102 | // TODO: move all these to seperate files. |
||
103 | /** |
||
104 | * Plugin Root File |
||
105 | * |
||
106 | * @since 1.7.2 |
||
107 | */ |
||
108 | if ( ! defined( 'EMAIL_LOG_PLUGIN_FILE' ) ) { |
||
109 | define( 'EMAIL_LOG_PLUGIN_FILE', __FILE__ ); |
||
110 | } |
||
111 | |||
112 | /** |
||
113 | * Handles installation and table creation. |
||
114 | */ |
||
115 | require_once plugin_dir_path( __FILE__ ) . 'include/install.php'; |
||
116 | |||
117 | /** |
||
118 | * Helper functions. |
||
119 | */ |
||
120 | require_once plugin_dir_path( __FILE__ ) . 'include/util/helper.php'; |
||
121 |