Version Description
Enjoy this update with the latest tweaks and improvements for AdRotate for WordPress!
Download this release
Release Info
Developer | adegans |
Plugin | AdRotate Banner Manager |
Version | 5.8.8 |
Comparing to | |
See all releases |
Code changes from version 5.8.7 to 5.8.8
- adrotate-functions.php +3 -3
- adrotate-manage-publisher.php +4 -4
- adrotate-output.php +7 -7
- adrotate-portability.php +1 -1
- adrotate-setup.php +13 -13
- adrotate-statistics.php +3 -15
- adrotate.php +5 -5
- language/adrotate.pot +1 -1
- library/goosebox.js +13 -12
- library/jquery.adrotate.clicktracker.js +1 -1
- library/jquery.adrotate.datepicker.js +1 -1
- library/jquery.adrotate.dyngroup.js +1 -1
- library/jquery.adrotate.tablesorter.js +1 -1
- library/jquery.tablesorter.min.js +0 -1
- library/textatcursor.js +1 -1
- library/uploader-hook.js +1 -1
- readme.txt +6 -3
adrotate-functions.php
CHANGED
@@ -67,7 +67,7 @@ function adrotate_is_human() {
|
|
67 |
function adrotate_filter_schedule($selected, $banner) {
|
68 |
global $wpdb, $adrotate_config;
|
69 |
|
70 |
-
$now =
|
71 |
|
72 |
// Get schedules for advert
|
73 |
$schedules = $wpdb->get_results("SELECT `{$wpdb->prefix}adrotate_schedule`.`id`, `starttime`, `stoptime`, `maxclicks`, `maximpressions` FROM `{$wpdb->prefix}adrotate_schedule`, `{$wpdb->prefix}adrotate_linkmeta` WHERE `schedule` = `{$wpdb->prefix}adrotate_schedule`.`id` AND `ad` = '".$banner->id."' ORDER BY `starttime` ASC LIMIT 1;");
|
@@ -331,7 +331,7 @@ function adrotate_evaluate_ads() {
|
|
331 |
function adrotate_evaluate_ad($ad_id) {
|
332 |
global $wpdb, $adrotate_config;
|
333 |
|
334 |
-
$now =
|
335 |
$in2days = $now + 172800;
|
336 |
$in7days = $now + 604800;
|
337 |
|
@@ -377,7 +377,7 @@ function adrotate_evaluate_ad($ad_id) {
|
|
377 |
Since: 3.0
|
378 |
-------------------------------------------------------------*/
|
379 |
function adrotate_prepare_color($enddate) {
|
380 |
-
$now =
|
381 |
$in2days = $now + 172800;
|
382 |
$in7days = $now + 604800;
|
383 |
|
67 |
function adrotate_filter_schedule($selected, $banner) {
|
68 |
global $wpdb, $adrotate_config;
|
69 |
|
70 |
+
$now = current_time('timestamp');
|
71 |
|
72 |
// Get schedules for advert
|
73 |
$schedules = $wpdb->get_results("SELECT `{$wpdb->prefix}adrotate_schedule`.`id`, `starttime`, `stoptime`, `maxclicks`, `maximpressions` FROM `{$wpdb->prefix}adrotate_schedule`, `{$wpdb->prefix}adrotate_linkmeta` WHERE `schedule` = `{$wpdb->prefix}adrotate_schedule`.`id` AND `ad` = '".$banner->id."' ORDER BY `starttime` ASC LIMIT 1;");
|
331 |
function adrotate_evaluate_ad($ad_id) {
|
332 |
global $wpdb, $adrotate_config;
|
333 |
|
334 |
+
$now = current_time('timestamp');
|
335 |
$in2days = $now + 172800;
|
336 |
$in7days = $now + 604800;
|
337 |
|
377 |
Since: 3.0
|
378 |
-------------------------------------------------------------*/
|
379 |
function adrotate_prepare_color($enddate) {
|
380 |
+
$now = current_time('timestamp');
|
381 |
$in2days = $now + 172800;
|
382 |
$in7days = $now + 604800;
|
383 |
|
adrotate-manage-publisher.php
CHANGED
@@ -65,7 +65,7 @@ function adrotate_generate_input() {
|
|
65 |
$portability = adrotate_portable_hash('import', $portability);
|
66 |
|
67 |
// Save the advert to the DB
|
68 |
-
$wpdb->update($wpdb->prefix.'adrotate', array('title' => $portability['title'], 'bannercode' => $portability['bannercode'], 'thetime' => $portability['thetime'], 'updated' =>
|
69 |
}
|
70 |
|
71 |
adrotate_return('adrotate-ads', 226, array('view' => 'edit', 'ad'=> $id));
|
@@ -95,7 +95,7 @@ function adrotate_insert_input() {
|
|
95 |
if(isset($_POST['adrotate_username'])) $author = $_POST['adrotate_username'];
|
96 |
if(isset($_POST['adrotate_title'])) $title = strip_tags(htmlspecialchars(trim($_POST['adrotate_title'], "\t\n "), ENT_QUOTES));
|
97 |
if(isset($_POST['adrotate_bannercode'])) $bannercode = htmlspecialchars(trim($_POST['adrotate_bannercode'], "\t\n "), ENT_QUOTES);
|
98 |
-
$thetime =
|
99 |
if(isset($_POST['adrotate_active'])) $active = strip_tags(htmlspecialchars(trim($_POST['adrotate_active'], "\t\n "), ENT_QUOTES));
|
100 |
|
101 |
// Schedules
|
@@ -743,7 +743,7 @@ function adrotate_renew($id, $howlong = 2592000) {
|
|
743 |
if($schedule_id > 0) {
|
744 |
$wpdb->query("UPDATE `{$wpdb->prefix}adrotate_schedule` SET `stoptime` = `stoptime` + $howlong WHERE `id` = $schedule_id;");
|
745 |
} else {
|
746 |
-
$now =
|
747 |
$stoptime = $now + $howlong;
|
748 |
$wpdb->insert($wpdb->prefix.'adrotate_schedule', array('name' => 'Schedule for ad '.$id, 'starttime' => $now, 'stoptime' => $stoptime, 'maxclicks' => 0, 'maximpressions' => 0));
|
749 |
$wpdb->insert($wpdb->prefix.'adrotate_linkmeta', array('ad' => $id, 'group' => 0, 'user' => 0, 'schedule' => $wpdb->insert_id));
|
@@ -834,7 +834,7 @@ function adrotate_options_submit() {
|
|
834 |
$config['enable_clean_trackerdata'] = (isset($_POST['adrotate_enable_clean_trackerdata'])) ? 'Y' : 'N';
|
835 |
|
836 |
if($config['enable_clean_trackerdata'] == "Y" AND !wp_next_scheduled('adrotate_delete_transients')) {
|
837 |
-
wp_schedule_event(
|
838 |
}
|
839 |
if($config['enable_clean_trackerdata'] == "N" AND wp_next_scheduled('adrotate_delete_transients')) {
|
840 |
wp_clear_scheduled_hook('adrotate_delete_transients');
|
65 |
$portability = adrotate_portable_hash('import', $portability);
|
66 |
|
67 |
// Save the advert to the DB
|
68 |
+
$wpdb->update($wpdb->prefix.'adrotate', array('title' => $portability['title'], 'bannercode' => $portability['bannercode'], 'thetime' => $portability['thetime'], 'updated' => current_time('timestamp'), 'author' => $portability['author'], 'imagetype' => $portability['imagetype'], 'image' => $portability['image'], 'tracker' => $portability['tracker'], 'show_everyone' => $portability['show_everyone'], 'desktop' => $portability['desktop'], 'mobile' => $portability['mobile'], 'tablet' => $portability['tablet'], 'os_ios' => $portability['os_ios'], 'os_android' => $portability['os_android'], 'os_other' => $portability['os_other'], 'weight' => $portability['weight'], 'autodelete' => $portability['autodelete'], 'budget' => $portability['budget'], 'crate' => $portability['crate'], 'irate' => $portability['irate'], 'state_req' => $portability['state_req'], 'cities' => $portability['cities'], 'states' => $portability['states'], 'countries' => $portability['countries']), array('id' => $id));
|
69 |
}
|
70 |
|
71 |
adrotate_return('adrotate-ads', 226, array('view' => 'edit', 'ad'=> $id));
|
95 |
if(isset($_POST['adrotate_username'])) $author = $_POST['adrotate_username'];
|
96 |
if(isset($_POST['adrotate_title'])) $title = strip_tags(htmlspecialchars(trim($_POST['adrotate_title'], "\t\n "), ENT_QUOTES));
|
97 |
if(isset($_POST['adrotate_bannercode'])) $bannercode = htmlspecialchars(trim($_POST['adrotate_bannercode'], "\t\n "), ENT_QUOTES);
|
98 |
+
$thetime = current_time('timestamp');
|
99 |
if(isset($_POST['adrotate_active'])) $active = strip_tags(htmlspecialchars(trim($_POST['adrotate_active'], "\t\n "), ENT_QUOTES));
|
100 |
|
101 |
// Schedules
|
743 |
if($schedule_id > 0) {
|
744 |
$wpdb->query("UPDATE `{$wpdb->prefix}adrotate_schedule` SET `stoptime` = `stoptime` + $howlong WHERE `id` = $schedule_id;");
|
745 |
} else {
|
746 |
+
$now = current_time('timestamp');
|
747 |
$stoptime = $now + $howlong;
|
748 |
$wpdb->insert($wpdb->prefix.'adrotate_schedule', array('name' => 'Schedule for ad '.$id, 'starttime' => $now, 'stoptime' => $stoptime, 'maxclicks' => 0, 'maximpressions' => 0));
|
749 |
$wpdb->insert($wpdb->prefix.'adrotate_linkmeta', array('ad' => $id, 'group' => 0, 'user' => 0, 'schedule' => $wpdb->insert_id));
|
834 |
$config['enable_clean_trackerdata'] = (isset($_POST['adrotate_enable_clean_trackerdata'])) ? 'Y' : 'N';
|
835 |
|
836 |
if($config['enable_clean_trackerdata'] == "Y" AND !wp_next_scheduled('adrotate_delete_transients')) {
|
837 |
+
wp_schedule_event(current_time('timestamp'), 'twicedaily', 'adrotate_delete_transients');
|
838 |
}
|
839 |
if($config['enable_clean_trackerdata'] == "N" AND wp_next_scheduled('adrotate_delete_transients')) {
|
840 |
wp_clear_scheduled_hook('adrotate_delete_transients');
|
adrotate-output.php
CHANGED
@@ -64,7 +64,7 @@ function adrotate_group($group_ids, $opt = null) {
|
|
64 |
if($group_ids) {
|
65 |
$options = wp_parse_args($opt, array());
|
66 |
|
67 |
-
$now =
|
68 |
|
69 |
$group_array = (preg_match('/,/is', $group_ids)) ? explode(",", $group_ids) : array($group_ids);
|
70 |
$group_array = array_filter($group_array);
|
@@ -372,7 +372,7 @@ function adrotate_preview($banner_id) {
|
|
372 |
global $wpdb;
|
373 |
|
374 |
if($banner_id) {
|
375 |
-
$now =
|
376 |
|
377 |
$banner = $wpdb->get_row($wpdb->prepare("SELECT * FROM `{$wpdb->prefix}adrotate` WHERE `id` = %d;", $banner_id));
|
378 |
|
@@ -678,13 +678,13 @@ function adrotate_notifications_dashboard() {
|
|
678 |
|
679 |
// These only show on AdRotate pages
|
680 |
if(strpos($page, 'adrotate') !== false) {
|
681 |
-
if(isset($_GET['hide']) AND $_GET['hide'] == 0) update_option('adrotate_hide_getpro',
|
682 |
if(isset($_GET['hide']) AND $_GET['hide'] == 1) update_option('adrotate_hide_review', 1);
|
683 |
-
if(isset($_GET['hide']) AND $_GET['hide'] == 2) update_option('adrotate_hide_birthday',
|
684 |
|
685 |
// Get AdRotate Pro
|
686 |
$getpro_banner = get_option('adrotate_hide_getpro');
|
687 |
-
if($getpro_banner <
|
688 |
echo '<div class="ajdg-notification notice">';
|
689 |
echo ' <div class="ajdg-notification-logo" style="background-image: url(\''.plugins_url('/images/notification.png', __FILE__).'\');"><span></span></div>';
|
690 |
echo ' <div class="ajdg-notification-message">Hello <strong>'.$displayname.'</strong>. Have you considered upgrading to <strong>AdRotate Professional</strong> yet?<br />Get extra features like Geo Targeting, Scheduling, mobile adverts, access to premium support and much more starting at only €39 EUR.<br />Use coupon code <strong>getadrotatepro</strong> and get a 10% discount on any <strong>AdRotate Professional</strong> license! Thank you for your consideration!</div>';
|
@@ -697,7 +697,7 @@ function adrotate_notifications_dashboard() {
|
|
697 |
|
698 |
// Write a review
|
699 |
$review_banner = get_option('adrotate_hide_review');
|
700 |
-
if($review_banner != 1 AND $review_banner < (
|
701 |
echo '<div class="ajdg-notification notice">';
|
702 |
echo ' <div class="ajdg-notification-logo" style="background-image: url(\''.plugins_url('/images/notification.png', __FILE__).'\');"><span></span></div>';
|
703 |
echo ' <div class="ajdg-notification-message">Hello <strong>'.$displayname.'</strong>! You have been using <strong>AdRotate</strong> for a few days. If you like AdRotate, please share <strong>your experience</strong> and help promote AdRotate.<br />Tell your followers that you use AdRotate. A <a href="https://twitter.com/intent/tweet?hashtags=wordpress%2Cplugin%2Cadvertising&related=arnandegans%2Cwordpress&text=I%20am%20using%20AdRotate%20for%20@WordPress.%20Check%20it%20out.&url=https%3A%2F%2Fwordpress.org/plugins/adrotate/" target="_blank" class="ajdg-notification-act goosebox">Tweet</a> or <a href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fwordpress.org%2Fplugins%2Fadrotate%2F&src=adrotate" target="_blank" class="ajdg-notification-act goosebox">Facebook Share</a> helps a lot and is super awesome!<br />If you have questions, complaints or something else that does not belong in a review, please use the <a href="'.admin_url('admin.php?page=adrotate-support').'">support forum</a>!</div>';
|
@@ -710,7 +710,7 @@ function adrotate_notifications_dashboard() {
|
|
710 |
|
711 |
// Birthday
|
712 |
$birthday_banner = get_option('adrotate_hide_birthday');
|
713 |
-
if($birthday_banner <
|
714 |
echo '<div class="ajdg-notification notice">';
|
715 |
echo ' <div class="ajdg-notification-logo" style="background-image: url(\''.plugins_url('/images/birthday.png', __FILE__).'\');"><span></span></div>';
|
716 |
echo ' <div class="ajdg-notification-message">Hey <strong>'.$displayname.'</strong>! Did you know it is Arnan his birtyday this month? February 9th to be exact. Wish him a happy birthday via Twitter!<br />Who is Arnan? He made AdRotate for you - Check out his <a href="https://www.arnan.me/?pk_campaign=adrotatefree&pk_keyword=birthday_banner" target="_blank">website</a> or <a href="https://www.arnan.me/donate.html?pk_campaign=adrotatefree&pk_keyword=birthday_banner" target="_blank">send a gift</a>.</div>';
|
64 |
if($group_ids) {
|
65 |
$options = wp_parse_args($opt, array());
|
66 |
|
67 |
+
$now = current_time('timestamp');
|
68 |
|
69 |
$group_array = (preg_match('/,/is', $group_ids)) ? explode(",", $group_ids) : array($group_ids);
|
70 |
$group_array = array_filter($group_array);
|
372 |
global $wpdb;
|
373 |
|
374 |
if($banner_id) {
|
375 |
+
$now = current_time('timestamp');
|
376 |
|
377 |
$banner = $wpdb->get_row($wpdb->prepare("SELECT * FROM `{$wpdb->prefix}adrotate` WHERE `id` = %d;", $banner_id));
|
378 |
|
678 |
|
679 |
// These only show on AdRotate pages
|
680 |
if(strpos($page, 'adrotate') !== false) {
|
681 |
+
if(isset($_GET['hide']) AND $_GET['hide'] == 0) update_option('adrotate_hide_getpro', current_time('timestamp') + (31 * DAY_IN_SECONDS));
|
682 |
if(isset($_GET['hide']) AND $_GET['hide'] == 1) update_option('adrotate_hide_review', 1);
|
683 |
+
if(isset($_GET['hide']) AND $_GET['hide'] == 2) update_option('adrotate_hide_birthday', current_time('timestamp') + (10 * MONTH_IN_SECONDS));
|
684 |
|
685 |
// Get AdRotate Pro
|
686 |
$getpro_banner = get_option('adrotate_hide_getpro');
|
687 |
+
if($getpro_banner < current_time('timestamp')) {
|
688 |
echo '<div class="ajdg-notification notice">';
|
689 |
echo ' <div class="ajdg-notification-logo" style="background-image: url(\''.plugins_url('/images/notification.png', __FILE__).'\');"><span></span></div>';
|
690 |
echo ' <div class="ajdg-notification-message">Hello <strong>'.$displayname.'</strong>. Have you considered upgrading to <strong>AdRotate Professional</strong> yet?<br />Get extra features like Geo Targeting, Scheduling, mobile adverts, access to premium support and much more starting at only €39 EUR.<br />Use coupon code <strong>getadrotatepro</strong> and get a 10% discount on any <strong>AdRotate Professional</strong> license! Thank you for your consideration!</div>';
|
697 |
|
698 |
// Write a review
|
699 |
$review_banner = get_option('adrotate_hide_review');
|
700 |
+
if($review_banner != 1 AND $review_banner < (current_time('timestamp') - (8 * DAY_IN_SECONDS))) {
|
701 |
echo '<div class="ajdg-notification notice">';
|
702 |
echo ' <div class="ajdg-notification-logo" style="background-image: url(\''.plugins_url('/images/notification.png', __FILE__).'\');"><span></span></div>';
|
703 |
echo ' <div class="ajdg-notification-message">Hello <strong>'.$displayname.'</strong>! You have been using <strong>AdRotate</strong> for a few days. If you like AdRotate, please share <strong>your experience</strong> and help promote AdRotate.<br />Tell your followers that you use AdRotate. A <a href="https://twitter.com/intent/tweet?hashtags=wordpress%2Cplugin%2Cadvertising&related=arnandegans%2Cwordpress&text=I%20am%20using%20AdRotate%20for%20@WordPress.%20Check%20it%20out.&url=https%3A%2F%2Fwordpress.org/plugins/adrotate/" target="_blank" class="ajdg-notification-act goosebox">Tweet</a> or <a href="https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fwordpress.org%2Fplugins%2Fadrotate%2F&src=adrotate" target="_blank" class="ajdg-notification-act goosebox">Facebook Share</a> helps a lot and is super awesome!<br />If you have questions, complaints or something else that does not belong in a review, please use the <a href="'.admin_url('admin.php?page=adrotate-support').'">support forum</a>!</div>';
|
710 |
|
711 |
// Birthday
|
712 |
$birthday_banner = get_option('adrotate_hide_birthday');
|
713 |
+
if($birthday_banner < current_time('timestamp') AND date('M',adrotate_date_start('day')) == 'Feb') {
|
714 |
echo '<div class="ajdg-notification notice">';
|
715 |
echo ' <div class="ajdg-notification-logo" style="background-image: url(\''.plugins_url('/images/birthday.png', __FILE__).'\');"><span></span></div>';
|
716 |
echo ' <div class="ajdg-notification-message">Hey <strong>'.$displayname.'</strong>! Did you know it is Arnan his birtyday this month? February 9th to be exact. Wish him a happy birthday via Twitter!<br />Who is Arnan? He made AdRotate for you - Check out his <a href="https://www.arnan.me/?pk_campaign=adrotatefree&pk_keyword=birthday_banner" target="_blank">website</a> or <a href="https://www.arnan.me/donate.html?pk_campaign=adrotatefree&pk_keyword=birthday_banner" target="_blank">send a gift</a>.</div>';
|
adrotate-portability.php
CHANGED
@@ -92,7 +92,7 @@ function adrotate_portable_hash($action, $data, $what = 'advert') {
|
|
92 |
$source = get_option('siteurl');
|
93 |
if(in_array("aes-128-cbc", openssl_get_cipher_methods())) {
|
94 |
if($action == 'export') {
|
95 |
-
$portable['meta'] = array('type' => $what, 'source' => $source, 'exported' =>
|
96 |
foreach($data as $key => $value) {
|
97 |
if(empty($value)) $value = '';
|
98 |
$advert[$key] = $value;
|
92 |
$source = get_option('siteurl');
|
93 |
if(in_array("aes-128-cbc", openssl_get_cipher_methods())) {
|
94 |
if($action == 'export') {
|
95 |
+
$portable['meta'] = array('type' => $what, 'source' => $source, 'exported' => current_time('timestamp'));
|
96 |
foreach($data as $key => $value) {
|
97 |
if(empty($value)) $value = '';
|
98 |
$advert[$key] = $value;
|
adrotate-setup.php
CHANGED
@@ -62,9 +62,9 @@ function adrotate_activate_setup() {
|
|
62 |
add_option('adrotate_geo_required', 0);
|
63 |
add_option('adrotate_geo_requests', 0);
|
64 |
add_option('adrotate_dynamic_required', 0);
|
65 |
-
update_option('adrotate_hide_getpro',
|
66 |
-
update_option('adrotate_hide_review',
|
67 |
-
update_option('adrotate_hide_birthday',
|
68 |
|
69 |
// Install new database
|
70 |
adrotate_database_install();
|
@@ -120,8 +120,8 @@ function adrotate_deactivate($network_wide) {
|
|
120 |
function adrotate_deactivate_setup() {
|
121 |
global $wp_roles;
|
122 |
|
123 |
-
update_option('adrotate_hide_getpro',
|
124 |
-
update_option('adrotate_hide_review',
|
125 |
|
126 |
// Clean up capabilities from ALL users
|
127 |
$editable_roles = apply_filters('editable_roles', $wp_roles->roles);
|
@@ -314,7 +314,7 @@ function adrotate_dummy_data() {
|
|
314 |
global $wpdb, $current_user;
|
315 |
|
316 |
// Initial data
|
317 |
-
$now =
|
318 |
$in84days = $now + 7257600;
|
319 |
|
320 |
$no_ads = $wpdb->get_var("SELECT `id` FROM `{$wpdb->prefix}adrotate` LIMIT 1;");
|
@@ -356,7 +356,7 @@ function adrotate_database_install() {
|
|
356 |
|
357 |
// Initial data
|
358 |
$charset_collate = $engine = '';
|
359 |
-
$now =
|
360 |
|
361 |
if(!empty($wpdb->charset)) {
|
362 |
$charset_collate .= " DEFAULT CHARACTER SET {$wpdb->charset}";
|
@@ -644,9 +644,9 @@ function adrotate_core_upgrade() {
|
|
644 |
|
645 |
// 4.13
|
646 |
if($adrotate_version['current'] < 392) {
|
647 |
-
update_option('adrotate_hide_premium',
|
648 |
-
update_option('adrotate_hide_premium_2',
|
649 |
-
update_option('adrotate_hide_premium_3',
|
650 |
|
651 |
delete_option('adrotate_hide_banner');
|
652 |
}
|
@@ -758,7 +758,7 @@ function adrotate_core_upgrade() {
|
|
758 |
function adrotate_clean_setup() {
|
759 |
global $wpdb, $adrotate_config;
|
760 |
|
761 |
-
$now =
|
762 |
|
763 |
// Clean up Tracker data
|
764 |
$yesterday = $now - DAY_IN_SECONDS;
|
@@ -824,8 +824,8 @@ function adrotate_clean_setup() {
|
|
824 |
function adrotate_empty_trackerdata() {
|
825 |
global $wpdb;
|
826 |
|
827 |
-
$clicks =
|
828 |
-
$impressions =
|
829 |
|
830 |
$wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_tracker` WHERE `timer` < {$impressions} AND `stat` = 'i';");
|
831 |
$wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_tracker` WHERE `timer` < {$clicks} AND `stat` = 'c';");
|
62 |
add_option('adrotate_geo_required', 0);
|
63 |
add_option('adrotate_geo_requests', 0);
|
64 |
add_option('adrotate_dynamic_required', 0);
|
65 |
+
update_option('adrotate_hide_getpro', current_time('timestamp') + (14 * DAY_IN_SECONDS));
|
66 |
+
update_option('adrotate_hide_review', current_time('timestamp'));
|
67 |
+
update_option('adrotate_hide_birthday', current_time('timestamp'));
|
68 |
|
69 |
// Install new database
|
70 |
adrotate_database_install();
|
120 |
function adrotate_deactivate_setup() {
|
121 |
global $wp_roles;
|
122 |
|
123 |
+
update_option('adrotate_hide_getpro', current_time('timestamp') + (14 * DAY_IN_SECONDS));
|
124 |
+
update_option('adrotate_hide_review', current_time('timestamp'));
|
125 |
|
126 |
// Clean up capabilities from ALL users
|
127 |
$editable_roles = apply_filters('editable_roles', $wp_roles->roles);
|
314 |
global $wpdb, $current_user;
|
315 |
|
316 |
// Initial data
|
317 |
+
$now = current_time('timestamp');
|
318 |
$in84days = $now + 7257600;
|
319 |
|
320 |
$no_ads = $wpdb->get_var("SELECT `id` FROM `{$wpdb->prefix}adrotate` LIMIT 1;");
|
356 |
|
357 |
// Initial data
|
358 |
$charset_collate = $engine = '';
|
359 |
+
$now = current_time('timestamp');
|
360 |
|
361 |
if(!empty($wpdb->charset)) {
|
362 |
$charset_collate .= " DEFAULT CHARACTER SET {$wpdb->charset}";
|
644 |
|
645 |
// 4.13
|
646 |
if($adrotate_version['current'] < 392) {
|
647 |
+
update_option('adrotate_hide_premium', current_time('timestamp'));
|
648 |
+
update_option('adrotate_hide_premium_2', current_time('timestamp'));
|
649 |
+
update_option('adrotate_hide_premium_3', current_time('timestamp'));
|
650 |
|
651 |
delete_option('adrotate_hide_banner');
|
652 |
}
|
758 |
function adrotate_clean_setup() {
|
759 |
global $wpdb, $adrotate_config;
|
760 |
|
761 |
+
$now = current_time('timestamp');
|
762 |
|
763 |
// Clean up Tracker data
|
764 |
$yesterday = $now - DAY_IN_SECONDS;
|
824 |
function adrotate_empty_trackerdata() {
|
825 |
global $wpdb;
|
826 |
|
827 |
+
$clicks = current_time('timestamp') - DAY_IN_SECONDS;
|
828 |
+
$impressions = current_time('timestamp') - HOUR_IN_SECONDS;
|
829 |
|
830 |
$wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_tracker` WHERE `timer` < {$impressions} AND `stat` = 'i';");
|
831 |
$wpdb->query("DELETE FROM `{$wpdb->prefix}adrotate_tracker` WHERE `timer` < {$clicks} AND `stat` = 'c';");
|
adrotate-statistics.php
CHANGED
@@ -346,7 +346,7 @@ function adrotate_prepare_advertiser_report($user, $ads) {
|
|
346 |
Since: 3.8.7.1
|
347 |
-------------------------------------------------------------*/
|
348 |
function adrotate_date_start($what) {
|
349 |
-
$now =
|
350 |
$string = gmdate('Y-m-d H:i:s', time());
|
351 |
preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches);
|
352 |
|
@@ -382,18 +382,6 @@ function adrotate_date_start($what) {
|
|
382 |
return $result;
|
383 |
}
|
384 |
|
385 |
-
/*-------------------------------------------------------------
|
386 |
-
Name: adrotate_now
|
387 |
-
|
388 |
-
Purpose: Get and return the localized UNIX time for "now"
|
389 |
-
Receive: -None-
|
390 |
-
Return: int
|
391 |
-
Since: 3.8.6.2
|
392 |
-
-------------------------------------------------------------*/
|
393 |
-
function adrotate_now() {
|
394 |
-
return time() + (get_option('gmt_offset') * HOUR_IN_SECONDS);
|
395 |
-
}
|
396 |
-
|
397 |
/*-------------------------------------------------------------
|
398 |
Name: adrotate_archive_stats
|
399 |
|
@@ -440,7 +428,7 @@ function adrotate_count_impression($ad, $group = 0, $blog_id = 0) {
|
|
440 |
global $wpdb, $adrotate_config;
|
441 |
|
442 |
if(($adrotate_config['enable_loggedin_impressions'] == 'Y' AND is_user_logged_in()) OR !is_user_logged_in()) {
|
443 |
-
$now =
|
444 |
$today = adrotate_date_start('day');
|
445 |
$remote_ip = adrotate_get_remote_ip();
|
446 |
|
@@ -522,7 +510,7 @@ function adrotate_click_callback() {
|
|
522 |
$remote_ip = adrotate_get_remote_ip();
|
523 |
|
524 |
if(adrotate_is_human() AND $remote_ip != "unknown" AND !empty($remote_ip)) {
|
525 |
-
$now =
|
526 |
$today = adrotate_date_start('day');
|
527 |
$click_timer = $now - $adrotate_config['click_timer'];
|
528 |
|
346 |
Since: 3.8.7.1
|
347 |
-------------------------------------------------------------*/
|
348 |
function adrotate_date_start($what) {
|
349 |
+
$now = current_time('timestamp');
|
350 |
$string = gmdate('Y-m-d H:i:s', time());
|
351 |
preg_match('#([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,2}) ([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})#', $string, $matches);
|
352 |
|
382 |
return $result;
|
383 |
}
|
384 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
385 |
/*-------------------------------------------------------------
|
386 |
Name: adrotate_archive_stats
|
387 |
|
428 |
global $wpdb, $adrotate_config;
|
429 |
|
430 |
if(($adrotate_config['enable_loggedin_impressions'] == 'Y' AND is_user_logged_in()) OR !is_user_logged_in()) {
|
431 |
+
$now = current_time('timestamp');
|
432 |
$today = adrotate_date_start('day');
|
433 |
$remote_ip = adrotate_get_remote_ip();
|
434 |
|
510 |
$remote_ip = adrotate_get_remote_ip();
|
511 |
|
512 |
if(adrotate_is_human() AND $remote_ip != "unknown" AND !empty($remote_ip)) {
|
513 |
+
$now = current_time('timestamp');
|
514 |
$today = adrotate_date_start('day');
|
515 |
$click_timer = $now - $adrotate_config['click_timer'];
|
516 |
|
adrotate.php
CHANGED
@@ -6,7 +6,7 @@ Author: Arnan de Gans
|
|
6 |
Author URI: https://www.arnan.me/?pk_campaign=adrotatefree&pk_keyword=plugin_info
|
7 |
Description: Monetise your website with adverts while keeping things simple. Start making money today!
|
8 |
Text Domain: adrotate
|
9 |
-
Version: 5.8.
|
10 |
License: GPLv3
|
11 |
*/
|
12 |
|
@@ -21,7 +21,7 @@ License: GPLv3
|
|
21 |
------------------------------------------------------------------------------------ */
|
22 |
|
23 |
/*--- AdRotate values ---------------------------------------*/
|
24 |
-
define("ADROTATE_DISPLAY", '5.8.
|
25 |
define("ADROTATE_VERSION", 399);
|
26 |
define("ADROTATE_DB_VERSION", 66);
|
27 |
$plugin_folder = plugin_dir_path(__FILE__);
|
@@ -176,7 +176,7 @@ function adrotate_manage() {
|
|
176 |
if(!is_numeric($status)) $status = 0;
|
177 |
if(!is_numeric($ad_edit_id)) $ad_edit_id = 0;
|
178 |
|
179 |
-
$now =
|
180 |
$today = adrotate_date_start('day');
|
181 |
$in2days = $now + 172800;
|
182 |
$in7days = $now + 604800;
|
@@ -312,7 +312,7 @@ function adrotate_manage_group() {
|
|
312 |
$monthend = mktime(0, 0, 0, $month+1, 0, $year);
|
313 |
|
314 |
$today = adrotate_date_start('day');
|
315 |
-
$now =
|
316 |
$today = adrotate_date_start('day');
|
317 |
$in2days = $now + 172800;
|
318 |
$in7days = $now + 604800;
|
@@ -351,7 +351,7 @@ function adrotate_manage_group() {
|
|
351 |
function adrotate_manage_schedules() {
|
352 |
global $wpdb, $adrotate_config;
|
353 |
|
354 |
-
$now =
|
355 |
$in2days = $now + 172800;
|
356 |
?>
|
357 |
<div class="wrap">
|
6 |
Author URI: https://www.arnan.me/?pk_campaign=adrotatefree&pk_keyword=plugin_info
|
7 |
Description: Monetise your website with adverts while keeping things simple. Start making money today!
|
8 |
Text Domain: adrotate
|
9 |
+
Version: 5.8.8
|
10 |
License: GPLv3
|
11 |
*/
|
12 |
|
21 |
------------------------------------------------------------------------------------ */
|
22 |
|
23 |
/*--- AdRotate values ---------------------------------------*/
|
24 |
+
define("ADROTATE_DISPLAY", '5.8.8');
|
25 |
define("ADROTATE_VERSION", 399);
|
26 |
define("ADROTATE_DB_VERSION", 66);
|
27 |
$plugin_folder = plugin_dir_path(__FILE__);
|
176 |
if(!is_numeric($status)) $status = 0;
|
177 |
if(!is_numeric($ad_edit_id)) $ad_edit_id = 0;
|
178 |
|
179 |
+
$now = current_time('timestamp');
|
180 |
$today = adrotate_date_start('day');
|
181 |
$in2days = $now + 172800;
|
182 |
$in7days = $now + 604800;
|
312 |
$monthend = mktime(0, 0, 0, $month+1, 0, $year);
|
313 |
|
314 |
$today = adrotate_date_start('day');
|
315 |
+
$now = current_time('timestamp');
|
316 |
$today = adrotate_date_start('day');
|
317 |
$in2days = $now + 172800;
|
318 |
$in7days = $now + 604800;
|
351 |
function adrotate_manage_schedules() {
|
352 |
global $wpdb, $adrotate_config;
|
353 |
|
354 |
+
$now = current_time('timestamp');
|
355 |
$in2days = $now + 172800;
|
356 |
?>
|
357 |
<div class="wrap">
|
language/adrotate.pot
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
msgid ""
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: AdRotate\n"
|
5 |
-
"POT-Creation-Date: 2020-
|
6 |
"PO-Revision-Date: 2019-09-20 12:05-0500\n"
|
7 |
"Last-Translator: Arnan de Gans <support@ajdg.solutions>\n"
|
8 |
"Language-Team: Arnan de Gans\n"
|
2 |
msgid ""
|
3 |
msgstr ""
|
4 |
"Project-Id-Version: AdRotate\n"
|
5 |
+
"POT-Creation-Date: 2020-09-07 15:36-0500\n"
|
6 |
"PO-Revision-Date: 2019-09-20 12:05-0500\n"
|
7 |
"Last-Translator: Arnan de Gans <support@ajdg.solutions>\n"
|
8 |
"Language-Team: Arnan de Gans\n"
|
library/goosebox.js
CHANGED
@@ -1,19 +1,20 @@
|
|
1 |
-
|
2 |
-
Popups that work
|
3 |
-
Version: 1.0
|
4 |
-
Original code: Arnan de Gans
|
5 |
-
Copyright:
|
6 |
-
|
|
|
|
|
|
|
|
|
|
|
7 |
jQuery(document).ready(function($) {
|
8 |
$('.goosebox').click(function() {
|
9 |
-
|
10 |
var left = (screen.width/2)-375;
|
11 |
-
var top = (screen.height/2)-
|
12 |
var NWin = window.open($(this).prop('href'), 'Spread the word', 'toolbar=no, location=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=750, height=550, top='+top+', left='+left);
|
13 |
-
|
14 |
-
if (window.focus) {
|
15 |
-
NWin.focus();
|
16 |
-
}
|
17 |
return false;
|
18 |
});
|
19 |
});
|
1 |
+
/*--------------------------------------//
|
2 |
+
Popups that work
|
3 |
+
Version: 1.0.1
|
4 |
+
Original code: Arnan de Gans
|
5 |
+
Copyright: (c) 2020 Arnan de Gans
|
6 |
+
//--------------------------------------//
|
7 |
+
Changelog:
|
8 |
+
//--------------------------------------//
|
9 |
+
7 sept 2020
|
10 |
+
* Adjusted top margin
|
11 |
+
//--------------------------------------*/
|
12 |
jQuery(document).ready(function($) {
|
13 |
$('.goosebox').click(function() {
|
|
|
14 |
var left = (screen.width/2)-375;
|
15 |
+
var top = (screen.height/2)-175;
|
16 |
var NWin = window.open($(this).prop('href'), 'Spread the word', 'toolbar=no, location=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=750, height=550, top='+top+', left='+left);
|
17 |
+
if (window.focus) { NWin.focus(); }
|
|
|
|
|
|
|
18 |
return false;
|
19 |
});
|
20 |
});
|
library/jquery.adrotate.clicktracker.js
CHANGED
@@ -3,7 +3,7 @@ Track clicks from special elements
|
|
3 |
Version: 1.1
|
4 |
Original code: Arnan de Gans
|
5 |
With help from: Fraser Munro
|
6 |
-
Copyright:
|
7 |
*/
|
8 |
(function($) {
|
9 |
$(document).ready(function() {
|
3 |
Version: 1.1
|
4 |
Original code: Arnan de Gans
|
5 |
With help from: Fraser Munro
|
6 |
+
Copyright: (c) 2020 Arnan de Gans
|
7 |
*/
|
8 |
(function($) {
|
9 |
$(document).ready(function() {
|
library/jquery.adrotate.datepicker.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Datepicker for exports and graphs
|
3 |
Version: 0.3
|
4 |
Original code: Arnan de Gans
|
5 |
-
Copyright:
|
6 |
*/
|
7 |
(function($) {
|
8 |
$(document).ready(function() {
|
2 |
Datepicker for exports and graphs
|
3 |
Version: 0.3
|
4 |
Original code: Arnan de Gans
|
5 |
+
Copyright: (c) 2020 Arnan de Gans
|
6 |
*/
|
7 |
(function($) {
|
8 |
$(document).ready(function() {
|
library/jquery.adrotate.dyngroup.js
CHANGED
@@ -3,7 +3,7 @@ Dynamic advert rotation for AdRotate
|
|
3 |
Version: 1.0.1
|
4 |
Original code: Arnan de Gans
|
5 |
With help from: Mathias Joergensen, Fraser Munro
|
6 |
-
Copyright:
|
7 |
== Settings ==
|
8 |
groupid : PHP Group ID [integer, defaults to 0]
|
9 |
speed : Time each slide is shown [integer: milliseconds, defaults to 3000]
|
3 |
Version: 1.0.1
|
4 |
Original code: Arnan de Gans
|
5 |
With help from: Mathias Joergensen, Fraser Munro
|
6 |
+
Copyright: (c) 2020 Arnan de Gans
|
7 |
== Settings ==
|
8 |
groupid : PHP Group ID [integer, defaults to 0]
|
9 |
speed : Time each slide is shown [integer: milliseconds, defaults to 3000]
|
library/jquery.adrotate.tablesorter.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
Tablesorter settings/directives
|
3 |
Version: 1.0.1
|
4 |
Original code: Tablesorter docs
|
5 |
-
Copyright:
|
6 |
*/
|
7 |
jQuery(function() {
|
8 |
jQuery("table.manage-ads-main").tablesorter({
|
2 |
Tablesorter settings/directives
|
3 |
Version: 1.0.1
|
4 |
Original code: Tablesorter docs
|
5 |
+
Copyright: (c) 2020 Arnan de Gans
|
6 |
*/
|
7 |
jQuery(function() {
|
8 |
jQuery("table.manage-ads-main").tablesorter({
|
library/jquery.tablesorter.min.js
CHANGED
@@ -1,4 +1,3 @@
|
|
1 |
-
|
2 |
(function($){$.extend({tablesorter:new
|
3 |
function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:true,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'/\.|\,/g',onRenderHeader:null,selectorHeaders:'thead th',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}if(table.tBodies.length==0)return;var rows=table.tBodies[0].rows;if(rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i<l;i++){var p=false;if($.metadata&&($($headers[i]).metadata()&&$($headers[i]).metadata().sorter)){p=getParserById($($headers[i]).metadata().sorter);}else if((table.config.headers[i]&&table.config.headers[i].sorter)){p=getParserById(table.config.headers[i].sorter);}if(!p){p=detectParserForColumn(table,rows,-1,i);}if(table.config.debug){parsersDebug+="column:"+i+" parser:"+p.id+"\n";}list.push(p);}}if(table.config.debug){log(parsersDebug);}return list;};function detectParserForColumn(table,rows,rowIndex,cellIndex){var l=parsers.length,node=false,nodeValue=false,keepLooking=true;while(nodeValue==''&&keepLooking){rowIndex++;if(rows[rowIndex]){node=getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex);nodeValue=trimAndGetNodeText(table.config,node);if(table.config.debug){log('Checking if value was empty on row:'+rowIndex);}}else{keepLooking=false;}}for(var i=1;i<l;i++){if(parsers[i].is(nodeValue,table,node)){return parsers[i];}}return parsers[0];}function getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex){return rows[rowIndex].cells[cellIndex];}function trimAndGetNodeText(config,node){return $.trim(getElementText(config,node));}function getParserById(name){var l=parsers.length;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==name.toLowerCase()){return parsers[i];}}return false;}function buildCache(table){if(table.config.debug){var cacheTime=new Date();}var totalRows=(table.tBodies[0]&&table.tBodies[0].rows.length)||0,totalCells=(table.tBodies[0].rows[0]&&table.tBodies[0].rows[0].cells.length)||0,parsers=table.config.parsers,cache={row:[],normalized:[]};for(var i=0;i<totalRows;++i){var c=$(table.tBodies[0].rows[i]),cols=[];if(c.hasClass(table.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue;}cache.row.push(c);for(var j=0;j<totalCells;++j){cols.push(parsers[j].format(getElementText(table.config,c[0].cells[j]),table,c[0].cells[j]));}cols.push(cache.normalized.length);cache.normalized.push(cols);cols=null;};if(table.config.debug){benchmark("Building cache for "+totalRows+" rows:",cacheTime);}return cache;};function getElementText(config,node){var text="";if(!node)return"";if(!config.supportsTextContent)config.supportsTextContent=node.textContent||false;if(config.textExtraction=="simple"){if(config.supportsTextContent){text=node.textContent;}else{if(node.childNodes[0]&&node.childNodes[0].hasChildNodes()){text=node.childNodes[0].innerHTML;}else{text=node.innerHTML;}}}else{if(typeof(config.textExtraction)=="function"){text=config.textExtraction(node);}else{text=$(node).text();}}return text;}function appendToTable(table,cache){if(table.config.debug){var appendTime=new Date()}var c=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=(n[0].length-1),tableBody=$(table.tBodies[0]),rows=[];for(var i=0;i<totalRows;i++){var pos=n[i][checkCell];rows.push(r[pos]);if(!table.config.appender){var l=r[pos].length;for(var j=0;j<l;j++){tableBody[0].appendChild(r[pos][j]);}}}if(table.config.appender){table.config.appender(table,rows);}rows=null;if(table.config.debug){benchmark("Rebuilt table:",appendTime);}applyWidget(table);setTimeout(function(){$(table).trigger("sortEnd");},0);};function buildHeaders(table){if(table.config.debug){var time=new Date();}var meta=($.metadata)?true:false;var header_index=computeTableHeaderCellIndexes(table);$tableHeaders=$(table.config.selectorHeaders,table).each(function(index){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(table.config.sortInitialOrder);this.count=this.order;if(checkHeaderMetadata(this)||checkHeaderOptions(table,index))this.sortDisabled=true;if(checkHeaderOptionsSortingLocked(table,index))this.order=this.lockedOrder=checkHeaderOptionsSortingLocked(table,index);if(!this.sortDisabled){var $th=$(this).addClass(table.config.cssHeader);if(table.config.onRenderHeader)table.config.onRenderHeader.apply($th);}table.config.headerList[index]=this;});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders);}return $tableHeaders;};function computeTableHeaderCellIndexes(t){var matrix=[];var lookup={};var thead=t.getElementsByTagName('THEAD')[0];var trs=thead.getElementsByTagName('TR');for(var i=0;i<trs.length;i++){var cells=trs[i].cells;for(var j=0;j<cells.length;j++){var c=cells[j];var rowIndex=c.parentNode.rowIndex;var cellId=rowIndex+"-"+c.cellIndex;var rowSpan=c.rowSpan||1;var colSpan=c.colSpan||1
|
4 |
var firstAvailCol;if(typeof(matrix[rowIndex])=="undefined"){matrix[rowIndex]=[];}for(var k=0;k<matrix[rowIndex].length+1;k++){if(typeof(matrix[rowIndex][k])=="undefined"){firstAvailCol=k;break;}}lookup[cellId]=firstAvailCol;for(var k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof(matrix[k])=="undefined"){matrix[k]=[];}var matrixrow=matrix[k];for(var l=firstAvailCol;l<firstAvailCol+colSpan;l++){matrixrow[l]="x";}}}}return lookup;}function checkCellColSpan(table,rows,row){var arr=[],r=table.tHead.rows,c=r[row].cells;for(var i=0;i<c.length;i++){var cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function checkHeaderOptionsSortingLocked(table,i){if((table.config.headers[i])&&(table.config.headers[i].lockedOrder))return table.config.headers[i].lockedOrder;return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i<l;i++){getWidgetById(c[i]).format(table);}}function getWidgetById(name){var l=widgets.length;for(var i=0;i<l;i++){if(widgets[i].id.toLowerCase()==name.toLowerCase()){return widgets[i];}}};function formatSortingOrder(v){if(typeof(v)!="Number"){return(v.toLowerCase()=="desc")?1:0;}else{return(v==1)?1:0;}}function isValueInArray(v,a){var l=a.length;for(var i=0;i<l;i++){if(a[i][0]==v){return true;}}return false;}function setHeadersCss(table,$headers,list,css){$headers.removeClass(css[0]).removeClass(css[1]);var h=[];$headers.each(function(offset){if(!this.sortDisabled){h[this.column]=$(this);}});var l=list.length;for(var i=0;i<l;i++){h[list[i][0]].addClass(css[list[i][1]]);}}function fixColumnWidth(table,$headers){var c=table.config;if(c.widthFixed){var colgroup=$('<colgroup>');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('<col>').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i<l;i++){var s=sortList[i],o=c.headerList[s[0]];o.count=s[1];o.count++;}}function multisort(table,sortList,cache){if(table.config.debug){var sortTime=new Date();}var dynamicExp="var sortWrapper = function(a,b) {",l=sortList.length;for(var i=0;i<l;i++){var c=sortList[i][0];var order=sortList[i][1];var s=(table.config.parsers[c].type=="text")?((order==0)?makeSortFunction("text","asc",c):makeSortFunction("text","desc",c)):((order==0)?makeSortFunction("numeric","asc",c):makeSortFunction("numeric","desc",c));var e="e"+i;dynamicExp+="var "+e+" = "+s;dynamicExp+="if("+e+") { return "+e+"; } ";dynamicExp+="else { ";}var orgOrderCol=cache.normalized[0].length-1;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(var i=0;i<l;i++){dynamicExp+="}; ";}dynamicExp+="return 0; ";dynamicExp+="}; ";if(table.config.debug){benchmark("Evaling expression:"+dynamicExp,new Date());}eval(dynamicExp);cache.normalized.sort(sortWrapper);if(table.config.debug){benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime);}return cache;};function makeSortFunction(type,direction,index){var a="a["+index+"]",b="b["+index+"]";if(type=='text'&&direction=='asc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+a+" < "+b+") ? -1 : 1 )));";}else if(type=='text'&&direction=='desc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+b+" < "+a+") ? -1 : 1 )));";}else if(type=='numeric'&&direction=='asc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+a+" - "+b+"));";}else if(type=='numeric'&&direction=='desc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+b+" - "+a+"));";}};function makeSortText(i){return"((a["+i+"] < b["+i+"]) ? -1 : ((a["+i+"] > b["+i+"]) ? 1 : 0));";};function makeSortTextDesc(i){return"((b["+i+"] < a["+i+"]) ? -1 : ((b["+i+"] > a["+i+"]) ? 1 : 0));";};function makeSortNumeric(i){return"a["+i+"]-b["+i+"];";};function makeSortNumericDesc(i){return"b["+i+"]-a["+i+"];";};function sortText(a,b){if(table.config.sortLocaleCompare)return a.localeCompare(b);return((a<b)?-1:((a>b)?1:0));};function sortTextDesc(a,b){if(table.config.sortLocaleCompare)return b.localeCompare(a);return((b<a)?-1:((b>a)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$.data(this,"tablesorter",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){$this.trigger("sortStart");var $cell=$(this);var i=this.column;this.order=this.count++%2;if(this.lockedOrder)this.order=this.lockedOrder;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j<a.length;j++){if(a[j][0]!=i){config.sortList.push(a[j]);}}}config.sortList.push([i,this.order]);}else{if(isValueInArray(i,config.sortList)){for(var j=0;j<config.sortList.length;j++){var s=config.sortList[j],o=config.headerList[s[0]];if(s[0]==i){o.count=s[1];o.count++;s[1]=o.count%2;}}}else{config.sortList.push([i,this.order]);}};setTimeout(function(){setHeadersCss($this[0],$headers,config.sortList,sortCSS);appendToTable($this[0],multisort($this[0],config.sortList,cache));},1);return false;}}).mousedown(function(){if(config.cancelSelection){this.onselectstart=function(){return false};return false;}});$this.bind("update",function(){var me=this;setTimeout(function(){me.config.parsers=buildParserCache(me,$headers);cache=buildCache(me);},1);}).bind("updateCell",function(e,cell){var config=this.config;var pos=[(cell.parentNode.rowIndex-1),cell.cellIndex];cache.normalized[pos[0]][pos[1]]=config.parsers[pos[1]].format(getElementText(config,cell),cell);}).bind("sorton",function(e,list){$(this).trigger("sortStart");config.sortList=list;var sortList=config.sortList;updateHeaderSortCount(this,sortList);setHeadersCss(this,$headers,sortList,sortCSS);appendToTable(this,multisort(this,sortList,cache));}).bind("appendCache",function(){appendToTable(this,cache);}).bind("applyWidgetId",function(e,id){getWidgetById(id).format(this);}).bind("applyWidgets",function(){applyWidget(this);});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){config.sortList=$(this).metadata().sortlist;}if(config.sortList.length>0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==parser.id.toLowerCase()){a=false;}}if(a){parsers.push(parser);};};this.addWidget=function(widget){widgets.push(widget);};this.formatFloat=function(s){var i=parseFloat(s);return(isNaN(i))?0:i;};this.formatInt=function(s){var i=parseInt(s);return(isNaN(i))?0:i;};this.isDigit=function(s,config){return/^[-+]?\d*$/.test($.trim(s.replace(/[,.']/g,'')));};this.clearTableBody=function(table){if($.browser.msie){function empty(){while(this.firstChild)this.removeChild(this.firstChild);}empty.apply(table.tBodies[0]);}else{table.tBodies[0].innerHTML="";}};}});$.fn.extend({tablesorter:$.tablesorter.construct});var ts=$.tablesorter;ts.addParser({id:"text",is:function(s){return true;},format:function(s){return $.trim(s.toLocaleLowerCase());},type:"text"});ts.addParser({id:"digit",is:function(s,table){var c=table.config;return $.tablesorter.isDigit(s,c);},format:function(s){return $.tablesorter.formatFloat(s);},type:"numeric"});ts.addParser({id:"currency",is:function(s){return/^[£$€?.]/.test(s);},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g),""));},type:"numeric"});ts.addParser({id:"ipAddress",is:function(s){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);},format:function(s){var a=s.split("."),r="",l=a.length;for(var i=0;i<l;i++){var item=a[i];if(item.length==2){r+="0"+item;}else{r+=item;}}return $.tablesorter.formatFloat(r);},type:"numeric"});ts.addParser({id:"url",is:function(s){return/^(https?|ftp|file):\/\/$/.test(s);},format:function(s){return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''));},type:"text"});ts.addParser({id:"isoDate",is:function(s){return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);},format:function(s){return $.tablesorter.formatFloat((s!="")?new Date(s.replace(new RegExp(/-/g),"/")).getTime():"0");},type:"numeric"});ts.addParser({id:"percent",is:function(s){return/\%$/.test($.trim(s));},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""));},type:"numeric"});ts.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"shortDate",is:function(s){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);},format:function(s,table){var c=table.config;s=s.replace(/\-/g,"/");if(c.dateFormat=="us"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2");}else if(c.dateFormat=="uk"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1");}else if(c.dateFormat=="dd/mm/yy"||c.dateFormat=="dd-mm-yy"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3");}return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"time",is:function(s){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime());},type:"numeric"});ts.addParser({id:"metadata",is:function(s){return false;},format:function(s,table,cell){var c=table.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(cell).metadata()[p];},type:"numeric"});ts.addWidget({id:"zebra",format:function(table){if(table.config.debug){var time=new Date();}var $tr,row=-1,odd;$("tr:visible",table.tBodies[0]).each(function(i){$tr=$(this);if(!$tr.hasClass(table.config.cssChildRow))row++;odd=(row%2==0);$tr.removeClass(table.config.widgetZebra.css[odd?0:1]).addClass(table.config.widgetZebra.css[odd?1:0])});if(table.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time);}}});})(jQuery);
|
|
|
1 |
(function($){$.extend({tablesorter:new
|
2 |
function(){var parsers=[],widgets=[];this.defaults={cssHeader:"header",cssAsc:"headerSortUp",cssDesc:"headerSortDown",cssChildRow:"expand-child",sortInitialOrder:"asc",sortMultiSortKey:"shiftKey",sortForce:null,sortAppend:null,sortLocaleCompare:true,textExtraction:"simple",parsers:{},widgets:[],widgetZebra:{css:["even","odd"]},headers:{},widthFixed:false,cancelSelection:true,sortList:[],headerList:[],dateFormat:"us",decimal:'/\.|\,/g',onRenderHeader:null,selectorHeaders:'thead th',debug:false};function benchmark(s,d){log(s+","+(new Date().getTime()-d.getTime())+"ms");}this.benchmark=benchmark;function log(s){if(typeof console!="undefined"&&typeof console.debug!="undefined"){console.log(s);}else{alert(s);}}function buildParserCache(table,$headers){if(table.config.debug){var parsersDebug="";}if(table.tBodies.length==0)return;var rows=table.tBodies[0].rows;if(rows[0]){var list=[],cells=rows[0].cells,l=cells.length;for(var i=0;i<l;i++){var p=false;if($.metadata&&($($headers[i]).metadata()&&$($headers[i]).metadata().sorter)){p=getParserById($($headers[i]).metadata().sorter);}else if((table.config.headers[i]&&table.config.headers[i].sorter)){p=getParserById(table.config.headers[i].sorter);}if(!p){p=detectParserForColumn(table,rows,-1,i);}if(table.config.debug){parsersDebug+="column:"+i+" parser:"+p.id+"\n";}list.push(p);}}if(table.config.debug){log(parsersDebug);}return list;};function detectParserForColumn(table,rows,rowIndex,cellIndex){var l=parsers.length,node=false,nodeValue=false,keepLooking=true;while(nodeValue==''&&keepLooking){rowIndex++;if(rows[rowIndex]){node=getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex);nodeValue=trimAndGetNodeText(table.config,node);if(table.config.debug){log('Checking if value was empty on row:'+rowIndex);}}else{keepLooking=false;}}for(var i=1;i<l;i++){if(parsers[i].is(nodeValue,table,node)){return parsers[i];}}return parsers[0];}function getNodeFromRowAndCellIndex(rows,rowIndex,cellIndex){return rows[rowIndex].cells[cellIndex];}function trimAndGetNodeText(config,node){return $.trim(getElementText(config,node));}function getParserById(name){var l=parsers.length;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==name.toLowerCase()){return parsers[i];}}return false;}function buildCache(table){if(table.config.debug){var cacheTime=new Date();}var totalRows=(table.tBodies[0]&&table.tBodies[0].rows.length)||0,totalCells=(table.tBodies[0].rows[0]&&table.tBodies[0].rows[0].cells.length)||0,parsers=table.config.parsers,cache={row:[],normalized:[]};for(var i=0;i<totalRows;++i){var c=$(table.tBodies[0].rows[i]),cols=[];if(c.hasClass(table.config.cssChildRow)){cache.row[cache.row.length-1]=cache.row[cache.row.length-1].add(c);continue;}cache.row.push(c);for(var j=0;j<totalCells;++j){cols.push(parsers[j].format(getElementText(table.config,c[0].cells[j]),table,c[0].cells[j]));}cols.push(cache.normalized.length);cache.normalized.push(cols);cols=null;};if(table.config.debug){benchmark("Building cache for "+totalRows+" rows:",cacheTime);}return cache;};function getElementText(config,node){var text="";if(!node)return"";if(!config.supportsTextContent)config.supportsTextContent=node.textContent||false;if(config.textExtraction=="simple"){if(config.supportsTextContent){text=node.textContent;}else{if(node.childNodes[0]&&node.childNodes[0].hasChildNodes()){text=node.childNodes[0].innerHTML;}else{text=node.innerHTML;}}}else{if(typeof(config.textExtraction)=="function"){text=config.textExtraction(node);}else{text=$(node).text();}}return text;}function appendToTable(table,cache){if(table.config.debug){var appendTime=new Date()}var c=cache,r=c.row,n=c.normalized,totalRows=n.length,checkCell=(n[0].length-1),tableBody=$(table.tBodies[0]),rows=[];for(var i=0;i<totalRows;i++){var pos=n[i][checkCell];rows.push(r[pos]);if(!table.config.appender){var l=r[pos].length;for(var j=0;j<l;j++){tableBody[0].appendChild(r[pos][j]);}}}if(table.config.appender){table.config.appender(table,rows);}rows=null;if(table.config.debug){benchmark("Rebuilt table:",appendTime);}applyWidget(table);setTimeout(function(){$(table).trigger("sortEnd");},0);};function buildHeaders(table){if(table.config.debug){var time=new Date();}var meta=($.metadata)?true:false;var header_index=computeTableHeaderCellIndexes(table);$tableHeaders=$(table.config.selectorHeaders,table).each(function(index){this.column=header_index[this.parentNode.rowIndex+"-"+this.cellIndex];this.order=formatSortingOrder(table.config.sortInitialOrder);this.count=this.order;if(checkHeaderMetadata(this)||checkHeaderOptions(table,index))this.sortDisabled=true;if(checkHeaderOptionsSortingLocked(table,index))this.order=this.lockedOrder=checkHeaderOptionsSortingLocked(table,index);if(!this.sortDisabled){var $th=$(this).addClass(table.config.cssHeader);if(table.config.onRenderHeader)table.config.onRenderHeader.apply($th);}table.config.headerList[index]=this;});if(table.config.debug){benchmark("Built headers:",time);log($tableHeaders);}return $tableHeaders;};function computeTableHeaderCellIndexes(t){var matrix=[];var lookup={};var thead=t.getElementsByTagName('THEAD')[0];var trs=thead.getElementsByTagName('TR');for(var i=0;i<trs.length;i++){var cells=trs[i].cells;for(var j=0;j<cells.length;j++){var c=cells[j];var rowIndex=c.parentNode.rowIndex;var cellId=rowIndex+"-"+c.cellIndex;var rowSpan=c.rowSpan||1;var colSpan=c.colSpan||1
|
3 |
var firstAvailCol;if(typeof(matrix[rowIndex])=="undefined"){matrix[rowIndex]=[];}for(var k=0;k<matrix[rowIndex].length+1;k++){if(typeof(matrix[rowIndex][k])=="undefined"){firstAvailCol=k;break;}}lookup[cellId]=firstAvailCol;for(var k=rowIndex;k<rowIndex+rowSpan;k++){if(typeof(matrix[k])=="undefined"){matrix[k]=[];}var matrixrow=matrix[k];for(var l=firstAvailCol;l<firstAvailCol+colSpan;l++){matrixrow[l]="x";}}}}return lookup;}function checkCellColSpan(table,rows,row){var arr=[],r=table.tHead.rows,c=r[row].cells;for(var i=0;i<c.length;i++){var cell=c[i];if(cell.colSpan>1){arr=arr.concat(checkCellColSpan(table,headerArr,row++));}else{if(table.tHead.length==1||(cell.rowSpan>1||!r[row+1])){arr.push(cell);}}}return arr;};function checkHeaderMetadata(cell){if(($.metadata)&&($(cell).metadata().sorter===false)){return true;};return false;}function checkHeaderOptions(table,i){if((table.config.headers[i])&&(table.config.headers[i].sorter===false)){return true;};return false;}function checkHeaderOptionsSortingLocked(table,i){if((table.config.headers[i])&&(table.config.headers[i].lockedOrder))return table.config.headers[i].lockedOrder;return false;}function applyWidget(table){var c=table.config.widgets;var l=c.length;for(var i=0;i<l;i++){getWidgetById(c[i]).format(table);}}function getWidgetById(name){var l=widgets.length;for(var i=0;i<l;i++){if(widgets[i].id.toLowerCase()==name.toLowerCase()){return widgets[i];}}};function formatSortingOrder(v){if(typeof(v)!="Number"){return(v.toLowerCase()=="desc")?1:0;}else{return(v==1)?1:0;}}function isValueInArray(v,a){var l=a.length;for(var i=0;i<l;i++){if(a[i][0]==v){return true;}}return false;}function setHeadersCss(table,$headers,list,css){$headers.removeClass(css[0]).removeClass(css[1]);var h=[];$headers.each(function(offset){if(!this.sortDisabled){h[this.column]=$(this);}});var l=list.length;for(var i=0;i<l;i++){h[list[i][0]].addClass(css[list[i][1]]);}}function fixColumnWidth(table,$headers){var c=table.config;if(c.widthFixed){var colgroup=$('<colgroup>');$("tr:first td",table.tBodies[0]).each(function(){colgroup.append($('<col>').css('width',$(this).width()));});$(table).prepend(colgroup);};}function updateHeaderSortCount(table,sortList){var c=table.config,l=sortList.length;for(var i=0;i<l;i++){var s=sortList[i],o=c.headerList[s[0]];o.count=s[1];o.count++;}}function multisort(table,sortList,cache){if(table.config.debug){var sortTime=new Date();}var dynamicExp="var sortWrapper = function(a,b) {",l=sortList.length;for(var i=0;i<l;i++){var c=sortList[i][0];var order=sortList[i][1];var s=(table.config.parsers[c].type=="text")?((order==0)?makeSortFunction("text","asc",c):makeSortFunction("text","desc",c)):((order==0)?makeSortFunction("numeric","asc",c):makeSortFunction("numeric","desc",c));var e="e"+i;dynamicExp+="var "+e+" = "+s;dynamicExp+="if("+e+") { return "+e+"; } ";dynamicExp+="else { ";}var orgOrderCol=cache.normalized[0].length-1;dynamicExp+="return a["+orgOrderCol+"]-b["+orgOrderCol+"];";for(var i=0;i<l;i++){dynamicExp+="}; ";}dynamicExp+="return 0; ";dynamicExp+="}; ";if(table.config.debug){benchmark("Evaling expression:"+dynamicExp,new Date());}eval(dynamicExp);cache.normalized.sort(sortWrapper);if(table.config.debug){benchmark("Sorting on "+sortList.toString()+" and dir "+order+" time:",sortTime);}return cache;};function makeSortFunction(type,direction,index){var a="a["+index+"]",b="b["+index+"]";if(type=='text'&&direction=='asc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+a+" < "+b+") ? -1 : 1 )));";}else if(type=='text'&&direction=='desc'){return"("+a+" == "+b+" ? 0 : ("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : ("+b+" < "+a+") ? -1 : 1 )));";}else if(type=='numeric'&&direction=='asc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+a+" - "+b+"));";}else if(type=='numeric'&&direction=='desc'){return"("+a+" === null && "+b+" === null) ? 0 :("+a+" === null ? Number.POSITIVE_INFINITY : ("+b+" === null ? Number.NEGATIVE_INFINITY : "+b+" - "+a+"));";}};function makeSortText(i){return"((a["+i+"] < b["+i+"]) ? -1 : ((a["+i+"] > b["+i+"]) ? 1 : 0));";};function makeSortTextDesc(i){return"((b["+i+"] < a["+i+"]) ? -1 : ((b["+i+"] > a["+i+"]) ? 1 : 0));";};function makeSortNumeric(i){return"a["+i+"]-b["+i+"];";};function makeSortNumericDesc(i){return"b["+i+"]-a["+i+"];";};function sortText(a,b){if(table.config.sortLocaleCompare)return a.localeCompare(b);return((a<b)?-1:((a>b)?1:0));};function sortTextDesc(a,b){if(table.config.sortLocaleCompare)return b.localeCompare(a);return((b<a)?-1:((b>a)?1:0));};function sortNumeric(a,b){return a-b;};function sortNumericDesc(a,b){return b-a;};function getCachedSortType(parsers,i){return parsers[i].type;};this.construct=function(settings){return this.each(function(){if(!this.tHead||!this.tBodies)return;var $this,$document,$headers,cache,config,shiftDown=0,sortOrder;this.config={};config=$.extend(this.config,$.tablesorter.defaults,settings);$this=$(this);$.data(this,"tablesorter",config);$headers=buildHeaders(this);this.config.parsers=buildParserCache(this,$headers);cache=buildCache(this);var sortCSS=[config.cssDesc,config.cssAsc];fixColumnWidth(this);$headers.click(function(e){var totalRows=($this[0].tBodies[0]&&$this[0].tBodies[0].rows.length)||0;if(!this.sortDisabled&&totalRows>0){$this.trigger("sortStart");var $cell=$(this);var i=this.column;this.order=this.count++%2;if(this.lockedOrder)this.order=this.lockedOrder;if(!e[config.sortMultiSortKey]){config.sortList=[];if(config.sortForce!=null){var a=config.sortForce;for(var j=0;j<a.length;j++){if(a[j][0]!=i){config.sortList.push(a[j]);}}}config.sortList.push([i,this.order]);}else{if(isValueInArray(i,config.sortList)){for(var j=0;j<config.sortList.length;j++){var s=config.sortList[j],o=config.headerList[s[0]];if(s[0]==i){o.count=s[1];o.count++;s[1]=o.count%2;}}}else{config.sortList.push([i,this.order]);}};setTimeout(function(){setHeadersCss($this[0],$headers,config.sortList,sortCSS);appendToTable($this[0],multisort($this[0],config.sortList,cache));},1);return false;}}).mousedown(function(){if(config.cancelSelection){this.onselectstart=function(){return false};return false;}});$this.bind("update",function(){var me=this;setTimeout(function(){me.config.parsers=buildParserCache(me,$headers);cache=buildCache(me);},1);}).bind("updateCell",function(e,cell){var config=this.config;var pos=[(cell.parentNode.rowIndex-1),cell.cellIndex];cache.normalized[pos[0]][pos[1]]=config.parsers[pos[1]].format(getElementText(config,cell),cell);}).bind("sorton",function(e,list){$(this).trigger("sortStart");config.sortList=list;var sortList=config.sortList;updateHeaderSortCount(this,sortList);setHeadersCss(this,$headers,sortList,sortCSS);appendToTable(this,multisort(this,sortList,cache));}).bind("appendCache",function(){appendToTable(this,cache);}).bind("applyWidgetId",function(e,id){getWidgetById(id).format(this);}).bind("applyWidgets",function(){applyWidget(this);});if($.metadata&&($(this).metadata()&&$(this).metadata().sortlist)){config.sortList=$(this).metadata().sortlist;}if(config.sortList.length>0){$this.trigger("sorton",[config.sortList]);}applyWidget(this);});};this.addParser=function(parser){var l=parsers.length,a=true;for(var i=0;i<l;i++){if(parsers[i].id.toLowerCase()==parser.id.toLowerCase()){a=false;}}if(a){parsers.push(parser);};};this.addWidget=function(widget){widgets.push(widget);};this.formatFloat=function(s){var i=parseFloat(s);return(isNaN(i))?0:i;};this.formatInt=function(s){var i=parseInt(s);return(isNaN(i))?0:i;};this.isDigit=function(s,config){return/^[-+]?\d*$/.test($.trim(s.replace(/[,.']/g,'')));};this.clearTableBody=function(table){if($.browser.msie){function empty(){while(this.firstChild)this.removeChild(this.firstChild);}empty.apply(table.tBodies[0]);}else{table.tBodies[0].innerHTML="";}};}});$.fn.extend({tablesorter:$.tablesorter.construct});var ts=$.tablesorter;ts.addParser({id:"text",is:function(s){return true;},format:function(s){return $.trim(s.toLocaleLowerCase());},type:"text"});ts.addParser({id:"digit",is:function(s,table){var c=table.config;return $.tablesorter.isDigit(s,c);},format:function(s){return $.tablesorter.formatFloat(s);},type:"numeric"});ts.addParser({id:"currency",is:function(s){return/^[£$€?.]/.test(s);},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/[£$€]/g),""));},type:"numeric"});ts.addParser({id:"ipAddress",is:function(s){return/^\d{2,3}[\.]\d{2,3}[\.]\d{2,3}[\.]\d{2,3}$/.test(s);},format:function(s){var a=s.split("."),r="",l=a.length;for(var i=0;i<l;i++){var item=a[i];if(item.length==2){r+="0"+item;}else{r+=item;}}return $.tablesorter.formatFloat(r);},type:"numeric"});ts.addParser({id:"url",is:function(s){return/^(https?|ftp|file):\/\/$/.test(s);},format:function(s){return jQuery.trim(s.replace(new RegExp(/(https?|ftp|file):\/\//),''));},type:"text"});ts.addParser({id:"isoDate",is:function(s){return/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/.test(s);},format:function(s){return $.tablesorter.formatFloat((s!="")?new Date(s.replace(new RegExp(/-/g),"/")).getTime():"0");},type:"numeric"});ts.addParser({id:"percent",is:function(s){return/\%$/.test($.trim(s));},format:function(s){return $.tablesorter.formatFloat(s.replace(new RegExp(/%/g),""));},type:"numeric"});ts.addParser({id:"usLongDate",is:function(s){return s.match(new RegExp(/^[A-Za-z]{3,10}\.? [0-9]{1,2}, ([0-9]{4}|'?[0-9]{2}) (([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(AM|PM)))$/));},format:function(s){return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"shortDate",is:function(s){return/\d{1,2}[\/\-]\d{1,2}[\/\-]\d{2,4}/.test(s);},format:function(s,table){var c=table.config;s=s.replace(/\-/g,"/");if(c.dateFormat=="us"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$1/$2");}else if(c.dateFormat=="uk"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{4})/,"$3/$2/$1");}else if(c.dateFormat=="dd/mm/yy"||c.dateFormat=="dd-mm-yy"){s=s.replace(/(\d{1,2})[\/\-](\d{1,2})[\/\-](\d{2})/,"$1/$2/$3");}return $.tablesorter.formatFloat(new Date(s).getTime());},type:"numeric"});ts.addParser({id:"time",is:function(s){return/^(([0-2]?[0-9]:[0-5][0-9])|([0-1]?[0-9]:[0-5][0-9]\s(am|pm)))$/.test(s);},format:function(s){return $.tablesorter.formatFloat(new Date("2000/01/01 "+s).getTime());},type:"numeric"});ts.addParser({id:"metadata",is:function(s){return false;},format:function(s,table,cell){var c=table.config,p=(!c.parserMetadataName)?'sortValue':c.parserMetadataName;return $(cell).metadata()[p];},type:"numeric"});ts.addWidget({id:"zebra",format:function(table){if(table.config.debug){var time=new Date();}var $tr,row=-1,odd;$("tr:visible",table.tBodies[0]).each(function(i){$tr=$(this);if(!$tr.hasClass(table.config.cssChildRow))row++;odd=(row%2==0);$tr.removeClass(table.config.widgetZebra.css[odd?0:1]).addClass(table.config.widgetZebra.css[odd?1:0])});if(table.config.debug){$.tablesorter.benchmark("Applying Zebra widget",time);}}});})(jQuery);
|
library/textatcursor.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
insert text at the position of the cursor in a HTML textarea
|
3 |
Version: 1.0
|
4 |
Original code: Arnan de Gans
|
5 |
-
Copyright:
|
6 |
*/
|
7 |
function textatcursor(areaId,text) {
|
8 |
var txtarea = document.getElementById(areaId);
|
2 |
insert text at the position of the cursor in a HTML textarea
|
3 |
Version: 1.0
|
4 |
Original code: Arnan de Gans
|
5 |
+
Copyright: (c) 2020 Arnan de Gans
|
6 |
*/
|
7 |
function textatcursor(areaId,text) {
|
8 |
var txtarea = document.getElementById(areaId);
|
library/uploader-hook.js
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
use the Media Uploader from WordPress
|
3 |
Version: 1.0
|
4 |
Original code: Arnan de Gans
|
5 |
-
Copyright:
|
6 |
*/
|
7 |
jQuery(document).ready(function(){
|
8 |
var custom_uploader;
|
2 |
use the Media Uploader from WordPress
|
3 |
Version: 1.0
|
4 |
Original code: Arnan de Gans
|
5 |
+
Copyright: (c) 2020 Arnan de Gans
|
6 |
*/
|
7 |
jQuery(document).ready(function(){
|
8 |
var custom_uploader;
|
readme.txt
CHANGED
@@ -5,10 +5,10 @@ Tags: adverts, ads, banners, advert manager, ad manager, banner manager, monetis
|
|
5 |
Requires at least: 4.6
|
6 |
Requires PHP: 5.6
|
7 |
Tested up to: 5.5
|
8 |
-
Stable tag: 5.8.
|
9 |
License: GPLv3
|
10 |
|
11 |
-
AdRotate is the only advert manager you'll ever need. Manage Google AdSense, Media.net, Amazon banners and more. Manage your ads.txt, widgets and many more powerful features to run successful campaigns.
|
12 |
|
13 |
== Description ==
|
14 |
|
@@ -64,6 +64,9 @@ For more detailed instructions check out the [installation steps](https://ajdg.s
|
|
64 |
|
65 |
For the full changelog check out the [development page](https://ajdg.solutions/support/adrotate-development/?pk_campaign=adrotatefree&pk_keyword=readme).
|
66 |
|
|
|
|
|
|
|
67 |
= AdRotate 5.8.7 =
|
68 |
* [i18n] Updated and rewritten Dutch translation to make more sense
|
69 |
|
@@ -90,7 +93,7 @@ Be a Pro and get [AdRotate Professional](https://ajdg.solutions/product-category
|
|
90 |
|
91 |
== Upgrade Notice ==
|
92 |
|
93 |
-
Enjoy this
|
94 |
|
95 |
== Frequently Asked Questions ==
|
96 |
|
5 |
Requires at least: 4.6
|
6 |
Requires PHP: 5.6
|
7 |
Tested up to: 5.5
|
8 |
+
Stable tag: 5.8.8
|
9 |
License: GPLv3
|
10 |
|
11 |
+
AdRotate is the only advert manager you'll ever need. Manage all your Google AdSense, Media.net, Amazon banners and more. Manage your ads.txt, widgets and many more powerful features to run successful campaigns.
|
12 |
|
13 |
== Description ==
|
14 |
|
64 |
|
65 |
For the full changelog check out the [development page](https://ajdg.solutions/support/adrotate-development/?pk_campaign=adrotatefree&pk_keyword=readme).
|
66 |
|
67 |
+
= AdRotate 5.8.8 =
|
68 |
+
* [fix] Replaced adrotate_now() with current_time('timestamp')
|
69 |
+
|
70 |
= AdRotate 5.8.7 =
|
71 |
* [i18n] Updated and rewritten Dutch translation to make more sense
|
72 |
|
93 |
|
94 |
== Upgrade Notice ==
|
95 |
|
96 |
+
Enjoy this update with the latest tweaks and improvements for AdRotate for WordPress!
|
97 |
|
98 |
== Frequently Asked Questions ==
|
99 |
|