loader = new AdvisorPPC_Loader(); $this->connect = new AdvisorPPC_Connect(); } /** * Boot. * * @return void */ public function run() { if ( $this->booted ) { return; } $this->booted = true; $this->load_modules(); $this->load_admin(); // No load_plugin_textdomain(): WordPress 4.6+ loads translations for // the `advisorppc` slug from translate.wordpress.org on its own. $this->connect->register( $this->loader ); if ( $this->admin ) { $this->admin->register( $this->loader ); } /** * Fires once every AdvisorPPC class file has been loaded and before * any hook is attached. Feature modules register here. * * @param AdvisorPPC_Loader $loader Hook loader. * @param AdvisorPPC_Plugin $plugin Plugin instance. */ do_action( 'advisorppc_loaded', $this->loader, $this ); $this->loader->run(); } /** * Include whichever feature module files this build ships. * * @return void */ protected function load_modules() { foreach ( $this->module_files as $relative ) { $path = ADVISORPPC_PLUGIN_DIR . $relative; if ( file_exists( $path ) ) { require_once $path; } } } /** * Include the admin screens, admin requests only. * * @return void */ protected function load_admin() { if ( ! is_admin() ) { return; } require_once ADVISORPPC_PLUGIN_DIR . 'admin/class-advisorppc-settings.php'; require_once ADVISORPPC_PLUGIN_DIR . 'admin/class-advisorppc-admin.php'; $this->admin = new AdvisorPPC_Admin( $this->connect ); } /** * The hook loader, so modules can register outside the action. * * @return AdvisorPPC_Loader */ public function loader() { return $this->loader; } /** * The connect flow object. * * @return AdvisorPPC_Connect */ public function connect() { return $this->connect; } /** * Plugin version. * * @return string */ public function version() { return ADVISORPPC_VERSION; } }