@@ -33,8 +33,6 @@ class="<?php posts_and_users_stats_echo_tab_class( $selected_tab == $tab_slug );
33
33
</h2>
34
34
35
35
<?php if ( $ selected_tab == 'date ' ) {
36
- global $ wpdb ;
37
-
38
36
// Get the selected post type.
39
37
if ( isset ( $ _POST ['type ' ] ) && in_array ( $ _POST ['type ' ], $ post_types ) ) {
40
38
$ selected_post_type = $ _POST ['type ' ];
@@ -53,22 +51,29 @@ class="<?php posts_and_users_stats_echo_tab_class( $selected_tab == $tab_slug );
53
51
$ selected_post_type_name = $ selected_post_type_object ->label ;
54
52
}
55
53
54
+ global $ wpdb ;
56
55
$ posts_per_date = $ wpdb ->get_results (
57
56
"SELECT DATE(post_date) as date, count(ID) as count
58
57
FROM {$ wpdb ->posts }
59
58
WHERE post_status = 'publish' " . $ post_type_query .
60
- "GROUP BY date " , OBJECT_K );
59
+ "GROUP BY date " ,
60
+ OBJECT_K
61
+ );
61
62
$ posts_per_month = $ wpdb ->get_results (
62
63
"SELECT DATE_FORMAT(post_date, '%Y-%m') as month, count(ID) as count
63
64
FROM {$ wpdb ->posts }
64
65
WHERE post_status = 'publish' " . $ post_type_query .
65
- "GROUP BY month " , OBJECT_K );
66
+ "GROUP BY month " ,
67
+ OBJECT_K
68
+ );
66
69
$ posts_per_year = $ wpdb ->get_results (
67
70
"SELECT YEAR(post_date) as year, count(ID) as count
68
71
FROM {$ wpdb ->posts }
69
72
WHERE post_status = 'publish' " . $ post_type_query .
70
73
"GROUP BY year
71
- ORDER BY year DESC " , OBJECT_K );
74
+ ORDER BY year DESC " ,
75
+ OBJECT_K
76
+ );
72
77
73
78
$ per_date_string = sprintf ( __ ( '%s per Date ' , 'posts-and-users-stats ' ), $ selected_post_type_name );
74
79
$ per_month_string = sprintf ( __ ( '%s per Month ' , 'posts-and-users-stats ' ), $ selected_post_type_name );
@@ -87,7 +92,7 @@ class="<?php posts_and_users_stats_echo_tab_class( $selected_tab == $tab_slug );
87
92
</form>
88
93
<nav>
89
94
<?php if ( !is_array ( $ posts_per_date ) || sizeof ( $ posts_per_date ) <= 0 ) { ?>
90
- <p><?php echo $ selected_post_type_labels ->not_found ?>
95
+ <p><?php echo $ selected_post_type_labels ->not_found ; ?>
91
96
<?php } else { ?>
92
97
<ul>
93
98
<li><a href="#monthly"><?php echo $ per_month_string ; ?> </a>
@@ -131,14 +136,14 @@ class="<?php posts_and_users_stats_echo_tab_class( $selected_tab == $tab_slug );
131
136
series: [ {
132
137
name: '<?php _e ( 'Posts ' , 'posts-and-users-stats ' ); ?> ',
133
138
data: [ <?php foreach ( $ posts_per_month as $ posts_of_month ) {
134
- $ date = strtotime ( $ posts_of_month ->month . '-01 ' );
135
- $ year = date ( 'Y ' , $ date );
136
- $ month = date ( 'm ' , $ date );
137
- echo '[Date.UTC( ' . $ year . ', ' . ( $ month - 1 ) . ',1), ' . $ posts_of_month ->count . '], ' ;
138
- } ?> ]
139
+ $ date = strtotime ( $ posts_of_month ->month . '-01 ' );
140
+ $ year = date ( 'Y ' , $ date );
141
+ $ month = date ( 'm ' , $ date );
142
+ echo '[Date.UTC( ' . $ year . ', ' . ( $ month - 1 ) . ',1), ' . $ posts_of_month ->count . '], ' ;
143
+ } ?> ]
139
144
} ],
140
145
credits: {
141
- enabled: false
146
+ enabled: false
142
147
},
143
148
exporting: {
144
149
filename: '<?php echo posts_and_users_stats_get_export_file_name ( $ per_month_string ); ?> '
@@ -185,12 +190,12 @@ class="<?php posts_and_users_stats_echo_tab_class( $selected_tab == $tab_slug );
185
190
series: [ {
186
191
name: '<?php _e ( 'Posts ' , 'posts-and-users-stats ' ); ?> ',
187
192
data: [ <?php foreach ( $ posts_per_date as $ posts_of_date ) {
188
- $ date = strtotime ( $ posts_of_date ->date );
189
- $ year = date ( 'Y ' , $ date );
190
- $ month = date ( 'm ' , $ date );
191
- $ day = date ( 'd ' , $ date );
192
- echo '[Date.UTC( ' . $ year . ', ' . ( $ month - 1 ) . ', ' . $ day .'), ' . $ posts_of_date ->count . '], ' ;
193
- } ?> ]
193
+ $ date = strtotime ( $ posts_of_date ->date );
194
+ $ year = date ( 'Y ' , $ date );
195
+ $ month = date ( 'm ' , $ date );
196
+ $ day = date ( 'd ' , $ date );
197
+ echo '[Date.UTC( ' . $ year . ', ' . ( $ month - 1 ) . ', ' . $ day .'), ' . $ posts_of_date ->count . '], ' ;
198
+ } ?> ]
194
199
} ],
195
200
credits: {
196
201
enabled: false
@@ -225,8 +230,8 @@ class="<?php posts_and_users_stats_echo_tab_class( $selected_tab == $tab_slug );
225
230
<?php foreach ( range ( 1 , 12 , 1 ) as $ month ) { ?>
226
231
<td class="number"><?php
227
232
$ date = date ('Y-m ' , strtotime ( $ year . '- ' . $ month . '-1 ' ) );
228
- if ( array_key_exists ( $ date , $ posts_per_month ) ) {
229
- posts_and_users_stats_echo_link ( get_month_link ( $ year , $ month ), $ posts_per_month [$ date ]->count );
233
+ if ( array_key_exists ( $ date , $ posts_per_month ) ) {
234
+ posts_and_users_stats_echo_link ( get_month_link ( $ year , $ month ), $ posts_per_month [ $ date ]->count );
230
235
} else {
231
236
echo 0 ;
232
237
} ?> </td>
@@ -264,7 +269,7 @@ class="<?php posts_and_users_stats_echo_tab_class( $selected_tab == $tab_slug );
264
269
if ( checkdate ( $ month , $ day , $ year ) ) {
265
270
$ date = date ('Y-m-d ' , strtotime ( $ year . '- ' . $ month . '- ' . $ day ) );
266
271
if ( array_key_exists ( $ date , $ posts_per_date ) ) {
267
- posts_and_users_stats_echo_link ( get_day_link ( $ year , $ month , $ day ), $ posts_per_date [$ date ]->count );
272
+ posts_and_users_stats_echo_link ( get_day_link ( $ year , $ month , $ day ), $ posts_per_date [ $ date ]->count );
268
273
} else {
269
274
echo 0 ;
270
275
}
@@ -279,8 +284,8 @@ class="<?php posts_and_users_stats_echo_tab_class( $selected_tab == $tab_slug );
279
284
<?php foreach ( range ( 1 , 12 , 1 ) as $ month ) { ?>
280
285
<td class="number"><strong><?php
281
286
$ date = date ('Y-m ' , strtotime ( $ year . '- ' . $ month . '-1 ' ) );
282
- if ( array_key_exists ( $ date , $ posts_per_month ) ) {
283
- posts_and_users_stats_echo_link ( get_month_link ( $ year , $ month ), $ posts_per_month [$ date ]->count );
287
+ if ( array_key_exists ( $ date , $ posts_per_month ) ) {
288
+ posts_and_users_stats_echo_link ( get_month_link ( $ year , $ month ), $ posts_per_month [ $ date ]->count );
284
289
} else {
285
290
echo 0 ;
286
291
} ?> </strong></td>
@@ -333,7 +338,7 @@ class="<?php posts_and_users_stats_echo_tab_class( $selected_tab == $tab_slug );
333
338
categories: [
334
339
<?php foreach ( $ terms as $ term ) {
335
340
echo "' " . $ term ->name . "', " ;
336
- }?> ],
341
+ } ?> ],
337
342
},
338
343
yAxis: {
339
344
title: {
@@ -347,8 +352,8 @@ class="<?php posts_and_users_stats_echo_tab_class( $selected_tab == $tab_slug );
347
352
series: [ {
348
353
name: '<?php _e ( 'Posts ' , 'posts-and-users-stats ' ); ?> ',
349
354
data: [ <?php foreach ( $ terms as $ term ) {
350
- echo $ term ->count . ', ' ;
351
- } ?> ]
355
+ echo $ term ->count . ', ' ;
356
+ } ?> ]
352
357
} ],
353
358
credits: {
354
359
enabled: false
@@ -431,7 +436,7 @@ class="<?php posts_and_users_stats_echo_tab_class( $selected_tab == $tab_slug );
431
436
text: '<?php echo get_bloginfo ( 'name ' ); ?> '
432
437
},
433
438
xAxis: {
434
- categories: [
439
+ categories: [
435
440
<?php foreach ( $ posts_per_author as $ author ) {
436
441
echo "' " . $ author ['name ' ] . "', " ;
437
442
}?> ],
@@ -448,11 +453,11 @@ class="<?php posts_and_users_stats_echo_tab_class( $selected_tab == $tab_slug );
448
453
series: [ {
449
454
name: 'all',
450
455
data: [ <?php foreach ( $ posts_per_author as $ author ) {
451
- echo $ author ['total ' ] . ', ' ;
452
- } ?> ]
456
+ echo $ author ['total ' ] . ', ' ;
457
+ } ?> ]
453
458
} ],
454
459
credits: {
455
- enabled: false
460
+ enabled: false
456
461
},
457
462
exporting: {
458
463
filename: '<?php echo posts_and_users_stats_get_export_file_name ( __ ('Posts per Author ' , 'posts-and-users-stats ' ) ); ?> '
@@ -473,10 +478,10 @@ class="<?php posts_and_users_stats_echo_tab_class( $selected_tab == $tab_slug );
473
478
xAxis: {
474
479
categories: [
475
480
<?php foreach ( $ posts_per_type as $ type => $ count ) {
476
- if ( $ type != 'total ' && $ count > 0 ) {
481
+ if ( $ type != 'total ' && $ count > 0 ) {
477
482
echo "' " . $ type . "', " ;
478
483
}
479
- }?> ],
484
+ } ?> ],
480
485
},
481
486
yAxis: {
482
487
title: {
@@ -490,10 +495,10 @@ class="<?php posts_and_users_stats_echo_tab_class( $selected_tab == $tab_slug );
490
495
series: [ {
491
496
name: 'all',
492
497
data: [ <?php foreach ( $ posts_per_type as $ type => $ count ) {
493
- if ( $ type != 'total ' && $ count > 0 ) {
494
- echo $ count . ', ' ;
495
- }
496
- } ?> ]
498
+ if ( $ type != 'total ' && $ count > 0 ) {
499
+ echo $ count . ', ' ;
500
+ }
501
+ } ?> ]
497
502
} ],
498
503
credits: {
499
504
enabled: false
@@ -529,7 +534,7 @@ class="<?php posts_and_users_stats_echo_tab_class( $selected_tab == $tab_slug );
529
534
<td class="number"><?php if ( $ post_type == 'post ' ) {
530
535
posts_and_users_stats_echo_link ( get_author_posts_url ( $ author ['ID ' ] ), $ author ['post ' ] );
531
536
} else {
532
- echo $ author [$ post_type ];
537
+ echo $ author [ $ post_type ];
533
538
} ?> </td>
534
539
<?php } ?>
535
540
<td class="number"><strong><?php echo $ author ['total ' ]; ?> </strong></td>
@@ -542,7 +547,7 @@ class="<?php posts_and_users_stats_echo_tab_class( $selected_tab == $tab_slug );
542
547
<?php } ?>
543
548
</tr>
544
549
</tbody>
545
- </table>
550
+ </table>
546
551
</section>
547
552
548
553
<?php } else if ( $ selected_tab == 'status ' ) {
@@ -571,7 +576,7 @@ class="<?php posts_and_users_stats_echo_tab_class( $selected_tab == $tab_slug );
571
576
categories: [
572
577
<?php foreach ( $ statuses as $ status_slug => $ status_name ) {
573
578
echo "' " . $ status_name . "', " ;
574
- }?> ],
579
+ } ?> ],
575
580
},
576
581
yAxis: {
577
582
title: {
@@ -585,11 +590,11 @@ class="<?php posts_and_users_stats_echo_tab_class( $selected_tab == $tab_slug );
585
590
series: [ {
586
591
name: '<?php _e ( 'Posts ' , 'posts-and-users-stats ' ); ?> ',
587
592
data: [ <?php foreach ( $ statuses as $ status_slug => $ status_name ) {
588
- echo $ posts_per_status ->$ status_slug . ', ' ;
589
- } ?> ]
593
+ echo $ posts_per_status ->$ status_slug . ', ' ;
594
+ } ?> ]
590
595
} ],
591
596
credits: {
592
- enabled: false
597
+ enabled: false
593
598
},
594
599
exporting: {
595
600
filename: '<?php echo posts_and_users_stats_get_export_file_name ( __ ('Posts per Status ' , 'posts-and-users-stats ' ) ); ?> '
@@ -618,7 +623,7 @@ class="<?php posts_and_users_stats_echo_tab_class( $selected_tab == $tab_slug );
618
623
</tr>
619
624
<?php } ?>
620
625
</tbody>
621
- </table>
626
+ </table>
622
627
</section>
623
628
<?php } ?>
624
629
<?php $ end_time = microtime ( true ); ?>
0 commit comments