PluginProbe ʕ •ᴥ•ʔ
WP Popular Posts / 7.3.8
WP Popular Posts v7.3.8
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-tools.php
wordpress-popular-posts / src / Admin Last commit date
Admin.php 8 months ago admin-page.php 4 months ago screen-debug.php 2 years ago screen-stats.php 4 months ago screen-tools.php 8 months ago
screen-tools.php
285 lines
1 <?php
2 if ( 'tools' == $current ) {
3
4 if ( ! current_user_can('edit_others_posts') ) {
5 echo '<p style="text-align: center;">' . esc_html(__('Sorry, you do not have enough permissions to do this. Please contact the site administrator for support.', 'wordpress-popular-posts')) . '</p>';
6 }
7 else {
8 // Image formats support
9 $webp_support = \WP_Image_Editor_GD::supports_mime_type('image/webp');
10 $avif_support = \WP_Image_Editor_GD::supports_mime_type('image/avif');
11 ?>
12 <div id="wpp_tools">
13 <h3 class="wmpp-subtitle"><?php esc_html_e('Thumbnails', 'wordpress-popular-posts'); ?></h3>
14
15 <form action="" method="post" id="wpp_thumbnail_options" name="wpp_thumbnail_options">
16 <table class="form-table">
17 <tbody>
18 <tr valign="top">
19 <th scope="row"><label for="thumb_default"><?php esc_html_e('Default thumbnail', 'wordpress-popular-posts'); ?>:</label></th>
20 <td>
21 <?php
22 $fallback_thumbnail_url = trim($this->config['tools']['thumbnail']['default']);
23
24 if ( ! $fallback_thumbnail_url ) {
25 $fallback_thumbnail_url = $this->thumbnail->get_default_url();
26 }
27
28 $fallback_thumbnail_url = str_replace(
29 parse_url($fallback_thumbnail_url, PHP_URL_SCHEME) . ':',
30 '',
31 $fallback_thumbnail_url
32 );
33 ?>
34 <div id="thumb-review">
35 <img src="<?php echo esc_url($fallback_thumbnail_url); ?>" alt="" />
36 </div>
37
38 <input id="upload_thumb_button" type="button" class="button" value="<?php esc_attr_e('Change thumbnail', 'wordpress-popular-posts'); ?>">
39 <input id="reset_thumb_button" type="button" class="button" value="<?php esc_attr_e('Reset thumbnail', 'wordpress-popular-posts'); ?>">
40 <input type="hidden" id="upload_thumb_src" name="upload_thumb_src" value="">
41
42 <p class="description"><?php esc_html_e('This image will be displayed when no thumbnail is available', 'wordpress-popular-posts'); ?>.</p>
43 </td>
44 </tr>
45 <tr valign="top">
46 <th scope="row"><label for="thumb_source"><?php esc_html_e('Pick image from', 'wordpress-popular-posts'); ?>:</label></th>
47 <td>
48 <select name="thumb_source" id="thumb_source">
49 <option <?php if ($this->config['tools']['thumbnail']['source'] == 'featured') { ?>selected="selected"<?php } ?> value="featured"><?php esc_html_e('Featured image', 'wordpress-popular-posts'); ?></option>
50 <option <?php if ($this->config['tools']['thumbnail']['source'] == 'first_image') { ?>selected="selected"<?php } ?> value="first_image"><?php esc_html_e('First image on post', 'wordpress-popular-posts'); ?></option>
51 <option <?php if ($this->config['tools']['thumbnail']['source'] == 'first_attachment') { ?>selected="selected"<?php } ?> value="first_attachment"><?php esc_html_e('First attachment', 'wordpress-popular-posts'); ?></option>
52 <option <?php if ($this->config['tools']['thumbnail']['source'] == 'custom_field') { ?>selected="selected"<?php } ?> value="custom_field"><?php esc_html_e('Custom field', 'wordpress-popular-posts'); ?></option>
53 </select>
54 <br />
55 <p class="description"><?php esc_html_e('Tell WP Popular Posts where it should get thumbnails from', 'wordpress-popular-posts'); ?>.</p>
56 </td>
57 </tr>
58 <?php if ( $webp_support || $avif_support ) : ?>
59 <tr valign="top">
60 <th scope="row"><label for="thumb_format"><?php esc_html_e('Thumbnail format', 'wordpress-popular-posts'); ?>:</label></th>
61 <td>
62 <select name="thumb_format" id="thumb_format">
63 <option <?php if ($this->config['tools']['thumbnail']['format'] == 'original') { ?>selected="selected"<?php } ?> value="original"><?php esc_html_e('Use original format', 'wordpress-popular-posts'); ?></option>
64 <?php if ( $avif_support ) : ?><option <?php if ($this->config['tools']['thumbnail']['format'] == 'avif') { ?>selected="selected"<?php } ?> value="avif">avif</option><?php endif; ?>
65 <?php if ( $webp_support ) : ?><option <?php if ($this->config['tools']['thumbnail']['format'] == 'webp') { ?>selected="selected"<?php } ?> value="webp">webp</option><?php endif; ?>
66 </select>
67 </td>
68 </tr>
69 <?php endif; ?>
70 <tr valign="top">
71 <th scope="row"><label for="thumb_lazy_load"><?php esc_html_e('Lazy load', 'wordpress-popular-posts'); ?>:</label> <small>[<a href="https://github.com/cabrerahector/wordpress-popular-posts/wiki/7.-Performance#lazy-loading" target="_blank" title="<?php esc_attr_e('What is this?', 'wordpress-popular-posts'); ?>">?</a>]</small></th>
72 <td>
73 <select name="thumb_lazy_load" id="thumb_lazy_load">
74 <option <?php if ( ! $this->config['tools']['thumbnail']['lazyload'] ) { ?>selected="selected"<?php } ?> value="0"><?php esc_html_e('No', 'wordpress-popular-posts'); ?></option>
75 <option <?php if ( $this->config['tools']['thumbnail']['lazyload'] ) { ?>selected="selected"<?php } ?> value="1"><?php esc_html_e('Yes', 'wordpress-popular-posts'); ?></option>
76 </select>
77 </td>
78 </tr>
79 <tr valign="top" <?php if ($this->config['tools']['thumbnail']['source'] != 'custom_field') { ?>style="display: none;"<?php } ?> id="row_custom_field">
80 <th scope="row"><label for="thumb_field"><?php esc_html_e('Custom field name', 'wordpress-popular-posts'); ?>:</label></th>
81 <td>
82 <input type="text" id="thumb_field" name="thumb_field" value="<?php echo esc_attr($this->config['tools']['thumbnail']['field']); ?>" size="10" />
83 </td>
84 </tr>
85 <tr valign="top" <?php if ($this->config['tools']['thumbnail']['source'] != 'custom_field') { ?>style="display: none;"<?php } ?> id="row_custom_field_resize">
86 <th scope="row"><label for="thumb_field_resize"><?php esc_html_e('Resize image from Custom field?', 'wordpress-popular-posts'); ?>:</label></th>
87 <td>
88 <select name="thumb_field_resize" id="thumb_field_resize">
89 <option <?php if ( ! $this->config['tools']['thumbnail']['resize'] ) { ?>selected="selected"<?php } ?> value="0"><?php esc_html_e('No, use image as is', 'wordpress-popular-posts'); ?></option>
90 <option <?php if ($this->config['tools']['thumbnail']['resize'] == 1 ) { ?>selected="selected"<?php } ?> value="1"><?php esc_html_e('Yes', 'wordpress-popular-posts'); ?></option>
91 </select>
92 </td>
93 </tr>
94 <?php
95 $wp_upload_dir = wp_get_upload_dir();
96 if ( is_dir($wp_upload_dir['basedir'] . '/wordpress-popular-posts') ) :
97 ?>
98 <tr valign="top">
99 <th scope="row"></th>
100 <td>
101 <input type="button" name="wpp-reset-image-cache" id="wpp-reset-image-cache" class="button-secondary" value="<?php esc_attr_e('Empty image cache', 'wordpress-popular-posts'); ?>">
102 <p class="description"><?php esc_html_e("Use this button to clear WPP's thumbnails cache", 'wordpress-popular-posts'); ?>.</p>
103 </td>
104 </tr>
105 <?php
106 endif;
107 ?>
108 <tr valign="top">
109 <td colspan="2">
110 <input type="hidden" name="section" value="thumb">
111 <input type="submit" class="button-primary action" id="btn_th_ops" value="<?php esc_attr_e('Apply', 'wordpress-popular-posts'); ?>" name="">
112 </td>
113 </tr>
114 </tbody>
115 </table>
116
117 <?php wp_nonce_field('wpp-update-thumbnail-options', 'wpp-update-thumbnail-options-token'); ?>
118 </form>
119 <br />
120 <p style="display: <?php echo ( current_user_can('manage_options') ) ? 'block' : 'none'; ?>; float:none; clear:both;">&nbsp;</p>
121
122 <?php if ( current_user_can('manage_options') ) : ?>
123 <h3 class="wmpp-subtitle"><?php esc_html_e('Data', 'wordpress-popular-posts'); ?></h3>
124
125 <form action="" method="post" id="wpp_ajax_options" name="wpp_ajax_options">
126 <table class="form-table">
127 <tbody>
128 <tr valign="top">
129 <th scope="row"><label for="log_option"><?php esc_html_e('Log views from', 'wordpress-popular-posts'); ?>:</label></th>
130 <td>
131 <select name="log_option" id="log_option">
132 <option <?php if ($this->config['tools']['log']['level'] == 0) { ?>selected="selected"<?php } ?> value="0"><?php esc_html_e('Visitors only', 'wordpress-popular-posts'); ?></option>
133 <option <?php if ($this->config['tools']['log']['level'] == 2) { ?>selected="selected"<?php } ?> value="2"><?php esc_html_e('Logged-in users only', 'wordpress-popular-posts'); ?></option>
134 <option <?php if ($this->config['tools']['log']['level'] == 1) { ?>selected="selected"<?php } ?> value="1"><?php esc_html_e('Everyone', 'wordpress-popular-posts'); ?></option>
135 </select>
136 <br />
137 </td>
138 </tr>
139 <tr valign="top">
140 <th scope="row"><label for="log_limit"><?php esc_html_e('Log limit', 'wordpress-popular-posts'); ?>:</label></th>
141 <td>
142 <select name="log_limit" id="log_limit">
143 <option <?php if ($this->config['tools']['log']['limit'] == 0) { ?>selected="selected"<?php } ?> value="0"><?php esc_html_e('Disabled', 'wordpress-popular-posts'); ?></option>
144 <option <?php if ($this->config['tools']['log']['limit'] == 1) { ?>selected="selected"<?php } ?> value="1"><?php esc_html_e('Keep data for', 'wordpress-popular-posts'); ?></option>
145 </select>
146
147 <label for="log_expire_time"<?php echo ($this->config['tools']['log']['limit'] == 0) ? ' style="display: none;"' : ''; ?>>
148 <input type="number" min="1" id="log_expire_time" name="log_expire_time" value="<?php echo esc_attr($this->config['tools']['log']['expires_after']); ?>" size="3"> <?php esc_html_e('day(s)', 'wordpress-popular-posts'); ?>
149 </label>
150
151 <p class="description"<?php echo ($this->config['tools']['log']['limit'] == 0) ? ' style="display: none;"' : ''; ?>><?php esc_html_e('Data older than the specified time frame will be automatically discarded', 'wordpress-popular-posts'); ?>.</p>
152
153 <br <?php echo (1 == $this->config['tools']['log']['limit']) ? 'style="display: none;"' : ''; ?>/>
154 </td>
155 </tr>
156 <tr valign="top">
157 <th scope="row"><label for="ajax"><?php esc_html_e('Load popular posts list via AJAX', 'wordpress-popular-posts'); ?>:</label></th>
158 <td>
159 <select name="ajax" id="ajax">
160 <option <?php if (! $this->config['tools']['ajax']) { ?>selected="selected"<?php } ?> value="0"><?php esc_html_e('Disabled', 'wordpress-popular-posts'); ?></option>
161 <option <?php if ($this->config['tools']['ajax']) { ?>selected="selected"<?php } ?> value="1"><?php esc_html_e('Enabled', 'wordpress-popular-posts'); ?></option>
162 </select>
163
164 <br />
165 <p class="description"><?php esc_html_e('If you are using a caching plugin such as WP Super Cache, enabling this feature will keep the popular list from being cached by it', 'wordpress-popular-posts'); ?>.</p>
166 </td>
167 </tr>
168 <tr valign="top">
169 <th scope="row"><label for="cache"><?php esc_html_e('Data Caching', 'wordpress-popular-posts'); ?>:</label> <small>[<a href="https://github.com/cabrerahector/wordpress-popular-posts/wiki/7.-Performance#caching-db-queries-results" target="_blank" title="<?php esc_attr_e('What is this?', 'wordpress-popular-posts'); ?>">?</a>]</small></th>
170 <td>
171 <select name="cache" id="cache">
172 <option <?php if ( ! $this->config['tools']['cache']['active'] ) { ?>selected="selected"<?php } ?> value="0"><?php esc_html_e('Never cache', 'wordpress-popular-posts'); ?></option>
173 <option <?php if ( $this->config['tools']['cache']['active'] ) { ?>selected="selected"<?php } ?> value="1"><?php esc_html_e('Enable caching', 'wordpress-popular-posts'); ?></option>
174 </select>
175
176 <br />
177 <p class="description"><?php esc_html_e('WPP can cache the popular list for a specified amount of time. Recommended for large / high traffic sites', 'wordpress-popular-posts'); ?>.</p>
178 </td>
179 </tr>
180 <tr valign="top" <?php if ( ! $this->config['tools']['cache']['active'] ) { ?>style="display: none;"<?php } ?> id="cache_refresh_interval">
181 <th scope="row"><label for="cache_interval_value"><?php esc_html_e('Refresh cache every', 'wordpress-popular-posts'); ?>:</label></th>
182 <td>
183 <input name="cache_interval_value" type="number" min="1" id="cache_interval_value" value="<?php echo ( isset($this->config['tools']['cache']['interval']['value']) ) ? (int) $this->config['tools']['cache']['interval']['value'] : 1; ?>" class="small-text">
184 <select name="cache_interval_time" id="cache_interval_time">
185 <option <?php if ($this->config['tools']['cache']['interval']['time'] == 'minute') { ?>selected="selected"<?php } ?> value="minute"><?php esc_html_e('Minute(s)', 'wordpress-popular-posts'); ?></option>
186 <option <?php if ($this->config['tools']['cache']['interval']['time'] == 'hour') { ?>selected="selected"<?php } ?> value="hour"><?php esc_html_e('Hour(s)', 'wordpress-popular-posts'); ?></option>
187 <option <?php if ($this->config['tools']['cache']['interval']['time'] == 'day') { ?>selected="selected"<?php } ?> value="day"><?php esc_html_e('Day(s)', 'wordpress-popular-posts'); ?></option>
188 <option <?php if ($this->config['tools']['cache']['interval']['time'] == 'week') { ?>selected="selected"<?php } ?> value="week"><?php esc_html_e('Week(s)', 'wordpress-popular-posts'); ?></option>
189 <option <?php if ($this->config['tools']['cache']['interval']['time'] == 'month') { ?>selected="selected"<?php } ?> value="month"><?php esc_html_e('Month(s)', 'wordpress-popular-posts'); ?></option>
190 <option <?php if ($this->config['tools']['cache']['interval']['time'] == 'year') { ?>selected="selected"<?php } ?> value="month"><?php esc_html_e('Year(s)', 'wordpress-popular-posts'); ?></option>
191 </select>
192 <br />
193 <p class="description" style="display: none;" id="cache_too_long"><?php esc_html_e('Really? That long?', 'wordpress-popular-posts'); ?></p>
194 </td>
195 </tr>
196 <tr valign="top">
197 <th scope="row"><label for="sampling"><?php esc_html_e('Data Sampling', 'wordpress-popular-posts'); ?>:</label> <small>[<a href="https://github.com/cabrerahector/wordpress-popular-posts/wiki/7.-Performance#data-sampling" target="_blank" title="<?php esc_attr_e('What is this?', 'wordpress-popular-posts'); ?>">?</a>]</small></th>
198 <td>
199 <select name="sampling" id="sampling">
200 <option <?php if ( ! $this->config['tools']['sampling']['active'] ) { ?>selected="selected"<?php } ?> value="0"><?php esc_html_e('Disabled', 'wordpress-popular-posts'); ?></option>
201 <option <?php if ( $this->config['tools']['sampling']['active'] ) { ?>selected="selected"<?php } ?> value="1"><?php esc_html_e('Enabled', 'wordpress-popular-posts'); ?></option>
202 </select>
203
204 <br />
205 <?php
206 $description = sprintf(
207 __('By default, WP Popular Posts stores in database every single visit your site receives. For small / medium sites this is generally OK, but on large / high traffic sites the constant writing to the database may have an impact on performance. With <a href="%1$s" target="_blank">data sampling</a>, WP Popular Posts will store only a subset of your traffic and report on the tendencies detected in that sample set (for more, <a href="%2$s" target="_blank">please read here</a>)', 'wordpress-popular-posts'),
208 'http://en.wikipedia.org/wiki/Sample_%28statistics%29',
209 'https://github.com/cabrerahector/wordpress-popular-posts/wiki/7.-Performance#data-sampling'
210 );
211 ?>
212 <p class="description"><?php echo $description; //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>.</p>
213 </td>
214 </tr>
215 <tr valign="top" <?php if ( ! $this->config['tools']['sampling']['active'] ) { ?>style="display: none;"<?php } ?> id="sampling_rate">
216 <th scope="row"><label for="sample_rate"><?php esc_html_e('Sample Rate', 'wordpress-popular-posts'); ?>: <small>[<a href="https://github.com/cabrerahector/wordpress-popular-posts/wiki/7.-Performance#what-is-sample-rate-for" target="_blank" title="<?php esc_attr_e('What is this?', 'wordpress-popular-posts'); ?>">?</a>]</small></label></th>
217 <td>
218 <input name="sample_rate" type="number" min="1" id="sample_rate" value="<?php echo ( isset($this->config['tools']['sampling']['rate']) ) ? (int) $this->config['tools']['sampling']['rate'] : 100; ?>" class="small-text">
219 <br />
220 <p class="description"><?php echo sprintf(esc_html__('A sampling rate of %d is recommended for large / high traffic sites. For lower traffic sites, you should lower the value.', 'wordpress-popular-posts'), 100); ?></p>
221 </td>
222 </tr>
223 <tr valign="top">
224 <td colspan="2">
225 <input type="hidden" name="section" value="data">
226 <input type="submit" class="button-primary action" id="btn_ajax_ops" value="<?php esc_attr_e('Apply', 'wordpress-popular-posts'); ?>" name="">
227 </td>
228 </tr>
229 </tbody>
230 </table>
231
232 <?php wp_nonce_field('wpp-update-data-options', 'wpp-update-data-options-token'); ?>
233 </form>
234 <br />
235 <p style="display: block; float:none; clear: both;">&nbsp;</p>
236 <?php endif; ?>
237
238 <h3 class="wmpp-subtitle"><?php esc_html_e('Miscellaneous', 'wordpress-popular-posts'); ?></h3>
239
240 <form action="" method="post" id="wpp_link_options" name="wpp_link_options">
241 <table class="form-table">
242 <tbody>
243 <tr valign="top">
244 <th scope="row"><label for="link_target"><?php esc_html_e('Open links in', 'wordpress-popular-posts'); ?>:</label></th>
245 <td>
246 <select name="link_target" id="link_target">
247 <option <?php if ($this->config['tools']['link']['target'] == '_self') { ?>selected="selected"<?php } ?> value="_self"><?php esc_html_e('Current window', 'wordpress-popular-posts'); ?></option>
248 <option <?php if ($this->config['tools']['link']['target'] == '_blank') { ?>selected="selected"<?php } ?> value="_blank"><?php esc_html_e('New tab/window', 'wordpress-popular-posts'); ?></option>
249 </select>
250 <br />
251 </td>
252 </tr>
253 <tr valign="top">
254 <th scope="row"><label for="css"><?php esc_html_e("Use plugin's stylesheet", 'wordpress-popular-posts'); ?>:</label></th>
255 <td>
256 <select name="css" id="css">
257 <option <?php if ($this->config['tools']['css']) { ?>selected="selected"<?php } ?> value="1"><?php esc_html_e('Enabled', 'wordpress-popular-posts'); ?></option>
258 <option <?php if (! $this->config['tools']['css']) { ?>selected="selected"<?php } ?> value="0"><?php esc_html_e('Disabled', 'wordpress-popular-posts'); ?></option>
259 </select>
260 <br />
261 <p class="description"><?php esc_html_e('By default, the plugin includes a stylesheet called wpp.css which you can use to style your popular posts listing. If you wish to use your own stylesheet or do not want it to have it included in the header section of your site, use this.', 'wordpress-popular-posts'); ?></p>
262 </td>
263 </tr>
264 <tr valign="top">
265 <th scope="row"><label for="experimental_features"><?php esc_html_e('Enable experimental features', 'wordpress-popular-posts'); ?>:</label></th>
266 <td>
267 <input type="checkbox" class="checkbox" id="experimental_features" name="experimental_features" <?php echo ($this->config['tools']['experimental']) ? 'checked="checked"' : ''; ?>>
268 </td>
269 </tr>
270 <tr valign="top">
271 <td colspan="2">
272 <input type="hidden" name="section" value="misc">
273 <input type="submit" class="button-primary action" value="<?php esc_attr_e('Apply', 'wordpress-popular-posts'); ?>" name="">
274 </td>
275 </tr>
276 </tbody>
277 </table>
278
279 <?php wp_nonce_field('wpp-update-misc-options', 'wpp-update-misc-options-token'); ?>
280 </form>
281 </div>
282 <?php
283 }
284 }
285