PluginProbe
Statify / 1.6.3
Statify v1.6.3
2.0.2 2.0.1 trunk 0.7 0.8 0.9 1.0 1.2.8 1.3.0 1.4.0 1.4.1 1.4.2 1.4.3 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.7.0 1.7.1 1.7.2 All 32 releases
statify / views / widget-front.php

widget-front.php in Statify 1.6.3, at views/widget-front.php

84 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Statify: Widget Frontend View
4 *
5 * This file contains the viewmodel for the plugin's widget frontend.
6 *
7 * @package Statify
8 */
9
10 // Quit if accessed outside WP context.
11 class_exists( 'Statify' ) || exit;
12
13 // Get stats.
14 $stats = Statify_Dashboard::get_stats(); ?>
15
16 <div id="statify_chart">
17 <?php if ( empty( $stats['visits'] ) ) { ?>
18 <p>
19 <?php esc_html_e( 'No data available.', 'statify' ); ?>
20 </p>
21 <?php } else { ?>
22 <table id="statify_chart_data">
23 <?php foreach ( (array) $stats['visits'] as $visit ) { ?>
24 <tr>
25 <th><?php echo esc_html( date_i18n( get_option( 'date_format' ), strtotime( $visit['date'] ) ) ); ?></th>
26 <td><?php echo (int) $visit['count']; ?></td>
27 </tr>
28 <?php } ?>
29 </table>
30 <?php } ?>
31 </div>
32
33
34 <?php if ( ! empty( $stats['target'] ) ) { ?>
35 <div class="table target">
36 <p class="sub">
37 <?php esc_html_e( 'Top targets', 'statify' ); ?>
38 </p>
39
40 <div>
41 <table>
42 <?php foreach ( (array) $stats['target'] as $target ) { ?>
43 <tr>
44 <td class="b">
45 <?php echo (int) $target['count']; ?>
46 </td>
47 <td class="t">
48 <a href="<?php echo esc_url( home_url( $target['url'] ) ); ?>" target="_blank" rel="noopener noreferrer">
49 <?php echo esc_html( $target['url'] ); ?>
50 </a>
51 </td>
52 </tr>
53 <?php } ?>
54 </table>
55 </div>
56 </div>
57 <?php } ?>
58
59
60 <?php if ( ! empty( $stats['referrer'] ) ) { ?>
61 <div class="table referrer">
62 <p class="sub">
63 <?php esc_html_e( 'Top referers', 'statify' ); ?>
64 </p>
65
66 <div>
67 <table>
68 <?php foreach ( (array) $stats['referrer'] as $referrer ) { ?>
69 <tr>
70 <td class="b">
71 <?php echo (int) $referrer['count']; ?>
72 </td>
73 <td class="t">
74 <a href="<?php echo esc_url( $referrer['url'] ); ?>" target="_blank" rel="noopener noreferrer">
75 <?php echo esc_html( $referrer['host'] ); ?>
76 </a>
77 </td>
78 </tr>
79 <?php } ?>
80 </table>
81 </div>
82 </div>
83 <?php } ?>
84