AdRotate Banner Manager - Version 3.11.3

Version Description

FREE = * [fix] Undefined notice for some setups when using Page Injection * [fix] Incorrect path for images on some setups * [fix] Max ads wrongly applied to Groups in block mode * [fix] Cleaned up irrelevant user roles * [change] No longer use 'ORDER BY RAND()' for groups * [change] Blocks can now have up to 32 rows * [new] More error notices for wrongly configured adverts * [new] Revised upgrade routine with manual trigger * [new] Revised installer routine better self-healing function * [i18n] Updated group settings descriptions and labels

NOTE: Certain features are exclusive to AdRotate PRO. If you need these features please consider upgrading to AdRotate PRO.

Download this release

Release Info

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

Code changes from version 3.11.2 to 3.11.3

adrotate-export.php CHANGED
@@ -45,8 +45,7 @@ function adrotate_export_ads($ids) {
45
$node->addChild('tracker', $single['tracker']);
46
$node->addChild('responsive', $single['responsive']);
47
$node->addChild('weight', $single['weight']);
48
- $node->addChild('cbudget', $single['cbudget']);
49
- $node->addChild('ibudget', $single['ibudget']);
50
$node->addChild('crate', $single['crate']);
51
$node->addChild('irate', $single['irate']);
52
$node->addChild('cities', implode(',', unserialize($single['cities'])));
45
$node->addChild('tracker', $single['tracker']);
46
$node->addChild('responsive', $single['responsive']);
47
$node->addChild('weight', $single['weight']);
48
+ $node->addChild('budget', $single['budget']);
49
$node->addChild('crate', $single['crate']);
50
$node->addChild('irate', $single['irate']);
51
$node->addChild('cities', implode(',', unserialize($single['cities'])));
adrotate-functions.php CHANGED
@@ -534,19 +534,21 @@ function adrotate_evaluate_ad($ad_id) {
534
$in7days = $now + 604800;
535
536
// Fetch ad
537
- $ad = $wpdb->get_row($wpdb->prepare("SELECT `id`, `bannercode`, `tracker`, `link`, `imagetype`, `image`, `cbudget`, `ibudget`, `crate`, `irate` FROM `".$wpdb->prefix."adrotate` WHERE `id` = %d;", $ad_id));
538
- $advertiser = $wpdb->get_var("SELECT `user` FROM `".$wpdb->prefix."adrotate_linkmeta` WHERE `ad` = '".$ad->id."' AND `group` = 0 AND `user` > 0 AND `schedule` = 0;");
539
$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;");
540
541
$bannercode = stripslashes(htmlspecialchars_decode($ad->bannercode, ENT_QUOTES));
542
// Determine error states
543
if(
544
strlen($bannercode) < 1 // AdCode empty
545
- OR ($ad->tracker == 'N' AND $advertiser > 0) // Didn't enable click-tracking, didn't provide a link, DID set a advertiser
546
OR (!preg_match_all('/<a[^>](.*?)>/i', $bannercode, $things) AND $ad->tracker == 'Y') // Clicktracking active but no valid link present
547
- OR (!preg_match("/%image%/i", $bannercode) AND $ad->image != '' AND $ad->imagetype != '') // Didn't use %image% but selected an image
548
OR (preg_match("/%image%/i", $bannercode) AND $ad->image == '' AND $ad->imagetype == '') // Did use %image% but didn't select an image
549
- OR ($ad->image == '' AND $ad->imagetype != '') // Image and Imagetype mismatch
550
) {
551
return 'error';
552
} else if(
534
$in7days = $now + 604800;
535
536
// Fetch ad
537
+ $ad = $wpdb->get_row($wpdb->prepare("SELECT `id`, `bannercode`, `tracker`, `link`, `imagetype`, `image`, `responsive` FROM `".$wpdb->prefix."adrotate` WHERE `id` = %d;", $ad_id));
538
$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;");
539
+ $schedules = $wpdb->get_var("SELECT COUNT(`schedule`) FROM `".$wpdb->prefix."adrotate_linkmeta` WHERE `ad` = '".$ad->id."' AND `group` = 0 AND `user` = 0;");
540
541
$bannercode = stripslashes(htmlspecialchars_decode($ad->bannercode, ENT_QUOTES));
542
// Determine error states
543
if(
544
strlen($bannercode) < 1 // AdCode empty
545
OR (!preg_match_all('/<a[^>](.*?)>/i', $bannercode, $things) AND $ad->tracker == 'Y') // Clicktracking active but no valid link present
546
OR (preg_match("/%image%/i", $bannercode) AND $ad->image == '' AND $ad->imagetype == '') // Did use %image% but didn't select an image
547
+ OR (!preg_match("/%image%/i", $bannercode) AND $ad->image != '' AND $ad->imagetype != '') // Didn't use %image% but selected an image
548
+ OR (!preg_match("/%image%/i", $bannercode) AND $ad->responsive == 'Y') // Didn't use %image% but enabled Responsive
549
+ OR (strlen($ad->image) > 0 AND !preg_match("/full/", $ad->image) AND $ad->responsive == 'Y') // Filename not correct for Responsive
550
+ OR (($ad->image == '' AND $ad->imagetype != '') OR ($ad->image != '' AND $ad->imagetype == '')) // Image and Imagetype mismatch
551
+ OR $schedules == 0 // No Schedules for this ad
552
) {
553
return 'error';
554
} else if(
adrotate-manage-publisher.php CHANGED
@@ -71,6 +71,14 @@ function adrotate_insert_input() {
71
$title = 'Ad '.$id;
72
}
73
74
// Sort out start dates
75
if(strlen($smonth) > 0 AND !is_numeric($smonth)) $smonth = date_i18n('m');
76
if(strlen($sday) > 0 AND !is_numeric($sday)) $sday = date_i18n('d');
@@ -118,9 +126,6 @@ function adrotate_insert_input() {
118
// Set responsive value
119
if(isset($responsive) AND strlen($responsive) != 0) $responsive = 'Y';
120
else $responsive = 'N';
121
-
122
- // Format the URL (assume agnostic)
123
- if((strlen($link) > 0 OR $link != "") AND preg_match("/%link%/i", $bannercode) AND strlen($link) > 0) $bannercode = str_replace('%link%', $link, $bannercode);
124
125
// Determine image settings ($image_field has priority!)
126
if(strlen($image_field) > 1) {
@@ -128,7 +133,7 @@ function adrotate_insert_input() {
128
$image = $image_field;
129
} else if(strlen($image_dropdown) > 1) {
130
$imagetype = "dropdown";
131
- $image = home_url()."/wp-content/banners/".$image_dropdown;
132
} else {
133
$imagetype = "";
134
$image = "";
71
$title = 'Ad '.$id;
72
}
73
74
+ // Clean up bannercode
75
+ if(preg_match("/%ID%/", $bannercode)) $bannercode = str_replace('%ID%', '%id%', $bannercode);
76
+ if(preg_match("/%IMAGE%/", $bannercode)) $bannercode = str_replace('%IMAGE%', '%image%', $bannercode);
77
+ if(preg_match("/%TITLE%/", $bannercode)) $bannercode = str_replace('%TITLE%', '%title%', $bannercode);
78
+ if(preg_match("/%RANDOM%/", $bannercode)) $bannercode = str_replace('%RANDOM%', '%random%', $bannercode);
79
+ // Replace %link% with the actual url (Deprecate $link)
80
+ if(strlen($link) > 0 AND preg_match("/%link%/i", $bannercode)) $bannercode = str_replace('%link%', $link, $bannercode);
81
+
82
// Sort out start dates
83
if(strlen($smonth) > 0 AND !is_numeric($smonth)) $smonth = date_i18n('m');
84
if(strlen($sday) > 0 AND !is_numeric($sday)) $sday = date_i18n('d');
126
// Set responsive value
127
if(isset($responsive) AND strlen($responsive) != 0) $responsive = 'Y';
128
else $responsive = 'N';
129
130
// Determine image settings ($image_field has priority!)
131
if(strlen($image_field) > 1) {
133
$image = $image_field;
134
} else if(strlen($image_dropdown) > 1) {
135
$imagetype = "dropdown";
136
+ $image = site_url()."/wp-content/banners/".$image_dropdown;
137
} else {
138
$imagetype = "";
139
$image = "";
adrotate-output.php CHANGED
@@ -25,8 +25,7 @@ function adrotate_ad($banner_id, $individual = true, $group = 0, $block = 0, $si
25
if($banner_id) {
26
$banner = $wpdb->get_row($wpdb->prepare(
27
"SELECT
28
- `id`, `bannercode`, `tracker`, `link`, `image`, `responsive`,
29
- `crate`, `irate`, `cbudget`, `ibudget`
30
FROM
31
`".$wpdb->prefix."adrotate`
32
WHERE
@@ -45,10 +44,6 @@ function adrotate_ad($banner_id, $individual = true, $group = 0, $block = 0, $si
45
46
$selected = array($banner->id => 0);
47
$selected = adrotate_filter_schedule($selected, $banner);
48
-
49
- if($adrotate_config['enable_advertisers'] > 0 AND ($banner->crate > 0 OR $banner->irate > 0)) {
50
- $selected = adrotate_filter_budget($selected, $banner);
51
- }
52
} else {
53
$selected = false;
54
}
@@ -107,9 +102,6 @@ function adrotate_group($group_ids, $fallback = 0, $weight = 0, $site = 0) {
107
if($group) {
108
if($fallback == 0) $fallback = $group->fallback;
109
if($weight > 0) $weightoverride = " AND `{$wpdb->prefix}adrotate`.`weight` >= '{$weight}'";
110
-
111
- // Limit group to save resources
112
- $amount = ($group->adspeed >= 10000) ? 10 : 20;
113
114
// Get all ads in all selected groups
115
$ads = $wpdb->get_results(
@@ -132,8 +124,8 @@ function adrotate_group($group_ids, $fallback = 0, $weight = 0, $site = 0) {
132
OR `{$wpdb->prefix}adrotate`.`type` = '2days'
133
OR `{$wpdb->prefix}adrotate`.`type` = '7days')
134
{$weightoverride}
135
- GROUP BY `{$wpdb->prefix}adrotate`.`id`
136
- ORDER BY RAND() LIMIT {$amount};");
137
138
if($ads) {
139
if($adrotate_debug['general'] == true) {
@@ -165,14 +157,20 @@ function adrotate_group($group_ids, $fallback = 0, $weight = 0, $site = 0) {
165
if($group->modus == 1) { // Dynamic ads
166
$i = 1;
167
168
$selected = adrotate_shuffle($selected);
169
foreach($selected as $key => $banner) {
170
- $image = str_replace('%folder%', $adrotate_config['banner_folder'], $banner->image);
171
-
172
- $output .= '<div class="g-dyn a-'.$banner->id.' c-'.$i.'">';
173
- $output .= $before.adrotate_ad_output($banner->id, $group->id, $banner->bannercode, $banner->tracker, $banner->link, $image, $banner->responsive).$after;
174
- $output .= '</div>';
175
- $i++;
176
}
177
} else if($group->modus == 2) { // Block of ads
178
$block_count = $group->gridcolumns * $group->gridrows;
@@ -274,7 +272,7 @@ function adrotate_inject_pages($post_content) {
274
$paragraph_count = $group_count;
275
}
276
$group_choice = array_rand($group_array, $paragraph_count);
277
- if(!is_array($group_choice)) $group_choice = array($page_choice);
278
279
shuffle($group_choice);
280
} else {
@@ -747,7 +745,7 @@ function adrotate_nonce_error() {
747
echo ' <h2 style="text-align: center;">'.__('Oh no! Something went wrong!', 'adrotate').'</h2>';
748
echo ' <p style="text-align: center;">'.__('WordPress was unable to verify the authenticity of the url you have clicked. Verify if the url used is valid or log in via your browser.', 'adrotate').'</p>';
749
echo ' <p style="text-align: center;">'.__('If you have received the url you want to visit via email, you are being tricked!', 'adrotate').'</p>';
750
- echo ' <p style="text-align: center;">'.__('Contact support if the issue persists:', 'adrotate').' <a href="https://ajdg.solutions/forums/forum/adrotate-for-wordpress/" title="AdRotate Support" target="_blank">AdRotate Support</a>.</p>';
751
}
752
753
/*-------------------------------------------------------------
@@ -822,7 +820,6 @@ function adrotate_error($action, $arg = null) {
822
function adrotate_notifications_dashboard() {
823
global $adrotate_advert_status;
824
if(current_user_can('adrotate_ad_manage')) {
825
-
826
if(!is_array($adrotate_advert_status)) {
827
$data = unserialize($adrotate_advert_status);
828
} else {
@@ -849,16 +846,10 @@ function adrotate_notifications_dashboard() {
849
if($pro_banner != 1 AND $pro_banner < (adrotate_now() - 604800) AND strpos($page, 'adrotate') !== false) {
850
echo '<div class="updated" style="padding: 0; margin: 0; border-left: none;">';
851
echo ' <div class="adrotate_banner">';
852
- echo ' <div class="button_div">';
853
- echo ' <a class="button" target="_blank" href="https://ajdg.solutions/products/adrotate-for-wordpress/?utm_source=adrotate_free&utm_medium=adrotate_free_banner&utm_campaign=upgrade_adrotatefree">'.__('Learn More', 'adrotate').'</a>';
854
- echo ' </div>';
855
- echo ' <div class="text">'.__("You've been using <strong>AdRotate</strong> for a while now. Why not upgrade to the <strong>PRO</strong> version", 'adrotate').'?<br />';
856
- echo ' <span>'.__('Get more features to even better run your advertising campaigns.', 'adrotate' ).' '.__('Thank you for your consideration!', 'adrotate' ).'</span>';
857
- echo ' </div>';
858
- echo ' <a class="close_banner" href="admin.php?page=adrotate-pro&hide=1"><small>dismiss</small></a>';
859
- echo ' <div class="icon">';
860
- echo ' <img title="" src="'.plugins_url('images/adrotate-logo-60x60.png', __FILE__).'" alt=""/>';
861
- echo ' </div>';
862
echo ' </div>';
863
echo '</div>';
864
}
@@ -867,20 +858,27 @@ function adrotate_notifications_dashboard() {
867
if($review_banner != 1 AND $review_banner < (adrotate_now() - 2419200) AND strpos($page, 'adrotate') !== false) {
868
echo '<div class="updated" style="padding: 0; margin: 0; border-left: none;">';
869
echo ' <div class="adrotate_banner">';
870
- echo ' <div class="button_div">';
871
- echo ' <a class="button" target="_blank" href="https://wordpress.org/support/view/plugin-reviews/adrotate?rate=5#postform">Rate AdRotate</a>';
872
- echo ' </div>';
873
- echo ' <div class="text">If you like <strong>AdRotate</strong> please let the world know that you do. Thanks for your support!<br />';
874
- echo ' <span>If you have questions, suggestions or something else that doesn\'t belong in a review, please <a href="https://ajdg.solutions/forums/forum/adrotate-for-wordpress/?utm_source=adrotate_free&utm_medium=adrotate_review_banner&utm_campaign=get_help" target="_blank">get in touch</a>!</span>';
875
- echo ' </div>';
876
- echo ' <a class="close_banner" href="admin.php?page=adrotate&hide=2"><small>dismiss</small></a>';
877
- echo ' <div class="icon">';
878
- echo ' <img title="" src="'.plugins_url('images/adrotate-logo-60x60.png', __FILE__).'" alt=""/>';
879
- echo ' </div>';
880
echo ' </div>';
881
echo '</div>';
882
}
883
}
884
}
885
886
/*-------------------------------------------------------------
@@ -894,7 +892,7 @@ function adrotate_notifications_dashboard() {
894
function adrotate_welcome_pointer() {
895
$pointer_content = '<h3>AdRotate '.ADROTATE_DISPLAY.'</h3>';
896
$pointer_content .= '<p>'.__('Welcome, and thanks for using AdRotate. Everything related to AdRotate is in this menu. Check out the', 'adrotate').' <a href="http:\/\/ajdg.solutions\/manuals\/adrotate\/" target="_blank">'.__('manuals', 'adrotate').'</a> '.__('and', 'adrotate').' <a href="https:\/\/ajdg.solutions\/forums\/forum\/adrotate-for-wordpress\/" target="_blank">'.__('forums', 'adrotate').'</a>.</p>';
897
- $pointer_content .= '<p><strong>AdRotate Professional</strong><br />Did you know there is also a premium version of AdRotate? Learn how you can benefit from the <a href="admin.php?page=adrotate-pro" target="_blank">extra features</a>.</p>';
898
?>
899
<script type="text/javascript">
900
jQuery(document).ready(function($) {
@@ -944,7 +942,7 @@ function adrotate_help_info() {
944
'id' => 'adrotate_thanks',
945
'title' => 'Thank You',
946
'content' => '<h4>Thank you for using AdRotate</h4><p>AdRotate is growing to be one of the most popular WordPress plugins for Advertising and is a household name for many companies around the world. AdRotate wouldn\'t be possible without your support and my life wouldn\'t be what it is today without your help.</p><p><em>- Arnan from AJdG Solutions</em></p>'.
947
- '<p><strong>Add me:</strong> <a href="http://twitter.com/ajdgsolutions/" target="_blank">Twitter</a>, <a href="https://www.facebook.com/adrotate" target="_blank">Facebook</a>. <strong>Business:</strong> <a href="https://ajdg.solutions/" target="_blank">ajdg.solutions</a> <strong>Blog:</strong> <a href="http://meandmymac.net/" target="_blank">meandmymac.net</a> and <strong>adventure:</strong> <a href="http://www.floatingcoconut.net/" target="_blank">floatingcoconut.net</a>.</p>'
948
)
949
);
950
}
25
if($banner_id) {
26
$banner = $wpdb->get_row($wpdb->prepare(
27
"SELECT
28
+ `id`, `bannercode`, `tracker`, `link`, `image`, `responsive`
29
FROM
30
`".$wpdb->prefix."adrotate`
31
WHERE
44
45
$selected = array($banner->id => 0);
46
$selected = adrotate_filter_schedule($selected, $banner);
47
} else {
48
$selected = false;
49
}
102
if($group) {
103
if($fallback == 0) $fallback = $group->fallback;
104
if($weight > 0) $weightoverride = " AND `{$wpdb->prefix}adrotate`.`weight` >= '{$weight}'";
105
106
// Get all ads in all selected groups
107
$ads = $wpdb->get_results(
124
OR `{$wpdb->prefix}adrotate`.`type` = '2days'
125
OR `{$wpdb->prefix}adrotate`.`type` = '7days')
126
{$weightoverride}
127
+ GROUP BY `{$wpdb->prefix}adrotate`.`id`
128
+ ORDER BY `{$wpdb->prefix}adrotate`.`id`;");
129
130
if($ads) {
131
if($adrotate_debug['general'] == true) {
157
if($group->modus == 1) { // Dynamic ads
158
$i = 1;
159
160
+ // Limit group to save resources
161
+ $amount = ($group->adspeed >= 10000) ? 10 : 20;
162
+
163
+ // Randomize and trim output
164
$selected = adrotate_shuffle($selected);
165
foreach($selected as $key => $banner) {
166
+ if($i <= $amount) {
167
+ $image = str_replace('%folder%', $adrotate_config['banner_folder'], $banner->image);
168
+
169
+ $output .= '<div class="g-dyn a-'.$banner->id.' c-'.$i.'">';
170
+ $output .= $before.adrotate_ad_output($banner->id, $group->id, $banner->bannercode, $banner->tracker, $banner->link, $image, $banner->responsive).$after;
171
+ $output .= '</div>';
172
+ $i++;
173
+ }
174
}
175
} else if($group->modus == 2) { // Block of ads
176
$block_count = $group->gridcolumns * $group->gridrows;
272
$paragraph_count = $group_count;
273
}
274
$group_choice = array_rand($group_array, $paragraph_count);
275
+ if(!is_array($group_choice)) $group_choice = array($group_choice);
276
277
shuffle($group_choice);
278
} else {
745
echo ' <h2 style="text-align: center;">'.__('Oh no! Something went wrong!', 'adrotate').'</h2>';
746
echo ' <p style="text-align: center;">'.__('WordPress was unable to verify the authenticity of the url you have clicked. Verify if the url used is valid or log in via your browser.', 'adrotate').'</p>';
747
echo ' <p style="text-align: center;">'.__('If you have received the url you want to visit via email, you are being tricked!', 'adrotate').'</p>';
748
+ echo ' <p style="text-align: center;">'.__('Contact support if the issue persists:', 'adrotate').' <a href="https://ajdg.solutions/forums/" title="AdRotate Support" target="_blank">AJdG Solutions Support</a>.</p>';
749
}
750
751
/*-------------------------------------------------------------
820
function adrotate_notifications_dashboard() {
821
global $adrotate_advert_status;
822
if(current_user_can('adrotate_ad_manage')) {
823
if(!is_array($adrotate_advert_status)) {
824
$data = unserialize($adrotate_advert_status);
825
} else {
846
if($pro_banner != 1 AND $pro_banner < (adrotate_now() - 604800) AND strpos($page, 'adrotate') !== false) {
847
echo '<div class="updated" style="padding: 0; margin: 0; border-left: none;">';
848
echo ' <div class="adrotate_banner">';
849
+ echo ' <div class="button_div"><a class="button" target="_blank" href="https://ajdg.solutions/products/adrotate-for-wordpress/?utm_source=adrotate_free&utm_medium=adrotate_free_banner&utm_campaign=upgrade_adrotatefree">'.__('Learn More', 'adrotate').'</a></div>';
850
+ echo ' <div class="text">'.__("You've been using <strong>AdRotate</strong> for a while now. Why not upgrade to the <strong>PRO</strong> version", 'adrotate').'?<br /><span>'.__('Get more features to even better run your advertising campaigns.', 'adrotate' ).' '.__('Thank you for your consideration!', 'adrotate' ).'</span></div>';
851
+ echo ' <a class="close_banner" href="admin.php?page=adrotate-pro&hide=1"><img title="Close" src="'.plugins_url('images/close-icon.png', __FILE__).'" alt=""/></a>';
852
+ echo ' <div class="icon"><img title="" src="'.plugins_url('images/adrotate-logo-60x60.png', __FILE__).'" alt=""/></div>';
853
echo ' </div>';
854
echo '</div>';
855
}
858
if($review_banner != 1 AND $review_banner < (adrotate_now() - 2419200) AND strpos($page, 'adrotate') !== false) {
859
echo '<div class="updated" style="padding: 0; margin: 0; border-left: none;">';
860
echo ' <div class="adrotate_banner">';
861
+ echo ' <div class="button_div"><a class="button" target="_blank" href="https://wordpress.org/support/view/plugin-reviews/adrotate?rate=5#postform">Rate AdRotate</a></div>';
862
+ echo ' <div class="text">If you like <strong>AdRotate</strong> please let the world know that you do. Thanks for your support!<br /><span>If you have questions, suggestions or something else that doesn\'t belong in a review, please <a href="https://ajdg.solutions/forums/forum/adrotate-for-wordpress/?utm_source=adrotate_free&utm_medium=adrotate_review_banner&utm_campaign=get_help" target="_blank">get in touch</a>!</span></div>';
863
+ echo ' <a class="close_banner" href="admin.php?page=adrotate&hide=2"><img title="Close" src="'.plugins_url('images/close-icon.png', __FILE__).'" alt=""/></a>';
864
+ echo ' <div class="icon"><img title="" src="'.plugins_url('images/adrotate-logo-60x60.png', __FILE__).'" alt=""/></div>';
865
echo ' </div>';
866
echo '</div>';
867
}
868
}
869
+
870
+ if(isset($_GET['upgrade']) AND $_GET['upgrade'] == 1) adrotate_check_upgrade();
871
+ $adrotate_db_version = get_option("adrotate_db_version");
872
+ $adrotate_version = get_option("adrotate_version");
873
+ if($adrotate_db_version['current'] < ADROTATE_DB_VERSION OR $adrotate_version['current'] < ADROTATE_VERSION) {
874
+ echo '<div class="updated" style="padding: 0; margin: 0; border-left: none;">';
875
+ echo ' <div class="adrotate_banner">';
876
+ echo ' <div class="button_div"><a class="button" href="admin.php?page=adrotate&upgrade=1">Upgrade Now</a></div>';
877
+ echo ' <div class="text">You have almost finished upgrading <strong>AdRotate</strong> to version <strong>'.ADROTATE_DISPLAY.'</strong>!<br /><span>To complete the update click the button on the left. This may take a few seconds to complete!</span></div>';
878
+ echo ' <div class="icon"><img title="" src="'.plugins_url('images/adrotate-logo-60x60.png', __FILE__).'" alt=""/></div>';
879
+ echo ' </div>';
880
+ echo '</div>';
881
+ }
882
}
883
884
/*-------------------------------------------------------------
892
function adrotate_welcome_pointer() {
893
$pointer_content = '<h3>AdRotate '.ADROTATE_DISPLAY.'</h3>';
894
$pointer_content .= '<p>'.__('Welcome, and thanks for using AdRotate. Everything related to AdRotate is in this menu. Check out the', 'adrotate').' <a href="http:\/\/ajdg.solutions\/manuals\/adrotate\/" target="_blank">'.__('manuals', 'adrotate').'</a> '.__('and', 'adrotate').' <a href="https:\/\/ajdg.solutions\/forums\/forum\/adrotate-for-wordpress\/" target="_blank">'.__('forums', 'adrotate').'</a>.</p>';
895
+ $pointer_content .= '<p><strong>AdRotate Professional</strong><br />Did you know there is also a premium version of AdRotate? Find out how you can benefit from the <a href="admin.php?page=adrotate-pro" target="_blank">extra features</a>.</p>';
896
?>
897
<script type="text/javascript">
898
jQuery(document).ready(function($) {
942
'id' => 'adrotate_thanks',
943
'title' => 'Thank You',
944
'content' => '<h4>Thank you for using AdRotate</h4><p>AdRotate is growing to be one of the most popular WordPress plugins for Advertising and is a household name for many companies around the world. AdRotate wouldn\'t be possible without your support and my life wouldn\'t be what it is today without your help.</p><p><em>- Arnan from AJdG Solutions</em></p>'.
945
+ '<p><strong>Add me:</strong> <a href="http://twitter.com/ajdgsolutions/" target="_blank">Twitter</a>, <a href="https://www.facebook.com/AJdgSolutions" target="_blank">Facebook</a>. <strong>Business:</strong> <a href="https://ajdg.solutions/" target="_blank">ajdg.solutions</a> <strong>Blog:</strong> <a href="http://meandmymac.net/" target="_blank">meandmymac.net</a> and <strong>adventure:</strong> <a href="http://www.floatingcoconut.net/" target="_blank">floatingcoconut.net</a>.</p>'
946
)
947
);
948
}
adrotate-setup.php CHANGED
@@ -48,63 +48,64 @@ function adrotate_activate($network_wide) {
48
function adrotate_activate_setup() {
49
global $wpdb, $current_user, $userdata;
50
51
- if(!current_user_can('activate_plugins')) {
52
deactivate_plugins(plugin_basename('adrotate/adrotate.php'));
53
- wp_die('You do not have appropriate access to activate this plugin! Contact your administrator!<br /><a href="'. get_option('siteurl').'/wp-admin/plugins.php">Back to plugins</a>.');
54
return;
55
} else {
56
- // Set defaults for internal versions
57
- add_option('adrotate_db_version', array('current' => ADROTATE_DB_VERSION, 'previous' => ''));
58
- add_option('adrotate_version', array('current' => ADROTATE_VERSION, 'previous' => ''));
59
-
60
- // Install tables for AdRotate
61
- adrotate_check_upgrade();
62
-
63
- // Set default settings and values
64
- add_option('adrotate_config', array());
65
- add_option('adrotate_notifications', array());
66
- add_option('adrotate_crawlers', array());
67
- add_option('adrotate_db_timer', date('U'));
68
- add_option('adrotate_debug', array('general' => false, 'dashboard' => false, 'userroles' => false, 'userstats' => false, 'stats' => false, 'track' => false));
69
- add_option('adrotate_advert_status', array('error' => 0, 'expired' => 0, 'expiressoon' => 0, 'normal' => 0, 'total' => 0));
70
- add_option('adrotate_geo_required', 0);
71
- add_option('adrotate_geo_requests', 0);
72
- add_option('adrotate_responsive_required', 0);
73
- add_option('adrotate_dynamic_required', 0);
74
- add_option('adrotate_hide_banner', adrotate_now());
75
- add_option('adrotate_hide_review', adrotate_now());
76
-
77
- adrotate_check_config();
78
-
79
- // Set the capabilities for the administrator
80
- $role = get_role('administrator');
81
- $role->add_cap("adrotate_advertiser");
82
- $role->add_cap("adrotate_global_report");
83
- $role->add_cap("adrotate_ad_manage");
84
- $role->add_cap("adrotate_ad_delete");
85
- $role->add_cap("adrotate_group_manage");
86
- $role->add_cap("adrotate_group_delete");
87
- $role->add_cap("adrotate_moderate");
88
- $role->add_cap("adrotate_moderate_approve");
89
-
90
- // Switch additional roles off
91
- adrotate_remove_roles();
92
- update_option('adrotate_roles', '0');
93
-
94
-
95
- // Set up some schedules
96
- $firstrun = adrotate_date_start('day');
97
- if(!wp_next_scheduled('adrotate_clean_trackerdata')) { // Periodically clean trackerdata
98
- wp_schedule_event($firstrun, 'twicedaily', 'adrotate_clean_trackerdata');
99
- }
100
-
101
- if(!wp_next_scheduled('adrotate_evaluate_ads')) {// Periodically check ads
102
- wp_schedule_event($firstrun + 1800, 'twicedaily', 'adrotate_evaluate_ads');
103
}
104
-
105
- // Attempt to make the some folders
106
- if(!is_dir(ABSPATH.'wp-content/banners')) mkdir(ABSPATH.'/wp-content/banners', 0755);
107
- if(!is_dir(ABSPATH.'wp-content/reports')) mkdir(ABSPATH.'/wp-content/reports', 0755);
108
}
109
}
110
@@ -139,16 +140,10 @@ function adrotate_deactivate_setup() {
139
update_option('adrotate_hide_review', adrotate_now());
140
141
// Clean up capabilities from ALL users
142
- adrotate_remove_capability("adrotate_advertiser");
143
- adrotate_remove_capability("adrotate_global_report");
144
adrotate_remove_capability("adrotate_ad_manage");
145
adrotate_remove_capability("adrotate_ad_delete");
146
adrotate_remove_capability("adrotate_group_manage");
147
adrotate_remove_capability("adrotate_group_delete");
148
- adrotate_remove_capability("adrotate_schedule_manage");
149
- adrotate_remove_capability("adrotate_schedule_delete");
150
- adrotate_remove_capability("adrotate_moderate");
151
- adrotate_remove_capability("adrotate_moderate_approve");
152
153
// Clear out wp_cron
154
wp_clear_scheduled_hook('adrotate_notification');
@@ -183,16 +178,16 @@ function adrotate_uninstall_setup() {
183
adrotate_deactivate_setup();
184
185
// Drop MySQL Tables
186
- $wpdb->query("DROP TABLE IF EXISTS `".$wpdb->prefix."adrotate`");
187
- $wpdb->query("DROP TABLE IF EXISTS `".$wpdb->prefix."adrotate_groups`");
188
- $wpdb->query("DROP TABLE IF EXISTS `".$wpdb->prefix."adrotate_tracker`");
189
- $wpdb->query("DROP TABLE IF EXISTS `".$wpdb->prefix."adrotate_blocks`"); // Obsolete in 3.9.10
190
- $wpdb->query("DROP TABLE IF EXISTS `".$wpdb->prefix."adrotate_linkmeta`");
191
- $wpdb->query("DROP TABLE IF EXISTS `".$wpdb->prefix."adrotate_stats`");
192
- $wpdb->query("DROP TABLE IF EXISTS `".$wpdb->prefix."adrotate_schedule`");
193
194
// Delete Options
195
- delete_option('adrotate_active');
196
delete_option('adrotate_advert_status');
197
delete_option('adrotate_config');
198
delete_option('adrotate_crawlers');
@@ -204,6 +199,7 @@ function adrotate_uninstall_setup() {
204
delete_option('adrotate_hide_review');
205
delete_option('adrotate_notifications');
206
delete_option('adrotate_geo_required');
207
delete_option('adrotate_responsive_required');
208
delete_option('adrotate_dynamic_required');
209
delete_option('adrotate_roles');
@@ -241,77 +237,6 @@ function adrotate_network_propagate($pfunction, $network_wide) {
241
call_user_func($pfunction, $network_wide);
242
}
243
244
- /*-------------------------------------------------------------
245
- Name: adrotate_check_upgrade
246
-
247
- Purpose: Checks if the plugin needs to upgrade stuff upon activation
248
- Receive: -none-
249
- Return: -none-
250
- Since: 3.7.3
251
- -------------------------------------------------------------*/
252
- function adrotate_check_upgrade() {
253
- global $wpdb, $current_user, $userdata;
254
-
255
- if(version_compare(PHP_VERSION, '5.3.0', '<') == -1) {
256
- deactivate_plugins(plugin_basename('adrotate/adrotate.php'));
257
- wp_die('AdRotate 3.10.8 and up requires PHP 5.3 or higher. Your server reports version '.PHP_VERSION.'. Contact your hosting provider about upgrading your server!<br /><a href="'. get_option('siteurl').'/wp-admin/plugins.php">Back to plugins</a>.');
258
- return;
259
- } else {
260
- $adrotate_db_version = get_option("adrotate_db_version");
261
- $adrotate_version = get_option("adrotate_version");
262
-
263
- // Check if there are tables with AdRotate in the name
264
- if($wpdb->get_var("SHOW TABLES LIKE '".$wpdb->prefix."adrotate%';")) {
265
-
266
- // Install missing bits in database
267
- adrotate_database_install();
268
-
269
- // Old version? Upgrade
270
- if(is_array($adrotate_db_version) AND $adrotate_db_version['current'] < ADROTATE_DB_VERSION) {
271
- adrotate_database_upgrade();
272
- // Verify all ads
273
- adrotate_prepare_evaluate_ads(false);
274
- }
275
- } else {
276
- // Install new database
277
- adrotate_database_install();
278
-
279
- // Initial data
280
- $now = adrotate_now();
281
- $in84days = $now + 7257600;
282
-
283
- // Demo ad 1
284
- $wpdb->insert($wpdb->prefix."adrotate", array('title' => 'Demo ad 468x60', 'bannercode' => '&lt;a href=\&quot;https:\/\/ajdg.solutions\&quot;&gt;&lt;img src=\&quot;http://ajdg.solutions/assets/dummy-banners/adrotate-468x60.jpg\&quot; /&gt;&lt;/a&gt;', 'thetime' => $now, 'updated' => $now, 'author' => $current_user->user_login, 'imagetype' => '', 'image' => '', 'link' => '', 'tracker' => 'N', 'responsive' => 'N', 'type' => 'active', 'weight' => 6, 'sortorder' => 0, 'cbudget' => 0, 'ibudget' => 0, 'crate' => 0, 'irate' => 0, 'cities' => serialize(array()), 'countries' => serialize(array())));
285
- $ad_id = $wpdb->insert_id;
286
- $wpdb->insert($wpdb->prefix.'adrotate_schedule', array('name' => 'Schedule for ad '.$ad_id, 'starttime' => $now, 'stoptime' => $in84days, 'maxclicks' => 0, 'maximpressions' => 0, 'spread' => 'N', 'dayimpressions' => 0));
287
- $schedule_id = $wpdb->insert_id;
288
- $wpdb->insert($wpdb->prefix.'adrotate_linkmeta', array('ad' => $ad_id, 'group' => 0, 'user' => 0, 'schedule' => $schedule_id));
289
- unset($ad_id, $schedule_id);
290
-
291
- // Demo ad 2
292
- $wpdb->insert($wpdb->prefix."adrotate", array('title' => 'Demo ad 200x200', 'bannercode' => '&lt;a href=\&quot;http:\/\/ajdg.solutions\&quot;&gt;&lt;img src=\&quot;http://ajdg.solutions/assets/dummy-banners/adrotate-200x200.jpg\&quot; /&gt;&lt;/a&gt;', 'thetime' => $now, 'updated' => $now, 'author' => $current_user->user_login, 'imagetype' => '', 'image' => '', 'link' => '', 'tracker' => 'N', 'responsive' => 'N', 'type' => 'active', 'weight' => 6, 'sortorder' => 0, 'cbudget' => 0, 'ibudget' => 0, 'crate' => 0, 'irate' => 0, 'cities' => serialize(array()), 'countries' => serialize(array())));
293
- $ad_id = $wpdb->insert_id;
294
- $wpdb->insert($wpdb->prefix.'adrotate_schedule', array('name' => 'Schedule for ad '.$ad_id, 'starttime' => $now, 'stoptime' => $in84days, 'maxclicks' => 0, 'maximpressions' => 0, 'spread' => 'N', 'dayimpressions' => 0));
295
- $schedule_id = $wpdb->insert_id;
296
- $wpdb->insert($wpdb->prefix.'adrotate_linkmeta', array('ad' => $ad_id, 'group' => 0, 'user' => 0, 'schedule' => $schedule_id));
297
- unset($ad_id, $schedule_id);
298
-
299
- // Demo ad 3 (Floating Coconut)
300
- $wpdb->insert($wpdb->prefix."adrotate", array('title' => 'Visit floatingcoconut.net', 'bannercode' => '&lt;a href=\&quot;http:\/\/www.floatingcoconut.net\&quot;&gt;&lt;img src=\&quot;http://ajdg.solutions/assets/banners/floatingcoconut-horizontal.jpg\&quot; /&gt;&lt;/a&gt;', 'thetime' => $now, 'updated' => $now, 'author' => $current_user->user_login, 'imagetype' => '', 'image' => '', 'link' => '', 'tracker' => 'Y', 'responsive' => 'N', 'type' => 'active', 'weight' => 6, 'sortorder' => 0, 'cbudget' => 0, 'ibudget' => 0, 'crate' => 0, 'irate' => 0, 'cities' => serialize(array()), 'countries' => serialize(array())));
301
- $ad_id = $wpdb->insert_id;
302
- $wpdb->insert($wpdb->prefix.'adrotate_schedule', array('name' => 'Schedule for ad '.$ad_id, 'starttime' => $now, 'stoptime' => $in84days, 'maxclicks' => 0, 'maximpressions' => 0, 'spread' => 'N', 'dayimpressions' => 0));
303
- $schedule_id = $wpdb->insert_id;
304
- $wpdb->insert($wpdb->prefix.'adrotate_linkmeta', array('ad' => $ad_id, 'group' => 0, 'user' => 0, 'schedule' => $schedule_id));
305
- unset($ad_id, $schedule_id);
306
- }
307
-
308
- // Check if there are changes to core that need upgrading
309
- if(is_array($adrotate_version) AND $adrotate_version['current'] < ADROTATE_VERSION) {
310
- adrotate_core_upgrade();
311
- }
312
- }
313
- }
314
-
315
/*-------------------------------------------------------------
316
Name: adrotate_check_config
317
@@ -386,6 +311,52 @@ function adrotate_check_config() {
386
387
}
388
389
/*-------------------------------------------------------------
390
Name: adrotate_database_install
391
@@ -399,22 +370,27 @@ function adrotate_database_install() {
399
400
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
401
402
- $tables = adrotate_list_tables();
403
404
- if ( $wpdb->has_cap( 'collation' ) ) {
405
- if ( ! empty($wpdb->charset) )
406
- $charset_collate = " DEFAULT CHARACTER SET $wpdb->charset";
407
- if ( ! empty($wpdb->collate) )
408
- $charset_collate .= " COLLATE $wpdb->collate";
409
}
410
411
- $engine = '';
412
- $found_engine = $wpdb->get_var("SELECT ENGINE FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = '".DB_NAME."' AND `TABLE_NAME` = '".$wpdb->prefix."posts';");
413
if(strtolower($found_engine) == 'innodb') {
414
$engine = ' ENGINE=InnoDB';
415
}
416
417
- dbDelta("CREATE TABLE IF NOT EXISTS `".$tables['adrotate']."` (
418
`id` mediumint(8) unsigned NOT NULL auto_increment,
419
`title` varchar(255) NOT NULL DEFAULT '',
420
`bannercode` longtext NOT NULL,
@@ -429,16 +405,17 @@ function adrotate_database_install() {
429
`type` varchar(10) NOT NULL default '0',
430
`weight` int(3) NOT NULL default '6',
431
`sortorder` int(5) NOT NULL default '0',
432
- `cbudget` double NOT NULL default '0',
433
- `ibudget` double NOT NULL default '0',
434
`crate` double NOT NULL default '0',
435
`irate` double NOT NULL default '0',
436
`cities` text NOT NULL,
437
`countries` text NOT NULL,
438
PRIMARY KEY (`id`)
439
) ".$charset_collate.$engine.";");
440
441
- dbDelta("CREATE TABLE IF NOT EXISTS `".$tables['adrotate_groups']."` (
442
`id` mediumint(8) unsigned NOT NULL auto_increment,
443
`name` varchar(255) NOT NULL default '',
444
`modus` tinyint(1) NOT NULL default '0',
@@ -465,8 +442,10 @@ function adrotate_database_install() {
465
`adspeed` int(5) NOT NULL DEFAULT '6000',
466
PRIMARY KEY (`id`)
467
) ".$charset_collate.$engine.";");
468
469
- dbDelta("CREATE TABLE IF NOT EXISTS `".$tables['adrotate_linkmeta']."` (
470
`id` mediumint(8) unsigned NOT NULL auto_increment,
471
`ad` int(5) unsigned NOT NULL default '0',
472
`group` int(5) unsigned NOT NULL default '0',
@@ -474,8 +453,10 @@ function adrotate_database_install() {
474
`schedule` int(5) unsigned NOT NULL default '0',
475
PRIMARY KEY (`id`)
476
) ".$charset_collate.$engine.";");
477
478
- dbDelta("CREATE TABLE IF NOT EXISTS `".$tables['adrotate_schedule']."` (
479
`id` int(8) unsigned NOT NULL auto_increment,
480
`name` varchar(255) NOT NULL default '',
481
`starttime` int(15) unsigned NOT NULL default '0',
@@ -487,8 +468,10 @@ function adrotate_database_install() {
487
PRIMARY KEY (`id`),
488
KEY `starttime` (`starttime`)
489
) ".$charset_collate.$engine.";");
490
491
- dbDelta("CREATE TABLE IF NOT EXISTS `".$tables['adrotate_stats']."` (
492
`id` bigint(9) unsigned NOT NULL auto_increment,
493
`ad` int(5) unsigned NOT NULL default '0',
494
`group` int(5) unsigned NOT NULL default '0',
@@ -499,8 +482,10 @@ function adrotate_database_install() {
499
INDEX `ad` (`ad`),
500
INDEX `thetime` (`thetime`)
501
) ".$charset_collate.$engine.";");
502
503
- dbDelta("CREATE TABLE IF NOT EXISTS `".$tables['adrotate_tracker']."` (
504
`id` bigint(9) unsigned NOT NULL auto_increment,
505
`ipaddress` varchar(15) NOT NULL default '0',
506
`timer` int(15) unsigned NOT NULL default '0',
@@ -513,6 +498,39 @@ function adrotate_database_install() {
513
KEY `ipaddress` (`ipaddress`),
514
KEY `timer` (`timer`)
515
) ".$charset_collate.$engine.";");
516
}
517
518
/*-------------------------------------------------------------
@@ -526,94 +544,89 @@ function adrotate_database_install() {
526
function adrotate_database_upgrade() {
527
global $wpdb;
528
529
- require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
530
-
531
- $tables = adrotate_list_tables();
532
-
533
$adrotate_db_version = get_option("adrotate_db_version");
534
535
// Database: 24
536
// AdRotate: 3.8b412
537
if($adrotate_db_version['current'] < 24) {
538
- if($wpdb->get_var("SHOW TABLES LIKE '".$wpdb->prefix."adrotate_stats_tracker'")) {
539
- $wpdb->query("RENAME TABLE `".$wpdb->prefix."adrotate_stats_tracker` TO `".$wpdb->prefix."adrotate_stats`;");
540
}
541
}
542
543
// Database: 25
544
// AdRotate: 3.8b413
545
if($adrotate_db_version['current'] < 25) {
546
- $wpdb->query("CREATE INDEX `timer` ON `".$tables['adrotate_tracker']."` (timer);");
547
- $wpdb->query("CREATE INDEX `ipaddress` ON `".$tables['adrotate_tracker']."` (ipaddress);");
548
- $wpdb->query("CREATE INDEX `ad` ON `".$tables['adrotate_stats']."` (ad);");
549
- $wpdb->query("CREATE INDEX `thetime` ON `".$tables['adrotate_stats']."` (thetime);");
550
}
551
552
// Database: 26
553
// AdRotate: 3.8.1
554
if($adrotate_db_version['current'] < 26) {
555
- adrotate_add_column($tables['adrotate'], 'cbudget', 'double NOT NULL default \'0\' AFTER `sortorder`');
556
- adrotate_add_column($tables['adrotate'], 'ibudget', 'double NOT NULL default \'0\' AFTER `cbudget`');
557
- adrotate_add_column($tables['adrotate'], 'crate', 'double NOT NULL default \'0\' AFTER `ibudget`');
558
- adrotate_add_column($tables['adrotate'], 'irate', 'double NOT NULL default \'0\' AFTER `crate`');
559
}
560
561
// Database: 30
562
// AdRotate: 3.8.3.4
563
if($adrotate_db_version['current'] < 30) {
564
- adrotate_add_column($tables['adrotate_groups'], 'wrapper_before', 'longtext NOT NULL AFTER `page_loc`');
565
- adrotate_add_column($tables['adrotate_groups'], 'wrapper_after', 'longtext NOT NULL AFTER `wrapper_before`');
566
}
567
568
// Database: 32
569
// AdRotate: 3.8.4.4
570
if($adrotate_db_version['current'] < 32) {
571
- adrotate_add_column($tables['adrotate'], 'cities', 'text NOT NULL AFTER `irate`');
572
- adrotate_add_column($tables['adrotate'], 'countries', 'text NOT NULL AFTER `cities`');
573
$geo_array = serialize(array());
574
- $wpdb->query("UPDATE `".$tables['adrotate']."` SET `cities` = '$geo_array' WHERE `cities` = '';");
575
- $wpdb->query("UPDATE `".$tables['adrotate']."` SET `countries` = '$geo_array' WHERE `countries` = '';");
576
- adrotate_add_column($tables['adrotate_groups'], 'geo', 'tinyint(1) NOT NULL default \'0\' AFTER `page_loc`');
577
}
578
579
// Database: 33
580
// AdRotate: 3.8.6
581
if($adrotate_db_version['current'] < 33) {
582
- adrotate_del_column($tables['adrotate_groups'], 'token');
583
- adrotate_add_column($tables['adrotate_groups'], 'modus', 'tinyint(1) NOT NULL default \'0\' AFTER `name`');
584
- adrotate_add_column($tables['adrotate_groups'], 'gridrows', 'int(3) NOT NULL default \'2\' AFTER `wrapper_after`');
585
- adrotate_add_column($tables['adrotate_groups'], 'gridcolumns', 'int(3) NOT NULL default \'2\' AFTER `gridrows`');
586
- adrotate_add_column($tables['adrotate_groups'], 'admargin', 'int(3) NOT NULL default \'1\' AFTER `gridcolumns`');
587
- adrotate_add_column($tables['adrotate_groups'], 'adwidth', 'varchar(4) NOT NULL default \'125\' AFTER `admargin`');
588
- adrotate_add_column($tables['adrotate_groups'], 'adheight', 'varchar(4) NOT NULL default \'125\' AFTER `adwidth`');
589
- adrotate_add_column($tables['adrotate_groups'], 'adspeed', 'int(5) NOT NULL default \'6000\' AFTER `adheight`');
590
}
591
592
593
// Database: 36
594
// AdRotate: 3.8.10
595
if($adrotate_db_version['current'] < 36) {
596
- adrotate_add_column($tables['adrotate_groups'], 'admargin_bottom', 'int(3) NOT NULL default \'1\' AFTER `admargin`');
597
- adrotate_add_column($tables['adrotate_groups'], 'admargin_left', 'int(3) NOT NULL default \'1\' AFTER `admargin_bottom`');
598
- adrotate_add_column($tables['adrotate_groups'], 'admargin_right', 'int(3) NOT NULL default \'1\' AFTER `admargin_left`');
599
}
600
601
// Database: 38
602
// AdRotate: 3.9
603
if($adrotate_db_version['current'] < 38) {
604
- adrotate_add_column($tables['adrotate_linkmeta'], 'schedule', 'int(5) NOT NULL default \'0\' AFTER `user`');
605
- $schedules = $wpdb->get_results("SELECT `id`, `ad` FROM ".$tables['adrotate_schedule']." ORDER BY `id` ASC;");
606
foreach($schedules as $schedule) {
607
- $wpdb->insert($tables['adrotate_linkmeta'], array('ad' => $schedule->ad, 'group' => 0, 'user' => 0, 'schedule' => $schedule->id), array('%d', '%d', '%d', '%d', '%d'));
608
unset($schedule);
609
}
610
unset($schedules);
611
- adrotate_add_column($tables['adrotate_schedule'], 'name', 'varchar(255) NOT NULL default \'\' AFTER `id`');
612
- adrotate_del_column($tables['adrotate_schedule'], 'ad');
613
614
- $schedules = $wpdb->get_results("SELECT `id` FROM ".$tables['adrotate_schedule']." WHERE `name` = '' ORDER BY `id` ASC;");
615
foreach($schedules as $schedule) {
616
- $wpdb->update($tables['adrotate_schedule'], array('name' => 'Schedule '.$schedule->id), array('id' => $schedule->id));
617
unset($schedule);
618
}
619
unset($schedules);
@@ -622,101 +635,108 @@ function adrotate_database_upgrade() {
622
// Database: 39
623
// AdRotate: 3.9.1
624
if($adrotate_db_version['current'] < 39) {
625
- adrotate_add_column($tables['adrotate_tracker'], 'country', 'text NOT NULL AFTER `useragent`');
626
- adrotate_add_column($tables['adrotate_tracker'], 'city', 'text NOT NULL AFTER `country`');
627
}
628
629
// Database: 40
630
// AdRotate: 3.9.9
631
if($adrotate_db_version['current'] < 40) {
632
- adrotate_add_column($tables['adrotate'], 'responsive', 'varchar(5) NOT NULL default \'N\' AFTER `tracker`');
633
}
634
635
// Database: 41
636
// AdRotate: 3.9.12
637
if($adrotate_db_version['current'] < 41) {
638
- adrotate_add_column($tables['adrotate_groups'], 'page_par', 'tinyint(1) NOT NULL default \'0\' AFTER `page_loc`');
639
- adrotate_add_column($tables['adrotate_groups'], 'cat_par', 'tinyint(1) NOT NULL default \'0\' AFTER `cat_loc`');
640
}
641
642
// Database: 42
643
// AdRotate: 3.10
644
if($adrotate_db_version['current'] < 42) {
645
- adrotate_add_column($tables['adrotate_schedule'], 'spread', 'varchar(5) NOT NULL default \'N\' AFTER `maximpressions`');
646
- adrotate_add_column($tables['adrotate_schedule'], 'hourimpressions', 'int(15) NOT NULL default \'0\' AFTER `spread`');
647
- $wpdb->query("ALTER TABLE `".$tables['adrotate_groups']."` CHANGE `page_par` `page_par` tinyint(2) NOT NULL default '0';");
648
- $wpdb->query("ALTER TABLE `".$tables['adrotate_groups']."` CHANGE `cat_par` `cat_par` tinyint(2) NOT NULL default '0';");
649
}
650
651
// Database: 43
652
// AdRotate: 3.10.7
653
if($adrotate_db_version['current'] < 43) {
654
- $wpdb->query("ALTER TABLE `".$tables['adrotate_groups']."` CHANGE `admargin` `admargin` int(2) NOT NULL default '0';");
655
- $wpdb->query("ALTER TABLE `".$tables['adrotate_groups']."` CHANGE `admargin_bottom` `admargin_bottom` int(2) NOT NULL default '0';");
656
- $wpdb->query("ALTER TABLE `".$tables['adrotate_groups']."` CHANGE `admargin_left` `admargin_left` int(2) NOT NULL default '0';");
657
- $wpdb->query("ALTER TABLE `".$tables['adrotate_groups']."` CHANGE `admargin_right` `admargin_right` int(2) NOT NULL default '0';");
658
}
659
660
// Database: 44
661
// AdRotate: 3.10.8
662
if($adrotate_db_version['current'] < 44) {
663
- adrotate_del_column($tables['adrotate'], 'timeframe');
664
- adrotate_del_column($tables['adrotate'], 'timeframelength');
665
- adrotate_del_column($tables['adrotate'], 'timeframeclicks');
666
- adrotate_del_column($tables['adrotate'], 'timeframeimpressions');
667
}
668
669
// Database: 46
670
// AdRotate: 3.10.13
671
if($adrotate_db_version['current'] < 46) {
672
- $wpdb->query("ALTER TABLE `".$tables['adrotate_schedule']."` CHANGE `hourimpressions` `dayimpressions` int(15) NOT NULL default '0';");
673
}
674
675
// Database: 47
676
// AdRotate: 3.10.18
677
if($adrotate_db_version['current'] < 47) {
678
- adrotate_add_column($tables['adrotate_groups'], 'align', 'tinyint(1) NOT NULL default \'0\' AFTER `wrapper_after`');
679
}
680
681
// Database: 48
682
// AdRotate: 3.11.2b2
683
if($adrotate_db_version['current'] < 48) {
684
- if($wpdb->get_var("SHOW INDEX FROM `".$tables['adrotate_tracker']."` WHERE Key_name = 'bannerid';") !== null) {
685
- $wpdb->query("ALTER TABLE `".$tables['adrotate_tracker']."` DROP KEY `bannerid`;");
686
}
687
- if($wpdb->get_var("SHOW INDEX FROM `".$tables['adrotate_schedule']."` WHERE Key_name = 'stoptime';") !== null) {
688
- $wpdb->query("ALTER TABLE `".$tables['adrotate_schedule']."` DROP KEY `stoptime`;");
689
}
690
- if($wpdb->get_var("SHOW INDEX FROM `".$tables['adrotate_schedule']."` WHERE Key_name = 'ad';") !== null) {
691
- $wpdb->query("ALTER TABLE `".$tables['adrotate_schedule']."` DROP KEY `ad`;");
692
}
693
- adrotate_del_column($tables['adrotate_stats'], 'block');
694
- adrotate_del_column($tables['adrotate_linkmeta'], 'block');
695
}
696
697
// Database: 49
698
// AdRotate: 3.11.2b3
699
if($adrotate_db_version['current'] < 49) {
700
- $wpdb->query("ALTER TABLE `".$tables['adrotate_stats']."` CHANGE `ad` `ad` INT(5) UNSIGNED NOT NULL DEFAULT '0';");
701
- $wpdb->query("ALTER TABLE `".$tables['adrotate_stats']."` CHANGE `group` `group` INT(5) UNSIGNED NOT NULL DEFAULT '0';");
702
- $wpdb->query("ALTER TABLE `".$tables['adrotate_stats']."` CHANGE `thetime` `thetime` INT(15) UNSIGNED NOT NULL DEFAULT '0';");
703
- $wpdb->query("ALTER TABLE `".$tables['adrotate_stats']."` CHANGE `clicks` `clicks` INT(15) UNSIGNED NOT NULL DEFAULT '0';");
704
- $wpdb->query("ALTER TABLE `".$tables['adrotate_stats']."` CHANGE `impressions` `impressions` INT(15) UNSIGNED NOT NULL DEFAULT '0';");
705
-
706
- $wpdb->query("ALTER TABLE `".$tables['adrotate_tracker']."` CHANGE `ipaddress` `ipaddress` char(15) NOT NULL DEFAULT '';");
707
- $wpdb->query("ALTER TABLE `".$tables['adrotate_tracker']."` CHANGE `timer` `timer` INT(15) UNSIGNED NOT NULL DEFAULT '0';");
708
- $wpdb->query("ALTER TABLE `".$tables['adrotate_tracker']."` CHANGE `bannerid` `bannerid` INT(15) UNSIGNED NOT NULL DEFAULT '0';");
709
-
710
- $wpdb->query("ALTER TABLE `".$tables['adrotate_schedule']."` CHANGE `starttime` `starttime` INT(15) UNSIGNED NOT NULL DEFAULT '0';");
711
- $wpdb->query("ALTER TABLE `".$tables['adrotate_schedule']."` CHANGE `stoptime` `stoptime` INT(15) UNSIGNED NOT NULL DEFAULT '0';");
712
- $wpdb->query("ALTER TABLE `".$tables['adrotate_schedule']."` CHANGE `maxclicks` `maxclicks` INT(15) UNSIGNED NOT NULL DEFAULT '0';");
713
- $wpdb->query("ALTER TABLE `".$tables['adrotate_schedule']."` CHANGE `maximpressions` `maximpressions` INT(15) UNSIGNED NOT NULL DEFAULT '0';");
714
- $wpdb->query("ALTER TABLE `".$tables['adrotate_schedule']."` CHANGE `dayimpressions` `dayimpressions` INT(15) UNSIGNED NOT NULL DEFAULT '0';");
715
-
716
- $wpdb->query("ALTER TABLE `".$tables['adrotate_linkmeta']."` CHANGE `ad` `ad` INT(5) UNSIGNED NOT NULL DEFAULT '0';");
717
- $wpdb->query("ALTER TABLE `".$tables['adrotate_linkmeta']."` CHANGE `group` `group` INT(5) UNSIGNED NOT NULL DEFAULT '0';");
718
- $wpdb->query("ALTER TABLE `".$tables['adrotate_linkmeta']."` CHANGE `user` `user` INT(5) UNSIGNED NOT NULL DEFAULT '0';");
719
- $wpdb->query("ALTER TABLE `".$tables['adrotate_linkmeta']."` CHANGE `schedule` `schedule` INT(5) UNSIGNED NOT NULL DEFAULT '0';");
720
}
721
722
update_option("adrotate_db_version", array('current' => ADROTATE_DB_VERSION, 'previous' => $adrotate_db_version['current']));
@@ -881,10 +901,9 @@ function adrotate_optimize_database() {
881
882
$adrotate_db_timer = get_option('adrotate_db_timer');
883
$now = adrotate_now();
884
- $tables = adrotate_list_tables();
885
886
if($adrotate_db_timer < ($now - 86400)) {
887
- dbDelta("OPTIMIZE TABLE `".$tables['adrotate']."`, `".$tables['adrotate_groups']."`, `".$tables['adrotate_linkmeta']."`, `".$tables['adrotate_stats']."`, `".$tables['adrotate_tracker']."`, `".$tables['adrotate_schedule']."`, ;");
888
update_option('adrotate_db_timer', $now);
889
adrotate_return('db_optimized');
890
} else {
@@ -907,26 +926,26 @@ function adrotate_cleanup_database() {
907
908
// Delete expired schedules
909
if(isset($_POST['adrotate_db_cleanup_schedules'])) {
910
- $wpdb->query("DELETE FROM `".$wpdb->prefix."adrotate_schedule` WHERE `stoptime` < $now;");
911
}
912
913
// Delete old stats
914
if(isset($_POST['adrotate_db_cleanup_statistics'])) {
915
$lastyear = $now - 30758400;
916
- $wpdb->query("DELETE FROM `".$wpdb->prefix."adrotate_stats` WHERE `thetime` < $lastyear;");
917
}
918
919
// Clean up Tracker data
920
$yesterday = $now - 2073600;
921
- $wpdb->query("DELETE FROM `".$wpdb->prefix."adrotate_tracker` WHERE `timer` < $yesterday;");
922
923
// Delete empty ads, groups and schedules
924
- $wpdb->query("DELETE FROM `".$wpdb->prefix."adrotate` WHERE `type` = 'empty' OR `type` = 'a_empty';");
925
- $wpdb->query("DELETE FROM `".$wpdb->prefix."adrotate_groups` WHERE `name` = '';");
926
927
// Clean up meta data
928
- $ads = $wpdb->get_results("SELECT `id` FROM `".$wpdb->prefix."adrotate` ORDER BY `id`;");
929
- $metas = $wpdb->get_results("SELECT `id`, `ad` FROM `".$wpdb->prefix."adrotate_linkmeta` WHERE `ad` != '0' ORDER BY `id`;");
930
931
$adverts = $linkmeta = array();
932
foreach($ads as $ad) {
@@ -938,13 +957,13 @@ function adrotate_cleanup_database() {
938
939
$result = array_diff($linkmeta, $adverts);
940
foreach($result as $key => $value) {
941
- $wpdb->query("DELETE FROM `".$wpdb->prefix."adrotate_linkmeta` WHERE `id` = $key;");
942
unset($result[$key]);
943
}
944
unset($ads, $metas, $adverts, $linkmeta, $result);
945
946
// Clean up stray linkmeta
947
- $wpdb->query("DELETE FROM `".$wpdb->prefix."adrotate_linkmeta` WHERE `ad` = 0 OR `ad` = '';");
948
949
adrotate_return('db_cleaned');
950
}
@@ -964,7 +983,7 @@ function adrotate_clean_trackerdata() {
964
$clicks = $now - 86400;
965
$impressions = $now - 3600;
966
967
- $wpdb->query("DELETE FROM `".$wpdb->prefix."adrotate_tracker` WHERE (`timer` < ".$clicks." AND `stat` = 'c') OR (`timer` < ".$impressions." AND `stat` = 'i') OR `ipaddress` = 'unknown' OR `ipaddress` = '';");
968
}
969
970
/*-------------------------------------------------------------
@@ -1011,27 +1030,4 @@ function adrotate_del_column($table_name, $column_name) {
1011
1012
return false;
1013
}
1014
-
1015
- /*-------------------------------------------------------------
1016
- Name: adrotate_list_tables
1017
-
1018
- Purpose: List tables for AdRotate in an array
1019
- Receive: -None-
1020
- Return: -None-
1021
- Since: 3.4
1022
- -------------------------------------------------------------*/
1023
- function adrotate_list_tables() {
1024
- global $wpdb;
1025
-
1026
- $tables = array(
1027
- 'adrotate' => $wpdb->prefix . "adrotate", // Since 0.1
1028
- 'adrotate_groups' => $wpdb->prefix . "adrotate_groups", // Since 0.2
1029
- 'adrotate_tracker' => $wpdb->prefix . "adrotate_tracker", // Since 2.0
1030
- 'adrotate_linkmeta' => $wpdb->prefix . "adrotate_linkmeta", // Since 3.0
1031
- 'adrotate_stats' => $wpdb->prefix . "adrotate_stats", // Since 3.5 (renamed in 3.8)
1032
- 'adrotate_schedule' => $wpdb->prefix . "adrotate_schedule", // Since 3.6.11a1
1033
- );
1034
-
1035
- return $tables;
1036
- }
1037
?>
48
function adrotate_activate_setup() {
49
global $wpdb, $current_user, $userdata;
50
51
+ if(version_compare(PHP_VERSION, '5.3.0', '<') == -1) {
52
deactivate_plugins(plugin_basename('adrotate/adrotate.php'));
53
+ wp_die('AdRotate 3.10.8 and newer requires PHP 5.3 or higher. Your server reports version '.PHP_VERSION.'. Contact your hosting provider about upgrading your server!<br /><a href="'. get_option('siteurl').'/wp-admin/plugins.php">Back to dashboard</a>.');
54
return;
55
} else {
56
+ if(!current_user_can('activate_plugins')) {
57
+ deactivate_plugins(plugin_basename('adrotate/adrotate.php'));
58
+ wp_die('You do not have appropriate access to activate this plugin! Contact your administrator!<br /><a href="'. get_option('siteurl').'/wp-admin/plugins.php">Back to dashboard</a>.');
59
+ return;
60
+ } else {
61
+ // Set defaults for internal versions
62
+ add_option('adrotate_db_version', array('current' => ADROTATE_DB_VERSION, 'previous' => ''));
63
+ add_option('adrotate_version', array('current' => ADROTATE_VERSION, 'previous' => ''));
64
+
65
+ // Set default settings and values
66
+ add_option('adrotate_config', array());
67
+ add_option('adrotate_notifications', array());
68
+ add_option('adrotate_crawlers', array());
69
+ add_option('adrotate_db_timer', date('U'));
70
+ add_option('adrotate_debug', array('general' => false, 'dashboard' => false, 'userroles' => false, 'userstats' => false, 'stats' => false, 'track' => false));
71
+ add_option('adrotate_advert_status', array('error' => 0, 'expired' => 0, 'expiressoon' => 0, 'normal' => 0, 'total' => 0));
72
+ add_option('adrotate_geo_required', 0);
73
+ add_option('adrotate_geo_requests', 0);
74
+ add_option('adrotate_responsive_required', 0);
75
+ add_option('adrotate_dynamic_required', 0);
76
+ add_option('adrotate_hide_banner', adrotate_now());
77
+ add_option('adrotate_hide_review', adrotate_now());
78
+
79
+ // Install new database
80
+ adrotate_database_install();
81
+ adrotate_dummy_data();
82
+ adrotate_check_config();
83
+
84
+ // Set the capabilities for the administrator
85
+ $role = get_role('administrator');
86
+ $role->add_cap("adrotate_ad_manage");
87
+ $role->add_cap("adrotate_ad_delete");
88
+ $role->add_cap("adrotate_group_manage");
89
+ $role->add_cap("adrotate_group_delete");
90
+
91
+ // Switch additional roles off
92
+ adrotate_remove_roles();
93
+ update_option('adrotate_roles', '0');
94
+
95
+ // Set up some schedules
96
+ $firstrun = adrotate_date_start('day');
97
+ if(!wp_next_scheduled('adrotate_clean_trackerdata')) { // Periodically clean trackerdata
98
+ wp_schedule_event($firstrun, 'twicedaily', 'adrotate_clean_trackerdata');
99
+ }
100
+
101
+ if(!wp_next_scheduled('adrotate_evaluate_ads')) {// Periodically check ads
102
+ wp_schedule_event($firstrun + 1800, 'twicedaily', 'adrotate_evaluate_ads');
103
+ }
104
+
105
+ // Attempt to make the some folders
106
+ if(!is_dir(ABSPATH.'wp-content/banners')) mkdir(ABSPATH.'/wp-content/banners', 0755);
107
+ if(!is_dir(ABSPATH.'wp-content/reports')) mkdir(ABSPATH.'/wp-content/reports', 0755);
108
}
109
}
110
}
111
140
update_option('adrotate_hide_review', adrotate_now());
141
142
// Clean up capabilities from ALL users
143
adrotate_remove_capability("adrotate_ad_manage");
144
adrotate_remove_capability("adrotate_ad_delete");
145
adrotate_remove_capability("adrotate_group_manage");
146
adrotate_remove_capability("adrotate_group_delete");
147
148
// Clear out wp_cron
149
wp_clear_scheduled_hook('adrotate_notification');
178
adrotate_deactivate_setup();
179
180
// Drop MySQL Tables
181
+ $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate`");
182
+ $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_groups`");
183
+ $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_tracker`");
184
+ $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_blocks`"); // Obsolete in 3.9.10
185
+ $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_linkmeta`");
186
+ $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_stats`");
187
+ $wpdb->query("DROP TABLE IF EXISTS `{$wpdb->prefix}adrotate_schedule`");
188
189
// Delete Options
190
+ delete_option('adrotate_activate');
191
delete_option('adrotate_advert_status');
192
delete_option('adrotate_config');
193
delete_option('adrotate_crawlers');
199
delete_option('adrotate_hide_review');
200
delete_option('adrotate_notifications');
201
delete_option('adrotate_geo_required');
202
+ delete_option('adrotate_geo_requests');
203
delete_option('adrotate_responsive_required');
204
delete_option('adrotate_dynamic_required');
205
delete_option('adrotate_roles');
237
call_user_func($pfunction, $network_wide);
238
}
239
240
/*-------------------------------------------------------------
241
Name: adrotate_check_config
242
311
312
}
313
314
+ /*-------------------------------------------------------------
315
+ Name: adrotate_dummy_data
316
+
317
+ Purpose: Install dummy data in empty tables
318
+ Receive: -none-
319
+ Return: -none-
320
+ Since: 3.11.3
321
+ -------------------------------------------------------------*/
322
+ function adrotate_dummy_data() {
323
+ global $wpdb;
324
+
325
+ // Initial data
326
+ $now = adrotate_now();
327
+ $in84days = $now + 7257600;
328
+
329
+ $no_ads = $wpdb->get_var("SELECT `id` FROM `{$wpdb->prefix}adrotate` LIMIT 1;");
330
+ $no_schedules = $wpdb->get_var("SELECT `id` FROM `{$wpdb->prefix}adrotate_schedule` LIMIT 1;");
331
+ $no_linkmeta = $wpdb->get_var("SELECT `id` FROM `{$wpdb->prefix}adrotate_linkmeta` LIMIT 1;");
332
+
333
+ if(is_null($no_ads) AND is_null($no_schedules) AND is_null($no_linkmeta)) {
334
+ // Demo ad 1
335
+ $wpdb->insert("{$wpdb->prefix}adrotate", array('title' => 'Demo ad 468x60', 'bannercode' => '&lt;a href=\&quot;https:\/\/ajdg.solutions\&quot;&gt;&lt;img src=\&quot;http://ajdg.solutions/assets/dummy-banners/adrotate-468x60.jpg\&quot; /&gt;&lt;/a&gt;', 'thetime' => $now, 'updated' => $now, 'author' => $current_user->user_login, 'imagetype' => '', 'image' => '', 'link' => '', 'tracker' => 'N', 'responsive' => 'N', 'type' => 'active', 'weight' => 6, 'sortorder' => 0, 'budget' => 0, 'crate' => 0, 'irate' => 0, 'cities' => serialize(array()), 'countries' => serialize(array())));
336
+ $ad_id = $wpdb->insert_id;
337
+ $wpdb->insert("{$wpdb->prefix}adrotate_schedule", array('name' => 'Schedule for ad '.$ad_id, 'starttime' => $now, 'stoptime' => $in84days, 'maxclicks' => 0, 'maximpressions' => 0, 'spread' => 'N', 'dayimpressions' => 0));
338
+ $schedule_id = $wpdb->insert_id;
339
+ $wpdb->insert("{$wpdb->prefix}adrotate_linkmeta", array('ad' => $ad_id, 'group' => 0, 'user' => 0, 'schedule' => $schedule_id));
340
+ unset($ad_id, $schedule_id);
341
+
342
+ // Demo ad 2
343
+ $wpdb->insert("{$wpdb->prefix}adrotate", array('title' => 'Demo ad 200x200', 'bannercode' => '&lt;a href=\&quot;http:\/\/ajdg.solutions\&quot;&gt;&lt;img src=\&quot;http://ajdg.solutions/assets/dummy-banners/adrotate-200x200.jpg\&quot; /&gt;&lt;/a&gt;', 'thetime' => $now, 'updated' => $now, 'author' => $current_user->user_login, 'imagetype' => '', 'image' => '', 'link' => '', 'tracker' => 'N', 'responsive' => 'N', 'type' => 'active', 'weight' => 6, 'sortorder' => 0, 'budget' => 0, 'crate' => 0, 'irate' => 0, 'cities' => serialize(array()), 'countries' => serialize(array())));
344
+ $ad_id = $wpdb->insert_id;
345
+ $wpdb->insert("{$wpdb->prefix}adrotate_schedule", array('name' => 'Schedule for ad '.$ad_id, 'starttime' => $now, 'stoptime' => $in84days, 'maxclicks' => 0, 'maximpressions' => 0, 'spread' => 'N', 'dayimpressions' => 0));
346
+ $schedule_id = $wpdb->insert_id;
347
+ $wpdb->insert("{$wpdb->prefix}adrotate_linkmeta", array('ad' => $ad_id, 'group' => 0, 'user' => 0, 'schedule' => $schedule_id));
348
+ unset($ad_id, $schedule_id);
349
+
350
+ // Demo ad 3 (Floating Coconut)
351
+ $wpdb->insert("{$wpdb->prefix}adrotate", array('title' => 'Visit floatingcoconut.net', 'bannercode' => '&lt;a href=\&quot;http:\/\/www.floatingcoconut.net\&quot;&gt;&lt;img src=\&quot;http://ajdg.solutions/assets/banners/floatingcoconut-horizontal.jpg\&quot; /&gt;&lt;/a&gt;', 'thetime' => $now, 'updated' => $now, 'author' => $current_user->user_login, 'imagetype' => '', 'image' => '', 'link' => '', 'tracker' => 'Y', 'responsive' => 'N', 'type' => 'active', 'weight' => 6, 'sortorder' => 0, 'budget' => 0, 'crate' => 0, 'irate' => 0, 'cities' => serialize(array()), 'countries' => serialize(array())));
352
+ $ad_id = $wpdb->insert_id;
353
+ $wpdb->insert("{$wpdb->prefix}adrotate_schedule", array('name' => 'Schedule for ad '.$ad_id, 'starttime' => $now, 'stoptime' => $in84days, 'maxclicks' => 0, 'maximpressions' => 0, 'spread' => 'N', 'dayimpressions' => 0));
354
+ $schedule_id = $wpdb->insert_id;
355
+ $wpdb->insert("{$wpdb->prefix}adrotate_linkmeta", array('ad' => $ad_id, 'group' => 0, 'user' => 0, 'schedule' => $schedule_id));
356
+ unset($ad_id, $schedule_id);
357
+ }
358
+ }
359
+
360
/*-------------------------------------------------------------
361
Name: adrotate_database_install
362
370
371
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
372
373
+ // Initial data
374
+ $charset_collate = $engine = '';
375
+ $now = adrotate_now();
376
+ $in84days = $now + 7257600;
377
378
+ if(!empty($wpdb->charset)) {
379
+ $charset_collate .= " DEFAULT CHARACTER SET {$wpdb->charset}";
380
+ }
381
+ if($wpdb->has_cap('collation') AND !empty($wpdb->collate)) {
382
+ $charset_collate .= " COLLATE {$wpdb->collate}";
383
}
384
385
+ $found_engine = $wpdb->get_var("SELECT ENGINE FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA` = '".DB_NAME."' AND `TABLE_NAME` = '{$wpdb->prefix}posts';");
386
if(strtolower($found_engine) == 'innodb') {
387
$engine = ' ENGINE=InnoDB';
388
}
389
390
+ $found_tables = $wpdb->get_col("SHOW TABLES LIKE '{$wpdb->prefix}adrotate';");
391
+
392
+ if(!in_array("{$wpdb->prefix}adrotate", $found_tables)) {
393
+ dbDelta("CREATE TABLE `{$wpdb->prefix}adrotate` (
394
`id` mediumint(8) unsigned NOT NULL auto_increment,
395
`title` varchar(255) NOT NULL DEFAULT '',
396
`bannercode` longtext NOT NULL,
405
`type` varchar(10) NOT NULL default '0',
406
`weight` int(3) NOT NULL default '6',
407
`sortorder` int(5) NOT NULL default '0',
408
+ `budget` double NOT NULL default '0',
409
`crate` double NOT NULL default '0',
410
`irate` double NOT NULL default '0',
411
`cities` text NOT NULL,
412
`countries` text NOT NULL,
413
PRIMARY KEY (`id`)
414
) ".$charset_collate.$engine.";");
415
+ }
416
417
+ if(!in_array("{$wpdb->prefix}adrotate_groups", $found_tables)) {
418
+ dbDelta("CREATE TABLE `{$wpdb->prefix}adrotate_groups` (
419
`id` mediumint(8) unsigned NOT NULL auto_increment,
420
`name` varchar(255) NOT NULL default '',
421
`modus` tinyint(1) NOT NULL default '0',
442
`adspeed` int(5) NOT NULL DEFAULT '6000',
443
PRIMARY KEY (`id`)
444
) ".$charset_collate.$engine.";");
445
+ }
446
447
+ if(!in_array("{$wpdb->prefix}adrotate_linkmeta", $found_tables)) {
448
+ dbDelta("CREATE TABLE `{$wpdb->prefix}adrotate_linkmeta` (
449
`id` mediumint(8) unsigned NOT NULL auto_increment,
450
`ad` int(5) unsigned NOT NULL default '0',
451
`group` int(5) unsigned NOT NULL default '0',
453
`schedule` int(5) unsigned NOT NULL default '0',
454
PRIMARY KEY (`id`)
455
) ".$charset_collate.$engine.";");
456
+ }
457
458
+ if(!in_array("{$wpdb->prefix}adrotate_schedule", $found_tables)) {
459
+ dbDelta("CREATE TABLE `{$wpdb->prefix}adrotate_schedule` (
460
`id` int(8) unsigned NOT NULL auto_increment,
461
`name` varchar(255) NOT NULL default '',
462
`starttime` int(15) unsigned NOT NULL default '0',
468
PRIMARY KEY (`id`),
469
KEY `starttime` (`starttime`)
470
) ".$charset_collate.$engine.";");
471
+ }
472
473
+ if(!in_array("{$wpdb->prefix}adrotate_stats", $found_tables)) {
474
+ dbDelta("CREATE TABLE `{$wpdb->prefix}adrotate_stats` (
475
`id` bigint(9) unsigned NOT NULL auto_increment,
476
`ad` int(5) unsigned NOT NULL default '0',
477
`group` int(5) unsigned NOT NULL default '0',
482
INDEX `ad` (`ad`),
483
INDEX `thetime` (`thetime`)
484
) ".$charset_collate.$engine.";");
485
+ }
486
487
+ if(!in_array("{$wpdb->prefix}adrotate_tracker", $found_tables)) {
488
+ dbDelta("CREATE TABLE `{$wpdb->prefix}adrotate_tracker` (
489
`id` bigint(9) unsigned NOT NULL auto_increment,
490
`ipaddress` varchar(15) NOT NULL default '0',
491
`timer` int(15) unsigned NOT NULL default '0',
498
KEY `ipaddress` (`ipaddress`),
499
KEY `timer` (`timer`)
500
) ".$charset_collate.$engine.";");
501
+ }
502
+ }
503
+
504
+
505
+ /*-------------------------------------------------------------
506
+ Name: adrotate_check_upgrade
507
+
508
+ Purpose: Checks if the plugin needs to upgrade stuff upon activation
509
+ Receive: -none-
510
+ Return: -none-
511
+ Since: 3.7.3
512
+ -------------------------------------------------------------*/
513
+ function adrotate_check_upgrade() {
514
+ global $wpdb;
515
+
516
+ if(version_compare(PHP_VERSION, '5.3.0', '<') == -1) {
517
+ deactivate_plugins(plugin_basename('adrotate/adrotate.php'));
518
+ wp_die('AdRotate 3.10.8 and up requires PHP 5.3 or higher. Your server reports version '.PHP_VERSION.'. Contact your hosting provider about upgrading your server!<br /><a href="'. get_option('siteurl').'/wp-admin/plugins.php">Back to plugins</a>.');
519
+ return;
520
+ } else {
521
+ // Old version? Upgrade
522
+ $adrotate_db_version = get_option("adrotate_db_version");
523
+ if($adrotate_db_version['current'] < ADROTATE_DB_VERSION) {
524
+ adrotate_database_upgrade();
525
+ adrotate_prepare_evaluate_ads(false);
526
+ }
527
+
528
+ // Check if there are changes to core that need upgrading
529
+ $adrotate_version = get_option("adrotate_version");
530
+ if($adrotate_version['current'] < ADROTATE_VERSION) {
531
+ adrotate_core_upgrade();
532
+ }
533
+ }
534
}
535
536
/*-------------------------------------------------------------
544
function adrotate_database_upgrade() {
545
global $wpdb;
546
547
$adrotate_db_version = get_option("adrotate_db_version");
548
549
// Database: 24
550
// AdRotate: 3.8b412
551
if($adrotate_db_version['current'] < 24) {
552
+ if($wpdb->get_var("SHOW TABLES LIKE '{$wpdb->prefix}adrotate_stats_tracker'")) {
553
+ $wpdb->query("RENAME TABLE `{$wpdb->prefix}adrotate_stats_tracker` TO `{$wpdb->prefix}adrotate_stats`;");
554
}
555
}
556
557
// Database: 25
558
// AdRotate: 3.8b413
559
if($adrotate_db_version['current'] < 25) {
560
+ $wpdb->query("CREATE INDEX `timer` ON `{$wpdb->prefix}adrotate_tracker` (timer);");
561
+ $wpdb->query("CREATE INDEX `ipaddress` ON `{$wpdb->prefix}adrotate_tracker` (ipaddress);");
562
+ $wpdb->query("CREATE INDEX `ad` ON `{$wpdb->prefix}adrotate_stats` (ad);");
563
+ $wpdb->query("CREATE INDEX `thetime` ON `{$wpdb->prefix}adrotate_stats` (thetime);");
564
}
565
566
// Database: 26
567
// AdRotate: 3.8.1
568
if($adrotate_db_version['current'] < 26) {
569
+ adrotate_add_column("{$wpdb->prefix}adrotate", 'budget', 'double NOT NULL default \'0\' AFTER `sortorder`');
570
+ adrotate_add_column("{$wpdb->prefix}adrotate", 'crate', 'double NOT NULL default \'0\' AFTER `budget`');
571
+ adrotate_add_column("{$wpdb->prefix}adrotate", 'irate', 'double NOT NULL default \'0\' AFTER `crate`');
572
}
573
574
// Database: 30
575
// AdRotate: 3.8.3.4
576
if($adrotate_db_version['current'] < 30) {
577
+ adrotate_add_column("{$wpdb->prefix}adrotate_groups", 'wrapper_before', 'longtext NOT NULL AFTER `page_loc`');
578
+ adrotate_add_column("{$wpdb->prefix}adrotate_groups", 'wrapper_after', 'longtext NOT NULL AFTER `wrapper_before`');
579
}
580
581
// Database: 32
582
// AdRotate: 3.8.4.4
583
if($adrotate_db_version['current'] < 32) {
584
+ adrotate_add_column("{$wpdb->prefix}adrotate", 'cities', 'text NOT NULL AFTER `irate`');
585
+ adrotate_add_column("{$wpdb->prefix}adrotate", 'countries', 'text NOT NULL AFTER `cities`');
586
$geo_array = serialize(array());
587
+ $wpdb->query("UPDATE `{$wpdb->prefix}adrotate` SET `cities` = '$geo_array' WHERE `cities` = '';");
588
+ $wpdb->query("UPDATE `{$wpdb->prefix}adrotate` SET `countries` = '$geo_array' WHERE `countries` = '';");
589
+ adrotate_add_column("{$wpdb->prefix}adrotate_groups", 'geo', 'tinyint(1) NOT NULL default \'0\' AFTER `page_loc`');
590
}
591
592
// Database: 33
593
// AdRotate: 3.8.6
594
if($adrotate_db_version['current'] < 33) {
595
+ adrotate_del_column("{$wpdb->prefix}adrotate_groups", 'token');
596
+ adrotate_add_column("{$wpdb->prefix}adrotate_groups", 'modus', 'tinyint(1) NOT NULL default \'0\' AFTER `name`');
597
+ adrotate_add_column("{$wpdb->prefix}adrotate_groups", 'gridrows', 'int(3) NOT NULL default \'2\' AFTER `wrapper_after`');
598
+ adrotate_add_column("{$wpdb->prefix}adrotate_groups", 'gridcolumns', 'int(3) NOT NULL default \'2\' AFTER `gridrows`');
599
+ adrotate_add_column("{$wpdb->prefix}adrotate_groups", 'admargin', 'int(3) NOT NULL default \'1\' AFTER `gridcolumns`');
600
+ adrotate_add_column("{$wpdb->prefix}adrotate_groups", 'adwidth', 'varchar(4) NOT NULL default \'125\' AFTER `admargin`');
601
+ adrotate_add_column("{$wpdb->prefix}adrotate_groups", 'adheight', 'varchar(4) NOT NULL default \'125\' AFTER `adwidth`');
602
+ adrotate_add_column("{$wpdb->prefix}adrotate_groups", 'adspeed', 'int(5) NOT NULL default \'6000\' AFTER `adheight`');
603
}
604
605
606
// Database: 36
607
// AdRotate: 3.8.10
608
if($adrotate_db_version['current'] < 36) {
609
+ adrotate_add_column("{$wpdb->prefix}adrotate_groups", 'admargin_bottom', 'int(3) NOT NULL default \'1\' AFTER `admargin`');
610
+ adrotate_add_column("{$wpdb->prefix}adrotate_groups", 'admargin_left', 'int(3) NOT NULL default \'1\' AFTER `admargin_bottom`');
611
+ adrotate_add_column("{$wpdb->prefix}adrotate_groups", 'admargin_right', 'int(3) NOT NULL default \'1\' AFTER `admargin_left`');
612
}
613
614
// Database: 38
615
// AdRotate: 3.9
616
if($adrotate_db_version['current'] < 38) {
617
+ adrotate_add_column("{$wpdb->prefix}adrotate_linkmeta", 'schedule', 'int(5) NOT NULL default \'0\' AFTER `user`');
618
+ $schedules = $wpdb->get_results("SELECT `id`, `ad` FROM {$wpdb->prefix}adrotate_schedule ORDER BY `id` ASC;");
619
foreach($schedules as $schedule) {
620
+ $wpdb->insert("{$wpdb->prefix}adrotate_linkmeta", array('ad' => $schedule->ad, 'group' => 0, 'user' => 0, 'schedule' => $schedule->id), array('%d', '%d', '%d', '%d', '%d'));
621
unset($schedule);
622
}
623
unset($schedules);
624
+ adrotate_add_column("{$wpdb->prefix}adrotate_schedule", 'name', 'varchar(255) NOT NULL default \'\' AFTER `id`');
625
+ adrotate_del_column("{$wpdb->prefix}adrotate_schedule", 'ad');
626
627
+ $schedules = $wpdb->get_results("SELECT `id` FROM {$wpdb->prefix}adrotate_schedule WHERE `name` = '' ORDER BY `id` ASC;");
628
foreach($schedules as $schedule) {
629
+ $wpdb->update("{$wpdb->prefix}adrotate_schedule", array('name' => 'Schedule '.$schedule->id), array('id' => $schedule->id));
630
unset($schedule);
631
}
632
unset($schedules);
635
// Database: 39
636
// AdRotate: 3.9.1
637
if($adrotate_db_version['current'] < 39) {
638
+ adrotate_add_column("{$wpdb->prefix}adrotate_tracker", 'country', 'text NOT NULL AFTER `useragent`');
639
+ adrotate_add_column("{$wpdb->prefix}adrotate_tracker", 'city', 'text NOT NULL AFTER `country`');
640
}
641
642
// Database: 40
643
// AdRotate: 3.9.9
644
if($adrotate_db_version['current'] < 40) {
645
+ adrotate_add_column("{$wpdb->prefix}adrotate", 'responsive', 'varchar(5) NOT NULL default \'N\' AFTER `tracker`');
646
}
647
648
// Database: 41
649
// AdRotate: 3.9.12
650
if($adrotate_db_version['current'] < 41) {
651
+ adrotate_add_column("{$wpdb->prefix}adrotate_groups", 'page_par', 'tinyint(1) NOT NULL default \'0\' AFTER `page_loc`');
652
+ adrotate_add_column("{$wpdb->prefix}adrotate_groups", 'cat_par', 'tinyint(1) NOT NULL default \'0\' AFTER `cat_loc`');
653
}
654
655
// Database: 42
656
// AdRotate: 3.10
657
if($adrotate_db_version['current'] < 42) {
658
+ adrotate_add_column("{$wpdb->prefix}adrotate_schedule", 'spread', 'varchar(5) NOT NULL default \'N\' AFTER `maximpressions`');
659
+ adrotate_add_column("{$wpdb->prefix}adrotate_schedule", 'hourimpressions', 'int(15) NOT NULL default \'0\' AFTER `spread`');
660
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_groups` CHANGE `page_par` `page_par` tinyint(2) NOT NULL default '0';");
661
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_groups` CHANGE `cat_par` `cat_par` tinyint(2) NOT NULL default '0';");
662
}
663
664
// Database: 43
665
// AdRotate: 3.10.7
666
if($adrotate_db_version['current'] < 43) {
667
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_groups` CHANGE `admargin` `admargin` int(2) NOT NULL default '0';");
668
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_groups` CHANGE `admargin_bottom` `admargin_bottom` int(2) NOT NULL default '0';");
669
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_groups` CHANGE `admargin_left` `admargin_left` int(2) NOT NULL default '0';");
670
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_groups` CHANGE `admargin_right` `admargin_right` int(2) NOT NULL default '0';");
671
}
672
673
// Database: 44
674
// AdRotate: 3.10.8
675
if($adrotate_db_version['current'] < 44) {
676
+ adrotate_del_column("{$wpdb->prefix}adrotate", 'timeframe');
677
+ adrotate_del_column("{$wpdb->prefix}adrotate", 'timeframelength');
678
+ adrotate_del_column("{$wpdb->prefix}adrotate", 'timeframeclicks');
679
+ adrotate_del_column("{$wpdb->prefix}adrotate", 'timeframeimpressions');
680
}
681
682
// Database: 46
683
// AdRotate: 3.10.13
684
if($adrotate_db_version['current'] < 46) {
685
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_schedule` CHANGE `hourimpressions` `dayimpressions` int(15) NOT NULL default '0';");
686
}
687
688
// Database: 47
689
// AdRotate: 3.10.18
690
if($adrotate_db_version['current'] < 47) {
691
+ adrotate_add_column("{$wpdb->prefix}adrotate_groups", 'align', 'tinyint(1) NOT NULL default \'0\' AFTER `wrapper_after`');
692
}
693
694
// Database: 48
695
// AdRotate: 3.11.2b2
696
if($adrotate_db_version['current'] < 48) {
697
+ if($wpdb->get_var("SHOW INDEX FROM `{$wpdb->prefix}adrotate_tracker` WHERE Key_name = 'bannerid';") !== null) {
698
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_tracker` DROP KEY `bannerid`;");
699
}
700
+ if($wpdb->get_var("SHOW INDEX FROM `{$wpdb->prefix}adrotate_schedule` WHERE Key_name = 'stoptime';") !== null) {
701
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_schedule` DROP KEY `stoptime`;");
702
}
703
+ if($wpdb->get_var("SHOW INDEX FROM `{$wpdb->prefix}adrotate_schedule` WHERE Key_name = 'ad';") !== null) {
704
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_schedule` DROP KEY `ad`;");
705
}
706
+ adrotate_del_column("{$wpdb->prefix}adrotate_stats", 'block');
707
+ adrotate_del_column("{$wpdb->prefix}adrotate_linkmeta", 'block');
708
}
709
710
// Database: 49
711
// AdRotate: 3.11.2b3
712
if($adrotate_db_version['current'] < 49) {
713
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_stats` CHANGE `ad` `ad` INT(5) UNSIGNED NOT NULL DEFAULT '0';");
714
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_stats` CHANGE `group` `group` INT(5) UNSIGNED NOT NULL DEFAULT '0';");
715
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_stats` CHANGE `thetime` `thetime` INT(15) UNSIGNED NOT NULL DEFAULT '0';");
716
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_stats` CHANGE `clicks` `clicks` INT(15) UNSIGNED NOT NULL DEFAULT '0';");
717
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_stats` CHANGE `impressions` `impressions` INT(15) UNSIGNED NOT NULL DEFAULT '0';");
718
+
719
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_tracker` CHANGE `timer` `timer` INT(15) UNSIGNED NOT NULL DEFAULT '0';");
720
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_tracker` CHANGE `bannerid` `bannerid` INT(15) UNSIGNED NOT NULL DEFAULT '0';");
721
+
722
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_schedule` CHANGE `starttime` `starttime` INT(15) UNSIGNED NOT NULL DEFAULT '0';");
723
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_schedule` CHANGE `stoptime` `stoptime` INT(15) UNSIGNED NOT NULL DEFAULT '0';");
724
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_schedule` CHANGE `maxclicks` `maxclicks` INT(15) UNSIGNED NOT NULL DEFAULT '0';");
725
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_schedule` CHANGE `maximpressions` `maximpressions` INT(15) UNSIGNED NOT NULL DEFAULT '0';");
726
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_schedule` CHANGE `dayimpressions` `dayimpressions` INT(15) UNSIGNED NOT NULL DEFAULT '0';");
727
+
728
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_linkmeta` CHANGE `ad` `ad` INT(5) UNSIGNED NOT NULL DEFAULT '0';");
729
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_linkmeta` CHANGE `group` `group` INT(5) UNSIGNED NOT NULL DEFAULT '0';");
730
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_linkmeta` CHANGE `user` `user` INT(5) UNSIGNED NOT NULL DEFAULT '0';");
731
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_linkmeta` CHANGE `schedule` `schedule` INT(5) UNSIGNED NOT NULL DEFAULT '0';");
732
+ }
733
+
734
+ // Database: 50
735
+ // AdRotate: 3.11.3b1
736
+ if($adrotate_db_version['current'] < 50) {
737
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate_tracker` CHANGE `ipaddress` `ipaddress` varchar(15) NOT NULL DEFAULT '';");
738
+ $wpdb->query("ALTER TABLE `{$wpdb->prefix}adrotate` CHANGE `cbudget` `budget` double NOT NULL default '0';");
739
+ adrotate_del_column("{$wpdb->prefix}adrotate", 'ibudget');
740
}
741
742
update_option("adrotate_db_version", array('current' => ADROTATE_DB_VERSION, 'previous' => $adrotate_db_version['current']));
901
902
$adrotate_db_timer = get_option('adrotate_db_timer');
903
$now = adrotate_now();
904
905
if($adrotate_db_timer < ($now - 86400)) {
906
+ dbDelta("OPTIMIZE TABLE `{$wpdb->prefix}adrotate`, `{$wpdb->prefix}adrotate_groups`, `{$wpdb->prefix}adrotate_linkmeta`, `{$wpdb->prefix}adrotate_stats`, `{$wpdb->prefix}adrotate_tracker`, `{$wpdb->prefix}adrotate_schedule`, ;");
907
update_option('adrotate_db_timer', $now);
908
adrotate_return('db_optimized');
909
} else {
926
927
// Delete expired schedules
928
if(isset($_POST['adrotate_db_cleanup_schedules'])) {
929
+ $wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_schedule` WHERE `stoptime` < $now;");
930
}
931
932
// Delete old stats
933
if(isset($_POST['adrotate_db_cleanup_statistics'])) {
934
$lastyear = $now - 30758400;
935
+ $wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_stats` WHERE `thetime` < $lastyear;");
936
}
937
938
// Clean up Tracker data
939
$yesterday = $now - 2073600;
940
+ $wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_tracker` WHERE `timer` < $yesterday;");
941
942
// Delete empty ads, groups and schedules
943
+ $wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate` WHERE `type` = 'empty' OR `type` = 'a_empty';");
944
+ $wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_groups` WHERE `name` = '';");
945
946
// Clean up meta data
947
+ $ads = $wpdb->get_results("SELECT `id` FROM `{$wpdb->prefix}adrotate` ORDER BY `id`;");
948
+ $metas = $wpdb->get_results("SELECT `id`, `ad` FROM `{$wpdb->prefix}adrotate_linkmeta` WHERE `ad` != '0' ORDER BY `id`;");
949
950
$adverts = $linkmeta = array();
951
foreach($ads as $ad) {
957
958
$result = array_diff($linkmeta, $adverts);
959
foreach($result as $key => $value) {
960
+ $wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_linkmeta` WHERE `id` = $key;");
961
unset($result[$key]);
962
}
963
unset($ads, $metas, $adverts, $linkmeta, $result);
964
965
// Clean up stray linkmeta
966
+ $wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_linkmeta` WHERE `ad` = 0 OR `ad` = '';");
967
968
adrotate_return('db_cleaned');
969
}
983
$clicks = $now - 86400;
984
$impressions = $now - 3600;
985
986
+ $wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_tracker` WHERE (`timer` < ".$clicks." AND `stat` = 'c') OR (`timer` < ".$impressions." AND `stat` = 'i') OR `ipaddress` = 'unknown' OR `ipaddress` = '';");
987
}
988
989
/*-------------------------------------------------------------
1030
1031
return false;
1032
}
1033
?>
adrotate.php CHANGED
@@ -5,7 +5,7 @@ Plugin URI: https://ajdg.solutions/products/adrotate-for-wordpress/
5
Author: Arnan de Gans of AJdG Solutions
6
Author URI: http://ajdg.solutions/
7
Description: Used on over a hundred thousand websites and by even more people! AdRotate is the popular choice for monetizing your website with adverts while keeping things simple.
8
- Version: 3.11.2
9
License: GPLv3
10
*/
11
@@ -20,9 +20,9 @@ License: GPLv3
20
------------------------------------------------------------------------------------ */
21
22
/*--- AdRotate values ---------------------------------------*/
23
- define("ADROTATE_DISPLAY", '3.11.2');
24
define("ADROTATE_VERSION", 378);
25
- define("ADROTATE_DB_VERSION", 49);
26
define("ADROTATE_FOLDER", 'adrotate');
27
/*-----------------------------------------------------------*/
28
@@ -75,7 +75,6 @@ if(!is_admin()) {
75
/*--- Back End ----------------------------------------------*/
76
if(is_admin()) {
77
adrotate_check_config();
78
- add_action('admin_init', 'adrotate_check_upgrade');
79
add_action('admin_menu', 'adrotate_dashboard');
80
add_action("admin_enqueue_scripts", 'adrotate_dashboard_scripts');
81
add_action("admin_print_styles", 'adrotate_dashboard_styles');
@@ -109,7 +108,7 @@ function adrotate_dashboard() {
109
$adrotate_pro = add_submenu_page('adrotate', 'AdRotate > '.__('AdRotate Pro', 'adrotate'), __('AdRotate Pro', 'adrotate'), 'adrotate_ad_manage', 'adrotate-pro', 'adrotate_pro');
110
$adrotate_adverts = add_submenu_page('adrotate', 'AdRotate > '.__('Manage Ads', 'adrotate'), __('Manage Ads', 'adrotate'), 'adrotate_ad_manage', 'adrotate-ads', 'adrotate_manage');
111
$adrotate_groups = add_submenu_page('adrotate', 'AdRotate > '.__('Manage Groups', 'adrotate'), __('Manage Groups', 'adrotate'), 'adrotate_group_manage', 'adrotate-groups', 'adrotate_manage_group');
112
- $adrotate_schedules = add_submenu_page('adrotate', 'AdRotate Pro > '.__('Manage Schedules', 'adrotate'), __('Manage Schedules', 'adrotate'), 'adrotate_schedule_manage', 'adrotate-schedules', 'adrotate_manage_schedules');
113
$adrotate_media = add_submenu_page('adrotate', 'AdRotate Pro > '.__('Manage Media', 'adrotate'), __('Manage Media', 'adrotate'), 'adrotate_ad_manage', 'adrotate-media', 'adrotate_manage_media');
114
$adrotate_settings = add_submenu_page('adrotate', 'AdRotate > '.__('Settings', 'adrotate'), __('Settings', 'adrotate'), 'manage_options', 'adrotate-settings', 'adrotate_options');
115
@@ -229,7 +228,7 @@ function adrotate_manage() {
229
<?php if($wpdb->get_var("SHOW TABLES LIKE '".$wpdb->prefix."adrotate';") AND $wpdb->get_var("SHOW TABLES LIKE '".$wpdb->prefix."adrotate_groups';") AND $wpdb->get_var("SHOW TABLES LIKE '".$wpdb->prefix."adrotate_schedule';") AND $wpdb->get_var("SHOW TABLES LIKE '".$wpdb->prefix."adrotate_linkmeta';")) { ?>
230
231
<?php
232
- $allbanners = $wpdb->get_results("SELECT `id`, `title`, `type`, `tracker`, `weight`, `cbudget`, `ibudget`, `crate`, `irate` FROM `".$wpdb->prefix."adrotate` WHERE `type` = 'active' OR `type` = 'error' OR `type` = 'expired' OR `type` = '2days' OR `type` = '7days' OR `type` = 'disabled' ORDER BY `sortorder` ASC, `id` ASC;");
233
$activebanners = $errorbanners = $disabledbanners = false;
234
foreach($allbanners as $singlebanner) {
235
$starttime = $stoptime = 0;
5
Author: Arnan de Gans of AJdG Solutions
6
Author URI: http://ajdg.solutions/
7
Description: Used on over a hundred thousand websites and by even more people! AdRotate is the popular choice for monetizing your website with adverts while keeping things simple.
8
+ Version: 3.11.3
9
License: GPLv3
10
*/
11
20
------------------------------------------------------------------------------------ */
21
22
/*--- AdRotate values ---------------------------------------*/
23
+ define("ADROTATE_DISPLAY", '3.11.3');
24
define("ADROTATE_VERSION", 378);
25
+ define("ADROTATE_DB_VERSION", 50);
26
define("ADROTATE_FOLDER", 'adrotate');
27
/*-----------------------------------------------------------*/
28
75
/*--- Back End ----------------------------------------------*/
76
if(is_admin()) {
77
adrotate_check_config();
78
add_action('admin_menu', 'adrotate_dashboard');
79
add_action("admin_enqueue_scripts", 'adrotate_dashboard_scripts');
80
add_action("admin_print_styles", 'adrotate_dashboard_styles');
108
$adrotate_pro = add_submenu_page('adrotate', 'AdRotate > '.__('AdRotate Pro', 'adrotate'), __('AdRotate Pro', 'adrotate'), 'adrotate_ad_manage', 'adrotate-pro', 'adrotate_pro');
109
$adrotate_adverts = add_submenu_page('adrotate', 'AdRotate > '.__('Manage Ads', 'adrotate'), __('Manage Ads', 'adrotate'), 'adrotate_ad_manage', 'adrotate-ads', 'adrotate_manage');
110
$adrotate_groups = add_submenu_page('adrotate', 'AdRotate > '.__('Manage Groups', 'adrotate'), __('Manage Groups', 'adrotate'), 'adrotate_group_manage', 'adrotate-groups', 'adrotate_manage_group');
111
+ $adrotate_schedules = add_submenu_page('adrotate', 'AdRotate Pro > '.__('Manage Schedules', 'adrotate'), __('Manage Schedules', 'adrotate'), 'adrotate_ad_manage', 'adrotate-schedules', 'adrotate_manage_schedules');
112
$adrotate_media = add_submenu_page('adrotate', 'AdRotate Pro > '.__('Manage Media', 'adrotate'), __('Manage Media', 'adrotate'), 'adrotate_ad_manage', 'adrotate-media', 'adrotate_manage_media');
113
$adrotate_settings = add_submenu_page('adrotate', 'AdRotate > '.__('Settings', 'adrotate'), __('Settings', 'adrotate'), 'manage_options', 'adrotate-settings', 'adrotate_options');
114
228
<?php if($wpdb->get_var("SHOW TABLES LIKE '".$wpdb->prefix."adrotate';") AND $wpdb->get_var("SHOW TABLES LIKE '".$wpdb->prefix."adrotate_groups';") AND $wpdb->get_var("SHOW TABLES LIKE '".$wpdb->prefix."adrotate_schedule';") AND $wpdb->get_var("SHOW TABLES LIKE '".$wpdb->prefix."adrotate_linkmeta';")) { ?>
229
230
<?php
231
+ $allbanners = $wpdb->get_results("SELECT `id`, `title`, `type`, `tracker`, `weight` FROM `".$wpdb->prefix."adrotate` WHERE `type` = 'active' OR `type` = 'error' OR `type` = 'expired' OR `type` = '2days' OR `type` = '7days' OR `type` = 'disabled' ORDER BY `sortorder` ASC, `id` ASC;");
232
$activebanners = $errorbanners = $disabledbanners = false;
233
foreach($allbanners as $singlebanner) {
234
$starttime = $stoptime = 0;
dashboard/publisher/adrotate-ads-edit.php CHANGED
@@ -12,7 +12,7 @@
12
if(!$ad_edit_id) {
13
$edit_id = $wpdb->get_var("SELECT `id` FROM `".$wpdb->prefix."adrotate` WHERE `type` = 'empty' ORDER BY `id` DESC LIMIT 1;");
14
if($edit_id == 0) {
15
- $wpdb->insert($wpdb->prefix."adrotate", array('title' => '', 'bannercode' => '', 'thetime' => $now, 'updated' => $now, 'author' => $current_user->user_login, 'imagetype' => 'dropdown', 'image' => '', 'link' => '', 'tracker' => 'N', 'responsive' => 'N', 'type' => 'empty', 'weight' => 6, 'sortorder' => 0, 'cbudget' => 0, 'ibudget' => 0, 'crate' => 0, 'irate' => 0, 'cities' => serialize(array()), 'countries' => serialize(array())));
16
$edit_id = $wpdb->insert_id;
17
$wpdb->insert($wpdb->prefix.'adrotate_schedule', array('name' => 'Schedule for ad '.$edit_id, 'starttime' => $now, 'stoptime' => $in84days, 'maxclicks' => 0, 'maximpressions' => 0));
18
$schedule_id = $wpdb->insert_id;
@@ -46,7 +46,7 @@ if($ad_edit_id) {
46
echo '<div class="error"><p>'. __('The AdCode cannot be empty!', 'adrotate').'</p></div>';
47
48
if(!preg_match("/%image%/i", $edit_banner->bannercode) AND $edit_banner->image != '')
49
- echo '<div class="error"><p>'. __('You didn\'t use %image% in your AdCode but did select an image!', 'adrotate').'</p></div>';
50
51
if(preg_match("/%image%/i", $edit_banner->bannercode) AND $edit_banner->image == '')
52
echo '<div class="error"><p>'. __('You did use %image% in your AdCode but did not select an image!', 'adrotate').'</p></div>';
@@ -54,21 +54,27 @@ if($ad_edit_id) {
54
if((($edit_banner->imagetype != '' AND $edit_banner->image == '') OR ($edit_banner->imagetype == '' AND $edit_banner->image != '')))
55
echo '<div class="error"><p>'. __('There is a problem saving the image specification. Please reset your image and re-save the ad!', 'adrotate').'</p></div>';
56
57
if(!preg_match_all('/<a[^>](.*?)>/i', stripslashes(htmlspecialchars_decode($edit_banner->bannercode, ENT_QUOTES)), $things) AND $edit_banner->tracker == 'Y')
58
echo '<div class="error"><p>'. __("Clicktracking is enabled but no valid link was found in the adcode!", 'adrotate').'</p></div>';
59
60
// Ad Notices
61
$adstate = adrotate_evaluate_ad($edit_banner->id);
62
- if($edit_banner->type == 'error' AND $adstate == 'normal')
63
echo '<div class="error"><p>'. __('AdRotate cannot find an error but the ad is marked erroneous, try re-saving the ad!', 'adrotate').'</p></div>';
64
65
if($adstate == 'expired')
66
echo '<div class="error"><p>'. __('This ad is expired and currently not shown on your website!', 'adrotate').'</p></div>';
67
68
- if($adstate == 'expires2days')
69
echo '<div class="updated"><p>'. __('The ad will expire in less than 2 days!', 'adrotate').'</p></div>';
70
71
- if($adstate == 'expires7days')
72
echo '<div class="updated"><p>'. __('This ad will expire in less than 7 days!', 'adrotate').'</p></div>';
73
74
if($edit_banner->type == 'disabled')
@@ -103,37 +109,63 @@ if($edit_banner->imagetype == "field") {
103
<h3><?php _e('Edit Advert', 'adrotate'); ?></h3>
104
<?php } ?>
105
106
- <p><em><?php _e('These are required.', 'adrotate'); ?></em></p>
107
<table class="widefat" style="margin-top: .5em">
108
<tbody>
109
<tr>
110
<th width="15%"><?php _e('Title:', 'adrotate'); ?></th>
111
<td colspan="2">
112
- <label for="adrotate_title"><input tabindex="1" name="adrotate_title" type="text" size="80" class="search-input" value="<?php echo stripslashes($edit_banner->title);?>" autocomplete="off" /></label>
113
</td>
114
</tr>
115
<tr>
116
<th valign="top"><?php _e('AdCode:', 'adrotate'); ?></th>
117
<td>
118
- <label for="adrotate_bannercode"><textarea tabindex="2" id="adrotate_bannercode" name="adrotate_bannercode" cols="65" rows="15"><?php echo stripslashes($edit_banner->bannercode); ?></textarea></label>
119
</td>
120
<td width="40%">
121
- <p><?php _e('Copy your ad tag/code in this field if you have received ready to go adverts.', 'adrotate'); ?><br /><?php _e('Advertising and affiliate networks often use these.', 'adrotate'); ?></p>
122
<p><strong><?php _e('Basic Examples:', 'adrotate'); ?></strong></p>
123
<p>1. <em><a href="#" onclick="textatcursor('adrotate_bannercode','&lt;a href=&quot;https://ajdg.solutions/&quot;&gt;Buy AdRotate Pro here!&lt;/a&gt;');return false;">&lt;a href="https://ajdg.solutions/"&gt;Buy AdRotate Pro here!&lt;/a&gt;</a></em></p>
124
<p>2. <em><a href="#" onclick="textatcursor('adrotate_bannercode','&lt;a href=&quot;http://www.floatingcoconut.net&quot;&gt;&lt;img src=&quot;%image%&quot; /&gt;&lt;/a&gt;');return false;">&lt;a href="http://www.floatingcoconut.net"&gt;&lt;img src="%image%" /&gt;&lt;/a&gt;</a></em></p>
125
<p>3. <em><a href="#" onclick="textatcursor('adrotate_bannercode','&lt;span class=&quot;ad-%id%&quot;&gt;&lt;a href=&quot;http://www.ajdg.net&quot;&gt;Text Link Ad!&lt;/a&gt;&lt;/span&gt;');return false;">&lt;span class="ad-%id%"&gt;&lt;a href="http://www.ajdg.net"&gt;Text Link Ad!&lt;/a&gt;&lt;/span&gt;</a></em></p>
126
-
127
- <p><strong><?php _e('Options:', 'adrotate'); ?></strong></p>
128
- <p><em><a href="#" onclick="textatcursor('adrotate_bannercode','%id%');return false;">%id%</a>, <a href="#" onclick="textatcursor('adrotate_bannercode','%image%');return false;">%image%</a>, <a href="#" onclick="textatcursor('adrotate_bannercode','%title%');return false;">%title%</a>, <a href="#" onclick="textatcursor('adrotate_bannercode','%random%');return false;">%random%</a>, <a href="#" onclick="textatcursor('adrotate_bannercode','target=&quot;_blank&quot;');return false;">target="_blank"</a>, <a href="#" onclick="textatcursor('adrotate_bannercode','rel=&quot;nofollow&quot;');return false;">rel="nofollow"</a></em><br />
129
- <p><?php _e('Place the cursor where you want to add a tag and click to add it to your AdCode.', 'adrotate'); ?></p>
130
</td>
131
</tr>
132
<tr>
133
<th><?php _e('Activate:', 'adrotate'); ?></th>
134
<td colspan="2">
135
<label for="adrotate_active">
136
- <select tabindex="3" name="adrotate_active">
137
<option value="active" <?php if($edit_banner->type == "active") { echo 'selected'; } ?>><?php _e('Yes, this ad will be used', 'adrotate'); ?></option>
138
<option value="disabled" <?php if($edit_banner->type == "disabled") { echo 'selected'; } ?>><?php _e('No, do not show this ad anywhere', 'adrotate'); ?></option>
139
</select>
@@ -145,7 +177,7 @@ if($edit_banner->imagetype == "field") {
145
<center><?php _e('Get more features with AdRotate Pro.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('More information', 'adrotate'); ?></a>.</center>
146
147
<p class="submit">
148
- <input tabindex="0" type="submit" name="adrotate_ad_submit" class="button-primary" value="<?php _e('Save Advert', 'adrotate'); ?>" />
149
<a href="admin.php?page=adrotate-ads&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
150
</p>
151
@@ -165,145 +197,12 @@ if($edit_banner->imagetype == "field") {
165
<?php } ?>
166
167
<h3><?php _e('Usage', 'adrotate'); ?></h3>
168
- <p><em><?php _e('Copy the shortcode in a post or page. The PHP code goes in a theme file where you want the advert to show up.', 'adrotate'); ?></em></p>
169
- <table class="widefat" style="margin-top: .5em">
170
- <tbody>
171
- <tr>
172
- <th width="15%"><?php _e('In a post or page:', 'adrotate'); ?></th>
173
- <td>[adrotate banner="<?php echo $edit_banner->id; ?>"]</td>
174
- <th width="15%"><?php _e('Directly in a theme:', 'adrotate'); ?></th>
175
- <td>&lt;?php echo adrotate_ad(<?php echo $edit_banner->id; ?>); ?&gt;</td>
176
- </tr>
177
- </tbody>
178
- </table>
179
-
180
- <p class="submit">
181
- <input tabindex="10" type="submit" name="adrotate_ad_submit" class="button-primary" value="<?php _e('Save Advert', 'adrotate'); ?>" />
182
- <a href="admin.php?page=adrotate-ads&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
183
- </p>
184
-
185
- <h3><?php _e('Advanced', 'adrotate'); ?></h3>
186
- <p><em><?php _e('Everything below is optional.', 'adrotate'); ?></em></p>
187
<table class="widefat" style="margin-top: .5em">
188
<tbody>
189
- <?php if($adrotate_config['enable_stats'] == 'Y') { ?>
190
- <tr>
191
- <th width="15%" valign="top"><?php _e('Clicktracking:', 'adrotate'); ?></th>
192
- <td colspan="3">
193
- <label for="adrotate_tracker"><input tabindex="4" type="checkbox" name="adrotate_tracker" <?php if($edit_banner->tracker == 'Y') { ?>checked="checked" <?php } ?> /> <?php _e('Enable click tracking for this advert.', 'adrotate'); ?> <br />
194
- <em><?php _e('Note: Clicktracking does generally not work for Javascript adverts such as those provided by Google AdSense.', 'adrotate'); ?></em><br />
195
- <em><?php _e('Place the target URL in your adcode - Similar to code example 1.', 'adrotate'); ?></em>
196
- </label>
197
- </td>
198
- </tr>
199
- <tr>
200
- <th valign="top"><?php _e('Target URL:', 'adrotate'); ?></th>
201
- <td colspan="3">
202
- <label for="adrotate_link_disabled"><input tabindex="5" name="adrotate_link_disabled" type="text" size="60" class="search-input" value="<?php echo $edit_banner->link;?>" disabled="1" /><br />
203
- <em><?php _e('This field is no longer required. You can place the URL directly in the adcode (above) instead of %link%.', 'adrotate'); ?></em></label>
204
- </td>
205
- </tr>
206
- <?php } ?>
207
- <tr>
208
- <th width="15%" valign="top"><?php _e('Responsive:', 'adrotate'); ?></th>
209
- <td colspan="3">
210
- <label for="adrotate_responsive"><input tabindex="6" type="checkbox" name="adrotate_responsive" <?php if($edit_banner->responsive == 'Y') { ?>checked="checked" <?php } ?> /> <?php _e('Enable responsive support for this advert.', 'adrotate'); ?></label><br />
211
- <em><?php _e('Upload your images to the banner folder and make sure the filename is in the following format; "imagename.full.ext". A full set of sized images is strongly recommended.', 'adrotate'); ?></em><br />
212
- <em><?php _e('For smaller size images use ".320", ".480", ".768" or ".1024" in the filename instead of ".full" for the various viewports.', 'adrotate'); ?></em><br />
213
- <em><strong><?php _e('Example:', 'adrotate'); ?></strong> <?php _e('image.full.jpg, image.320.jpg and image.768.jpg will serve the same advert for different viewports. Requires jQuery.', 'adrotate'); ?></em></label>
214
- </td>
215
- </tr>
216
- <tr>
217
- <th valign="top"><?php _e('Banner image:', 'adrotate'); ?></th>
218
- <td colspan="3">
219
- <label for="adrotate_image">
220
- <?php _e('Media:', 'adrotate'); ?> <input tabindex="7" id="adrotate_image" type="text" size="50" name="adrotate_image" value="<?php echo $image_field; ?>" /> <input tabindex="8" id="adrotate_image_button" class="button" type="button" value="<?php _e('Select Banner', 'adrotate'); ?>" />
221
- </label><br />
222
- <?php _e('- OR -', 'adrotate'); ?><br />
223
- <label for="adrotate_image_dropdown">
224
- <?php _e('Banner folder:', 'adrotate'); ?> <select tabindex="9" name="adrotate_image_dropdown" style="min-width: 200px;">
225
- <option value=""><?php _e('No image selected', 'adrotate'); ?></option>
226
- <?php echo adrotate_folder_contents($image_dropdown); ?>
227
- </select><br />
228
- </label>
229
- <em><?php _e('Use %image% in the code. Accepted files are:', 'adrotate'); ?> jpg, jpeg, gif, png, swf <?php _e('and', 'adrotate'); ?> flv. <?php _e('Use either the text field or the dropdown. If the textfield has content that field has priority.', 'adrotate'); ?></em>
230
- </td>
231
- </tr>
232
- <tr>
233
- <th valign="top"><?php _e('Weight:', 'adrotate'); ?><br /><em><?php _e('AdRotate Pro only', 'adrotate'); ?></em></th>
234
- <td colspan="3">
235
- <label for="adrotate_weight">
236
- &nbsp;<input type="radio" name="adrotate_weight" value="2" disabled />&nbsp;&nbsp;&nbsp;2, <?php _e('Barely visible', 'adrotate'); ?><br />
237
- &nbsp;<input type="radio" name="adrotate_weight" value="4" disabled />&nbsp;&nbsp;&nbsp;4, <?php _e('Less than average', 'adrotate'); ?><br />
238
- &nbsp;<input type="radio" name="adrotate_weight" value="6" disabled checked />&nbsp;&nbsp;&nbsp;6, <?php _e('Normal coverage', 'adrotate'); ?><br />
239
- &nbsp;<input type="radio" name="adrotate_weight" value="8" disabled />&nbsp;&nbsp;&nbsp;8, <?php _e('More than average', 'adrotate'); ?><br />
240
- &nbsp;<input type="radio" name="adrotate_weight" value="10" disabled />&nbsp;&nbsp;&nbsp;10, <?php _e('Best visibility', 'adrotate'); ?>
241
- </label>
242
- </td>
243
- </tr>
244
<tr>
245
- <th><?php _e('Sortorder:', 'adrotate'); ?></th>
246
- <td colspan="3">
247
- <label for="adrotate_sortorder"><input tabindex="4" name="adrotate_sortorder" type="text" size="5" class="search-input" autocomplete="off" value="<?php echo $edit_banner->sortorder;?>" /> <em><?php _e('For administrative purposes set a sortorder.', 'adrotate'); ?> <?php _e('Leave empty or 0 to skip this. Will default to ad id.', 'adrotate'); ?></em></label>
248
- </td>
249
</tr>
250
- </tbody>
251
- </table>
252
- <center><?php _e('With AdRotate Pro you can also set a weight to give adverts more or less attention.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade today', 'adrotate'); ?></a>!</center>
253
-
254
- <h3><?php _e('Geo Location in AdRotate Pro', 'adrotate'); ?></h3>
255
- <p><em><?php _e('This works if you assign the advert to a group and enable that group to use Geo Targeting.', 'adrotate'); ?></em></p>
256
- <table class="widefat" style="margin-top: .5em">
257
- <tbody>
258
- <tr>
259
- <th width="15%" valign="top"><?php _e('Cities/States:', 'adrotate'); ?></strong></th>
260
- <td colspan="2"><textarea tabindex="14" name="adrotate_geo_cities" cols="65" rows="3" disabled>Amsterdam, Noord Holland, New York, California, Tokyo, London</textarea></td>
261
- <td>
262
- <p><strong><?php _e('Usage:', 'adrotate'); ?></strong></p>
263
- <p><em><?php _e('A comma separated list of cities and/or states', 'adrotate'); ?> (Alkmaar, Philadelphia, Melbourne, ...)<br /><?php _e('AdRotate does not check the validity of names so make sure you spell them correctly!', 'adrotate'); ?></em></p>
264
- </td>
265
- </tr>
266
- <tr>
267
- <th valign="top"><?php _e('Countries:', 'adrotate'); ?></strong></th>
268
- <td colspan="2">
269
- <label for="adrotate_geo_countries">
270
- <div class="adrotate-select">
271
-
272
- <table width="100%">
273
- <tbody>
274
- <tr>
275
- <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">United States</td>
276
- </tr>
277
- <tr>
278
- <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">Australia</td>
279
- </tr>
280
- <tr>
281
- <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">Germany</td>
282
- </tr>
283
- <tr>
284
- <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">Brazil</td>
285
- </tr>
286
- <tr>
287
- <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">Japan</td>
288
- </tr>
289
- </tbody>
290
- </table>
291
- </div>
292
- </label>
293
- </td>
294
- <td>
295
- <p><strong><?php _e('Usage:', 'adrotate'); ?></strong></p>
296
- <p><em><?php _e('Select the countries you want the adverts to show in.', 'adrotate'); ?><br /><?php _e('Cities take priority and will be filtered first.', 'adrotate'); ?></em></p>
297
- </td>
298
- </tr>
299
- </tbody>
300
- </table>
301
- <center><?php _e('Target your audience with Geo Location in AdRotate Pro', 'adrotate'); ?>, <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade today', 'adrotate'); ?></a>.</center>
302
-
303
- <h3><?php _e('Usage', 'adrotate'); ?></h3>
304
- <p><em><?php _e('Copy the shortcode in a post or page. The PHP code goes in a theme file where you want the advert to show up.', 'adrotate'); ?></em></p>
305
- <table class="widefat" style="margin-top: .5em">
306
- <tbody>
307
<tr>
308
<th width="15%"><?php _e('In a post or page:', 'adrotate'); ?></th>
309
<td>[adrotate banner="<?php echo $edit_banner->id; ?>"]</td>
@@ -313,21 +212,15 @@ if($edit_banner->imagetype == "field") {
313
</tbody>
314
</table>
315
316
- <p class="submit">
317
- <input tabindex="10" type="submit" name="adrotate_ad_submit" class="button-primary" value="<?php _e('Save Advert', 'adrotate'); ?>" />
318
- <a href="admin.php?page=adrotate-ads&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
319
- </p>
320
-
321
- <h3><?php _e('Schedule', 'adrotate'); ?></h3>
322
- <p><em><?php _e('From when to when is the advert visible?', 'adrotate'); ?></em></p>
323
<table class="widefat" style="margin-top: .5em">
324
<tbody>
325
<tr>
326
<th width="15%"><?php _e('Start date (day/month/year):', 'adrotate'); ?></th>
327
<td>
328
<label for="adrotate_sday">
329
- <input tabindex="11" name="adrotate_sday" class="search-input" type="text" size="4" maxlength="2" value="<?php echo $sday;?>" /> /
330
- <select tabindex="12" name="adrotate_smonth">
331
<option value="01" <?php if($smonth == "01") { echo 'selected'; } ?>><?php _e('January', 'adrotate'); ?></option>
332
<option value="02" <?php if($smonth == "02") { echo 'selected'; } ?>><?php _e('February', 'adrotate'); ?></option>
333
<option value="03" <?php if($smonth == "03") { echo 'selected'; } ?>><?php _e('March', 'adrotate'); ?></option>
@@ -341,14 +234,14 @@ if($edit_banner->imagetype == "field") {
341
<option value="11" <?php if($smonth == "11") { echo 'selected'; } ?>><?php _e('November', 'adrotate'); ?></option>
342
<option value="12" <?php if($smonth == "12") { echo 'selected'; } ?>><?php _e('December', 'adrotate'); ?></option>
343
</select> /
344
- <input tabindex="13" name="adrotate_syear" class="search-input" type="text" size="4" maxlength="4" value="<?php echo $syear;?>" />&nbsp;&nbsp;&nbsp;
345
</label>
346
</td>
347
<th width="15%"><?php _e('End date (day/month/year):', 'adrotate'); ?></th>
348
<td>
349
<label for="adrotate_eday">
350
- <input tabindex="14" name="adrotate_eday" class="search-input" type="text" size="4" maxlength="2" value="<?php echo $eday;?>" /> /
351
- <select tabindex="15" name="adrotate_emonth">
352
<option value="01" <?php if($emonth == "01") { echo 'selected'; } ?>><?php _e('January', 'adrotate'); ?></option>
353
<option value="02" <?php if($emonth == "02") { echo 'selected'; } ?>><?php _e('February', 'adrotate'); ?></option>
354
<option value="03" <?php if($emonth == "03") { echo 'selected'; } ?>><?php _e('March', 'adrotate'); ?></option>
@@ -362,7 +255,7 @@ if($edit_banner->imagetype == "field") {
362
<option value="11" <?php if($emonth == "11") { echo 'selected'; } ?>><?php _e('November', 'adrotate'); ?></option>
363
<option value="12" <?php if($emonth == "12") { echo 'selected'; } ?>><?php _e('December', 'adrotate'); ?></option>
364
</select> /
365
- <input tabindex="16" name="adrotate_eyear" class="search-input" type="text" size="4" maxlength="4" value="<?php echo $eyear;?>" />&nbsp;&nbsp;&nbsp;
366
</label>
367
</td>
368
</tr>
@@ -370,24 +263,24 @@ if($edit_banner->imagetype == "field") {
370
<th><?php _e('Start time (hh:mm):', 'adrotate'); ?></th>
371
<td>
372
<label for="adrotate_sday">
373
- <input tabindex="17" name="adrotate_shour" class="search-input" type="text" size="2" maxlength="4" value="<?php echo $shour;?>" /> :
374
- <input tabindex="18" name="adrotate_sminute" class="search-input" type="text" size="2" maxlength="4" value="<?php echo $sminute;?>" />
375
</label>
376
</td>
377
<th><?php _e('End time (hh:mm):', 'adrotate'); ?></th>
378
<td>
379
<label for="adrotate_eday">
380
- <input tabindex="19" name="adrotate_ehour" class="search-input" type="text" size="2" maxlength="4" value="<?php echo $ehour;?>" /> :
381
- <input tabindex="20" name="adrotate_eminute" class="search-input" type="text" size="2" maxlength="4" value="<?php echo $eminute;?>" />
382
</label>
383
</td>
384
</tr>
385
<?php if($adrotate_config['enable_stats'] == 'Y') { ?>
386
<tr>
387
<th><?php _e('Maximum Clicks:', 'adrotate'); ?></th>
388
- <td><input tabindex="21" name="adrotate_maxclicks" type="text" size="5" class="search-input" autocomplete="off" value="<?php echo $schedules->maxclicks;?>" /> <em><?php _e('Leave empty or 0 to skip this.', 'adrotate'); ?></em></td>
389
<th><?php _e('Maximum Impressions:', 'adrotate'); ?></th>
390
- <td><input tabindex="22" name="adrotate_maxshown" type="text" size="5" class="search-input" autocomplete="off" value="<?php echo $schedules->maximpressions;?>" /> <em><?php _e('Leave empty or 0 to skip this.', 'adrotate'); ?></em></td>
391
</tr>
392
<?php } ?>
393
<tr>
@@ -398,55 +291,113 @@ if($edit_banner->imagetype == "field") {
398
</table>
399
<center><?php _e('Create multiple schedules for each advert with AdRotate Pro.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade today', 'adrotate'); ?></a>.</center>
400
401
- <h3><?php _e('Choose Multiple Schedules in AdRotate Pro', 'adrotate'); ?></h3>
402
- <p><em><?php _e('You can add, edit or delete schedules from the', 'adrotate'); ?> '<a href="admin.php?page=adrotate-schedules"><?php _e('Manage Schedules', 'adrotate'); ?></a>' <?php _e('dashboard. Save your advert first!', 'adrotate'); ?></em></p>
403
<table class="widefat" style="margin-top: .5em">
404
405
- <thead>
406
- <tr>
407
- <th scope="col" class="manage-column column-cb check-column"><input type="checkbox" disabled /></th>
408
- <th width="4%"><?php _e('ID', 'adrotate'); ?></th>
409
- <th width="17%"><?php _e('From / Until', 'adrotate'); ?></th>
410
- <th>&nbsp;</th>
411
- <th width="12%"><center><?php _e('Clicks', 'adrotate'); ?></center></th>
412
- <th width="12%"><center><?php _e('Impressions', 'adrotate'); ?></center></th>
413
</tr>
414
- </thead>
415
416
<tbody>
417
- <tr id='schedule-1'>
418
- <th class="check-column"><input type="checkbox" name="scheduleselect[]" value="" disabled /></th>
419
- <td>1</td>
420
- <td><?php echo date_i18n("F d, Y H:i", $now-86400);?><br /><span style="color: <?php echo adrotate_prepare_color($now+604800);?>;"><?php echo date_i18n("F d, Y H:i", $now+604800);?></span></td>
421
- <td>Schedule for trekking campaign <span style="color:#999;"><br /><span style="font-weight:bold;">Spread:</span> Max. 342 <?php _e('impressions per day', 'adrotate'); ?></span></td>
422
- <td><center>100000</center></td>
423
- <td><center>Unlimited</center></td>
424
</tr>
425
- <tr id='schedule-2' class='alternate'>
426
- <th class="check-column"><input type="checkbox" name="scheduleselect[]" value="" disabled /></th>
427
- <td>1</td>
428
- <td><?php echo date_i18n("F d, Y H:i", $now);?><br /><span style="color: <?php echo adrotate_prepare_color($now+1209600);?>;"><?php echo date_i18n("F d, Y H:i", $now+1209600);?></span></td>
429
- <td>Generic schedule</td>
430
- <td><center>Unlimited</center></td>
431
- <td><center>Unlimited</center></td>
432
</tr>
433
- </tbody>
434
-
435
</table>
436
- <p><center>
437
- <span style="border: 1px solid #518257; height: 12px; width: 12px; background-color: #e5faee">&nbsp;&nbsp;&nbsp;&nbsp;</span> <?php _e("In use by this advert.", "adrotate"); ?>
438
- &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"); ?>
439
- </center></p>
440
441
<p class="submit">
442
- <input tabindex="23" type="submit" name="adrotate_ad_submit" class="button-primary" value="<?php _e('Save Advert', 'adrotate'); ?>" />
443
<a href="admin.php?page=adrotate-ads&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
444
</p>
445
446
-
447
<?php if($groups) { ?>
448
<h3><?php _e('Select Groups', 'adrotate'); ?></h3>
449
- <p><em><?php _e('Optionally select the group(s) this ad belongs to.', 'adrotate'); ?></em></p>
450
<table class="widefat" style="margin-top: .5em">
451
<thead>
452
<tr>
@@ -482,7 +433,7 @@ if($edit_banner->imagetype == "field") {
482
</table>
483
484
<p class="submit">
485
- <input tabindex="24" type="submit" name="adrotate_ad_submit" class="button-primary" value="<?php _e('Save Advert', 'adrotate'); ?>" />
486
<a href="admin.php?page=adrotate-ads&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
487
</p>
488
<?php } ?>
12
if(!$ad_edit_id) {
13
$edit_id = $wpdb->get_var("SELECT `id` FROM `".$wpdb->prefix."adrotate` WHERE `type` = 'empty' ORDER BY `id` DESC LIMIT 1;");
14
if($edit_id == 0) {
15
+ $wpdb->insert($wpdb->prefix."adrotate", array('title' => '', 'bannercode' => '', 'thetime' => $now, 'updated' => $now, 'author' => $current_user->user_login, 'imagetype' => 'dropdown', 'image' => '', 'link' => '', 'tracker' => 'N', 'responsive' => 'N', 'type' => 'empty', 'weight' => 6, 'sortorder' => 0, 'budget' => 0, 'crate' => 0, 'irate' => 0, 'cities' => serialize(array()), 'countries' => serialize(array())));
16
$edit_id = $wpdb->insert_id;
17
$wpdb->insert($wpdb->prefix.'adrotate_schedule', array('name' => 'Schedule for ad '.$edit_id, 'starttime' => $now, 'stoptime' => $in84days, 'maxclicks' => 0, 'maximpressions' => 0));
18
$schedule_id = $wpdb->insert_id;
46
echo '<div class="error"><p>'. __('The AdCode cannot be empty!', 'adrotate').'</p></div>';
47
48
if(!preg_match("/%image%/i", $edit_banner->bannercode) AND $edit_banner->image != '')
49
+ echo '<div class="error"><p>'. __('You did not use %image% in your AdCode but did select an image!', 'adrotate').'</p></div>';
50
51
if(preg_match("/%image%/i", $edit_banner->bannercode) AND $edit_banner->image == '')
52
echo '<div class="error"><p>'. __('You did use %image% in your AdCode but did not select an image!', 'adrotate').'</p></div>';
54
if((($edit_banner->imagetype != '' AND $edit_banner->image == '') OR ($edit_banner->imagetype == '' AND $edit_banner->image != '')))
55
echo '<div class="error"><p>'. __('There is a problem saving the image specification. Please reset your image and re-save the ad!', 'adrotate').'</p></div>';
56
57
+ if(!preg_match("/%image%/i", $edit_banner->bannercode) AND $edit_banner->responsive == 'Y')
58
+ echo '<div class="error"><p>'. __(' You did not use %image% in your AdCode. The responsive checkbox will be ineffective.', 'adrotate').'</p></div>';
59
+
60
+ if(strlen($edit_banner->image) > 0 AND !preg_match("/full/", $edit_banner->image) AND $edit_banner->responsive == 'Y')
61
+ echo '<div class="error"><p>'. __('Your chosen banner image does not have the right name. Check the responsive description and try again.', 'adrotate').'</p></div>';
62
+
63
if(!preg_match_all('/<a[^>](.*?)>/i', stripslashes(htmlspecialchars_decode($edit_banner->bannercode, ENT_QUOTES)), $things) AND $edit_banner->tracker == 'Y')
64
echo '<div class="error"><p>'. __("Clicktracking is enabled but no valid link was found in the adcode!", 'adrotate').'</p></div>';
65
66
// Ad Notices
67
$adstate = adrotate_evaluate_ad($edit_banner->id);
68
+ if($edit_banner->type == 'error' AND $adstate == 'active')
69
echo '<div class="error"><p>'. __('AdRotate cannot find an error but the ad is marked erroneous, try re-saving the ad!', 'adrotate').'</p></div>';
70
71
if($adstate == 'expired')
72
echo '<div class="error"><p>'. __('This ad is expired and currently not shown on your website!', 'adrotate').'</p></div>';
73
74
+ if($adstate == '2days')
75
echo '<div class="updated"><p>'. __('The ad will expire in less than 2 days!', 'adrotate').'</p></div>';
76
77
+ if($adstate == '7days')
78
echo '<div class="updated"><p>'. __('This ad will expire in less than 7 days!', 'adrotate').'</p></div>';
79
80
if($edit_banner->type == 'disabled')
109
<h3><?php _e('Edit Advert', 'adrotate'); ?></h3>
110
<?php } ?>
111
112
<table class="widefat" style="margin-top: .5em">
113
<tbody>
114
<tr>
115
<th width="15%"><?php _e('Title:', 'adrotate'); ?></th>
116
<td colspan="2">
117
+ <label for="adrotate_title"><input tabindex="1" name="adrotate_title" type="text" size="50" class="search-input" value="<?php echo stripslashes($edit_banner->title);?>" autocomplete="off" /></label>
118
</td>
119
</tr>
120
<tr>
121
<th valign="top"><?php _e('AdCode:', 'adrotate'); ?></th>
122
<td>
123
+ <label for="adrotate_bannercode"><textarea tabindex="2" id="adrotate_bannercode" name="adrotate_bannercode" cols="65" rows="10"><?php echo stripslashes($edit_banner->bannercode); ?></textarea></label>
124
</td>
125
<td width="40%">
126
<p><strong><?php _e('Basic Examples:', 'adrotate'); ?></strong></p>
127
<p>1. <em><a href="#" onclick="textatcursor('adrotate_bannercode','&lt;a href=&quot;https://ajdg.solutions/&quot;&gt;Buy AdRotate Pro here!&lt;/a&gt;');return false;">&lt;a href="https://ajdg.solutions/"&gt;Buy AdRotate Pro here!&lt;/a&gt;</a></em></p>
128
<p>2. <em><a href="#" onclick="textatcursor('adrotate_bannercode','&lt;a href=&quot;http://www.floatingcoconut.net&quot;&gt;&lt;img src=&quot;%image%&quot; /&gt;&lt;/a&gt;');return false;">&lt;a href="http://www.floatingcoconut.net"&gt;&lt;img src="%image%" /&gt;&lt;/a&gt;</a></em></p>
129
<p>3. <em><a href="#" onclick="textatcursor('adrotate_bannercode','&lt;span class=&quot;ad-%id%&quot;&gt;&lt;a href=&quot;http://www.ajdg.net&quot;&gt;Text Link Ad!&lt;/a&gt;&lt;/span&gt;');return false;">&lt;span class="ad-%id%"&gt;&lt;a href="http://www.ajdg.net"&gt;Text Link Ad!&lt;/a&gt;&lt;/span&gt;</a></em></p>
130
</td>
131
</tr>
132
+ <tr>
133
+ <th valign="top"><?php _e('Useful tags:', 'adrotate'); ?></th>
134
+ <td colspan="2">
135
+ <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('Insert the %image% tag. Required when selecting a image below.', 'adrotate'); ?>" onclick="textatcursor('adrotate_bannercode','%image%');return false;">%image%</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>
136
+ </td>
137
+ </tr>
138
+ <tr>
139
+ <th valign="top"><?php _e('Banner image:', 'adrotate'); ?></th>
140
+ <td colspan="2">
141
+ <label for="adrotate_image">
142
+ <?php _e('WordPress media:', 'adrotate'); ?> <input tabindex="3" id="adrotate_image" type="text" size="50" name="adrotate_image" value="<?php echo $image_field; ?>" /> <input tabindex="4" id="adrotate_image_button" class="button" type="button" value="<?php _e('Select Banner', 'adrotate'); ?>" />
143
+ </label><br />
144
+ <?php _e('- OR -', 'adrotate'); ?><br />
145
+ <label for="adrotate_image_dropdown">
146
+ <?php _e('Banner folder:', 'adrotate'); ?> <select tabindex="5" name="adrotate_image_dropdown" style="min-width: 200px;">
147
+ <option value=""><?php _e('No image selected', 'adrotate'); ?></option>
148
+ <?php echo adrotate_folder_contents($image_dropdown); ?>
149
+ </select><br />
150
+ </label>
151
+ <em><?php _e('Use %image% in the code. Accepted files are:', 'adrotate'); ?> jpg, jpeg, gif, png, swf <?php _e('and', 'adrotate'); ?> flv. <?php _e('Use either the text field or the dropdown. If the textfield has content that field has priority.', 'adrotate'); ?></em>
152
+ </td>
153
+ </tr>
154
+ <?php if($adrotate_config['enable_stats'] == 'Y') { ?>
155
+ <tr>
156
+ <th width="15%" valign="top"><?php _e('Clicktracking:', 'adrotate'); ?></th>
157
+ <td colspan="2">
158
+ <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 tracking for this advert.', 'adrotate'); ?> <br />
159
+ <em><?php _e('Note: Clicktracking does not work for Javascript adverts such as those provided by Google AdSense/DFP/DoubleClick. Flash Adverts also are not supported.', 'adrotate'); ?></em>
160
+ </label>
161
+ </td>
162
+ </tr>
163
+ <?php } ?>
164
<tr>
165
<th><?php _e('Activate:', 'adrotate'); ?></th>
166
<td colspan="2">
167
<label for="adrotate_active">
168
+ <select tabindex="7" name="adrotate_active">
169
<option value="active" <?php if($edit_banner->type == "active") { echo 'selected'; } ?>><?php _e('Yes, this ad will be used', 'adrotate'); ?></option>
170
<option value="disabled" <?php if($edit_banner->type == "disabled") { echo 'selected'; } ?>><?php _e('No, do not show this ad anywhere', 'adrotate'); ?></option>
171
</select>
177
<center><?php _e('Get more features with AdRotate Pro.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('More information', 'adrotate'); ?></a>.</center>
178
179
<p class="submit">
180
+ <input tabindex="8" type="submit" name="adrotate_ad_submit" class="button-primary" value="<?php _e('Save Advert', 'adrotate'); ?>" />
181
<a href="admin.php?page=adrotate-ads&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
182
</p>
183
197
<?php } ?>
198
199
<h3><?php _e('Usage', 'adrotate'); ?></h3>
200
<table class="widefat" style="margin-top: .5em">
201
<tbody>
202
<tr>
203
+ <th width="15%"><?php _e('Widget:', 'adrotate'); ?></th>
204
+ <td colspan="3"><?php _e('Drag the AdRotate widget to the sidebar you want it in, select "Single Ad" and enter ID', 'adrotate'); ?> "<?php echo $edit_banner->id; ?>".</td>
205
</tr>
206
<tr>
207
<th width="15%"><?php _e('In a post or page:', 'adrotate'); ?></th>
208
<td>[adrotate banner="<?php echo $edit_banner->id; ?>"]</td>
212
</tbody>
213
</table>
214
215
+ <h3><?php _e('Schedule your advert', 'adrotate'); ?></h3>
216
<table class="widefat" style="margin-top: .5em">
217
<tbody>
218
<tr>
219
<th width="15%"><?php _e('Start date (day/month/year):', 'adrotate'); ?></th>
220
<td>
221
<label for="adrotate_sday">
222
+ <input tabindex="9" name="adrotate_sday" class="search-input" type="text" size="4" maxlength="2" value="<?php echo $sday;?>" /> /
223
+ <select tabindex="10" name="adrotate_smonth">
224
<option value="01" <?php if($smonth == "01") { echo 'selected'; } ?>><?php _e('January', 'adrotate'); ?></option>
225
<option value="02" <?php if($smonth == "02") { echo 'selected'; } ?>><?php _e('February', 'adrotate'); ?></option>
226
<option value="03" <?php if($smonth == "03") { echo 'selected'; } ?>><?php _e('March', 'adrotate'); ?></option>
234
<option value="11" <?php if($smonth == "11") { echo 'selected'; } ?>><?php _e('November', 'adrotate'); ?></option>
235
<option value="12" <?php if($smonth == "12") { echo 'selected'; } ?>><?php _e('December', 'adrotate'); ?></option>
236
</select> /
237
+ <input tabindex="11" name="adrotate_syear" class="search-input" type="text" size="4" maxlength="4" value="<?php echo $syear;?>" />&nbsp;&nbsp;&nbsp;
238
</label>
239
</td>
240
<th width="15%"><?php _e('End date (day/month/year):', 'adrotate'); ?></th>
241
<td>
242
<label for="adrotate_eday">
243
+ <input tabindex="12" name="adrotate_eday" class="search-input" type="text" size="4" maxlength="2" value="<?php echo $eday;?>" /> /
244
+ <select tabindex="13" name="adrotate_emonth">
245
<option value="01" <?php if($emonth == "01") { echo 'selected'; } ?>><?php _e('January', 'adrotate'); ?></option>
246
<option value="02" <?php if($emonth == "02") { echo 'selected'; } ?>><?php _e('February', 'adrotate'); ?></option>
247
<option value="03" <?php if($emonth == "03") { echo 'selected'; } ?>><?php _e('March', 'adrotate'); ?></option>
255
<option value="11" <?php if($emonth == "11") { echo 'selected'; } ?>><?php _e('November', 'adrotate'); ?></option>
256
<option value="12" <?php if($emonth == "12") { echo 'selected'; } ?>><?php _e('December', 'adrotate'); ?></option>
257
</select> /
258
+ <input tabindex="14" name="adrotate_eyear" class="search-input" type="text" size="4" maxlength="4" value="<?php echo $eyear;?>" />&nbsp;&nbsp;&nbsp;
259
</label>
260
</td>
261
</tr>
263
<th><?php _e('Start time (hh:mm):', 'adrotate'); ?></th>
264
<td>
265
<label for="adrotate_sday">
266
+ <input tabindex="15" name="adrotate_shour" class="search-input" type="text" size="2" maxlength="4" value="<?php echo $shour;?>" /> :
267
+ <input tabindex="16" name="adrotate_sminute" class="search-input" type="text" size="2" maxlength="4" value="<?php echo $sminute;?>" />
268
</label>
269
</td>
270
<th><?php _e('End time (hh:mm):', 'adrotate'); ?></th>
271
<td>
272
<label for="adrotate_eday">
273
+ <input tabindex="17" name="adrotate_ehour" class="search-input" type="text" size="2" maxlength="4" value="<?php echo $ehour;?>" /> :
274
+ <input tabindex="18" name="adrotate_eminute" class="search-input" type="text" size="2" maxlength="4" value="<?php echo $eminute;?>" />
275
</label>
276
</td>
277
</tr>
278
<?php if($adrotate_config['enable_stats'] == 'Y') { ?>
279
<tr>
280
<th><?php _e('Maximum Clicks:', 'adrotate'); ?></th>
281
+ <td><input tabindex="19" name="adrotate_maxclicks" type="text" size="5" class="search-input" autocomplete="off" value="<?php echo $schedules->maxclicks;?>" /> <em><?php _e('Leave empty or 0 to skip this.', 'adrotate'); ?></em></td>
282
<th><?php _e('Maximum Impressions:', 'adrotate'); ?></th>
283
+ <td><input tabindex="20" name="adrotate_maxshown" type="text" size="5" class="search-input" autocomplete="off" value="<?php echo $schedules->maximpressions;?>" /> <em><?php _e('Leave empty or 0 to skip this.', 'adrotate'); ?></em></td>
284
</tr>
285
<?php } ?>
286
<tr>
291
</table>
292
<center><?php _e('Create multiple schedules for each advert with AdRotate Pro.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade today', '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
+ <h3><?php _e('Advanced', 'adrotate'); ?></h3>
300
+ <p><em><?php _e('Everything below is optional.', 'adrotate'); ?></em></p>
301
<table class="widefat" style="margin-top: .5em">
302
+ <tbody>
303
+ <tr>
304
+ <th width="15%" valign="top"><?php _e('Responsive:', 'adrotate'); ?></th>
305
+ <td colspan="3">
306
+ <label for="adrotate_responsive"><input tabindex="22" type="checkbox" name="adrotate_responsive" <?php if($edit_banner->responsive == 'Y') { ?>checked="checked" <?php } ?> /> <?php _e('Enable responsive support for this advert.', 'adrotate'); ?></label><br />
307
+ <em><?php _e('Upload your images to the banner folder and make sure the filename is in the following format; "imagename.full.ext". A full set of sized images is strongly recommended.', 'adrotate'); ?></em><br />
308
+ <em><?php _e('For smaller size images use ".320", ".480", ".768" or ".1024" in the filename instead of ".full" for the various viewports.', 'adrotate'); ?></em><br />
309
+ <em><strong><?php _e('Example:', 'adrotate'); ?></strong> <?php _e('image.full.jpg, image.320.jpg and image.768.jpg will serve the same advert for different viewports.', 'adrotate'); ?></em></label>
310
+ </td>
311
+ </tr>
312
+ <tr>
313
+ <th valign="top"><?php _e('Weight:', 'adrotate'); ?><br /><em><?php _e('AdRotate Pro only', 'adrotate'); ?></em></th>
314
+ <td colspan="3">
315
+ <label for="adrotate_weight">
316
+ &nbsp;<input type="radio" name="adrotate_weight" value="2" disabled />&nbsp;&nbsp;&nbsp;2, <?php _e('Barely visible', 'adrotate'); ?><br />
317
+ &nbsp;<input type="radio" name="adrotate_weight" value="4" disabled />&nbsp;&nbsp;&nbsp;4, <?php _e('Less than average', 'adrotate'); ?><br />
318
+ &nbsp;<input type="radio" name="adrotate_weight" value="6" disabled checked />&nbsp;&nbsp;&nbsp;6, <?php _e('Normal coverage', 'adrotate'); ?><br />
319
+ &nbsp;<input type="radio" name="adrotate_weight" value="8" disabled />&nbsp;&nbsp;&nbsp;8, <?php _e('More than average', 'adrotate'); ?><br />
320
+ &nbsp;<input type="radio" name="adrotate_weight" value="10" disabled />&nbsp;&nbsp;&nbsp;10, <?php _e('Best visibility', 'adrotate'); ?>
321
+ </label>
322
+ </td>
323
+ </tr>
324
+ <tr>
325
+ <th><?php _e('Sortorder:', 'adrotate'); ?></th>
326
+ <td colspan="3">
327
+ <label for="adrotate_sortorder"><input tabindex="23" name="adrotate_sortorder" type="text" size="5" class="search-input" autocomplete="off" value="<?php echo $edit_banner->sortorder;?>" /> <em><?php _e('For administrative purposes set a sortorder.', 'adrotate'); ?> <?php _e('Leave empty or 0 to skip this. Will default to ad id.', 'adrotate'); ?></em></label>
328
+ </td>
329
+ </tr>
330
+ </tbody>
331
+ </table>
332
+ <center><?php _e('With AdRotate Pro you can set the weight to give adverts more or less exposure.', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade today', 'adrotate'); ?></a>!</center>
333
334
+ <h3><?php _e('Geo Targeting in AdRotate Pro', 'adrotate'); ?></h3>
335
+ <p><em><?php _e('Assign the advert to a group and enable that group to use Geo Targeting.', 'adrotate'); ?></em></p>
336
+ <table class="widefat" style="margin-top: .5em">
337
+ <tbody>
338
+ <tr>
339
+ <th width="15%" valign="top"><?php _e('Cities/States:', 'adrotate'); ?></strong></th>
340
+ <td colspan="2">
341
+ <textarea name="adrotate_geo_cities" cols="85" rows="3" disabled>Amsterdam, Noord Holland, New York, California, Tokyo, London</textarea><br />
342
+ <p><em><?php _e('A comma separated list of cities (or the Metro ID) and/or states (Also the states ISO codes are supported)', 'adrotate'); ?> (Alkmaar, Philadelphia, Melbourne, ...)<br /><?php _e('AdRotate does not check the validity of names so make sure you spell them correctly!', 'adrotate'); ?></em></p>
343
+ </td>
344
</tr>
345
+ <tr>
346
+ <th valign="top"><?php _e('Countries:', 'adrotate'); ?></strong></th>
347
+ <td colspan="2">
348
+ <label for="adrotate_geo_countries">
349
+ <div class="adrotate-select">
350
+ <table width="100%">
351
+ <tbody>
352
+ <tr>
353
+ <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">United States</td>
354
+ </tr>
355
+ <tr>
356
+ <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">Australia</td>
357
+ </tr>
358
+ <tr>
359
+ <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">Germany</td>
360
+ </tr>
361
+ <tr>
362
+ <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">Brazil</td>
363
+ </tr>
364
+ <tr>
365
+ <td class="check-column" style="padding: 0px;"><input type="checkbox" name="adrotate_geo_countries[]" value="" disabled></td><td style="padding: 0px;">Japan</td>
366
+ </tr>
367
+ </tbody>
368
+ </table>
369
+ </div>
370
+ </label>
371
+ <p><em><?php _e('Select the countries you want the adverts to show in.', 'adrotate'); ?> <?php _e('Cities take priority and will be filtered first.', 'adrotate'); ?></em></p>
372
+ </td>
373
+ </tr>
374
+ </tbody>
375
+ </table>
376
+ <center><?php _e('Target your audience with Geo Targeting in AdRotate Pro', 'adrotate'); ?>, <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade today', 'adrotate'); ?></a>.</center>
377
378
+ <h3><?php _e('Usage', 'adrotate'); ?></h3>
379
+ <table class="widefat" style="margin-top: .5em">
380
<tbody>
381
+ <tr>
382
+ <th width="15%"><?php _e('Widget:', 'adrotate'); ?></th>
383
+ <td colspan="3"><?php _e('Drag the AdRotate widget to the sidebar you want it in, select "Single Ad" and enter ID', 'adrotate'); ?> "<?php echo $edit_banner->id; ?>".</td>
384
</tr>
385
+ <tr>
386
+ <th width="15%"><?php _e('In a post or page:', 'adrotate'); ?></th>
387
+ <td>[adrotate banner="<?php echo $edit_banner->id; ?>"]</td>
388
+ <th width="15%"><?php _e('Directly in a theme:', 'adrotate'); ?></th>
389
+ <td>&lt;?php echo adrotate_ad(<?php echo $edit_banner->id; ?>); ?&gt;</td>
390
</tr>
391
+ </tbody>
392
</table>
393
394
<p class="submit">
395
+ <input tabindex="24" type="submit" name="adrotate_ad_submit" class="button-primary" value="<?php _e('Save Advert', 'adrotate'); ?>" />
396
<a href="admin.php?page=adrotate-ads&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
397
</p>
398
399
<?php if($groups) { ?>
400
<h3><?php _e('Select Groups', 'adrotate'); ?></h3>
401
<table class="widefat" style="margin-top: .5em">
402
<thead>
403
<tr>
433
</table>
434
435
<p class="submit">
436
+ <input tabindex="25" type="submit" name="adrotate_ad_submit" class="button-primary" value="<?php _e('Save Advert', 'adrotate'); ?>" />
437
<a href="admin.php?page=adrotate-ads&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
438
</p>
439
<?php } ?>
dashboard/publisher/adrotate-groups-edit.php CHANGED
@@ -24,7 +24,7 @@
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`, `crate`, `cbudget`, `irate`, `ibudget`, `type` FROM `".$wpdb->prefix."adrotate` WHERE (`type` != 'empty' AND `type` != 'a_empty') 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 = '';
@@ -45,7 +45,6 @@ if(!is_array($meta_array)) $meta_array = array();
45
<h3><?php _e('Edit Group', 'adrotate'); ?></h3>
46
<?php } ?>
47
48
- <p><em><?php _e('These are required.', 'adrotate'); ?></em></p>
49
<table class="widefat" style="margin-top: .5em">
50
<tbody>
51
<tr>
@@ -55,7 +54,7 @@ if(!is_array($meta_array)) $meta_array = array();
55
<tr>
56
<th width="15%"><?php _e('Name:', 'adrotate'); ?></th>
57
<td colspan="2">
58
- <label for="adrotate_groupname"><input tabindex="1" name="adrotate_groupname" type="text" class="search-input" size="80" value="<?php echo $edit_group->name; ?>" autocomplete="off" /></label>
59
</td>
60
</tr>
61
<tr>
@@ -80,54 +79,24 @@ if(!is_array($meta_array)) $meta_array = array();
80
<table class="widefat" style="margin-top: .5em">
81
<tbody>
82
<tr>
83
- <th width="15%"><?php _e('Block shape and border', 'adrotate'); ?></strong></th>
84
<td width="35%">
85
<label for="adrotate_gridrows"><select tabindex="3" name="adrotate_gridrows">
86
- <option value="1" <?php if($edit_group->gridrows == 1) { echo 'selected'; } ?>>1</option>
87
- <option value="2" <?php if($edit_group->gridrows == 2) { echo 'selected'; } ?>>2</option>
88
- <option value="3" <?php if($edit_group->gridrows == 3) { echo 'selected'; } ?>>3</option>
89
- <option value="4" <?php if($edit_group->gridrows == 4) { echo 'selected'; } ?>>4</option>
90
- <option value="5" <?php if($edit_group->gridrows == 5) { echo 'selected'; } ?>>5</option>
91
- <option value="6" <?php if($edit_group->gridrows == 6) { echo 'selected'; } ?>>6</option>
92
- <option value="7" <?php if($edit_group->gridrows == 7) { echo 'selected'; } ?>>7</option>
93
- <option value="8" <?php if($edit_group->gridrows == 8) { echo 'selected'; } ?>>8</option>
94
- <option value="9" <?php if($edit_group->gridrows == 9) { echo 'selected'; } ?>>9</option>
95
- <option value="10" <?php if($edit_group->gridrows == 10) { echo 'selected'; } ?>>10</option>
96
- <option value="11" <?php if($edit_group->gridrows == 11) { echo 'selected'; } ?>>11</option>
97
- <option value="12" <?php if($edit_group->gridrows == 12) { echo 'selected'; } ?>>12</option>
98
- <option value="13" <?php if($edit_group->gridrows == 13) { echo 'selected'; } ?>>13</option>
99
- <option value="14" <?php if($edit_group->gridrows == 14) { echo 'selected'; } ?>>14</option>
100
- <option value="15" <?php if($edit_group->gridrows == 15) { echo 'selected'; } ?>>15</option>
101
- <option value="16" <?php if($edit_group->gridrows == 16) { echo 'selected'; } ?>>16</option>
102
- <option value="17" <?php if($edit_group->gridrows == 17) { echo 'selected'; } ?>>17</option>
103
- <option value="18" <?php if($edit_group->gridrows == 18) { echo 'selected'; } ?>>18</option>
104
- <option value="19" <?php if($edit_group->gridrows == 19) { echo 'selected'; } ?>>19</option>
105
- <option value="20" <?php if($edit_group->gridrows == 20) { echo 'selected'; } ?>>20</option>
106
- <option value="21" <?php if($edit_group->gridrows == 21) { echo 'selected'; } ?>>21</option>
107
- <option value="22" <?php if($edit_group->gridrows == 22) { echo 'selected'; } ?>>22</option>
108
- <option value="23" <?php if($edit_group->gridrows == 23) { echo 'selected'; } ?>>23</option>
109
- <option value="24" <?php if($edit_group->gridrows == 24) { echo 'selected'; } ?>>24</option>
110
</select> <?php _e('rows', 'adrotate'); ?>,</label> <label for="adrotate_gridcolumns"><select tabindex="4" name="adrotate_gridcolumns">
111
- <option value="1" <?php if($edit_group->gridcolumns == 1) { echo 'selected'; } ?>>1</option>
112
- <option value="2" <?php if($edit_group->gridcolumns == 2) { echo 'selected'; } ?>>2</option>
113
- <option value="3" <?php if($edit_group->gridcolumns == 3) { echo 'selected'; } ?>>3</option>
114
- <option value="4" <?php if($edit_group->gridcolumns == 4) { echo 'selected'; } ?>>4</option>
115
- <option value="5" <?php if($edit_group->gridcolumns == 5) { echo 'selected'; } ?>>5</option>
116
- <option value="6" <?php if($edit_group->gridcolumns == 6) { echo 'selected'; } ?>>6</option>
117
- <option value="7" <?php if($edit_group->gridcolumns == 7) { echo 'selected'; } ?>>7</option>
118
- <option value="8" <?php if($edit_group->gridcolumns == 8) { echo 'selected'; } ?>>8</option>
119
- <option value="9" <?php if($edit_group->gridcolumns == 9) { echo 'selected'; } ?>>9</option>
120
- <option value="10" <?php if($edit_group->gridcolumns == 10) { echo 'selected'; } ?>>10</option>
121
- <option value="11" <?php if($edit_group->gridcolumns == 11) { echo 'selected'; } ?>>11</option>
122
- <option value="12" <?php if($edit_group->gridcolumns == 12) { echo 'selected'; } ?>>12</option>
123
</select> <?php _e('columns', 'adrotate'); ?>.</label>
124
</td>
125
<td colspan="2">
126
- <p><em><?php _e('Block Mode', 'adrotate'); ?> - <?php _e('Make a grid for your ads. Selecting 3 and 2 makes a grid with 2 columns showing a maximum of 6 ads. Default: 2x2.', 'adrotate'); ?></em></p>
127
</td>
128
</tr>
129
<tr>
130
- <th valign="top"><?php _e('Advert Width and Height', 'adrotate'); ?></strong></th>
131
<td>
132
<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>
133
</td>
@@ -165,9 +134,12 @@ if(!is_array($meta_array)) $meta_array = array();
165
</table>
166
167
<h3><?php _e('Usage', 'adrotate'); ?></h3>
168
- <p><em><?php _e('Copy the shortcode in a post or page. The PHP code goes in a theme file where you want the advert to show up.', 'adrotate'); ?></em></p>
169
<table class="widefat" style="margin-top: .5em">
170
<tbody>
171
<tr>
172
<th width="15%"><?php _e('In a post or page:', 'adrotate'); ?></th>
173
<td width="35%">[adrotate group="<?php echo $edit_group->id; ?>"]</td>
@@ -191,7 +163,7 @@ if(!is_array($meta_array)) $meta_array = array();
191
<label for="adrotate_admargin"><input tabindex="9" name="adrotate_admargin" type="text" class="search-input" size="5" value="<?php echo $edit_group->admargin; ?>" autocomplete="off" /> <?php _e('pixel(s)', 'adrotate'); ?>.</label>
192
</td>
193
<td colspan="2">
194
- <p><em><?php _e('A transparent area outside the advert in pixels. Default: 0.', 'adrotate'); ?> <?php _e('Set to 0 to disable.', 'adrotate'); ?></em></p>
195
</td>
196
</tr>
197
<tr>
@@ -210,7 +182,7 @@ if(!is_array($meta_array)) $meta_array = array();
210
</tr>
211
<tr>
212
<th valign="top"><?php _e('Sortorder:', 'adrotate'); ?></th>
213
- <td><label for="adrotate_sortorder"><input tabindex="12" name="adrotate_sortorder" type="text" size="5" class="search-input" autocomplete="off" value="<?php echo $edit_group->sortorder;?>" /></label></td>
214
<td><em><?php _e('For administrative purposes set a sortorder.', 'adrotate'); ?> <?php _e('Leave empty or 0 to skip this. Will default to group id.', 'adrotate'); ?></em></td>
215
</tr>
216
</tbody>
@@ -218,13 +190,12 @@ if(!is_array($meta_array)) $meta_array = array();
218
<center><?php _e('Set up a fallback group and use Geo Location in AdRotate Pro', 'adrotate'); ?> <a href="admin.php?page=adrotate-pro"><?php _e('Upgrade today', 'adrotate'); ?></a>.</center>
219
220
<h3><?php _e('Post Injection', 'adrotate'); ?></h3>
221
- <p><em><?php _e('Insert ads to the begin or end of a post/page.', 'adrotate'); ?></em></p>
222
<table class="widefat" style="margin-top: .5em">
223
<tr>
224
<th width="15%"><?php _e('Include ads in categories?', 'adrotate'); ?></th>
225
<td>
226
<label for="adrotate_cat_location">
227
- <select tabindex="13" name="adrotate_cat_location">
228
<option value="0" <?php if($edit_group->cat_loc == 0) { echo 'selected'; } ?>><?php _e('Disabled', '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>
@@ -233,7 +204,7 @@ if(!is_array($meta_array)) $meta_array = array();
233
</select>
234
</label>
235
<label for="adrotate_cat_paragraph">
236
- <select tabindex="14" name="adrotate_cat_paragraph">
237
<option value="0" <?php if($edit_group->cat_par == 0) { echo 'selected'; } ?>>...</option>
238
<option value="1" <?php if($edit_group->cat_par == 1) { echo 'selected'; } ?>><?php _e('the first paragraph', 'adrotate'); ?></option>
239
<option value="20" <?php if($edit_group->cat_par == 20) { echo 'selected'; } ?>><?php _e('the 2nd paragraph', 'adrotate'); ?></option>
@@ -265,7 +236,7 @@ if(!is_array($meta_array)) $meta_array = array();
265
<th valign="top"><?php _e('Include ads in pages?', 'adrotate'); ?></th>
266
<td>
267
<label for="adrotate_page_location">
268
- <select tabindex="15" name="adrotate_page_location">
269
<option value="0" <?php if($edit_group->page_loc == 0) { echo 'selected'; } ?>><?php _e('Disabled', 'adrotate'); ?></option>
270
<option value="1" <?php if($edit_group->page_loc == 1) { echo 'selected'; } ?>><?php _e('Before content', 'adrotate'); ?></option>
271
<option value="2" <?php if($edit_group->page_loc == 2) { echo 'selected'; } ?>><?php _e('After content', 'adrotate'); ?></option>
@@ -274,7 +245,7 @@ if(!is_array($meta_array)) $meta_array = array();
274
</select>
275
</label>
276
<label for="adrotate_page_paragraph">
277
- <select tabindex="16" name="adrotate_page_paragraph">
278
<option value="0" <?php if($edit_group->page_par == 0) { echo 'selected'; } ?>>...</option>
279
<option value="1" <?php if($edit_group->page_par == 1) { echo 'selected'; } ?>><?php _e('the first paragraph', 'adrotate'); ?></option>
280
<option value="20" <?php if($edit_group->page_par == 20) { echo 'selected'; } ?>><?php _e('the 2nd paragraph', 'adrotate'); ?></option>
@@ -306,9 +277,12 @@ if(!is_array($meta_array)) $meta_array = array();
306
</table>
307
308
<h3><?php _e('Usage', 'adrotate'); ?></h3>
309
- <p><em><?php _e('Copy the shortcode in a post or page. The PHP code goes in a theme file where you want the advert to show up.', 'adrotate'); ?></em></p>
310
<table class="widefat" style="margin-top: .5em">
311
<tbody>
312
<tr>
313
<th width="15%"><?php _e('In a post or page:', 'adrotate'); ?></th>
314
<td width="35%">[adrotate group="<?php echo $edit_group->id; ?>"]</td>
@@ -319,26 +293,25 @@ if(!is_array($meta_array)) $meta_array = array();
319
</table>
320
321
<p class="submit">
322
- <input tabindex="17" type="submit" name="adrotate_group_submit" class="button-primary" value="<?php _e('Save Group', 'adrotate'); ?>" />
323
<a href="admin.php?page=adrotate-groups&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
324
</p>
325
326
<h3><?php _e('Wrapper code', 'adrotate'); ?></h3>
327
- <p><em><?php _e('Wraps around each ad.', 'adrotate'); ?></em></p>
328
<table class="widefat" style="margin-top: .5em">
329
<tbody>
330
<tr>
331
<th width="15%" valign="top"><?php _e('Before ad', 'adrotate'); ?></strong></th>
332
- <td colspan="2"><textarea tabindex="18" name="adrotate_wrapper_before" cols="65" rows="3"><?php echo stripslashes($edit_group->wrapper_before); ?></textarea></td>
333
<td width="35%">
334
<p><strong><?php _e('Example:', 'adrotate'); ?></strong> <em>&lt;span style="background-color:#aaa;"&gt;</em></p>
335
<p><strong><?php _e('Options:', 'adrotate'); ?></strong> <em>%id%</em></p>
336
- <p><em><?php _e('HTML/JavaScript allowed, use with care!', 'adrotate'); ?></em></p>
337
</td>
338
</tr>
339
<tr>
340
<th valign="top"><?php _e('After ad', 'adrotate'); ?></strong></th>
341
- <td colspan="2"><textarea tabindex="19" name="adrotate_wrapper_after" cols="65" rows="3"><?php echo stripslashes($edit_group->wrapper_after); ?></textarea></td>
342
<td>
343
<p><strong><?php _e('Example:', 'adrotate'); ?></strong> <em>&lt;/span&gt;</em></p>
344
</td>
@@ -401,7 +374,7 @@ if(!is_array($meta_array)) $meta_array = array();
401
</center></p>
402
403
<p class="submit">
404
- <input tabindex="20" type="submit" name="adrotate_group_submit" class="button-primary" value="<?php _e('Save Group', 'adrotate'); ?>" />
405
<a href="admin.php?page=adrotate-groups&view=manage" class="button"><?php _e('Cancel', 'adrotate'); ?></a>
406
</p>
407
</form>
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') 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 = '';
45
<h3><?php _e('Edit Group', 'adrotate'); ?></h3>
46
<?php } ?>
47
48
<table class="widefat" style="margin-top: .5em">
49
<tbody>
50
<tr>
54
<tr>
55
<th width="15%"><?php _e('Name:', 'adrotate'); ?></th>
56
<td colspan="2">
57
+ <label for="adrotate_groupname"><input tabindex="1" name="adrotate_groupname" type="text" class="search-input" size="50" value="<?php echo $edit_group->name; ?>" autocomplete="off" /></label>
58
</td>
59
</tr>
60
<tr>
79
<table class="widefat" style="margin-top: .5em">
80
<tbody>
81
<tr>
82
+ <th width="15%"><?php _e('Block size', 'adrotate'); ?></strong></th>
83
<td width="35%">
84
<label for="adrotate_gridrows"><select tabindex="3" name="adrotate_gridrows">
85
+ <?php for($rows=1;$rows<=32;$rows++) { ?>
86
+ <option value="<?php echo $rows; ?>" <?php if($edit_group->gridrows == $rows) { echo 'selected'; } ?>><?php echo $rows; ?></option>
87
+ <?php } ?>
88