PluginProbe
Send Users Email – Email Subscribers, Email Marketing Newsletter / 2.0.1
Send Users Email – Email Subscribers, Email Marketing Newsletter v2.0.1
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 / send-users-email.php

send-users-email.php in Send Users Email – Email Subscribers, Email Marketing Newsletter 2.0.1, at send-users-email.php

150 lines 5.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Plugin Name: Send Users Email
5 * Plugin URI: https://sendusersemail.com/
6 * Description: Easily send emails to your users. Select individual users or role to send email.
7 * Version: 2.0.1
8 * Author: SendUsersEmail.com
9 * Author URI: https://sendusersemail.com/?utm_source=wp_repo&utm_medium=link&utm_campaign=author_url
10 * License: GPL-2.0+
11 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt
12 * Text Domain: send-users-email
13 * Domain Path: /languages
14 *
15 */
16 // If this file is called directly, abort.
17 if ( !defined( 'WPINC' ) ) {
18 die;
19 }
20 if ( function_exists( 'sue_fs' ) ) {
21 sue_fs()->set_basename( false, __FILE__ );
22 } else {
23 // DO NOT REMOVE THIS IF, IT IS ESSENTIAL FOR THE `function_exists` CALL ABOVE TO PROPERLY WORK.
24 if ( !function_exists( 'sue_fs' ) ) {
25 // Create a helper function for easy SDK access.
26 function sue_fs() {
27 global $sue_fs;
28 if ( !isset( $sue_fs ) ) {
29 // Include Freemius SDK.
30 require_once dirname( __FILE__ ) . '/vendor/freemius/start.php';
31 $sue_fs = fs_dynamic_init( array(
32 'id' => '11436',
33 'slug' => 'send-users-email',
34 'premium_slug' => 'send-users-email-pro',
35 'type' => 'plugin',
36 'public_key' => 'pk_29ad05bfbd6008f9c20e155704ec0',
37 'is_premium' => false,
38 'premium_suffix' => 'PRO',
39 'has_addons' => false,
40 'has_paid_plans' => true,
41 'trial' => array(
42 'days' => 14,
43 'is_require_payment' => true,
44 ),
45 'menu' => array(
46 'slug' => 'send-users-email',
47 'support' => false,
48 'contact' => false,
49 ),
50 'is_live' => true,
51 'is_org_compliant' => true,
52 ) );
53 }
54 return $sue_fs;
55 }
56
57 // Init Freemius.
58 sue_fs();
59 // Signal that SDK was initiated.
60 do_action( 'sue_fs_loaded' );
61 }
62 /**
63 * Currently plugin version.
64 */
65 define( 'SEND_USERS_EMAIL_VERSION', '2.0.1' );
66 /**
67 * Currently plugin base path.
68 */
69 define( 'SEND_USERS_EMAIL_PLUGIN_BASE_PATH', dirname( __FILE__ ) );
70 /**
71 * Currently plugin base path.
72 */
73 define( 'SEND_USERS_EMAIL_PLUGIN_BASE_URL', plugins_url( plugin_basename( SEND_USERS_EMAIL_PLUGIN_BASE_PATH ) ) );
74 /**
75 * Email send capability name
76 */
77 define( 'SEND_USERS_EMAIL_SEND_MAIL_CAPABILITY', 'sue_send_email_capability' );
78 /**
79 * Summary of sue_get_plugin_dir
80 *
81 */
82 function sue_get_plugin_dir() {
83 return plugin_dir_path( __FILE__ );
84 }
85
86 function sue_get_plugin_url() {
87 return plugins_url( plugin_basename( SEND_USERS_EMAIL_PLUGIN_BASE_PATH ) );
88 }
89
90 /**
91 * The code that runs during plugin activation.
92 */
93 function activate_send_users_email() {
94 require_once plugin_dir_path( __FILE__ ) . 'includes/class-send-users-email-activator.php';
95 Send_Users_Email_Activator::activate();
96 }
97
98 /**
99 * The code that runs during plugin deactivation.
100 */
101 function deactivate_send_users_email() {
102 require_once plugin_dir_path( __FILE__ ) . 'includes/class-send-users-email-deactivator.php';
103 Send_Users_Email_Deactivator::deactivate();
104 }
105
106 register_activation_hook( __FILE__, 'activate_send_users_email' );
107 register_deactivation_hook( __FILE__, 'deactivate_send_users_email' );
108 /**
109 * The core plugin class that is used to define internationalization,
110 * admin-specific hooks, and public-facing site hooks.
111 */
112 require plugin_dir_path( __FILE__ ) . 'includes/class-send-users-email.php';
113 /**
114 * Begins execution of the plugin.
115 */
116 function run_send_users_email() {
117 $plugin = new Send_Users_Email();
118 $plugin->run();
119 }
120
121 run_send_users_email();
122 /**
123 * Perform Uninstall cleanup and actions
124 */
125 sue_fs()->add_action( 'after_uninstall', 'sue_fs_uninstall_cleanup_action' );
126 function sue_fs_uninstall_cleanup_action() {
127 /**
128 * Perform cleanup
129 */
130 // Delete option created by send users email
131 delete_option( 'sue_send_users_email' );
132 delete_option( 'sue_db_version' );
133 // Remove capability to send email for all roles
134 $all_roles = sue_get_roles();
135 // Remove capability from all roles
136 foreach ( $all_roles as $role_slug ) {
137 $role = get_role( $role_slug );
138 if ( $role ) {
139 $role->remove_cap( SEND_USERS_EMAIL_SEND_MAIL_CAPABILITY );
140 }
141 }
142 // Delete log folder and its files
143 $dirDetails = wp_upload_dir();
144 $uploads_dir = trailingslashit( $dirDetails['basedir'] );
145 if ( file_exists( $uploads_dir . DIRECTORY_SEPARATOR . 'send-users-email' ) ) {
146 unlink( $uploads_dir . DIRECTORY_SEPARATOR . 'send-users-email' );
147 }
148 }
149
150 }