I'm trying to understand how this block of code in the an existing wordpress plugin which depends on a third party events-manager plugin works. I understand that the 'plugins_loaded' action hook is called to register the 'class-events-manager-stripe' class but the next line then calls a static class 'EM_Gateways' in the 3rd party plugin. I can't see where in the plugin this class is included or loaded as part of the php class loading mechanism.
The code is sample
function emp_stripe_register() {
//check that EM Pro is installed
if( ! defined( 'EMP_VERSION' ) ) {
add_action( 'admin_notices', 'emp_stripe_requirements' );
return false; //don't load plugin further
}
require_once( plugin_dir_path( __FILE__ ) . 'class-events-manager-stripe.php' );
EM_Gateways::register_gateway('stripe', 'EM_Gateway_Stripe');
}
add_action( 'plugins_loaded', 'emp_stripe_register', 1000);
I've reused the code locally for my own plugin but keep getting this error
[29-Apr-2015 12:23:56 UTC] PHP Fatal error: Class 'EM_Gateways' not found in /home/xxxx/projects/github/bhaa/public/class-bhaa.php on line 93
What do i need to do to ensure the 'EM_Gateways' class is loaded as part of my plugin start up?
/home/xxxx/projects/github/bhaa/public/class-bhaa.php
doesn't look like a plugin path, are you attempting to load WordPress APIs without loading WordPress in order to create a custom endpoint?