PluginProbe
EmailKit – Email Customizer for WooCommerce & WP / 1.6.9
EmailKit – Email Customizer for WooCommerce & WP v1.6.9
1.6.9 1.6.8 1.6.7 trunk 1.0.0 1.2.0 1.4.0 1.4.5 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6
← All changes | includes/Admin/Emails/EmailLists.php +60 -1 1.6.2 → 1.6.9 View file →
@@ -22,9 +22,11 @@
22 22 const NEW_ACCOUNT = "customer_new_account";
23 23 const WP_NEW_REGISTER = "new_register";
24 24 const WP_RESET_PASSWORD = "reset_account";
25 25 const PARTIAL_REFUND = "partial_refund";
26 + const PAYMENT_GATEWAY_ENABLED = "admin_payment_gateway_enabled";
26 27 const METFORM = "metform";
28 + const POPUPKIT = "popupkit";
27 29
28 30
29 31 /**
30 32 * Get woocommerce template names
@@ -48,8 +50,9 @@
48 50 self::CUSTOMER_INVOICE_OR_ORDER_DETAILS => esc_html__('Customer Invoice ', 'emailkit'),
49 51 self::CUSTOMER_NOTE => esc_html__('Customer Note', 'emailkit'),
50 52 self::NEW_ACCOUNT => esc_html__('New Account', 'emailkit'),
51 53 self::RESET_PASSWORD => esc_html__('Reset Password', 'emailkit'),
54 + self::PAYMENT_GATEWAY_ENABLED => esc_html__('Payment Gateway Enabled', 'emailkit'),
52 55 ];
53 56
54 57 if($template_type){
55 58 return isset($list[$template_type]) ? $list[$template_type] : '';
@@ -89,9 +92,9 @@
89 92
90 93 // Free: Check for templates
91 94 $templates = get_posts([
92 95 'post_type' => 'emailkit',
93 - 'meta_query' => [['key' => 'emailkit_template_type', 'value' => 'metform_form_', 'compare' => 'LIKE']],
96 + 'meta_query' => [['key' => ' ', 'value' => 'metform_form_', 'compare' => 'LIKE']],
94 97 'posts_per_page' => 1,
95 98 'fields' => 'ids',
96 99 'orderby' => 'ID',
97 100 'order' => 'ASC'
@@ -130,8 +133,64 @@
130 133 }
131 134
132 135 return $template_type ? ($list[$template_type] ?? '') : $list;
133 136 }
137 +
138 + public static function popupkit_email($template_type = '') {
139 + $list = ['Select Template' => esc_html__('Select Popup', 'emailkit')];
140 +
141 + $popupkit_popups = get_posts([
142 + 'post_type' => 'popupkit-campaigns',
143 + 'post_status' => 'publish',
144 + 'numberposts' => -1,
145 + 'orderby' => 'title',
146 + 'order' => 'ASC',
147 + ]);
148 +
149 + // Free: Check for existing templates linked to popupkit
150 + $templates = get_posts([
151 + 'post_type' => 'emailkit',
152 + 'meta_query' => [['key' => 'emailkit_template_type', 'value' => 'popupkit_popup_', 'compare' => 'LIKE']],
153 + 'posts_per_page' => 1,
154 + 'fields' => 'ids',
155 + 'orderby' => 'ID',
156 + 'order' => 'ASC'
157 + ]);
158 +
159 + if (defined('EMAILKITPRO_VERSION') || class_exists('EmailKitPro')) {
160 + // Pro: Show all popups
161 + foreach ($popupkit_popups as $popup) {
162 + $list['popupkit_popup_' . $popup->ID] = esc_html__('Popup: ', 'emailkit') . $popup->post_title;
163 + }
164 + } else {
165 + if (empty($templates)) {
166 + // No templates: Show all popups
167 + foreach ($popupkit_popups as $popup) {
168 + $list['popupkit_popup_' . $popup->ID] = esc_html__('Popup: ', 'emailkit') . $popup->post_title;
169 + }
170 + } else {
171 + // Templates exist: Show only popups that already have a template
172 + $popup_ids = [];
173 + foreach ($templates as $template_id) {
174 + $popup_id = get_post_meta($template_id, 'emailkit_popup_id', true) ?:
175 + (preg_match('/popupkit_popup_(\d+)/', get_post_meta($template_id, 'emailkit_template_type', true), $matches) ? $matches[1] : 0);
176 + if ($popup_id) $popup_ids[] = (int) $popup_id;
177 + }
178 + foreach ($popupkit_popups as $popup) {
179 + if (in_array($popup->ID, $popup_ids)) {
180 + $list['popupkit_popup_' . $popup->ID] = esc_html__('Popup: ', 'emailkit') . $popup->post_title;
181 + }
182 + }
183 + }
184 + }
185 +
186 + if (!class_exists('EmailKitPro') && is_array($popupkit_popups) && count($popupkit_popups) > 1 && !empty($templates)) {
187 + $list['more-popups'] = esc_html__('More Popups...', 'emailkit');
188 + }
189 +
190 + return $template_type ? ($list[$template_type] ?? '') : $list;
191 + }
192 +
134 193
135 194 /**
136 195 * Get saved templates from database
137 196 * @return array