1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
|
<?php /** * Plugin Name: YayMail - WooCommerce Email Customizer * Plugin URI: https://yaycommerce.com/yaymail-woocommerce-email-customizer/ * Description: Create awesome transactional emails with a drag and drop email builder * Version: 3.6.0.1 * Author: YayCommerce * Author URI: https://yaycommerce.com * Text Domain: yaymail * WC requires at least: 3.0.0 * WC tested up to: 9.5.2 * Domain Path: /i18n/languages/ */
namespace YayMail;
use YayMail\License\LicenseHandler;
defined( 'ABSPATH' ) || exit;
if ( function_exists( 'YayMail\\init' ) ) { require_once plugin_dir_path( __FILE__ ) . 'includes/Fallback.php'; add_action( 'admin_init', function () { deactivate_plugins( plugin_basename( __FILE__ ) ); } ); return; }
if ( ! defined( 'YAYMAIL_PREFIX' ) ) { define( 'YAYMAIL_PREFIX', 'yaymail' ); }
if ( ! defined( 'YAYMAIL_DEBUG' ) ) { define( 'YAYMAIL_DEBUG', false ); }
if ( ! defined( 'YAYMAIL_VERSION' ) ) { define( 'YAYMAIL_VERSION', '3.6.0.1' ); }
if ( ! defined( 'YAYMAIL_PLUGIN_URL' ) ) { define( 'YAYMAIL_PLUGIN_URL', plugin_dir_url( __FILE__ ) ); }
if ( ! defined( 'YAYMAIL_PLUGIN_PATH' ) ) { define( 'YAYMAIL_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); }
if ( ! defined( 'YAYMAIL_PLUGIN_BASENAME' ) ) { define( 'YAYMAIL_PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); }
spl_autoload_register( function ( $class ) { $prefix = __NAMESPACE__; $base_dir = __DIR__ . '/includes';
$len = strlen( $prefix ); if ( strncmp( $prefix, $class, $len ) !== 0 ) { return; }
$relative_class_name = substr( $class, $len );
$file = $base_dir . str_replace( '\\', '/', $relative_class_name ) . '.php';
if ( file_exists( $file ) ) { require $file; } } );
if ( ! function_exists( 'install_yaymail_admin_notice' ) ) { function install_yaymail_admin_notice() { ?> <div class="error"> <p> <?php // translators: %s: search WooCommerce plugin link 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>' ); ?> </p> </div> <?php } }
if ( ! function_exists( 'yaymail_enable_compatible_hpos' ) ) { function yaymail_enable_compatible_hpos() { if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); $plugins = get_plugins();
$yaymail_addons = array_filter( $plugins, function ( $key ) { return strpos( $key, 'yaymail-addon' ) !== false || strpos( $key, 'email-customizer' ) !== false || strpos( $key, 'yaymail-premium-addon' ) !== false || strpos( $key, 'yaymail-conditional-logic' ) !== false; }, ARRAY_FILTER_USE_KEY );
$addon_keys = array_keys( $yaymail_addons );
array_map( function ( $key ) { \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', $key, true ); }, $addon_keys ); } } }
if ( ! function_exists( 'YayMail\\init' ) ) { function init() { \YayMail\YayCommerceMenu\RegisterMenu::get_instance(); LicenseHandler::get_instance(); if ( ! function_exists( 'WC' ) ) { add_action( 'admin_notices', 'YayMail\\install_yaymail_admin_notice' ); } else { add_action( 'before_woocommerce_init', 'YayMail\\yaymail_enable_compatible_hpos' ); }
Plugin::getInstance(); Page\Settings::getInstance(); MailBuilder\WooTemplate::getInstance(); MailBuilder\YaymailElement::getInstance(); } }
add_action( 'plugins_loaded', 'YayMail\\init' );
add_action( 'init', function () { I18n::loadPluginTextdomain(); } );
register_activation_hook( __FILE__, array( 'YayMail\\Plugin', 'activate' ) ); register_deactivation_hook( __FILE__, array( 'YayMail\\Plugin', 'deactivate' ) );
|