forked from joseconti/WangGuard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwangguard-stats.php
More file actions
48 lines (48 loc) · 2.2 KB
/
wangguard-stats.php
File metadata and controls
48 lines (48 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
//WangGuard Wizard
function wangguard_stats() {
global $wpdb,$wangguard_nonce, $wangguard_api_key;
if ( defined('WANGGUARD_API_HOST') ) {$wangguard_api_host = WANGGUARD_API_HOST;}
if ( defined('WANGGUARD_REST_PATH') ) {$wangguard_rest_path = WANGGUARD_REST_PATH;}
if ( !current_user_can('level_10') )
die(__('Cheatin’ uh?', 'wangguard'));
$lang = substr(WPLANG, 0,2);
?>
<div class="wrap" id="wangguard-stats-cont">
<div class="wangguard-confico"><img src="<?php echo WP_PLUGIN_URL ?>/wangguard/img/stats.png" alt="<?php echo htmlentities(__('WangGuard Stats', 'wangguard')) ?>" /></div>
<div class="icon32" id="icon-wangguard"><br></div>
<h2><?php _e('WangGuard Stats', 'wangguard'); ?></h2>
<script type="text/javascript">
jQuery(document).ready(function () {
var WGURL = "http://<?php echo $wangguard_api_host . $wangguard_rest_path?>";
var WGstatsLast7URL = WGURL + "get-stat.php?wg="+ encodeURIComponent('<in><apikey><?php echo $wangguard_api_key?></apikey><last7>1</last7><lang><?php echo $lang?></lang></in>');
var WGstatsLast30URL = WGURL + "get-stat.php?wg="+ encodeURIComponent('<in><apikey><?php echo $wangguard_api_key?></apikey><last30>1</last30><lang><?php echo $lang?></lang></in>');
var WGstatsLast6URL = WGURL + "get-stat.php?wg="+ encodeURIComponent('<in><apikey><?php echo $wangguard_api_key?></apikey><last6>1</last6><lang><?php echo $lang?></lang></in>');
jQuery.ajax({
dataType: "jsonp",
url: WGstatsLast30URL,
jsonpCallback: "callback",
success: function (data) {
jQuery("#wangguard-stats-last30-container").wijbarchart(data);
jQuery.ajax({
dataType: "jsonp",
url: WGstatsLast6URL,
jsonpCallback: "callback",
success: function (data) {
jQuery("#wangguard-stats-last6-container").wijbarchart(data);
}
});
}
});
});
</script>
<div id="wangguard-stats-container">
<h2><?php _e( 'Last 30 days' , 'wangguard' )?></h2>
<div id="wangguard-stats-last30-container" class="ui-widget ui-widget-content ui-corner-all"></div>
<h2><?php _e( 'Last 6 months' , 'wangguard' )?></h2>
<div id="wangguard-stats-last6-container" class="ui-widget ui-widget-content ui-corner-all"></div>
</div>
</div>
<?php
}
?>