-
Notifications
You must be signed in to change notification settings - Fork 0
/
subscribe2.php
129 lines (114 loc) · 4.6 KB
/
subscribe2.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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
/*
Plugin Name: Subscribe2
Plugin URI: http://subscribe2.wordpress.com
Description: Notifies an email list when new entries are posted.
Version: 10.18.4
Author: Matthew Robinson, Tanay Lakhani
Author URI: http://subscribe2.wordpress.com
Licence: GPL3
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2387904
Text Domain: subscribe2
*/
/*
Copyright (C) 2006-14 Matthew Robinson
Based on the Original Subscribe2 plugin by
Copyright (C) 2005 Scott Merrill ([email protected])
This file is part of Subscribe2.
Subscribe2 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 3 of the License, or
(at your option) any later version.
Subscribe2 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 Subscribe2. If not, see <http://www.gnu.org/licenses/>.
*/
if ( version_compare($GLOBALS['wp_version'], '3.3', '<') || !function_exists( 'add_action' ) ) {
if ( !function_exists( 'add_action' ) ) {
$exit_msg = __("I'm just a plugin, please don't call me directly", 'subscribe2');
} else {
// Subscribe2 needs WordPress 3.3 or above, exit if not on a compatible version
$exit_msg = sprintf(__('This version of Subscribe2 requires WordPress 3.3 or greater. Please update %1$s or use an older version of %2$s.', 'subscribe2'), '<a href="http://codex.wordpress.org/Updating_WordPress">Wordpress</a>', '<a href="http://wordpress.org/extend/plugins/subscribe2/download/">Subscribe2</a>');
}
exit($exit_msg);
}
// stop Subscribe2 being activated site wide on Multisite installs
if ( !function_exists( 'is_plugin_active_for_network' ) ) {
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
}
if ( is_plugin_active_for_network(plugin_basename(__FILE__)) ) {
deactivate_plugins( plugin_basename(__FILE__) );
$exit_msg = __('Subscribe2 cannot be activated as a network plugin. Please activate it on a site level', 'subscribe2');
exit($exit_msg);
}
// our version number. Don't touch this or any line below
// unless you know exactly what you are doing
define( 'S2VERSION', '10.18.4' );
define( 'S2PATH', trailingslashit(dirname(__FILE__)) );
define( 'S2DIR', trailingslashit(dirname(plugin_basename(__FILE__))) );
define( 'S2URL', plugin_dir_url(dirname(__FILE__)) . S2DIR );
// Set maximum execution time to 5 minutes - won't affect safe mode
$safe_mode = array('On', 'ON', 'on', 1);
if ( !in_array(ini_get('safe_mode'), $safe_mode) && ini_get('max_execution_time') < 300 ) {
@ini_set('max_execution_time', 300);
}
require_once( S2PATH . 'classes/class-s2-core.php' );
if ( is_admin() ) {
require_once( S2PATH . 'classes/class-s2-admin.php' );
global $mysubscribe2;
$mysubscribe2 = new s2_admin;
$mysubscribe2->s2init();
} else {
require_once( S2PATH . 'classes/class-s2-frontend.php' );
global $mysubscribe2;
$mysubscribe2 = new s2_frontend;
$mysubscribe2->s2init();
}
function s2_install() {
add_option('readygraph_tutorial', 'true');
add_option('rg_s2_plugin_do_activation_redirect', true);
}
if( file_exists(plugin_dir_path( __FILE__ ).'/readygraph-extension.php' )) {
include "readygraph-extension.php";
}
else {
}
register_activation_hook(__FILE__, 's2_install');
function s2_rrmdir($dir) {
if (is_dir($dir)) {
$objects = scandir($dir);
foreach ($objects as $object) {
if ($object != "." && $object != "..") {
if (filetype($dir."/".$object) == "dir")
s2_rrmdir($dir."/".$object);
else unlink ($dir."/".$object);
}
}
reset($objects);
rmdir($dir);
}
$del_url = plugin_dir_path( __FILE__ );
unlink($del_url.'/readygraph-extension.php');
$setting_url="admin.php?page=s2";
echo'<script> window.location="'.admin_url($setting_url).'"; </script> ';
}
function s2_delete_rg_options() {
delete_option('readygraph_access_token');
delete_option('readygraph_application_id');
delete_option('readygraph_refresh_token');
delete_option('readygraph_email');
delete_option('readygraph_settings');
delete_option('readygraph_delay');
delete_option('readygraph_enable_sidebar');
delete_option('readygraph_auto_select_all');
delete_option('readygraph_enable_notification');
delete_option('readygraph_enable_branding');
delete_option('readygraph_send_blog_updates');
delete_option('readygraph_send_real_time_post_updates');
delete_option('readygraph_popup_template');
delete_option('readygraph_upgrade_notice');
}
?>