Version Description
Download this release
Release Info
Developer | MattyRob |
Plugin | Subscribe2 |
Version | 8.8 |
Comparing to | |
See all releases |
Code changes from version 8.7 to 8.8
- ChangeLog.txt +14 -0
- ReadMe.txt +3 -3
- admin/settings.php +1 -1
- admin/subscribers.php +1 -1
- admin/your_subscriptions.php +1 -1
- classes/class-s2-core.php +39 -8
- classes/class-s2-list-table.php +105 -16
- classes/class-s2-multisite.php +2 -2
- classes/class-s2-upgrade.php +23 -1
- subscribe2.php +15 -4
- subscribe2.pot +29 -19
- uninstall.php +43 -21
ChangeLog.txt
CHANGED
@@ -1,3 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
= Version 8.7 by Matthew Robinson =
|
2 |
|
3 |
* Enabled {TITLE} as a keyword in URL Tracking in free version
|
1 |
+
= Version 8.8 by Matthew Robinson =
|
2 |
+
|
3 |
+
* Added ability to filter both excerpt_length and word_wrap
|
4 |
+
* Added code to stop site wide activation on Multisite installs
|
5 |
+
* Added code to fix compatibility issues with Autoblog plugin - thanks to Kevin Waite and Andy Stratton
|
6 |
+
* Fixed digit entry in pagination section on Registeres tab in Subscribe2->Subscribers
|
7 |
+
* Removed ID from a string in the Settings page as it was confusing
|
8 |
+
* Enhanced Compulsory Category code to ensure that Registered Users all get notifications for such categories despite their current personal settings
|
9 |
+
* Improved Pagination when the Filter is changed on the Subscribe2->Subscribers page
|
10 |
+
* Use $wpdb->prefix in preference to $table_prefix
|
11 |
+
* Improve functionality of the uninstall script on Multisite installs
|
12 |
+
* Fixed glitch in upgrade85 code that failed to add a new database column when called
|
13 |
+
* Sort subscribers into alphabetical order irrespective of case - thanks to mharpen
|
14 |
+
|
15 |
= Version 8.7 by Matthew Robinson =
|
16 |
|
17 |
* Enabled {TITLE} as a keyword in URL Tracking in free version
|
ReadMe.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: MattyRob, Skippy, RavanH
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2387904
|
4 |
Tags: posts, subscription, email, subscribe, notify, notification
|
5 |
Requires at least: 3.1
|
6 |
-
Tested up to: 3.5
|
7 |
-
Stable tag: 8.
|
8 |
License: GPL3
|
9 |
|
10 |
Sends a list of subscribers an email notification when new posts are published to your blog
|
@@ -199,7 +199,7 @@ But it also has advanced options, which are related to form. The default form co
|
|
199 |
|
200 |
If you use the shortcode [subscribe2 hide="subscribe"] then the button for subscribing will be hidden and similarly if you use [subscribe2 hide="unsubscribe"], only button for subscribing will be shown.
|
201 |
|
202 |
-
The new shortcode also accepts two further attributes, these are **id** and **url**. To understand these parameters you need to understand that Subscribe2 returns a user to the default WordPress Page on your site where you use the shortcode or token however in some circumstances you may
|
203 |
|
204 |
There are many scenarios in which to use new options, but here is an example:
|
205 |
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2387904
|
4 |
Tags: posts, subscription, email, subscribe, notify, notification
|
5 |
Requires at least: 3.1
|
6 |
+
Tested up to: 3.5.1
|
7 |
+
Stable tag: 8.8
|
8 |
License: GPL3
|
9 |
|
10 |
Sends a list of subscribers an email notification when new posts are published to your blog
|
199 |
|
200 |
If you use the shortcode [subscribe2 hide="subscribe"] then the button for subscribing will be hidden and similarly if you use [subscribe2 hide="unsubscribe"], only button for subscribing will be shown.
|
201 |
|
202 |
+
The new shortcode also accepts two further attributes, these are **id** and **url**. To understand these parameters you need to understand that Subscribe2 returns a user to the default WordPress Page on your site where you use the shortcode or token however in some circumstances you may want to override this behaviour. If you specify a WordPress page id using the id parameter or a full URL using the url parameter then the user would be returned to the alternative page.
|
203 |
|
204 |
There are many scenarios in which to use new options, but here is an example:
|
205 |
|
admin/settings.php
CHANGED
@@ -386,7 +386,7 @@ switch ($current_tab) {
|
|
386 |
echo "<p>\r\n";
|
387 |
|
388 |
// WordPress page ID where subscribe2 token is used
|
389 |
-
echo __('Set default Subscribe2 page as
|
390 |
echo "<select name=\"s2page\">\r\n";
|
391 |
$this->pages_dropdown($this->subscribe2_options['s2page']);
|
392 |
echo "</select>\r\n";
|
386 |
echo "<p>\r\n";
|
387 |
|
388 |
// WordPress page ID where subscribe2 token is used
|
389 |
+
echo __('Set default Subscribe2 page as', 'subscribe2') . ': ';
|
390 |
echo "<select name=\"s2page\">\r\n";
|
391 |
$this->pages_dropdown($this->subscribe2_options['s2page']);
|
392 |
echo "</select>\r\n";
|
admin/subscribers.php
CHANGED
@@ -178,7 +178,7 @@ switch ($current_tab) {
|
|
178 |
case 'registered':
|
179 |
echo "<div class=\"s2_admin\" id=\"s2_add_subscribers\">\r\n";
|
180 |
echo "<h2>" . __('Add/Remove Subscribers', 'subscribe2') . "</h2>\r\n";
|
181 |
-
echo "<p class=\"submit\" style=\"border-top: none;\"><input type=\"
|
182 |
|
183 |
echo "</div>\r\n";
|
184 |
|
178 |
case 'registered':
|
179 |
echo "<div class=\"s2_admin\" id=\"s2_add_subscribers\">\r\n";
|
180 |
echo "<h2>" . __('Add/Remove Subscribers', 'subscribe2') . "</h2>\r\n";
|
181 |
+
echo "<p class=\"submit\" style=\"border-top: none;\"><input type=\"button\" class=\"button-primary\" name=\"add_user\" value=\"" . __('Add Registered User', 'subscribe2') . "\" formaction=\"" . admin_url() . "user-new.php\" /></p>\r\n";
|
182 |
|
183 |
echo "</div>\r\n";
|
184 |
|
admin/your_subscriptions.php
CHANGED
@@ -43,7 +43,7 @@ if ( isset($_POST['s2_admin']) && 'user' == $_POST['s2_admin'] ) {
|
|
43 |
delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $cat);
|
44 |
}
|
45 |
}
|
46 |
-
|
47 |
} elseif ( $cats == 'digest' ) {
|
48 |
$all_cats = $this->all_cats(false, 'ID');
|
49 |
foreach ( $all_cats as $cat ) {
|
43 |
delete_user_meta($user_ID, $this->get_usermeta_keyname('s2_cat') . $cat);
|
44 |
}
|
45 |
}
|
46 |
+
update_user_meta($user_ID, $this->get_usermeta_keyname('s2_subscribed'), '');
|
47 |
} elseif ( $cats == 'digest' ) {
|
48 |
$all_cats = $this->all_cats(false, 'ID');
|
49 |
foreach ( $all_cats as $cat ) {
|
classes/class-s2-core.php
CHANGED
@@ -77,8 +77,8 @@ class s2class {
|
|
77 |
email varchar(64) NOT NULL default '',
|
78 |
active tinyint(1) default 0,
|
79 |
date DATE default '$date' NOT NULL,
|
80 |
-
ip char(64) NOT NULL default 'admin',
|
81 |
time TIME DEFAULT '00:00:00' NOT NULL,
|
|
|
82 |
conf_date DATE,
|
83 |
conf_time TIME,
|
84 |
conf_ip char(64),
|
@@ -146,6 +146,9 @@ class s2class {
|
|
146 |
if ( version_compare($this->subscribe2_options['version'], '8.6', '<') ) {
|
147 |
$s2_upgrade->upgrade86();
|
148 |
}
|
|
|
|
|
|
|
149 |
|
150 |
$this->subscribe2_options['version'] = S2VERSION;
|
151 |
update_option('subscribe2_options', $this->subscribe2_options);
|
@@ -161,7 +164,7 @@ class s2class {
|
|
161 |
wp_clear_scheduled_hook('s2_digest_cron');
|
162 |
unset($this->subscribe2_options);
|
163 |
require(S2PATH . "include/options.php");
|
164 |
-
|
165 |
} // end reset()
|
166 |
|
167 |
/* ===== mail handling ===== */
|
@@ -372,7 +375,7 @@ class s2class {
|
|
372 |
function publish($post, $preview = '') {
|
373 |
if ( !$post ) { return $post; }
|
374 |
|
375 |
-
if ( $this->s2_mu ) {
|
376 |
global $switched;
|
377 |
if ( $switched ) { return; }
|
378 |
}
|
@@ -437,6 +440,7 @@ class s2class {
|
|
437 |
}
|
438 |
|
439 |
// lets collect our subscribers
|
|
|
440 |
if ( !$check ) {
|
441 |
// if this post is assigned to an excluded
|
442 |
// category, or is a private post then
|
@@ -926,6 +930,14 @@ class s2class {
|
|
926 |
if ( !isset($r['author']) )
|
927 |
$r['author'] = '';
|
928 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
929 |
$JOIN = ''; $AND = '';
|
930 |
// text or HTML subscribers
|
931 |
if ( 'all' != $r['format'] ) {
|
@@ -982,7 +994,7 @@ class s2class {
|
|
982 |
function sanitize_email($email) {
|
983 |
if ( !is_email($email) ) { return; }
|
984 |
|
985 |
-
// ensure that domain is in lowercase as per internet email standards
|
986 |
list($name, $domain) = explode('@', $email, 2);
|
987 |
return $name . "@" . strtolower($domain);
|
988 |
} // end sanitize_email()
|
@@ -1596,7 +1608,7 @@ class s2class {
|
|
1596 |
Subscribe2 constructor
|
1597 |
*/
|
1598 |
function s2init() {
|
1599 |
-
global $wpdb, $
|
1600 |
// load the options
|
1601 |
$this->subscribe2_options = get_option('subscribe2_options');
|
1602 |
// if SCRIPT_DEBUG is true, use dev scripts
|
@@ -1629,7 +1641,7 @@ class s2class {
|
|
1629 |
add_action('init', array(&$this, 'load_strings'));
|
1630 |
|
1631 |
// do we need to install anything?
|
1632 |
-
$this->public = $
|
1633 |
if ( $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE %s", $this->public)) != $this->public ) { $this->install(); }
|
1634 |
//do we need to upgrade anything?
|
1635 |
if ( $this->subscribe2_options === false || is_array($this->subscribe2_options) && $this->subscribe2_options['version'] !== S2VERSION ) {
|
@@ -1754,6 +1766,24 @@ class s2class {
|
|
1754 |
}
|
1755 |
} // end s2init()
|
1756 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1757 |
/* ===== our variables ===== */
|
1758 |
// cache variables
|
1759 |
var $subscribe2_options = array();
|
@@ -1782,8 +1812,9 @@ class s2class {
|
|
1782 |
var $action = '';
|
1783 |
var $email = '';
|
1784 |
var $message = '';
|
1785 |
-
var $word_wrap
|
1786 |
-
var $excerpt_length
|
|
|
1787 |
|
1788 |
// some messages
|
1789 |
var $please_log_in = '';
|
77 |
email varchar(64) NOT NULL default '',
|
78 |
active tinyint(1) default 0,
|
79 |
date DATE default '$date' NOT NULL,
|
|
|
80 |
time TIME DEFAULT '00:00:00' NOT NULL,
|
81 |
+
ip char(64) NOT NULL default 'admin',
|
82 |
conf_date DATE,
|
83 |
conf_time TIME,
|
84 |
conf_ip char(64),
|
146 |
if ( version_compare($this->subscribe2_options['version'], '8.6', '<') ) {
|
147 |
$s2_upgrade->upgrade86();
|
148 |
}
|
149 |
+
if ( version_compare($this->subscribe2_options['version'], '8.8', '<') ) {
|
150 |
+
$s2_upgrade->upgrade88();
|
151 |
+
}
|
152 |
|
153 |
$this->subscribe2_options['version'] = S2VERSION;
|
154 |
update_option('subscribe2_options', $this->subscribe2_options);
|
164 |
wp_clear_scheduled_hook('s2_digest_cron');
|
165 |
unset($this->subscribe2_options);
|
166 |
require(S2PATH . "include/options.php");
|
167 |
+
add_option('subscribe2_options', $this->subscribe2_options, '', 'no');
|
168 |
} // end reset()
|
169 |
|
170 |
/* ===== mail handling ===== */
|
375 |
function publish($post, $preview = '') {
|
376 |
if ( !$post ) { return $post; }
|
377 |
|
378 |
+
if ( $this->s2_mu && !apply_filters('s2_allow_site_switching', $this->site_switching) ) {
|
379 |
global $switched;
|
380 |
if ( $switched ) { return; }
|
381 |
}
|
440 |
}
|
441 |
|
442 |
// lets collect our subscribers
|
443 |
+
$public = array();
|
444 |
if ( !$check ) {
|
445 |
// if this post is assigned to an excluded
|
446 |
// category, or is a private post then
|
930 |
if ( !isset($r['author']) )
|
931 |
$r['author'] = '';
|
932 |
|
933 |
+
// collect all subscribers for compulsory categories
|
934 |
+
$compulsory = explode(',', $this->subscribe2_options['compulsory']);
|
935 |
+
foreach ( explode(',', $r['cats']) as $cat ) {
|
936 |
+
if ( in_array($cat, $compulsory) ) {
|
937 |
+
$r['cats'] = '';
|
938 |
+
}
|
939 |
+
}
|
940 |
+
|
941 |
$JOIN = ''; $AND = '';
|
942 |
// text or HTML subscribers
|
943 |
if ( 'all' != $r['format'] ) {
|
994 |
function sanitize_email($email) {
|
995 |
if ( !is_email($email) ) { return; }
|
996 |
|
997 |
+
// ensure that domain is in lowercase as per internet email standards http://www.ietf.org/rfc/rfc5321.txt
|
998 |
list($name, $domain) = explode('@', $email, 2);
|
999 |
return $name . "@" . strtolower($domain);
|
1000 |
} // end sanitize_email()
|
1608 |
Subscribe2 constructor
|
1609 |
*/
|
1610 |
function s2init() {
|
1611 |
+
global $wpdb, $wp_version, $wpmu_version;
|
1612 |
// load the options
|
1613 |
$this->subscribe2_options = get_option('subscribe2_options');
|
1614 |
// if SCRIPT_DEBUG is true, use dev scripts
|
1641 |
add_action('init', array(&$this, 'load_strings'));
|
1642 |
|
1643 |
// do we need to install anything?
|
1644 |
+
$this->public = $wpdb->prefix . "subscribe2";
|
1645 |
if ( $wpdb->get_var($wpdb->prepare("SHOW TABLES LIKE %s", $this->public)) != $this->public ) { $this->install(); }
|
1646 |
//do we need to upgrade anything?
|
1647 |
if ( $this->subscribe2_options === false || is_array($this->subscribe2_options) && $this->subscribe2_options['version'] !== S2VERSION ) {
|
1766 |
}
|
1767 |
} // end s2init()
|
1768 |
|
1769 |
+
/**
|
1770 |
+
PHP4 Constructor
|
1771 |
+
Can be erased when support for WordPress 3.1 is dropped
|
1772 |
+
*/
|
1773 |
+
function s2class() {
|
1774 |
+
$this->__construct();
|
1775 |
+
} // end s2class()
|
1776 |
+
|
1777 |
+
/**
|
1778 |
+
PHP5 Constructor
|
1779 |
+
Allows dynamic variable setting
|
1780 |
+
*/
|
1781 |
+
function __construct() {
|
1782 |
+
$this->word_wrap = apply_filters('s2_word_wrap', 80);
|
1783 |
+
$this->excerpt_length = apply_filters('s2_excerpt_length', 55);
|
1784 |
+
$this->site_switching = apply_filters('s2_allow_site_switching', false);
|
1785 |
+
} // end __construct()
|
1786 |
+
|
1787 |
/* ===== our variables ===== */
|
1788 |
// cache variables
|
1789 |
var $subscribe2_options = array();
|
1812 |
var $action = '';
|
1813 |
var $email = '';
|
1814 |
var $message = '';
|
1815 |
+
var $word_wrap;
|
1816 |
+
var $excerpt_length;
|
1817 |
+
var $site_switching;
|
1818 |
|
1819 |
// some messages
|
1820 |
var $please_log_in = '';
|
classes/class-s2-list-table.php
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
<?php
|
2 |
class Subscribe2_List_Table extends WP_List_Table {
|
3 |
-
function __construct(){
|
4 |
global $status, $page;
|
5 |
|
6 |
parent::__construct( array(
|
@@ -10,17 +10,17 @@ class Subscribe2_List_Table extends WP_List_Table {
|
|
10 |
) );
|
11 |
}
|
12 |
|
13 |
-
function column_default($item, $column_name){
|
14 |
global $current_tab;
|
15 |
if ( $current_tab == 'registered' ) {
|
16 |
-
switch($column_name){
|
17 |
case 'email':
|
18 |
return $item[$column_name];
|
19 |
default:
|
20 |
return print_r($item,true);
|
21 |
}
|
22 |
} else {
|
23 |
-
switch($column_name){
|
24 |
case 'email':
|
25 |
case 'date':
|
26 |
return $item[$column_name];
|
@@ -30,7 +30,7 @@ class Subscribe2_List_Table extends WP_List_Table {
|
|
30 |
}
|
31 |
}
|
32 |
|
33 |
-
function column_email($item){
|
34 |
global $current_tab;
|
35 |
if ( $current_tab == 'registered' ) {
|
36 |
$actions = array('edit' => sprintf('<a href="?page=%s&email=%s">Edit</a>', 's2', $item['email']));
|
@@ -45,11 +45,11 @@ class Subscribe2_List_Table extends WP_List_Table {
|
|
45 |
}
|
46 |
}
|
47 |
|
48 |
-
function column_cb($item){
|
49 |
return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_args['singular'], $item['email']);
|
50 |
}
|
51 |
|
52 |
-
function get_columns(){
|
53 |
global $current_tab;
|
54 |
if ( $current_tab == 'registered' ) {
|
55 |
$columns = array('email' => 'Email');
|
@@ -89,9 +89,95 @@ class Subscribe2_List_Table extends WP_List_Table {
|
|
89 |
}
|
90 |
}
|
91 |
|
92 |
-
function
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
if ( is_int($mysubscribe2->subscribe2_options['entries']) ) {
|
96 |
$per_page = $mysubscribe2->subscribe2_options['entries'];
|
97 |
} else {
|
@@ -103,7 +189,6 @@ class Subscribe2_List_Table extends WP_List_Table {
|
|
103 |
$sortable = $this->get_sortable_columns();
|
104 |
$this->_column_headers = array($columns, $hidden, $sortable);
|
105 |
|
106 |
-
global $mysubscribe2, $subscribers, $current_tab;
|
107 |
$data = array();
|
108 |
if ( $current_tab == 'public' ) {
|
109 |
foreach($subscribers as $email) {
|
@@ -115,18 +200,22 @@ class Subscribe2_List_Table extends WP_List_Table {
|
|
115 |
}
|
116 |
}
|
117 |
|
118 |
-
function usort_reorder($a,$b){
|
119 |
$orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'email';
|
120 |
$order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc';
|
121 |
-
$result =
|
122 |
return ($order==='asc') ? $result : -$result;
|
123 |
}
|
124 |
usort($data, 'usort_reorder');
|
125 |
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
|
|
|
|
|
|
|
|
130 |
|
131 |
$this->set_pagination_args( array(
|
132 |
'total_items' => $total_items,
|
1 |
<?php
|
2 |
class Subscribe2_List_Table extends WP_List_Table {
|
3 |
+
function __construct() {
|
4 |
global $status, $page;
|
5 |
|
6 |
parent::__construct( array(
|
10 |
) );
|
11 |
}
|
12 |
|
13 |
+
function column_default($item, $column_name) {
|
14 |
global $current_tab;
|
15 |
if ( $current_tab == 'registered' ) {
|
16 |
+
switch($column_name) {
|
17 |
case 'email':
|
18 |
return $item[$column_name];
|
19 |
default:
|
20 |
return print_r($item,true);
|
21 |
}
|
22 |
} else {
|
23 |
+
switch($column_name) {
|
24 |
case 'email':
|
25 |
case 'date':
|
26 |
return $item[$column_name];
|
30 |
}
|
31 |
}
|
32 |
|
33 |
+
function column_email($item) {
|
34 |
global $current_tab;
|
35 |
if ( $current_tab == 'registered' ) {
|
36 |
$actions = array('edit' => sprintf('<a href="?page=%s&email=%s">Edit</a>', 's2', $item['email']));
|
45 |
}
|
46 |
}
|
47 |
|
48 |
+
function column_cb($item) {
|
49 |
return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_args['singular'], $item['email']);
|
50 |
}
|
51 |
|
52 |
+
function get_columns() {
|
53 |
global $current_tab;
|
54 |
if ( $current_tab == 'registered' ) {
|
55 |
$columns = array('email' => 'Email');
|
89 |
}
|
90 |
}
|
91 |
|
92 |
+
function pagination( $which ) {
|
93 |
+
if ( empty( $this->_pagination_args ) )
|
94 |
+
return;
|
95 |
+
|
96 |
+
extract( $this->_pagination_args, EXTR_SKIP );
|
97 |
+
|
98 |
+
$output = '<span class="displaying-num">' . sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . '</span>';
|
99 |
+
|
100 |
+
if ( isset($_POST['what']) ) {
|
101 |
+
$current = 1;
|
102 |
+
} else {
|
103 |
+
$current = $this->get_pagenum();
|
104 |
+
}
|
105 |
+
|
106 |
+
$current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
|
107 |
+
|
108 |
+
$current_url = remove_query_arg( array('hotkeys_highlight_last', 'hotkeys_highlight_first'), $current_url );
|
109 |
|
110 |
+
if ( isset($what) ) {
|
111 |
+
$current_url = add_query_arg( array('what' => $what), $current_url );
|
112 |
+
} elseif ( isset($_REQUEST['what']) ) {
|
113 |
+
$current_url = add_query_arg( array('what' => $_REQUEST['what']), $current_url );
|
114 |
+
}
|
115 |
+
|
116 |
+
$page_links = array();
|
117 |
+
|
118 |
+
$disable_first = $disable_last = '';
|
119 |
+
if ( $current == 1 )
|
120 |
+
$disable_first = ' disabled';
|
121 |
+
if ( $current == $total_pages )
|
122 |
+
$disable_last = ' disabled';
|
123 |
+
|
124 |
+
$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
|
125 |
+
'first-page' . $disable_first,
|
126 |
+
esc_attr__( 'Go to the first page' ),
|
127 |
+
esc_url( remove_query_arg( 'paged', $current_url ) ),
|
128 |
+
'«'
|
129 |
+
);
|
130 |
+
|
131 |
+
$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
|
132 |
+
'prev-page' . $disable_first,
|
133 |
+
esc_attr__( 'Go to the previous page' ),
|
134 |
+
esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ),
|
135 |
+
'‹'
|
136 |
+
);
|
137 |
+
|
138 |
+
if ( 'bottom' == $which )
|
139 |
+
$html_current_page = $current;
|
140 |
+
else
|
141 |
+
$html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name='paged' value='%s' size='%d' />",
|
142 |
+
esc_attr__( 'Current page' ),
|
143 |
+
$current,
|
144 |
+
strlen( $total_pages )
|
145 |
+
);
|
146 |
+
|
147 |
+
$html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
|
148 |
+
$page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . '</span>';
|
149 |
+
|
150 |
+
$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
|
151 |
+
'next-page' . $disable_last,
|
152 |
+
esc_attr__( 'Go to the next page' ),
|
153 |
+
esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ),
|
154 |
+
'›'
|
155 |
+
);
|
156 |
+
|
157 |
+
$page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
|
158 |
+
'last-page' . $disable_last,
|
159 |
+
esc_attr__( 'Go to the last page' ),
|
160 |
+
esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
|
161 |
+
'»'
|
162 |
+
);
|
163 |
+
|
164 |
+
$pagination_links_class = 'pagination-links';
|
165 |
+
if ( ! empty( $infinite_scroll ) )
|
166 |
+
$pagination_links_class = ' hide-if-js';
|
167 |
+
$output .= "\n<span class='$pagination_links_class'>" . join( "\n", $page_links ) . '</span>';
|
168 |
+
|
169 |
+
if ( $total_pages )
|
170 |
+
$page_class = $total_pages < 2 ? ' one-page' : '';
|
171 |
+
else
|
172 |
+
$page_class = ' no-pages';
|
173 |
+
|
174 |
+
$this->_pagination = "<div class='tablenav-pages{$page_class}'>$output</div>";
|
175 |
+
|
176 |
+
echo $this->_pagination;
|
177 |
+
}
|
178 |
+
|
179 |
+
function prepare_items() {
|
180 |
+
global $mysubscribe2, $subscribers, $current_tab;
|
181 |
if ( is_int($mysubscribe2->subscribe2_options['entries']) ) {
|
182 |
$per_page = $mysubscribe2->subscribe2_options['entries'];
|
183 |
} else {
|
189 |
$sortable = $this->get_sortable_columns();
|
190 |
$this->_column_headers = array($columns, $hidden, $sortable);
|
191 |
|
|
|
192 |
$data = array();
|
193 |
if ( $current_tab == 'public' ) {
|
194 |
foreach($subscribers as $email) {
|
200 |
}
|
201 |
}
|
202 |
|
203 |
+
function usort_reorder($a,$b) {
|
204 |
$orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'email';
|
205 |
$order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc';
|
206 |
+
$result = strcasecmp($a[$orderby], $b[$orderby]);
|
207 |
return ($order==='asc') ? $result : -$result;
|
208 |
}
|
209 |
usort($data, 'usort_reorder');
|
210 |
|
211 |
+
if ( isset($_POST['what']) ) {
|
212 |
+
$current_page = 1;
|
213 |
+
} else {
|
214 |
+
$current_page = $this->get_pagenum();
|
215 |
+
}
|
216 |
+
$total_items = count($data);
|
217 |
+
$data = array_slice($data,(($current_page-1)*$per_page),$per_page);
|
218 |
+
$this->items = $data;
|
219 |
|
220 |
$this->set_pagination_args( array(
|
221 |
'total_items' => $total_items,
|
classes/class-s2-multisite.php
CHANGED
@@ -97,7 +97,7 @@ class s2_multisite {
|
|
97 |
$blog_list[$details['blog_id']] = $details;
|
98 |
}
|
99 |
|
100 |
-
if (
|
101 |
return array();
|
102 |
}
|
103 |
|
@@ -160,8 +160,8 @@ class s2_multisite {
|
|
160 |
if ( $changed ) {
|
161 |
update_option('sidebar_widgets', $sidebars);
|
162 |
}
|
|
|
163 |
}
|
164 |
-
restore_current_blog();
|
165 |
} // end namechange_subscribe2_widget()
|
166 |
}
|
167 |
?>
|
97 |
$blog_list[$details['blog_id']] = $details;
|
98 |
}
|
99 |
|
100 |
+
if ( !is_array($blog_list) ) {
|
101 |
return array();
|
102 |
}
|
103 |
|
160 |
if ( $changed ) {
|
161 |
update_option('sidebar_widgets', $sidebars);
|
162 |
}
|
163 |
+
restore_current_blog();
|
164 |
}
|
|
|
165 |
} // end namechange_subscribe2_widget()
|
166 |
}
|
167 |
?>
|
classes/class-s2-upgrade.php
CHANGED
@@ -187,7 +187,7 @@ class s2class_upgrade {
|
|
187 |
} // end upgrade70()
|
188 |
|
189 |
function upgrade85() {
|
190 |
-
global $wpdb;
|
191 |
|
192 |
// include upgrade-functions for maybe_add_column;
|
193 |
if ( !function_exists('maybe_add_column') ) {
|
@@ -222,5 +222,27 @@ class s2class_upgrade {
|
|
222 |
}
|
223 |
return;
|
224 |
} // end upgrade86()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
225 |
}
|
226 |
?>
|
187 |
} // end upgrade70()
|
188 |
|
189 |
function upgrade85() {
|
190 |
+
global $mysubscribe2, $wpdb;
|
191 |
|
192 |
// include upgrade-functions for maybe_add_column;
|
193 |
if ( !function_exists('maybe_add_column') ) {
|
222 |
}
|
223 |
return;
|
224 |
} // end upgrade86()
|
225 |
+
|
226 |
+
function upgrade88() {
|
227 |
+
// to ensure compulsory category collects all users we need there to be s2_subscribed meta-keys for all users
|
228 |
+
global $mysubscribe2;
|
229 |
+
|
230 |
+
$all_registered = $mysubscribe2->get_all_registered('ID');
|
231 |
+
if ( !empty($all_registered) ) {
|
232 |
+
foreach ( $all_registered as $user_ID ) {
|
233 |
+
$check_subscribed = get_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_subscribed'), true);
|
234 |
+
if ( empty($check_subscribed) ) {
|
235 |
+
update_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_subscribed'), '');
|
236 |
+
}
|
237 |
+
}
|
238 |
+
}
|
239 |
+
|
240 |
+
// check the time column again as the upgrade86() function contained a bug
|
241 |
+
// include upgrade-functions for maybe_add_column;
|
242 |
+
if ( !function_exists('maybe_add_column') ) {
|
243 |
+
require_once(ABSPATH . 'wp-admin/install-helper.php');
|
244 |
+
}
|
245 |
+
maybe_add_column($mysubscribe2->public, 'time', "ALTER TABLE $mysubscribe2->public ADD time TIME DEFAULT '00:00:00' NOT NULL AFTER date");
|
246 |
+
} // end upgrade88()
|
247 |
}
|
248 |
?>
|
subscribe2.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Subscribe2
|
4 |
Plugin URI: http://subscribe2.wordpress.com
|
5 |
Description: Notifies an email list when new entries are posted.
|
6 |
-
Version: 8.
|
7 |
Author: Matthew Robinson
|
8 |
Author URI: http://subscribe2.wordpress.com
|
9 |
Licence: GPL3
|
@@ -11,7 +11,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_butt
|
|
11 |
*/
|
12 |
|
13 |
/*
|
14 |
-
Copyright (C) 2006-
|
15 |
Based on the Original Subscribe2 plugin by
|
16 |
Copyright (C) 2005 Scott Merrill (skippy@skippy.net)
|
17 |
|
@@ -33,7 +33,7 @@ along with Subscribe2. If not, see <http://www.gnu.org/licenses/>.
|
|
33 |
|
34 |
if ( version_compare($GLOBALS['wp_version'], '3.1', '<') || !function_exists( 'add_action' ) ) {
|
35 |
if ( !function_exists( 'add_action' ) ) {
|
36 |
-
$exit_msg = "I'm just a plugin, please don't call me directly";
|
37 |
} else {
|
38 |
// Subscribe2 needs WordPress 3.1 or above, exit if not on a compatible version
|
39 |
$exit_msg = sprintf(__('This version of Subscribe2 requires WordPress 3.1 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>');
|
@@ -41,9 +41,20 @@ if ( version_compare($GLOBALS['wp_version'], '3.1', '<') || !function_exists( 'a
|
|
41 |
exit($exit_msg);
|
42 |
}
|
43 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
// our version number. Don't touch this or any line below
|
45 |
// unless you know exactly what you are doing
|
46 |
-
define( 'S2VERSION', '8.
|
47 |
define( 'S2PATH', trailingslashit(dirname(__FILE__)) );
|
48 |
define( 'S2DIR', trailingslashit(dirname(plugin_basename(__FILE__))) );
|
49 |
define( 'S2URL', plugin_dir_url(dirname(__FILE__)) . S2DIR );
|
3 |
Plugin Name: Subscribe2
|
4 |
Plugin URI: http://subscribe2.wordpress.com
|
5 |
Description: Notifies an email list when new entries are posted.
|
6 |
+
Version: 8.8
|
7 |
Author: Matthew Robinson
|
8 |
Author URI: http://subscribe2.wordpress.com
|
9 |
Licence: GPL3
|
11 |
*/
|
12 |
|
13 |
/*
|
14 |
+
Copyright (C) 2006-13 Matthew Robinson
|
15 |
Based on the Original Subscribe2 plugin by
|
16 |
Copyright (C) 2005 Scott Merrill (skippy@skippy.net)
|
17 |
|
33 |
|
34 |
if ( version_compare($GLOBALS['wp_version'], '3.1', '<') || !function_exists( 'add_action' ) ) {
|
35 |
if ( !function_exists( 'add_action' ) ) {
|
36 |
+
$exit_msg = __("I'm just a plugin, please don't call me directly", 'subscribe2');
|
37 |
} else {
|
38 |
// Subscribe2 needs WordPress 3.1 or above, exit if not on a compatible version
|
39 |
$exit_msg = sprintf(__('This version of Subscribe2 requires WordPress 3.1 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>');
|
41 |
exit($exit_msg);
|
42 |
}
|
43 |
|
44 |
+
// stop Subscribe2 being activated site wide on Multisite installs
|
45 |
+
if ( !function_exists( 'is_plugin_active_for_network' ) ) {
|
46 |
+
require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
|
47 |
+
}
|
48 |
+
|
49 |
+
if ( is_plugin_active_for_network(plugin_basename(__FILE__)) ) {
|
50 |
+
deactivate_plugins( plugin_basename(__FILE__) );
|
51 |
+
$exit_msg = __('Subscribe2 cannot be activate as a network plugin. Please activate it at on a site level', 'subscribe2');
|
52 |
+
exit($exit_msg);
|
53 |
+
}
|
54 |
+
|
55 |
// our version number. Don't touch this or any line below
|
56 |
// unless you know exactly what you are doing
|
57 |
+
define( 'S2VERSION', '8.8' );
|
58 |
define( 'S2PATH', trailingslashit(dirname(__FILE__)) );
|
59 |
define( 'S2DIR', trailingslashit(dirname(plugin_basename(__FILE__))) );
|
60 |
define( 'S2URL', plugin_dir_url(dirname(__FILE__)) . S2DIR );
|
subscribe2.pot
CHANGED
@@ -8,7 +8,7 @@ msgid ""
|
|
8 |
msgstr ""
|
9 |
"Project-Id-Version: PACKAGE VERSION\n"
|
10 |
"Report-Msgid-Bugs-To: \n"
|
11 |
-
"POT-Creation-Date: 2013-
|
12 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
@@ -422,7 +422,7 @@ msgid "Show one-click subscription on profile page"
|
|
422 |
msgstr ""
|
423 |
|
424 |
#: admin/settings.php:389
|
425 |
-
msgid "Set default Subscribe2 page as
|
426 |
msgstr ""
|
427 |
|
428 |
#: admin/settings.php:395
|
@@ -913,73 +913,73 @@ msgstr ""
|
|
913 |
msgid "Options reset!"
|
914 |
msgstr ""
|
915 |
|
916 |
-
#: classes/class-s2-core.php:
|
917 |
msgid "Plain Text Excerpt Preview"
|
918 |
msgstr ""
|
919 |
|
920 |
-
#: classes/class-s2-core.php:
|
921 |
msgid "Plain Text Full Preview"
|
922 |
msgstr ""
|
923 |
|
924 |
-
#: classes/class-s2-core.php:
|
925 |
msgid "HTML Excerpt Preview"
|
926 |
msgstr ""
|
927 |
|
928 |
-
#: classes/class-s2-core.php:
|
929 |
msgid "HTML Full Preview"
|
930 |
msgstr ""
|
931 |
|
932 |
-
#: classes/class-s2-core.php:
|
933 |
msgid "Registered User"
|
934 |
msgstr ""
|
935 |
|
936 |
-
#: classes/class-s2-core.php:
|
937 |
msgid "Confirmed Public Subscriber"
|
938 |
msgstr ""
|
939 |
|
940 |
-
#: classes/class-s2-core.php:
|
941 |
msgid "Unconfirmed Public Subscriber"
|
942 |
msgstr ""
|
943 |
|
944 |
-
#: classes/class-s2-core.php:
|
945 |
msgid "Check here to Subscribe to email notifications for new posts"
|
946 |
msgstr ""
|
947 |
|
948 |
-
#: classes/class-s2-core.php:
|
949 |
msgid ""
|
950 |
"By registering with this blog you are also agreeing to receive email "
|
951 |
"notifications for new posts but you can unsubscribe at anytime"
|
952 |
msgstr ""
|
953 |
|
954 |
-
#: classes/class-s2-core.php:
|
955 |
msgid "Check here to Subscribe to notifications for new posts"
|
956 |
msgstr ""
|
957 |
|
958 |
-
#: classes/class-s2-core.php:
|
959 |
msgid "Weekly"
|
960 |
msgstr ""
|
961 |
|
962 |
-
#: classes/class-s2-core.php:
|
963 |
msgid "Author"
|
964 |
msgstr ""
|
965 |
|
966 |
-
#: classes/class-s2-core.php:
|
967 |
msgid "Posted on"
|
968 |
msgstr ""
|
969 |
|
970 |
-
#: classes/class-s2-core.php:
|
971 |
msgid "Posted in"
|
972 |
msgstr ""
|
973 |
|
974 |
-
#: classes/class-s2-core.php:
|
975 |
msgid "Tagged as"
|
976 |
msgstr ""
|
977 |
|
978 |
-
#: classes/class-s2-core.php:
|
979 |
msgid "Digest Email"
|
980 |
msgstr ""
|
981 |
|
982 |
-
#: classes/class-s2-core.php:
|
983 |
msgid "Digest Preview"
|
984 |
msgstr ""
|
985 |
|
@@ -1192,9 +1192,19 @@ msgstr ""
|
|
1192 |
msgid "Disable JavaScript"
|
1193 |
msgstr ""
|
1194 |
|
|
|
|
|
|
|
|
|
1195 |
#: subscribe2.php:39
|
1196 |
#, php-format
|
1197 |
msgid ""
|
1198 |
"This version of Subscribe2 requires WordPress 3.1 or greater. Please update "
|
1199 |
"%1$s or use an older version of %2$s."
|
1200 |
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
|
8 |
msgstr ""
|
9 |
"Project-Id-Version: PACKAGE VERSION\n"
|
10 |
"Report-Msgid-Bugs-To: \n"
|
11 |
+
"POT-Creation-Date: 2013-02-08 13:23+0000\n"
|
12 |
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
13 |
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
14 |
"Language-Team: LANGUAGE <LL@li.org>\n"
|
422 |
msgstr ""
|
423 |
|
424 |
#: admin/settings.php:389
|
425 |
+
msgid "Set default Subscribe2 page as"
|
426 |
msgstr ""
|
427 |
|
428 |
#: admin/settings.php:395
|
913 |
msgid "Options reset!"
|
914 |
msgstr ""
|
915 |
|
916 |
+
#: classes/class-s2-core.php:580
|
917 |
msgid "Plain Text Excerpt Preview"
|
918 |
msgstr ""
|
919 |
|
920 |
+
#: classes/class-s2-core.php:582
|
921 |
msgid "Plain Text Full Preview"
|
922 |
msgstr ""
|
923 |
|
924 |
+
#: classes/class-s2-core.php:584
|
925 |
msgid "HTML Excerpt Preview"
|
926 |
msgstr ""
|
927 |
|
928 |
+
#: classes/class-s2-core.php:586
|
929 |
msgid "HTML Full Preview"
|
930 |
msgstr ""
|
931 |
|
932 |
+
#: classes/class-s2-core.php:1187
|
933 |
msgid "Registered User"
|
934 |
msgstr ""
|
935 |
|
936 |
+
#: classes/class-s2-core.php:1192
|
937 |
msgid "Confirmed Public Subscriber"
|
938 |
msgstr ""
|
939 |
|
940 |
+
#: classes/class-s2-core.php:1194
|
941 |
msgid "Unconfirmed Public Subscriber"
|
942 |
msgstr ""
|
943 |
|
944 |
+
#: classes/class-s2-core.php:1231
|
945 |
msgid "Check here to Subscribe to email notifications for new posts"
|
946 |
msgstr ""
|
947 |
|
948 |
+
#: classes/class-s2-core.php:1237
|
949 |
msgid ""
|
950 |
"By registering with this blog you are also agreeing to receive email "
|
951 |
"notifications for new posts but you can unsubscribe at anytime"
|
952 |
msgstr ""
|
953 |
|
954 |
+
#: classes/class-s2-core.php:1263
|
955 |
msgid "Check here to Subscribe to notifications for new posts"
|
956 |
msgstr ""
|
957 |
|
958 |
+
#: classes/class-s2-core.php:1353
|
959 |
msgid "Weekly"
|
960 |
msgstr ""
|
961 |
|
962 |
+
#: classes/class-s2-core.php:1487 classes/class-s2-core.php:1488
|
963 |
msgid "Author"
|
964 |
msgstr ""
|
965 |
|
966 |
+
#: classes/class-s2-core.php:1494
|
967 |
msgid "Posted on"
|
968 |
msgstr ""
|
969 |
|
970 |
+
#: classes/class-s2-core.php:1512 classes/class-s2-core.php:1513
|
971 |
msgid "Posted in"
|
972 |
msgstr ""
|
973 |
|
974 |
+
#: classes/class-s2-core.php:1518 classes/class-s2-core.php:1519
|
975 |
msgid "Tagged as"
|
976 |
msgstr ""
|
977 |
|
978 |
+
#: classes/class-s2-core.php:1585
|
979 |
msgid "Digest Email"
|
980 |
msgstr ""
|
981 |
|
982 |
+
#: classes/class-s2-core.php:1595
|
983 |
msgid "Digest Preview"
|
984 |
msgstr ""
|
985 |
|
1192 |
msgid "Disable JavaScript"
|
1193 |
msgstr ""
|
1194 |
|
1195 |
+
#: subscribe2.php:36
|
1196 |
+
msgid "I'm just a plugin, please don't call me directly"
|
1197 |
+
msgstr ""
|
1198 |
+
|
1199 |
#: subscribe2.php:39
|
1200 |
#, php-format
|
1201 |
msgid ""
|
1202 |
"This version of Subscribe2 requires WordPress 3.1 or greater. Please update "
|
1203 |
"%1$s or use an older version of %2$s."
|
1204 |
msgstr ""
|
1205 |
+
|
1206 |
+
#: subscribe2.php:51
|
1207 |
+
msgid ""
|
1208 |
+
"Subscribe2 cannot be activate as a network plugin. Please activate it at on "
|
1209 |
+
"a site level"
|
1210 |
+
msgstr ""
|
uninstall.php
CHANGED
@@ -3,27 +3,49 @@ if ( !defined('ABSPATH') && !defined('WP_UNINSTALL_PLUGIN') ) {
|
|
3 |
// Make sure not to call this file directly
|
4 |
exit();
|
5 |
} else {
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
// remove and scheduled events
|
14 |
-
wp_clear_scheduled_hook('s2_digest_cron');
|
15 |
-
// delete usermeta data for registered users
|
16 |
-
// use LIKE and % wildcard as meta_key names are prepended on WPMU
|
17 |
-
// and s2_cat is appended with category ID integer
|
18 |
-
$wpdb->query("DELETE from $wpdb->usermeta WHERE meta_key LIKE '%s2_cat%'");
|
19 |
-
$wpdb->query("DELETE from $wpdb->usermeta WHERE meta_key LIKE '%s2_subscribed'");
|
20 |
-
$wpdb->query("DELETE from $wpdb->usermeta WHERE meta_key LIKE '%s2_format'");
|
21 |
-
$wpdb->query("DELETE from $wpdb->usermeta WHERE meta_key LIKE '%s2_autosub'");
|
22 |
-
// delete any postmeta data that supressed notifications
|
23 |
-
$wpdb->query("DELETE from $wpdb->postmeta WHERE meta_key = 's2mail'");
|
24 |
|
25 |
-
|
26 |
-
|
27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
}
|
29 |
?>
|
3 |
// Make sure not to call this file directly
|
4 |
exit();
|
5 |
} else {
|
6 |
+
// Is this WordPressMU or not?
|
7 |
+
if ( isset($wpmu_version) || strpos($wp_version, 'wordpress-mu') ) {
|
8 |
+
$s2_mu = true;
|
9 |
+
}
|
10 |
+
if ( function_exists('is_multisite') && is_multisite() ) {
|
11 |
+
$s2_mu = true;
|
12 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
+
if ( $s2_mu ) {
|
15 |
+
global $wpdb;
|
16 |
+
$blogs = $wpdb->get_col("SELECT blog_id FROM {$wpdb->blogs}");
|
17 |
+
foreach ( $blogs as $blog ) {
|
18 |
+
switch_to_blog($blog);
|
19 |
+
s2_uninstall();
|
20 |
+
restore_current_blog();
|
21 |
+
}
|
22 |
+
} else {
|
23 |
+
s2_uninstall();
|
24 |
+
}
|
25 |
+
|
26 |
+
function s2_uninstall() {
|
27 |
+
global $wpdb;
|
28 |
+
// get name of subscribe2 table
|
29 |
+
$public = $wpdb->prefix . "subscribe2";
|
30 |
+
// delete entry from wp_options table
|
31 |
+
delete_option('subscribe2_options');
|
32 |
+
// delete legacy entry from wp-options table
|
33 |
+
delete_option('s2_future_posts');
|
34 |
+
// remove and scheduled events
|
35 |
+
wp_clear_scheduled_hook('s2_digest_cron');
|
36 |
+
// delete usermeta data for registered users
|
37 |
+
// use LIKE and % wildcard as meta_key names are prepended on WPMU
|
38 |
+
// and s2_cat is appended with category ID integer
|
39 |
+
$wpdb->query("DELETE from $wpdb->usermeta WHERE meta_key LIKE '%s2_cat%'");
|
40 |
+
$wpdb->query("DELETE from $wpdb->usermeta WHERE meta_key LIKE '%s2_subscribed'");
|
41 |
+
$wpdb->query("DELETE from $wpdb->usermeta WHERE meta_key LIKE '%s2_format'");
|
42 |
+
$wpdb->query("DELETE from $wpdb->usermeta WHERE meta_key LIKE '%s2_autosub'");
|
43 |
+
// delete any postmeta data that supressed notifications
|
44 |
+
$wpdb->query("DELETE from $wpdb->postmeta WHERE meta_key = 's2mail'");
|
45 |
+
|
46 |
+
// drop the subscribe2 table
|
47 |
+
$sql = "DROP TABLE IF EXISTS `" . $public . "`";
|
48 |
+
$wpdb->query($sql);
|
49 |
+
} // end s2_uninstall()
|
50 |
}
|
51 |
?>
|