PluginProbe
WebberZone Top 10 — Popular Posts / 4.5.2
WebberZone Top 10 — Popular Posts v4.5.2
4.5.2 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 All 118 releases
← All changes | includes/admin/class-settings.php +297 -56 4.4.0 → 4.5.2 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
@@ -136,8 +137,11 @@
136 137 'modified_field' => esc_html__( 'Modified from default setting', 'top-10' ),
137 138 'modified_legend' => esc_html__( 'Setting modified from its default value', 'top-10' ),
138 139 'default_label' => esc_html__( 'Default', 'top-10' ),
139 140 'default_none' => esc_html__( 'None', 'top-10' ),
141 + 'repeater_move_up' => esc_html__( 'Move item up', 'top-10' ),
142 + 'repeater_move_down' => esc_html__( 'Move item down', 'top-10' ),
143 + 'repeater_remove_item' => esc_html__( 'Remove item', 'top-10' ),
140 144 );
141 145
142 146 /**
143 147 * Filter the array containing the settings' sections.
@@ -200,8 +204,159 @@
200 204 }
201 205
202 206
203 207 /**
208 + * Raw defaults for every registered setting, keyed by option ID.
209 + *
210 + * Must exactly match what `tptn_settings_defaults()` computes from
211 + * {@see self::get_registered_settings()}, but without building the full
212 + * (translated) field definitions. Values are pre-normalized: checkboxes are
213 + * `1`/`0`, not `true`/`false`. Computed defaults (e.g. `thumb_default`) are
214 + * represented as `''` here since their real value cannot be known statically.
215 + *
216 + * @since 4.4.2
217 + *
218 + * @return array<string, mixed> Default value for every option ID.
219 + */
220 + public static function get_defaults() {
221 + return array(
222 + 'features_header' => '',
223 + 'features_display_header' => '',
224 + 'features_performance_header' => '',
225 + 'enable_blocks' => 1,
226 + 'enable_legacy_widgets' => 1,
227 + 'enable_rest_api' => 1,
228 + 'enable_query_block' => 1,
229 + 'enable_featured_image_block' => 1,
230 + 'enable_popular_posts_pro_block' => 1,
231 + 'enable_page_builders' => 1,
232 + 'enable_popular_authors' => 1,
233 + 'features_tracking_header' => '',
234 + 'enable_feed' => 1,
235 + 'enable_fast_tracker' => 1,
236 + 'enable_sitewide_tracking' => 1,
237 + 'features_data_header' => '',
238 + 'enable_daily_table_rollup' => 1,
239 + 'features_admin_header' => '',
240 + 'features_api_header' => '',
241 + 'enable_pro_dashboard_widgets' => 1,
242 + 'enable_lazy_load' => 1,
243 + 'cache' => 1,
244 + 'cache_time' => HOUR_IN_SECONDS,
245 + 'lazy_load' => 0,
246 + 'uninstall_clean_options' => 1,
247 + 'uninstall_clean_tables' => 0,
248 + 'show_credit' => 0,
249 + 'admin_header' => '',
250 + 'show_metabox' => 1,
251 + 'show_metabox_admins' => 0,
252 + 'pv_in_admin' => 1,
253 + 'admin_column_post_types' => 'post,page',
254 + 'show_count_non_admins' => 1,
255 + 'show_dashboard_to_roles' => 'administrator',
256 + 'show_admin_bar' => 1,
257 + 'query_optimization' => '',
258 + 'max_execution_time' => 3000,
259 + 'counter_header' => '',
260 + 'add_to' => 'single,page',
261 + 'count_disp_form' => 'Visited %totalcount% times, %dailycount% visit(s) today',
262 + 'count_disp_form_zero' => 'No visits yet',
263 + 'number_format_count' => 1,
264 + 'number_format_style' => 'full',
265 + 'daily_midnight' => 1,
266 + 'range_desc' => '',
267 + 'daily_range' => '1',
268 + 'hour_range' => '0',
269 + 'dynamic_post_count' => 0,
270 + 'exclude_on_post_ids' => '',
271 + 'tracker_header' => '',
272 + 'trackers' => 'overall,daily',
273 + 'tracker_type' => 'query_based',
274 + 'tracking_method' => 'funnel',
275 + 'tracker_all_pages' => 0,
276 + 'track_sitewide' => 0,
277 + 'track_feed_views' => 0,
278 + 'track_users' => 'authors,editors,admins',
279 + 'logged_in' => 1,
280 + 'no_bots' => 0,
281 + 'debug_mode' => 0,
282 + 'use_global_settings' => 0,
283 + 'limit' => '10',
284 + 'how_old' => '0',
285 + 'post_types' => 'post',
286 + 'exclusion_header' => '',
287 + 'exclude_front' => 0,
288 + 'exclude_current_post' => 0,
289 + 'exclude_post_ids' => '',
290 + 'exclude_cat_slugs' => '',
291 + 'exclude_categories' => '',
292 + 'exclude_terms_include_parents' => 'none',
293 + 'exclude_on_cat_slugs' => '',
294 + 'customize_output_header' => '',
295 + 'title' => '<h3>Popular posts:</h3>',
296 + 'title_daily' => '<h3>Currently trending:</h3>',
297 + 'blank_output' => 'blank',
298 + 'blank_output_text' => 'No top posts yet',
299 + 'show_excerpt' => 0,
300 + 'excerpt_length' => '10',
301 + 'show_date' => 0,
302 + 'show_author' => 0,
303 + 'disp_list_count' => 0,
304 + 'show_ratings' => '',
305 + 'title_length' => '60',
306 + 'link_new_window' => 0,
307 + 'link_nofollow' => 0,
308 + 'html_wrapper_header' => '',
309 + 'before_list' => '<ul>',
310 + 'after_list' => '</ul>',
311 + 'before_list_item' => '<li>',
312 + 'after_list_item' => '</li>',
313 + 'post_thumb_op' => 'text_only',
314 + 'thumb_size' => 'tptn_thumbnail',
315 + 'thumb_width' => '250',
316 + 'thumb_height' => '250',
317 + 'thumb_crop' => 1,
318 + 'thumb_create_sizes' => 1,
319 + 'thumb_html' => 'html',
320 + 'thumb_meta' => 'post-image',
321 + 'scan_images' => 1,
322 + 'thumb_default_show' => 1,
323 + 'thumb_default' => '',
324 + 'tptn_styles' => 'no_style',
325 + 'custom_css' => '',
326 + 'cron_on' => 0,
327 + 'maintenance_days' => 0,
328 + 'log_retention_days' => 0,
329 + 'cron_range_desc' => '',
330 + 'cron_hour' => '0',
331 + 'cron_min' => '0',
332 + 'cron_recurrence' => 'weekly',
333 + 'feed_permalink_overall' => 'popular-posts',
334 + 'feed_permalink_daily' => 'popular-posts-daily',
335 + 'feed_limit' => '10',
336 + 'feed_daily_range' => '1',
337 + 'feed_category_slugs' => '',
338 + 'wzpa_number' => 10,
339 + 'wzpa_daily_range' => 1,
340 + 'wzpa_hour_range' => 0,
341 + 'wzpa_optioncount' => 0,
342 + 'wzpa_show_postcount' => 0,
343 + 'wzpa_show_fullname' => 0,
344 + 'wzpa_show_avatar' => 0,
345 + 'wzpa_exclude_admin' => 0,
346 + 'wzpa_post_type' => 'post',
347 + 'wzpa_cache' => 1,
348 + 'wzpa_styles_desc' => '',
349 + 'wzpa_styles' => 'no_style',
350 + 'wzpa_html_wrapper_header' => '',
351 + 'wzpa_before_list' => '<ul>',
352 + 'wzpa_after_list' => '</ul>',
353 + 'wzpa_before_list_item' => '<li>',
354 + 'wzpa_after_list_item' => '</li>',
355 + );
356 + }
357 +
358 + /**
204 359 * Retrieve the array of plugin settings
205 360 *
206 361 * @since 3.3.0
207 362 *
@@ -520,8 +675,16 @@
520 675 'desc' => esc_html__( 'This will load the tracker js on all pages. Helpful if you are running minification/concatenation plugins.', 'top-10' ),
521 676 'type' => 'checkbox',
522 677 'default' => false,
523 678 ),
679 + 'track_sitewide' => array(
680 + 'id' => 'track_sitewide',
681 + 'name' => esc_html__( 'Track site-wide views', 'top-10' ),
682 + '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' ),
683 + 'type' => 'checkbox',
684 + 'default' => false,
685 + 'pro' => true,
686 + ),
524 687 'track_feed_views' => array(
525 688 'id' => 'track_feed_views',
526 689 'name' => esc_html__( 'Track feed views', 'top-10' ),
527 690 '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 +927,9 @@
764 927 ),
765 928 'show_ratings' => array(
766 929 'id' => 'show_ratings',
767 930 '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' ),
931 + '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 932 'type' => 'select',
770 933 'default' => '',
771 934 'options' => array(
772 935 '' => esc_html__( 'Do not display', 'top-10' ),
@@ -984,9 +1147,9 @@
984 1147 'custom_css' => array(
985 1148 'id' => 'custom_css',
986 1149 'name' => esc_html__( 'Custom CSS', 'top-10' ),
987 1150 'desc' => sprintf(
988 - /* translators: 1: Opening a tag, 2: Closing a tag, 3: Opening code tage, 4. Closing code tag. */
1151 + /* translators: 1: Opening a tag, 2: Closing a tag, 3: Opening code tage, 4. Closing code tag. */
989 1152 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 1153 '<a href="' . esc_url( 'https://webberzone.com/support/knowledgebase/using-and-customising-top-10/' ) . '" target="_blank">',
991 1154 '</a>',
992 1155 '<code>',
@@ -1021,10 +1184,11 @@
1021 1184 'cron_on' => array(
1022 1185 'id' => 'cron_on',
1023 1186 'name' => esc_html__( 'Enable scheduled maintenance', 'top-10' ),
1024 1187 'desc' => sprintf(
1025 - /* translators: 1: Constant holding number of days data is stored. */
1188 + /* translators: 1: Constant holding number of days data is stored. */
1026 1189 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' ),
1190 + /** This filter is documented in includes/admin/class-cron.php */
1027 1191 '<strong>' . (int) apply_filters( 'tptn_maintenance_days', TOP_TEN_STORE_DATA ) . '</strong>'
1028 1192 ),
1029 1193 'type' => 'checkbox',
1030 1194 'default' => false,
@@ -1032,9 +1196,9 @@
1032 1196 'maintenance_days' => array(
1033 1197 'id' => 'maintenance_days',
1034 1198 'name' => esc_html__( 'Daily table retention period', 'top-10' ),
1035 1199 'desc' => sprintf(
1036 - /* translators: 1: Constant holding number of days data is stored. */
1200 + /* translators: 1: Constant holding number of days data is stored. */
1037 1201 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 1202 '<strong>' . TOP_TEN_STORE_DATA . '</strong>'
1039 1203 ),
1040 1204 'type' => 'number',
@@ -1046,9 +1210,9 @@
1046 1210 'log_retention_days' => array(
1047 1211 'id' => 'log_retention_days',
1048 1212 'name' => esc_html__( 'Visits log retention period', 'top-10' ),
1049 1213 'desc' => sprintf(
1050 - /* translators: 1: Default number of days for visits log retention. */
1214 + /* translators: 1: Default number of days for visits log retention. */
1051 1215 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 1216 '<strong>' . TOP_TEN_LOG_STORE_DATA . '</strong>'
1053 1217 ),
1054 1218 'type' => 'number',
@@ -1194,8 +1358,14 @@
1194 1358 'name' => '<h3>' . esc_html__( 'Features', 'top-10' ) . '</h3>',
1195 1359 '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 1360 'type' => 'header',
1197 1361 ),
1362 + 'features_display_header' => array(
1363 + 'id' => 'features_display_header',
1364 + 'name' => '<h3>' . esc_html__( 'Content and display', 'top-10' ) . '</h3>',
1365 + 'desc' => esc_html__( 'Control the blocks, widgets, page builders, and author tools registered by Top 10.', 'top-10' ),
1366 + 'type' => 'header',
1367 + ),
1198 1368 'enable_blocks' => array(
1199 1369 'id' => 'enable_blocks',
1200 1370 'name' => esc_html__( 'Popular Posts and Post Count blocks', 'top-10' ),
1201 1371 'desc' => esc_html__( 'Registers the free Popular Posts and Post Count blocks for the block editor.', 'top-10' ),
@@ -1201,15 +1371,8 @@
1201 1371 'desc' => esc_html__( 'Registers the free Popular Posts and Post Count blocks for the block editor.', 'top-10' ),
1202 1372 'type' => 'checkbox',
1203 1373 'default' => 1,
1204 1374 ),
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 1375 'enable_legacy_widgets' => array(
1213 1376 'id' => 'enable_legacy_widgets',
1214 1377 'name' => esc_html__( 'Legacy widgets', 'top-10' ),
1215 1378 '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 +1402,51 @@
1239 1402 'type' => 'checkbox',
1240 1403 'default' => 1,
1241 1404 'pro' => true,
1242 1405 ),
1406 + 'enable_page_builders' => array(
1407 + 'id' => 'enable_page_builders',
1408 + 'name' => esc_html__( 'Page builder integrations', 'top-10' ),
1409 + 'desc' => esc_html__( 'Registers the Popular Posts elements for Elementor, Bricks Builder, and WPBakery Page Builder.', 'top-10' ),
1410 + 'type' => 'checkbox',
1411 + 'default' => 1,
1412 + 'pro' => true,
1413 + ),
1414 + 'enable_popular_authors' => array(
1415 + 'id' => 'enable_popular_authors',
1416 + 'name' => esc_html__( 'Popular Authors', 'top-10' ),
1417 + 'desc' => esc_html__( 'Enables the Popular Authors blocks, shortcodes, widgets and settings.', 'top-10' ),
1418 + 'type' => 'checkbox',
1419 + 'default' => 1,
1420 + 'pro' => true,
1421 + ),
1422 + 'features_performance_header' => array(
1423 + 'id' => 'features_performance_header',
1424 + 'name' => '<h3>' . esc_html__( 'Performance', 'top-10' ) . '</h3>',
1425 + 'desc' => esc_html__( 'Control optional output performance modules.', 'top-10' ),
1426 + 'type' => 'header',
1427 + ),
1428 + 'enable_lazy_load' => array(
1429 + 'id' => 'enable_lazy_load',
1430 + 'name' => esc_html__( 'Lazy-load module', 'top-10' ),
1431 + 'desc' => esc_html__( 'Loads the lazy-loading module and its REST endpoint. Disable this to remove lazy-loading support, including per-shortcode and per-block lazy_load overrides. Requires REST API endpoints to be enabled.', 'top-10' ),
1432 + 'type' => 'checkbox',
1433 + 'default' => 1,
1434 + 'pro' => true,
1435 + ),
1436 + 'features_tracking_header' => array(
1437 + 'id' => 'features_tracking_header',
1438 + 'name' => '<h3>' . esc_html__( 'Tracking and feeds', 'top-10' ) . '</h3>',
1439 + 'desc' => esc_html__( 'Control how Top 10 records views and provides popular posts feeds.', 'top-10' ),
1440 + 'type' => 'header',
1441 + ),
1442 + 'enable_feed' => array(
1443 + 'id' => 'enable_feed',
1444 + 'name' => esc_html__( 'Popular posts feeds', 'top-10' ),
1445 + 'desc' => esc_html__( 'Adds custom RSS feeds for overall and daily popular posts. The feed settings are on the Feed tab.', 'top-10' ),
1446 + 'type' => 'checkbox',
1447 + 'default' => 1,
1448 + ),
1243 1449 'enable_fast_tracker' => array(
1244 1450 'id' => 'enable_fast_tracker',
1245 1451 'name' => esc_html__( 'Fast and High-traffic trackers', 'top-10' ),
1246 1452 '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 +1453,36 @@
1247 1453 'type' => 'checkbox',
1248 1454 'default' => 1,
1249 1455 'pro' => true,
1250 1456 ),
1457 + 'enable_sitewide_tracking' => array(
1458 + 'id' => 'enable_sitewide_tracking',
1459 + 'name' => esc_html__( 'Site-wide tracking', 'top-10' ),
1460 + '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' ),
1461 + 'type' => 'checkbox',
1462 + 'default' => 1,
1463 + 'pro' => true,
1464 + ),
1465 + 'features_data_header' => array(
1466 + 'id' => 'features_data_header',
1467 + 'name' => '<h3>' . esc_html__( 'Data and maintenance', 'top-10' ) . '</h3>',
1468 + 'desc' => esc_html__( 'Control tools that manage and reduce stored view data.', 'top-10' ),
1469 + 'type' => 'header',
1470 + ),
1471 + 'enable_daily_table_rollup' => array(
1472 + 'id' => 'enable_daily_table_rollup',
1473 + 'name' => esc_html__( 'Daily table size reduction', 'top-10' ),
1474 + 'desc' => esc_html__( 'Enables the Reduce Daily Table Size tool and the wp top10 db rollup command for combining older hourly records.', 'top-10' ),
1475 + 'type' => 'checkbox',
1476 + 'default' => 1,
1477 + 'pro' => true,
1478 + ),
1479 + 'features_admin_header' => array(
1480 + 'id' => 'features_admin_header',
1481 + 'name' => '<h3>' . esc_html__( 'Administration', 'top-10' ) . '</h3>',
1482 + 'desc' => esc_html__( 'Control additional Top 10 administration features.', 'top-10' ),
1483 + 'type' => 'header',
1484 + ),
1251 1485 'enable_pro_dashboard_widgets' => array(
1252 1486 'id' => 'enable_pro_dashboard_widgets',
1253 1487 'name' => esc_html__( 'Pro dashboard widgets', 'top-10' ),
1254 1488 'desc' => esc_html__( 'Adds the enhanced Top 10 Pro widgets to the WordPress dashboard.', 'top-10' ),
@@ -1255,15 +1489,20 @@
1255 1489 'type' => 'checkbox',
1256 1490 'default' => 1,
1257 1491 'pro' => true,
1258 1492 ),
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' ),
1493 + 'features_api_header' => array(
1494 + 'id' => 'features_api_header',
1495 + 'name' => '<h3>' . esc_html__( 'API integrations', 'top-10' ) . '</h3>',
1496 + 'desc' => esc_html__( 'Control the Top 10 REST API endpoints used by integrations, tracking, blocks, and lazy loading.', 'top-10' ),
1497 + 'type' => 'header',
1498 + ),
1499 + 'enable_rest_api' => array(
1500 + 'id' => 'enable_rest_api',
1501 + 'name' => esc_html__( 'REST API endpoints', 'top-10' ),
1502 + 'desc' => esc_html__( 'Registers the top-10/v1 endpoints for popular posts, tracking, counters, blocks, and lazy loading. Keep enabled if your tracker type is REST-based or if your integrations or blocks use these endpoints.', 'top-10' ),
1263 1503 'type' => 'checkbox',
1264 1504 'default' => 1,
1265 - 'pro' => true,
1266 1505 ),
1267 1506 );
1268 1507
1269 1508 /**
@@ -1278,9 +1517,9 @@
1278 1517
1279 1518 /**
1280 1519 * Get the various styles.
1281 1520 *
1282 - * @since 2.5.0
1521 + * @since 2.5.0
1283 1522 * @return array Style options.
1284 1523 */
1285 1524 public static function get_styles() {
1286 1525 $styles = array(
@@ -1315,9 +1554,9 @@
1315 1554 * Get User Roles.
1316 1555 *
1317 1556 * @since 4.0.0
1318 1557 *
1319 - * @param array $remove_roles Roles to remove.
1558 + * @param array $remove_roles Roles to remove.
1320 1559 * @return array User roles in the format 'role' => 'name'.
1321 1560 */
1322 1561 public static function get_user_roles( $remove_roles = array() ) {
1323 1562 // Get the global $wp_roles object using the wp_roles() function.
@@ -1358,9 +1597,9 @@
1358 1597 * Adding WordPress plugin action links.
1359 1598 *
1360 1599 * @since 3.3.0
1361 1600 *
1362 - * @param array $links Array of links.
1601 + * @param array $links Array of links.
1363 1602 * @return array
1364 1603 */
1365 1604 public function plugin_actions_links( $links ) {
1366 1605
@@ -1376,10 +1615,10 @@
1376 1615 * Add meta links on Plugins page.
1377 1616 *
1378 1617 * @since 3.3.0
1379 1618 *
1380 - * @param array $links Array of Links.
1381 - * @param string $file Current file.
1619 + * @param array $links Array of Links.
1620 + * @param string $file Current file.
1382 1621 * @return array
1383 1622 */
1384 1623 public function plugin_row_meta( $links, $file ) {
1385 1624
@@ -1401,18 +1640,18 @@
1401 1640 * @since 1.8.0
1402 1641 */
1403 1642 public function get_help_sidebar() {
1404 1643 $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>';
1644 + /* translators: 1: Plugin support site link. */
1645 + '<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>' .
1646 + /* translators: 1: WordPress.org support forums link. */
1647 + '<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>' .
1648 + '<p>' . sprintf(
1649 + /* translators: 1: Github issues link, 2: Github plugin page link. */
1650 + __( '<a href="%1$s">Post an issue</a> on <a href="%2$s">GitHub</a> (bug reports only).', 'top-10' ),
1651 + esc_url( 'https://github.com/ajaydsouza/top-10/issues' ),
1652 + esc_url( 'https://github.com/ajaydsouza/top-10' )
1653 + ) . '</p>';
1415 1654
1416 1655 /**
1417 1656 * Filter to modify the help sidebar content.
1418 1657 *
@@ -1434,9 +1673,9 @@
1434 1673 'id' => 'tptn-settings-general-help',
1435 1674 'title' => esc_html__( 'General', 'top-10' ),
1436 1675 'content' =>
1437 1676 '<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>',
1677 + '<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 1678 ),
1440 1679 array(
1441 1680 'id' => 'tptn-settings-counter-help',
1442 1681 'title' => esc_html__( 'Counter / Tracker', 'top-10' ),
@@ -1441,9 +1680,9 @@
1441 1680 'id' => 'tptn-settings-counter-help',
1442 1681 'title' => esc_html__( 'Counter / Tracker', 'top-10' ),
1443 1682 'content' =>
1444 1683 '<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>',
1684 + '<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 1685 ),
1447 1686 array(
1448 1687 'id' => 'tptn-settings-list-help',
1449 1688 'title' => esc_html__( 'Posts list', 'top-10' ),
@@ -1448,9 +1687,9 @@
1448 1687 'id' => 'tptn-settings-list-help',
1449 1688 'title' => esc_html__( 'Posts list', 'top-10' ),
1450 1689 'content' =>
1451 1690 '<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>',
1691 + '<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 1692 ),
1454 1693 array(
1455 1694 'id' => 'tptn-settings-thumbnail-help',
1456 1695 'title' => esc_html__( 'Thumbnail', 'top-10' ),
@@ -1455,9 +1694,9 @@
1455 1694 'id' => 'tptn-settings-thumbnail-help',
1456 1695 'title' => esc_html__( 'Thumbnail', 'top-10' ),
1457 1696 'content' =>
1458 1697 '<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>',
1698 + '<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 1699 ),
1461 1700 array(
1462 1701 'id' => 'tptn-settings-styles-help',
1463 1702 'title' => esc_html__( 'Styles', 'top-10' ),
@@ -1462,9 +1701,9 @@
1462 1701 'id' => 'tptn-settings-styles-help',
1463 1702 'title' => esc_html__( 'Styles', 'top-10' ),
1464 1703 'content' =>
1465 1704 '<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>',
1705 + '<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 1706 ),
1468 1707 array(
1469 1708 'id' => 'tptn-settings-maintenance-help',
1470 1709 'title' => esc_html__( 'Maintenance', 'top-10' ),
@@ -1469,9 +1708,9 @@
1469 1708 'id' => 'tptn-settings-maintenance-help',
1470 1709 'title' => esc_html__( 'Maintenance', 'top-10' ),
1471 1710 'content' =>
1472 1711 '<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>',
1712 + '<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 1713 ),
1475 1714 array(
1476 1715 'id' => 'tptn-settings-feed-help',
1477 1716 'title' => esc_html__( 'Feed', 'top-10' ),
@@ -1476,9 +1715,9 @@
1476 1715 'id' => 'tptn-settings-feed-help',
1477 1716 'title' => esc_html__( 'Feed', 'top-10' ),
1478 1717 'content' =>
1479 1718 '<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>',
1719 + '<p>' . esc_html__( 'Configure copyright text and additional HTML that is added before or after the content in your feeds.', 'top-10' ) . '</p>',
1481 1720 ),
1482 1721 );
1483 1722
1484 1723 /**
@@ -1493,9 +1732,9 @@
1493 1732
1494 1733 /**
1495 1734 * Function returns the different types of trackers.
1496 1735 *
1497 - * @since 3.3.0
1736 + * @since 3.3.0
1498 1737 * @return array Tracker types.
1499 1738 */
1500 1739 public static function get_tracker_types() {
1501 1740
@@ -1529,9 +1768,9 @@
1529 1768
1530 1769 /**
1531 1770 * Function returns the different tracking methods.
1532 1771 *
1533 - * @since 4.3.3
1772 + * @since 4.3.3
1534 1773 * @return array Tracking methods.
1535 1774 */
1536 1775 public static function get_tracking_methods() {
1537 1776
@@ -1567,9 +1806,9 @@
1567 1806 * @since 2.0.0
1568 1807 */
1569 1808 public static function get_admin_footer_text() {
1570 1809 return sprintf(
1571 - /* translators: 1: Opening achor tag with Plugin page link, 2: Closing anchor tag, 3: Opening anchor tag with review link. */
1810 + /* translators: 1: Opening achor tag with Plugin page link, 2: Closing anchor tag, 3: Opening anchor tag with review link. */
1572 1811 __( 'Thank you for using %1$sWebberZone Top 10%2$s! Please %3$srate us%2$s on WordPress.org', 'top-10' ),
1573 1812 '<a href="https://webberzone.com/plugins/top-10/" target="_blank">',
1574 1813 '</a>',
1575 1814 '<a href="https://wordpress.org/support/plugin/top-10/reviews/#new-post" target="_blank">'
@@ -1747,13 +1986,13 @@
1747 1986 public static function settings_page_header() {
1748 1987 global $tptn_freemius;
1749 1988 ?>
1750 1989 <p>
1751 - <?php if ( ! $tptn_freemius->is_paying() ) { ?>
1990 + <?php if ( ! $tptn_freemius->is_paying() ) { ?>
1752 1991 <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' ); ?>
1992 + <?php esc_html_e( 'Upgrade to Pro', 'top-10' ); ?>
1754 1993 </a>
1755 - <?php } ?>
1994 + <?php } ?>
1756 1995 </p>
1757 1996
1758 1997 <?php
1759 1998 }
@@ -1760,10 +1999,10 @@
1760 1999
1761 2000 /**
1762 2001 * Updated the settings fields to display a pro version link.
1763 2002 *
1764 - * @param string $output Settings field HTML.
1765 - * @param array $args Settings field arguments.
2003 + * @param string $output Settings field HTML.
2004 + * @param array $args Settings field arguments.
1766 2005 * @return string Updated HTML.
1767 2006 */
1768 2007 public static function after_setting_output( $output, $args ) {
1769 2008 if ( isset( $args['pro'] ) && $args['pro'] ) {
@@ -1845,9 +2084,9 @@
1845 2084 if ( false !== strpos( $search_term, ',' ) ) {
1846 2085 $search_term = explode( ',', $search_term );
1847 2086 $search_term = $search_term[ count( $search_term ) - 1 ];
1848 2087 }
1849 - $search_term = trim( $search_term );
2088 + $search_term = trim( $search_term, " \t\n\r\0\x0B" );
1850 2089
1851 2090 if ( 'public_taxonomies' === $endpoint ) {
1852 2091 $taxonomies = (array) get_taxonomies( array( 'public' => true ), 'objects' );
1853 2092 $taxonomy = array();
@@ -1882,15 +2121,17 @@
1882 2121 wp_send_json_error( 'Insufficient permissions' );
1883 2122 }
1884 2123 }
1885 2124
1886 - /** This filter has been defined in /wp-admin/includes/ajax-actions.php */
2125 + /**
2126 + * This filter has been defined in /wp-admin/includes/ajax-actions.php
2127 +*/
1887 2128 $term_search_min_chars = (int) apply_filters( 'term_search_min_chars', 2, $tax, $search_term );
1888 2129
1889 2130 /*
1890 - * Require $term_search_min_chars chars for matching (default: 2)
1891 - * ensure it's a non-negative, non-zero integer.
1892 - */
2131 + * Require $term_search_min_chars chars for matching (default: 2)
2132 + * ensure it's a non-negative, non-zero integer.
2133 + */
1893 2134 if ( ( 0 === $term_search_min_chars ) || ( strlen( $search_term ) < $term_search_min_chars ) ) {
1894 2135 wp_send_json_success( array() );
1895 2136 }
1896 2137
@@ -1918,10 +2159,10 @@
1918 2159 * Get field attributes for Tom Select taxonomy search fields.
1919 2160 *
1920 2161 * @since 4.2.0
1921 2162 *
1922 - * @param string $taxonomy The taxonomy to search.
1923 - * @param array $ts_config Optional Tom Select configuration.
2163 + * @param string $taxonomy The taxonomy to search.
2164 + * @param array $ts_config Optional Tom Select configuration.
1924 2165 * @return array Field attributes array.
1925 2166 */
1926 2167 private static function get_taxonomy_search_field_attributes( $taxonomy, $ts_config = array() ) {
1927 2168 $attributes = array(
@@ -1942,9 +2183,9 @@
1942 2183 * Get field attributes for Tom Select meta key search fields.
1943 2184 *
1944 2185 * @since 4.2.0
1945 2186 *
1946 - * @param array $ts_config Optional Tom Select configuration.
2187 + * @param array $ts_config Optional Tom Select configuration.
1947 2188 * @return array Field attributes array.
1948 2189 */
1949 2190 private static function get_meta_keys_search_field_attributes( $ts_config = array() ) {
1950 2191 $attributes = array(