PluginProbe
YeeMail — Email Template Builder & Customizer / 3.0.1
YeeMail — Email Template Builder & Customizer v3.0.1
3.0.1 2.2.1 3.0.0 2.2.0 trunk 2.0.0 2.0.3 2.0.5 2.0.8 2.1.6 2.1.7 2.1.8
yeemail / yeemail.php

yeemail.php in YeeMail — Email Template Builder & Customizer 3.0.1, at yeemail.php

100 lines 4.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Plugin Name: YeeMail — Email Template Builder & Customizer
4 * Description: Customizing the design and content of your email
5 * Version: 3.0.1
6 * Author: add-ons.org
7 * Plugin URI: https://wordpress.org/plugins/yeemail/
8 * Author URI: https://add-ons.org/
9 * License: GPL v2 or later
10 * License URI: https://www.gnu.org/licenses/gpl-2.0.html
11 */
12
13 if (!defined('ABSPATH'))
14 exit; // Exit if accessed directly
15 define('YEEMAIL_PLUGIN_URL', plugin_dir_url(__FILE__));
16 define('YEEMAIL_PLUGIN_PATH', plugin_dir_path(__FILE__));
17 define('YEEMAIL_PLUGIN_BASENAME', plugin_basename(__FILE__));
18 if (function_exists('is_plugin_active')) {
19 require_once(ABSPATH . '/wp-admin/includes/plugin.php');
20 }
21 class Yeemail_Template_Customizer_Init
22 {
23 function __construct()
24 {
25 register_activation_hook(__FILE__, array($this, 'activation'));
26 $dir = new RecursiveDirectoryIterator(YEEMAIL_PLUGIN_PATH . "backend");
27 $ite = new RecursiveIteratorIterator($dir);
28 $files = new RegexIterator($ite, "/\.php/", RegexIterator::MATCH);
29 foreach ($files as $file) {
30 if (!$file->isDir()) {
31 require_once $file->getPathname();
32 }
33 }
34 $dir = new RecursiveDirectoryIterator(YEEMAIL_PLUGIN_PATH . "includes");
35 $ite = new RecursiveIteratorIterator($dir);
36 $files = new RegexIterator($ite, "/\.php/", RegexIterator::MATCH);
37 if (!function_exists('str_get_html')) {
38 include YEEMAIL_PLUGIN_PATH . "libs/simple_html_dom.php";
39 }
40 foreach ($files as $file) {
41 if (!$file->isDir()) {
42 require_once $file->getPathname();
43 }
44 }
45 include_once YEEMAIL_PLUGIN_PATH . "frontend/index.php";
46 include_once YEEMAIL_PLUGIN_PATH . "frontend/functions.php";
47 do_action("yeemail/loaded");
48 }
49 function activation()
50 {
51 global $wpdb;
52 $check = get_option("yeemail_setup", array());
53 if (count($check) < 1) {
54 $string = file_get_contents(YEEMAIL_PLUGIN_PATH . "backend/demo/default.json");
55 $id_map_email_id = array();
56 $datas_templates = explode("\n", $string);
57 foreach ($datas_templates as $datas_template) {
58 $settings_datas = explode("|||yeemail_data|||", $datas_template);
59 if (count($settings_datas) > 1) {
60 $template_content = $settings_datas[1];
61 $settings_data = explode(",", $settings_datas[0]);
62 foreach ($settings_data as $setting) {
63 $main_settings = explode(":", $setting);
64 switch ($main_settings[0]) {
65 case "type":
66 $type = $main_settings[1];
67 break;
68 case "title":
69 $title = $main_settings[1];
70 break;
71 case "email":
72 $email = $main_settings[1];
73 break;
74 case "status":
75 $status = $main_settings[1];
76 break;
77 }
78 }
79 $my_template = array(
80 'post_title' => $title,
81 'post_content' => "",
82 'post_status' => 'publish',
83 'post_type' => 'yeemail_template'
84 );
85 $id_template = wp_insert_post($my_template);
86 $id_map_email_id[$email] = $id_template;
87 add_post_meta($id_template, "data_email", $settings_datas[1]);
88 add_post_meta($id_template, "_mail_type", $type);
89 add_post_meta($id_template, "_mail_template", $email);
90 add_post_meta($id_template, "_status", $status);
91 if ($email == "yeemail_pro") {
92 update_option("yemail_pro_id", $id_template);
93 }
94 }
95 }
96 update_option("yeemail_setup", $id_map_email_id);
97 }
98 }
99 }
100 new Yeemail_Template_Customizer_Init;