activator(); } // Register the activation hook register_activation_hook( __FILE__, 'ai_writing_assistant_plugin_activator' ); if (!function_exists('ai_writing_assistant_pro')) { // Define the version and name of the plugin define('AIWA_VERSION', '1.1.7'); define('AIWA_NAME', 'ai_writing_assistant'); // Define the directory path and URL for the plugin define('AIWA_DIR_PATH', dirname(__FILE__) . '/'); define('AIWA_PLUGIN_BASENAME', plugin_basename(__FILE__)); define('AIWA_DIR_URL', plugin_dir_url(__FILE__) . '/'); register_activation_hook(__FILE__, 'aiwa_save_redirect_option'); add_action('admin_init', 'aiwa_redirect_to_menu'); /*Redirect to plugin's settings page when plugin will active*/ function aiwa_save_redirect_option() { add_option('aiwa_activation_check', true); } function aiwa_redirect_to_menu() { if (get_option('aiwa_activation_check', false)) { delete_option('aiwa_activation_check'); exit( wp_redirect("admin.php?page=ai-writing-assistant&welcome=true") ); } } // Include the file containing the plugin class require 'includes/class-WpWritingAssistant.php'; /** * Deactivation hook function that runs when the plugin is deactivated. * * @since 1.0.0 */ function ai_writing_assistant_plugin_deactivator() { // Include the file containing the deactivation class require 'includes/plugin-deactivator.php'; // Create an instance of the deactivation class and call its deactivator method $plugin = new PluginDeactivator(); $plugin->deactivator(); } // Register the deactivation hook register_deactivation_hook(__FILE__, 'ai_writing_assistant_plugin_deactivator'); /** * Function that runs when the plugin is loaded. * * @since 1.0.0 */ function ai_writing_assistant() { // Create an instance of the plugin class and call its run method $plugin = new WpWritingAssistant\WpWritingAssistant(); $plugin->run(); } // Run the plugin ai_writing_assistant(); }