PluginProbe ʕ •ᴥ•ʔ
WP Popular Posts / trunk
WP Popular Posts vtrunk
4.0.8 4.0.9 4.1.0 4.1.1 4.1.2 4.2.0 4.2.1 4.2.2 5.0.0 5.0.1 5.0.2 5.1.0 5.2.0 5.2.1 5.2.2 5.2.3 5.2.4 5.3.0 5.3.1 5.3.2 5.3.3 5.3.4 5.3.5 5.3.6 5.4.0 5.4.1 5.4.2 5.5.0 5.5.1 6.0.0 6.0.1 6.0.2 6.0.3 6.0.4 6.0.5 6.1.0 6.1.1 6.1.2 6.1.3 6.1.4 6.2.0 6.2.1 6.3.0 6.3.1 6.3.2 6.3.3 6.3.4 6.4.0 6.4.1 6.4.2 7.0.0 7.0.1 7.1.0 7.2.0 7.3.0 7.3.1 7.3.2 7.3.3 7.3.4 7.3.5 7.3.6 7.3.7 7.3.8 7.4.0 trunk 2.3.7 3.0.0 3.0.1 3.0.2 3.0.3 3.1.0 3.1.1 3.2.0 3.2.1 3.2.2 3.2.3 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 4.0.0 4.0.1 4.0.10 4.0.11 4.0.12 4.0.13 4.0.2 4.0.3 4.0.5 4.0.6
wordpress-popular-posts / src / Admin / screen-stats.php
wordpress-popular-posts / src / Admin Last commit date
Admin.php 1 month ago ListColumnTotalViews.php 1 month ago admin-page.php 1 month ago screen-debug.php 1 month ago screen-stats.php 1 month ago screen-tools.php 1 month ago
screen-stats.php
162 lines
1 <?php
2 if ( 'stats' == $current ) {
3 $chart_data = json_decode(
4 $this->get_chart_data(
5 $this->config['stats']['range'],
6 strtoupper($this->config['stats']['time_unit']),
7 $this->config['stats']['time_quantity']
8 ),
9 true
10 );
11 ?>
12
13 <?php if ( current_user_can('edit_others_posts') ) : ?>
14 <button type="button" id="wpp-stats-config-btn" class="button-secondary action right"><span class="dashicons dashicons-admin-generic"></span><span class="screen-reader-text"><?php esc_html_e('Open Settings', 'wordpress-popular-posts'); ?></span></button>
15
16 <div id="wpp-stats-config" class="wpp-lightbox" role="dialog" aria-label="<?php esc_attr_e('Stats Settings', 'wordpress-popular-posts'); ?>">
17 <form action="" method="post" id="wpp_stats_options" name="wpp_stats_options">
18 <label for="stats_type"><?php esc_html_e('Post type', 'wordpress-popular-posts'); ?>:</label>
19 <input type="text" id="stats_type" name="stats_type" value="<?php echo esc_attr($this->config['stats']['post_type']); ?>" size="15" required>
20
21 <label for="stats_limits"><?php esc_html_e('Limit', 'wordpress-popular-posts'); ?>:</label>
22 <input type="text" id="stats_type" name="stats_limit" value="<?php echo esc_attr($this->config['stats']['limit']); ?>" size="5" required>
23
24 <label for="stats_freshness">
25 <input type="checkbox" class="checkbox" <?php echo ($this->config['stats']['freshness']) ? 'checked="checked"' : ''; ?> id="stats_freshness" name="stats_freshness"> <small><?php esc_html_e('Display only posts published within the selected Time Range', 'wordpress-popular-posts'); ?></small>
26 </label>
27
28 <div class="clear"></div>
29
30 <label for="stats_y_scale">
31 <input type="checkbox" class="checkbox" <?php echo ($this->config['stats']['y_scale']) ? 'checked="checked"' : ''; ?> id="stats_y_scale" name="stats_y_scale"> <small><?php esc_html_e('Display Y scale', 'wordpress-popular-posts'); ?></small>
32 </label>
33
34 <div class="clear"></div>
35 <br /><br />
36
37 <input type="hidden" name="section" value="stats">
38 <button type="submit" class="button-primary action"><?php esc_html_e('Apply', 'wordpress-popular-posts'); ?></button>
39 <button type="button" class="button-secondary action right"><?php esc_html_e('Cancel'); ?></button>
40
41 <?php wp_nonce_field('wpp-update-stats-options', 'wpp-update-stats-options-token'); ?>
42 </form>
43 </div>
44 <?php endif; ?>
45
46 <div id="wpp-stats-range" class="wpp-lightbox wpp-tabs" role="dialog" aria-label="<?php esc_attr_e('Custom Time Range Settings', 'wordpress-popular-posts'); ?>">
47 <form action="" method="post">
48 <div class="wpp-lightbox-tabs wpp-tabs-container" role="tablist">
49 <button type="button" role="tab" aria-selected="true" aria-controls="custom-time-range" id="tab-1" tabindex="0"><?php esc_html_e('Custom Time Range', 'wordpress-popular-posts'); ?></button>
50 <button type="button" role="tab" aria-selected="false" aria-controls="custom-date-range" id="tab-2" tabindex="-1"><?php esc_html_e('Date Range', 'wordpress-popular-posts'); ?></button>
51 </div>
52
53 <div class="wpp-lightbox-tab-content active wpp-tabs-panel" id="custom-time-range" role="tabpanel" tabindex="0" aria-labelledby="tab-1">
54 <input type="number" id="stats_range_time_quantity" name="stats_range_time_quantity" min="1" step="1" value="<?php echo esc_attr($this->config['stats']['time_quantity']); ?>">
55
56 <select id="stats_range_time_unit" name="stats_range_time_unit">
57 <option <?php if ($this->config['stats']['time_unit'] == 'minute') { ?>selected="selected"<?php } ?> value="minute"><?php esc_html_e('Minute(s)', 'wordpress-popular-posts'); ?></option>
58 <option <?php if ($this->config['stats']['time_unit'] == 'hour') { ?>selected="selected"<?php } ?> value="hour"><?php esc_html_e('Hour(s)', 'wordpress-popular-posts'); ?></option>
59 <option <?php if ($this->config['stats']['time_unit'] == 'day') { ?>selected="selected"<?php } ?> value="day"><?php esc_html_e('Day(s)', 'wordpress-popular-posts'); ?></option>
60 </select>
61 </div>
62
63 <div class="wpp-lightbox-tab-content wpp-tabs-panel" id="custom-date-range" role="tabpanel" tabindex="0" aria-labelledby="tab-2">
64 <?php $today = \WordPressPopularPosts\Helper::curdate(); ?>
65
66 <div class="wpp-date-field">
67 <div class="wpp-date-field-inner">
68 <label for="stats_range_start_date"><?php esc_html_e('Start date', 'wordpress-popular-posts'); ?></label>
69 <input type="date" id="stats_range_start_date" name="stats_range_start_date" max="<?php echo esc_attr($today); ?>" value="<?php echo esc_attr($today); ?>" />
70 </div>
71 </div>
72
73 <div class="wpp-date-field">
74 <div class="wpp-date-field-inner">
75 <label for="stats_range_end_date"><?php esc_html_e('End date', 'wordpress-popular-posts'); ?></label>
76 <input type="date" id="stats_range_end_date" name="stats_range_end_date" max="<?php echo esc_attr($today); ?>" value="<?php echo esc_attr($today); ?>" />
77 </div>
78 </div>
79 </div>
80
81 <div class="clear"></div>
82 <br />
83
84 <button type="submit" class="button-primary action">
85 <?php esc_html_e('Apply', 'wordpress-popular-posts'); ?>
86 </button>
87 <button type="button" class="button-secondary action right">
88 <?php esc_html_e('Cancel'); ?>
89 </button>
90 </form>
91 </div>
92
93 <div id="wpp-chart-wrapper">
94 <p><?php echo wp_kses_post($chart_data['totals']['label_summary']); ?></p>
95 <p><?php echo esc_html($chart_data['totals']['label_date_range']); ?></p>
96
97 <ul class="wpp-header-nav" id="wpp-time-ranges">
98 <li <?php echo ('today' == $this->config['stats']['range']) ? ' class="current"' : ''; ?>>
99 <button type="button" class="<?php echo ('today' == $this->config['stats']['range']) ? 'button-primary' : 'button-secondary'; ?>" data-range="today"><?php esc_html_e('Today', 'wordpress-popular-posts'); ?></button>
100 </li>
101 <li <?php echo ('last24hours' == $this->config['stats']['range']) ? ' class="current"' : ''; ?>>
102 <button type="button" class="<?php echo ('last24hours' == $this->config['stats']['range'] ) ? 'button-primary' : 'button-secondary'; ?>" data-range="last24hours" title="<?php esc_attr_e('Last 24 hours', 'wordpress-popular-posts'); ?>">24h</button>
103 </li>
104 <li <?php echo ('last7days' == $this->config['stats']['range']) ? ' class="current"' : ''; ?>>
105 <button type="button" class="<?php echo ('last7days' == $this->config['stats']['range'] ) ? 'button-primary' : 'button-secondary'; ?>" data-range="last7days" title="<?php esc_attr_e('Last 7 days', 'wordpress-popular-posts'); ?>">7d</button>
106 </li>
107 <li <?php echo ('last30days' == $this->config['stats']['range']) ? ' class="current"' : ''; ?>>
108 <button type="button" class="<?php echo ('last30days' == $this->config['stats']['range']) ? 'button-primary' : 'button-secondary'; ?>" data-range="last30days" title="<?php esc_attr_e('Last 30 days', 'wordpress-popular-posts'); ?>">30d</button>
109 </li>
110 <li <?php echo ('custom' == $this->config['stats']['range']) ? ' class="current"' : ''; ?>>
111 <button type="button" class="<?php echo ('custom' == $this->config['stats']['range']) ? 'button-primary' : 'button-secondary'; ?>" data-range="custom"><?php esc_html_e('Custom', 'wordpress-popular-posts'); ?></button>
112 </li>
113 </ul>
114
115 <div id="wpp-chart" data-y-scale="<?php echo absint($this->config['stats']['y_scale']); ?>"></div>
116 </div>
117
118 <div id="wpp-listing" class="wpp-content wpp-tabs">
119 <div class="wpp-tabs-container" role="tablist">
120 <button type="button" role="tab" aria-selected="true" aria-controls="most-viewed-list" id="tab-list-1" tabindex="0" title="<?php esc_attr_e('See your most viewed posts within the selected time range', 'wordpress-popular-posts'); ?>"><span class="wpp-icon-eye"></span><span><?php esc_html_e('Most viewed', 'wordpress-popular-posts'); ?></span></button>
121 <button type="button" role="tab" aria-selected="false" aria-controls="most-commented-list" id="tab-list-2" tabindex="-1" title="<?php esc_attr_e('See your most commented posts within the selected time range', 'wordpress-popular-posts'); ?>"><span class="wpp-icon-comment"></span><span><?php esc_html_e('Most commented', 'wordpress-popular-posts'); ?></span></button>
122 <button type="button" role="tab" aria-selected="false" aria-controls="trending-list" id="tab-list-3" tabindex="-1" title="<?php esc_attr_e('See your most viewed posts within the last hour', 'wordpress-popular-posts'); ?>"><span class="wpp-icon-rocket"></span><span><?php esc_html_e('Trending now', 'wordpress-popular-posts'); ?></span></button>
123 <button type="button" role="tab" aria-selected="false" aria-controls="hof-list" id="tab-list-4" tabindex="-1" title="<?php esc_attr_e('See your most viewed posts of all time', 'wordpress-popular-posts'); ?>"><span class="wpp-icon-award"></span><span><?php esc_html_e('Hall of Fame', 'wordpress-popular-posts'); ?></span></button>
124 </div>
125
126 <div class="wpp-tabs-panel active" id="most-viewed-list" role="tabpanel" tabindex="0" aria-labelledby="tab-list-1">
127 <span class="spinner"></span>
128 </div>
129
130 <div class="wpp-tabs-panel" id="most-commented-list" role="tabpanel" tabindex="0" aria-labelledby="tab-list-2">
131 <span class="spinner"></span>
132 </div>
133
134 <div class="wpp-tabs-panel" id="trending-list" role="tabpanel" tabindex="0" aria-labelledby="tab-list-3">
135 <span class="spinner"></span>
136 </div>
137
138 <div class="wpp-tabs-panel" id="hof-list" role="tabpanel" tabindex="0" aria-labelledby="tab-list-4">
139 <?php
140 $args = [
141 'range' => 'all',
142 'post_type' => $this->config['stats']['post_type'],
143 'order_by' => 'views',
144 'limit' => $this->config['stats']['limit'],
145 'stats_tag' => [
146 'comment_count' => 1,
147 'views' => 1,
148 'date' => [
149 'active' => 1
150 ]
151 ]
152 ];
153 $query = new \WordPressPopularPosts\Query($args);
154 $popular_posts = $query->get_posts();
155
156 $this->render_list($popular_posts, 'hof');
157 ?>
158 </div>
159 </div>
160 <?php
161 }
162