- phpList REST API wrapper with subscriber get-or-create + list assignment - WooCommerce Settings tab (5 sections: connection, orders, signup, newsletter) - Test Connection button via admin-post action - Hooks for order completed/cancelled and user_register events - [woolist_newsletter] shortcode with jQuery AJAX, fixed & auto-generated coupons - Responsive front-end form styles and JS with loading/success/error states Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
58 lines
1.6 KiB
PHP
58 lines
1.6 KiB
PHP
<?php
|
|
/**
|
|
* Plugin Name: WooList — phpList Integration
|
|
* Plugin URI: https://github.com/woolist/woolist-phplist
|
|
* Description: Sync WooCommerce customers and newsletter signups to phpList.
|
|
* Version: 1.0.0
|
|
* Author: WooList
|
|
* Text Domain: woolist-phplist
|
|
* Domain Path: /languages
|
|
* Requires at least: 6.0
|
|
* Requires PHP: 7.4
|
|
* Requires Plugins: woocommerce
|
|
*
|
|
* @package WooList
|
|
*/
|
|
|
|
defined( 'ABSPATH' ) || exit;
|
|
|
|
// Plugin constants.
|
|
define( 'WOOLIST_VERSION', '1.0.0' );
|
|
define( 'WOOLIST_PATH', plugin_dir_path( __FILE__ ) );
|
|
define( 'WOOLIST_URL', plugin_dir_url( __FILE__ ) );
|
|
|
|
/**
|
|
* Check that WooCommerce is active; show admin notice if not.
|
|
*/
|
|
function woolist_check_woocommerce() {
|
|
if ( ! class_exists( 'WooCommerce' ) ) {
|
|
add_action( 'admin_notices', function () {
|
|
echo '<div class="notice notice-error"><p>'
|
|
. esc_html__( 'WooList — phpList Integration requires WooCommerce to be installed and active.', 'woolist-phplist' )
|
|
. '</p></div>';
|
|
} );
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Bootstrap the plugin after all plugins are loaded.
|
|
*/
|
|
function woolist_init() {
|
|
if ( ! woolist_check_woocommerce() ) {
|
|
return;
|
|
}
|
|
|
|
require_once WOOLIST_PATH . 'includes/class-woolist-api.php';
|
|
require_once WOOLIST_PATH . 'includes/class-woolist-admin.php';
|
|
require_once WOOLIST_PATH . 'includes/class-woolist-hooks.php';
|
|
require_once WOOLIST_PATH . 'includes/class-woolist-shortcode.php';
|
|
|
|
$api = new WooList_API();
|
|
new WooList_Admin( $api );
|
|
new WooList_Hooks( $api );
|
|
new WooList_Shortcode( $api );
|
|
}
|
|
add_action( 'plugins_loaded', 'woolist_init' );
|