feat: initial WooCow plugin — Mailcow/WooCommerce integration

- Mailcow API client wrapping domains, mailboxes, aliases endpoints
- Admin backend: server management, customer-domain assignments, mailbox overview
- WooCommerce My Account: email hosting tab with mailbox/alias management
- Per-mailbox password change (independent of WP account password)
- Optional WP account password sync to all customer mailboxes
- Installer creates wp_woocow_servers and wp_woocow_assignments DB tables
- Full nonce + capability + ownership verification on all AJAX endpoints

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-02-27 08:06:22 +01:00
commit 2ee81efacf
9 changed files with 2324 additions and 0 deletions

41
woocow.php Normal file
View File

@@ -0,0 +1,41 @@
<?php
/**
* Plugin Name: WooCow
* Description: Mailcow email hosting management for WooCommerce customers.
* Version: 1.0.0
* Author: WooCow
* Text Domain: woocow
* Requires at least: 6.2
* Requires PHP: 8.1
* WC requires at least: 7.0
*/
defined( 'ABSPATH' ) || exit;
define( 'WOOCOW_VERSION', '1.0.0' );
define( 'WOOCOW_PLUGIN_FILE', __FILE__ );
define( 'WOOCOW_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'WOOCOW_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
require_once WOOCOW_PLUGIN_DIR . 'includes/class-woocow-installer.php';
require_once WOOCOW_PLUGIN_DIR . 'includes/class-woocow-api.php';
require_once WOOCOW_PLUGIN_DIR . 'includes/class-woocow-admin.php';
require_once WOOCOW_PLUGIN_DIR . 'includes/class-woocow-account.php';
require_once WOOCOW_PLUGIN_DIR . 'includes/class-woocow-pw-sync.php';
register_activation_hook( __FILE__, [ 'WooCow_Installer', 'install' ] );
add_action( 'plugins_loaded', function () {
if ( ! class_exists( 'WooCommerce' ) ) {
add_action( 'admin_notices', function () {
printf(
'<div class="notice notice-error"><p>%s</p></div>',
esc_html__( 'WooCow requires WooCommerce to be installed and active.', 'woocow' )
);
} );
return;
}
new WooCow_Admin();
new WooCow_Account();
new WooCow_PW_Sync();
} );