PluginProbe
Send Users Email – Email Subscribers, Email Marketing Newsletter / trunk
Send Users Email – Email Subscribers, Email Marketing Newsletter vtrunk
2.0.3 2.0.2 2.0.1 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.2.0 1.2.1 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 All 51 releases
send-users-email / includes / class-send-users-email.php

class-send-users-email.php in Send Users Email – Email Subscribers, Email Marketing Newsletter trunk, at includes/class-send-users-email.php

114 lines 4.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * The core plugin class.
5 */
6 class Send_Users_Email {
7 protected $loader;
8
9 protected $plugin_name;
10
11 protected $version;
12
13 /**
14 * Define the core functionality of the plugin.
15 */
16 public function __construct() {
17 if ( defined( 'SEND_USERS_EMAIL_VERSION' ) ) {
18 $this->version = SEND_USERS_EMAIL_VERSION;
19 } else {
20 $this->version = '1.5.5';
21 }
22 $this->plugin_name = 'send-users-email';
23 $this->load_dependencies();
24 $this->set_locale();
25 $this->define_admin_hooks();
26 }
27
28 /**
29 * Load the required dependencies for this plugin.
30 */
31 private function load_dependencies() {
32 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-send-users-email-loader.php';
33 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-send-users-email-i18n.php';
34 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'admin/class-send-users-email-admin.php';
35 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'helpers/cleanup.class.php';
36 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'helpers/functions.php';
37 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-wp-admin-notices.php';
38 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-email-template-data.php';
39 require_once plugin_dir_path( dirname( __FILE__ ) ) . 'includes/class-template-data.php';
40 $this->loader = new Send_Users_Email_Loader();
41 }
42
43 /**
44 * Define the locale for this plugin for internationalization.
45 */
46 private function set_locale() {
47 $plugin_i18n = new Send_Users_Email_i18n();
48 $this->loader->add_action( 'plugins_loaded', $plugin_i18n, 'load_plugin_textdomain' );
49 }
50
51 /**
52 * Register all the hooks related to the admin area functionality of the plugin.
53 */
54 private function define_admin_hooks() {
55 $plugin_admin = new Send_Users_Email_Admin($this->get_plugin_name(), $this->get_version());
56 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_styles' );
57 $this->loader->add_action( 'admin_enqueue_scripts', $plugin_admin, 'enqueue_scripts' );
58 // Initialize Admin menu
59 $this->loader->add_action( 'admin_menu', $plugin_admin, 'admin_menu' );
60 // User email handler
61 $this->loader->add_action( "wp_ajax_sue_user_email_ajax", $plugin_admin, 'handle_ajax_admin_user_email' );
62 // User single email handler
63 $this->loader->add_action( "wp_ajax_sue_user_single_email_ajax", $plugin_admin, 'handle_ajax_admin_user_single_email' );
64 // User email send progress
65 $this->loader->add_action( "wp_ajax_sue_email_users_progress", $plugin_admin, 'handle_ajax_email_users_progress' );
66 // Role email handler
67 $this->loader->add_action( "wp_ajax_sue_role_email_ajax", $plugin_admin, 'handle_ajax_admin_role_email' );
68 // Role email send progress
69 $this->loader->add_action( "wp_ajax_sue_email_roles_progress", $plugin_admin, 'handle_ajax_email_roles_progress' );
70 // Settings ajax handler
71 $this->loader->add_action( "wp_ajax_sue_settings_ajax", $plugin_admin, 'handle_ajax_admin_settings' );
72 // wp mail log error
73 $this->loader->add_action( "wp_mail_failed", $plugin_admin, 'handle_wp_mail_failed_action' );
74 // Delete error log request handling
75 $this->loader->add_action( 'admin_init', $plugin_admin, 'delete_error_log' );
76 // Delete all queued emails
77 $this->loader->add_action( 'admin_init', $plugin_admin, 'delete_all_queued_emails' );
78 // Email log view request
79 $this->loader->add_action( 'wp_ajax_sue_view_email_log_ajax', $plugin_admin, 'handle_ajax_view_email_log' );
80 // Check admin capability when plugin initialize
81 $this->loader->add_filter( 'init', $plugin_admin, 'check_administrator_capability' );
82 }
83
84 /**
85 * Run the loader to execute all the hooks with WordPress.
86 */
87 public function run() {
88 $this->loader->run();
89 }
90
91 /**
92 * The name of the plugin used to uniquely identify it within the context of
93 * WordPress and to define internationalization functionality.
94 */
95 public function get_plugin_name() {
96 return $this->plugin_name;
97 }
98
99 /**
100 * The reference to the class that orchestrates the hooks with the plugin.
101 */
102 public function get_loader() {
103 return $this->loader;
104 }
105
106 /**
107 * Retrieve the version number of the plugin.
108 */
109 public function get_version() {
110 return $this->version;
111 }
112
113 }
114