PluginProbe
EmailKit – Email Customizer for WooCommerce & WP / 1.6.2
EmailKit – Email Customizer for WooCommerce & WP v1.6.2
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
emailkit / includes / Admin / EmailKitEditor / EmailKitEditorInit.php

EmailKitEditorInit.php in EmailKit – Email Customizer for WooCommerce & WP 1.6.2, at includes/Admin/EmailKitEditor/EmailKitEditorInit.php

78 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace EmailKit\Admin\EmailKitEditor;
3
4 use EmailKit\Admin\MetaField\StyleLoad;
5
6 defined('ABSPATH') || exit('No direct script access allowed!');
7
8 /**
9 * EmailKitEditorInit
10 *
11 * @since 1.0.0
12 */
13
14 class EmailKitEditorInit
15 {
16
17 public function __construct()
18 {
19 if(!current_user_can( 'manage_options' )){
20 return;
21 }
22
23 $post_id = isset($_GET['post']) ? sanitize_text_field(wp_unslash($_GET['post'])) : ''; //phpcs:ignore WordPress.Security.NonceVerification -- Nonce can't be added in CPT edit page URL
24 $action = isset($_GET['action']) ? sanitize_text_field(wp_unslash($_GET['action'])) : ''; //phpcs:ignore WordPress.Security.NonceVerification -- Nonce can't be added in CPT edit page URL
25 $post_type = get_post_type($post_id);
26
27 if (empty($post_id) || $action != 'emailkit-builder' || $post_type != 'emailkit') {
28 return;
29 }
30 add_action('init', function () use($post_id) {
31 $dep = \EmailKit\Admin\Dependency::check(get_post_meta($post_id,'emailkit_email_type', true));
32
33 if(true !== $dep){
34 wp_die("Need to " . esc_html($dep['label']??'') . "<a href='" . esc_url($dep['url']??'') . "'> Check here </a>", 'Need to activate plugin');
35 }
36 });
37
38 new StyleLoad();
39 add_action('wp_loaded', [$this, 'add_editor_template']);
40 }
41
42
43 public function add_editor_template()
44 {
45
46 if(is_plugin_active('uafrica-shipping/uafrica-shipping.php') || ( get_template() == 'entry' )){
47 // Check if WooCommerce is active and initialize session if needed
48 if (class_exists('WooCommerce') && function_exists('WC')) {
49 if (is_null(WC()->session) && !headers_sent()) {
50 WC()->session = new \WC_Session_Handler();
51 WC()->session->init();
52 }
53 }
54 }
55 ?>
56 <!DOCTYPE html>
57 <html>
58 <head>
59 <?php wp_head(); ?>
60 <meta charSet="utf-8" />
61 <meta name="viewport" content="width=device-width" />
62 <meta name="next-head-count" content="2" />
63 </head>
64
65 <body class="<?php body_class(['post-'.get_the_ID()]); ?>">
66
67 <?php
68 require_once EMAILKIT_PATH . '/dist/editor.php';
69 wp_footer();
70 ?>
71
72 </body>
73 </html>
74 <?php
75 exit();
76 }
77 }
78