PluginProbe
WebberZone Top 10 — Popular Posts / 4.5.1
WebberZone Top 10 — Popular Posts v4.5.1
4.5.1 4.5.0 4.4.3 4.4.2 4.4.1 4.4.0 4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 trunk 1.0 1.0.1 1.1 1.2 1.3 1.4 1.4.1 1.5 1.5.1 1.5.2 1.5.3 1.6 1.6.1 All 117 releases
← All changes | includes/admin/class-settings.php +266 -59 4.4.04.5.1 View file →
@@ -21,12 +21,13 @@
21 21
22 22 /**
23 23 * Class to register the settings.
24 24 *
25 - * @since 3.3.0
25 + * @since 3.3.0
26 26 */
27 27 class Settings {
28 28
29 +
29 30 /**
30 31 * Settings API.
31 32 *
32 33 * @since 3.3.0
@@ -200,8 +201,155 @@
200 201 }
201 202
202 203
203 204 /**
205 + * Raw defaults for every registered setting, keyed by option ID.
206 + *
207 + * Must exactly match what `tptn_settings_defaults()` computes from
208 + * {@see self::get_registered_settings()}, but without building the full
209 + * (translated) field definitions. Values are pre-normalized: checkboxes are
210 + * `1`/`0`, not `true`/`false`. Computed defaults (e.g. `thumb_default`) are
211 + * represented as `''` here since their real value cannot be known statically.
212 + *
213 + * @since 4.4.2
214 + *
215 + * @return array<string, mixed> Default value for every option ID.
216 + */
217 + public static function get_defaults() {
218 + return array(
219 + 'features_header' => '',
220 + 'features_display_header' => '',
221 + 'enable_blocks' => 1,
222 + 'enable_legacy_widgets' => 1,
223 + 'enable_query_block' => 1,
224 + 'enable_featured_image_block' => 1,
225 + 'enable_popular_posts_pro_block' => 1,
226 + 'enable_page_builders' => 1,
227 + 'enable_popular_authors' => 1,
228 + 'features_tracking_header' => '',
229 + 'enable_feed' => 1,
230 + 'enable_fast_tracker' => 1,
231 + 'enable_sitewide_tracking' => 1,
232 + 'features_data_header' => '',
233 + 'enable_daily_table_rollup' => 1,
234 + 'features_admin_header' => '',
235 + 'enable_pro_dashboard_widgets' => 1,
236 + 'cache' => 1,
237 + 'cache_time' => HOUR_IN_SECONDS,
238 + 'lazy_load' => 0,
239 + 'uninstall_clean_options' => 1,
240 + 'uninstall_clean_tables' => 0,
241 + 'show_credit' => 0,
242 + 'admin_header' => '',
243 + 'show_metabox' => 1,
244 + 'show_metabox_admins' => 0,
245 + 'pv_in_admin' => 1,
246 + 'admin_column_post_types' => 'post,page',
247 + 'show_count_non_admins' => 1,
248 + 'show_dashboard_to_roles' => 'administrator',
249 + 'show_admin_bar' => 1,
250 + 'query_optimization' => '',
251 + 'max_execution_time' => 3000,
252 + 'counter_header' => '',
253 + 'add_to' => 'single,page',
254 + 'count_disp_form' => 'Visited %totalcount% times, %dailycount% visit(s) today',
255 + 'count_disp_form_zero' => 'No visits yet',
256 + 'number_format_count' => 1,
257 + 'number_format_style' => 'full',
258 + 'daily_midnight' => 1,
259 + 'range_desc' => '',
260 + 'daily_range' => '1',
261 + 'hour_range' => '0',
262 + 'dynamic_post_count' => 0,
263 + 'exclude_on_post_ids' => '',
264 + 'tracker_header' => '',
265 + 'trackers' => 'overall,daily',
266 + 'tracker_type' => 'query_based',
267 + 'tracking_method' => 'funnel',
268 + 'tracker_all_pages' => 0,
269 + 'track_sitewide' => 0,
270 + 'track_feed_views' => 0,
271 + 'track_users' => 'authors,editors,admins',
272 + 'logged_in' => 1,
273 + 'no_bots' => 0,
274 + 'debug_mode' => 0,
275 + 'use_global_settings' => 0,
276 + 'limit' => '10',
277 + 'how_old' => '0',
278 + 'post_types' => 'post',
279 + 'exclusion_header' => '',
280 + 'exclude_front' => 0,
281 + 'exclude_current_post' => 0,
282 + 'exclude_post_ids' => '',
283 + 'exclude_cat_slugs' => '',
284 + 'exclude_categories' => '',
285 + 'exclude_terms_include_parents' => 'none',
286 + 'exclude_on_cat_slugs' => '',
287 + 'customize_output_header' => '',
288 + 'title' => '<h3>Popular posts:</h3>',
289 + 'title_daily' => '<h3>Currently trending:</h3>',
290 + 'blank_output' => 'blank',
291 + 'blank_output_text' => 'No top posts yet',
292 + 'show_excerpt' => 0,
293 + 'excerpt_length' => '10',
294 + 'show_date' => 0,
295 + 'show_author' => 0,
296 + 'disp_list_count' => 0,
297 + 'show_ratings' => '',
298 + 'title_length' => '60',
299 + 'link_new_window' => 0,
300 + 'link_nofollow' => 0,
301 + 'html_wrapper_header' => '',
302 + 'before_list' => '<ul>',
303 + 'after_list' => '</ul>',
304 + 'before_list_item' => '<li>',
305 + 'after_list_item' => '</li>',
306 + 'post_thumb_op' => 'text_only',
307 + 'thumb_size' => 'tptn_thumbnail',
308 + 'thumb_width' => '250',
309 + 'thumb_height' => '250',
310 + 'thumb_crop' => 1,
311 + 'thumb_create_sizes' => 1,
312 + 'thumb_html' => 'html',
313 + 'thumb_meta' => 'post-image',
314 + 'scan_images' => 1,
315 + 'thumb_default_show' => 1,
316 + 'thumb_default' => '',
317 + 'tptn_styles' => 'no_style',
318 + 'custom_css' => '',
319 + 'cron_on' => 0,
320 + 'maintenance_days' => 0,
321 + 'log_retention_days' => 0,
322 + 'cron_range_desc' => '',
323 + 'cron_hour' => '0',
324 + 'cron_min' => '0',
325 + 'cron_recurrence' => 'weekly',
326 + 'feed_permalink_overall' => 'popular-posts',
327 + 'feed_permalink_daily' => 'popular-posts-daily',
328 + 'feed_limit' => '10',
329 + 'feed_daily_range' => '1',
330 + 'feed_category_slugs' => '',
331 + 'wzpa_number' => 10,
332 + 'wzpa_daily_range' => 1,
333 + 'wzpa_hour_range' => 0,
334 + 'wzpa_optioncount' => 0,
335 + 'wzpa_show_postcount' => 0,
336 + 'wzpa_show_fullname' => 0,
337 + 'wzpa_show_avatar' => 0,
338 + 'wzpa_exclude_admin' => 0,
339 + 'wzpa_post_type' => 'post',
340 + 'wzpa_cache' => 1,
341 + 'wzpa_styles_desc' => '',
342 + 'wzpa_styles' => 'no_style',
343 + 'wzpa_html_wrapper_header' => '',
344 + 'wzpa_before_list' => '<ul>',
345 + 'wzpa_after_list' => '</ul>',
346 + 'wzpa_before_list_item' => '<li>',
347 + 'wzpa_after_list_item' => '</li>',
348 + );
349 + }
350 +
351 + /**
204 352 * Retrieve the array of plugin settings
205 353 *
206 354 * @since 3.3.0
207 355 *
@@ -520,8 +668,16 @@
520 668 'desc' => esc_html__( 'This will load the tracker js on all pages. Helpful if you are running minification/concatenation plugins.', 'top-10' ),
521 669 'type' => 'checkbox',
522 670 'default' => false,
523 671 ),
672 + 'track_sitewide' => array(
673 + 'id' => 'track_sitewide',
674 + 'name' => esc_html__( 'Track site-wide views', 'top-10' ),
675 + 'desc' => esc_html__( 'Track views for the front page, posts page, archives, and search results in addition to individual posts and pages. Site-wide contexts use fixed reserved IDs in the shared Top 10 tables: front page = PHP_INT_MAX; home page = PHP_INT_MAX - 1; search = PHP_INT_MAX - 2; category = PHP_INT_MAX - 4; tag = PHP_INT_MAX - 5; taxonomy = PHP_INT_MAX - 6; author = PHP_INT_MAX - 7; post type archive = PHP_INT_MAX - 8; date archive = PHP_INT_MAX - 9; archive = PHP_INT_MAX - 10; other = PHP_INT_MAX - 11. These IDs are the same on every site and counts remain separate by site (blog ID).', 'top-10' ),
676 + 'type' => 'checkbox',
677 + 'default' => false,
678 + 'pro' => true,
679 + ),
524 680 'track_feed_views' => array(
525 681 'id' => 'track_feed_views',
526 682 'name' => esc_html__( 'Track feed views', 'top-10' ),
527 683 'desc' => esc_html__( 'Count post views from RSS/Atom feed readers via a tracking pixel. Views are added to the post\'s regular view count. Note: some feed readers block remote images by default; views are only counted when the reader loads images.', 'top-10' ),
@@ -764,9 +920,9 @@
764 920 ),
765 921 'show_ratings' => array(
766 922 'id' => 'show_ratings',
767 923 'name' => esc_html__( 'Show WP-PostRatings rating', 'top-10' ),
768 - 'desc' => esc_html__( 'Display the rating from the WP-PostRatings plugin with each post in the list. This option only takes effect when the WP-PostRatings plugin is active. The Star rating output, including the text shown alongside the stars, comes from the "Ratings Voted Text" template which you can edit under Ratings » Ratings Templates.', 'top-10' ),
924 + 'desc' => esc_html__( 'Display the rating from the WP-PostRatings plugin with each post in the list. This option only takes effect when the WP-PostRatings plugin is active. The Star rating output, including the text shown alongside the stars, comes from the "Ratings Voted Text" template which you can edit under WP-PostRatings » Settings » Templates.', 'top-10' ),
769 925 'type' => 'select',
770 926 'default' => '',
771 927 'options' => array(
772 928 '' => esc_html__( 'Do not display', 'top-10' ),
@@ -984,9 +1140,9 @@
984 1140 'custom_css' => array(
985 1141 'id' => 'custom_css',
986 1142 'name' => esc_html__( 'Custom CSS', 'top-10' ),
987 1143 'desc' => sprintf(
988 - /* translators: 1: Opening a tag, 2: Closing a tag, 3: Opening code tage, 4. Closing code tag. */
1144 + /* translators: 1: Opening a tag, 2: Closing a tag, 3: Opening code tage, 4. Closing code tag. */
989 1145 esc_html__( 'Do not include %3$sstyle%4$s tags. Check out %1$sthis article%2$s for available CSS classes to style.', 'top-10' ),
990 1146 '<a href="' . esc_url( 'https://webberzone.com/support/knowledgebase/using-and-customising-top-10/' ) . '" target="_blank">',
991 1147 '</a>',
992 1148 '<code>',
@@ -1021,10 +1177,11 @@
1021 1177 'cron_on' => array(
1022 1178 'id' => 'cron_on',
1023 1179 'name' => esc_html__( 'Enable scheduled maintenance', 'top-10' ),
1024 1180 'desc' => sprintf(
1025 - /* translators: 1: Constant holding number of days data is stored. */
1181 + /* translators: 1: Constant holding number of days data is stored. */
1026 1182 esc_html__( 'Regularly cleaning the database can enhance performance, especially for high-traffic blogs. Enabling maintenance will automatically delete entries older than %s days from the daily tables.', 'top-10' ),
1183 + /** This filter is documented in includes/admin/class-cron.php */
1027 1184 '<strong>' . (int) apply_filters( 'tptn_maintenance_days', TOP_TEN_STORE_DATA ) . '</strong>'
1028 1185 ),
1029 1186 'type' => 'checkbox',
1030 1187 'default' => false,
@@ -1032,9 +1189,9 @@
1032 1189 'maintenance_days' => array(
1033 1190 'id' => 'maintenance_days',
1034 1191 'name' => esc_html__( 'Daily table retention period', 'top-10' ),
1035 1192 'desc' => sprintf(
1036 - /* translators: 1: Constant holding number of days data is stored. */
1193 + /* translators: 1: Constant holding number of days data is stored. */
1037 1194 esc_html__( 'Enter the number of days to retain data in the daily tables before scheduled maintenance removes older entries. Enter 0 to use the default value of %s days.', 'top-10' ),
1038 1195 '<strong>' . TOP_TEN_STORE_DATA . '</strong>'
1039 1196 ),
1040 1197 'type' => 'number',
@@ -1046,9 +1203,9 @@
1046 1203 'log_retention_days' => array(
1047 1204 'id' => 'log_retention_days',
1048 1205 'name' => esc_html__( 'Visits log retention period', 'top-10' ),
1049 1206 'desc' => sprintf(
1050 - /* translators: 1: Default number of days for visits log retention. */
1207 + /* translators: 1: Default number of days for visits log retention. */
1051 1208 esc_html__( 'Enter the number of days to retain raw visit rows in the visits log table. The log stores one row per visit and grows faster than the daily table, so a shorter window is recommended. Enter 0 to use the default value of %s days.', 'top-10' ),
1052 1209 '<strong>' . TOP_TEN_LOG_STORE_DATA . '</strong>'
1053 1210 ),
1054 1211 'type' => 'number',
@@ -1194,8 +1351,14 @@
1194 1351 'name' => '<h3>' . esc_html__( 'Features', 'top-10' ) . '</h3>',
1195 1352 'desc' => esc_html__( 'Turn off any features you do not use and the plugin will not load their code. All features are enabled by default. Blocks that are disabled will render as empty on the front end and show an unavailable notice in the block editor.', 'top-10' ),
1196 1353 'type' => 'header',
1197 1354 ),
1355 + 'features_display_header' => array(
1356 + 'id' => 'features_display_header',
1357 + 'name' => '<h3>' . esc_html__( 'Content and display', 'top-10' ) . '</h3>',
1358 + 'desc' => esc_html__( 'Control the blocks, widgets, page builders, and author tools registered by Top 10.', 'top-10' ),
1359 + 'type' => 'header',
1360 + ),
1198 1361 'enable_blocks' => array(
1199 1362 'id' => 'enable_blocks',
1200 1363 'name' => esc_html__( 'Popular Posts and Post Count blocks', 'top-10' ),
1201 1364 'desc' => esc_html__( 'Registers the free Popular Posts and Post Count blocks for the block editor.', 'top-10' ),
@@ -1201,15 +1364,8 @@
1201 1364 'desc' => esc_html__( 'Registers the free Popular Posts and Post Count blocks for the block editor.', 'top-10' ),
1202 1365 'type' => 'checkbox',
1203 1366 'default' => 1,
1204 1367 ),
1205 - 'enable_feed' => array(
1206 - 'id' => 'enable_feed',
1207 - 'name' => esc_html__( 'Popular posts feeds', 'top-10' ),
1208 - 'desc' => esc_html__( 'Adds custom RSS feeds for overall and daily popular posts. The feed settings are on the Feed tab.', 'top-10' ),
1209 - 'type' => 'checkbox',
1210 - 'default' => 1,
1211 - ),
1212 1368 'enable_legacy_widgets' => array(
1213 1369 'id' => 'enable_legacy_widgets',
1214 1370 'name' => esc_html__( 'Legacy widgets', 'top-10' ),
1215 1371 'desc' => esc_html__( 'Registers the classic Popular Posts and Views Count widgets. Disable this if you use blocks instead of classic widgets.', 'top-10' ),
@@ -1239,8 +1395,37 @@
1239 1395 'type' => 'checkbox',
1240 1396 'default' => 1,
1241 1397 'pro' => true,
1242 1398 ),
1399 + 'enable_page_builders' => array(
1400 + 'id' => 'enable_page_builders',
1401 + 'name' => esc_html__( 'Page builder integrations', 'top-10' ),
1402 + 'desc' => esc_html__( 'Registers the Popular Posts elements for Elementor, Bricks Builder, and WPBakery Page Builder.', 'top-10' ),
1403 + 'type' => 'checkbox',
1404 + 'default' => 1,
1405 + 'pro' => true,
1406 + ),
1407 + 'enable_popular_authors' => array(
1408 + 'id' => 'enable_popular_authors',
1409 + 'name' => esc_html__( 'Popular Authors', 'top-10' ),
1410 + 'desc' => esc_html__( 'Enables the Popular Authors blocks, shortcodes, widgets and settings.', 'top-10' ),
1411 + 'type' => 'checkbox',
1412 + 'default' => 1,
1413 + 'pro' => true,
1414 + ),
1415 + 'features_tracking_header' => array(
1416 + 'id' => 'features_tracking_header',
1417 + 'name' => '<h3>' . esc_html__( 'Tracking and feeds', 'top-10' ) . '</h3>',
1418 + 'desc' => esc_html__( 'Control how Top 10 records views and provides popular posts feeds.', 'top-10' ),
1419 + 'type' => 'header',
1420 + ),
1421 + 'enable_feed' => array(
1422 + 'id' => 'enable_feed',
1423 + 'name' => esc_html__( 'Popular posts feeds', 'top-10' ),
1424 + 'desc' => esc_html__( 'Adds custom RSS feeds for overall and daily popular posts. The feed settings are on the Feed tab.', 'top-10' ),
1425 + 'type' => 'checkbox',
1426 + 'default' => 1,
1427 + ),
1243 1428 'enable_fast_tracker' => array(
1244 1429 'id' => 'enable_fast_tracker',
1245 1430 'name' => esc_html__( 'Fast and High-traffic trackers', 'top-10' ),
1246 1431 'desc' => esc_html__( 'Adds the Fast tracker and High-traffic tracker options to the Tracker type setting. If this is disabled while one of these trackers is in use, the tracker type will be reset to the default.', 'top-10' ),
@@ -1247,8 +1432,36 @@
1247 1432 'type' => 'checkbox',
1248 1433 'default' => 1,
1249 1434 'pro' => true,
1250 1435 ),
1436 + 'enable_sitewide_tracking' => array(
1437 + 'id' => 'enable_sitewide_tracking',
1438 + 'name' => esc_html__( 'Site-wide tracking', 'top-10' ),
1439 + 'desc' => esc_html__( 'Enables the site-wide tracking feature. When enabled, turn on Track site-wide views under Counter/Tracker to count front pages, posts pages, archives, and searches.', 'top-10' ),
1440 + 'type' => 'checkbox',
1441 + 'default' => 1,
1442 + 'pro' => true,
1443 + ),
1444 + 'features_data_header' => array(
1445 + 'id' => 'features_data_header',
1446 + 'name' => '<h3>' . esc_html__( 'Data and maintenance', 'top-10' ) . '</h3>',
1447 + 'desc' => esc_html__( 'Control tools that manage and reduce stored view data.', 'top-10' ),
1448 + 'type' => 'header',
1449 + ),
1450 + 'enable_daily_table_rollup' => array(
1451 + 'id' => 'enable_daily_table_rollup',
1452 + 'name' => esc_html__( 'Daily table size reduction', 'top-10' ),
1453 + 'desc' => esc_html__( 'Enables the Reduce Daily Table Size tool and the wp top10 db rollup command for combining older hourly records.', 'top-10' ),
1454 + 'type' => 'checkbox',
1455 + 'default' => 1,
1456 + 'pro' => true,
1457 + ),
1458 + 'features_admin_header' => array(
1459 + 'id' => 'features_admin_header',
1460 + 'name' => '<h3>' . esc_html__( 'Administration', 'top-10' ) . '</h3>',
1461 + 'desc' => esc_html__( 'Control additional Top 10 administration features.', 'top-10' ),
1462 + 'type' => 'header',
1463 + ),
1251 1464 'enable_pro_dashboard_widgets' => array(
1252 1465 'id' => 'enable_pro_dashboard_widgets',
1253 1466 'name' => esc_html__( 'Pro dashboard widgets', 'top-10' ),
1254 1467 'desc' => esc_html__( 'Adds the enhanced Top 10 Pro widgets to the WordPress dashboard.', 'top-10' ),
@@ -1255,16 +1468,8 @@
1255 1468 'type' => 'checkbox',
1256 1469 'default' => 1,
1257 1470 'pro' => true,
1258 1471 ),
1259 - 'enable_popular_authors' => array(
1260 - 'id' => 'enable_popular_authors',
1261 - 'name' => esc_html__( 'Popular Authors', 'top-10' ),
1262 - 'desc' => esc_html__( 'Enables the Popular Authors blocks, shortcodes, widgets and settings.', 'top-10' ),
1263 - 'type' => 'checkbox',
1264 - 'default' => 1,
1265 - 'pro' => true,
1266 - ),
1267 1472 );
1268 1473
1269 1474 /**
1270 1475 * Filters the Features settings array
@@ -1278,9 +1483,9 @@
1278 1483
1279 1484 /**
1280 1485 * Get the various styles.
1281 1486 *
1282 - * @since 2.5.0
1487 + * @since 2.5.0
1283 1488 * @return array Style options.
1284 1489 */
1285 1490 public static function get_styles() {
1286 1491 $styles = array(
@@ -1315,9 +1520,9 @@
1315 1520 * Get User Roles.
1316 1521 *
1317 1522 * @since 4.0.0
1318 1523 *
1319 - * @param array $remove_roles Roles to remove.
1524 + * @param array $remove_roles Roles to remove.
1320 1525 * @return array User roles in the format 'role' => 'name'.
1321 1526 */
1322 1527 public static function get_user_roles( $remove_roles = array() ) {
1323 1528 // Get the global $wp_roles object using the wp_roles() function.
@@ -1358,9 +1563,9 @@
1358 1563 * Adding WordPress plugin action links.
1359 1564 *
1360 1565 * @since 3.3.0
1361 1566 *
1362 - * @param array $links Array of links.
1567 + * @param array $links Array of links.
1363 1568 * @return array
1364 1569 */
1365 1570 public function plugin_actions_links( $links ) {
1366 1571
@@ -1376,10 +1581,10 @@
1376 1581 * Add meta links on Plugins page.
1377 1582 *
1378 1583 * @since 3.3.0
1379 1584 *
1380 - * @param array $links Array of Links.
1381 - * @param string $file Current file.
1585 + * @param array $links Array of Links.
1586 + * @param string $file Current file.
1382 1587 * @return array
1383 1588 */
1384 1589 public function plugin_row_meta( $links, $file ) {
1385 1590
@@ -1401,18 +1606,18 @@
1401 1606 * @since 1.8.0
1402 1607 */
1403 1608 public function get_help_sidebar() {
1404 1609 $help_sidebar =
1405 - /* translators: 1: Plugin support site link. */
1406 - '<p>' . sprintf( __( 'For more information or how to get support visit the <a href="%s">support site</a>.', 'top-10' ), esc_url( 'https://webberzone.com/support/' ) ) . '</p>' .
1407 - /* translators: 1: WordPress.org support forums link. */
1408 - '<p>' . sprintf( __( 'Support queries should be posted in the <a href="%s">WordPress.org support forums</a>.', 'top-10' ), esc_url( 'https://wordpress.org/support/plugin/top-10' ) ) . '</p>' .
1409 - '<p>' . sprintf(
1410 - /* translators: 1: Github issues link, 2: Github plugin page link. */
1411 - __( '<a href="%1$s">Post an issue</a> on <a href="%2$s">GitHub</a> (bug reports only).', 'top-10' ),
1412 - esc_url( 'https://github.com/ajaydsouza/top-10/issues' ),
1413 - esc_url( 'https://github.com/ajaydsouza/top-10' )
1414 - ) . '</p>';
1610 + /* translators: 1: Plugin support site link. */
1611 + '<p>' . sprintf( __( 'For more information or how to get support visit the <a href="%s">support site</a>.', 'top-10' ), esc_url( 'https://webberzone.com/support/' ) ) . '</p>' .
1612 + /* translators: 1: WordPress.org support forums link. */
1613 + '<p>' . sprintf( __( 'Support queries should be posted in the <a href="%s">WordPress.org support forums</a>.', 'top-10' ), esc_url( 'https://wordpress.org/support/plugin/top-10' ) ) . '</p>' .
1614 + '<p>' . sprintf(
1615 + /* translators: 1: Github issues link, 2: Github plugin page link. */
1616 + __( '<a href="%1$s">Post an issue</a> on <a href="%2$s">GitHub</a> (bug reports only).', 'top-10' ),
1617 + esc_url( 'https://github.com/ajaydsouza/top-10/issues' ),
1618 + esc_url( 'https://github.com/ajaydsouza/top-10' )
1619 + ) . '</p>';
1415 1620
1416 1621 /**
1417 1622 * Filter to modify the help sidebar content.
1418 1623 *
@@ -1434,9 +1639,9 @@
1434 1639 'id' => 'tptn-settings-general-help',
1435 1640 'title' => esc_html__( 'General', 'top-10' ),
1436 1641 'content' =>
1437 1642 '<p><strong>' . esc_html__( 'This tab provides global settings for how Top 10 works across your site.', 'top-10' ) . '</strong></p>' .
1438 - '<p>' . esc_html__( 'Configure caching, uninstall behaviour, admin columns, the dashboard, and other high-level options. You must click the Save Changes button at the bottom of the screen for new settings to take effect.', 'top-10' ) . '</p>',
1643 + '<p>' . esc_html__( 'Configure caching, uninstall behaviour, admin columns, the dashboard, and other high-level options. You must click the Save Changes button at the bottom of the screen for new settings to take effect.', 'top-10' ) . '</p>',
1439 1644 ),
1440 1645 array(
1441 1646 'id' => 'tptn-settings-counter-help',
1442 1647 'title' => esc_html__( 'Counter / Tracker', 'top-10' ),
@@ -1441,9 +1646,9 @@
1441 1646 'id' => 'tptn-settings-counter-help',
1442 1647 'title' => esc_html__( 'Counter / Tracker', 'top-10' ),
1443 1648 'content' =>
1444 1649 '<p><strong>' . esc_html__( 'This tab controls how Top 10 tracks and displays view counts.', 'top-10' ) . '</strong></p>' .
1445 - '<p>' . esc_html__( 'Choose where to display view counts, how they are formatted, which visits are tracked, and how the tracker works (REST API, query variables, or Ajax).', 'top-10' ) . '</p>',
1650 + '<p>' . esc_html__( 'Choose where to display view counts, how they are formatted, which visits are tracked, and how the tracker works (REST API, query variables, or Ajax).', 'top-10' ) . '</p>',
1446 1651 ),
1447 1652 array(
1448 1653 'id' => 'tptn-settings-list-help',
1449 1654 'title' => esc_html__( 'Posts list', 'top-10' ),
@@ -1448,9 +1653,9 @@
1448 1653 'id' => 'tptn-settings-list-help',
1449 1654 'title' => esc_html__( 'Posts list', 'top-10' ),
1450 1655 'content' =>
1451 1656 '<p><strong>' . esc_html__( 'This tab controls the popular posts list output.', 'top-10' ) . '</strong></p>' .
1452 - '<p>' . esc_html__( 'Configure the number of posts, age of posts, post types, exclusions, and what information is shown (title, date, author, views, excerpts, and HTML wrappers).', 'top-10' ) . '</p>',
1657 + '<p>' . esc_html__( 'Configure the number of posts, age of posts, post types, exclusions, and what information is shown (title, date, author, views, excerpts, and HTML wrappers).', 'top-10' ) . '</p>',
1453 1658 ),
1454 1659 array(
1455 1660 'id' => 'tptn-settings-thumbnail-help',
1456 1661 'title' => esc_html__( 'Thumbnail', 'top-10' ),
@@ -1455,9 +1660,9 @@
1455 1660 'id' => 'tptn-settings-thumbnail-help',
1456 1661 'title' => esc_html__( 'Thumbnail', 'top-10' ),
1457 1662 'content' =>
1458 1663 '<p><strong>' . esc_html__( 'This tab manages thumbnail settings for the popular posts list.', 'top-10' ) . '</strong></p>' .
1459 - '<p>' . esc_html__( 'Choose whether thumbnails are displayed, select the image size, configure custom dimensions, cropping, the default thumbnail, and fallback behaviour when no thumbnail is found.', 'top-10' ) . '</p>',
1664 + '<p>' . esc_html__( 'Choose whether thumbnails are displayed, select the image size, configure custom dimensions, cropping, the default thumbnail, and fallback behaviour when no thumbnail is found.', 'top-10' ) . '</p>',
1460 1665 ),
1461 1666 array(
1462 1667 'id' => 'tptn-settings-styles-help',
1463 1668 'title' => esc_html__( 'Styles', 'top-10' ),
@@ -1462,9 +1667,9 @@
1462 1667 'id' => 'tptn-settings-styles-help',
1463 1668 'title' => esc_html__( 'Styles', 'top-10' ),
1464 1669 'content' =>
1465 1670 '<p><strong>' . esc_html__( 'This tab controls how the popular posts list is styled.', 'top-10' ) . '</strong></p>' .
1466 - '<p>' . esc_html__( 'Select a built-in style or disable styles if you want to fully control the look using your own CSS.', 'top-10' ) . '</p>',
1671 + '<p>' . esc_html__( 'Select a built-in style or disable styles if you want to fully control the look using your own CSS.', 'top-10' ) . '</p>',
1467 1672 ),
1468 1673 array(
1469 1674 'id' => 'tptn-settings-maintenance-help',
1470 1675 'title' => esc_html__( 'Maintenance', 'top-10' ),
@@ -1469,9 +1674,9 @@
1469 1674 'id' => 'tptn-settings-maintenance-help',
1470 1675 'title' => esc_html__( 'Maintenance', 'top-10' ),
1471 1676 'content' =>
1472 1677 '<p><strong>' . esc_html__( 'This tab handles tools and maintenance-related options.', 'top-10' ) . '</strong></p>' .
1473 - '<p>' . esc_html__( 'Use this screen to reset settings, clear cached popular posts, and manage database-related options such as pruning or rebuilding counts.', 'top-10' ) . '</p>',
1678 + '<p>' . esc_html__( 'Use this screen to reset settings, clear cached popular posts, and manage database-related options such as pruning or rebuilding counts.', 'top-10' ) . '</p>',
1474 1679 ),
1475 1680 array(
1476 1681 'id' => 'tptn-settings-feed-help',
1477 1682 'title' => esc_html__( 'Feed', 'top-10' ),
@@ -1476,9 +1681,9 @@
1476 1681 'id' => 'tptn-settings-feed-help',
1477 1682 'title' => esc_html__( 'Feed', 'top-10' ),
1478 1683 'content' =>
1479 1684 '<p><strong>' . esc_html__( 'This tab controls how Top 10 content appears in your site feed.', 'top-10' ) . '</strong></p>' .
1480 - '<p>' . esc_html__( 'Configure copyright text and additional HTML that is added before or after the content in your feeds.', 'top-10' ) . '</p>',
1685 + '<p>' . esc_html__( 'Configure copyright text and additional HTML that is added before or after the content in your feeds.', 'top-10' ) . '</p>',
1481 1686 ),
1482 1687 );
1483 1688
1484 1689 /**
@@ -1493,9 +1698,9 @@
1493 1698
1494 1699 /**
1495 1700 * Function returns the different types of trackers.
1496 1701 *
1497 - * @since 3.3.0
1702 + * @since 3.3.0
1498 1703 * @return array Tracker types.
1499 1704 */
1500 1705 public static function get_tracker_types() {
1501 1706
@@ -1529,9 +1734,9 @@
1529 1734
1530 1735 /**
1531 1736 * Function returns the different tracking methods.
1532 1737 *
1533 - * @since 4.3.3
1738 + * @since 4.3.3
1534 1739 * @return array Tracking methods.
1535 1740 */
1536 1741 public static function get_tracking_methods() {
1537 1742
@@ -1567,9 +1772,9 @@
1567 1772 * @since 2.0.0
1568 1773 */
1569 1774 public static function get_admin_footer_text() {
1570 1775 return sprintf(
1571 - /* translators: 1: Opening achor tag with Plugin page link, 2: Closing anchor tag, 3: Opening anchor tag with review link. */
1776 + /* translators: 1: Opening achor tag with Plugin page link, 2: Closing anchor tag, 3: Opening anchor tag with review link. */
1572 1777 __( 'Thank you for using %1$sWebberZone Top 10%2$s! Please %3$srate us%2$s on WordPress.org', 'top-10' ),
1573 1778 '<a href="https://webberzone.com/plugins/top-10/" target="_blank">',
1574 1779 '</a>',
1575 1780 '<a href="https://wordpress.org/support/plugin/top-10/reviews/#new-post" target="_blank">'
@@ -1747,13 +1952,13 @@
1747 1952 public static function settings_page_header() {
1748 1953 global $tptn_freemius;
1749 1954 ?>
1750 1955 <p>
1751 - <?php if ( ! $tptn_freemius->is_paying() ) { ?>
1956 + <?php if ( ! $tptn_freemius->is_paying() ) { ?>
1752 1957 <a class="tptn_button tptn_button_gold" href="<?php echo esc_url( $tptn_freemius->get_upgrade_url() ); ?>">
1753 - <?php esc_html_e( 'Upgrade to Pro', 'top-10' ); ?>
1958 + <?php esc_html_e( 'Upgrade to Pro', 'top-10' ); ?>
1754 1959 </a>
1755 - <?php } ?>
1960 + <?php } ?>
1756 1961 </p>
1757 1962
1758 1963 <?php
1759 1964 }
@@ -1760,10 +1965,10 @@
1760 1965
1761 1966 /**
1762 1967 * Updated the settings fields to display a pro version link.
1763 1968 *
1764 - * @param string $output Settings field HTML.
1765 - * @param array $args Settings field arguments.
1969 + * @param string $output Settings field HTML.
1970 + * @param array $args Settings field arguments.
1766 1971 * @return string Updated HTML.
1767 1972 */
1768 1973 public static function after_setting_output( $output, $args ) {
1769 1974 if ( isset( $args['pro'] ) && $args['pro'] ) {
@@ -1845,9 +2050,9 @@
1845 2050 if ( false !== strpos( $search_term, ',' ) ) {
1846 2051 $search_term = explode( ',', $search_term );
1847 2052 $search_term = $search_term[ count( $search_term ) - 1 ];
1848 2053 }
1849 - $search_term = trim( $search_term );
2054 + $search_term = trim( $search_term, " \t\n\r\0\x0B" );
1850 2055
1851 2056 if ( 'public_taxonomies' === $endpoint ) {
1852 2057 $taxonomies = (array) get_taxonomies( array( 'public' => true ), 'objects' );
1853 2058 $taxonomy = array();
@@ -1882,15 +2087,17 @@
1882 2087 wp_send_json_error( 'Insufficient permissions' );
1883 2088 }
1884 2089 }
1885 2090
1886 - /** This filter has been defined in /wp-admin/includes/ajax-actions.php */
2091 + /**
2092 + * This filter has been defined in /wp-admin/includes/ajax-actions.php
2093 +*/
1887 2094 $term_search_min_chars = (int) apply_filters( 'term_search_min_chars', 2, $tax, $search_term );
1888 2095
1889 2096 /*
1890 - * Require $term_search_min_chars chars for matching (default: 2)
1891 - * ensure it's a non-negative, non-zero integer.
1892 - */
2097 + * Require $term_search_min_chars chars for matching (default: 2)
2098 + * ensure it's a non-negative, non-zero integer.
2099 + */
1893 2100 if ( ( 0 === $term_search_min_chars ) || ( strlen( $search_term ) < $term_search_min_chars ) ) {
1894 2101 wp_send_json_success( array() );
1895 2102 }
1896 2103
@@ -1918,10 +2125,10 @@
1918 2125 * Get field attributes for Tom Select taxonomy search fields.
1919 2126 *
1920 2127 * @since 4.2.0
1921 2128 *
1922 - * @param string $taxonomy The taxonomy to search.
1923 - * @param array $ts_config Optional Tom Select configuration.
2129 + * @param string $taxonomy The taxonomy to search.
2130 + * @param array $ts_config Optional Tom Select configuration.
1924 2131 * @return array Field attributes array.
1925 2132 */
1926 2133 private static function get_taxonomy_search_field_attributes( $taxonomy, $ts_config = array() ) {
1927 2134 $attributes = array(
@@ -1942,9 +2149,9 @@
1942 2149 * Get field attributes for Tom Select meta key search fields.
1943 2150 *
1944 2151 * @since 4.2.0
1945 2152 *
1946 - * @param array $ts_config Optional Tom Select configuration.
2153 + * @param array $ts_config Optional Tom Select configuration.
1947 2154 * @return array Field attributes array.
1948 2155 */
1949 2156 private static function get_meta_keys_search_field_attributes( $ts_config = array() ) {
1950 2157 $attributes = array(