sudar /
email-log
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Load Email Log plugin. |
||
| 4 | * |
||
| 5 | * We need this load code in a separate file since it requires namespace |
||
| 6 | * and using namespace in PHP 5.2 will generate a fatal error. |
||
| 7 | * |
||
| 8 | * @since 2.0 |
||
| 9 | */ |
||
| 10 | |||
| 11 | /** |
||
| 12 | * Load Email Log plugin. |
||
| 13 | * |
||
| 14 | * @since 2.0 |
||
| 15 | * |
||
| 16 | * @param string $plugin_file Main plugin file. |
||
| 17 | */ |
||
| 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 | $loader->add_file( $plugin_dir . 'include/Addon/addon-helper.php' ); |
||
| 36 | |||
| 37 | $loader->register(); |
||
| 38 | |||
| 39 | $email_log = new \EmailLog\Core\EmailLog( $plugin_file, $loader, new \EmailLog\Core\DB\TableManager() ); |
||
| 40 | |||
| 41 | $email_log->add_loadie( new \EmailLog\Core\EmailLogger() ); |
||
| 42 | $email_log->add_loadie( new \EmailLog\Core\UI\UILoader( $plugin_file ) ); |
||
| 43 | $email_log->add_loadie( new \EmailLog\Addon\DependencyEnforcer() ); |
||
|
0 ignored issues
–
show
|
|||
| 44 | |||
| 45 | // `register_activation_hook` can't be called from inside any hook. |
||
| 46 | register_activation_hook( $plugin_file, array( $email_log->table_manager, 'on_activate' ) ); |
||
| 47 | |||
| 48 | // Load the plugin. |
||
| 49 | add_action( 'wp_loaded', array( $email_log, 'load' ) ); |
||
| 50 | } |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Return the global instance of Email Log plugin. |
||
| 54 | * Eventually the EmailLog class might become singleton. |
||
| 55 | * |
||
| 56 | * @since 2.0 |
||
| 57 | * |
||
| 58 | * @global \EmailLog\Core\EmailLog $email_log |
||
| 59 | * @return \EmailLog\Core\EmailLog |
||
| 60 | */ |
||
| 61 | function email_log() { |
||
| 62 | global $email_log; |
||
| 63 | |||
| 64 | return $email_log; |
||
| 65 | } |
||
| 66 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: