PluginProbe
YayMail – WooCommerce Email Customizer / 2.1.5
YayMail – WooCommerce Email Customizer v2.1.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
yaymail / includes / Page / Settings.php

Settings.php in YayMail – WooCommerce Email Customizer 2.1.5, at includes/Page/Settings.php

864 lines 34.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace YayMail\Page;
4
5 use YayMail\Ajax;
6 use YayMail\Page\Source\CustomPostType;
7 use YayMail\Page\Source\DefaultElement;
8 use YayMail\Templates\Templates;
9
10 defined( 'ABSPATH' ) || exit;
11 /**
12 * Settings Page
13 */
14 class Settings {
15
16 protected static $instance = null;
17
18 public static function getInstance() {
19 if ( null == self::$instance ) {
20 self::$instance = new self();
21 self::$instance->doHooks();
22 }
23
24 return self::$instance;
25 }
26
27 private $pageId = null;
28 private $templateAccount;
29 private $emails = null;
30 public function doHooks() {
31 $this->templateAccount = array( 'customer_new_account', 'customer_new_account_activation', 'customer_reset_password' );
32
33 // Register Custom Post Type use Email Builder
34 add_action( 'init', array( $this, 'registerCustomPostType' ) );
35
36 // Register Menu
37 add_action( 'admin_menu', array( $this, 'settingsMenu' ) );
38
39 // Register Style & Script use for Menu Backend
40 add_action( 'admin_enqueue_scripts', array( $this, 'enqueueAdminScripts' ) );
41
42 add_filter( 'plugin_action_links_' . YAYMAIL_PLUGIN_BASENAME, array( $this, 'plugin_action_links' ) );
43
44 // free version
45 $optionNotice = get_option( 'yaymail_notice' );
46 if ( time() >= (int) $optionNotice ) {
47 add_action( 'admin_notices', array( $this, 'renderNotice' ) );
48 }
49
50 // Ajax display notive
51 add_action( 'wp_ajax_yaymail_notice', array( $this, 'yaymailNotice' ) );
52
53 // Add Woocommerce email setting columns
54 add_filter( 'woocommerce_email_setting_columns', array( $this, 'yaymail_email_setting_columns' ) );
55 add_action( 'woocommerce_email_setting_column_template', array( $this, 'column_template' ) );
56
57 // Excute Ajax
58 Ajax::getInstance();
59 }
60 public function __construct() {}
61
62 public function yaymail_email_setting_columns( $array ) {
63 if ( isset( $array['actions'] ) ) {
64 unset( $array['actions'] );
65 return array_merge(
66 $array,
67 array(
68 'template' => '',
69 'actions' => '',
70 )
71 );
72 }
73 return $array;
74 }
75 public function column_template( $email ) {
76 echo '<td class="wc-email-settings-table-template">
77 <a class="button alignright" target="_blank" href="' . esc_attr( admin_url( 'admin.php?page=yaymail-settings' ) ) . '&template=' . esc_attr( $email->id ) . '">' . esc_html( __( 'Customize with YayMail', 'yaymail' ) ) . '</a></td>';
78 }
79
80 public function renderNotice() {
81 if ( is_plugin_active( 'woocommerce-subscriptions/woocommerce-subscriptions.php' )
82 || is_plugin_active( 'woocommerce-shipment-tracking/woocommerce-shipment-tracking.php' )
83 || is_plugin_active( 'woocommerce-order-status-manager/woocommerce-order-status-manager.php' )
84 || is_plugin_active( 'woocommerce-admin-custom-order-fields/woocommerce-admin-custom-order-fields.php' )
85 || is_plugin_active( 'woo-advanced-shipment-tracking/woo-advanced-shipment-tracking.php' )
86 || is_plugin_active( 'yith-woocommerce-subscription-premium/init.php' )
87 || is_plugin_active( 'yith-woocommerce-subscription/init.php' )
88 ) {
89 ?>
90
91 <div id="yaymail-notice" class="notice-info notice is-dismissible">
92 <h4 style="color: #000"><?php esc_html_e( 'Please upgrade to YayMail Pro to customize emails with:', 'yaymail' ); ?></h4>
93 <ul style="list-style: inside;">
94 <?php
95 ob_start();
96 $path = YAYMAIL_PLUGIN_PATH . '/includes/Page/Source/DisplayNotice.php';
97 include $path;
98 ?>
99 </ul>
100 <p style="padding-left:0">
101 <a href="https://yaycommerce.com/yaymail-woocommerce-email-customizer/ " target="_blank" data="upgradenow" class="button button-primary" style="margin-right: 5px"><?php esc_html_e( 'Upgrade Now', 'yaymail' ); ?></a>
102 <a href="javascript:;" data="later" class="button yaymail-nothank" style="margin-right: 5px"><?php esc_html_e( 'No, thanks', 'yaymail' ); ?></a>
103 </p>
104 </div>
105 <?php
106 }
107 }
108
109
110 public function yaymailNotice() {
111 if ( isset( $_POST ) ) {
112 $nonce = isset( $_POST['nonce'] ) ? sanitize_text_field( $_POST['nonce'] ) : null;
113
114 if ( ! wp_verify_nonce( $nonce, 'yaymail_nonce' ) ) {
115 wp_send_json_error( array( 'status' => 'Wrong nonce validate!' ) );
116 exit();
117 }
118 update_option( 'yaymail_notice', time() + 7 * 60 * 60 * 24 ); // After 7 days show
119 wp_send_json_success();
120 }
121 wp_send_json_error( array( 'message' => 'Update fail!' ) );
122 }
123
124 public function plugin_action_links( $links ) {
125 $action_links = array(
126 'settings' => '<a href="' . admin_url( 'admin.php?page=yaymail-settings' ) . '" aria-label="' . esc_attr__( 'View WooCommerce Email Builder', 'yaymail' ) . '">' . esc_html__( 'Settings', 'yaymail' ) . '</a>',
127 );
128 $links[] = '<a target="_blank" href="https://yaycommerce.com/yaymail-woocommerce-email-customizer/" style="color: #43B854; font-weight: bold">' . __( 'Go Pro', 'yaymail' ) . '</a>';
129 return array_merge( $action_links, $links );
130 }
131
132 public function registerCustomPostType() {
133 $labels = array(
134 'name' => __( 'Email Template', 'yaymail' ),
135 'singular_name' => __( 'Email Template', 'yaymail' ),
136 'add_new' => __( 'Add New Email Template', 'yaymail' ),
137 'add_new_item' => __( 'Add a new Email Template', 'yaymail' ),
138 'edit_item' => __( 'Edit Email Template', 'yaymail' ),
139 'new_item' => __( 'New Email Template', 'yaymail' ),
140 'view_item' => __( 'View Email Template', 'yaymail' ),
141 'search_items' => __( 'Search Email Template', 'yaymail' ),
142 'not_found' => __( 'No Email Template found', 'yaymail' ),
143 'not_found_in_trash' => __( 'No Email Template currently trashed', 'yaymail' ),
144 'parent_item_colon' => '',
145 );
146 $capabilities = array();
147 $args = array(
148 'labels' => $labels,
149 'public' => true,
150 'publicly_queryable' => true,
151 'show_ui' => false,
152 'query_var' => true,
153 'rewrite' => true,
154 'capability_type' => 'yaymail_template',
155 'capabilities' => $capabilities,
156 'hierarchical' => false,
157 'menu_position' => null,
158 'supports' => array( 'title', 'author', 'thumbnail' ),
159 );
160 register_post_type( 'yaymail_template', $args );
161 }
162 public function settingsMenu() {
163 add_submenu_page( 'woocommerce', __( 'Email Builder Settings', 'yaymail' ), __( 'Email Customizer', 'yaymail' ), 'manage_options', $this->getPageId(), array( $this, 'settingsPage' ) );
164 }
165
166 public function nitWebPluginRegisterButtons( $buttons ) {
167 $buttons[] = 'table';
168 $buttons[] = 'searchreplace';
169 $buttons[] = 'visualblocks';
170 $buttons[] = 'code';
171 $buttons[] = 'insertdatetime';
172 $buttons[] = 'autolink';
173 $buttons[] = 'contextmenu';
174 $buttons[] = 'advlist';
175 return $buttons;
176 }
177
178 public function njtWebPluginRegisterPlugin( $plugin_array ) {
179 $plugin_array['table'] = YAYMAIL_PLUGIN_URL . 'assets/tinymce/table/plugin.min.js';
180 $plugin_array['searchreplace'] = YAYMAIL_PLUGIN_URL . 'assets/tinymce/searchreplace/plugin.min.js';
181 $plugin_array['visualblocks'] = YAYMAIL_PLUGIN_URL . 'assets/tinymce/visualblocks/plugin.min.js';
182 $plugin_array['code'] = YAYMAIL_PLUGIN_URL . 'assets/tinymce/code/plugin.min.js';
183 $plugin_array['insertdatetime'] = YAYMAIL_PLUGIN_URL . 'assets/tinymce/insertdatetime/plugin.min.js';
184 $plugin_array['autolink'] = YAYMAIL_PLUGIN_URL . 'assets/tinymce/autolink/plugin.min.js';
185 $plugin_array['contextmenu'] = YAYMAIL_PLUGIN_URL . 'assets/tinymce/contextmenu/plugin.min.js';
186 $plugin_array['advlist'] = YAYMAIL_PLUGIN_URL . 'assets/tinymce/advlist/plugin.min.js';
187 return $plugin_array;
188 }
189
190 public function settingsPage() {
191 // When load this page will not show adminbar
192 ?>
193 <style type="text/css">
194 #wpcontent, #footer {opacity: 0}
195 #adminmenuback, #adminmenuwrap { display: none !important; }
196 </style>
197 <script type="text/javascript" id="yaymail-onload">
198 jQuery(document).ready( function() {
199 jQuery('#adminmenuback, #adminmenuwrap').remove();
200 });
201 </script>
202 <?php
203 // add new buttons
204 add_filter( 'mce_buttons', array( $this, 'nitWebPluginRegisterButtons' ) );
205
206 // Load the TinyMCE plugin
207 add_filter( 'mce_external_plugins', array( $this, 'njtWebPluginRegisterPlugin' ) );
208 $viewPath = YAYMAIL_PLUGIN_PATH . 'views/pages/html-settings.php';
209 include_once $viewPath;
210 }
211
212 public function enqueueAdminScripts( $screenId ) {
213 if ( class_exists( 'SitePress' ) ) {
214 global $sitepress_settings, $sitepress;
215 $custom_posts_sync = $sitepress_settings['custom_posts_sync_option'];
216 $custom_posts_sync['yaymail_template'] = 0;
217 $sitepress->set_setting( 'custom_posts_sync_option', $custom_posts_sync, true );
218 }
219 if ( class_exists( 'Polylang' ) ) {
220 $polylang_options = get_option( 'polylang' );
221 if ( isset( $polylang_options['post_types'] ) ) {
222 $yaymail_template_position = array_search( 'yaymail_template', $polylang_options['post_types'] );
223 if ( false !== $yaymail_template_position ) {
224 $polylang_options['post_types'] = array_splice( $polylang_options['post_types'], $yaymail_template_position + 1, 1 );
225 update_option( 'polylang', $polylang_options );
226 }
227 }
228 }
229 if ( strpos( $screenId, 'yaymail-settings' ) !== false && class_exists( 'WC_Emails' ) ) {
230 // Get list template from Woo
231 $wc_emails = \WC_Emails::instance();
232 $this->emails = (array) $wc_emails::instance()->emails;
233
234 // Insert database all order template from Woo
235 $templateEmail = Templates::getInstance();
236 $templates = $templateEmail::getList();
237
238 foreach ( $templates as $key => $template ) {
239 if ( ! CustomPostType::postIDByTemplate( $key ) ) {
240 $arr = array(
241 'mess' => '',
242 'post_date' => current_time( 'Y-m-d H:i:s' ),
243 'post_type' => 'yaymail_template',
244 'post_status' => 'publish',
245 '_yaymail_template' => $key,
246 '_email_backgroundColor_settings' => 'rgb(236, 236, 236)',
247 '_yaymail_elements' => json_decode( $template['elements'], true ),
248
249 );
250 $insert = CustomPostType::insert( $arr );
251 }
252 }
253
254 /*
255 @@@@ Enable Disable
256 @@@@ note: Note the default value section is required when displaying in vue
257 */
258
259 $settingDefaultEnableDisable = array(
260 'new_order' => 1,
261 'cancelled_order' => 1,
262 'failed_order' => 1,
263 'customer_on_hold_order' => 1,
264 'customer_processing_order' => 1,
265 'customer_completed_order' => 1,
266 'customer_refunded_order' => 1,
267 'customer_invoice' => 0,
268 'customer_note' => 0,
269 'customer_reset_password' => 0,
270 'customer_new_account' => 0,
271 );
272
273 $settingEnableDisables = ( CustomPostType::templateEnableDisable( false ) ) ? CustomPostType::templateEnableDisable( false ) : $settingDefaultEnableDisable;
274
275 foreach ( $this->emails as $key => $value ) {
276 if ( 'ORDDD_Email_Delivery_Reminder' == $key ) {
277 $value->id = 'orddd_delivery_reminder_customer';
278 }
279 if ( 'WCVendors_Admin_Notify_Approved' == $key ) {
280 $value->id = 'admin_notify_approved';
281 }
282 if ( ! array_key_exists( $value->id, $settingEnableDisables ) ) {
283 $settingEnableDisables[ $value->id ] = '0';
284 }
285 }
286
287 $this->emails = apply_filters( 'YaymailCreateFollowUpTemplates', $this->emails );
288 $settingEnableDisables = apply_filters( 'YaymailCreateSelectFollowUpTemplates', $settingEnableDisables );
289
290 $settingDefaultGenerals = array(
291 'payment' => 2,
292 'product_image' => 0,
293 'image_size' => 'thumbnail',
294 'image_width' => '30px',
295 'image_height' => '30px',
296 'product_sku' => 1,
297 'background_color_table_items' => '#e5e5e5',
298 'content_items_color' => '#636363',
299 'title_items_color' => '#96588a',
300 'container_width' => '605px',
301 'order_url' => '',
302 'custom_css' => '',
303 'enable_css_custom' => 'no',
304 'image_position' => 'Top',
305 );
306 $settingGenerals = get_option( 'yaymail_settings' ) ? get_option( 'yaymail_settings' ) : $settingDefaultGenerals;
307 foreach ( $settingDefaultEnableDisable as $keyDefaultEnableDisable => $settingDefaultEnableDisable ) {
308 if ( ! array_key_exists( $keyDefaultEnableDisable, $settingEnableDisables ) ) {
309 $settingEnableDisables[ $keyDefaultEnableDisable ] = $settingDefaultEnableDisable;
310 };
311 }
312 $settings['enableDisable'] = $settingEnableDisables;
313
314 /*
315 @@@@ General
316 @@@@ note: Note the default value section is required when displaying in vue
317 */
318
319 $settingGenerals = get_option( 'yaymail_settings' ) ? get_option( 'yaymail_settings' ) : $settingDefaultGenerals;
320 foreach ( $settingDefaultGenerals as $keyDefaultGeneral => $settingGeneral ) {
321 if ( ! array_key_exists( $keyDefaultGeneral, $settingGenerals ) ) {
322 $settingGenerals[ $keyDefaultGeneral ] = $settingDefaultGenerals[ $keyDefaultGeneral ];
323 };
324 }
325
326 $settingGenerals['direction_rtl'] = get_option( 'yaymail_direction' ) ? get_option( 'yaymail_direction' ) : 'ltr';
327 $settings['general'] = $settingGenerals;
328
329 $scriptId = $this->getPageId();
330 $order = CustomPostType::getListOrders();
331 wp_enqueue_script( 'vue', YAYMAIL_PLUGIN_URL . ( YAYMAIL_DEBUG ? 'assets/libs/vue.js' : 'assets/libs/vue.min.js' ), '', YAYMAIL_VERSION, true );
332 wp_enqueue_script( 'vuex', YAYMAIL_PLUGIN_URL . 'assets/libs/vuex.js', '', YAYMAIL_VERSION, true );
333
334 wp_enqueue_script( $scriptId, YAYMAIL_PLUGIN_URL . 'assets/dist/js/main.js', array( 'jquery' ), YAYMAIL_VERSION, true );
335 wp_enqueue_style( $scriptId, YAYMAIL_PLUGIN_URL . 'assets/dist/css/main.css', array(), YAYMAIL_VERSION );
336
337 // Css of ant
338 // wp_enqueue_style($scriptId . 'antd-css', YAYMAIL_PLUGIN_URL . 'assets/admin/css/antd.min.css');
339 // Css file app
340 // wp_enqueue_style($scriptId, YAYMAIL_PLUGIN_URL . 'assets/dist/css/main.css');
341
342 wp_enqueue_script( $scriptId . '-script', YAYMAIL_PLUGIN_URL . 'assets/admin/js/script.js', '', YAYMAIL_VERSION, true );
343 $yaymailSettings = get_option( 'yaymail_settings' );
344
345 // Load ACE Editor -Start
346 if ( isset( $yaymailSettings['enable_css_custom'] ) && 'yes' == $yaymailSettings['enable_css_custom'] ) {
347 wp_enqueue_script( $scriptId . 'ace-script', YAYMAIL_PLUGIN_URL . 'assets/aceeditor/ace.js', '', YAYMAIL_VERSION, true );
348 wp_enqueue_script( $scriptId . 'ace1-script', YAYMAIL_PLUGIN_URL . 'assets/aceeditor/ext-language_tools.js', '', YAYMAIL_VERSION, true );
349 wp_enqueue_script( $scriptId . 'ace2-script', YAYMAIL_PLUGIN_URL . 'assets/aceeditor/mode-css.js', '', YAYMAIL_VERSION, true );
350 wp_enqueue_script( $scriptId . 'ace3-script', YAYMAIL_PLUGIN_URL . 'assets/aceeditor/theme-merbivore_soft.js', '', YAYMAIL_VERSION, true );
351 wp_enqueue_script( $scriptId . 'ace4-script', YAYMAIL_PLUGIN_URL . 'assets/aceeditor/worker-css.js', '', YAYMAIL_VERSION, true );
352 wp_enqueue_script( $scriptId . 'ace5-script', YAYMAIL_PLUGIN_URL . 'assets/aceeditor/snippets/css.js ', '', YAYMAIL_VERSION, true );
353 } else {
354 wp_dequeue_script( $scriptId . 'ace-script' );
355 wp_dequeue_script( $scriptId . 'ace1-script' );
356 wp_dequeue_script( $scriptId . 'ace2-script' );
357 wp_dequeue_script( $scriptId . 'ace3-script' );
358 wp_dequeue_script( $scriptId . 'ace4-script' );
359 wp_dequeue_script( $scriptId . 'ace5-script' );
360 }
361 // Load ACE Editor -End
362 // Css for page admin of WordPress.
363 wp_enqueue_style( $scriptId . '-css', YAYMAIL_PLUGIN_URL . 'assets/admin/css/css.css', array(), YAYMAIL_VERSION );
364 $current_user = wp_get_current_user();
365 $default_email_test = false != get_user_meta( get_current_user_id(), 'yaymail_default_email_test', true ) ? get_user_meta( get_current_user_id(), 'yaymail_default_email_test', true ) : $current_user->user_email;
366 $element = new DefaultElement();
367 $yaymailSettingsDefaultLogo = get_option( 'yaymail_settings_default_logo' );
368 $setDefaultLogo = false != $yaymailSettingsDefaultLogo ? $yaymailSettingsDefaultLogo['set_default'] : '0';
369 $yaymailSettingsDefaultFooter = get_option( 'yaymail_settings_default_footer' );
370 $setDefaultFooter = false != $yaymailSettingsDefaultFooter ? $yaymailSettingsDefaultFooter['set_default'] : '0';
371 if ( isset( $_GET['template'] ) || ! empty( $_GET['template'] ) ) {
372 $req_template['id'] = sanitize_text_field( $_GET['template'] );
373 } else {
374 $req_template['id'] = 'new_order';
375 }
376 foreach ( $this->emails as $value ) {
377 if ( $value->id == $req_template['id'] ) {
378 $req_template['title'] = $value->title;
379 }
380 }
381
382 // List email supported
383
384 $list_email_supported = array(
385 'WC_Subscription' => array(
386 'plugin_name' => 'WooCommerce Subscriptions',
387 'template_name' => array(
388 'cancelled_subscription',
389 'expired_subscription',
390 'suspended_subscription',
391 'customer_completed_renewal_order',
392 'customer_completed_switch_order',
393 'customer_on_hold_renewal_order',
394 'customer_renewal_invoice',
395 'new_renewal_order',
396 'new_switch_order',
397 'customer_processing_renewal_order',
398 ),
399 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-woo-subscriptions',
400 ),
401 'yith_wishlist_constructor' => array(
402 'plugin_name' => 'YITH WooCommerce Wishlist Premium',
403 'template_name' => array(
404 'estimate_mail',
405 'yith_wcwl_back_in_stock',
406 'yith_wcwl_on_sale_item',
407 'yith_wcwl_promotion_mail',
408 ),
409 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-yith-wishlist',
410 ),
411 'SUMO_Subscription' => array(
412 'plugin_name' => 'SUMO Subscription',
413 'template_name' => array(
414 'subscription_new_order',
415 'subscription_new_order_old_subscribers',
416 'subscription_processing_order',
417 'subscription_completed_order',
418 'subscription_pause_order',
419 'subscription_invoice_order_manual',
420 'subscription_expiry_reminder',
421 'subscription_automatic_charging_reminder',
422 'subscription_renewed_order_automatic',
423 'auto_to_manual_subscription_renewal',
424 'subscription_overdue_order_automatic',
425 'subscription_overdue_order_manual',
426 'subscription_suspended_order_automatic',
427 'subscription_suspended_order_manual',
428 'subscription_preapproval_access_revoked',
429 'subscription_turnoff_automatic_payments_success',
430 'subscription_pending_authorization',
431 'subscription_cancel_order',
432 'subscription_cancel_request_submitted',
433 'subscription_cancel_request_revoked',
434 'subscription_expired_order',
435 ),
436 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-sumo-subscriptions',
437 ),
438
439 'YITH_Subscription' => array(
440 'plugin_name' => 'YITH WooCommerce Subscription Premium',
441 'template_name' => array(
442 'ywsbs_subscription_admin_mail',
443 'ywsbs_customer_subscription_cancelled',
444 'ywsbs_customer_subscription_suspended',
445 'ywsbs_customer_subscription_expired',
446 'ywsbs_customer_subscription_before_expired',
447 'ywsbs_customer_subscription_paused',
448 'ywsbs_customer_subscription_resumed',
449 'ywsbs_customer_subscription_request_payment',
450 'ywsbs_customer_subscription_renew_reminder',
451 'ywsbs_customer_subscription_payment_done',
452 'ywsbs_customer_subscription_payment_failed',
453 'ywsbs_customer_subscription_delivery_schedules',
454 ),
455 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-yith-subscription',
456 ),
457 'woo-b2b' => array(
458 'plugin_name' => 'WooCommerce B2B',
459 'template_name' => array(
460 'wcb2b_customer_onquote_order',
461 'wcb2b_customer_quoted_order',
462 'wcb2b_customer_status_notification',
463 'wcb2b_new_quote',
464 ),
465 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-b2b-woocommerce',
466 ),
467 'YITH_Vendors' => array(
468 'plugin_name' => 'YITH WooCommerce Multi Vendor Premium',
469 'template_name' => array(
470 'cancelled_order_to_vendor',
471 'commissions_paid',
472 'commissions_unpaid',
473 'new_order_to_vendor',
474 'new_vendor_registration',
475 'product_set_in_pending_review',
476 'vendor_commissions_bulk_action',
477 'vendor_commissions_paid',
478 'vendor_new_account',
479 ),
480 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-yith-multivendor',
481 ),
482 'Germanized_Pro' => array(
483 'plugin_name' => 'Germanized for WooCommerce',
484 'template_name' => array(
485 'sab_cancellation_invoice',
486 'sab_document',
487 'sab_document_admin',
488 'sab_simple_invoice',
489 'sab_packing_slip',
490 'customer_paid_for_order',
491 'customer_cancelled_order',
492 'customer_order_confirmation',
493 'customer_revocation',
494 'customer_new_account_activation',
495 'customer_shipment',
496 'customer_return_shipment',
497 'customer_return_shipment_delivered',
498 'new_return_shipment_request',
499 'customer_trusted_shops',
500 'customer_sepa_direct_debit_mandate',
501 'customer_guest_return_shipment_request',
502 ),
503 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-germanized',
504 ),
505 'WC_Bookings' => array(
506 'plugin_name' => 'WooCommerce Bookings',
507 'template_name' => array(
508 'admin_booking_cancelled',
509 'booking_cancelled',
510 'booking_confirmed',
511 'booking_notification',
512 'booking_pending_confirmation',
513 'booking_reminder',
514 'new_booking',
515 ),
516 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-woo-bookings',
517 ),
518 'WooCommerce_Waitlist' => array(
519 'plugin_name' => 'WooCommerce Waitlist',
520 'template_name' => array(
521 'woocommerce_waitlist_joined_email',
522 'woocommerce_waitlist_left_email',
523 'woocommerce_waitlist_mailout',
524 'woocommerce_waitlist_signup_email',
525 ),
526 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-woo-waitlist',
527 ),
528 'WooCommerce_Quotes' => array(
529 'plugin_name' => 'Quotes for WooCommerce',
530 'template_name' => array(
531 'qwc_req_new_quote',
532 'qwc_request_sent',
533 'qwc_send_quote',
534 ),
535 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-quotes-woocommerce',
536 ),
537 'YITH_Pre_Order' => array(
538 'plugin_name' => 'YITH Pre-Order for WooCommerce Premium ',
539 'template_name' => array(
540 'yith_ywpo_date_end',
541 'yith_ywpo_sale_date_changed',
542 'yith_ywpo_is_for_sale',
543 'yith_ywpo_out_of_stock',
544 ),
545 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-yith-pre-order',
546 ),
547 'WooCommerce_Appointments' => array(
548 'plugin_name' => 'WooCommerce Appointments',
549 'template_name' => array(
550 'admin_appointment_cancelled',
551 'admin_new_appointment',
552 'appointment_cancelled',
553 'appointment_confirmed',
554 'appointment_follow_up',
555 'appointment_reminder',
556 ),
557 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-appointments-woocommerce',
558 ),
559 'SG_Order_Approval' => array(
560 'plugin_name' => 'Sg Order Approval for Woocommerce',
561 'template_name' => array(
562 'wc_admin_order_new',
563 'wc_customer_order_new',
564 'wc_customer_order_approved',
565 'wc_customer_order_rejected',
566 'sgitsoa_wc_admin_order_new',
567 'sgitsoa_wc_customer_order_new',
568 'sgitsoa_wc_customer_order_approved',
569 'sgitsoa_wc_customer_order_rejected',
570 ),
571 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-order-approval-woocommerce',
572 ),
573 'YITH_Pre_Order' => array(
574 'plugin_name' => 'YITH Pre-Order for WooCommerce Premium ',
575 'template_name' => array(
576 'yith_ywpo_date_end',
577 'yith_ywpo_sale_date_changed',
578 'yith_ywpo_is_for_sale',
579 'yith_ywpo_out_of_stock',
580 ),
581 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-yith-pre-order',
582 ),
583 'Follow_Up_Emails' => array(
584 'plugin_name' => 'Follow Up Emails for WooCommerce ',
585 'template_name' => apply_filters( 'YaymailCreateListFollowUpNames', array() ),
586 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-woo-follow-ups',
587 ),
588 'Order_Delivery_Date' => array(
589 'plugin_name' => 'Order Delivery Date Pro for WooCommerce',
590 'template_name' => array(
591 'orddd_delivery_reminder',
592 'orddd_delivery_reminder_customer',
593 'orddd_update_date',
594 ),
595 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-order-delivery-date',
596 ),
597 'WC_Email_Cancelled_Customer_Order' => array(
598 'plugin_name' => 'Order Cancellation Email to Customer',
599 'template_name' => array(
600 'wc_customer_cancelled_order',
601 ),
602 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-order-cancellation-email-customer',
603 ),
604 'WC_Smart_Coupons' => array(
605 'plugin_name' => 'WooCommerce Smart Coupons',
606 'template_name' => array(
607 'wc_sc_combined_email_coupon',
608 'wc_sc_acknowledgement_email',
609 'wc_sc_email_coupon',
610 ),
611 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-smart-coupons',
612 ),
613 'Dokan' => array(
614 'plugin_name' => 'Dokan',
615 'template_name' => array(
616 'dokan_new_seller',
617 'dokan_email_vendor_disable',
618 'dokan_email_vendor_enable',
619 'dokan_contact_seller',
620 'new_product',
621 'new_product_pending',
622 'pending_product_published',
623 'updated_product_pending',
624 'dokan_vendor_new_order',
625 'dokan_vendor_completed_order',
626 'dokan_vendor_withdraw_request',
627 'dokan_vendor_withdraw_cancelled',
628 'dokan_vendor_withdraw_approved',
629 'dokan_refund_request',
630 'dokan_vendor_refund',
631 'dokan_announcement',
632 'dokan_staff_new_order',
633 'Dokan_Email_Wholesale_Register',
634 'dokan_email_shipping_status_tracking',
635 'dokan_email_subscription_invoice',
636 'updates_for_store_followers',
637 'vendor_new_store_follower',
638 'dokan_product_enquiry_email',
639 'dokan_report_abuse_admin_email',
640 'Dokan_Send_Coupon_Email',
641 'Dokan_Rma_Send_Warranty_Request',
642 ),
643 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-dokan',
644 ),
645 'B2B_Wholesale_Suite' => array(
646 'plugin_name' => 'B2B & Wholesale Suite',
647 'template_name' => array(
648 'b2bwhs_new_customer_email',
649 'b2bwhs_new_customer_requires_approval_email',
650 'b2bwhs_new_message_email',
651 'b2bwhs_new_quote_email',
652 'b2bwhs_your_account_approved_email',
653 ),
654 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-b2b-wholesale-suite',
655 ),
656 'WooCommerce_Deposits' => array(
657 'plugin_name' => 'WooCommerce Deposits',
658 'template_name' => array(
659 'customer_deposit_partially_paid',
660 'customer_partially_paid',
661 'customer_second_payment_reminder',
662 'full_payment',
663 'partial_payment',
664 ),
665 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-woocommerce-deposits',
666 ),
667 'YITH_Booking' => array(
668 'plugin_name' => 'YITH Booking and Appointment for WooCommerce Premium',
669 'template_name' => array(
670 'yith_wcbk_admin_new_booking',
671 'yith_wcbk_booking_status',
672 'yith_wcbk_customer_booking_note',
673 'yith_wcbk_customer_cancelled_booking',
674 'yith_wcbk_customer_completed_booking',
675 'yith_wcbk_customer_confirmed_booking',
676 'yith_wcbk_customer_new_booking',
677 'yith_wcbk_customer_paid_booking',
678 'yith_wcbk_customer_unconfirmed_booking',
679 'yith_wcbk_booking_status_vendor',
680 'yith_wcbk_vendor_new_booking',
681 ),
682 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-yith-booking',
683 ),
684 'WooCommerce_Points_Rewards' => array(
685 'plugin_name' => 'Points and Rewards for WooCommerce',
686 'template_name' => array(
687 'mwb_wpr_email_notification',
688 ),
689 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-points-and-rewards',
690 ),
691 'PW_WooCommerce_Gift_Cards' => array(
692 'plugin_name' => 'PW WooCommerce Gift Cards',
693 'template_name' => array(
694 'pwgc_email',
695 ),
696 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-pw-woocommerce-gift-cards',
697 ),
698 'YITH_WooCommerce_Gift_Cards_Premium' => array(
699 'plugin_name' => 'YITH WooCommerce Gift Cards Premium',
700 'template_name' => array(
701 'ywgc-email-delivered-gift-card',
702 'ywgc-email-send-gift-card',
703 ),
704 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-yith-woocommerce-gift-cards-premium',
705 ),
706 'YITH_WooCommerce_Membership_Premium' => array(
707 'plugin_name' => 'YITH WooCommerce Membership Premium',
708 'template_name' => array(
709 'membership_cancelled',
710 'membership_expired',
711 'membership_expiring',
712 'membership_welcome',
713 ),
714 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-yith-woocommerce-membership-premium',
715 ),
716 'WooCommerce_Order_Delivery' => array(
717 'plugin_name' => 'WooCommerce Order Delivery',
718 'template_name' => array(
719 'subscription_delivery_note',
720 'order_delivery_note',
721 ),
722 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-themesquad-delivery-date',
723 ),
724 'WooCommerce_Simple_Auction' => array(
725 'plugin_name' => 'WooCommerce Simple Auction',
726 'template_name' => array(
727 'auction_buy_now',
728 'auction_closing_soon',
729 'auction_fail',
730 'auction_finished',
731 'auction_relist',
732 'auction_relist_user',
733 'auction_win',
734 'bid_note',
735 'customer_bid_note',
736 'outbid_note',
737 'remind_to_pay',
738 'Reserve_fail',
739 ),
740 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-simple-auctions',
741 ),
742 'vendors_marketplace' => array(
743 'plugin_name' => 'Vendors marketplace',
744 'template_name' => array(
745 'admin_notify_approved',
746 'admin_notify_application',
747 'admin_notify_product',
748 'admin_notify_shipped',
749 'customer_notify_shipped',
750 'vendor_notify_application',
751 'vendor_notify_approved',
752 'vendor_notify_cancelled_order',
753 'vendor_notify_denied',
754 'vendor_notify_order',
755 'vendor_application',
756 'admin_new_vendor_product',
757 'vendor_notify_shipped',
758 'vendor_new_order',
759 'customer-mark-received',
760 'store_contact',
761 ),
762 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-wc-vendors',
763 ),
764 'WooCommerce_Pre_Orders' => array(
765 'plugin_name' => 'WooCommerce Pre-Orders',
766 'template_name' => array(
767 'wc_pre_orders_new_pre_order',
768 'wc_pre_orders_pre_order_available',
769 'wc_pre_orders_pre_order_cancelled',
770 'wc_pre_orders_pre_order_date_changed',
771 'wc_pre_orders_pre_ordered',
772 ),
773 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-woo-pre-orders',
774 ),
775 'WooCommerce_Split_Orders' => array(
776 'plugin_name' => 'WooCommerce Split Orders',
777 'template_name' => array(
778 'customer_order_split',
779 ),
780 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-split-orders',
781 ),
782 'WP_Crowdfunding' => array(
783 'plugin_name' => 'WP Crowdfunding',
784 'template_name' => array(
785 'wp_crowdfunding_campaign_accept',
786 'wp_crowdfunding_submit_campaign',
787 'wp_crowdfunding_campaign_update_email',
788 'wp_crowdfunding_new_backed',
789 'wp_crowdfunding_new_user',
790 'wp_crowdfunding_target_reached_email',
791 'wp_crowdfunding_withdraw_request'
792 ),
793 'link_upgrade' => 'https://yaycommerce.com/yaymail-woocommerce-email-customizer/#yaymail-addon-wp-crowdfunding',
794 ),
795 );
796
797 $list_plugin_for_pro = array();
798
799 if ( class_exists( 'WC_Shipment_Tracking_Actions' ) || class_exists( 'WC_Advanced_Shipment_Tracking_Actions' ) ) {
800 $list_plugin_for_pro[] = 'WC_Shipment_Tracking';
801 }
802 if ( class_exists( 'WC_Admin_Custom_Order_Fields' ) ) {
803 $list_plugin_for_pro[] = 'WC_Admin_Custom_Order_Fields';
804 }
805
806 $orderby = 'name';
807 $order_category = 'asc';
808 $hide_empty = false;
809
810 $cat_args = array(
811 'orderby' => $orderby,
812 'order' => $order_category,
813 'hide_empty' => $hide_empty,
814 );
815
816 $product_categories = get_terms( 'product_cat', $cat_args );
817 $billing_country = WC()->countries->countries;
818
819 wp_localize_script(
820 $scriptId,
821 'yaymail_data',
822 array(
823 'orders' => $order,
824 'imgUrl' => YAYMAIL_PLUGIN_URL . 'assets/dist/images',
825 'nonce' => wp_create_nonce( 'email-nonce' ),
826 'defaultDataElement' => $element->defaultDataElement,
827 'home_url' => home_url(),
828 'settings' => $settings,
829 'admin_url' => get_admin_url(),
830 'yaymail_plugin_url' => YAYMAIL_PLUGIN_URL,
831 'wc_emails' => $this->emails,
832 'default_email_test' => $default_email_test,
833 'template' => $req_template,
834 'set_default_logo' => $setDefaultLogo,
835 'set_default_footer' => $setDefaultFooter,
836 'list_plugin_for_pro' => $list_plugin_for_pro,
837 'plugins' => apply_filters( 'yaymail_plugins', array() ),
838 'list_email_supported' => $list_email_supported,
839 'product_categories' => $product_categories,
840 'billing_country' => $billing_country,
841 )
842 );
843 do_action( 'yaymail_enqueue_script_conditional_logic' );
844 do_action( 'yaymail_before_enqueue_dependence' );
845 }
846 wp_enqueue_script( 'yaymail-notice', YAYMAIL_PLUGIN_URL . 'assets/admin/js/notice.js', array( 'jquery' ), YAYMAIL_VERSION, false );
847 wp_localize_script(
848 'yaymail-notice',
849 'yaymail_notice',
850 array(
851 'admin_ajax' => admin_url( 'admin-ajax.php' ),
852 'nonce' => wp_create_nonce( 'yaymail_nonce' ),
853 )
854 );
855 }
856 public function getPageId() {
857 if ( null == $this->pageId ) {
858 $this->pageId = YAYMAIL_PREFIX . '-settings';
859 }
860
861 return $this->pageId;
862 }
863 }
864