register_hooks(); $this->check_rewrite_flush(); } /** * Prevent cloning of the instance. * * @since 1.0.0 */ private function __clone() {} /** * Prevent unserializing of the instance. * * @since 1.0.0 */ public function __wakeup() { throw new Exception( 'Cannot unserialize singleton' ); } /** * Register activation and deactivation hooks. * * @since 1.0.0 */ private function register_hooks() { // Load activator and deactivator classes. require_once DDHH_JM_PLUGIN_DIR . 'includes/class-activator.php'; require_once DDHH_JM_PLUGIN_DIR . 'includes/class-deactivator.php'; // Register activation hook. register_activation_hook( DDHH_JM_PLUGIN_FILE, array( 'DDHH_JM_Activator', 'activate' ) ); // Register deactivation hook. register_deactivation_hook( DDHH_JM_PLUGIN_FILE, array( 'DDHH_JM_Deactivator', 'deactivate' ) ); } /** * Check if rewrite rules need to be flushed. * * This is triggered by a transient set during activation. * * @since 1.0.0 */ private function check_rewrite_flush() { if ( get_transient( 'ddhh_jm_flush_rewrite_rules' ) ) { flush_rewrite_rules(); delete_transient( 'ddhh_jm_flush_rewrite_rules' ); } } }