AdRotate Banner Manager - Version 5.3

Version Description

FREE = * [fix] Possible vulnerability for users with privileged access * [change] Dashboard tweaks

Download this release

Release Info

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

Code changes from version 5.2 to 5.3

adrotate-output.php CHANGED
@@ -632,6 +632,12 @@ function adrotate_error($action, $arg = null) {
632
  return $result;
633
  break;
634
 
 
 
 
 
 
 
635
  // Misc
636
  default:
637
  $result = '<span style="font-weight: bold; color: #f00;">'.__('An unknown error occured.', 'adrotate').' (ID: '.$arg[0].')</span>';
@@ -713,7 +719,7 @@ function adrotate_notifications_dashboard() {
713
  echo '<div class="updated" style="padding: 0; margin: 0;">';
714
  echo ' <div class="ajdg_notification">';
715
  echo ' <div class="button_div"><a class="button button_large" target="_blank" href="https://ajdg.solutions/plugins/adrotate-for-wordpress/?add-to-cart=1126">'.__('Get AdRotate Pro', 'adrotate').'</a></div>';
716
- echo ' <div class="text">'.__("Upgrade to <strong>AdRotate Professional</strong> and get features like Geo Targeting, Scheduling and more...", 'adrotate').'<br /><span>'.__('Use coupon code <b>IWANTADROTATEPRO</b> and get a 20% discount on any AdRotate license!', 'adrotate' ).' '.__('Thank you for your support!', 'adrotate' ).'</span></div>';
717
 
718
  echo ' <div class="icon"><img title="" src="'.plugins_url('/images/logo-60x60.png', __FILE__).'" alt=""/></div>';
719
  echo ' </div>';
@@ -725,7 +731,7 @@ function adrotate_notifications_dashboard() {
725
  echo '<div class="updated" style="padding: 0; margin: 0;">';
726
  echo ' <div class="ajdg_notification">';
727
  echo ' <div class="button_div"><a class="button button_large" target="_blank" href="https://wordpress.org/support/view/plugin-reviews/adrotate?rate=5#postform">Review AdRotate</a></div>';
728
- echo ' <div class="text">You have been using <strong>AdRotate</strong> for a few days. Please write a <strong>encouraging review</strong>!<br /><span>If you have questions, complaints or something else that doesn\'t belong in a review, please <a href="https://ajdg.solutions/forums/forum/adrotate-for-wordpress/" target="_blank">post it here</a>!</span></div>';
729
 
730
  echo ' <a class="close_notification" href="admin.php?page=adrotate&hide=1"><img title="Close" src="'.plugins_url('/images/icon-close.png', __FILE__).'" alt=""/></a>';
731
 
632
  return $result;
633
  break;
634
 
635
+ // Possible XSS or malformed URL
636
+ case "error_loading_item" :
637
+ $result = '<span style="font-weight: bold; color: #f00;">'.__('There was an error loading the page. Please try again by reloading the page via the menu on the left.', 'adrotate').'<br />'.__('If the issue persists please seek help at', 'adrotate').' <a href="https://ajdg.solutions/forums/forum/adrotate-for-wordpress/">ajdg.solutions/forums/forum/adrotate-for-wordpress/</a></span>';
638
+ return $result;
639
+ break;
640
+
641
  // Misc
642
  default:
643
  $result = '<span style="font-weight: bold; color: #f00;">'.__('An unknown error occured.', 'adrotate').' (ID: '.$arg[0].')</span>';
719
  echo '<div class="updated" style="padding: 0; margin: 0;">';
720
  echo ' <div class="ajdg_notification">';
721
  echo ' <div class="button_div"><a class="button button_large" target="_blank" href="https://ajdg.solutions/plugins/adrotate-for-wordpress/?add-to-cart=1126">'.__('Get AdRotate Pro', 'adrotate').'</a></div>';
722
+ echo ' <div class="text">'.__("Upgrade to <strong>AdRotate Professional</strong> and get features like Geo Targeting, Scheduling and more...", 'adrotate').'<br /><span>'.__('Use coupon code <b>IWANTADROTATEPRO</b> and get a 20% discount on any AdRotate Professional license!', 'adrotate' ).' '.__('Thank you for your support!', 'adrotate' ).'</span></div>';
723
 
724
  echo ' <div class="icon"><img title="" src="'.plugins_url('/images/logo-60x60.png', __FILE__).'" alt=""/></div>';
725
  echo ' </div>';
731
  echo '<div class="updated" style="padding: 0; margin: 0;">';
732
  echo ' <div class="ajdg_notification">';
733
  echo ' <div class="button_div"><a class="button button_large" target="_blank" href="https://wordpress.org/support/view/plugin-reviews/adrotate?rate=5#postform">Review AdRotate</a></div>';
734
+ echo ' <div class="text">You have been using <strong>AdRotate</strong> for a few days. If you like AdRotate, please share <strong>your experience</strong>!<br /><span>If you have questions, complaints or something else that does not belong in a review, please use the <a href="admin.php?page=adrotate-support">support forum</a>!</span></div>';
735
 
736
  echo ' <a class="close_notification" href="admin.php?page=adrotate&hide=1"><img title="Close" src="'.plugins_url('/images/icon-close.png', __FILE__).'" alt=""/></a>';
737
 
adrotate.php CHANGED
@@ -6,7 +6,7 @@ Author: Arnan de Gans
6
  Author URI: https://www.arnan.me/
7
  Description: AdRotate Banner Manager - Monetise your website with adverts while keeping things simple. Start making money today!
8
  Text Domain: adrotate
9
- Version: 5.2
10
  License: GPLv3
11
  */
12
 
@@ -21,7 +21,7 @@ License: GPLv3
21
  ------------------------------------------------------------------------------------ */
22
 
23
  /*--- AdRotate values ---------------------------------------*/
24
- define("ADROTATE_DISPLAY", '5.2');
25
  define("ADROTATE_VERSION", 393);
26
  define("ADROTATE_DB_VERSION", 64);
27
  $plugin_folder = plugin_dir_path(__FILE__);
@@ -198,8 +198,8 @@ function adrotate_manage() {
198
  $active = $disabled = $error = false;
199
  foreach($allbanners as $singlebanner) {
200
  $starttime = $stoptime = 0;
201
- $starttime = $wpdb->get_var("SELECT `starttime` FROM `{$wpdb->prefix}adrotate_schedule`, `{$wpdb->prefix}adrotate_linkmeta` WHERE `ad` = '".$singlebanner->id."' AND `schedule` = `{$wpdb->prefix}adrotate_schedule`.`id` ORDER BY `starttime` ASC LIMIT 1;");
202
- $stoptime = $wpdb->get_var("SELECT `stoptime` FROM `{$wpdb->prefix}adrotate_schedule`, `{$wpdb->prefix}adrotate_linkmeta` WHERE `ad` = '".$singlebanner->id."' AND `schedule` = `{$wpdb->prefix}adrotate_schedule`.`id` ORDER BY `stoptime` DESC LIMIT 1;");
203
 
204
  $type = $singlebanner->type;
205
  if($type == 'active' AND $stoptime <= $in7days) $type = '7days';
6
  Author URI: https://www.arnan.me/
7
  Description: AdRotate Banner Manager - Monetise your website with adverts while keeping things simple. Start making money today!
8
  Text Domain: adrotate
9
+ Version: 5.3
10
  License: GPLv3
11
  */
12
 
21
  ------------------------------------------------------------------------------------ */
22
 
23
  /*--- AdRotate values ---------------------------------------*/
24
+ define("ADROTATE_DISPLAY", '5.3');
25
  define("ADROTATE_VERSION", 393);
26
  define("ADROTATE_DB_VERSION", 64);
27
  $plugin_folder = plugin_dir_path(__FILE__);
198
  $active = $disabled = $error = false;
199
  foreach($allbanners as $singlebanner) {
200
  $starttime = $stoptime = 0;
201
+ $starttime = $wpdb->get_var("SELECT `starttime` FROM `{$wpdb->prefix}adrotate_schedule`, `{$wpdb->prefix}adrotate_linkmeta` WHERE `ad` = '{$singlebanner->id}' AND `schedule` = `{$wpdb->prefix}adrotate_schedule`.`id` ORDER BY `starttime` ASC LIMIT 1;");
202
+ $stoptime = $wpdb->get_var("SELECT `stoptime` FROM `{$wpdb->prefix}adrotate_schedule`, `{$wpdb->prefix}adrotate_linkmeta` WHERE `ad` = '{$singlebanner->id}' AND `schedule` = `{$wpdb->prefix}adrotate_schedule`.`id` ORDER BY `stoptime` DESC LIMIT 1;");
203
 
204
  $type = $singlebanner->type;
205
  if($type == 'active' AND $stoptime <= $in7days) $type = '7days';
dashboard/publisher/adverts-edit.php CHANGED
@@ -22,481 +22,488 @@ if(!$ad_edit_id) {
22
  $ad_edit_id = $edit_id;
23
  }
24
 
25
- $edit_banner = $wpdb->get_row("SELECT * FROM `{$wpdb->prefix}adrotate` WHERE `id` = {$ad_edit_id};");
26
- $groups = $wpdb->get_results("SELECT * FROM `{$wpdb->prefix}adrotate_groups` WHERE `name` != '' ORDER BY `id` ASC;");
27
- $schedule = $wpdb->get_row("SELECT `{$wpdb->prefix}adrotate_schedule`.`id`, `starttime`, `stoptime`, `maxclicks`, `maximpressions` FROM `{$wpdb->prefix}adrotate_schedule`, `{$wpdb->prefix}adrotate_linkmeta` WHERE `ad` = {$edit_banner->id} AND `group` = 0 AND `user` = 0 AND `schedule` = `{$wpdb->prefix}adrotate_schedule`.`id` ORDER BY `{$wpdb->prefix}adrotate_schedule`.`id` ASC LIMIT 1;");
28
- $linkmeta = $wpdb->get_results("SELECT `group` FROM `{$wpdb->prefix}adrotate_linkmeta` WHERE `ad` = {$edit_banner->id} AND `user` = 0 AND `schedule` = 0;");
29
 
30
- // Random banner for Media.net
31
- $partner = mt_rand(1,3);
32
-
33
- wp_enqueue_media();
34
- wp_enqueue_script('uploader-hook', plugins_url().'/adrotate/library/uploader-hook.js', array('jquery'));
35
-
36
- // Set up start and end date
37
- list($start_day, $start_month, $start_year, $start_hour, $start_minute) = explode(" ", date("d m Y H i", $schedule->starttime));
38
- list($end_day, $end_month, $end_year, $end_hour, $end_minute) = explode(" ", date("d m Y H i", $schedule->stoptime));
39
- $start_date = $start_day.'-'.$start_month.'-'.$start_year;
40
- $end_date = $end_day.'-'.$end_month.'-'.$end_year;
41
-
42
- $meta_array = array();
43
- foreach($linkmeta as $meta) {
44
- $meta_array[] = $meta->group;
45
- }
46
-
47
- if($ad_edit_id) {
48
- if($edit_banner->type != 'empty') {
49
- // Errors
50
- if(strlen($edit_banner->bannercode) < 1 AND $edit_banner->type != 'empty')
51
- echo '<div class="error"><p>'. __('The AdCode cannot be empty!', 'adrotate').'</p></div>';
52
-
53
- if(!preg_match("/(%image%|%asset%)/i", $edit_banner->bannercode, $things) AND $edit_banner->image != '')
54
- echo '<div class="error"><p>'. __('You did not use %asset% (or %image%) in your AdCode but did select a file to use!', 'adrotate').'</p></div>';
 
 
55
 
56
- if(preg_match("/(%image%|%asset%)/i", $edit_banner->bannercode, $things) AND $edit_banner->image == '')
57
- echo '<div class="error"><p>'. __('You did use %asset% (or %image%) in your AdCode but did not select a file to use!', 'adrotate').'</p></div>';
58
 
59
- if((($edit_banner->imagetype != '' AND $edit_banner->image == '') OR ($edit_banner->imagetype == '' AND $edit_banner->image != '')))
60
- echo '<div class="error"><p>'. __('There is a problem saving the image. Please reset your image and re-save the ad!', 'adrotate').'</p></div>';
61
-
62
- if(!preg_match_all('/<(a|script|embed|iframe)[^>](.*?)>/i', stripslashes(htmlspecialchars_decode($edit_banner->bannercode, ENT_QUOTES)), $things) AND $edit_banner->tracker == 'Y')
63
- echo '<div class="error"><p>'. __("Tracking is enabled but no valid link/tag was found in the adcode!", 'adrotate').'</p></div>';
64
-
65
- // Ad Notices
66
- $adstate = adrotate_evaluate_ad($edit_banner->id);
67
- if($edit_banner->type == 'error' AND $adstate == 'active')
68
- echo '<div class="error"><p>'. __('AdRotate cannot find an error but the ad is marked erroneous, try re-saving the ad!', 'adrotate').'</p></div>';
69
-
70
- if($adstate == 'expired')
71
- echo '<div class="error"><p>'. __('This ad is expired and currently not shown on your website!', 'adrotate').'</p></div>';
72
-
73
- if($adstate == '2days')
74
- echo '<div class="updated"><p>'. __('The ad will expire in less than 2 days!', 'adrotate').'</p></div>';
75
-
76
- if($adstate == '7days')
77
- echo '<div class="updated"><p>'. __('This ad will expire in less than 7 days!', 'adrotate').'</p></div>';
78
-
79
- if($edit_banner->type == 'disabled')
80
- echo '<div class="updated"><p>'. __('This ad has been disabled and does not rotate on your site!', 'adrotate').'</p></div>';
81
-
82
- // Depreciated stuff
83
- if($edit_banner->responsive == 'Y')
84
- echo '<div class="error"><p>'. __('This advert uses the obsolete Responsive feature. Please use the more reliable Mobile feature! Saving the advert will disable the responsive option silently.', 'adrotate').'</p></div>';
 
 
 
 
85
  }
86
- }
87
-
88
- // Determine image field
89
- if($edit_banner->imagetype == "field") {
90
- $image_field = $edit_banner->image;
91
- $image_dropdown = '';
92
- } else if($edit_banner->imagetype == "dropdown") {
93
- $image_field = '';
94
- $image_dropdown = $edit_banner->image;
95
- } else {
96
- $image_field = '';
97
- $image_dropdown = '';
98
- }
99
- ?>
100
-
101
- <form method="post" action="admin.php?page=adrotate-ads">
102
- <?php wp_nonce_field('adrotate_save_ad','adrotate_nonce'); ?>
103
- <input type="hidden" name="adrotate_username" value="<?php echo $userdata->user_login;?>" />
104
- <input type="hidden" name="adrotate_id" value="<?php echo $edit_banner->id;?>" />
105
- <input type="hidden" name="adrotate_type" value="<?php echo $edit_banner->type;?>" />
106
- <input type="hidden" name="adrotate_schedule" value="<?php echo $schedule->id;?>" />
107
-
108
- <?php if($edit_banner->type == 'empty') { ?>
109
- <h3><?php _e('New Advert', 'adrotate'); ?></h3>
110
- <?php } else { ?>
111
- <h3><?php _e('Edit Advert', 'adrotate'); ?></h3>
112
- <?php } ?>
113
-
114
- <table class="widefat" style="margin-top: .5em;">
115
- <tbody>
116
- <tr>
117
- <th width="15%"><?php _e('Name', 'adrotate'); ?></th>
118
- <td>
119
- <input tabindex="1" name="adrotate_title" type="text" class="ajdg-fullwidth ajdg-inputfield" value="<?php echo stripslashes($edit_banner->title);?>" autocomplete="off" />
120
- </td>
121
- <td width="35%">
122
- &nbsp;
123
- </td>
124
- </tr>
125
- <tr>
126
- <th valign="top"><?php _e('AdCode', 'adrotate'); ?></th>
127
- <td>
128
- <label for="adrotate_bannercode"><textarea tabindex="2" id="adrotate_bannercode" name="adrotate_bannercode" cols="80" rows="15" class="ajdg-fullwidth"><?php echo stripslashes($edit_banner->bannercode); ?></textarea></label>
129
- </td>
130
- <td width="35%" rowspan="2">
131
- <p><strong><?php _e('Basic Examples:', 'adrotate'); ?></strong></p>
132
- <p><em><?php _e('Click any of the examples to use it.', 'adrotate'); ?></em></p>
133
- <p><em><a href="#" onclick="textatcursor('adrotate_bannercode','&lt;a href=&quot;https://ajdg.solutions/&quot;&gt;&lt;img src=&quot;%asset%&quot; /&gt;&lt;/a&gt;');return false;">&lt;a href="https://ajdg.solutions/"&gt;&lt;img src="%asset%" /&gt;&lt;/a&gt;</a></em></p>
134
- <p><em><a href="#" onclick="textatcursor('adrotate_bannercode','&lt;iframe src=&quot;%asset%&quot; height=&quot;250&quot; frameborder=&quot;0&quot; style=&quot;border:none;&quot;&gt;&lt;/iframe&gt;');return false;">&lt;iframe src=&quot;%asset%&quot; height=&quot;250&quot; frameborder=&quot;0&quot; style=&quot;border:none;&quot;&gt;&lt;/iframe&gt;</a></em></p>
135
- <p><em><a href="#" onclick="textatcursor('adrotate_bannercode','&lt;a href=&quot;http://www.arnan.me/&quot;&gt;Visit arnan.me&lt;/a&gt;');return false;">&lt;a href="http://www.arnan.me/"&gt;Visit arnan.me&lt;/a&gt;</a></em></p>
136
- <p><em><a href="#" onclick="textatcursor('adrotate_bannercode','&lt;a href=&quot;https://ajdg.solutions/&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;%asset%&quot; /&gt;&lt;/a&gt;');return false;">&lt;a href="https://ajdg.solutions/" target=&quot;_blank&quot;&gt;&lt;img src="%asset%" /&gt;&lt;/a&gt;</a></em></p>
137
- <p><em><a href="#" onclick="textatcursor('adrotate_bannercode','&lt;a href=&quot;https://ajdg.solutions/?timestamp=%random%&quot;&gt;&lt;img src=&quot;%asset%&quot; /&gt;&lt;/a&gt;');return false;">&lt;a href="https://ajdg.solutions/?timestamp=%random%"&gt;&lt;img src="%asset%" /&gt;&lt;/a&gt;</a></em></p>
138
- </td>
139
- </tr>
140
- <tr>
141
- <th valign="top"><?php _e('Useful tags', 'adrotate'); ?></th>
142
- <td colspan="2">
143
- <p><em><a href="#" title="<?php _e('Insert the advert ID Number.', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','%id%');return false;">%id%</a>, <a href="#" title="<?php _e('Required when selecting a asset below.', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','%asset%');return false;">%asset%</a>, <a href="#" title="<?php _e('Insert the advert name.', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','%title%');return false;">%title%</a>, <a href="#" title="<?php _e('Insert a random seed. Useful for DFP/DoubleClick type adverts.', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','%random%');return false;">%random%</a>, <a href="#" title="<?php _e('Add inside the <a> tag to open advert in a new window.', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','target=&quot;_blank&quot;');return false;">target="_blank"</a>, <a href="#" title="<?php _e('Add inside the <a> tag to tell crawlers to ignore this link', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','rel=&quot;nofollow&quot;');return false;">rel="nofollow"</a></em><br /><?php _e('Place the cursor in your AdCode where you want to add any of these tags and click to add it.', 'adrotate'); ?></p>
144
- </td>
145
- </tr>
146
- <?php if($edit_banner->type != 'empty') { ?>
147
- <tr>
148
- <th valign="top"><?php _e('Preview', 'adrotate'); ?></th>
149
- <td colspan="3">
150
- <div><?php echo adrotate_preview($edit_banner->id); ?></div>
151
- <br /><em><?php _e('Note: While this preview is an accurate one, it might look different then it does on the website.', 'adrotate'); ?>
152
- <br /><?php _e('This is because of CSS differences. Your themes CSS file is not active here!', 'adrotate'); ?></em>
153
- </td>
154
- </tr>
155
- <?php } ?>
156
- <tr>
157
- <th valign="top"><?php _e('Banner asset', 'adrotate'); ?></th>
158
- <td colspan="3">
159
- <label for="adrotate_image">
160
- <?php _e('WordPress media:', 'adrotate'); ?> <input tabindex="3" id="adrotate_image" type="text" size="50" name="adrotate_image" value="<?php echo $image_field; ?>" class="ajdg-inputfield" /> <input tabindex="4" id="adrotate_image_button" class="button" type="button" value="<?php _e('Select Banner', 'adrotate'); ?>" />
161
- </label><br />
162
- <?php _e('- OR -', 'adrotate'); ?><br />
163
- <label for="adrotate_image_dropdown">
164
- <?php _e('Banner folder:', 'adrotate'); ?> <select tabindex="5" name="adrotate_image_dropdown" style="min-width: 200px;">
165
- <option value=""><?php _e('No image selected', 'adrotate'); ?></option>
166
- <?php echo adrotate_folder_contents($image_dropdown); ?>
167
- </select><br />
168
- </label>
169
- <em><?php _e('Use %asset% in the adcode instead of the file path.', 'adrotate'); ?> <?php _e('Use either the text field or the dropdown. If the textfield has content that field has priority.', 'adrotate'); ?></em>
170
- </td>
171
- </tr>
172
- <?php if($adrotate_config['stats'] > 0) { ?>
173
- <tr>
174
- <th width="15%" valign="top"><?php _e('Statistics', 'adrotate'); ?></th>
175
- <td colspan="3">
176
- <label for="adrotate_tracker"><input tabindex="6" type="checkbox" name="adrotate_tracker" <?php if($edit_banner->tracker == 'Y') { ?>checked="checked" <?php } ?> /> <?php _e('Enable click and impression tracking for this advert.', 'adrotate'); ?> <br />
177
- <em><?php _e('Note: Clicktracking does not work for Javascript adverts such as those provided by Google AdSense/DFP/DoubleClick. HTML5/Flash adverts are not always supported.', 'adrotate'); ?></em>
178
- </label>
179
- </td>
180
- </tr>
181
- <?php } ?>
182
- <tr>
183
- <th><?php _e('Activate', 'adrotate'); ?></th>
184
- <td colspan="3">
185
- <label for="adrotate_active">
186
- <select tabindex="7" name="adrotate_active">
187
- <option value="active" <?php if($edit_banner->type == "active") { echo 'selected'; } ?>><?php _e('Yes, this ad will be used', 'adrotate'); ?></option>
188
- <option value="disabled" <?php if($edit_banner->type == "disabled") { echo 'selected'; } ?>><?php _e('No, do not show this ad anywhere', 'adrotate'); ?></option>
189
- </select>
190
- </label>
191
- </td>
192
- </tr>
193
- </tbody>
194
- </table>
195
- <center><?php _e('Get more features with AdRotate Pro.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!</center>
196
-
197
- <p class="submit">
198
- <input tabindex="8" type="submit" name="adrotate_ad_submit" class="button-primary" value="<?php _e('Save Advert', 'adrotate'); ?>" />
199
- <a href="admin.php?page=adrotate-ads&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
200
- </p>
201
-
202
- <h2><?php _e('Usage', 'adrotate'); ?></h2>
203
- <table class="widefat" style="margin-top: .5em">
204
- <tbody>
205
- <tr>
206
- <th width="15%"><?php _e('Widget', 'adrotate'); ?></th>
207
- <td colspan="3"><?php _e('Drag the AdRotate widget to the sidebar where you want to place the advert and select the advert or the group the advert is in.', 'adrotate'); ?></td>
208
- </tr>
209
- <tr>
210
- <th width="15%"><?php _e('In a post or page', 'adrotate'); ?></th>
211
- <td width="35%">[adrotate banner="<?php echo $edit_banner->id; ?>"]</td>
212
- <th width="15%"><?php _e('Directly in a theme', 'adrotate'); ?></th>
213
- <td>&lt;?php echo adrotate_ad(<?php echo $edit_banner->id; ?>); ?&gt;</td>
214
- </tr>
215
- </tbody>
216
- </table>
217
-
218
- <?php
219
- $partner = mt_rand(1,4);
220
- if($partner < 4) {
221
  ?>
222
- <h2><?php _e('Get adverts from Media.net', 'adrotate'); ?></h2>
223
- <table class="widefat" style="margin-top: .5em">
224
- <tbody>
225
- <tr>
226
- <th width="40%"><center><a href="https://ajdg.solutions/go/medianet/" target="_blank"><img src="<?php echo plugins_url("../images/offers/medianet-large-$partner.jpg", dirname(__FILE__)); ?>" width="440" /></a></center></th>
227
- <td>
228
- <p><a href="https://ajdg.solutions/go/medianet/" target="_blank">Media.net</a> is the <strong>#2 largest contextual ads platform</strong> in the world that provides its publishers with an <strong>exclusive access to the Yahoo! Bing Network of advertisers and $6bn worth of search demand.</strong></p>
229
- <p><a href="https://ajdg.solutions/go/medianet/" target="_blank">Media.net</a> <strong>ads are contextual</strong> and hence always relevant to your content. They are also <strong>native by design</strong> and highly customizable, delivering a great user experience and higher CTRs.</p>
230
- </td>
231
- </tr>
232
- </tbody>
233
- </table>
234
- <?php } else { ?>
235
- <h2><?php _e('Sign up with Blind Ferret', 'adrotate'); ?></h2>
236
- <table class="widefat" style="margin-top: .5em">
237
- <tbody>
238
- <tr>
239
- <th width="40%"><center><a href="https://ajdg.solutions/go/blindferret/" target="_blank"><img src="<?php echo plugins_url("../images/offers/blindferret.jpg", dirname(__FILE__)); ?>" width="440" /></a></center></th>
240
- <td>
241
- <p>At <a href="https://ajdg.solutions/go/blindferret/" target="_blank">Blind Ferret</a>, we are publishers too, which means we know what's needed to create successful campaigns! We know that advertising isn't just "set it and forget it" anymore. Our Publisher Network features a wide range of creative and comic sites, is simple to take advantage of and intensely UI/UX focused.</p>
242
-
243
- <p>With over 15 years of experience, <a href="https://ajdg.solutions/go/blindferret/" target="_blank">Blind Ferret</a> can offer great ads at top dollar via header bidding, ensuring advertisers vie for your ad space, which brings in higher quality ads and makes you more money!</p>
244
- </td>
245
- </tr>
246
- </tbody>
247
- </table>
248
- <?php } ?>
249
-
250
- <h2><?php _e('Schedule your advert', 'adrotate'); ?></h2>
251
- <p><em><?php _e('Time uses a 24 hour clock. When you\'re used to the AM/PM system keep this in mind: If the start or end time is after lunch, add 12 hours. 2PM is 14:00 hours. 6AM is 6:00 hours.', 'adrotate'); ?></em></p>
252
- <table class="widefat" style="margin-top: .5em">
253
- <tbody>
254
- <tr>
255
- <th width="15%"><?php _e('Start date', 'adrotate'); ?> (dd-mm-yyyy)</th>
256
- <td width="35%">
257
- <input tabindex="9" type="text" id="startdate_picker" name="adrotate_start_date" value="<?php echo $start_date; ?>" class="datepicker ajdg-inputfield" autocomplete="off" />
258
- </td>
259
- <th width="15%"><?php _e('End date', 'adrotate'); ?> (dd-mm-yyyy)</th>
260
- <td>
261
- <input tabindex="10" type="text" id="enddate_picker" name="adrotate_end_date" value="<?php echo $end_date; ?>" class="datepicker ajdg-inputfield" autocomplete="off" />
262
- </td>
263
- </tr>
264
- <tr>
265
- <th><?php _e('Start time', 'adrotate'); ?> (hh:mm)</th>
266
- <td>
267
- <label for="adrotate_sday">
268
- <input tabindex="11" name="adrotate_start_hour" class="ajdg-inputfield" type="text" size="2" maxlength="4" value="<?php echo $start_hour; ?>" autocomplete="off" /> :
269
- <input tabindex="12" name="adrotate_start_minute" class="ajdg-inputfield" type="text" size="2" maxlength="4" value="<?php echo $start_hour; ?>" autocomplete="off" />
270
- </label>
271
- </td>
272
- <th><?php _e('End time', 'adrotate'); ?> (hh:mm)</th>
273
- <td>
274
- <label for="adrotate_eday">
275
- <input tabindex="13" name="adrotate_end_hour" class="ajdg-inputfield" type="text" size="2" maxlength="4" value="<?php echo $end_hour; ?>" autocomplete="off" /> :
276
- <input tabindex="14" name="adrotate_end_minute" class="ajdg-inputfield" type="text" size="2" maxlength="4" value="<?php echo $end_minute; ?>" autocomplete="off" />
277
- </label>
278
- </td>
279
- </tr>
280
- <?php if($adrotate_config['stats'] == 1) { ?>
281
- <tr>
282
- <th><?php _e('Maximum Clicks', 'adrotate'); ?></th>
283
- <td><input tabindex="19" name="adrotate_maxclicks" type="text" size="5" class="ajdg-inputfield" autocomplete="off" value="<?php echo $schedule->maxclicks;?>" /> <em><?php _e('Leave empty or 0 to skip this.', 'adrotate'); ?></em></td>
284
- <th><?php _e('Maximum Impressions', 'adrotate'); ?></th>
285
- <td><input tabindex="20" name="adrotate_maxshown" type="text" size="5" class="ajdg-inputfield" autocomplete="off" value="<?php echo $schedule->maximpressions;?>" /> <em><?php _e('Leave empty or 0 to skip this.', 'adrotate'); ?></em></td>
286
- </tr>
287
  <?php } ?>
288
- </tbody>
289
- </table>
290
- <center><?php _e('Create multiple and more advanced schedules for each advert with AdRotate Pro.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!</center>
291
-
292
- <p class="submit">
293
- <input tabindex="21" type="submit" name="adrotate_ad_submit" class="button-primary" value="<?php _e('Save Advert', 'adrotate'); ?>" />
294
- <a href="admin.php?page=adrotate-ads&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
295
- </p>
296
-
297
- <h2><?php _e('Advanced', 'adrotate'); ?></h2>
298
- <p><em><?php _e('Available in AdRotate Pro!', 'adrotate'); ?></em></p>
299
- <table class="widefat" style="margin-top: .5em">
300
-
301
- <tbody>
302
- <tr>
303
- <th width="15%" valign="top"><?php _e('Show to everyone', 'adrotate-pro'); ?></th>
304
- <td colspan="5">
305
- <label for="adrotate_show_everyone"><input type="checkbox" name="adrotate_show_everyone" checked disabled /> <?php _e('Disable this option to hide the advert from logged-in visitors.', 'adrotate-pro'); ?>
306
- </label>
307
- </td>
308
- </tr>
309
- <tr>
310
- <th width="15%" valign="top"><?php _e('Weight', 'adrotate'); ?></th>
311
- <td width="17%">
312
- <label for="adrotate_weight">
313
- <center><input type="radio" disabled name="adrotate_weight" value="2" /><br /><?php _e('Few impressions', 'adrotate'); ?></center>
314
- </label>
315
- </td>
316
- <td width="17%">
317
- <label for="adrotate_weight">
318
- <center><input type="radio" disabled name="adrotate_weight" value="4" /><br /><?php _e('Less than average', 'adrotate'); ?></center>
319
- </label>
320
- </td>
321
- <td width="17%">
322
- <label for="adrotate_weight">
323
- <center><input type="radio" disabled name="adrotate_weight" value="6" checked="1" /><br /><?php _e('Normal impressions', 'adrotate'); ?></center>
324
- </label>
325
- </td>
326
- <td width="17%">
327
- <label for="adrotate_weight">
328
- <center><input type="radio" disabled name="adrotate_weight" value="8" /><br /><?php _e('More than average', 'adrotate'); ?></center>
329
- </label>
330
- </td>
331
- <td>
332
- <label for="adrotate_weight">
333
- <center><input type="radio" disabled name="adrotate_weight" value="10" /><br /><?php _e('Many impressions', 'adrotate'); ?>
334
- </label>
335
- </td>
336
- </tr>
337
- <tr>
338
- <th width="15%" valign="top"><?php _e('Mobile', 'adrotate'); ?></th>
339
- <td>
340
- <label for="adrotate_desktop"><center><input disabled type="checkbox" name="adrotate_desktop" checked="1" /><br /><?php _e('Desktops/Laptops', 'adrotate'); ?></center></label>
341
- </td>
342
- <td>
343
- <label for="adrotate_mobile"><center><input disabled type="checkbox" name="adrotate_mobile" checked="1" /><br /><?php _e('Smartphones', 'adrotate'); ?></center></label>
344
- </td>
345
- <td>
346
- <label for="adrotate_tablet"><center><input disabled type="checkbox" name="adrotate_tablet" checked="1" /><br /><?php _e('Tablets', 'adrotate'); ?></center></label>
347
- </td>
348
- <td colspan="2" rowspan="2">
349
- <em><?php _e("Also enable 'Mobile Support' in the group this advert goes in or 'Device' and 'Operating System' are ignored!", 'adrotate'); ?><br /><?php _e("Operating system detection only detects iOS and Android, select 'Not Mobile/Other' for everything else.", 'adrotate'); ?></em>
350
- </td>
351
- </tr>
352
- <tr>
353
- <th width="15%" valign="top"><?php _e('Mobile OS', 'adrotate'); ?></th>
354
- <td>
355
- <label for="adrotate_ios"><center><input disabled type="checkbox" name="adrotate_ios" checked="1" /><br /><?php _e('iOS', 'adrotate'); ?></center></label>
356
- </td>
357
- <td>
358
- <label for="adrotate_android"><center><input disabled type="checkbox" name="adrotate_android" checked="1" /><br /><?php _e('Android', 'adrotate'); ?></center></label>
359
- </td>
360
- <td>
361
- <label for="adrotate_other"><center><input disabled type="checkbox" name="adrotate_other" checked="1" /><br /><?php _e('Not mobile/Others', 'adrotate'); ?></center></label>
362
- </td>
363
- </tr>
364
- <tr>
365
- <th valign="top"><?php _e('Auto-delete', 'adrotate'); ?></th>
366
- <td colspan="5">
367
- <label for="adrotate_autodelete"><input tabindex="31" type="checkbox" name="adrotate_autodelete" disabled /></label> <?php _e('Automatically delete the advert 1 day after it expires?', 'adrotate'); ?><br /><em><?php _e('This is useful for short running campaigns that do not require attention after they finish.', 'adrotate'); ?></em>
368
- </td>
369
- </tr>
370
- </tbody>
371
- </table>
372
- <center><?php _e('With AdRotate Pro you can easily select which devices and mobile operating systems the advert should show on!', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!</center>
373
-
374
- <h2><?php _e('Geo Targeting', 'adrotate'); ?></h2>
375
- <p><em><?php _e('Assign the advert to a group and enable that group to use Geo Targeting.', 'adrotate'); ?> <?php _e('Available in AdRotate Pro!', 'adrotate'); ?></em></p>
376
-
377
- <div id="dashboard-widgets-wrap">
378
- <div id="dashboard-widgets" class="metabox-holder">
379
- <div id="left-column" class="postbox-container">
380
-
381
- <div class="ajdg-postbox">
382
- <h2 class="ajdg-postbox-title"><?php _e('Select Countries and or Regions', 'adrotate'); ?></h2>
383
- <div id="countries" class="ajdg-postbox-content">
384
- <div class="adrotate-select ajdg-fullwidth">
385
- <table width="100%">
386
- <tbody>
387
- <tr>
388
- <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">United States</td>
389
- </tr>
390
- <tr>
391
- <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">Australia</td>
392
- </tr>
393
- <tr>
394
- <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">Germany</td>
395
- </tr>
396
- <tr>
397
- <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">Brazil</td>
398
- </tr>
399
- <tr>
400
- <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">Japan</td>
401
- </tr>
402
- <tr>
403
- <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">Netherlands</td>
404
- </tr>
405
- <tr>
406
- <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">Mexico</td>
407
- </tr>
408
- <tr>
409
- <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">Canada</td>
410
- </tr>
411
- <tr>
412
- <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">South Africa</td>
413
- </tr>
414
- </tbody>
415
- </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
416
  </div>
417
  </div>
 
418
  </div>
419
-
420
- </div>
421
- <div id="right-column" class="postbox-container">
422
-
423
- <div class="ajdg-postbox">
424
- <h2 class="ajdg-postbox-title"><?php _e('Enter cities, metro IDs, States or State ISO codes', 'adrotate'); ?></h2>
425
- <div id="cities" class="ajdg-postbox-content">
426
- <textarea name="adrotate_geo_cities" cols="40" rows="6" class="ajdg-fullwidth" disabled>Amsterdam, 29022, Noord Holland, New York, California, Tokyo, London, CA, NY, Ohio</textarea><br />
427
- <p><em><?php _e('A comma separated list of items:', 'adrotate'); ?> (Alkmaar, New York, Manila, Tokyo) <?php _e('AdRotate does not check the validity of names so make sure you spell them correctly!', 'adrotate'); ?></em></p>
428
  </div>
 
429
  </div>
430
-
431
  </div>
432
  </div>
433
- </div>
434
-
435
- <div class="clear"></div>
436
- <center><?php _e('Target your audience with Geo Targeting in AdRotate Pro', 'adrotate'); ?>, <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!</center>
437
-
438
- <h3><?php _e('Usage', 'adrotate'); ?></h3>
439
- <table class="widefat" style="margin-top: .5em">
440
- <tbody>
441
- <tr>
442
- <th width="15%"><?php _e('Widget', 'adrotate'); ?></th>
443
- <td colspan="3"><?php _e('Drag the AdRotate widget to the sidebar where you want to place the advert and select the advert or the group the advert is in.', 'adrotate'); ?></td>
444
- </tr>
445
- <tr>
446
- <th width="15%"><?php _e('In a post or page', 'adrotate'); ?></th>
447
- <td width="35%">[adrotate banner="<?php echo $edit_banner->id; ?>"]</td>
448
- <th width="15%"><?php _e('Directly in a theme', 'adrotate'); ?></th>
449
- <td>&lt;?php echo adrotate_ad(<?php echo $edit_banner->id; ?>); ?&gt;</td>
450
- </tr>
451
- </tbody>
452
- </table>
453
-
454
- <p class="submit">
455
- <input tabindex="24" type="submit" name="adrotate_ad_submit" class="button-primary" value="<?php _e('Save Advert', 'adrotate'); ?>" />
456
- <a href="admin.php?page=adrotate-ads&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
457
- </p>
458
-
459
- <?php if($groups) { ?>
460
- <h3><?php _e('Select Groups', 'adrotate'); ?></h3>
461
- <table class="widefat" style="margin-top: .5em">
462
- <thead>
463
- <tr>
464
- <td width="2%" scope="col" class="manage-column column-cb check-column"><input type="checkbox" /></td>
465
- <th width="2%"><center><?php _e('ID', 'adrotate'); ?></center></th>
466
- <th><?php _e('Name', 'adrotate'); ?></th>
467
- <th width="5%"><center><?php _e('Adverts', 'adrotate'); ?></center></th>
468
- </tr>
469
- </thead>
470
-
471
- <tbody>
472
- <?php
473
- $class = '';
474
- foreach($groups as $group) {
475
- if($group->adspeed > 0) $adspeed = $group->adspeed / 1000;
476
- if($group->modus == 0) $modus[] = __('Default', 'adrotate');
477
- if($group->modus == 1) $modus[] = __('Dynamic', 'adrotate').' ('.$adspeed.' '. __('second rotation', 'adrotate').')';
478
- if($group->modus == 2) $modus[] = __('Block', 'adrotate').' ('.$group->gridrows.' x '.$group->gridcolumns.' '. __('grid', 'adrotate').')';
479
- if($group->cat_loc > 0 OR $group->page_loc > 0) $modus[] = __('Post Injection', 'adrotate');
480
- if($group->geo == 1 AND $adrotate_config['enable_geo'] > 0) $modus[] = __('Geolocation', 'adrotate');
481
-
482
- $ads_in_group = $wpdb->get_var("SELECT COUNT(*) FROM `{$wpdb->prefix}adrotate_linkmeta` WHERE `group` = ".$group->id." AND `user` = 0 AND `schedule` = 0;");
483
- $class = ('alternate' != $class) ? 'alternate' : ''; ?>
484
- <tr id='group-<?php echo $group->id; ?>' class=' <?php echo $class; ?>'>
485
- <th class="check-column"><input type="checkbox" name="groupselect[]" value="<?php echo $group->id; ?>" <?php if(in_array($group->id, $meta_array)) echo "checked"; ?> /></th>
486
- <td><center><?php echo $group->id; ?></center></td>
487
- <td><?php echo $group->name; ?><span style="color:#999;"><?php echo '<br /><span style="font-weight:bold;">'.__('Mode', 'adrotate').':</span> '.implode(', ', $modus); ?></span></td>
488
- <td><center><?php echo $ads_in_group; ?></center></td>
489
  </tr>
 
 
 
490
  <?php
491
- unset($modus);
492
- }
493
- ?>
494
- </tbody>
495
- </table>
496
-
497
- <p class="submit">
498
- <input tabindex="25" type="submit" name="adrotate_ad_submit" class="button-primary" value="<?php _e('Save Advert', 'adrotate'); ?>" />
499
- <a href="admin.php?page=adrotate-ads&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
500
- </p>
501
- <?php } ?>
502
- </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
  $ad_edit_id = $edit_id;
23
  }
24
 
25
+ $edit_banner = $wpdb->get_row("SELECT * FROM `{$wpdb->prefix}adrotate` WHERE `id` = '{$ad_edit_id}';");
 
 
 
26
 
27
+ if($edit_banner) {
28
+ $groups = $wpdb->get_results("SELECT * FROM `{$wpdb->prefix}adrotate_groups` WHERE `name` != '' ORDER BY `id` ASC;");
29
+ $schedule = $wpdb->get_row("SELECT `{$wpdb->prefix}adrotate_schedule`.`id`, `starttime`, `stoptime`, `maxclicks`, `maximpressions` FROM `{$wpdb->prefix}adrotate_schedule`, `{$wpdb->prefix}adrotate_linkmeta` WHERE `ad` = '{$edit_banner->id}' AND `group` = 0 AND `user` = 0 AND `schedule` = `{$wpdb->prefix}adrotate_schedule`.`id` ORDER BY `{$wpdb->prefix}adrotate_schedule`.`id` ASC LIMIT 1;");
30
+ $linkmeta = $wpdb->get_results("SELECT `group` FROM `{$wpdb->prefix}adrotate_linkmeta` WHERE `ad` = '{$edit_banner->id}' AND `user` = 0 AND `schedule` = 0;");
31
+
32
+ // Random banner for Media.net
33
+ $partner = mt_rand(1,3);
34
+
35
+ wp_enqueue_media();
36
+ wp_enqueue_script('uploader-hook', plugins_url().'/adrotate/library/uploader-hook.js', array('jquery'));
37
+
38
+ // Set up start and end date
39
+ list($start_day, $start_month, $start_year, $start_hour, $start_minute) = explode(" ", date("d m Y H i", $schedule->starttime));
40
+ list($end_day, $end_month, $end_year, $end_hour, $end_minute) = explode(" ", date("d m Y H i", $schedule->stoptime));
41
+ $start_date = $start_day.'-'.$start_month.'-'.$start_year;
42
+ $end_date = $end_day.'-'.$end_month.'-'.$end_year;
43
+
44
+ $meta_array = array();
45
+ foreach($linkmeta as $meta) {
46
+ $meta_array[] = $meta->group;
47
+ }
48
+
49
+ if($ad_edit_id) {
50
+ if($edit_banner->type != 'empty') {
51
+ // Errors
52
+ if(strlen($edit_banner->bannercode) < 1 AND $edit_banner->type != 'empty')
53
+ echo '<div class="error"><p>'. __('The AdCode cannot be empty!', 'adrotate').'</p></div>';
54
 
55
+ if(!preg_match("/(%image%|%asset%)/i", $edit_banner->bannercode, $things) AND $edit_banner->image != '')
56
+ echo '<div class="error"><p>'. __('You did not use %asset% (or %image%) in your AdCode but did select a file to use!', 'adrotate').'</p></div>';
57
 
58
+ if(preg_match("/(%image%|%asset%)/i", $edit_banner->bannercode, $things) AND $edit_banner->image == '')
59
+ echo '<div class="error"><p>'. __('You did use %asset% (or %image%) in your AdCode but did not select a file to use!', 'adrotate').'</p></div>';
60
+
61
+ if((($edit_banner->imagetype != '' AND $edit_banner->image == '') OR ($edit_banner->imagetype == '' AND $edit_banner->image != '')))
62
+ echo '<div class="error"><p>'. __('There is a problem saving the image. Please reset your image and re-save the ad!', 'adrotate').'</p></div>';
63
+
64
+ if(!preg_match_all('/<(a|script|embed|iframe)[^>](.*?)>/i', stripslashes(htmlspecialchars_decode($edit_banner->bannercode, ENT_QUOTES)), $things) AND $edit_banner->tracker == 'Y')
65
+ echo '<div class="error"><p>'. __("Tracking is enabled but no valid link/tag was found in the adcode!", 'adrotate').'</p></div>';
66
+
67
+ // Ad Notices
68
+ $adstate = adrotate_evaluate_ad($edit_banner->id);
69
+ if($edit_banner->type == 'error' AND $adstate == 'active')
70
+ echo '<div class="error"><p>'. __('AdRotate cannot find an error but the ad is marked erroneous, try re-saving the ad!', 'adrotate').'</p></div>';
71
+
72
+ if($adstate == 'expired')
73
+ echo '<div class="error"><p>'. __('This ad is expired and currently not shown on your website!', 'adrotate').'</p></div>';
74
+
75
+ if($adstate == '2days')
76
+ echo '<div class="updated"><p>'. __('The ad will expire in less than 2 days!', 'adrotate').'</p></div>';
77
+
78
+ if($adstate == '7days')
79
+ echo '<div class="updated"><p>'. __('This ad will expire in less than 7 days!', 'adrotate').'</p></div>';
80
+
81
+ if($edit_banner->type == 'disabled')
82
+ echo '<div class="updated"><p>'. __('This ad has been disabled and does not rotate on your site!', 'adrotate').'</p></div>';
83
+
84
+ // Depreciated stuff
85
+ if($edit_banner->responsive == 'Y')
86
+ echo '<div class="error"><p>'. __('This advert uses the obsolete Responsive feature. Please use the more reliable Mobile feature! Saving the advert will disable the responsive option silently.', 'adrotate').'</p></div>';
87
+ }
88
  }
89
+
90
+ // Determine image field
91
+ if($edit_banner->imagetype == "field") {
92
+ $image_field = $edit_banner->image;
93
+ $image_dropdown = '';
94
+ } else if($edit_banner->imagetype == "dropdown") {
95
+ $image_field = '';
96
+ $image_dropdown = $edit_banner->image;
97
+ } else {
98
+ $image_field = '';
99
+ $image_dropdown = '';
100
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
  ?>
102
+
103
+ <form method="post" action="admin.php?page=adrotate-ads">
104
+ <?php wp_nonce_field('adrotate_save_ad','adrotate_nonce'); ?>
105
+ <input type="hidden" name="adrotate_username" value="<?php echo $userdata->user_login;?>" />
106
+ <input type="hidden" name="adrotate_id" value="<?php echo $edit_banner->id;?>" />
107
+ <input type="hidden" name="adrotate_type" value="<?php echo $edit_banner->type;?>" />
108
+ <input type="hidden" name="adrotate_schedule" value="<?php echo $schedule->id;?>" />
109
+
110
+ <?php if($edit_banner->type == 'empty') { ?>
111
+ <h3><?php _e('New Advert', 'adrotate'); ?></h3>
112
+ <?php } else { ?>
113
+ <h3><?php _e('Edit Advert', 'adrotate'); ?></h3>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  <?php } ?>
115
+
116
+ <table class="widefat" style="margin-top: .5em;">
117
+ <tbody>
118
+ <tr>
119
+ <th width="15%"><?php _e('Name', 'adrotate'); ?></th>
120
+ <td>
121
+ <input tabindex="1" name="adrotate_title" type="text" class="ajdg-fullwidth ajdg-inputfield" value="<?php echo stripslashes($edit_banner->title);?>" autocomplete="off" />
122
+ </td>
123
+ <td width="35%">
124
+ &nbsp;
125
+ </td>
126
+ </tr>
127
+ <tr>
128
+ <th valign="top"><?php _e('AdCode', 'adrotate'); ?></th>
129
+ <td>
130
+ <label for="adrotate_bannercode"><textarea tabindex="2" id="adrotate_bannercode" name="adrotate_bannercode" cols="80" rows="15" class="ajdg-fullwidth"><?php echo stripslashes($edit_banner->bannercode); ?></textarea></label>
131
+ </td>
132
+ <td width="35%" rowspan="2">
133
+ <p><strong><?php _e('Basic Examples:', 'adrotate'); ?></strong></p>
134
+ <p><em><?php _e('Click any of the examples to use it.', 'adrotate'); ?></em></p>
135
+ <p><em><a href="#" onclick="textatcursor('adrotate_bannercode','&lt;a href=&quot;https://ajdg.solutions/&quot;&gt;&lt;img src=&quot;%asset%&quot; /&gt;&lt;/a&gt;');return false;">&lt;a href="https://ajdg.solutions/"&gt;&lt;img src="%asset%" /&gt;&lt;/a&gt;</a></em></p>
136
+ <p><em><a href="#" onclick="textatcursor('adrotate_bannercode','&lt;iframe src=&quot;%asset%&quot; height=&quot;250&quot; frameborder=&quot;0&quot; style=&quot;border:none;&quot;&gt;&lt;/iframe&gt;');return false;">&lt;iframe src=&quot;%asset%&quot; height=&quot;250&quot; frameborder=&quot;0&quot; style=&quot;border:none;&quot;&gt;&lt;/iframe&gt;</a></em></p>
137
+ <p><em><a href="#" onclick="textatcursor('adrotate_bannercode','&lt;a href=&quot;http://www.arnan.me/&quot;&gt;Visit arnan.me&lt;/a&gt;');return false;">&lt;a href="http://www.arnan.me/"&gt;Visit arnan.me&lt;/a&gt;</a></em></p>
138
+ <p><em><a href="#" onclick="textatcursor('adrotate_bannercode','&lt;a href=&quot;https://ajdg.solutions/&quot; target=&quot;_blank&quot;&gt;&lt;img src=&quot;%asset%&quot; /&gt;&lt;/a&gt;');return false;">&lt;a href="https://ajdg.solutions/" target=&quot;_blank&quot;&gt;&lt;img src="%asset%" /&gt;&lt;/a&gt;</a></em></p>
139
+ <p><em><a href="#" onclick="textatcursor('adrotate_bannercode','&lt;a href=&quot;https://ajdg.solutions/?timestamp=%random%&quot;&gt;&lt;img src=&quot;%asset%&quot; /&gt;&lt;/a&gt;');return false;">&lt;a href="https://ajdg.solutions/?timestamp=%random%"&gt;&lt;img src="%asset%" /&gt;&lt;/a&gt;</a></em></p>
140
+ </td>
141
+ </tr>
142
+ <tr>
143
+ <th valign="top"><?php _e('Useful tags', 'adrotate'); ?></th>
144
+ <td colspan="2">
145
+ <p><em><a href="#" title="<?php _e('Insert the advert ID Number.', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','%id%');return false;">%id%</a>, <a href="#" title="<?php _e('Required when selecting a asset below.', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','%asset%');return false;">%asset%</a>, <a href="#" title="<?php _e('Insert the advert name.', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','%title%');return false;">%title%</a>, <a href="#" title="<?php _e('Insert a random seed. Useful for DFP/DoubleClick type adverts.', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','%random%');return false;">%random%</a>, <a href="#" title="<?php _e('Add inside the <a> tag to open advert in a new window.', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','target=&quot;_blank&quot;');return false;">target="_blank"</a>, <a href="#" title="<?php _e('Add inside the <a> tag to tell crawlers to ignore this link', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','rel=&quot;nofollow&quot;');return false;">rel="nofollow"</a></em><br /><?php _e('Place the cursor in your AdCode where you want to add any of these tags and click to add it.', 'adrotate'); ?></p>
146
+ </td>
147
+ </tr>
148
+ <?php if($edit_banner->type != 'empty') { ?>
149
+ <tr>
150
+ <th valign="top"><?php _e('Preview', 'adrotate'); ?></th>
151
+ <td colspan="3">
152
+ <div><?php echo adrotate_preview($edit_banner->id); ?></div>
153
+ <br /><em><?php _e('Note: While this preview is an accurate one, it might look different then it does on the website.', 'adrotate'); ?>
154
+ <br /><?php _e('This is because of CSS differences. Your themes CSS file is not active here!', 'adrotate'); ?></em>
155
+ </td>
156
+ </tr>
157
+ <?php } ?>
158
+ <tr>
159
+ <th valign="top"><?php _e('Banner asset', 'adrotate'); ?></th>
160
+ <td colspan="3">
161
+ <label for="adrotate_image">
162
+ <?php _e('WordPress media:', 'adrotate'); ?> <input tabindex="3" id="adrotate_image" type="text" size="50" name="adrotate_image" value="<?php echo $image_field; ?>" class="ajdg-inputfield" /> <input tabindex="4" id="adrotate_image_button" class="button" type="button" value="<?php _e('Select Banner', 'adrotate'); ?>" />
163
+ </label><br />
164
+ <?php _e('- OR -', 'adrotate'); ?><br />
165
+ <label for="adrotate_image_dropdown">
166
+ <?php _e('Banner folder:', 'adrotate'); ?> <select tabindex="5" name="adrotate_image_dropdown" style="min-width: 200px;">
167
+ <option value=""><?php _e('No image selected', 'adrotate'); ?></option>
168
+ <?php echo adrotate_folder_contents($image_dropdown); ?>
169
+ </select><br />
170
+ </label>
171
+ <em><?php _e('Use %asset% in the adcode instead of the file path.', 'adrotate'); ?> <?php _e('Use either the text field or the dropdown. If the textfield has content that field has priority.', 'adrotate'); ?></em>
172
+ </td>
173
+ </tr>
174
+ <?php if($adrotate_config['stats'] > 0) { ?>
175
+ <tr>
176
+ <th width="15%" valign="top"><?php _e('Statistics', 'adrotate'); ?></th>
177
+ <td colspan="3">
178
+ <label for="adrotate_tracker"><input tabindex="6" type="checkbox" name="adrotate_tracker" <?php if($edit_banner->tracker == 'Y') { ?>checked="checked" <?php } ?> /> <?php _e('Enable click and impression tracking for this advert.', 'adrotate'); ?> <br />
179
+ <em><?php _e('Note: Clicktracking does not work for Javascript adverts such as those provided by Google AdSense/DFP/DoubleClick. HTML5/Flash adverts are not always supported.', 'adrotate'); ?></em>
180
+ </label>
181
+ </td>
182
+ </tr>
183
+ <?php } ?>
184
+ <tr>
185
+ <th><?php _e('Activate', 'adrotate'); ?></th>
186
+ <td colspan="3">
187
+ <label for="adrotate_active">
188
+ <select tabindex="7" name="adrotate_active">
189
+ <option value="active" <?php if($edit_banner->type == "active") { echo 'selected'; } ?>><?php _e('Yes, this ad will be used', 'adrotate'); ?></option>
190
+ <option value="disabled" <?php if($edit_banner->type == "disabled") { echo 'selected'; } ?>><?php _e('No, do not show this ad anywhere', 'adrotate'); ?></option>
191
+ </select>
192
+ </label>
193
+ </td>
194
+ </tr>
195
+ </tbody>
196
+ </table>
197
+ <center><?php _e('Get more features with AdRotate Pro.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!</center>
198
+
199
+ <p class="submit">
200
+ <input tabindex="8" type="submit" name="adrotate_ad_submit" class="button-primary" value="<?php _e('Save Advert', 'adrotate'); ?>" />
201
+ <a href="admin.php?page=adrotate-ads&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
202
+ </p>
203
+
204
+ <h2><?php _e('Usage', 'adrotate'); ?></h2>
205
+ <table class="widefat" style="margin-top: .5em">
206
+ <tbody>
207
+ <tr>
208
+ <th width="15%"><?php _e('Widget', 'adrotate'); ?></th>
209
+ <td colspan="3"><?php _e('Drag the AdRotate widget to the sidebar where you want to place the advert and select the advert or the group the advert is in.', 'adrotate'); ?></td>
210
+ </tr>
211
+ <tr>
212
+ <th width="15%"><?php _e('In a post or page', 'adrotate'); ?></th>
213
+ <td width="35%">[adrotate banner="<?php echo $edit_banner->id; ?>"]</td>
214
+ <th width="15%"><?php _e('Directly in a theme', 'adrotate'); ?></th>
215
+ <td>&lt;?php echo adrotate_ad(<?php echo $edit_banner->id; ?>); ?&gt;</td>
216
+ </tr>
217
+ </tbody>
218
+ </table>
219
+
220
+ <?php
221
+ $partner = mt_rand(1,4);
222
+ if($partner < 4) {
223
+ ?>
224
+ <h2><?php _e('Get your adverts from Media.net', 'adrotate'); ?></h2>
225
+ <table class="widefat" style="margin-top: .5em">
226
+ <tbody>
227
+ <tr>
228
+ <th width="40%"><center><a href="https://ajdg.solutions/go/medianet/" target="_blank"><img src="<?php echo plugins_url("../images/offers/medianet-large-$partner.jpg", dirname(__FILE__)); ?>" width="440" /></a></center></th>
229
+ <td>
230
+ <p><a href="https://ajdg.solutions/go/medianet/" target="_blank">Media.net</a> is the <strong>#2 largest contextual ads platform</strong> in the world that provides its publishers with an <strong>exclusive access to the Yahoo! Bing Network of advertisers and $6bn worth of search demand.</strong></p>
231
+ <p><a href="https://ajdg.solutions/go/medianet/" target="_blank">Media.net</a> <strong>ads are contextual</strong> and hence always relevant to your content. They are also <strong>native by design</strong> and highly customizable, delivering a great user experience and higher CTRs.</p>
232
+ </td>
233
+ </tr>
234
+ </tbody>
235
+ </table>
236
+ <?php } else { ?>
237
+ <h2><?php _e('Sign up with Blind Ferret', 'adrotate'); ?></h2>
238
+ <table class="widefat" style="margin-top: .5em">
239
+ <tbody>
240
+ <tr>
241
+ <th width="40%"><center><a href="https://ajdg.solutions/go/blindferret/" target="_blank"><img src="<?php echo plugins_url("../images/offers/blindferret.jpg", dirname(__FILE__)); ?>" width="440" /></a></center></th>
242
+ <td>
243
+ <p>At <a href="https://ajdg.solutions/go/blindferret/" target="_blank">Blind Ferret</a>, we are publishers too, which means we know what's needed to create successful campaigns! We know that advertising isn't just "set it and forget it" anymore. Our Publisher Network features a wide range of creative and comic sites, is simple to take advantage of and intensely UI/UX focused.</p>
244
+
245
+ <p>With over 15 years of experience, <a href="https://ajdg.solutions/go/blindferret/" target="_blank">Blind Ferret</a> can offer great ads at top dollar via header bidding, ensuring advertisers vie for your ad space, which brings in higher quality ads and makes you more money!</p>
246
+ </td>
247
+ </tr>
248
+ </tbody>
249
+ </table>
250
+ <?php } ?>
251
+
252
+ <h2><?php _e('Schedule your advert', 'adrotate'); ?></h2>
253
+ <p><em><?php _e('Time uses a 24 hour clock. When you\'re used to the AM/PM system keep this in mind: If the start or end time is after lunch, add 12 hours. 2PM is 14:00 hours. 6AM is 6:00 hours.', 'adrotate'); ?></em></p>
254
+ <table class="widefat" style="margin-top: .5em">
255
+ <tbody>
256
+ <tr>
257
+ <th width="15%"><?php _e('Start date', 'adrotate'); ?> (dd-mm-yyyy)</th>
258
+ <td width="35%">
259
+ <input tabindex="9" type="text" id="startdate_picker" name="adrotate_start_date" value="<?php echo $start_date; ?>" class="datepicker ajdg-inputfield" autocomplete="off" />
260
+ </td>
261
+ <th width="15%"><?php _e('End date', 'adrotate'); ?> (dd-mm-yyyy)</th>
262
+ <td>
263
+ <input tabindex="10" type="text" id="enddate_picker" name="adrotate_end_date" value="<?php echo $end_date; ?>" class="datepicker ajdg-inputfield" autocomplete="off" />
264
+ </td>
265
+ </tr>
266
+ <tr>
267
+ <th><?php _e('Start time', 'adrotate'); ?> (hh:mm)</th>
268
+ <td>
269
+ <label for="adrotate_sday">
270
+ <input tabindex="11" name="adrotate_start_hour" class="ajdg-inputfield" type="text" size="2" maxlength="4" value="<?php echo $start_hour; ?>" autocomplete="off" /> :
271
+ <input tabindex="12" name="adrotate_start_minute" class="ajdg-inputfield" type="text" size="2" maxlength="4" value="<?php echo $start_hour; ?>" autocomplete="off" />
272
+ </label>
273
+ </td>
274
+ <th><?php _e('End time', 'adrotate'); ?> (hh:mm)</th>
275
+ <td>
276
+ <label for="adrotate_eday">
277
+ <input tabindex="13" name="adrotate_end_hour" class="ajdg-inputfield" type="text" size="2" maxlength="4" value="<?php echo $end_hour; ?>" autocomplete="off" /> :
278
+ <input tabindex="14" name="adrotate_end_minute" class="ajdg-inputfield" type="text" size="2" maxlength="4" value="<?php echo $end_minute; ?>" autocomplete="off" />
279
+ </label>
280
+ </td>
281
+ </tr>
282
+ <?php if($adrotate_config['stats'] == 1) { ?>
283
+ <tr>
284
+ <th><?php _e('Maximum Clicks', 'adrotate'); ?></th>
285
+ <td><input tabindex="19" name="adrotate_maxclicks" type="text" size="5" class="ajdg-inputfield" autocomplete="off" value="<?php echo $schedule->maxclicks;?>" /> <em><?php _e('Leave empty or 0 to skip this.', 'adrotate'); ?></em></td>
286
+ <th><?php _e('Maximum Impressions', 'adrotate'); ?></th>
287
+ <td><input tabindex="20" name="adrotate_maxshown" type="text" size="5" class="ajdg-inputfield" autocomplete="off" value="<?php echo $schedule->maximpressions;?>" /> <em><?php _e('Leave empty or 0 to skip this.', 'adrotate'); ?></em></td>
288
+ </tr>
289
+ <?php } ?>
290
+ </tbody>
291
+ </table>
292
+ <center><?php _e('Create multiple and more advanced schedules for each advert with AdRotate Pro.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!</center>
293
+
294
+ <p class="submit">
295
+ <input tabindex="21" type="submit" name="adrotate_ad_submit" class="button-primary" value="<?php _e('Save Advert', 'adrotate'); ?>" />
296
+ <a href="admin.php?page=adrotate-ads&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
297
+ </p>
298
+
299
+ <h2><?php _e('Advanced', 'adrotate'); ?></h2>
300
+ <p><em><?php _e('Available in AdRotate Pro!', 'adrotate'); ?></em></p>
301
+ <table class="widefat" style="margin-top: .5em">
302
+
303
+ <tbody>
304
+ <tr>
305
+ <th width="15%" valign="top"><?php _e('Show to everyone', 'adrotate-pro'); ?></th>
306
+ <td colspan="5">
307
+ <label for="adrotate_show_everyone"><input type="checkbox" name="adrotate_show_everyone" checked disabled /> <?php _e('Disable this option to hide the advert from logged-in visitors.', 'adrotate-pro'); ?>
308
+ </label>
309
+ </td>
310
+ </tr>
311
+ <tr>
312
+ <th width="15%" valign="top"><?php _e('Weight', 'adrotate'); ?></th>
313
+ <td width="17%">
314
+ <label for="adrotate_weight">
315
+ <center><input type="radio" disabled name="adrotate_weight" value="2" /><br /><?php _e('Few impressions', 'adrotate'); ?></center>
316
+ </label>
317
+ </td>
318
+ <td width="17%">
319
+ <label for="adrotate_weight">
320
+ <center><input type="radio" disabled name="adrotate_weight" value="4" /><br /><?php _e('Less than average', 'adrotate'); ?></center>
321
+ </label>
322
+ </td>
323
+ <td width="17%">
324
+ <label for="adrotate_weight">
325
+ <center><input type="radio" disabled name="adrotate_weight" value="6" checked="1" /><br /><?php _e('Normal impressions', 'adrotate'); ?></center>
326
+ </label>
327
+ </td>
328
+ <td width="17%">
329
+ <label for="adrotate_weight">
330
+ <center><input type="radio" disabled name="adrotate_weight" value="8" /><br /><?php _e('More than average', 'adrotate'); ?></center>
331
+ </label>
332
+ </td>
333
+ <td>
334
+ <label for="adrotate_weight">
335
+ <center><input type="radio" disabled name="adrotate_weight" value="10" /><br /><?php _e('Many impressions', 'adrotate'); ?>
336
+ </label>
337
+ </td>
338
+ </tr>
339
+ <tr>
340
+ <th width="15%" valign="top"><?php _e('Mobile', 'adrotate'); ?></th>
341
+ <td>
342
+ <label for="adrotate_desktop"><center><input disabled type="checkbox" name="adrotate_desktop" checked="1" /><br /><?php _e('Desktops/Laptops', 'adrotate'); ?></center></label>
343
+ </td>
344
+ <td>
345
+ <label for="adrotate_mobile"><center><input disabled type="checkbox" name="adrotate_mobile" checked="1" /><br /><?php _e('Smartphones', 'adrotate'); ?></center></label>
346
+ </td>
347
+ <td>
348
+ <label for="adrotate_tablet"><center><input disabled type="checkbox" name="adrotate_tablet" checked="1" /><br /><?php _e('Tablets', 'adrotate'); ?></center></label>
349
+ </td>
350
+ <td colspan="2" rowspan="2">
351
+ <em><?php _e("Also enable 'Mobile Support' in the group this advert goes in or 'Device' and 'Operating System' are ignored!", 'adrotate'); ?><br /><?php _e("Operating system detection only detects iOS and Android, select 'Not Mobile/Other' for everything else.", 'adrotate'); ?></em>
352
+ </td>
353
+ </tr>
354
+ <tr>
355
+ <th width="15%" valign="top"><?php _e('Mobile OS', 'adrotate'); ?></th>
356
+ <td>
357
+ <label for="adrotate_ios"><center><input disabled type="checkbox" name="adrotate_ios" checked="1" /><br /><?php _e('iOS', 'adrotate'); ?></center></label>
358
+ </td>
359
+ <td>
360
+ <label for="adrotate_android"><center><input disabled type="checkbox" name="adrotate_android" checked="1" /><br /><?php _e('Android', 'adrotate'); ?></center></label>
361
+ </td>
362
+ <td>
363
+ <label for="adrotate_other"><center><input disabled type="checkbox" name="adrotate_other" checked="1" /><br /><?php _e('Not mobile/Others', 'adrotate'); ?></center></label>
364
+ </td>
365
+ </tr>
366
+ <tr>
367
+ <th valign="top"><?php _e('Auto-delete', 'adrotate'); ?></th>
368
+ <td colspan="5">
369
+ <label for="adrotate_autodelete"><input tabindex="31" type="checkbox" name="adrotate_autodelete" disabled /></label> <?php _e('Automatically delete the advert 1 day after it expires?', 'adrotate'); ?><br /><em><?php _e('This is useful for short running campaigns that do not require attention after they finish.', 'adrotate'); ?></em>
370
+ </td>
371
+ </tr>
372
+ </tbody>
373
+ </table>
374
+ <center><?php _e('With AdRotate Pro you can easily select which devices and mobile operating systems the advert should show on!', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!</center>
375
+
376
+ <h2><?php _e('Geo Targeting', 'adrotate'); ?></h2>
377
+ <p><em><?php _e('Assign the advert to a group and enable that group to use Geo Targeting.', 'adrotate'); ?> <?php _e('Available in AdRotate Pro!', 'adrotate'); ?></em></p>
378
+
379
+ <div id="dashboard-widgets-wrap">
380
+ <div id="dashboard-widgets" class="metabox-holder">
381
+ <div id="left-column" class="ajdg-postbox-container">
382
+
383
+ <div class="ajdg-postbox">
384
+ <h2 class="ajdg-postbox-title"><?php _e('Select Countries and or Regions', 'adrotate'); ?></h2>
385
+ <div id="countries" class="ajdg-postbox-content">
386
+ <div class="adrotate-select ajdg-fullwidth">
387
+ <table width="100%">
388
+ <tbody>
389
+ <tr>
390
+ <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">United States</td>
391
+ </tr>
392
+ <tr>
393
+ <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">Australia</td>
394
+ </tr>
395
+ <tr>
396
+ <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">Germany</td>
397
+ </tr>
398
+ <tr>
399
+ <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">Brazil</td>
400
+ </tr>
401
+ <tr>
402
+ <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">Japan</td>
403
+ </tr>
404
+ <tr>
405
+ <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">Netherlands</td>
406
+ </tr>
407
+ <tr>
408
+ <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">Mexico</td>
409
+ </tr>
410
+ <tr>
411
+ <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">Canada</td>
412
+ </tr>
413
+ <tr>
414
+ <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">South Africa</td>
415
+ </tr>
416
+ </tbody>
417
+ </table>
418
+ </div>
419
  </div>
420
  </div>
421
+
422
  </div>
423
+ <div id="right-column" class="ajdg-postbox-container">
424
+
425
+ <div class="ajdg-postbox">
426
+ <h2 class="ajdg-postbox-title"><?php _e('Enter cities, metro IDs, States or State ISO codes', 'adrotate'); ?></h2>
427
+ <div id="cities" class="ajdg-postbox-content">
428
+ <textarea name="adrotate_geo_cities" cols="40" rows="6" class="ajdg-fullwidth" disabled>Amsterdam, 29022, Noord Holland, New York, California, Tokyo, London, CA, NY, Ohio</textarea><br />
429
+ <p><em><?php _e('A comma separated list of items:', 'adrotate'); ?> (Alkmaar, New York, Manila, Tokyo) <?php _e('AdRotate does not check the validity of names so make sure you spell them correctly!', 'adrotate'); ?></em></p>
430
+ </div>
 
431
  </div>
432
+
433
  </div>
 
434
  </div>
435
  </div>
436
+
437
+ <div class="clear"></div>
438
+ <center><?php _e('Target your audience with Geo Targeting in AdRotate Pro', 'adrotate'); ?>, <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!</center>
439
+
440
+ <h3><?php _e('Usage', 'adrotate'); ?></h3>
441
+ <table class="widefat" style="margin-top: .5em">
442
+ <tbody>
443
+ <tr>
444
+ <th width="15%"><?php _e('Widget', 'adrotate'); ?></th>
445
+ <td colspan="3"><?php _e('Drag the AdRotate widget to the sidebar where you want to place the advert and select the advert or the group the advert is in.', 'adrotate'); ?></td>
446
+ </tr>
447
+ <tr>
448
+ <th width="15%"><?php _e('In a post or page', 'adrotate'); ?></th>
449
+ <td width="35%">[adrotate banner="<?php echo $edit_banner->id; ?>"]</td>
450
+ <th width="15%"><?php _e('Directly in a theme', 'adrotate'); ?></th>
451
+ <td>&lt;?php echo adrotate_ad(<?php echo $edit_banner->id; ?>); ?&gt;</td>
452
+ </tr>
453
+ </tbody>
454
+ </table>
455
+
456
+ <p class="submit">
457
+ <input tabindex="24" type="submit" name="adrotate_ad_submit" class="button-primary" value="<?php _e('Save Advert', 'adrotate'); ?>" />
458
+ <a href="admin.php?page=adrotate-ads&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
459
+ </p>
460
+
461
+ <?php if($groups) { ?>
462
+ <h3><?php _e('Select Groups', 'adrotate'); ?></h3>
463
+ <table class="widefat" style="margin-top: .5em">
464
+ <thead>
465
+ <tr>
466
+ <td width="2%" scope="col" class="manage-column column-cb check-column"><input type="checkbox" /></td>
467
+ <th width="2%"><center><?php _e('ID', 'adrotate'); ?></center></th>
468
+ <th><?php _e('Name', 'adrotate'); ?></th>
469
+ <th width="5%"><center><?php _e('Adverts', 'adrotate'); ?></center></th>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
470
  </tr>
471
+ </thead>
472
+
473
+ <tbody>
474
  <?php
475
+ $class = '';
476
+ foreach($groups as $group) {
477
+ if($group->adspeed > 0) $adspeed = $group->adspeed / 1000;
478
+ if($group->modus == 0) $modus[] = __('Default', 'adrotate');
479
+ if($group->modus == 1) $modus[] = __('Dynamic', 'adrotate').' ('.$adspeed.' '. __('second rotation', 'adrotate').')';
480
+ if($group->modus == 2) $modus[] = __('Block', 'adrotate').' ('.$group->gridrows.' x '.$group->gridcolumns.' '. __('grid', 'adrotate').')';
481
+ if($group->cat_loc > 0 OR $group->page_loc > 0) $modus[] = __('Post Injection', 'adrotate');
482
+ if($group->geo == 1 AND $adrotate_config['enable_geo'] > 0) $modus[] = __('Geolocation', 'adrotate');
483
+
484
+ $ads_in_group = $wpdb->get_var("SELECT COUNT(*) FROM `{$wpdb->prefix}adrotate_linkmeta` WHERE `group` = ".$group->id." AND `user` = 0 AND `schedule` = 0;");
485
+ $class = ('alternate' != $class) ? 'alternate' : ''; ?>
486
+ <tr id='group-<?php echo $group->id; ?>' class=' <?php echo $class; ?>'>
487
+ <th class="check-column"><input type="checkbox" name="groupselect[]" value="<?php echo $group->id; ?>" <?php if(in_array($group->id, $meta_array)) echo "checked"; ?> /></th>
488
+ <td><center><?php echo $group->id; ?></center></td>
489
+ <td><?php echo $group->name; ?><span style="color:#999;"><?php echo '<br /><span style="font-weight:bold;">'.__('Mode', 'adrotate').':</span> '.implode(', ', $modus); ?></span></td>
490
+ <td><center><?php echo $ads_in_group; ?></center></td>
491
+ </tr>
492
+ <?php
493
+ unset($modus);
494
+ }
495
+ ?>
496
+ </tbody>
497
+ </table>
498
+
499
+ <p class="submit">
500
+ <input tabindex="25" type="submit" name="adrotate_ad_submit" class="button-primary" value="<?php _e('Save Advert', 'adrotate'); ?>" />
501
+ <a href="admin.php?page=adrotate-ads&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
502
+ </p>
503
+ <?php } ?>
504
+ </form>
505
+ <?php
506
+ } else {
507
+ echo adrotate_error('error_loading_item');
508
+ }
509
+ ?>
dashboard/publisher/adverts-generator.php CHANGED
@@ -22,125 +22,131 @@ if(!$ad_edit_id) {
22
  $ad_edit_id = $edit_id;
23
  }
24
 
25
- $edit_banner = $wpdb->get_row("SELECT * FROM `{$wpdb->prefix}adrotate` WHERE `id` = '$ad_edit_id';");
26
 
27
- wp_enqueue_media();
28
- wp_enqueue_script('uploader-hook', plugins_url().'/adrotate-pro/library/uploader-hook.js', array('jquery'));
29
- ?>
30
-
31
- <form method="post" action="admin.php?page=adrotate-ads">
32
- <?php wp_nonce_field('adrotate_generate_ad','adrotate_nonce'); ?>
33
- <input type="hidden" name="adrotate_id" value="<?php echo $edit_banner->id;?>" />
34
-
35
- <h2><?php _e('Generate Advert Code', 'adrotate'); ?></h2>
36
- <p><?php _e('Use the Generator if you have received a target url, banner image and/or some separate files with a description on how to use those. The AdRotate Generator will take your bits and pieces and try to generate a working adcode from it.', 'adrotate'); ?></p>
37
-
38
- <p><?php _e('If you have a complete and working ad code / ad tag you do not use the Generator. You can simply paste that code in the AdCode field when creating your advert. For example as provided by Media.net or Google AdSense among others.', 'adrotate'); ?></p>
39
-
40
- <h2><?php _e('Create your advert', 'adrotate'); ?></h2>
41
- <em><?php _e('This is a regular advert consisting of an image and a link, made up from HTML code.', 'adrotate'); ?></em>
42
- <table class="widefat" style="margin-top: .5em">
43
-
44
- <thead>
45
- <tr>
46
- <th colspan="2"><strong><?php _e('Required', 'adrotate'); ?></strong></th>
47
- </tr>
48
- </thead>
49
-
50
- <tbody>
51
- <tr>
52
- <th valign="top"><?php _e('Banner image', 'adrotate'); ?></th>
53
- <td>
54
- <label for="adrotate_fullsize_dropdown">
55
- <select tabindex="1" id="adrotate_fullsize_dropdown" name="adrotate_fullsize_dropdown" style="min-width: 300px;">
56
- <option value=""><?php _e('Select advert image', 'adrotate'); ?></option>
57
- <?php echo adrotate_folder_contents('', 'image'); ?>
58
- </select> <?php _e('Is your file not listed? Upload it via the AdRotate Media Manager.', 'adrotate'); ?>
59
- </label>
60
- </td>
61
- </tr>
62
- <tr>
63
- <th width="15%" valign="top"><?php _e('Target website', 'adrotate'); ?></th>
64
- <td>
65
- <label for="adrotate_targeturl"><input tabindex="2" id="adrotate_targeturl" name="adrotate_targeturl" type="text" size="60" class="ajdg-inputfield" value="" autocomplete="off" /> <?php _e('Where does the person clicking the advert go?', 'adrotate'); ?></label>
66
- </td>
67
- </tr>
68
- </tbody>
69
-
70
- <thead>
71
- <tr>
72
- <th colspan="2"><strong><?php _e('Viewports', 'adrotate'); ?> - <?php _e('Available in AdRotate Pro', 'adrotate'); ?></strong></th>
73
- </tr>
74
- </thead>
75
-
76
- <tbody>
77
- <tr>
78
- <th valign="top"><?php _e('Smaller Devices', 'adrotate'); ?></th>
79
- <td>
80
- <label for="adrotate_small_dropdown">
81
- <select tabindex="3" id="adrotate_small_dropdown" name="adrotate_small_dropdown" style="min-width: 300px;" disabled>
82
- <option value=""><?php _e('No file selected', 'adrotate'); ?></option>
83
- </select> <em><?php _e('Smaller smartphones and tablets with a viewport of up to 480px wide (up-to 1440px resolution).', 'adrotate'); ?></em>
84
- </label>
85
- </td>
86
- </tr>
87
- <tr>
88
- <th valign="top"><?php _e('Medium sized Devices', 'adrotate'); ?></th>
89
- <td>
90
- <label for="adrotate_medium_dropdown">
91
- <select tabindex="4" id="adrotate_medium_dropdown" name="adrotate_medium_dropdown" style="min-width: 300px;" disabled>
92
- <option value=""><?php _e('No file selected', 'adrotate'); ?></option>
93
- </select> <em><?php _e('Larger smartphones or Small tablets with a viewport of up to 960px wide (up-to 1536px resolution).', 'adrotate'); ?></em>
94
- </label>
95
- </td>
96
- </tr>
97
- <tr>
98
- <th valign="top"><?php _e('Larger Devices', 'adrotate'); ?></th>
99
- <td>
100
- <label for="adrotate_large_dropdown">
101
- <select tabindex="5" id="adrotate_large_dropdown" name="adrotate_large_dropdown" style="min-width: 300px;" disabled>
102
- <option value=""><?php _e('No file selected', 'adrotate'); ?></option>
103
- </select> <em><?php _e('Small laptops and Larger tablets with a viewport of up to 1280px wide (up-to 2048px resolution).', 'adrotate'); ?></em>
104
- </label>
105
- </td>
106
- </tr>
107
- <tr>
108
- <td colspan="2"><strong><?php _e('Important:', 'adrotate'); ?></strong> <?php _e('All sizes are optional, but it is highly recommended to use at least the small and medium size. Devices with viewports greater than 1280px will use the full sized banner.', 'adrotate'); ?><br /><?php _e('Are your files not listed? Upload them via the AdRotate Media Manager. For your convenience, use easy to use filenames.', 'adrotate'); ?></td>
109
- </tr>
110
-
111
- <thead>
112
- <tr>
113
- <th colspan="2"><strong><?php _e('Optional', 'adrotate'); ?></strong></th>
114
- </tr>
115
- </thead>
116
-
117
- <tbody>
118
- <tr>
119
- <th valign="top"><?php _e('Target window', 'adrotate'); ?></th>
120
- <td>
121
- <label for="adrotate_newwindow"><input tabindex="6" type="checkbox" name="adrotate_newwindow" checked="1" /></label> <?php _e('Open the advert in a new window?', 'adrotate'); ?> <?php _e('(Recommended)', 'adrotate'); ?>
122
- </td>
123
- </tr>
124
- <tr>
125
- <th valign="top"><?php _e('NoFollow', 'adrotate'); ?></th>
126
- <td>
127
- <label for="adrotate_nofollow"><input tabindex="7" type="checkbox" name="adrotate_nofollow" disabled /></label> <?php _e('Tell crawlers and search engines not to follow the target website url?', 'adrotate'); ?> <?php _e('(Available in AdRotate Pro)', 'adrotate'); ?><br /><em><?php _e('Letting bots (Such as Googlebot) index paid links may negatively affect your SEO and PageRank.', 'adrotate'); ?></em>
128
- </td>
129
- </tr>
130
- <tr>
131
- <th valign="top"><?php _e('Alt and Title', 'adrotate'); ?></th>
132
- <td>
133
- <label for="adrotate_title_attr"><input tabindex="8" type="checkbox" name="adrotate_title_attr" disabled /></label> <?php _e('Add an alt and title attribute based on the asset name?', 'adrotate'); ?> <?php _e('(Available in AdRotate Pro)', 'adrotate'); ?><br /><em><?php _e('Some bots/crawlers use them as a descriptive measure to see what the code is about.', 'adrotate'); ?></em>
134
- </td>
135
- </tr>
136
- </tbody>
137
-
138
- </table>
139
-
140
- <p class="submit">
141
- <input tabindex="8" type="submit" name="adrotate_generate_submit" class="button-primary" value="<?php _e('Generate and Configure Advert', 'adrotate'); ?>" />
142
- <a href="admin.php?page=adrotate-ads&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a> <?php _e('Always test your adverts before activating them.', 'adrotate'); ?>
143
- </p>
144
-
145
- <p><em><strong><?php _e('NOTE:', 'adrotate'); ?></strong> <?php _e('While the Code Generator has been tested and works, code generation, as always, is a interpretation of user input. If you provide the correct bits and pieces, a working advert may be generated. If you leave fields empty or insert the wrong info you probably end up with a broken advert.', 'adrotate'); ?><br /><?php _e('Based on your input and experiences later iterations of the Code Generator will be better and more feature rich.', 'adrotate'); ?></em></p>
146
- </form>
 
 
 
 
 
 
22
  $ad_edit_id = $edit_id;
23
  }
24
 
25
+ $edit_banner = $wpdb->get_row("SELECT * FROM `{$wpdb->prefix}adrotate` WHERE `id` = '{$ad_edit_id}';");
26
 
27
+ if($edit_banner) {
28
+ wp_enqueue_media();
29
+ wp_enqueue_script('uploader-hook', plugins_url().'/adrotate-pro/library/uploader-hook.js', array('jquery'));
30
+ ?>
31
+
32
+ <form method="post" action="admin.php?page=adrotate-ads">
33
+ <?php wp_nonce_field('adrotate_generate_ad','adrotate_nonce'); ?>
34
+ <input type="hidden" name="adrotate_id" value="<?php echo $edit_banner->id;?>" />
35
+
36
+ <h2><?php _e('Generate Advert Code', 'adrotate'); ?></h2>
37
+ <p><?php _e('Use the Generator if you have received a target url, banner image and/or some separate files with a description on how to use those. The AdRotate Generator will take your bits and pieces and try to generate a working adcode from it.', 'adrotate'); ?></p>
38
+
39
+ <p><?php _e('If you have a complete and working ad code / ad tag you do not use the Generator. You can simply paste that code in the AdCode field when creating your advert. For example as provided by Media.net or Google AdSense among others.', 'adrotate'); ?></p>
40
+
41
+ <h2><?php _e('Create your advert', 'adrotate'); ?></h2>
42
+ <em><?php _e('This is a regular advert consisting of an image and a link, made up from HTML code.', 'adrotate'); ?></em>
43
+ <table class="widefat" style="margin-top: .5em">
44
+
45
+ <thead>
46
+ <tr>
47
+ <th colspan="2"><strong><?php _e('Required', 'adrotate'); ?></strong></th>
48
+ </tr>
49
+ </thead>
50
+
51
+ <tbody>
52
+ <tr>
53
+ <th valign="top"><?php _e('Banner image', 'adrotate'); ?></th>
54
+ <td>
55
+ <label for="adrotate_fullsize_dropdown">
56
+ <select tabindex="1" id="adrotate_fullsize_dropdown" name="adrotate_fullsize_dropdown" style="min-width: 300px;">
57
+ <option value=""><?php _e('Select advert image', 'adrotate'); ?></option>
58
+ <?php echo adrotate_folder_contents('', 'image'); ?>
59
+ </select> <?php _e('Is your file not listed? Upload it via the AdRotate Media Manager.', 'adrotate'); ?>
60
+ </label>
61
+ </td>
62
+ </tr>
63
+ <tr>
64
+ <th width="15%" valign="top"><?php _e('Target website', 'adrotate'); ?></th>
65
+ <td>
66
+ <label for="adrotate_targeturl"><input tabindex="2" id="adrotate_targeturl" name="adrotate_targeturl" type="text" size="60" class="ajdg-inputfield" value="" autocomplete="off" /> <?php _e('Where does the person clicking the advert go?', 'adrotate'); ?></label>
67
+ </td>
68
+ </tr>
69
+ </tbody>
70
+
71
+ <thead>
72
+ <tr>
73
+ <th colspan="2"><strong><?php _e('Viewports', 'adrotate'); ?> - <?php _e('Available in AdRotate Pro', 'adrotate'); ?></strong></th>
74
+ </tr>
75
+ </thead>
76
+
77
+ <tbody>
78
+ <tr>
79
+ <th valign="top"><?php _e('Smaller Devices', 'adrotate'); ?></th>
80
+ <td>
81
+ <label for="adrotate_small_dropdown">
82
+ <select tabindex="3" id="adrotate_small_dropdown" name="adrotate_small_dropdown" style="min-width: 300px;" disabled>
83
+ <option value=""><?php _e('No file selected', 'adrotate'); ?></option>
84
+ </select> <em><?php _e('Smaller smartphones and tablets with a viewport of up to 480px wide (up-to 1440px resolution).', 'adrotate'); ?></em>
85
+ </label>
86
+ </td>
87
+ </tr>
88
+ <tr>
89
+ <th valign="top"><?php _e('Medium sized Devices', 'adrotate'); ?></th>
90
+ <td>
91
+ <label for="adrotate_medium_dropdown">
92
+ <select tabindex="4" id="adrotate_medium_dropdown" name="adrotate_medium_dropdown" style="min-width: 300px;" disabled>
93
+ <option value=""><?php _e('No file selected', 'adrotate'); ?></option>
94
+ </select> <em><?php _e('Larger smartphones or Small tablets with a viewport of up to 960px wide (up-to 1536px resolution).', 'adrotate'); ?></em>
95
+ </label>
96
+ </td>
97
+ </tr>
98
+ <tr>
99
+ <th valign="top"><?php _e('Larger Devices', 'adrotate'); ?></th>
100
+ <td>
101
+ <label for="adrotate_large_dropdown">
102
+ <select tabindex="5" id="adrotate_large_dropdown" name="adrotate_large_dropdown" style="min-width: 300px;" disabled>
103
+ <option value=""><?php _e('No file selected', 'adrotate'); ?></option>
104
+ </select> <em><?php _e('Small laptops and Larger tablets with a viewport of up to 1280px wide (up-to 2048px resolution).', 'adrotate'); ?></em>
105
+ </label>
106
+ </td>
107
+ </tr>
108
+ <tr>
109
+ <td colspan="2"><strong><?php _e('Important:', 'adrotate'); ?></strong> <?php _e('All sizes are optional, but it is highly recommended to use at least the small and medium size. Devices with viewports greater than 1280px will use the full sized banner.', 'adrotate'); ?><br /><?php _e('Are your files not listed? Upload them via the AdRotate Media Manager. For your convenience, use easy to use filenames.', 'adrotate'); ?></td>
110
+ </tr>
111
+
112
+ <thead>
113
+ <tr>
114
+ <th colspan="2"><strong><?php _e('Optional', 'adrotate'); ?></strong></th>
115
+ </tr>
116
+ </thead>
117
+
118
+ <tbody>
119
+ <tr>
120
+ <th valign="top"><?php _e('Target window', 'adrotate'); ?></th>
121
+ <td>
122
+ <label for="adrotate_newwindow"><input tabindex="6" type="checkbox" name="adrotate_newwindow" checked="1" /></label> <?php _e('Open the advert in a new window?', 'adrotate'); ?> <?php _e('(Recommended)', 'adrotate'); ?>
123
+ </td>
124
+ </tr>
125
+ <tr>
126
+ <th valign="top"><?php _e('NoFollow', 'adrotate'); ?></th>
127
+ <td>
128
+ <label for="adrotate_nofollow"><input tabindex="7" type="checkbox" name="adrotate_nofollow" disabled /></label> <?php _e('Tell crawlers and search engines not to follow the target website url?', 'adrotate'); ?> <?php _e('(Available in AdRotate Pro)', 'adrotate'); ?><br /><em><?php _e('Letting bots (Such as Googlebot) index paid links may negatively affect your SEO and PageRank.', 'adrotate'); ?></em>
129
+ </td>
130
+ </tr>
131
+ <tr>
132
+ <th valign="top"><?php _e('Alt and Title', 'adrotate'); ?></th>
133
+ <td>
134
+ <label for="adrotate_title_attr"><input tabindex="8" type="checkbox" name="adrotate_title_attr" disabled /></label> <?php _e('Add an alt and title attribute based on the asset name?', 'adrotate'); ?> <?php _e('(Available in AdRotate Pro)', 'adrotate'); ?><br /><em><?php _e('Some bots/crawlers use them as a descriptive measure to see what the code is about.', 'adrotate'); ?></em>
135
+ </td>
136
+ </tr>
137
+ </tbody>
138
+
139
+ </table>
140
+
141
+ <p class="submit">
142
+ <input tabindex="8" type="submit" name="adrotate_generate_submit" class="button-primary" value="<?php _e('Generate and Configure Advert', 'adrotate'); ?>" />
143
+ <a href="admin.php?page=adrotate-ads&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a> <?php _e('Always test your adverts before activating them.', 'adrotate'); ?>
144
+ </p>
145
+
146
+ <p><em><strong><?php _e('NOTE:', 'adrotate'); ?></strong> <?php _e('While the Code Generator has been tested and works, code generation, as always, is a interpretation of user input. If you provide the correct bits and pieces, a working advert may be generated. If you leave fields empty or insert the wrong info you probably end up with a broken advert.', 'adrotate'); ?><br /><?php _e('Based on your input and experiences later iterations of the Code Generator will be better and more feature rich.', 'adrotate'); ?></em></p>
147
+ </form>
148
+ <?php
149
+ } else {
150
+ echo adrotate_error('error_loading_item');
151
+ }
152
+ ?>
dashboard/publisher/groups-edit.php CHANGED
@@ -22,390 +22,397 @@
22
  $action = "group_edit";
23
  }
24
 
25
- $edit_group = $wpdb->get_row("SELECT * FROM `{$wpdb->prefix}adrotate_groups` WHERE `id` = '$group_edit_id';");
26
- $groups = $wpdb->get_results("SELECT * FROM `{$wpdb->prefix}adrotate_groups` WHERE `name` != '' ORDER BY `id` ASC;");
27
- $ads = $wpdb->get_results("SELECT `id`, `title`, `tracker`, `weight`, `type` FROM `{$wpdb->prefix}adrotate` WHERE (`type` != 'empty' AND `type` != 'a_empty' AND `type` != 'generator') ORDER BY `id` ASC;");
28
- $linkmeta = $wpdb->get_results("SELECT `ad` FROM `{$wpdb->prefix}adrotate_linkmeta` WHERE `group` = '$group_edit_id' AND `user` = 0;");
29
 
30
- $meta_array = array();
31
- foreach($linkmeta as $meta) {
32
- $meta_array[] = $meta->ad;
33
- }
34
- if(!is_array($meta_array)) $meta_array = array();
35
- ?>
36
-
37
- <form name="editgroup" id="post" method="post" action="admin.php?page=adrotate-groups">
38
- <?php wp_nonce_field('adrotate_save_group','adrotate_nonce'); ?>
39
- <input type="hidden" name="adrotate_id" value="<?php echo $edit_group->id;?>" />
40
- <input type="hidden" name="adrotate_action" value="<?php echo $action;?>" />
41
-
42
- <?php if($edit_group->name == '') { ?>
43
- <h3><?php _e('New Group', 'adrotate'); ?></h3>
44
- <?php } else { ?>
45
- <h3><?php _e('Edit Group', 'adrotate'); ?></h3>
46
- <?php } ?>
47
-
48
- <table class="widefat" style="margin-top: .5em">
49
- <tbody>
50
- <tr>
51
- <th width="15%"><?php _e('Name', 'adrotate'); ?></th>
52
- <td width="35%">
53
- <label for="adrotate_groupname"><input tabindex="1" name="adrotate_groupname" type="text" class="ajdg-fullwidth ajdg-inputfield" size="70" value="<?php echo $edit_group->name; ?>" autocomplete="off" /></label>
54
- </td>
55
- <td>
56
- &nbsp;
57
- </td>
58
- </tr>
59
- <tr>
60
- <th valign="top"><?php _e('Mode', 'adrotate'); ?></strong></th>
61
- <td>
62
- <select tabindex="2" name="adrotate_modus" class="ajdg-fullwidth">
63
- <option value="0" <?php if($edit_group->modus == 0) { echo 'selected'; } ?>><?php _e('Default - Show one ad at a time', 'adrotate'); ?></option>
64
- <option value="1" <?php if($edit_group->modus == 1) { echo 'selected'; } ?>><?php _e('Dynamic Mode - Show a different ad every few seconds', 'adrotate'); ?></option>
65
- <option value="2" <?php if($edit_group->modus == 2) { echo 'selected'; } ?>><?php _e('Block Mode - Show a block of adverts', 'adrotate'); ?></option>
66
- </select>
67
- </td>
68
- <td>
69
- <p><em><?php _e('Dynamic mode requires jQuery. You can enable this in AdRotate Settings.', 'adrotate'); ?></em></p>
70
- </td>
71
- </tr>
72
- <tr>
73
- <th valign="top"><?php _e('Advert size', 'adrotate'); ?></strong></th>
74
- <td>
75
- <label for="adrotate_adwidth"><input tabindex="5" name="adrotate_adwidth" type="text" class="search-input" size="3" value="<?php echo $edit_group->adwidth; ?>" autocomplete="off" /> <?php _e('pixel(s) wide', 'adrotate'); ?>,</label> <label for="adrotate_adheight"><input tabindex="6" name="adrotate_adheight" type="text" class="search-input" size="3" value="<?php echo $edit_group->adheight; ?>" autocomplete="off" /> <?php _e('pixel(s) high.', 'adrotate'); ?></label>
76
- </td>
77
- <td>
78
- <em><?php _e('Define the maximum size of the adverts in pixels. Size can be \'auto\' (Not recommended).', 'adrotate'); ?></em>
79
- </td>
80
- </tr>
81
- </tbody>
82
- </table>
83
-
84
- <h3><?php _e('Dynamic and Block Mode', 'adrotate'); ?></h3>
85
- <table class="widefat" style="margin-top: .5em">
86
- <tbody>
87
- <tr>
88
- <th width="15%"><?php _e('Block size', 'adrotate'); ?></strong></th>
89
- <td width="35%">
90
- <label for="adrotate_gridrows"><select tabindex="3" name="adrotate_gridrows">
91
- <?php for($rows=1;$rows<=32;$rows++) { ?>
92
- <option value="<?php echo $rows; ?>" <?php if($edit_group->gridrows == $rows) { echo 'selected'; } ?>><?php echo $rows; ?></option>
93
- <?php } ?>
94
- </select> <?php _e('rows', 'adrotate'); ?>,</label> <label for="adrotate_gridcolumns"><select tabindex="4" name="adrotate_gridcolumns">
95
- <?php for($columns=1;$columns<=12;$columns++) { ?>
96
- <option value="<?php echo $columns; ?>" <?php if($edit_group->gridcolumns == $columns) { echo 'selected'; } ?>><?php echo $columns; ?></option>
97
- <?php } ?>
98
- </select> <?php _e('columns', 'adrotate'); ?>.</label>
99
- </td>
100
- <td colspan="2">
101
- <p><em><?php _e('Block Mode', 'adrotate'); ?> - <?php _e('Larger blocks will degrade your sites performance! Default: 2/2.', 'adrotate'); ?></em></p>
102
- </td>
103
- </tr>
104
- <tr>
105
- <th valign="top"><?php _e('Automated refresh', 'adrotate'); ?></strong></th>
106
- <td>
107
- <label for="adrotate_adwidth"><select tabindex="7" name="adrotate_adspeed">
108
- <option value="3000" <?php if($edit_group->adspeed == 3000) { echo 'selected'; } ?>>3</option>
109
- <option value="4000" <?php if($edit_group->adspeed == 4000) { echo 'selected'; } ?>>4</option>
110
- <option value="5000" <?php if($edit_group->adspeed == 5000) { echo 'selected'; } ?>>5</option>
111
- <option value="6000" <?php if($edit_group->adspeed == 6000) { echo 'selected'; } ?>>6</option>
112
- <option value="7000" <?php if($edit_group->adspeed == 7000) { echo 'selected'; } ?>>7</option>
113
- <option value="8000" <?php if($edit_group->adspeed == 8000) { echo 'selected'; } ?>>8</option>
114
- <option value="9000" <?php if($edit_group->adspeed == 9000) { echo 'selected'; } ?>>9</option>
115
- <option value="10000" <?php if($edit_group->adspeed == 10000) { echo 'selected'; } ?>>10</option>
116
- <option value="12000" <?php if($edit_group->adspeed == 12000) { echo 'selected'; } ?>>12</option>
117
- <option value="15000" <?php if($edit_group->adspeed == 15000) { echo 'selected'; } ?>>15</option>
118
- <option value="20000" <?php if($edit_group->adspeed == 20000) { echo 'selected'; } ?>>20</option>
119
- <option value="25000" <?php if($edit_group->adspeed == 25000) { echo 'selected'; } ?>>25</option>
120
- <option value="35000" <?php if($edit_group->adspeed == 35000) { echo 'selected'; } ?>>35</option>
121
- <option value="45000" <?php if($edit_group->adspeed == 45000) { echo 'selected'; } ?>>45</option>
122
- <option value="60000" <?php if($edit_group->adspeed == 60000) { echo 'selected'; } ?>>60</option>
123
- <option value="90000" <?php if($edit_group->adspeed == 90000) { echo 'selected'; } ?>>90</option>
124
- </select> <?php _e('seconds.', 'adrotate'); ?></label>
125
- </td>
126
- <td colspan="2">
127
- <p><em><?php _e('Dynamic Mode', 'adrotate'); ?> - <?php _e('Load a new advert in this interval without reloading the page. Default: 6.', 'adrotate'); ?></em></p>
128
- </td>
129
- </tr>
130
- <tr>
131
- <th valign="top"><?php _e('Repeat impressions', 'adrotate'); ?></th>
132
- <td>
133
- <label for="adrotate_repeat_impressions"><input type="checkbox" name="adrotate_repeat_impressions" checked disabled /> <?php _e('Count impressions for every cycle of adverts?', 'adrotate'); ?></label>
134
- </td>
135
- <td>
136
- <em><?php _e('Dynamic Mode', 'adrotate'); ?> - <?php _e('Uncheck this option to only count impressions for the first cycle of adverts.', 'adrotate'); ?></em>
137
- </td>
138
- </tr>
139
- </tbody>
140
- </table>
141
- <center><?php _e('Get access to all features in AdRotate Pro.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade today', 'adrotate'); ?></a>!</center>
142
-
143
- <h3><?php _e('Usage', 'adrotate'); ?></h3>
144
- <table class="widefat" style="margin-top: .5em">
145
- <tbody>
146
- <tr>
147
- <th width="15%"><?php _e('Widget', 'adrotate'); ?></th>
148
- <td colspan="3"><?php _e('Drag the AdRotate widget to the sidebar you want it in, select "Group of Adverts" and enter ID', 'adrotate'); ?> "<?php echo $edit_group->id; ?>".</td>
149
- </tr>
150
- <tr>
151
- <th width="15%"><?php _e('In a post or page', 'adrotate'); ?></th>
152
- <td width="35%">[adrotate group="<?php echo $edit_group->id; ?>"]</td>
153
- <th width="15%"><?php _e('Directly in a theme', 'adrotate'); ?></th>
154
- <td width="35%">&lt;?php echo adrotate_group(<?php echo $edit_group->id; ?>); ?&gt;</td>
155
- </tr>
156
- </tbody>
157
- </table>
158
-
159
- <p class="submit">
160
- <input tabindex="8" type="submit" name="adrotate_group_submit" class="button-primary" value="<?php _e('Save Group', 'adrotate'); ?>" />
161
- <a href="admin.php?page=adrotate-groups&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
162
- </p>
163
-
164
- <h3><?php _e('Advanced', 'adrotate'); ?></h3>
165
- <table class="widefat" style="margin-top: .5em">
166
- <tbody>
167
- <tr>
168
- <th width="15%" valign="top"><?php _e('Advert Margin', 'adrotate'); ?></strong></th>
169
- <td width="35%">
170
- <label for="adrotate_admargin"><input tabindex="9" name="adrotate_admargin" type="text" class="ajdg-inputfield" size="5" value="<?php echo $edit_group->admargin; ?>" autocomplete="off" /> <?php _e('pixel(s)', 'adrotate'); ?>.</label>
171
  </td>
172
- <td>
173
- <p><em><?php _e('A transparent area outside the advert in pixels. Default: 0.', 'adrotate'); ?> <?php _e('Set to 0 to disable.', 'adrotate'); ?> <?php _e('Margins are automatically disabled for blocks where required.', 'adrotate'); ?></em></p>
174
- </td>
175
- </tr>
176
- <tr>
177
- <th valign="top"><?php _e('Align the group', 'adrotate'); ?></strong></th>
178
- <td>
179
- <label for="adrotate_align"><select tabindex="10" name="adrotate_align">
180
- <option value="0" <?php if($edit_group->align == 0) { echo 'selected'; } ?>><?php _e('None (Default)', 'adrotate'); ?></option>
181
- <option value="1" <?php if($edit_group->align == 1) { echo 'selected'; } ?>><?php _e('Left', 'adrotate'); ?></option>
182
- <option value="2" <?php if($edit_group->align == 2) { echo 'selected'; } ?>><?php _e('Right', 'adrotate'); ?></option>
183
- <option value="3" <?php if($edit_group->align == 3) { echo 'selected'; } ?>><?php _e('Center', 'adrotate'); ?></option>
184
- </select></label>
185
  </td>
186
- <td>
187
- <p><em><?php _e('Align the group in your post or page. Using \'center\' may affect your margin setting. Not every theme supports this feature.', 'adrotate'); ?></em></p>
188
- </td>
189
- </tr>
190
- <tr>
191
- <th width="15%" valign="top"><?php _e('Geo Targeting', 'adrotate'); ?></th>
192
- <td width="35%"><label for="adrotate_geo"><input type="checkbox" name="adrotate_geo" value="1" disabled /> <?php _e('Enable Geo Targeting for this group.', 'adrotate'); ?></label></td>
193
- <td><p><em><?php _e('Do not forget to tell the adverts for which areas they should show.', 'adrotate'); ?></em></p></td>
194
- </tr>
195
- <tr>
196
- <th width="15%" valign="top"><?php _e('Mobile Support', 'adrotate'); ?></th>
197
- <td width="35%"><label for="adrotate_mobile"><input type="checkbox" name="adrotate_mobile" value="1" disabled /> <?php _e('Enable mobile support for this group.', 'adrotate'); ?></label></td>
198
- <td><p><em><?php _e('Do not forget to put at least one mobile advert in this group.', 'adrotate'); ?></em></p></td>
199
- </tr>
200
- <tr>
201
- <th valign="top"><?php _e('Fallback Group', 'adrotate-pro'); ?></th>
202
- <td>
203
- <label for="adrotate_fallback">
204
- <select tabindex="16" name="adrotate_fallback" disabled>
205
- <option value="0"><?php _e('Available in AdRotate Pro', 'adrotate-pro'); ?></option>
206
- </select>
207
- </td>
208
- <td>
209
- <em><?php _e('Select another group to fall back on when all adverts are expired, not in the visitors geographic area or are otherwise unavailable.', 'adrotate-pro'); ?></em>
210
- </td>
211
- </tr>
212
- </tbody>
213
- </table>
214
- <center><?php _e('Get access to all features in AdRotate Pro.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!</center>
215
 
216
- <div id="dashboard-widgets-wrap">
217
- <div id="dashboard-widgets" class="metabox-holder">
218
- <div id="left-column" class="postbox-container">
 
219
 
220
- <div class="ajdg-postbox">
221
- <h2 class="ajdg-postbox-title"><?php _e('Post Injection', 'adrotate'); ?></h2>
222
- <div id="postinjection" class="ajdg-postbox-content">
223
- <p><label for="adrotate_cat_location">
224
- <select tabindex="18" name="adrotate_cat_location">
225
- <option value="0" <?php if($edit_group->cat_loc == 0) { echo 'selected'; } ?>><?php _e('Disabled', 'adrotate'); ?></option>
226
- <option value="0" disabled><?php _e('Widget (Pro only)', 'adrotate'); ?></option>
227
- <option value="1" <?php if($edit_group->cat_loc == 1) { echo 'selected'; } ?>><?php _e('Before content', 'adrotate'); ?></option>
228
- <option value="2" <?php if($edit_group->cat_loc == 2) { echo 'selected'; } ?>><?php _e('After content', 'adrotate'); ?></option>
229
- <option value="3" <?php if($edit_group->cat_loc == 3) { echo 'selected'; } ?>><?php _e('Before and after content', 'adrotate'); ?></option>
230
- <option value="4" <?php if($edit_group->cat_loc == 4) { echo 'selected'; } ?>><?php _e('Inside the content...', 'adrotate'); ?></option>
231
- </select>
232
- </label>
233
- <label for="adrotate_cat_paragraph">
234
- <select tabindex="19" name="adrotate_cat_paragraph">
235
- <option value="0" <?php if($edit_group->cat_par == 0) { echo 'selected'; } ?>>...</option>
236
- <option value="99" <?php if($edit_group->cat_par == 99) { echo 'selected'; } ?>><?php _e('after the middle paragraph', 'adrotate'); ?></option>
237
- <option value="1" <?php if($edit_group->cat_par == 1) { echo 'selected'; } ?>><?php _e('after the 1st paragraph', 'adrotate'); ?></option>
238
- <option value="2" <?php if($edit_group->cat_par == 2) { echo 'selected'; } ?>><?php _e('after the 2nd paragraph', 'adrotate'); ?></option>
239
- <option value="3" <?php if($edit_group->cat_par == 3) { echo 'selected'; } ?>><?php _e('after the 3rd paragraph', 'adrotate'); ?></option>
240
- <option value="4" <?php if($edit_group->cat_par == 4) { echo 'selected'; } ?>><?php _e('after the 4th paragraph', 'adrotate'); ?></option>
241
- <option value="5" <?php if($edit_group->cat_par == 5) { echo 'selected'; } ?>><?php _e('after the 5th paragraph', 'adrotate'); ?></option>
242
- <option value="6" <?php if($edit_group->cat_par == 6) { echo 'selected'; } ?>><?php _e('after the 6th paragraph', 'adrotate'); ?></option>
243
- <option value="7" <?php if($edit_group->cat_par == 7) { echo 'selected'; } ?>><?php _e('after the 7th paragraph', 'adrotate'); ?></option>
244
- <option value="8" <?php if($edit_group->cat_par == 8) { echo 'selected'; } ?>><?php _e('after the 8th paragraph', 'adrotate'); ?></option>
245
- </select>
246
- </label></p>
247
- <p><strong>Select Categories</strong></p>
248
- <div class="adrotate-select">
249
- <?php echo adrotate_select_categories($edit_group->cat, 0, 0, 0); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
250
  </div>
251
  </div>
 
252
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
253
 
254
- </div>
255
- <div id="right-column" class="postbox-container">
256
-
257
- <div class="ajdg-postbox">
258
- <h2 class="ajdg-postbox-title"><?php _e('Page Injection', 'adrotate'); ?></h2>
259
- <div id="pageinjection" class="ajdg-postbox-content">
260
- <p><label for="adrotate_page_location">
261
- <select tabindex="20" name="adrotate_page_location">
262
- <option value="0" <?php if($edit_group->page_loc == 0) { echo 'selected'; } ?>><?php _e('Disabled', 'adrotate'); ?></option>
263
- <option value="0" disabled><?php _e('Widget (Pro only)', 'adrotate'); ?></option>
264
- <option value="1" <?php if($edit_group->page_loc == 1) { echo 'selected'; } ?>><?php _e('Before content', 'adrotate'); ?></option>
265
- <option value="2" <?php if($edit_group->page_loc == 2) { echo 'selected'; } ?>><?php _e('After content', 'adrotate'); ?></option>
266
- <option value="3" <?php if($edit_group->page_loc == 3) { echo 'selected'; } ?>><?php _e('Before and after content', 'adrotate'); ?></option>
267
- <option value="4" <?php if($edit_group->page_loc == 4) { echo 'selected'; } ?>><?php _e('Inside the content...', 'adrotate'); ?></option>
268
- </select>
269
- </label>
270
- <label for="adrotate_page_paragraph">
271
- <select tabindex="21" name="adrotate_page_paragraph">
272
- <option value="0" <?php if($edit_group->page_par == 0) { echo 'selected'; } ?>>...</option>
273
- <option value="99" <?php if($edit_group->page_par == 99) { echo 'selected'; } ?>><?php _e('after the middle paragraph', 'adrotate'); ?></option>
274
- <option value="1" <?php if($edit_group->page_par == 1) { echo 'selected'; } ?>><?php _e('after the 1st paragraph', 'adrotate'); ?></option>
275
- <option value="2" <?php if($edit_group->page_par == 2) { echo 'selected'; } ?>><?php _e('after the 2nd paragraph', 'adrotate'); ?></option>
276
- <option value="3" <?php if($edit_group->page_par == 3) { echo 'selected'; } ?>><?php _e('after the 3rd paragraph', 'adrotate'); ?></option>
277
- <option value="4" <?php if($edit_group->page_par == 4) { echo 'selected'; } ?>><?php _e('after the 4th paragraph', 'adrotate'); ?></option>
278
- <option value="5" <?php if($edit_group->page_par == 5) { echo 'selected'; } ?>><?php _e('after the 5th paragraph', 'adrotate'); ?></option>
279
- <option value="6" <?php if($edit_group->page_par == 6) { echo 'selected'; } ?>><?php _e('after the 6th paragraph', 'adrotate'); ?></option>
280
- <option value="7" <?php if($edit_group->page_par == 7) { echo 'selected'; } ?>><?php _e('after the 7th paragraph', 'adrotate'); ?></option>
281
- <option value="8" <?php if($edit_group->page_par == 8) { echo 'selected'; } ?>><?php _e('after the 8th paragraph', 'adrotate'); ?></option>
282
- </select>
283
- </label></p>
284
-
285
- <p><strong>Select Pages</strong></p>
286
- <div class="adrotate-select">
287
- <?php echo adrotate_select_pages($edit_group->page, 0, 0, 0); ?>
288
  </div>
289
  </div>
 
290
  </div>
291
-
292
  </div>
293
  </div>
294
- </div>
295
- <div class="clear"></div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
296
 
297
- <h3><?php _e('Usage', 'adrotate'); ?></h3>
298
- <table class="widefat" style="margin-top: .5em">
299
- <tbody>
300
- <tr>
301
- <th width="15%"><?php _e('Widget', 'adrotate'); ?></th>
302
- <td colspan="3"><?php _e('Drag the AdRotate widget to the sidebar you want it in, select "Group of Adverts" and enter ID', 'adrotate'); ?> "<?php echo $edit_group->id; ?>".</td>
303
- </tr>
304
- <tr>
305
- <th width="15%"><?php _e('In a post or page', 'adrotate'); ?></th>
306
- <td width="35%">[adrotate group="<?php echo $edit_group->id; ?>"]</td>
307
- <th width="15%"><?php _e('Directly in a theme', 'adrotate'); ?></th>
308
- <td>&lt;?php echo adrotate_group(<?php echo $edit_group->id; ?>); ?&gt;</td>
309
- </tr>
310
- </tbody>
311
- </table>
312
-
313
- <p class="submit">
314
- <input tabindex="16" type="submit" name="adrotate_group_submit" class="button-primary" value="<?php _e('Save Group', 'adrotate'); ?>" />
315
- <a href="admin.php?page=adrotate-groups&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
316
- </p>
317
-
318
- <h3><?php _e('Wrapper code', 'adrotate'); ?></h3>
319
- <p><em><?php _e('Wraps around each advert. HTML/JavaScript allowed, use with care!', 'adrotate'); ?></em></p>
320
- <table class="widefat" style="margin-top: .5em">
321
- <tbody>
322
- <tr>
323
- <th width="15%" valign="top"><?php _e('Before advert', 'adrotate'); ?></strong></th>
324
- <td width="35%"><textarea tabindex="17" name="adrotate_wrapper_before" rows="3" class="ajdg-fullwidth"><?php echo stripslashes($edit_group->wrapper_before); ?></textarea></td>
325
- <td>
326
- <p><strong><?php _e('Example:', 'adrotate'); ?></strong> <em>&lt;span style="background-color:#aaa;"&gt;</em></p>
327
- <p><strong><?php _e('Options:', 'adrotate'); ?></strong> <em>%id%</em></p>
328
- </td>
329
- </tr>
330
- <tr>
331
- <th valign="top"><?php _e('After advert', 'adrotate'); ?></strong></th>
332
- <td width="35%"><textarea tabindex="18" name="adrotate_wrapper_after" rows="3" class="ajdg-fullwidth"><?php echo stripslashes($edit_group->wrapper_after); ?></textarea></td>
333
- <td>
334
- <p><strong><?php _e('Example:', 'adrotate'); ?></strong> <em>&lt;/span&gt;</em></p>
335
- </td>
336
- </tr>
337
- </tbody>
338
- </table>
339
 
340
- <h3><?php _e('Select adverts', 'adrotate'); ?></h3>
341
- <table class="widefat" style="margin-top: .5em">
342
- <thead>
343
- <tr>
344
- <td width="2%" scope="col" class="manage-column column-cb check-column"><input type="checkbox" /></td>
345
- <th width="2%"><center><?php _e('ID', 'adrotate'); ?></center></th>
346
- <th><?php _e('Name', 'adrotate'); ?></th>
347
- <th width="15%"><?php _e('Visible until', 'adrotate'); ?></th>
348
- <th width="5%"><center><?php _e('Weight', 'adrotate'); ?></center></th>
349
- <?php if($adrotate_config['stats'] == 1) { ?>
350
- <th width="5%"><center><?php _e('Shown', 'adrotate'); ?></center></th>
351
- <th width="5%"><center><?php _e('Clicks', 'adrotate'); ?></center></th>
352
- <?php } ?>
353
- </tr>
354
- </thead>
355
-
356
- <tbody>
357
- <?php if($ads) {
358
- $class = '';
359
- foreach($ads as $ad) {
360
- $stoptime = $wpdb->get_var("SELECT `stoptime` FROM `{$wpdb->prefix}adrotate_schedule`, `{$wpdb->prefix}adrotate_linkmeta` WHERE `ad` = '".$ad->id."' AND `schedule` = `{$wpdb->prefix}adrotate_schedule`.`id` ORDER BY `stoptime` DESC LIMIT 1;");
361
-
362
- if($adrotate_config['stats'] == 1) {
363
- $stats = adrotate_stats($ad->id);
364
- }
365
-
366
- $errorclass = '';
367
- if($ad->type == 'error') $errorclass = ' row_yellow';
368
- if($stoptime <= $in2days OR $stoptime <= $in7days) $errorclass = ' row_red';
369
- if($stoptime <= $now) $errorclass = ' row_blue';
370
-
371
- $class = ('alternate' != $class) ? 'alternate' : '';
372
- $class = ($errorclass != '') ? $errorclass : $class;
373
- ?>
374
- <tr class='<?php echo $class; ?>'>
375
- <th class="check-column"><input type="checkbox" name="adselect[]" value="<?php echo $ad->id; ?>" <?php if(in_array($ad->id, $meta_array)) echo "checked"; ?> /></th>
376
- <td><center><?php echo $ad->id; ?></center></td>
377
- <td><?php echo stripslashes(html_entity_decode($ad->title)); ?></td>
378
- <td><span style="color: <?php echo adrotate_prepare_color($stoptime);?>;"><?php echo date_i18n("F d, Y", $stoptime); ?></span></td>
379
- <td><center><?php echo $ad->weight; ?></center></td>
380
- <?php if($adrotate_config['stats'] == 1) {
381
- if($ad->tracker == 'Y') { ?>
382
- <td><center><?php echo $stats['impressions']; ?></center></td>
383
- <td><center><?php echo $stats['clicks']; ?></center></td>
384
- <?php } else { ?>
385
- <td><center>&hellip;</center></td>
386
- <td><center>&hellip;</center></td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
387
  <?php } ?>
388
- <?php } ?>
389
- </tr>
390
- <?php unset($stats);?>
391
- <?php } ?>
392
- <?php } else { ?>
393
- <tr>
394
- <th class="check-column">&nbsp;</th>
395
- <td colspan="<?php echo ($adrotate_config['stats'] == 1) ? '6' : '4'; ?>"><em><?php _e('No adverts created!', 'adrotate'); ?></em></td>
396
- </tr>
397
- <?php } ?>
398
- </tbody>
399
- </table>
400
-
401
- <p><center>
402
- <span style="border: 1px solid #e6db55; height: 12px; width: 12px; background-color: #ffffe0">&nbsp;&nbsp;&nbsp;&nbsp;</span> <?php _e("Configuration errors.", "adrotate"); ?>
403
- &nbsp;&nbsp;&nbsp;&nbsp;<span style="border: 1px solid #c00; height: 12px; width: 12px; background-color: #ffebe8">&nbsp;&nbsp;&nbsp;&nbsp;</span> <?php _e("Expires soon.", "adrotate"); ?>
404
- &nbsp;&nbsp;&nbsp;&nbsp;<span style="border: 1px solid #466f82; height: 12px; width: 12px; background-color: #8dcede">&nbsp;&nbsp;&nbsp;&nbsp;</span> <?php _e("Has expired.", "adrotate"); ?>
405
- </center></p>
406
-
407
- <p class="submit">
408
- <input tabindex="19" type="submit" name="adrotate_group_submit" class="button-primary" value="<?php _e('Save Group', 'adrotate'); ?>" />
409
- <a href="admin.php?page=adrotate-groups&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
410
- </p>
411
- </form>
 
 
 
 
22
  $action = "group_edit";
23
  }
24
 
25
+ $edit_group = $wpdb->get_row("SELECT * FROM `{$wpdb->prefix}adrotate_groups` WHERE `id` = '{$group_edit_id}';");
 
 
 
26
 
27
+ if($edit_group) {
28
+ $groups = $wpdb->get_results("SELECT * FROM `{$wpdb->prefix}adrotate_groups` WHERE `name` != '' ORDER BY `id` ASC;");
29
+ $ads = $wpdb->get_results("SELECT `id`, `title`, `tracker`, `weight`, `type` FROM `{$wpdb->prefix}adrotate` WHERE (`type` != 'empty' AND `type` != 'a_empty' AND `type` != 'generator') ORDER BY `id` ASC;");
30
+ $linkmeta = $wpdb->get_results("SELECT `ad` FROM `{$wpdb->prefix}adrotate_linkmeta` WHERE `group` = '{$group_edit_id}' AND `user` = 0;");
31
+
32
+ $meta_array = array();
33
+ foreach($linkmeta as $meta) {
34
+ $meta_array[] = $meta->ad;
35
+ }
36
+ if(!is_array($meta_array)) $meta_array = array();
37
+ ?>
38
+
39
+ <form name="editgroup" id="post" method="post" action="admin.php?page=adrotate-groups">
40
+ <?php wp_nonce_field('adrotate_save_group','adrotate_nonce'); ?>
41
+ <input type="hidden" name="adrotate_id" value="<?php echo $edit_group->id;?>" />
42
+ <input type="hidden" name="adrotate_action" value="<?php echo $action;?>" />
43
+
44
+ <?php if($edit_group->name == '') { ?>
45
+ <h3><?php _e('New Group', 'adrotate'); ?></h3>
46
+ <?php } else { ?>
47
+ <h3><?php _e('Edit Group', 'adrotate'); ?></h3>
48
+ <?php } ?>
49
+
50
+ <table class="widefat" style="margin-top: .5em">
51
+ <tbody>
52
+ <tr>
53
+ <th width="15%"><?php _e('Name', 'adrotate'); ?></th>
54
+ <td width="35%">
55
+ <label for="adrotate_groupname"><input tabindex="1" name="adrotate_groupname" type="text" class="ajdg-fullwidth ajdg-inputfield" size="70" value="<?php echo $edit_group->name; ?>" autocomplete="off" /></label>
56
+ </td>
57
+ <td>
58
+ &nbsp;
59
+ </td>
60
+ </tr>
61
+ <tr>
62
+ <th valign="top"><?php _e('Mode', 'adrotate'); ?></strong></th>
63
+ <td>
64
+ <select tabindex="2" name="adrotate_modus" class="ajdg-fullwidth">
65
+ <option value="0" <?php if($edit_group->modus == 0) { echo 'selected'; } ?>><?php _e('Default - Show one ad at a time', 'adrotate'); ?></option>
66
+ <option value="1" <?php if($edit_group->modus == 1) { echo 'selected'; } ?>><?php _e('Dynamic Mode - Show a different ad every few seconds', 'adrotate'); ?></option>
67
+ <option value="2" <?php if($edit_group->modus == 2) { echo 'selected'; } ?>><?php _e('Block Mode - Show a block of adverts', 'adrotate'); ?></option>
68
+ </select>
69
+ </td>
70
+ <td>
71
+ <p><em><?php _e('Dynamic mode requires jQuery. You can enable this in AdRotate Settings.', 'adrotate'); ?></em></p>
72
+ </td>
73
+ </tr>
74
+ <tr>
75
+ <th valign="top"><?php _e('Advert size', 'adrotate'); ?></strong></th>
76
+ <td>
77
+ <label for="adrotate_adwidth"><input tabindex="5" name="adrotate_adwidth" type="text" class="search-input" size="3" value="<?php echo $edit_group->adwidth; ?>" autocomplete="off" /> <?php _e('pixel(s) wide', 'adrotate'); ?>,</label> <label for="adrotate_adheight"><input tabindex="6" name="adrotate_adheight" type="text" class="search-input" size="3" value="<?php echo $edit_group->adheight; ?>" autocomplete="off" /> <?php _e('pixel(s) high.', 'adrotate'); ?></label>
78
+ </td>
79
+ <td>
80
+ <em><?php _e('Define the maximum size of the adverts in pixels. Size can be \'auto\' (Not recommended).', 'adrotate'); ?></em>
81
+ </td>
82
+ </tr>
83
+ </tbody>
84
+ </table>
85
+
86
+ <h3><?php _e('Dynamic and Block Mode', 'adrotate'); ?></h3>
87
+ <table class="widefat" style="margin-top: .5em">
88
+ <tbody>
89
+ <tr>
90
+ <th width="15%"><?php _e('Block size', 'adrotate'); ?></strong></th>
91
+ <td width="35%">
92
+ <label for="adrotate_gridrows"><select tabindex="3" name="adrotate_gridrows">
93
+ <?php for($rows=1;$rows<=32;$rows++) { ?>
94
+ <option value="<?php echo $rows; ?>" <?php if($edit_group->gridrows == $rows) { echo 'selected'; } ?>><?php echo $rows; ?></option>
95
+ <?php } ?>
96
+ </select> <?php _e('rows', 'adrotate'); ?>,</label> <label for="adrotate_gridcolumns"><select tabindex="4" name="adrotate_gridcolumns">
97
+ <?php for($columns=1;$columns<=12;$columns++) { ?>
98
+ <option value="<?php echo $columns; ?>" <?php if($edit_group->gridcolumns == $columns) { echo 'selected'; } ?>><?php echo $columns; ?></option>
99
+ <?php } ?>
100
+ </select> <?php _e('columns', 'adrotate'); ?>.</label>
101
+ </td>
102
+ <td colspan="2">
103
+ <p><em><?php _e('Block Mode', 'adrotate'); ?> - <?php _e('Larger blocks will degrade your sites performance! Default: 2/2.', 'adrotate'); ?></em></p>
104
+ </td>
105
+ </tr>
106
+ <tr>
107
+ <th valign="top"><?php _e('Automated refresh', 'adrotate'); ?></strong></th>
108
+ <td>
109
+ <label for="adrotate_adwidth"><select tabindex="7" name="adrotate_adspeed">
110
+ <option value="3000" <?php if($edit_group->adspeed == 3000) { echo 'selected'; } ?>>3</option>
111
+ <option value="4000" <?php if($edit_group->adspeed == 4000) { echo 'selected'; } ?>>4</option>
112
+ <option value="5000" <?php if($edit_group->adspeed == 5000) { echo 'selected'; } ?>>5</option>
113
+ <option value="6000" <?php if($edit_group->adspeed == 6000) { echo 'selected'; } ?>>6</option>
114
+ <option value="7000" <?php if($edit_group->adspeed == 7000) { echo 'selected'; } ?>>7</option>
115
+ <option value="8000" <?php if($edit_group->adspeed == 8000) { echo 'selected'; } ?>>8</option>
116
+ <option value="9000" <?php if($edit_group->adspeed == 9000) { echo 'selected'; } ?>>9</option>
117
+ <option value="10000" <?php if($edit_group->adspeed == 10000) { echo 'selected'; } ?>>10</option>
118
+ <option value="12000" <?php if($edit_group->adspeed == 12000) { echo 'selected'; } ?>>12</option>
119
+ <option value="15000" <?php if($edit_group->adspeed == 15000) { echo 'selected'; } ?>>15</option>
120
+ <option value="20000" <?php if($edit_group->adspeed == 20000) { echo 'selected'; } ?>>20</option>
121
+ <option value="25000" <?php if($edit_group->adspeed == 25000) { echo 'selected'; } ?>>25</option>
122
+ <option value="35000" <?php if($edit_group->adspeed == 35000) { echo 'selected'; } ?>>35</option>
123
+ <option value="45000" <?php if($edit_group->adspeed == 45000) { echo 'selected'; } ?>>45</option>
124
+ <option value="60000" <?php if($edit_group->adspeed == 60000) { echo 'selected'; } ?>>60</option>
125
+ <option value="90000" <?php if($edit_group->adspeed == 90000) { echo 'selected'; } ?>>90</option>
126
+ </select> <?php _e('seconds.', 'adrotate'); ?></label>
127
+ </td>
128
+ <td colspan="2">
129
+ <p><em><?php _e('Dynamic Mode', 'adrotate'); ?> - <?php _e('Load a new advert in this interval without reloading the page. Default: 6.', 'adrotate'); ?></em></p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
130
  </td>
131
+ </tr>
132
+ <tr>
133
+ <th valign="top"><?php _e('Repeat impressions', 'adrotate'); ?></th>
134
+ <td>
135
+ <label for="adrotate_repeat_impressions"><input type="checkbox" name="adrotate_repeat_impressions" checked disabled /> <?php _e('Count impressions for every cycle of adverts?', 'adrotate'); ?></label>
 
 
 
 
 
 
 
 
136
  </td>
137
+ <td>
138
+ <em><?php _e('Dynamic Mode', 'adrotate'); ?> - <?php _e('Uncheck this option to only count impressions for the first cycle of adverts.', 'adrotate'); ?></em>
139
+ </td>
140
+ </tr>
141
+ </tbody>
142
+ </table>
143
+ <center><?php _e('Get access to all features in AdRotate Pro.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade today', 'adrotate'); ?></a>!</center>
144
+
145
+ <h3><?php _e('Usage', 'adrotate'); ?></h3>
146
+ <table class="widefat" style="margin-top: .5em">
147
+ <tbody>
148
+ <tr>
149
+ <th width="15%"><?php _e('Widget', 'adrotate'); ?></th>
150
+ <td colspan="3"><?php _e('Drag the AdRotate widget to the sidebar you want it in, select "Group of Adverts" and enter ID', 'adrotate'); ?> "<?php echo $edit_group->id; ?>".</td>
151
+ </tr>
152
+ <tr>
153
+ <th width="15%"><?php _e('In a post or page', 'adrotate'); ?></th>
154
+ <td width="35%">[adrotate group="<?php echo $edit_group->id; ?>"]</td>
155
+ <th width="15%"><?php _e('Directly in a theme', 'adrotate'); ?></th>
156
+ <td width="35%">&lt;?php echo adrotate_group(<?php echo $edit_group->id; ?>); ?&gt;</td>
157
+ </tr>
158
+ </tbody>
159
+ </table>
 
 
 
 
 
 
160
 
161
+ <p class="submit">
162
+ <input tabindex="8" type="submit" name="adrotate_group_submit" class="button-primary" value="<?php _e('Save Group', 'adrotate'); ?>" />
163
+ <a href="admin.php?page=adrotate-groups&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
164
+ </p>
165
 
166
+ <h3><?php _e('Advanced', 'adrotate'); ?></h3>
167
+ <table class="widefat" style="margin-top: .5em">
168
+ <tbody>
169
+ <tr>
170
+ <th width="15%" valign="top"><?php _e('Advert Margin', 'adrotate'); ?></strong></th>
171
+ <td width="35%">
172
+ <label for="adrotate_admargin"><input tabindex="9" name="adrotate_admargin" type="text" class="ajdg-inputfield" size="5" value="<?php echo $edit_group->admargin; ?>" autocomplete="off" /> <?php _e('pixel(s)', 'adrotate'); ?>.</label>
173
+ </td>
174
+ <td>
175
+ <p><em><?php _e('A transparent area outside the advert in pixels. Default: 0.', 'adrotate'); ?> <?php _e('Set to 0 to disable.', 'adrotate'); ?> <?php _e('Margins are automatically disabled for blocks where required.', 'adrotate'); ?></em></p>
176
+ </td>
177
+ </tr>
178
+ <tr>
179
+ <th valign="top"><?php _e('Align the group', 'adrotate'); ?></strong></th>
180
+ <td>
181
+ <label for="adrotate_align"><select tabindex="10" name="adrotate_align">
182
+ <option value="0" <?php if($edit_group->align == 0) { echo 'selected'; } ?>><?php _e('None (Default)', 'adrotate'); ?></option>
183
+ <option value="1" <?php if($edit_group->align == 1) { echo 'selected'; } ?>><?php _e('Left', 'adrotate'); ?></option>
184
+ <option value="2" <?php if($edit_group->align == 2) { echo 'selected'; } ?>><?php _e('Right', 'adrotate'); ?></option>
185
+ <option value="3" <?php if($edit_group->align == 3) { echo 'selected'; } ?>><?php _e('Center', 'adrotate'); ?></option>
186
+ </select></label>
187
+ </td>
188
+ <td>
189
+ <p><em><?php _e('Align the group in your post or page. Using \'center\' may affect your margin setting. Not every theme supports this feature.', 'adrotate'); ?></em></p>
190
+ </td>
191
+ </tr>
192
+ <tr>
193
+ <th width="15%" valign="top"><?php _e('Geo Targeting', 'adrotate'); ?></th>
194
+ <td width="35%"><label for="adrotate_geo"><input type="checkbox" name="adrotate_geo" value="1" disabled /> <?php _e('Enable Geo Targeting for this group.', 'adrotate'); ?></label></td>
195
+ <td><p><em><?php _e('Do not forget to tell the adverts for which areas they should show.', 'adrotate'); ?></em></p></td>
196
+ </tr>
197
+ <tr>
198
+ <th width="15%" valign="top"><?php _e('Mobile Support', 'adrotate'); ?></th>
199
+ <td width="35%"><label for="adrotate_mobile"><input type="checkbox" name="adrotate_mobile" value="1" disabled /> <?php _e('Enable mobile support for this group.', 'adrotate'); ?></label></td>
200
+ <td><p><em><?php _e('Do not forget to put at least one mobile advert in this group.', 'adrotate'); ?></em></p></td>
201
+ </tr>
202
+ <tr>
203
+ <th valign="top"><?php _e('Fallback Group', 'adrotate-pro'); ?></th>
204
+ <td>
205
+ <label for="adrotate_fallback">
206
+ <select tabindex="16" name="adrotate_fallback" disabled>
207
+ <option value="0"><?php _e('Available in AdRotate Pro', 'adrotate-pro'); ?></option>
208
+ </select>
209
+ </td>
210
+ <td>
211
+ <em><?php _e('Select another group to fall back on when all adverts are expired, not in the visitors geographic area or are otherwise unavailable.', 'adrotate-pro'); ?></em>
212
+ </td>
213
+ </tr>
214
+ </tbody>
215
+ </table>
216
+ <center><?php _e('Get access to all features in AdRotate Pro.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade now', 'adrotate'); ?></a>!</center>
217
+
218
+ <div id="dashboard-widgets-wrap">
219
+ <div id="dashboard-widgets" class="metabox-holder">
220
+ <div id="left-column" class="postbox-container">
221
+
222
+ <div class="ajdg-postbox">
223
+ <h2 class="ajdg-postbox-title"><?php _e('Post Injection', 'adrotate'); ?></h2>
224
+ <div id="postinjection" class="ajdg-postbox-content">
225
+ <p><label for="adrotate_cat_location">
226
+ <select tabindex="18" name="adrotate_cat_location">
227
+ <option value="0" <?php if($edit_group->cat_loc == 0) { echo 'selected'; } ?>><?php _e('Disabled', 'adrotate'); ?></option>
228
+ <option value="0" disabled><?php _e('Widget (Pro only)', 'adrotate'); ?></option>
229
+ <option value="1" <?php if($edit_group->cat_loc == 1) { echo 'selected'; } ?>><?php _e('Before content', 'adrotate'); ?></option>
230
+ <option value="2" <?php if($edit_group->cat_loc == 2) { echo 'selected'; } ?>><?php _e('After content', 'adrotate'); ?></option>
231
+ <option value="3" <?php if($edit_group->cat_loc == 3) { echo 'selected'; } ?>><?php _e('Before and after content', 'adrotate'); ?></option>
232
+ <option value="4" <?php if($edit_group->cat_loc == 4) { echo 'selected'; } ?>><?php _e('Inside the content...', 'adrotate'); ?></option>
233
+ </select>
234
+ </label>
235
+ <label for="adrotate_cat_paragraph">
236
+ <select tabindex="19" name="adrotate_cat_paragraph">
237
+ <option value="0" <?php if($edit_group->cat_par == 0) { echo 'selected'; } ?>>...</option>
238
+ <option value="99" <?php if($edit_group->cat_par == 99) { echo 'selected'; } ?>><?php _e('after the middle paragraph', 'adrotate'); ?></option>
239
+ <option value="1" <?php if($edit_group->cat_par == 1) { echo 'selected'; } ?>><?php _e('after the 1st paragraph', 'adrotate'); ?></option>
240
+ <option value="2" <?php if($edit_group->cat_par == 2) { echo 'selected'; } ?>><?php _e('after the 2nd paragraph', 'adrotate'); ?></option>
241
+ <option value="3" <?php if($edit_group->cat_par == 3) { echo 'selected'; } ?>><?php _e('after the 3rd paragraph', 'adrotate'); ?></option>
242
+ <option value="4" <?php if($edit_group->cat_par == 4) { echo 'selected'; } ?>><?php _e('after the 4th paragraph', 'adrotate'); ?></option>
243
+ <option value="5" <?php if($edit_group->cat_par == 5) { echo 'selected'; } ?>><?php _e('after the 5th paragraph', 'adrotate'); ?></option>
244
+ <option value="6" <?php if($edit_group->cat_par == 6) { echo 'selected'; } ?>><?php _e('after the 6th paragraph', 'adrotate'); ?></option>
245
+ <option value="7" <?php if($edit_group->cat_par == 7) { echo 'selected'; } ?>><?php _e('after the 7th paragraph', 'adrotate'); ?></option>
246
+ <option value="8" <?php if($edit_group->cat_par == 8) { echo 'selected'; } ?>><?php _e('after the 8th paragraph', 'adrotate'); ?></option>
247
+ </select>
248
+ </label></p>
249
+ <p><strong>Select Categories</strong></p>
250
+ <div class="adrotate-select">
251
+ <?php echo adrotate_select_categories($edit_group->cat, 0, 0, 0); ?>
252
+ </div>
253
  </div>
254
  </div>
255
+
256
  </div>
257
+ <div id="right-column" class="postbox-container">
258
+
259
+ <div class="ajdg-postbox">
260
+ <h2 class="ajdg-postbox-title"><?php _e('Page Injection', 'adrotate'); ?></h2>
261
+ <div id="pageinjection" class="ajdg-postbox-content">
262
+ <p><label for="adrotate_page_location">
263
+ <select tabindex="20" name="adrotate_page_location">
264
+ <option value="0" <?php if($edit_group->page_loc == 0) { echo 'selected'; } ?>><?php _e('Disabled', 'adrotate'); ?></option>
265
+ <option value="0" disabled><?php _e('Widget (Pro only)', 'adrotate'); ?></option>
266
+ <option value="1" <?php if($edit_group->page_loc == 1) { echo 'selected'; } ?>><?php _e('Before content', 'adrotate'); ?></option>
267
+ <option value="2" <?php if($edit_group->page_loc == 2) { echo 'selected'; } ?>><?php _e('After content', 'adrotate'); ?></option>
268
+ <option value="3" <?php if($edit_group->page_loc == 3) { echo 'selected'; } ?>><?php _e('Before and after content', 'adrotate'); ?></option>
269
+ <option value="4" <?php if($edit_group->page_loc == 4) { echo 'selected'; } ?>><?php _e('Inside the content...', 'adrotate'); ?></option>
270
+ </select>
271
+ </label>
272
+ <label for="adrotate_page_paragraph">
273
+ <select tabindex="21" name="adrotate_page_paragraph">
274
+ <option value="0" <?php if($edit_group->page_par == 0) { echo 'selected'; } ?>>...</option>
275
+ <option value="99" <?php if($edit_group->page_par == 99) { echo 'selected'; } ?>><?php _e('after the middle paragraph', 'adrotate'); ?></option>
276
+ <option value="1" <?php if($edit_group->page_par == 1) { echo 'selected'; } ?>><?php _e('after the 1st paragraph', 'adrotate'); ?></option>
277
+ <option value="2" <?php if($edit_group->page_par == 2) { echo 'selected'; } ?>><?php _e('after the 2nd paragraph', 'adrotate'); ?></option>
278
+ <option value="3" <?php if($edit_group->page_par == 3) { echo 'selected'; } ?>><?php _e('after the 3rd paragraph', 'adrotate'); ?></option>
279
+ <option value="4" <?php if($edit_group->page_par == 4) { echo 'selected'; } ?>><?php _e('after the 4th paragraph', 'adrotate'); ?></option>
280
+ <option value="5" <?php if($edit_group->page_par == 5) { echo 'selected'; } ?>><?php _e('after the 5th paragraph', 'adrotate'); ?></option>
281
+ <option value="6" <?php if($edit_group->page_par == 6) { echo 'selected'; } ?>><?php _e('after the 6th paragraph', 'adrotate'); ?></option>
282
+ <option value="7" <?php if($edit_group->page_par == 7) { echo 'selected'; } ?>><?php _e('after the 7th paragraph', 'adrotate'); ?></option>
283
+ <option value="8" <?php if($edit_group->page_par == 8) { echo 'selected'; } ?>><?php _e('after the 8th paragraph', 'adrotate'); ?></option>
284
+ </select>
285
+ </label></p>
286
 
287
+ <p><strong>Select Pages</strong></p>
288
+ <div class="adrotate-select">
289
+ <?php echo adrotate_select_pages($edit_group->page, 0, 0, 0); ?>
290
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
  </div>
292
  </div>
293
+
294
  </div>
 
295
  </div>
296
  </div>
297
+ <div class="clear"></div>
298
+
299
+ <h3><?php _e('Usage', 'adrotate'); ?></h3>
300
+ <table class="widefat" style="margin-top: .5em">
301
+ <tbody>
302
+ <tr>
303
+ <th width="15%"><?php _e('Widget', 'adrotate'); ?></th>
304
+ <td colspan="3"><?php _e('Drag the AdRotate widget to the sidebar you want it in, select "Group of Adverts" and enter ID', 'adrotate'); ?> "<?php echo $edit_group->id; ?>".</td>
305
+ </tr>
306
+ <tr>
307
+ <th width="15%"><?php _e('In a post or page', 'adrotate'); ?></th>
308
+ <td width="35%">[adrotate group="<?php echo $edit_group->id; ?>"]</td>
309
+ <th width="15%"><?php _e('Directly in a theme', 'adrotate'); ?></th>
310
+ <td>&lt;?php echo adrotate_group(<?php echo $edit_group->id; ?>); ?&gt;</td>
311
+ </tr>
312
+ </tbody>
313
+ </table>
314
 
315
+ <p class="submit">
316
+ <input tabindex="16" type="submit" name="adrotate_group_submit" class="button-primary" value="<?php _e('Save Group', 'adrotate'); ?>" />
317
+ <a href="admin.php?page=adrotate-groups&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
318
+ </p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
319
 
320
+ <h3><?php _e('Wrapper code', 'adrotate'); ?></h3>
321
+ <p><em><?php _e('Wraps around each advert. HTML/JavaScript allowed, use with care!', 'adrotate'); ?></em></p>
322
+ <table class="widefat" style="margin-top: .5em">
323
+ <tbody>
324
+ <tr>
325
+ <th width="15%" valign="top"><?php _e('Before advert', 'adrotate'); ?></strong></th>
326
+ <td width="35%"><textarea tabindex="17" name="adrotate_wrapper_before" rows="3" class="ajdg-fullwidth"><?php echo stripslashes($edit_group->wrapper_before); ?></textarea></td>
327
+ <td>
328
+ <p><strong><?php _e('Example:', 'adrotate'); ?></strong> <em>&lt;span style="background-color:#aaa;"&gt;</em></p>
329
+ <p><strong><?php _e('Options:', 'adrotate'); ?></strong> <em>%id%</em></p>
330
+ </td>
331
+ </tr>
332
+ <tr>
333
+ <th valign="top"><?php _e('After advert', 'adrotate'); ?></strong></th>
334
+ <td width="35%"><textarea tabindex="18" name="adrotate_wrapper_after" rows="3" class="ajdg-fullwidth"><?php echo stripslashes($edit_group->wrapper_after); ?></textarea></td>
335
+ <td>
336
+ <p><strong><?php _e('Example:', 'adrotate'); ?></strong> <em>&lt;/span&gt;</em></p>
337
+ </td>
338
+ </tr>
339
+ </tbody>
340
+ </table>
341
+
342
+ <h3><?php _e('Select adverts', 'adrotate'); ?></h3>
343
+ <table class="widefat" style="margin-top: .5em">
344
+ <thead>
345
+ <tr>
346
+ <td width="2%" scope="col" class="manage-column column-cb check-column"><input type="checkbox" /></td>
347
+ <th width="2%"><center><?php _e('ID', 'adrotate'); ?></center></th>
348
+ <th><?php _e('Name', 'adrotate'); ?></th>
349
+ <th width="15%"><?php _e('Visible until', 'adrotate'); ?></th>
350
+ <th width="5%"><center><?php _e('Weight', 'adrotate'); ?></center></th>
351
+ <?php if($adrotate_config['stats'] == 1) { ?>
352
+ <th width="5%"><center><?php _e('Shown', 'adrotate'); ?></center></th>
353
+ <th width="5%"><center><?php _e('Clicks', 'adrotate'); ?></center></th>
354
+ <?php } ?>
355
+ </tr>
356
+ </thead>
357
+
358
+ <tbody>
359
+ <?php if($ads) {
360
+ $class = '';
361
+ foreach($ads as $ad) {
362
+ $stoptime = $wpdb->get_var("SELECT `stoptime` FROM `{$wpdb->prefix}adrotate_schedule`, `{$wpdb->prefix}adrotate_linkmeta` WHERE `ad` = '{$ad->id}' AND `schedule` = `{$wpdb->prefix}adrotate_schedule`.`id` ORDER BY `stoptime` DESC LIMIT 1;");
363
+
364
+ if($adrotate_config['stats'] == 1) {
365
+ $stats = adrotate_stats($ad->id);
366
+ }
367
+
368
+ $errorclass = '';
369
+ if($ad->type == 'error') $errorclass = ' row_yellow';
370
+ if($stoptime <= $in2days OR $stoptime <= $in7days) $errorclass = ' row_red';
371
+ if($stoptime <= $now) $errorclass = ' row_blue';
372
+
373
+ $class = ('alternate' != $class) ? 'alternate' : '';
374
+ $class = ($errorclass != '') ? $errorclass : $class;
375
+ ?>
376
+ <tr class='<?php echo $class; ?>'>
377
+ <th class="check-column"><input type="checkbox" name="adselect[]" value="<?php echo $ad->id; ?>" <?php if(in_array($ad->id, $meta_array)) echo "checked"; ?> /></th>
378
+ <td><center><?php echo $ad->id; ?></center></td>
379
+ <td><?php echo stripslashes(html_entity_decode($ad->title)); ?></td>
380
+ <td><span style="color: <?php echo adrotate_prepare_color($stoptime);?>;"><?php echo date_i18n("F d, Y", $stoptime); ?></span></td>
381
+ <td><center><?php echo $ad->weight; ?></center></td>
382
+ <?php if($adrotate_config['stats'] == 1) {
383
+ if($ad->tracker == 'Y') { ?>
384
+ <td><center><?php echo $stats['impressions']; ?></center></td>
385
+ <td><center><?php echo $stats['clicks']; ?></center></td>
386
+ <?php } else { ?>
387
+ <td><center>&hellip;</center></td>
388
+ <td><center>&hellip;</center></td>
389
+ <?php } ?>
390
  <?php } ?>
391
+ </tr>
392
+ <?php unset($stats);?>
393
+ <?php } ?>
394
+ <?php } else { ?>
395
+ <tr>
396
+ <th class="check-column">&nbsp;</th>
397
+ <td colspan="<?php echo ($adrotate_config['stats'] == 1) ? '6' : '4'; ?>"><em><?php _e('No adverts created!', 'adrotate'); ?></em></td>
398
+ </tr>
399
+ <?php } ?>
400
+ </tbody>
401
+ </table>
402
+
403
+ <p><center>
404
+ <span style="border: 1px solid #e6db55; height: 12px; width: 12px; background-color: #ffffe0">&nbsp;&nbsp;&nbsp;&nbsp;</span> <?php _e("Configuration errors.", "adrotate"); ?>
405
+ &nbsp;&nbsp;&nbsp;&nbsp;<span style="border: 1px solid #c00; height: 12px; width: 12px; background-color: #ffebe8">&nbsp;&nbsp;&nbsp;&nbsp;</span> <?php _e("Expires soon.", "adrotate"); ?>
406
+ &nbsp;&nbsp;&nbsp;&nbsp;<span style="border: 1px solid #466f82; height: 12px; width: 12px; background-color: #8dcede">&nbsp;&nbsp;&nbsp;&nbsp;</span> <?php _e("Has expired.", "adrotate"); ?>
407
+ </center></p>
408
+
409
+ <p class="submit">
410
+ <input tabindex="19" type="submit" name="adrotate_group_submit" class="button-primary" value="<?php _e('Save Group', 'adrotate'); ?>" />
411
+ <a href="admin.php?page=adrotate-groups&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
412
+ </p>
413
+ </form>
414
+ <?php
415
+ } else {
416
+ echo adrotate_error('error_loading_item');
417
+ }
418
+ ?>
dashboard/publisher/statistics-main.php CHANGED
@@ -10,7 +10,7 @@
10
  ------------------------------------------------------------------------------------ */
11
 
12
  $stats = adrotate_prepare_fullreport();
13
- $stats_graph_month = $wpdb->get_row("SELECT SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}adrotate_stats` WHERE `thetime` >= {$monthstart} AND `thetime` <= {$monthend};", ARRAY_A);
14
  if(empty($stats_graph_month['impressions'])) $stats_graph_month['impressions'] = 0;
15
  if(empty($stats_graph_month['clicks'])) $stats_graph_month['clicks'] = 0;
16
 
10
  ------------------------------------------------------------------------------------ */
11
 
12
  $stats = adrotate_prepare_fullreport();
13
+ $stats_graph_month = $wpdb->get_row("SELECT SUM(`clicks`) as `clicks`, SUM(`impressions`) as `impressions` FROM `{$wpdb->prefix}adrotate_stats` WHERE `thetime` >= '{$monthstart}' AND `thetime` <= '{$monthend}';", ARRAY_A);
14
  if(empty($stats_graph_month['impressions'])) $stats_graph_month['impressions'] = 0;
15
  if(empty($stats_graph_month['clicks'])) $stats_graph_month['clicks'] = 0;
16
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: adverts, ads, banners, advert manager, ad manager, banner manager, adsense
5
  Requires at least: 4.6
6
  Requires PHP: 5.6
7
  Tested up to: 5.2.2
8
- Stable tag: 5.2
9
  License: GPLv3
10
 
11
  Start making money today! Monetise your website while keeping things simple. Try AdRotate today!
@@ -106,20 +106,17 @@ All about translations. Better support for GlotPress. Now requires WordPress 4.6
106
 
107
  Be a Professional and go Pro. With [AdRotate Professional](https://ajdg.solutions/plugins/adrotate-for-wordpress/)!
108
 
109
- = 5.2 FREE =
110
- * [i18n] Now supports WP Language Packs
111
- * [i18n] po/mo files removed from AdRotate
112
- * [change] Now requires WordPress 4.6 or newer
113
  * [change] Dashboard tweaks
114
 
115
- = 5.2 PRO =
116
- * [fix] Datepicker not always working when overlapping graphs
117
- * [fix] Generated CSS not deleting properly when deleting groups
118
- * [fix] Generated CSS not cleaned properly when doing maintenance
119
- * [fix] Outputting generated CSS code more efficient
120
- * [update] Faster and more reliable Update Library
121
- * [change] Now uses Update Api v6
122
- * [change] Now requires WordPress 4.6 or newer
123
 
124
  All recent changes are available on the [AdRotate website](https://ajdg.solutions/plugins/adrotate-for-wordpress/development/).
125
 
5
  Requires at least: 4.6
6
  Requires PHP: 5.6
7
  Tested up to: 5.2.2
8
+ Stable tag: 5.3
9
  License: GPLv3
10
 
11
  Start making money today! Monetise your website while keeping things simple. Try AdRotate today!
106
 
107
  Be a Professional and go Pro. With [AdRotate Professional](https://ajdg.solutions/plugins/adrotate-for-wordpress/)!
108
 
109
+ = 5.3 FREE =
110
+ * [fix] Possible vulnerability for users with privileged access
 
 
111
  * [change] Dashboard tweaks
112
 
113
+ = 5.3 PRO =
114
+ * [new] Support to edit ads.txt
115
+ * [fix] State and Statecode not converted to lowercase for ipstack
116
+ * [fix] Missing $wpdb value for multisite groups
117
+ * [fix] Geo Targeting dashboard layout
118
+ * [fix] Possible vulnerability for users with privileged access
119
+ * [change] Dashboard tweaks
 
120
 
121
  All recent changes are available on the [AdRotate website](https://ajdg.solutions/plugins/adrotate-for-wordpress/development/).
122