index-uvym.php
7.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
<?php
require_once('./admin.php');
if ( ! current_user_can( 'manage_options' ) )
wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
$title = __('General Settings');
$parent_file = 'options-general.php';
/* translators: date and time format for exact current time, mainly about timezones, see http://php.net/date */
$timezone_format = _x('Y-m-d G:i:s', 'timezone date format');
/**
* Display JavaScript on the page.
*
* @since 3.5.0
*/
function options_general_add_js() {
?>
<script type="text/javascript">
//<![CDATA[
jQuery(document).ready(function($){
$("input[name='date_format']").click(function(){
if ( "date_format_custom_radio" != $(this).attr("id") )
$("input[name='date_format_custom']").val( $(this).val() ).siblings('.example').text( $(this).siblings('span').text() );
});
$("input[name='date_format_custom']").focus(function(){
$("#date_format_custom_radio").attr("checked", "checked");
});
$("input[name='time_format']").click(function(){
if ( "time_format_custom_radio" != $(this).attr("id") )
$("input[name='time_format_custom']").val( $(this).val() ).siblings('.example').text( $(this).siblings('span').text() );
});
$("input[name='time_format_custom']").focus(function(){
$("#time_format_custom_radio").attr("checked", "checked");
});
$("input[name='date_format_custom'], input[name='time_format_custom']").change( function() {
var format = $(this);
format.siblings('.spinner').css('display', 'inline-block'); // show(); can't be used here
$.post(ajaxurl, {
action: 'date_format_custom' == format.attr('name') ? 'date_format' : 'time_format',
date : format.val()
}, function(d) { format.siblings('.spinner').hide(); format.siblings('.example').text(d); } );
});
});
//]]>
</script>
<?php
}
add_action('admin_head', 'options_general_add_js');
include('./admin-header.php');
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>全球搜-受访页面</title>
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no">
<meta name="format-detection" content="telephone=no">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<link rel="stylesheet" href="//www.quanqiusou.cn/admin40/base.css">
<link rel="stylesheet" href="//www.quanqiusou.cn/admin40/global.css">
<link rel="stylesheet" href="//www.quanqiusou.cn/admin40/skin.css">
<!--[if lt IE 9]>
<script src="//www.quanqiusou.cn/admin40/js/html5.js"></script>
<script src="//www.quanqiusou.cn/admin40/js/respond.js"></script>
<![endif]-->
</head>
<body class="body-loading">
<div class="gd-wrap">
<?php
$stats_setting = get_option('stats_settings');
$StartMonth = $stats_setting['month_start']."-01";
$EndMonth = date('Y-m-01');
$ToStartMonth = strtotime( $StartMonth ); //转换一下
$ToEndMonth = strtotime( $EndMonth ); //一样转换一下
$i = false; //开始标示
$month_str = '';
while( $ToEndMonth > $ToStartMonth) {
$NewMonth = !$i ? date('Y-m', strtotime('+0 Month', $ToEndMonth)) : date('Y-m', strtotime('-1 Month', $ToEndMonth));
$ToEndMonth = strtotime( $NewMonth );
$i = true;
$month_str .= $NewMonth.",";
?>
<section class="view-report-item referrals-report-item">
<aside class="report-item-side">
<div class="gd-panel">
<header class="gd-panel-hd">
<h2 class="panel-hd-tit"><span class="moth_<?php echo $NewMonth;?>_moth"></span>份数据统计</h2>
</header>
<div class="gd-panel-bd">
<div class="view-count-info view-count-page">
<ul>
<li>
<div class="count-label">共计浏览量</div>
<div class="count-num"><span class="num-value" id="moth_<?php echo $NewMonth;?>_pv">0</span><i>PV</i></div>
</li>
<li>
<div class="count-label">共计访客量</div>
<div class="count-num"><span class="num-value" id="moth_<?php echo $NewMonth;?>_ip">0</span><i>IP</i></div>
</li>
</ul>
</div>
<div class="state-count-txt">
<h4>受访页面TOP15</h4>
<ul class="referrals-list" id="country_top10_<?php echo $NewMonth;?>" ></ul>
</div>
</div>
</div>
</aside>
<div class="report-item-main">
<div class="item-main-in">
<div class="gd-panel">
<header class="gd-panel-hd">
<h2 class="panel-hd-tit"><span class="moth_<?php echo $NewMonth;?>_moth"></span>数据统计</h2>
</header>
<div class="gd-panel-bd">
<div class="chart-box">
<div class="referrals-report-chart" id="referrals-report-chart-<?php echo $NewMonth;?>"></div>
</div>
</div>
</div>
</div>
</div>
</section>
<?php }?>
<input type="hidden" id="month_str" value="<?php echo rtrim($month_str,',')?>">
<!-- <input type="hidden" id="month_str" value="2018-04,2018-03,2018-02,2018-01"> -->
<script src="//www.quanqiusou.cn/admin40/js/jquery.min.js"></script>
<script src="//www.quanqiusou.cn/admin40/js/fastclick.js"></script>
<script src="//www.quanqiusou.cn/admin40/js/base.js"></script>
<!-- 生成图表 -->
<script src="//www.quanqiusou.cn/admin40/js/highcharts.js"></script>
<script type="text/javascript">
$(function () {
var months = $('#month_str').val();
var month_arr = months.split(',');
$.each(month_arr, function(k,item_month){
var arr = new Array();
$.get("/wp-admin/admin-ajax.php", { "action": "stats_data_uvym", month :item_month},
function(data){
$('.moth_'+item_month+'_moth').html(data.moth_moth);
$('#moth_'+item_month+'_pv').html(data.moth_pv);
$('#moth_'+item_month+'_ip').html(data.moth_ip);
var country_top10_html = '';
$.each(data.referrer_top15_area, function(i,item){
country_top10_html +="<li><a target='_blank' href='"+item['request']+"'>"+item['request']+"</a></li>";
arr[i] = new Array(i);
arr[i][0] = item['request'].substring(0,50);
arr[i][1] = parseInt(item['num_request']);
console.log(item['request'])
});
$('#country_top10_'+item_month).html(country_top10_html);
$('#referrals-report-chart-'+item_month).highcharts({
chart: {
plotBackgroundColor: null,
plotBorderWidth: null,
plotShadow: false
},
colors: ['#188ae2', '#3ab74c', '#ff7373', '#DDDF00',
'#24CBE5', '#64E572', '#FF9655', '#FFF263', '#6AF9C4','#82a6f5',
'#9ff048','#f1aaa6','#c09eff','#82d0f5']
,
title: {
text: ''
},
tooltip: {
headerFormat: '',
pointFormat: '{point.name}: <span class="point-value">{point.percentage:.1f}%</span>'
},
plotOptions: {
pie: {
allowPointSelect: true,
cursor: 'pointer',
dataLabels: {
enabled: true,
format: '<span class="point-label">{point.name}</span>, {point.percentage:.1f} %',
style: {
color: '#666',
fontSize: "12px",
fontWeight: "normal"
}
}
}
},
series: [{
type: 'pie',
name: '',
// 数据
data: arr
}]
});
}, "json");
})
});
</script>
</div>
</body>
</html>