PluginProbe
Send Users Email – Email Subscribers, Email Marketing Newsletter / 1.5.9
Send Users Email – Email Subscribers, Email Marketing Newsletter v1.5.9
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 1.5.9, at send-users-email.php

137 lines 5.0 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: 1.5.9
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 ) );
52 }
53 return $sue_fs;
54 }
55
56 // Init Freemius.
57 sue_fs();
58 // Signal that SDK was initiated.
59 do_action( 'sue_fs_loaded' );
60 }
61 /**
62 * Currently plugin version.
63 */
64 define( 'SEND_USERS_EMAIL_VERSION', '1.5.9' );
65 /**
66 * Currently plugin base path.
67 */
68 define( 'SEND_USERS_EMAIL_PLUGIN_BASE_PATH', dirname( __FILE__ ) );
69 /**
70 * Currently plugin base path.
71 */
72 define( 'SEND_USERS_EMAIL_PLUGIN_BASE_URL', plugins_url( plugin_basename( SEND_USERS_EMAIL_PLUGIN_BASE_PATH ) ) );
73 /**
74 * Email send capability name
75 */
76 define( 'SEND_USERS_EMAIL_SEND_MAIL_CAPABILITY', 'sue_send_email_capability' );
77 /**
78 * The code that runs during plugin activation.
79 */
80 function activate_send_users_email() {
81 require_once plugin_dir_path( __FILE__ ) . 'includes/class-send-users-email-activator.php';
82 Send_Users_Email_Activator::activate();
83 }
84
85 /**
86 * The code that runs during plugin deactivation.
87 */
88 function deactivate_send_users_email() {
89 require_once plugin_dir_path( __FILE__ ) . 'includes/class-send-users-email-deactivator.php';
90 Send_Users_Email_Deactivator::deactivate();
91 }
92
93 register_activation_hook( __FILE__, 'activate_send_users_email' );
94 register_deactivation_hook( __FILE__, 'deactivate_send_users_email' );
95 /**
96 * The core plugin class that is used to define internationalization,
97 * admin-specific hooks, and public-facing site hooks.
98 */
99 require plugin_dir_path( __FILE__ ) . 'includes/class-send-users-email.php';
100 /**
101 * Begins execution of the plugin.
102 */
103 function run_send_users_email() {
104 $plugin = new Send_Users_Email();
105 $plugin->run();
106 }
107
108 run_send_users_email();
109 /**
110 * Perform Uninstall cleanup and actions
111 */
112 sue_fs()->add_action( 'after_uninstall', 'sue_fs_uninstall_cleanup_action' );
113 function sue_fs_uninstall_cleanup_action() {
114 /**
115 * Perform cleanup
116 */
117 // Delete option created by send users email
118 delete_option( 'sue_send_users_email' );
119 delete_option( 'sue_db_version' );
120 // Remove capability to send email for all roles
121 $all_roles = sue_get_roles();
122 // Remove capability from all roles
123 foreach ( $all_roles as $role_slug ) {
124 $role = get_role( $role_slug );
125 if ( $role ) {
126 $role->remove_cap( SEND_USERS_EMAIL_SEND_MAIL_CAPABILITY );
127 }
128 }
129 // Delete log folder and its files
130 $dirDetails = wp_upload_dir();
131 $uploads_dir = trailingslashit( $dirDetails['basedir'] );
132 if ( file_exists( $uploads_dir . DIRECTORY_SEPARATOR . 'send-users-email' ) ) {
133 unlink( $uploads_dir . DIRECTORY_SEPARATOR . 'send-users-email' );
134 }
135 }
136
137 }