', esc_html__( 'Oops!', 'woo_custom_emails_domain' ), '' ); $text_string .= sprintf( '%1$s%2$sWooCommerce%3$s%4$s%5$s', '

', '', '', esc_html__( ' is required for this plugin.', 'woo_custom_emails_domain' ), '

' ); $text_string .= sprintf( '%1$s%2$s%3$s', '

', esc_html__( 'Please install and activate WooCommerce and try again.', 'woo_custom_emails_domain' ), '

' ); wp_die( $text_string ); // phpcs:ignore } } // Add a custom Database Table on plugin activation. register_activation_hook( __FILE__, 'woo_custom_emails_add_db_table' ); function woo_custom_emails_add_db_table() { // Global var for WP db. global $wpdb; // Collation setting. $charset_collate = $wpdb->get_charset_collate(); // Custom Table name. $table_name = $wpdb->prefix . 'wcepp_messages'; // SQL statement. $sql = "CREATE TABLE `$table_name` ( `id` int(9) NOT NULL AUTO_INCREMENT, `product_id` int(9) DEFAULT NULL, `msg_processing` varchar(220) DEFAULT NULL, `msg_processing_loc` varchar(220) DEFAULT NULL, `msg_onhold` varchar(220) DEFAULT NULL, `msg_onhold_loc` varchar(220) DEFAULT NULL, `msg_completed` varchar(220) DEFAULT NULL, `msg_completed_loc` varchar(220) DEFAULT NULL, PRIMARY KEY(id) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; "; // If the table does not exist, run the SQL statement using dbDelta() function. if ( $wpdb->get_var( "SHOW TABLES LIKE '$table_name'" ) != $table_name ) { require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); dbDelta( $sql ); } } // Include required files. require_once plugin_dir_path( __FILE__ ) . 'includes/class-woo-custom-emails-per-product.php'; require_once plugin_dir_path( __FILE__ ) . 'admin/class-woo-custom-emails-per-product-cpt.php'; require_once plugin_dir_path( __FILE__ ) . 'admin/class-woo-custom-emails-column-display.php'; require_once plugin_dir_path( __FILE__ ) . 'admin/class-woo-custom-emails-per-product-admin-settings.php'; // require_once plugin_dir_path( __FILE__ ) . 'admin/class-woo-custom-emails-assigned-messages.php'; require_once plugin_dir_path( __FILE__ ) . 'includes/class-woo-custom-emails-output.php'; /** * Runs main plugin functions. */ function run_woo_custom_emails_per_product() { // Create a new object. $woo_custom_emails_domain = new Woo_Custom_Emails_Per_Product(); // Do the 'run' function inside our object. $woo_custom_emails_domain->run(); // Create a new output object. new Woo_Custom_Emails_Output(); } // Go! run_woo_custom_emails_per_product();