-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathad-rotate-email-addon.php
113 lines (92 loc) · 3.6 KB
/
ad-rotate-email-addon.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<?php
/**
* Plugin Name: AdRotater Email Add-on
* Plugin URI: http://xylusthemes.com/
* Description: This is a add-on plugin for Add Rotate, this Plugin has functionality to send Emails to Advertisers.
* Version: 1.0.3
* Author: Xylus Themes
* Author URI: http://xylusthemes.com/
* License: GPLv2 or later
* Text Domain: add-rotate-email-addon
* Domain Path: /languages
*/
/*
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
/**
* The code that runs during plugin activation.
*/
require_once plugin_dir_path( __FILE__ ) . 'includes/class-ad-rotate-email-addon-activator.php';
/**
* The code that runs during plugin deactivation.
*/
require_once plugin_dir_path( __FILE__ ) . 'includes/class-ad-rotate-email-addon-deactivator.php';
/**
* The code that required for sending E-Mails.
*/
require_once plugin_dir_path( __FILE__ ) . 'includes/class-ad-rotate-email-addon-send-email.php';
/** This action is documented in includes/class-plugin-name-activator.php */
register_activation_hook( __FILE__, array( 'Ad_Rotate_Email_Addon_Activator', 'activate' ) );
/** This action is documented in includes/class-plugin-name-deactivator.php */
register_deactivation_hook( __FILE__, array( 'Ad_Rotate_Email_Addon_Deactivator', 'deactivate' ) );
/**
* The core plugin class that is used to define internationalization,
* dashboard-specific hooks, and public-facing site hooks.
*/
require_once plugin_dir_path( __FILE__ ) . 'includes/class-ad-rotate-email-addon.php';
add_action( 'plugins_loaded', 'dsp_self_deactivate');
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
if(is_plugin_active("adrotate/adrotate.php")){
add_action('admin_menu',array('Ad_Rotate_Email_Addon_Admin','dsp_wordpress_dashboard'),100);
add_action('admin_init',array('Ad_Rotate_Email_Addon_Admin','dsp_enable_option'));
}
/**
* If dependency requirements are not satisfied, self-deactivate
*/
function dsp_self_deactivate() {
if(!is_plugin_active("adrotate/adrotate.php") && !is_plugin_active("adrotate-pro/adrotate.php")){
require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
deactivate_plugins( plugin_basename( __FILE__ ) );
add_action( 'admin_notices','self_deactivate_notice');
}
}
/**
* Display an error message when the plugin deactivates itself.
*/
function self_deactivate_notice() {
?>
<div class="error">
<p>
<?php _e("AdRotate Email Add-on has deactivated itself because AdRotate is no longer active","add-rotate-email-addon");?>
</p>
</div>
<?php
}
/**
* Begins execution of the plugin.
*
* Since everything within the plugin is registered via hooks,
* then kicking off the plugin from this point in the file does
* not affect the page life cycle.
*
* @since 1.0.0
*/
function run_ad_rotate_email_addon() {
$plugin = new Ad_Rotate_Email_Addon();
$plugin->run();
}
run_ad_rotate_email_addon();