2026-02-27 08:06:22 +01:00
|
|
|
<?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' ] );
|
|
|
|
|
|
feat: domains, transports, logs, quarantine, spam filter, i18n + UX fixes
Features added:
- Admin > Domains: add domains to Mailcow servers, auto-generate DKIM,
display full DNS record set (MX, SPF, DMARC, DKIM, autoconfig CNAMEs)
with one-click copy per record
- Admin > Transports: manage sender-dependent relay hosts (add/delete)
- Admin > Logs: view Postfix, Dovecot, Rspamd, Ratelimit, API and other
server logs in a dark scrollable panel
- My Account: per-domain Quarantine panel — view score, sender, subject,
date; permanently delete quarantined messages
- My Account: per-mailbox Spam Filter slider (1–15 threshold) saved via API
- My Account: Aliases & Forwarders (alias creation doubles as forwarder
to any external address)
UX fixes:
- Quota 0 now displays ∞ (unlimited) in both admin and account views
- Admin mailbox action buttons replaced with Dashicon icon buttons
(lock, chart-bar, trash) with title tooltips
i18n:
- load_plugin_textdomain registered on init hook
- All user-facing PHP strings wrapped in __() / esc_html__()
- Translated strings array passed to account JS via wp_localize_script
- woocow-es_ES.po/.mo — Spanish translation
- woocow-ro_RO.po/.mo — Romanian translation (with correct plural forms)
- English remains the fallback
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-27 08:38:52 +01:00
|
|
|
add_action( 'init', function () {
|
|
|
|
|
load_plugin_textdomain( 'woocow', false, dirname( plugin_basename( WOOCOW_PLUGIN_FILE ) ) . '/languages' );
|
|
|
|
|
} );
|
|
|
|
|
|
2026-02-27 08:06:22 +01:00
|
|
|
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();
|
|
|
|
|
} );
|