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

65 lines 1.8 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 $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
23 $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
24 $post_type = get_post_type($post_id);
25
26 if (empty($post_id) || $action != 'emailkit-builder' || $post_type != 'emailkit') {
27 return;
28 }
29
30 $dep = \EmailKit\Admin\Dependency::check(get_post_meta($post_id,'emailkit_email_type', true));
31
32 if(true !== $dep){
33 wp_die("Need to " . esc_html($dep['label']) . "<a href='" . esc_url($dep['url']) . "'> Check here </a>", 'Need to activate plugin');
34 }
35
36 new StyleLoad();
37 add_action('wp_loaded', [$this, 'add_editor_template']);
38 }
39
40 public function add_editor_template()
41 {
42 ?>
43 <!DOCTYPE html>
44 <html>
45 <head>
46 <?php wp_head(); ?>
47 <meta charSet="utf-8" />
48 <meta name="viewport" content="width=device-width" />
49 <meta name="next-head-count" content="2" />
50 </head>
51
52 <body class="<?php body_class(['post-'.get_the_ID()]); ?>">
53
54 <?php
55 require_once EMAILKIT_PATH . '/dist/editor.php';
56 wp_footer();
57 ?>
58
59 </body>
60 </html>
61 <?php
62 exit();
63 }
64 }
65