PluginProbe
YayMail – WooCommerce Email Customizer / 4.4.5
YayMail – WooCommerce Email Customizer v4.4.5
4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 trunk 1.9.6 2.1.4 2.1.5 3.2.2 3.2.6 3.2.7.1 3.2.8.1 3.2.9 3.3 3.3.1 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4 3.4.1 All 57 releases
← All changes | yaymail.php +200 -64 1.9.6 → 4.4.5 View file →
@@ -1,64 +1,200 @@
1 -<?php
2 -/**
3 - * Plugin Name: YayMail - WooCommerce Email Customizer
4 - * Plugin URI: https://yaycommerce.com/yaymail-woocommerce-email-customizer/
5 - * Description: Create awesome transactional emails with a drag and drop email builder
6 - * Version: 1.9.6
7 - * Author: YayCommerce
8 - * Author URI: https://yaycommerce.com
9 - * Text Domain: yaymail
10 - * WC requires at least: 3.0.0
11 - * WC tested up to: 5.1.0
12 - * Domain Path: /i18n/languages/
13 - */
14 -
15 -namespace YayMail;
16 -
17 -defined( 'ABSPATH' ) || exit;
18 -define( 'YAYMAIL_PREFIX', 'yaymail' );
19 -define( 'YAYMAIL_VERSION', '1.9.6' );
20 -define( 'YAYMAIL_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
21 -define( 'YAYMAIL_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
22 -define( 'YAYMAIL_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
23 -
24 -spl_autoload_register(
25 - function ( $class ) {
26 - $prefix = __NAMESPACE__;
27 - $base_dir = __DIR__ . '/includes';
28 -
29 - $len = strlen( $prefix );
30 - if ( strncmp( $prefix, $class, $len ) !== 0 ) {
31 - return;
32 - }
33 -
34 - $relative_class_name = substr( $class, $len );
35 -
36 - $file = $base_dir . str_replace( '\\', '/', $relative_class_name ) . '.php';
37 -
38 - if ( file_exists( $file ) ) {
39 - require $file;
40 - }
41 - }
42 -);
43 -if ( ! function_exists( 'install_yaymail_admin_notice' ) ) {
44 - function install_yaymail_admin_notice() {
45 - ?>
46 - <div class="error">
47 - <p><?php echo 'YayMail ' . __( 'is enabled but not effective. It requires WooCommerce in order to work.', 'yaymail' ); ?></p>
48 - </div>
49 - <?php
50 - }
51 -}
52 -function init() {
53 - if ( ! function_exists( 'WC' ) ) {
54 - add_action( 'admin_notices', 'YayMail\\install_yaymail_admin_notice' );
55 - }
56 - Plugin::getInstance();
57 - I18n::getInstance();
58 - Page\Settings::getInstance();
59 - MailBuilder\WooTemplate::getInstance();
60 -}
61 -add_action( 'plugins_loaded', 'YayMail\\init' );
62 -
63 -register_activation_hook( __FILE__, array( 'YayMail\\Plugin', 'activate' ) );
64 -register_deactivation_hook( __FILE__, array( 'YayMail\\Plugin', 'deactivate' ) );
1 +<?php
2 +/**
3 + * Plugin Name: YayMail - WooCommerce Email Customizer
4 + * Plugin URI: https://yaycommerce.com/yaymail-woocommerce-email-customizer/
5 + * Description: Create awesome transactional emails with a drag and drop email builder
6 + * Version: 4.4.5
7 + * Author: YayCommerce
8 + * Author URI: https://yaycommerce.com
9 + * License: GPLv2 or later
10 + * License URI: https://www.gnu.org/licenses/gpl-2.0.html
11 + * Text Domain: yaymail
12 + * Requires at least: 4.7
13 + * Tested up to: 7.1
14 + * Requires PHP: 5.4
15 + * WC requires at least: 3.0.0
16 + * WC tested up to: 11.1.2
17 + * Domain Path: /i18n/languages/
18 + *
19 + * @package YayMail
20 + */
21 +
22 +namespace YayMail;
23 +
24 +defined( 'ABSPATH' ) || exit;
25 +
26 +if ( ! defined( 'YAYMAIL_PREFIX' ) ) {
27 + define( 'YAYMAIL_PREFIX', 'yaymail' );
28 +}
29 +
30 +if ( ! defined( 'YAYMAIL_DEBUG' ) ) {
31 + define( 'YAYMAIL_DEBUG', false );
32 +}
33 +
34 +if ( ! defined( 'YAYMAIL_VERSION' ) ) {
35 + define( 'YAYMAIL_VERSION', '4.4.5' );
36 +}
37 +
38 +if ( ! defined( 'YAYMAIL_PLUGIN_URL' ) ) {
39 + define( 'YAYMAIL_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
40 +}
41 +
42 +if ( ! defined( 'YAYMAIL_PLUGIN_PATH' ) ) {
43 + define( 'YAYMAIL_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
44 +}
45 +
46 +if ( ! defined( 'YAYMAIL_PLUGIN_BASENAME' ) ) {
47 + define( 'YAYMAIL_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
48 +}
49 +
50 +if ( ! defined( 'YAYMAIL_IS_DEVELOPMENT' ) ) {
51 + define( 'YAYMAIL_IS_DEVELOPMENT', false );
52 +}
53 +
54 +if ( ! defined( 'YAYMAIL_REST_NAMESPACE' ) ) {
55 + define( 'YAYMAIL_REST_NAMESPACE', 'yaymail/v1' );
56 +}
57 +
58 +if ( ! defined( 'YAYMAIL_MENU_PRIORITY' ) ) {
59 + define( 'YAYMAIL_MENU_PRIORITY', 100 );
60 +}
61 +
62 +// Lite customizer JS expects a single { global_header_elements, global_footer_elements }
63 +// object, not the multi-language array used by pro. SettingsPage gates on this flag.
64 +if ( ! defined( 'YAYMAIL_LITE_LEGACY_GHF_SHAPE' ) ) {
65 + define( 'YAYMAIL_LITE_LEGACY_GHF_SHAPE', true );
66 +}
67 +
68 +$yaymail_has_required_deps = true;
69 +if ( function_exists( 'YayMail\\init' ) ) {
70 + require_once plugin_dir_path( __FILE__ ) . 'templates/fallbacks/fallback-exists.php';
71 + $yaymail_has_required_deps = false;
72 +}
73 +
74 +if ( version_compare( PHP_VERSION, '7.2', '<' ) ) {
75 + require_once plugin_dir_path( __FILE__ ) . 'templates/fallbacks/fallback-minimum-php.php';
76 + $yaymail_has_required_deps = false;
77 +}
78 +
79 +if ( version_compare( $GLOBALS['wp_version'], '5.2', '<' ) ) {
80 + require_once plugin_dir_path( __FILE__ ) . 'templates/fallbacks/fallback-minimum-wp.php';
81 + $yaymail_has_required_deps = false;
82 +}
83 +
84 +if ( ! $yaymail_has_required_deps ) {
85 + add_action(
86 + 'admin_init',
87 + function() {
88 + deactivate_plugins( plugin_basename( __FILE__ ) );
89 + }
90 + );
91 +
92 + // Return early to prevent loading the plugin.
93 + return;
94 +}
95 +
96 +require_once __DIR__ . '/vendor/autoload.php';
97 +require_once __DIR__ . '/YaymailPluginAdapter.php';
98 +
99 +spl_autoload_register(
100 + function ( $class ) {
101 + $prefix = 'YayMail\\';
102 +
103 + if ( strpos( $class, $prefix ) !== 0 ) {
104 + return;
105 + }
106 +
107 + $relative = substr( $class, strlen( $prefix ) );
108 + $relative_path = str_replace( '\\', '/', $relative ) . '.php';
109 +
110 + $core_file = YAYMAIL_PLUGIN_PATH . 'src/' . $relative_path;
111 +
112 + // Check if yay-wp-pro active
113 + if ( ! function_exists( 'is_plugin_active' ) ) {
114 + require_once ABSPATH . 'wp-admin/includes/plugin.php';
115 + }
116 + $yaymail_wp_pro_plugin_file = 'yaymagic-email-builder-pro/yaymagic-email-builder.php';
117 + $yaymail_wp_pro_active = is_plugin_active( $yaymail_wp_pro_plugin_file ) || is_plugin_active_for_network( $yaymail_wp_pro_plugin_file );
118 +
119 + if ( $yaymail_wp_pro_active && defined( 'YAYWP_PLUGIN_PATH' ) ) {
120 + $core_file = YAYWP_PLUGIN_PATH . 'src/' . $relative_path;
121 + }
122 +
123 + if ( file_exists( $core_file ) ) {
124 + require $core_file;
125 + }
126 + },
127 + true,
128 + true
129 +);
130 +
131 +// Declare this platform so shared core reads platform-specific values from the
132 +// registry instead of detecting the platform inline. Registered after the core
133 +// autoloader above so PlatformRegistry/PlatformInterface resolve, and before Initialize.
134 +\YayMail\Platform\PlatformRegistry::register( new \YayMail\Platform\YaymailPlatform() );
135 +
136 +/**
137 + * Initialize constants
138 + */
139 +Constants\ConstantsHandler::get_instance();
140 +
141 +if ( ! function_exists( 'install_yaymail_admin_notice' ) ) {
142 + function install_yaymail_admin_notice() {
143 + ?>
144 +<div class="error">
145 + <p>
146 + <?php
147 + // translators: %s: search WooCommerce plugin link
148 + printf( 'YayMail ' . esc_html__( 'is enabled but not effective. It requires %1$sWooCommerce%2$s in order to work.', 'yaymail' ), '<a href="' . esc_url( admin_url( 'plugin-install.php?s=woocommerce&tab=search&type=term' ) ) . '">', '</a>' );
149 + ?>
150 + </p>
151 +</div>
152 + <?php
153 + }
154 +}
155 +
156 +if ( ! function_exists( 'YayMail\\init' ) ) {
157 + function init() {
158 + \YayMailScoped\YayCommerce\AdminShell\AdminShell::boot();
159 + \YayMailScoped\YayCommerce\AdminShell\AdminShell::register_plugin(
160 + new \YaymailPluginAdapter()
161 + );
162 + if ( ! function_exists( 'WC' ) ) {
163 + add_action( 'admin_notices', 'YayMail\\install_yaymail_admin_notice' );
164 + } else {
165 + add_action( 'before_woocommerce_init', 'YayMail\\yaymail_enable_compatible_hpos' );
166 + do_action( 'yaymail_before_init' );
167 +
168 + \YayMail\Initialize::get_instance();
169 + }//end if
170 + }
171 +}//end if
172 +
173 +if ( ! function_exists( 'yaymail_enable_compatible_hpos' ) ) {
174 + function yaymail_enable_compatible_hpos() {
175 + if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) {
176 + \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true );
177 +
178 + // Set compatible for active addons. Read the active-plugin options instead of
179 + // scanning the plugin directory: this hook fires on every request and that scans and
180 + // parses every plugin header on disk.
181 + $active_plugins = array_merge(
182 + (array) get_option( 'active_plugins', [] ),
183 + array_keys( (array) get_site_option( 'active_sitewide_plugins', [] ) )
184 + );
185 + foreach ( $active_plugins as $key ) {
186 + $is_yaymail_addon = strpos( $key, 'yaymail-addon' ) !== false || strpos( $key, 'email-customizer' ) !== false;
187 + if ( $is_yaymail_addon ) {
188 + \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', $key, true );
189 + }
190 + }
191 + }
192 + }
193 +}
194 +
195 +if ( ! wp_installing() ) {
196 + add_action( 'plugins_loaded', 'YayMail\\init' );
197 +}
198 +
199 +register_activation_hook( __FILE__, [ \YayMail\Engine\ActDeact::class, 'activate' ] );
200 +register_deactivation_hook( __FILE__, [ \YayMail\Engine\ActDeact::class, 'deactivate' ] );