AdRotate Banner Manager - Version 5.8.1

Version Description

Enjoy this latest update with the latest tweaks and fixes to further improve AdRotate for WordPress!

Download this release

Release Info

Developer adegans
Plugin Icon 128x128 AdRotate Banner Manager
Version 5.8.1
Comparing to
See all releases

Code changes from version 5.8 to 5.8.1

Files changed (5) hide show
  1. adrotate-output.php +3 -3
  2. adrotate-setup.php +97 -1
  3. adrotate.php +4 -3
  4. readme.txt +8 -2
  5. uninstall.php +0 -91
adrotate-output.php CHANGED
@@ -649,10 +649,10 @@ function adrotate_dashboard_error() {
649
  $error['banners_folder'] = __('Your AdRotate Banner folder is not writable or does not exist.', 'adrotate').' <a href="https://ajdg.solutions/manuals/adrotate-manuals/manage-banner-images/" target="_blank">'.__('Set up your banner folder', 'adrotate').'</a>.';
650
  }
651
  if(is_dir(WP_PLUGIN_DIR."/adrotate-pro/")) {
652
- $error['adrotate_exists'] = __('You have the AdRotate Professional installed. Please check out the upgrade manual and switch over to AdRotate Pro!', 'adrotate-pro').' <a href="https://ajdg.solutions/support/adrotate-manuals/upgrade-adrotate-to-adrotate-pro/" target="_blank">'.__('Upgrade instructions', 'adrotate-pro').'</a>.';
653
  }
654
- if(is_dir(WP_PLUGIN_DIR."/adrotate_new/") OR is_dir(WP_PLUGIN_DIR."/adrotate-pro_new/")) {
655
- $error['adrotate_exists'] = __('Something is wrong with your installation of AdRotate. Either the plugin is installed twice or your current installation has the wrong folder name. Please install the plugin properly!', 'adrotate-pro').' <a href="https://ajdg.solutions/support/adrotate-manuals/installing-adrotate-on-your-website/" target="_blank">'.__('Installation instructions', 'adrotate-pro').'</a>.';
656
  }
657
 
658
  $error = (isset($error) AND is_array($error)) ? $error : false;
649
  $error['banners_folder'] = __('Your AdRotate Banner folder is not writable or does not exist.', 'adrotate').' <a href="https://ajdg.solutions/manuals/adrotate-manuals/manage-banner-images/" target="_blank">'.__('Set up your banner folder', 'adrotate').'</a>.';
650
  }
651
  if(is_dir(WP_PLUGIN_DIR."/adrotate-pro/")) {
652
+ $error['adrotate_exists'] = __('You have AdRotate Professional installed. Please switch to AdRotate Pro! You can delete this plugin after AdRotate Pro is activated.', 'adrotate-pro').' <a href="'.admin_url('/plugins.php?s=adrotate&plugin_status=all').'">'.__('Switch plugins', 'adrotate-pro').'</a>.';
653
  }
654
+ if(is_dir(WP_PLUGIN_DIR."/adrotate_new/") OR is_dir(WP_PLUGIN_DIR."/adrotate-pro_new/") OR is_dir(WP_PLUGIN_DIR."/adrotate_old/") OR is_dir(WP_PLUGIN_DIR."/adrotate-pro_old/")) {
655
+ $error['adrotate_folder_names'] = __('Something is wrong with your installation of AdRotate. Either the plugin is installed twice or your current installation has the wrong folder name. Please install the plugin properly!', 'adrotate-pro').' <a href="https://ajdg.solutions/support/adrotate-manuals/installing-adrotate-on-your-website/" target="_blank">'.__('Installation instructions', 'adrotate-pro').'</a>.';
656
  }
657
 
658
  $error = (isset($error) AND is_array($error)) ? $error : false;
adrotate-setup.php CHANGED
@@ -58,7 +58,7 @@ function adrotate_activate_setup() {
58
  add_option('adrotate_config', array());
59
  add_option('adrotate_notifications', array());
60
  add_option('adrotate_crawlers', array());
61
- add_option('adrotate_advert_status', array('error' => 0, 'expired' => 0, 'expiressoon' => 0, 'normal' => 0, 'total' => 0));
62
  add_option('adrotate_geo_required', 0);
63
  add_option('adrotate_geo_requests', 0);
64
  add_option('adrotate_dynamic_required', 0);
@@ -137,6 +137,97 @@ function adrotate_deactivate_setup() {
137
  wp_clear_scheduled_hook('adrotate_empty_trackerdata');
138
  }
139
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  /*-------------------------------------------------------------
141
  Name: adrotate_check_schedules
142
  Purpose: Set or reset maintenance schedules for AdRotate
@@ -650,6 +741,11 @@ function adrotate_core_upgrade() {
650
  delete_option('adrotate_hide_banner');
651
  }
652
 
 
 
 
 
 
653
  update_option("adrotate_version", array('current' => ADROTATE_VERSION, 'previous' => $adrotate_version['current']));
654
  }
655
 
58
  add_option('adrotate_config', array());
59
  add_option('adrotate_notifications', array());
60
  add_option('adrotate_crawlers', array());
61
+ add_option('adrotate_advert_status', array('error' => 0, 'expired' => 0, 'expiressoon' => 0, 'expiresweek' => 0, 'normal' => 0, 'total' => 0));
62
  add_option('adrotate_geo_required', 0);
63
  add_option('adrotate_geo_requests', 0);
64
  add_option('adrotate_dynamic_required', 0);
137
  wp_clear_scheduled_hook('adrotate_empty_trackerdata');
138
  }
139
 
140
+ /*-------------------------------------------------------------
141
+ Name: adrotate_uninstall
142
+ Purpose: Initiate uninstallation
143
+ Since: 5.8.1
144
+ -------------------------------------------------------------*/
145
+ function adrotate_uninstall($network_wide) {
146
+ adrotate_network_propagate($network_wide);
147
+ }
148
+
149
+ /*-------------------------------------------------------------
150
+ Name: adrotate_uninstall_setup
151
+ Purpose: Delete the entire AdRotate database and remove the options on uninstall
152
+ Since: 5.8.1
153
+ -------------------------------------------------------------*/
154
+ function adrotate_uninstall_setup() {
155
+ global $wpdb, $wp_roles;
156
+
157
+ // Clean up capabilities from ALL users
158
+ $editable_roles = apply_filters('editable_roles', $wp_roles->roles);
159
+ foreach($editable_roles as $role => $details) {
160
+ $wp_roles->remove_cap($details['name'], "adrotate_ad_manage");
161
+ $wp_roles->remove_cap($details['name'], "adrotate_ad_delete");
162
+ $wp_roles->remove_cap($details['name'], "adrotate_group_manage");
163
+ $wp_roles->remove_cap($details['name'], "adrotate_group_delete");
164
+ }
165
+
166
+ // Clear out userroles
167
+ remove_role('adrotate_advertiser');
168
+
169
+ // Clear out wp_cron
170
+ wp_clear_scheduled_hook('adrotate_evaluate_ads');
171
+ wp_clear_scheduled_hook('adrotate_empty_trackerdata');
172
+
173
+ // Drop MySQL Tables
174
+ $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate`");
175
+ $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_groups`");
176
+ $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_linkmeta`");
177
+ $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_stats`");
178
+ $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_stats_archive`");
179
+ $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_schedule`");
180
+ $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_tracker`");
181
+
182
+ // Delete Options
183
+ delete_option('adrotate_activate');
184
+ delete_option('adrotate_config');
185
+ delete_option('adrotate_crawlers');
186
+ delete_option('adrotate_version');
187
+ delete_option('adrotate_db_version');
188
+ delete_option('adrotate_geo_required');
189
+ delete_option('adrotate_geo_requests');
190
+ delete_option('adrotate_geo_reset');
191
+ delete_option('adrotate_group_css');
192
+ delete_option('adrotate_header_output');
193
+ delete_option('adrotate_dynamic_required');
194
+ delete_option('adrotate_hide_license');
195
+ delete_option('adrotate_hide_review');
196
+ delete_option('adrotate_hide_getpro');
197
+ delete_option('adrotate_hide_birthday');
198
+ delete_option('adrotate_advert_status');
199
+ delete_option('adrotate_notifications');
200
+
201
+ // Cleanup user meta
202
+ $wpdb->query("DELETE FROM `{$wpdb->prefix}usermeta` WHERE `meta_key` = 'adrotate_is_advertiser';");
203
+ $wpdb->query("DELETE FROM `{$wpdb->prefix}usermeta` WHERE `meta_key` = 'adrotate_notes';");
204
+ $wpdb->query("DELETE FROM `{$wpdb->prefix}usermeta` WHERE `meta_key` = 'adrotate_permissions';");
205
+ }
206
+
207
+ /*-------------------------------------------------------------
208
+ Name: adrotate_network_propagate
209
+ Purpose: Check how many sites use AdRotate
210
+ Since: 5.8.1
211
+ -------------------------------------------------------------*/
212
+ function adrotate_network_propagate($network_wide) {
213
+ global $wpdb;
214
+
215
+ if(is_multisite() AND $network_wide) {
216
+ $current_blog = $wpdb->blogid;
217
+ // Get all blog ids
218
+ $blogids = $wpdb->get_col("SELECT `blog_id` FROM $wpdb->blogs;");
219
+ foreach($blogids as $blog_id) {
220
+ switch_to_blog($blog_id);
221
+ if(!is_plugin_active('adrotate-pro/adrotate-pro.php')) { // Only if AdRotate Pro is not active
222
+ adrotate_uninstall_setup();
223
+ }
224
+ }
225
+ switch_to_blog($current_blog);
226
+ return;
227
+ }
228
+ call_user_func($pfunction, $network_wide);
229
+ }
230
+
231
  /*-------------------------------------------------------------
232
  Name: adrotate_check_schedules
233
  Purpose: Set or reset maintenance schedules for AdRotate
741
  delete_option('adrotate_hide_banner');
742
  }
743
 
744
+ // 5.8.1
745
+ if($adrotate_version['current'] < 398) {
746
+ delete_option('adrotate_hide_competition');
747
+ }
748
+
749
  update_option("adrotate_version", array('current' => ADROTATE_VERSION, 'previous' => $adrotate_version['current']));
750
  }
751
 
adrotate.php CHANGED
@@ -6,7 +6,7 @@ Author: Arnan de Gans
6
  Author URI: https://www.arnan.me/?pk_campaign=adrotatefree&pk_keyword=plugin_info
7
  Description: Monetise your website with adverts while keeping things simple. Start making money today!
8
  Text Domain: adrotate
9
- Version: 5.8
10
  License: GPLv3
11
  */
12
 
@@ -21,8 +21,8 @@ License: GPLv3
21
  ------------------------------------------------------------------------------------ */
22
 
23
  /*--- AdRotate values ---------------------------------------*/
24
- define("ADROTATE_DISPLAY", '5.8');
25
- define("ADROTATE_VERSION", 395);
26
  define("ADROTATE_DB_VERSION", 66);
27
  $plugin_folder = plugin_dir_path(__FILE__);
28
  /*-----------------------------------------------------------*/
@@ -48,6 +48,7 @@ $adrotate_db_version = get_option("adrotate_db_version");
48
  /*--- Core --------------------------------------------------*/
49
  register_activation_hook(__FILE__, 'adrotate_activate');
50
  register_deactivation_hook(__FILE__, 'adrotate_deactivate');
 
51
  add_action('adrotate_evaluate_ads', 'adrotate_evaluate_ads');
52
  add_action('adrotate_empty_trackerdata', 'adrotate_empty_trackerdata');
53
  add_action('widgets_init', 'adrotate_widget');
6
  Author URI: https://www.arnan.me/?pk_campaign=adrotatefree&pk_keyword=plugin_info
7
  Description: Monetise your website with adverts while keeping things simple. Start making money today!
8
  Text Domain: adrotate
9
+ Version: 5.8.1
10
  License: GPLv3
11
  */
12
 
21
  ------------------------------------------------------------------------------------ */
22
 
23
  /*--- AdRotate values ---------------------------------------*/
24
+ define("ADROTATE_DISPLAY", '5.8.1');
25
+ define("ADROTATE_VERSION", 398);
26
  define("ADROTATE_DB_VERSION", 66);
27
  $plugin_folder = plugin_dir_path(__FILE__);
28
  /*-----------------------------------------------------------*/
48
  /*--- Core --------------------------------------------------*/
49
  register_activation_hook(__FILE__, 'adrotate_activate');
50
  register_deactivation_hook(__FILE__, 'adrotate_deactivate');
51
+ register_uninstall_hook(__FILE__, 'adrotate_uninstall');
52
  add_action('adrotate_evaluate_ads', 'adrotate_evaluate_ads');
53
  add_action('adrotate_empty_trackerdata', 'adrotate_empty_trackerdata');
54
  add_action('widgets_init', 'adrotate_widget');
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: adverts, ads, banners, advert manager, ad manager, banner manager, monetis
5
  Requires at least: 4.6
6
  Requires PHP: 5.6
7
  Tested up to: 5.4
8
- Stable tag: 5.8
9
  License: GPLv3
10
 
11
  Manage your advertisements the easy way! Monetise your website with AdRotate. AdRotate has everything you need and keeps management simple!
@@ -67,7 +67,10 @@ For more detailed instructions check out the [installation steps](https://ajdg.s
67
 
68
  Be a Pro and get [AdRotate Professional](https://ajdg.solutions/product-category/adrotate-pro/?pk_campaign=adrotatefree&pk_keyword=readme)!
69
 
70
- = AdRotate 5.7 =
 
 
 
71
  * [change] Maintenance dashboard optimised and reworded
72
  * [change] Removed old/unused debug code
73
  * [change] Compacted Javascript files
@@ -80,6 +83,9 @@ Be a Pro and get [AdRotate Professional](https://ajdg.solutions/product-category
80
  * [i18n] Added German translation using pre-translation
81
  * [i18n] Updated Spanish translation using pre-translation
82
 
 
 
 
83
  = AdRotate Professional 5.8 =
84
  * [change] No longer uses WordPress mechanism for update checks
85
  * [change] Maintenance dashboard optimised and reworded
5
  Requires at least: 4.6
6
  Requires PHP: 5.6
7
  Tested up to: 5.4
8
+ Stable tag: 5.8.1
9
  License: GPLv3
10
 
11
  Manage your advertisements the easy way! Monetise your website with AdRotate. AdRotate has everything you need and keeps management simple!
67
 
68
  Be a Pro and get [AdRotate Professional](https://ajdg.solutions/product-category/adrotate-pro/?pk_campaign=adrotatefree&pk_keyword=readme)!
69
 
70
+ = AdRotate 5.8.1 =
71
+ * [fix] Uninstall not working for some people
72
+
73
+ = AdRotate 5.8 =
74
  * [change] Maintenance dashboard optimised and reworded
75
  * [change] Removed old/unused debug code
76
  * [change] Compacted Javascript files
83
  * [i18n] Added German translation using pre-translation
84
  * [i18n] Updated Spanish translation using pre-translation
85
 
86
+ = AdRotate Professional 5.8.1 =
87
+ * [fix] Uninstall not working for some people
88
+
89
  = AdRotate Professional 5.8 =
90
  * [change] No longer uses WordPress mechanism for update checks
91
  * [change] Maintenance dashboard optimised and reworded
uninstall.php DELETED
@@ -1,91 +0,0 @@
1
- <?php
2
- if(!defined('ABSPATH') OR !defined('WP_UNINSTALL_PLUGIN')) exit;
3
- if(!current_user_can('activate_plugins')) return;
4
-
5
- /*-------------------------------------------------------------
6
- Name: adrotate_initiate_uninstall
7
- Purpose: Loop through all instances and init adrotate_uninstall_setup()
8
- Since: 5.7
9
- -------------------------------------------------------------*/
10
- function adrotate_initiate_uninstall() {
11
- global $network_wide, $wpdb;
12
-
13
- if(is_multisite()) {
14
- $blog_ids = $wpdb->get_col("SELECT blog_id FROM $wpdb->blogs");
15
-
16
- if($blog_ids) {
17
- foreach($blog_ids as $blog_id) {
18
- switch_to_blog($blog_id);
19
- if(!is_plugin_active('adrotate-pro/adrotate-pro.php')) adrotate_uninstall_setup();
20
- restore_current_blog();
21
- }
22
- }
23
- } else {
24
- adrotate_uninstall_setup();
25
- }
26
- }
27
-
28
- /*-------------------------------------------------------------
29
- Name: adrotate_uninstall_setup
30
- Purpose: Delete all data per instance
31
- Since: 5.7
32
- -------------------------------------------------------------*/
33
- function adrotate_uninstall_setup() {
34
- global $wpdb, $wp_roles;
35
-
36
- // Clean up capabilities from ALL users
37
- $editable_roles = apply_filters('editable_roles', $wp_roles->roles);
38
- foreach($editable_roles as $role => $details) {
39
- $wp_roles->remove_cap($details['name'], "adrotate_ad_manage");
40
- $wp_roles->remove_cap($details['name'], "adrotate_ad_delete");
41
- $wp_roles->remove_cap($details['name'], "adrotate_group_manage");
42
- $wp_roles->remove_cap($details['name'], "adrotate_group_delete");
43
- }
44
-
45
- // Clear out userroles
46
- remove_role('adrotate_advertiser');
47
-
48
- // Clear out wp_cron
49
- wp_clear_scheduled_hook('adrotate_evaluate_ads');
50
- wp_clear_scheduled_hook('adrotate_empty_trackerdata');
51
-
52
- // Drop MySQL Tables
53
- $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate`");
54
- $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_groups`");
55
- $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_linkmeta`");
56
- $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_stats`");
57
- $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_stats_archive`");
58
- $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_schedule`");
59
- $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_tracker`");
60
-
61
- // Delete Options
62
- delete_option('adrotate_activate');
63
- delete_option('adrotate_config');
64
- delete_option('adrotate_crawlers');
65
- delete_option('adrotate_version');
66
- delete_option('adrotate_db_version');
67
- delete_option('adrotate_db_timer'); // Obsolete in 5.8
68
- delete_option('adrotate_debug'); // Obsolete in 5.8
69
- delete_option('adrotate_geo_required');
70
- delete_option('adrotate_geo_requests');
71
- delete_option('adrotate_geo_reset');
72
- delete_option('adrotate_group_css');
73
- delete_option('adrotate_header_output');
74
- delete_option('adrotate_dynamic_required');
75
- delete_option('adrotate_hide_license');
76
- delete_option('adrotate_hide_review');
77
- delete_option('adrotate_hide_competition');
78
- delete_option('adrotate_hide_getpro');
79
- delete_option('adrotate_hide_birthday');
80
- delete_option('adrotate_advert_status');
81
- delete_option('adrotate_notifications');
82
-
83
- // Cleanup user meta
84
- $wpdb->query("DELETE FROM `{$wpdb->prefix}usermeta` WHERE `meta_key` = 'adrotate_is_advertiser';");
85
- $wpdb->query("DELETE FROM `{$wpdb->prefix}usermeta` WHERE `meta_key` = 'adrotate_notes';");
86
- $wpdb->query("DELETE FROM `{$wpdb->prefix}usermeta` WHERE `meta_key` = 'adrotate_permissions';");
87
- }
88
-
89
- // Run the uninstaller
90
- adrotate_initiate_uninstall();
91
- ?>