| 1 |
<?php |
| 2 |
/* |
| 3 |
* Author URI: https://smaily.com |
| 4 |
* Author: Smaily |
| 5 |
* Description: Connect your WooCommerce shop to Smaily for email marketing, automation, and personalised recommendations. (BETA: extended e-commerce sync and Smaily Campaign Intelligence integration.) |
| 6 |
* Domain Path: /languages |
| 7 |
* License URI: https://www.gnu.org/licenses/gpl-3.0.en.html |
| 8 |
* License: GPL-3.0+ |
| 9 |
* Requires at least: 6.6 |
| 10 |
* Requires PHP: 8.0 |
| 11 |
* WC requires at least: 6.9 |
| 12 |
* WC tested up to: 10.7 |
| 13 |
* Plugin Name: Smaily Connect |
| 14 |
* Plugin URI: https://smaily.com/help/user-manual/smaily-connect-for-wordpress/ |
| 15 |
* Text Domain: smaily-connect |
| 16 |
* Version: 3.12.1 |
| 17 |
*/ |
| 18 |
|
| 19 |
// Exit if accessed directly. |
| 20 |
if ( ! defined( 'ABSPATH' ) ) { |
| 21 |
exit; |
| 22 |
} |
| 23 |
|
| 24 |
/** |
| 25 |
* Current plugin version (PSR-4 callers should prefer Smaily\Connect\Constants::version()). |
| 26 |
*/ |
| 27 |
define( 'SMAILY_CONNECT_VERSION', '3.12.1' ); |
| 28 |
|
| 29 |
/** |
| 30 |
* Legacy version constant — kept for upstream compatibility (used by older |
| 31 |
* classes that still reference it). New code should use SMAILY_CONNECT_VERSION. |
| 32 |
*/ |
| 33 |
define( 'SMAILY_CONNECT_PLUGIN_VERSION', '3.12.1' ); |
| 34 |
|
| 35 |
/** |
| 36 |
* The name of the plugin. |
| 37 |
*/ |
| 38 |
define( 'SMAILY_CONNECT_PLUGIN_NAME', 'smaily-connect' ); |
| 39 |
|
| 40 |
/** |
| 41 |
* Absolute URL to the Smaily plugin directory. |
| 42 |
*/ |
| 43 |
define( 'SMAILY_CONNECT_PLUGIN_URL', plugins_url( '', __FILE__ ) ); |
| 44 |
|
| 45 |
/** |
| 46 |
* Absolute path to the Smaily plugin directory. |
| 47 |
*/ |
| 48 |
define( 'SMAILY_CONNECT_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); |
| 49 |
|
| 50 |
/** |
| 51 |
* Absolute path to the core plugin file. |
| 52 |
*/ |
| 53 |
define( 'SMAILY_CONNECT_PLUGIN_FILE', __FILE__ ); |
| 54 |
|
| 55 |
/** |
| 56 |
* Composer autoloader — required for the Smaily\Connect\* PSR-4 namespace and |
| 57 |
* for the bundled Action Scheduler. When vendor/ is missing (e.g. a developer |
| 58 |
* cloned the repo without running `composer install`), surface a clear notice |
| 59 |
* instead of fatally erroring during plugin activation. |
| 60 |
*/ |
| 61 |
if ( file_exists( SMAILY_CONNECT_PLUGIN_PATH . 'vendor/autoload.php' ) ) { |
| 62 |
require_once SMAILY_CONNECT_PLUGIN_PATH . 'vendor/autoload.php'; |
| 63 |
} else { |
| 64 |
add_action( |
| 65 |
'admin_notices', |
| 66 |
static function () { |
| 67 |
if ( ! current_user_can( 'activate_plugins' ) ) { |
| 68 |
return; |
| 69 |
} |
| 70 |
printf( |
| 71 |
'<div class="notice notice-error"><p>%s</p></div>', |
| 72 |
esc_html__( |
| 73 |
'Smaily Connect is missing its Composer dependencies. Run `composer install` in the plugin directory.', |
| 74 |
'smaily-connect' |
| 75 |
) |
| 76 |
); |
| 77 |
} |
| 78 |
); |
| 79 |
|
| 80 |
return; |
| 81 |
} |
| 82 |
|
| 83 |
// Required to use functions is_plugin_active and deactivate_plugins. |
| 84 |
require_once ABSPATH . 'wp-admin/includes/plugin.php'; |
| 85 |
|
| 86 |
/** |
| 87 |
* The plugin lifecycle (legacy bootstrap — handles CF7, Elementor, Gutenberg blocks, |
| 88 |
* existing Smaily-API client). Retained verbatim during the BETA to keep upstream |
| 89 |
* functionality working unchanged; the new namespaced code in Smaily\Connect\* |
| 90 |
* runs alongside it. |
| 91 |
*/ |
| 92 |
require_once SMAILY_CONNECT_PLUGIN_PATH . 'includes/smaily-lifecycle.class.php'; |
| 93 |
|
| 94 |
/** |
| 95 |
* The core legacy plugin class. |
| 96 |
*/ |
| 97 |
require_once SMAILY_CONNECT_PLUGIN_PATH . 'includes/smaily.class.php'; |
| 98 |
|
| 99 |
/** |
| 100 |
* Begins execution of the legacy plugin. |
| 101 |
*/ |
| 102 |
if ( class_exists( 'Smaily_Connect' ) ) { |
| 103 |
new Smaily_Connect( SMAILY_CONNECT_PLUGIN_NAME, SMAILY_CONNECT_PLUGIN_VERSION ); |
| 104 |
} |
| 105 |
|
| 106 |
/** |
| 107 |
* Boot the namespaced Smaily\Connect\* code path. Runs alongside the legacy |
| 108 |
* class above; the two coexist in disjoint namespaces during the BETA. |
| 109 |
*/ |
| 110 |
\Smaily\Connect\Bootstrap::instance()->boot(); |
| 111 |
|