PluginProbe
EmailKit – Email Customizer for WooCommerce & WP / 1.5.4
EmailKit – Email Customizer for WooCommerce & WP v1.5.4
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.5.4, at includes/Admin/EmailKitEditor/EmailKitEditorInit.php

68 lines 1.9 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 <!DOCTYPE html>
47 <html>
48 <head>
49 <?php wp_head(); ?>
50 <meta charSet="utf-8" />
51 <meta name="viewport" content="width=device-width" />
52 <meta name="next-head-count" content="2" />
53 </head>
54
55 <body class="<?php body_class(['post-'.get_the_ID()]); ?>">
56
57 <?php
58 require_once EMAILKIT_PATH . '/dist/editor.php';
59 wp_footer();
60 ?>
61
62 </body>
63 </html>
64 <?php
65 exit();
66 }
67 }
68