init(); add_action( 'init', array( $this, 'init_classes' ) ); } /** * Initialize the plugin. * * @return void */ protected function init(): void { $this->version = '1.0.1'; $this->plugin_file = BOOKTICS_FILE; $this->plugin_directory = BOOKTICS_DIR; $this->basename = plugin_basename( $this->plugin_file ); $this->text_domain_directory = $this->plugin_directory . '/languages'; $this->template_directory = $this->plugin_directory . '/templates'; $this->plugin_url = plugins_url( '', $this->plugin_file ); $this->assets_url = $this->plugin_url . '/assets'; $this->build_url = $this->plugin_url . '/build'; register_activation_hook( $this->plugin_file, array( $this, 'activate', ) ); register_deactivation_hook( $this->plugin_file, array( $this, 'deactivate', ) ); } /** * Init classes * * @return void */ public function init_classes() { if ( ! session_id() ) { session_start(); } $service_provider = $this->get_container()->get( 'global' ); // Initilize Plugin Banner Notice. Plugin_Notice::run(); } /** * Get container * * @return Container */ public function get_container() { return booktics_container(); } /** * Initializes the Booktics class. * * Checks for an existing WeMeal instance * and if it doesn't find one, creates it. * * @return Booktics */ public static function instance(): Booktics { static $instance = false; if ( ! $instance ) { $instance = new self(); } return $instance; } /** * Trigger plugin activation class * * @return void */ public function activate() { Activate::handle(); } /** * Trigger plugin deactivation * * @return void */ public function deactivate() { Deactivate::handle(); } /** * returns assets url * * @return string */ public static function assets_url(): string { return trailingslashit( plugins_url( '', BOOKTICS_FILE ) . '/assets' ); } }