AdRotate Banner Manager - Version 5.8.24

Version Description

Enjoy this update with the latest tweaks and improvements for AdRotate for WordPress!

Download this release

Release Info

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

Code changes from version 5.8.23 to 5.8.24

adrotate-block.php ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* ------------------------------------------------------------------------------------
3
+ * COPYRIGHT AND TRADEMARK NOTICE
4
+ * Copyright 2008-2022 Arnan de Gans. All Rights Reserved.
5
+ * ADROTATE is a registered trademark of Arnan de Gans.
6
+
7
+ * COPYRIGHT NOTICES AND ALL THE COMMENTS SHOULD REMAIN INTACT.
8
+ * By using this code you agree to indemnify Arnan de Gans from any
9
+ * liability that might arise from its use.
10
+ ------------------------------------------------------------------------------------ */
11
+
12
+ /*-------------------------------------------------------------
13
+ Name: adrotate_register_blocks
14
+ Purpose: Register and load blocks and their configuration
15
+ Since: 5.8.24
16
+ -------------------------------------------------------------*/
17
+ function adrotate_register_blocks() {
18
+ wp_register_script('adrotate-block', plugins_url('/library/block.js', __FILE__), array('wp-blocks', 'wp-element', 'wp-i18n'));
19
+
20
+ register_block_type('adrotate/advert', array('editor_script' => 'adrotate-block', 'render_callback' => 'adrotate_advert_block'));
21
+ register_block_type('adrotate/group', array('editor_script' => 'adrotate-block', 'render_callback' => 'adrotate_group_block'));
22
+ }
23
+ add_action('init', 'adrotate_register_blocks');
24
+
25
+ /*-------------------------------------------------------------
26
+ Name: adrotate_advert_block, adrotate_group_block
27
+ Purpose: Output advert or group block
28
+ Since: 5.8.24
29
+ -------------------------------------------------------------*/
30
+ function adrotate_advert_block($attr) {
31
+ if(!isset($attr['advert_id']) OR !is_numeric($attr['advert_id'])) return;
32
+ return adrotate_ad($attr['advert_id']);
33
+ }
34
+
35
+ function adrotate_group_block($attr) {
36
+ if(!isset($attr['group_id']) OR !is_numeric($attr['group_id'])) return;
37
+ return adrotate_group($attr['group_id']);
38
+ }
39
+
40
+ /*-------------------------------------------------------------
41
+ Name: adrotate_add_block_category
42
+ Purpose: Add a category for AdRotate blocks in the Block Editor
43
+ Since: 5.8.24
44
+ -------------------------------------------------------------*/
45
+ function adrotate_add_block_category($categories, $editor_context) {
46
+ if(!empty($editor_context->post)) {
47
+ $categories[] = array(
48
+ 'slug' => 'custom-adrotate',
49
+ 'title' => __('AdRotate - Advertisements', 'adrotate'),
50
+ 'icon' => null,
51
+ );
52
+ }
53
+
54
+ return $categories;
55
+ }
56
+ add_filter('block_categories_all', 'adrotate_add_block_category', 10, 2);
adrotate-manage-publisher.php CHANGED
@@ -24,14 +24,14 @@ function adrotate_generate_input() {
24
 
25
  // Basic advert
26
  $fullsize_image = $targeturl = $nofollow = $basic_dropdown = $adwidth = $adheight = '';
27
- if(isset($_POST['adrotate_fullsize_dropdown'])) $fullsize_image = strip_tags(trim($_POST['adrotate_fullsize_dropdown'], "\t\n "));
28
- if(isset($_POST['adrotate_targeturl'])) $targeturl = strip_tags(trim($_POST['adrotate_targeturl'], "\t\n "));
29
 
30
  $new_window = '';
31
- if(isset($_POST['adrotate_newwindow'])) $new_window = strip_tags(trim($_POST['adrotate_newwindow'], "\t\n "));
32
 
33
  $portability = '';
34
- if(isset($_POST['adrotate_portability'])) $portability = strip_tags(trim($_POST['adrotate_portability'], "\t\n "));
35
 
36
  if(current_user_can('adrotate_ad_manage')) {
37
  if(strlen($portability) == 0) {
@@ -93,44 +93,40 @@ function adrotate_insert_input() {
93
  if(isset($_POST['adrotate_id'])) $id = sanitize_key($_POST['adrotate_id']);
94
  if(isset($_POST['adrotate_schedule'])) $schedule_id = sanitize_key($_POST['adrotate_schedule']);
95
  if(isset($_POST['adrotate_username'])) $author = sanitize_key($_POST['adrotate_username']);
96
- if(isset($_POST['adrotate_title'])) $title = sanitize_title(trim($_POST['adrotate_title'], "\t\n "), "Ad $id");
97
- if(isset($_POST['adrotate_bannercode'])) $bannercode = htmlspecialchars(trim($_POST['adrotate_bannercode'], "\t\n "), ENT_QUOTES);
98
  $thetime = current_time('timestamp');
99
- if(isset($_POST['adrotate_active'])) $active = strip_tags(trim($_POST['adrotate_active'], "\t\n "));
100
 
101
  // Schedules
102
  $start_date = $start_hour = $start_minute = $end_date = $end_hour = $end_minute = '';
103
- if(isset($_POST['adrotate_start_date'])) $start_date = sanitize_key(trim($_POST['adrotate_start_date'], "\t\n "));
104
- if(isset($_POST['adrotate_start_hour'])) $start_hour = sanitize_key(trim($_POST['adrotate_start_hour'], "\t\n "));
105
- if(isset($_POST['adrotate_start_minute'])) $start_minute = sanitize_key(trim($_POST['adrotate_start_minute'], "\t\n "));
106
- if(isset($_POST['adrotate_end_date'])) $end_date = sanitize_key(trim($_POST['adrotate_end_date'], "\t\n "));
107
- if(isset($_POST['adrotate_end_hour'])) $end_hour = sanitize_key(trim($_POST['adrotate_end_hour'], "\t\n "));
108
- if(isset($_POST['adrotate_end_minute'])) $end_minute = sanitize_key(trim($_POST['adrotate_end_minute'], "\t\n "));
109
 
110
  $maxclicks = $maxshown = '';
111
- if(isset($_POST['adrotate_maxclicks'])) $maxclicks = sanitize_key(trim($_POST['adrotate_maxclicks'], "\t\n "));
112
- if(isset($_POST['adrotate_maxshown'])) $maxshown = sanitize_key(trim($_POST['adrotate_maxshown'], "\t\n "));
113
 
114
  // Advanced options
115
  $image_field = $image_dropdown = $tracker = $show_everyone = '';
116
  $advertiser = 0;
117
- if(isset($_POST['adrotate_image'])) $image_field = strip_tags(trim($_POST['adrotate_image'], "\t\n "));
118
- if(isset($_POST['adrotate_image_dropdown'])) $image_dropdown = strip_tags(trim($_POST['adrotate_image_dropdown'], "\t\n "));
119
- if(isset($_POST['adrotate_tracker'])) $tracker = strip_tags(trim($_POST['adrotate_tracker'], "\t\n "));
120
 
121
  // Misc variables
122
  $type = '';
123
  $groups = array();
124
  if(isset($_POST['groupselect'])) $groups = $_POST['groupselect'];
125
- if(isset($_POST['adrotate_type'])) $type = sanitize_key(trim($_POST['adrotate_type'], "\t\n "));
126
 
127
 
128
  if(current_user_can('adrotate_ad_manage')) {
129
- /*
130
- if(strlen($title) < 1) {
131
- $title = 'Ad '.$id;
132
- }
133
- */
134
 
135
  // Clean up bannercode
136
  if(preg_match("/%ID%/", $bannercode)) $bannercode = str_replace('%ID%', '%id%', $bannercode);
@@ -257,20 +253,20 @@ function adrotate_insert_group() {
257
  $action = $id = $name = $modus = '';
258
  if(isset($_POST['adrotate_action'])) $action = sanitize_key($_POST['adrotate_action']);
259
  if(isset($_POST['adrotate_id'])) $id = sanitize_key($_POST['adrotate_id']);
260
- if(isset($_POST['adrotate_groupname'])) $name = sanitize_title(trim($_POST['adrotate_groupname'], "\t\n "), "Group $id");
261
- if(isset($_POST['adrotate_modus'])) $modus = sanitize_key(trim($_POST['adrotate_modus'], "\t\n "));
262
 
263
  $rows = $columns = $adwidth = $adheight = $adspeed = '';
264
- if(isset($_POST['adrotate_gridrows'])) $rows = sanitize_key(trim($_POST['adrotate_gridrows'], "\t\n "));
265
- if(isset($_POST['adrotate_gridcolumns'])) $columns = sanitize_key(trim($_POST['adrotate_gridcolumns'], "\t\n "));
266
- if(isset($_POST['adrotate_adwidth'])) $adwidth = sanitize_key(trim($_POST['adrotate_adwidth'], "\t\n "));
267
- if(isset($_POST['adrotate_adheight'])) $adheight = sanitize_key(trim($_POST['adrotate_adheight'], "\t\n "));
268
- if(isset($_POST['adrotate_adspeed'])) $adspeed = sanitize_key(trim($_POST['adrotate_adspeed'], "\t\n "));
269
 
270
  $ads = $admargin = $align = '';
271
- if(isset($_POST['adselect'])) $ads = strip_tags(trim($_POST['adselect'], "\t\n "));
272
- if(isset($_POST['adrotate_admargin'])) $admargin = sanitize_key(trim($_POST['adrotate_admargin'], "\t\n "));
273
- if(isset($_POST['adrotate_align'])) $align = sanitize_key(trim($_POST['adrotate_align'], "\t\n "));
274
 
275
  $categories = $category_loc = $category_par = $pages = $page_loc = $page_par = '';
276
  if(isset($_POST['adrotate_categories'])) $categories = $_POST['adrotate_categories'];
@@ -281,11 +277,11 @@ function adrotate_insert_group() {
281
  if(isset($_POST['adrotate_page_paragraph'])) $page_par = sanitize_key($_POST['adrotate_page_paragraph']);
282
 
283
  $wrapper_before = $wrapper_after = '';
284
- if(isset($_POST['adrotate_wrapper_before'])) $wrapper_before = htmlspecialchars(trim($_POST['adrotate_wrapper_before'], "\t\n "), ENT_QUOTES);
285
- if(isset($_POST['adrotate_wrapper_after'])) $wrapper_after = htmlspecialchars(trim($_POST['adrotate_wrapper_after'], "\t\n "), ENT_QUOTES);
286
 
287
  if(current_user_can('adrotate_group_manage')) {
288
- // if(strlen($name) < 1) $name = 'Group '.$id;
289
 
290
  if($modus < 0 OR $modus > 2) $modus = 0;
291
  if($adspeed < 0 OR $adspeed > 99999) $adspeed = 6000;
@@ -549,13 +545,13 @@ function adrotate_request_action() {
549
  // Determine which kind of action to use
550
  if(isset($_POST['adrotate_action'])) {
551
  // Default action call
552
- $actions = strip_tags(trim($_POST['adrotate_action'], "\t\n "));
553
  } else if(isset($_POST['adrotate_disabled_action'])) {
554
  // Disabled ads listing call
555
- $actions = strip_tags(trim($_POST['adrotate_disabled_action'], "\t\n "));
556
  } else if(isset($_POST['adrotate_error_action'])) {
557
  // Erroneous ads listing call
558
- $actions = strip_tags(trim($_POST['adrotate_error_action'], "\t\n "));
559
  }
560
  if(preg_match("/-/", $actions)) {
561
  list($action, $specific) = explode("-", $actions);
24
 
25
  // Basic advert
26
  $fullsize_image = $targeturl = $nofollow = $basic_dropdown = $adwidth = $adheight = '';
27
+ if(isset($_POST['adrotate_fullsize_dropdown'])) $fullsize_image = strip_tags(trim($_POST['adrotate_fullsize_dropdown']));
28
+ if(isset($_POST['adrotate_targeturl'])) $targeturl = strip_tags(trim($_POST['adrotate_targeturl']));
29
 
30
  $new_window = '';
31
+ if(isset($_POST['adrotate_newwindow'])) $new_window = strip_tags(trim($_POST['adrotate_newwindow']));
32
 
33
  $portability = '';
34
+ if(isset($_POST['adrotate_portability'])) $portability = strip_tags(trim($_POST['adrotate_portability']));
35
 
36
  if(current_user_can('adrotate_ad_manage')) {
37
  if(strlen($portability) == 0) {
93
  if(isset($_POST['adrotate_id'])) $id = sanitize_key($_POST['adrotate_id']);
94
  if(isset($_POST['adrotate_schedule'])) $schedule_id = sanitize_key($_POST['adrotate_schedule']);
95
  if(isset($_POST['adrotate_username'])) $author = sanitize_key($_POST['adrotate_username']);
96
+ if(isset($_POST['adrotate_title'])) $title = sanitize_text_field($_POST['adrotate_title']);
97
+ if(isset($_POST['adrotate_bannercode'])) $bannercode = htmlspecialchars(trim($_POST['adrotate_bannercode']), ENT_QUOTES);
98
  $thetime = current_time('timestamp');
99
+ if(isset($_POST['adrotate_active'])) $active = strip_tags(trim($_POST['adrotate_active']));
100
 
101
  // Schedules
102
  $start_date = $start_hour = $start_minute = $end_date = $end_hour = $end_minute = '';
103
+ if(isset($_POST['adrotate_start_date'])) $start_date = sanitize_key(trim($_POST['adrotate_start_date']));
104
+ if(isset($_POST['adrotate_start_hour'])) $start_hour = sanitize_key(trim($_POST['adrotate_start_hour']));
105
+ if(isset($_POST['adrotate_start_minute'])) $start_minute = sanitize_key(trim($_POST['adrotate_start_minute']));
106
+ if(isset($_POST['adrotate_end_date'])) $end_date = sanitize_key(trim($_POST['adrotate_end_date']));
107
+ if(isset($_POST['adrotate_end_hour'])) $end_hour = sanitize_key(trim($_POST['adrotate_end_hour']));
108
+ if(isset($_POST['adrotate_end_minute'])) $end_minute = sanitize_key(trim($_POST['adrotate_end_minute']));
109
 
110
  $maxclicks = $maxshown = '';
111
+ if(isset($_POST['adrotate_maxclicks'])) $maxclicks = sanitize_key(trim($_POST['adrotate_maxclicks']));
112
+ if(isset($_POST['adrotate_maxshown'])) $maxshown = sanitize_key(trim($_POST['adrotate_maxshown']));
113
 
114
  // Advanced options
115
  $image_field = $image_dropdown = $tracker = $show_everyone = '';
116
  $advertiser = 0;
117
+ if(isset($_POST['adrotate_image'])) $image_field = strip_tags(trim($_POST['adrotate_image']));
118
+ if(isset($_POST['adrotate_image_dropdown'])) $image_dropdown = strip_tags(trim($_POST['adrotate_image_dropdown']));
119
+ if(isset($_POST['adrotate_tracker'])) $tracker = strip_tags(trim($_POST['adrotate_tracker']));
120
 
121
  // Misc variables
122
  $type = '';
123
  $groups = array();
124
  if(isset($_POST['groupselect'])) $groups = $_POST['groupselect'];
125
+ if(isset($_POST['adrotate_type'])) $type = sanitize_key(trim($_POST['adrotate_type']));
126
 
127
 
128
  if(current_user_can('adrotate_ad_manage')) {
129
+ if(strlen($title) < 1) $title = 'Advert '.$id;
 
 
 
 
130
 
131
  // Clean up bannercode
132
  if(preg_match("/%ID%/", $bannercode)) $bannercode = str_replace('%ID%', '%id%', $bannercode);
253
  $action = $id = $name = $modus = '';
254
  if(isset($_POST['adrotate_action'])) $action = sanitize_key($_POST['adrotate_action']);
255
  if(isset($_POST['adrotate_id'])) $id = sanitize_key($_POST['adrotate_id']);
256
+ if(isset($_POST['adrotate_groupname'])) $name = sanitize_text_field($_POST['adrotate_groupname']);
257
+ if(isset($_POST['adrotate_modus'])) $modus = sanitize_key(trim($_POST['adrotate_modus']));
258
 
259
  $rows = $columns = $adwidth = $adheight = $adspeed = '';
260
+ if(isset($_POST['adrotate_gridrows'])) $rows = sanitize_key(trim($_POST['adrotate_gridrows']));
261
+ if(isset($_POST['adrotate_gridcolumns'])) $columns = sanitize_key(trim($_POST['adrotate_gridcolumns']));
262
+ if(isset($_POST['adrotate_adwidth'])) $adwidth = sanitize_key(trim($_POST['adrotate_adwidth']));
263
+ if(isset($_POST['adrotate_adheight'])) $adheight = sanitize_key(trim($_POST['adrotate_adheight']));
264
+ if(isset($_POST['adrotate_adspeed'])) $adspeed = sanitize_key(trim($_POST['adrotate_adspeed']));
265
 
266
  $ads = $admargin = $align = '';
267
+ if(isset($_POST['adselect'])) $ads = $_POST['adselect'];
268
+ if(isset($_POST['adrotate_admargin'])) $admargin = sanitize_key(trim($_POST['adrotate_admargin']));
269
+ if(isset($_POST['adrotate_align'])) $align = sanitize_key(trim($_POST['adrotate_align']));
270
 
271
  $categories = $category_loc = $category_par = $pages = $page_loc = $page_par = '';
272
  if(isset($_POST['adrotate_categories'])) $categories = $_POST['adrotate_categories'];
277
  if(isset($_POST['adrotate_page_paragraph'])) $page_par = sanitize_key($_POST['adrotate_page_paragraph']);
278
 
279
  $wrapper_before = $wrapper_after = '';
280
+ if(isset($_POST['adrotate_wrapper_before'])) $wrapper_before = htmlspecialchars(trim($_POST['adrotate_wrapper_before']), ENT_QUOTES);
281
+ if(isset($_POST['adrotate_wrapper_after'])) $wrapper_after = htmlspecialchars(trim($_POST['adrotate_wrapper_after']), ENT_QUOTES);
282
 
283
  if(current_user_can('adrotate_group_manage')) {
284
+ if(strlen($name) < 1) $name = 'Group '.$id;
285
 
286
  if($modus < 0 OR $modus > 2) $modus = 0;
287
  if($adspeed < 0 OR $adspeed > 99999) $adspeed = 6000;
545
  // Determine which kind of action to use
546
  if(isset($_POST['adrotate_action'])) {
547
  // Default action call
548
+ $actions = strip_tags(trim($_POST['adrotate_action']));
549
  } else if(isset($_POST['adrotate_disabled_action'])) {
550
  // Disabled ads listing call
551
+ $actions = strip_tags(trim($_POST['adrotate_disabled_action']));
552
  } else if(isset($_POST['adrotate_error_action'])) {
553
  // Erroneous ads listing call
554
+ $actions = strip_tags(trim($_POST['adrotate_error_action']));
555
  }
556
  if(preg_match("/-/", $actions)) {
557
  list($action, $specific) = explode("-", $actions);
adrotate-setup.php CHANGED
@@ -403,6 +403,7 @@ function adrotate_database_install() {
403
  `id` mediumint(8) unsigned NOT NULL auto_increment,
404
  `name` varchar(255) NOT NULL default '',
405
  `modus` tinyint(1) NOT NULL default '0',
 
406
  `fallback` varchar(5) NOT NULL default '0',
407
  `cat` longtext NOT NULL,
408
  `cat_loc` tinyint(1) NOT NULL default '0',
@@ -445,6 +446,7 @@ function adrotate_database_install() {
445
  `maxclicks` int(15) unsigned NOT NULL default '0',
446
  `maximpressions` int(15) unsigned NOT NULL default '0',
447
  `spread` char(1) NOT NULL default 'N',
 
448
  `daystarttime` char(4) NOT NULL default '0000',
449
  `daystoptime` char(4) NOT NULL default '0000',
450
  `day_mon` char(1) NOT NULL default 'Y',
@@ -600,6 +602,14 @@ function adrotate_database_upgrade() {
600
  adrotate_add_column("{$wpdb->prefix}adrotate", 'state_req', 'char(1) NOT NULL default \'N\' AFTER `irate`');
601
  }
602
 
 
 
 
 
 
 
 
 
603
  update_option("adrotate_db_version", array('current' => ADROTATE_DB_VERSION, 'previous' => $adrotate_db_version['current']));
604
  }
605
 
403
  `id` mediumint(8) unsigned NOT NULL auto_increment,
404
  `name` varchar(255) NOT NULL default '',
405
  `modus` tinyint(1) NOT NULL default '0',
406
+ `swap` tinyint(1) NOT NULL default '0',
407
  `fallback` varchar(5) NOT NULL default '0',
408
  `cat` longtext NOT NULL,
409
  `cat_loc` tinyint(1) NOT NULL default '0',
446
  `maxclicks` int(15) unsigned NOT NULL default '0',
447
  `maximpressions` int(15) unsigned NOT NULL default '0',
448
  `spread` char(1) NOT NULL default 'N',
449
+ `spread_all` char(1) NOT NULL default 'N',
450
  `daystarttime` char(4) NOT NULL default '0000',
451
  `daystoptime` char(4) NOT NULL default '0000',
452
  `day_mon` char(1) NOT NULL default 'Y',
602
  adrotate_add_column("{$wpdb->prefix}adrotate", 'state_req', 'char(1) NOT NULL default \'N\' AFTER `irate`');
603
  }
604
 
605
+ // Database: 68
606
+ // AdRotate: 5.8.24
607
+ if($adrotate_db_version['current'] < 68) {
608
+ adrotate_add_column("{$wpdb->prefix}adrotate_groups", 'swap', 'tinyint(1) NOT NULL default \'0\' AFTER `modus`');
609
+ adrotate_add_column("{$wpdb->prefix}adrotate_schedule", 'spread_all', 'char(1) NOT NULL default \'N\' AFTER `spread`');
610
+ }
611
+
612
+
613
  update_option("adrotate_db_version", array('current' => ADROTATE_DB_VERSION, 'previous' => $adrotate_db_version['current']));
614
  }
615
 
adrotate-statistics.php CHANGED
@@ -470,9 +470,9 @@ function adrotate_count_impression($ad, $group = 0, $blog_id = 0) {
470
  Since: 3.11.4
471
  -------------------------------------------------------------*/
472
  function adrotate_impression_callback() {
473
- define('DONOTCACHEPAGE', true);
474
- define('DONOTCACHEDB', true);
475
- define('DONOTCACHCEOBJECT', true);
476
 
477
  $meta = $_POST['track'];
478
  $meta = base64_decode($meta);
@@ -493,9 +493,9 @@ function adrotate_impression_callback() {
493
  Since: 3.11.4
494
  -------------------------------------------------------------*/
495
  function adrotate_click_callback() {
496
- define('DONOTCACHEPAGE', true);
497
- define('DONOTCACHEDB', true);
498
- define('DONOTCACHCEOBJECT', true);
499
 
500
  global $wpdb, $adrotate_config;
501
 
470
  Since: 3.11.4
471
  -------------------------------------------------------------*/
472
  function adrotate_impression_callback() {
473
+ if(!defined('DONOTCACHEPAGE')) define('DONOTCACHEPAGE', true);
474
+ if(!defined('DONOTCACHEDB')) define('DONOTCACHEDB', true);
475
+ if(!defined('DONOTCACHCEOBJECT')) define('DONOTCACHCEOBJECT', true);
476
 
477
  $meta = $_POST['track'];
478
  $meta = base64_decode($meta);
493
  Since: 3.11.4
494
  -------------------------------------------------------------*/
495
  function adrotate_click_callback() {
496
+ if(!defined('DONOTCACHEPAGE')) define('DONOTCACHEPAGE', true);
497
+ if(!defined('DONOTCACHEDB')) define('DONOTCACHEDB', true);
498
+ if(!defined('DONOTCACHCEOBJECT')) define('DONOTCACHCEOBJECT', true);
499
 
500
  global $wpdb, $adrotate_config;
501
 
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: Monetize your website with adverts while keeping things simple. Start making money today!
8
  Text Domain: adrotate
9
- Version: 5.8.23
10
  License: GPLv3
11
  */
12
 
@@ -21,9 +21,9 @@ License: GPLv3
21
  ------------------------------------------------------------------------------------ */
22
 
23
  /*--- AdRotate values ---------------------------------------*/
24
- define("ADROTATE_DISPLAY", '5.8.23');
25
  define("ADROTATE_VERSION", 399);
26
- define("ADROTATE_DB_VERSION", 66);
27
  $plugin_folder = plugin_dir_path(__FILE__);
28
  /*-----------------------------------------------------------*/
29
 
@@ -35,6 +35,8 @@ include_once($plugin_folder.'/adrotate-statistics.php');
35
  include_once($plugin_folder.'/adrotate-portability.php');
36
  include_once($plugin_folder.'/adrotate-output.php');
37
  include_once($plugin_folder.'/adrotate-widget.php');
 
 
38
  /*-----------------------------------------------------------*/
39
 
40
  /*--- Check and Load config ---------------------------------*/
6
  Author URI: https://www.arnan.me/?pk_campaign=adrotatefree&pk_keyword=plugin_info
7
  Description: Monetize your website with adverts while keeping things simple. Start making money today!
8
  Text Domain: adrotate
9
+ Version: 5.8.24
10
  License: GPLv3
11
  */
12
 
21
  ------------------------------------------------------------------------------------ */
22
 
23
  /*--- AdRotate values ---------------------------------------*/
24
+ define("ADROTATE_DISPLAY", '5.8.24');
25
  define("ADROTATE_VERSION", 399);
26
+ define("ADROTATE_DB_VERSION", 68);
27
  $plugin_folder = plugin_dir_path(__FILE__);
28
  /*-----------------------------------------------------------*/
29
 
35
  include_once($plugin_folder.'/adrotate-portability.php');
36
  include_once($plugin_folder.'/adrotate-output.php');
37
  include_once($plugin_folder.'/adrotate-widget.php');
38
+ /*--- Blocks ------------------------------------------------*/
39
+ if(function_exists('register_block_type')) include_once($plugin_folder.'/adrotate-block.php');
40
  /*-----------------------------------------------------------*/
41
 
42
  /*--- Check and Load config ---------------------------------*/
dashboard/publisher/adverts-edit.php CHANGED
@@ -15,7 +15,7 @@ if(!$ad_edit_id) {
15
  $wpdb->insert($wpdb->prefix."adrotate", array('title' => '', 'bannercode' => '', 'thetime' => $now, 'updated' => $now, 'author' => $userdata->user_login, 'imagetype' => 'dropdown', 'image' => '', 'tracker' => 'N', 'show_everyone' => 'Y', 'desktop' => 'Y', 'mobile' => 'Y', 'tablet' => 'Y', 'os_ios' => 'Y', 'os_android' => 'Y', 'os_other' => 'Y', 'type' => 'empty', 'weight' => 6, 'autodelete' => 'N', 'budget' => 0, 'crate' => 0, 'irate' => 0, 'state_req' => 'N', 'cities' => serialize(array()), 'states' => serialize(array()), 'countries' => serialize(array())));
16
  $edit_id = $wpdb->insert_id;
17
 
18
- $wpdb->insert($wpdb->prefix.'adrotate_schedule', array('name' => 'Schedule for ad '.$edit_id, 'starttime' => $now, 'stoptime' => $in84days, 'maxclicks' => 0, 'maximpressions' => 0, 'spread' => 'N', 'daystarttime' => '0000', 'daystoptime' => '0000', 'day_mon' => 'Y', 'day_tue' => 'Y', 'day_wed' => 'Y', 'day_thu' => 'Y', 'day_fri' => 'Y', 'day_sat' => 'Y', 'day_sun' => 'Y', 'autodelete' => 'N'));
19
  $schedule_id = $wpdb->insert_id;
20
  $wpdb->insert($wpdb->prefix.'adrotate_linkmeta', array('ad' => $edit_id, 'group' => 0, 'user' => 0, 'schedule' => $schedule_id));
21
  }
15
  $wpdb->insert($wpdb->prefix."adrotate", array('title' => '', 'bannercode' => '', 'thetime' => $now, 'updated' => $now, 'author' => $userdata->user_login, 'imagetype' => 'dropdown', 'image' => '', 'tracker' => 'N', 'show_everyone' => 'Y', 'desktop' => 'Y', 'mobile' => 'Y', 'tablet' => 'Y', 'os_ios' => 'Y', 'os_android' => 'Y', 'os_other' => 'Y', 'type' => 'empty', 'weight' => 6, 'autodelete' => 'N', 'budget' => 0, 'crate' => 0, 'irate' => 0, 'state_req' => 'N', 'cities' => serialize(array()), 'states' => serialize(array()), 'countries' => serialize(array())));
16
  $edit_id = $wpdb->insert_id;
17
 
18
+ $wpdb->insert($wpdb->prefix.'adrotate_schedule', array('name' => 'Schedule for ad '.$edit_id, 'starttime' => $now, 'stoptime' => $in84days, 'maxclicks' => 0, 'maximpressions' => 0, 'spread' => 'N', 'spread_all' => 'N', 'daystarttime' => '0000', 'daystoptime' => '0000', 'day_mon' => 'Y', 'day_tue' => 'Y', 'day_wed' => 'Y', 'day_thu' => 'Y', 'day_fri' => 'Y', 'day_sat' => 'Y', 'day_sun' => 'Y', 'autodelete' => 'N'));
19
  $schedule_id = $wpdb->insert_id;
20
  $wpdb->insert($wpdb->prefix.'adrotate_linkmeta', array('ad' => $edit_id, 'group' => 0, 'user' => 0, 'schedule' => $schedule_id));
21
  }
dashboard/publisher/groups-edit.php CHANGED
@@ -13,7 +13,7 @@
13
  $action = "group_new";
14
  $edit_id = $wpdb->get_var("SELECT `id` FROM `{$wpdb->prefix}adrotate_groups` WHERE `name` = '' ORDER BY `id` DESC LIMIT 1;");
15
  if($edit_id == 0) {
16
- $wpdb->insert($wpdb->prefix.'adrotate_groups', array('name' => '', 'modus' => 0, 'fallback' => '0', 'cat' => '', 'cat_loc' => 0, 'cat_par' => 0, 'page' => '', 'page_loc' => 0, 'page_par' => 0, 'mobile' => 0, 'geo' => 0, 'wrapper_before' => '', 'wrapper_after' => '', 'gridrows' => 2, 'gridcolumns' => 2, 'admargin' => 0, 'admargin_bottom' => 0, 'admargin_left' => 0, 'admargin_right' => 0, 'adwidth' => '125', 'adheight' => '125', 'adspeed' => 6000, 'repeat_impressions' => 'Y'));
17
  $edit_id = $wpdb->insert_id;
18
  }
19
  $group_edit_id = $edit_id;
13
  $action = "group_new";
14
  $edit_id = $wpdb->get_var("SELECT `id` FROM `{$wpdb->prefix}adrotate_groups` WHERE `name` = '' ORDER BY `id` DESC LIMIT 1;");
15
  if($edit_id == 0) {
16
+ $wpdb->insert($wpdb->prefix.'adrotate_groups', array('name' => '', 'modus' => 0, 'swap' => 0, 'fallback' => '0', 'cat' => '', 'cat_loc' => 0, 'cat_par' => 0, 'page' => '', 'page_loc' => 0, 'page_par' => 0, 'mobile' => 0, 'geo' => 0, 'wrapper_before' => '', 'wrapper_after' => '', 'gridrows' => 2, 'gridcolumns' => 2, 'admargin' => 0, 'admargin_bottom' => 0, 'admargin_left' => 0, 'admargin_right' => 0, 'adwidth' => '125', 'adheight' => '125', 'adspeed' => 6000, 'repeat_impressions' => 'Y'));
17
  $edit_id = $wpdb->insert_id;
18
  }
19
  $group_edit_id = $edit_id;
library/block.js ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*--------------------------------------//
2
+ WordPress Blocks
3
+ Version: 1.0
4
+ Original code: Arnan de Gans
5
+ Copyright: See notice in adrotate-pro.php
6
+ //--------------------------------------//
7
+ Changelog:
8
+ //--------------------------------------//
9
+ 17 April 2022
10
+ * Initial release
11
+ //--------------------------------------*/
12
+ var el = wp.element.createElement,
13
+ __ = wp.i18n.__,
14
+ registerBlockType = wp.blocks.registerBlockType,
15
+ RichText = wp.blocks.RichText,
16
+ BlockBoxStyle = { 'box-sizing': 'border-box', position: 'relative', padding: '1em', 'min-height': '20px', width: '100%', margin: '0', color: '#1e1e1e', 'border-radius': '2px', 'background-color': '#f7f7f7', 'box-shadow': 'inset 0 0 0 1px #1e1e1e', outline: '1px solid transparent', 'background-image': 'linear-gradient(to bottom right, #f7f7f7, #1fa4d1)' };
17
+
18
+ registerBlockType('adrotate/advert', {
19
+ title: __('AdRotate Advert', 'adrotate'),
20
+ icon: 'editor-code',
21
+ category: 'custom-adrotate',
22
+ description: __('Show a single advert by entering an advert ID.', 'adrotate'),
23
+ keywords: ['ad', 'advert', 'adrotate', 'banner', 'ads'],
24
+
25
+ attributes: {
26
+ advert_id: {
27
+ type: 'string',
28
+ selector: 'input',
29
+ },
30
+ },
31
+ supports: {
32
+ html: false,
33
+ },
34
+
35
+ edit: function( props ) {
36
+ function onChangeText( e ) {
37
+ props.setAttributes( { advert_id: e.target.value } );
38
+ }
39
+
40
+ if(isNaN(props.attributes.advert_id)) props.attributes.advert_id = 0;
41
+
42
+ return el('div', {
43
+ className: props.className + 'components-placeholder widefat',
44
+ style: BlockBoxStyle,
45
+ },
46
+ el('div', {
47
+ className: 'components-placeholder__label',
48
+ style: { 'font-size': '18pt', 'font-weight': '400' },
49
+ }, __('AdRotate Advert', 'adrotate')),
50
+ el('label', {
51
+ className: 'components-placeholder__instructions group-' + props.attributes.advert_id,
52
+ }, __('Enter an Advert ID (numbers only):', 'adrotate')),
53
+ el('input', {
54
+ className: 'components-text-control__input group-' + props.attributes.advert_id,
55
+ onChange: onChangeText,
56
+ value: Number(props.attributes.advert_id),
57
+ isSelected: props.isSelected,
58
+ style: { 'background-color': '#fefefe' }
59
+ }),
60
+ el('div', {
61
+ className: 'components-placeholder__instructions group-' + props.attributes.group_id,
62
+ style: { 'font-size': '70%', 'font-style': 'italic' },
63
+ }, __('You can find the advert ID in Manage Adverts. Any special markup, code or layout styles can be applied in the advert itself or by placing the advert in a group.', 'adrotate')),
64
+ );
65
+ },
66
+
67
+ save: function( props ) {
68
+ return null;
69
+ },
70
+ } );
71
+
72
+ registerBlockType('adrotate/group', {
73
+ title: __('AdRotate Group', 'adrotate'),
74
+ icon: 'editor-code',
75
+ category: 'custom-adrotate',
76
+ description: __('Show a group of adverts by entering a group ID.', 'adrotate'),
77
+ keywords: ['ad', 'advert', 'adrotate', 'banner', 'group'],
78
+
79
+ attributes: {
80
+ group_id: {
81
+ type: 'string',
82
+ selector: 'input',
83
+ },
84
+ },
85
+ supports: {
86
+ html: false,
87
+ },
88
+
89
+ edit: function( props ) {
90
+ function onChangeText( e ) {
91
+ props.setAttributes( { group_id: e.target.value } );
92
+ }
93
+
94
+ if(isNaN(props.attributes.group_id)) props.attributes.group_id = 0;
95
+
96
+ return el('div', {
97
+ className: props.className + 'components-placeholder widefat',
98
+ style: BlockBoxStyle,
99
+ },
100
+ el('div', {
101
+ className: 'components-placeholder__label',
102
+ style: { 'font-size': '18pt', 'font-weight': '400' },
103
+ }, __('AdRotate Group', 'adrotate')),
104
+ el('label', {
105
+ className: 'components-placeholder__instructions group-' + props.attributes.group_id,
106
+ }, __('Enter a group ID (numbers only):', 'adrotate')),
107
+ el('input', {
108
+ className: 'components-text-control__input group-' + props.attributes.group_id,
109
+ onChange: onChangeText,
110
+ value: Number(props.attributes.group_id),
111
+ isSelected: props.isSelected,
112
+ style: { 'background-color': '#fefefe' }
113
+ }),
114
+ el('div', {
115
+ className: 'components-placeholder__instructions group-' + props.attributes.group_id,
116
+ style: { 'font-size': '70%', 'font-style': 'italic' },
117
+ }, __('You can find the group ID in Manage Groups. Any special markup, code or layout styles can be applied in the group wrapper when editing the group.', 'adrotate')),
118
+ );
119
+ },
120
+
121
+ save: function( props ) {
122
+ return null;
123
+ },
124
+ } );
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: adverts, ads, banners, advert manager, ad manager, banner manager, monetiz
5
  Requires at least: 4.9
6
  Requires PHP: 5.6
7
  Tested up to: 5.9.3
8
- Stable tag: 5.8.23
9
  License: GPLv3
10
 
11
  Manage all your advertising campaigns and affiliate banners/links with ease. Use any advert banner or link and place them anywhere on your site. Use many powerful features to run successful campaigns and increase your revenue.
@@ -65,21 +65,19 @@ For more detailed instructions check out the [installation steps](https://ajdg.s
65
 
66
  For the full changelog check out the [development page](https://ajdg.solutions/support/adrotate-development/?pk_campaign=adrotatefree&pk_keyword=readme).
67
 
68
- = AdRotate 5.8.23 =
69
- * [fix] Replaced 'adrotate-pro' language strings with 'adrotate'
70
- * [fix] Better validate uploaded files
71
- * [fix] Low risk security fixes for saving adverts and groups
72
- * [update] Borlabs cache code - Requires Borlabs Cache 1.6.5+
73
- * [update] Removed unused 'save options' button in Maintenance dashboard
74
-
75
- = AdRotate Professional 5.8.17 =
76
- * [fix] Notice about height on stats
77
- * [fix] Overall stats now only count active adverts
78
- * [fix] Archiving adverts deleted wrong stats in some cases
79
- * [fix] Uninstaller calling unused/broken functions
80
- * [fix] Geo Targeting now properly handles failed server responses
81
- * [fix] Low risk security fixes for saving adverts and groups
82
- * [update] Removed unused 'save options' button in Maintenance dashboard
83
 
84
  Be a Pro and get [AdRotate Professional](https://ajdg.solutions/product-category/adrotate-pro/?pk_campaign=adrotatefree&pk_keyword=readme)!
85
 
5
  Requires at least: 4.9
6
  Requires PHP: 5.6
7
  Tested up to: 5.9.3
8
+ Stable tag: 5.8.24
9
  License: GPLv3
10
 
11
  Manage all your advertising campaigns and affiliate banners/links with ease. Use any advert banner or link and place them anywhere on your site. Use many powerful features to run successful campaigns and increase your revenue.
65
 
66
  For the full changelog check out the [development page](https://ajdg.solutions/support/adrotate-development/?pk_campaign=adrotatefree&pk_keyword=readme).
67
 
68
+ = AdRotate 5.8.24 =
69
+ * [new] Group and Advert block support
70
+ * [fix] Selecting adverts in groups not working
71
+ * [fix] Better handling of caching constants
72
+ * [tweak] Replaced sanitize_title with sanitize_text_field for advert names
73
+ * [tweak] Replaced sanitize_title with sanitize_text_field for group names
74
+ * [update] Update database to be in sync with AdRotate Pro
75
+
76
+ = AdRotate Professional 5.8.20 =
77
+ * [fix] Schedules not being saved when editing adverts
78
+ * [fix] Impression spread not working properly
79
+ * [fix] Impression spread configuration errors not always showing
80
+ * [fix] Several queries using wrong quotations
 
 
81
 
82
  Be a Pro and get [AdRotate Professional](https://ajdg.solutions/product-category/adrotate-pro/?pk_campaign=adrotatefree&pk_keyword=readme)!
83