Top 10 – Popular posts plugin for WordPress - Version 3.2.1

Version Description

Release post: https://webberzone.com/blog/top-10-v3-2-0/

  • Other Enhancements/Modifications:

    • Modified behaviour of Popular Posts page and Admin Dashboard widgets to limit to public post types
  • Bug fixes:

    • Fixed: Fatal error: Uncaught Error: Call to undefined function restore_current_blog()
Download this release

Release Info

Developer Ajay
Plugin Icon 128x128 Top 10 – Popular posts plugin for WordPress
Version 3.2.1
Comparing to
See all releases

Code changes from version 3.2.0 to 3.2.1

includes/admin/class-top-ten-statistics-table.php CHANGED
@@ -89,6 +89,13 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
89
  $table_name = $wpdb->base_prefix . 'top_ten AS ttt';
90
 
91
  // Fields to return.
 
 
 
 
 
 
 
92
  $fields[] = 'ttt.postnumber as ID';
93
  $fields[] = 'ttt.cntaccess as total_count';
94
  $fields[] = 'SUM(ttd.cntaccess) as daily_count';
@@ -114,6 +121,7 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
114
  // Create the base WHERE clause.
115
  if ( ! $this->network_wide ) {
116
  $where .= $wpdb->prepare( ' AND ttt.blog_id = %d ', $blog_id ); // Posts need to be from the current blog only.
 
117
 
118
  // If search argument is set, do a search for it.
119
  if ( ! empty( $args['search'] ) ) {
@@ -123,6 +131,13 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
123
  // If post filter argument is set, do a search for it.
124
  if ( isset( $args['post-type-filter'] ) && $this->all_post_type['all'] !== $args['post-type-filter'] ) {
125
  $where .= $wpdb->prepare( " AND $wpdb->posts.post_type = %s ", $args['post-type-filter'] );
 
 
 
 
 
 
 
126
  }
127
  }
128
 
@@ -130,24 +145,32 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
130
  $groupby = ' ttt.postnumber, ttt.blog_id ';
131
 
132
  // Create the ORDER BY clause.
133
- $orderby = ' total_count DESC ';
134
-
135
  if ( ! empty( $_REQUEST['orderby'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
136
  $orderby = sanitize_text_field( wp_unslash( $_REQUEST['orderby'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
 
 
 
137
 
 
138
  if ( ! in_array( $orderby, array( 'title', 'daily_count', 'total_count' ) ) ) { //phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
139
  $orderby = ' total_count ';
140
  }
141
 
 
142
  if ( ! empty( $_REQUEST['order'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
143
  $order = sanitize_text_field( wp_unslash( $_REQUEST['order'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
 
 
 
144
 
145
- if ( in_array( $order, array( 'asc', 'ASC', 'desc', 'DESC' ) ) ) { //phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
146
- $orderby .= ' ' . $order;
147
- } else {
148
- $orderby .= ' DESC';
149
- }
150
  }
 
 
151
  }
152
 
153
  // Create the base LIMITS clause.
@@ -179,10 +202,12 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
179
  global $wpdb;
180
 
181
  $where = '';
 
182
 
183
  $sql = "SELECT COUNT(*) FROM {$wpdb->base_prefix}top_ten as ttt";
184
 
185
  if ( ! $this->network_wide ) {
 
186
  $where .= $wpdb->prepare( ' AND blog_id = %d ', get_current_blog_id() );
187
 
188
  if ( ! empty( $args['search'] ) ) {
@@ -191,9 +216,16 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
191
 
192
  if ( isset( $args['post-type-filter'] ) && $this->all_post_type['all'] !== $args['post-type-filter'] ) {
193
  $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_type = %s ", $args['post-type-filter'] );
 
 
 
 
 
 
 
194
  }
195
  }
196
- return $wpdb->get_var( "$sql WHERE 1=1 $where" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared,WordPress.DB.PreparedSQL.InterpolatedNotPrepared
197
  }
198
 
199
  /**
@@ -437,10 +469,12 @@ class Top_Ten_Statistics_Table extends WP_List_Table {
437
  */
438
  public function get_sortable_columns() {
439
  $sortable_columns = array(
440
- 'title' => array( 'title', false ),
441
  'total_count' => array( 'total_count', true ),
442
  'daily_count' => array( 'daily_count', true ),
443
  );
 
 
 
444
  return $sortable_columns;
445
  }
446
 
89
  $table_name = $wpdb->base_prefix . 'top_ten AS ttt';
90
 
91
  // Fields to return.
92
+ if ( ! $this->network_wide ) {
93
+ $fields[] = "{$wpdb->posts}.post_title as title";
94
+ $fields[] = "{$wpdb->posts}.post_type";
95
+ $fields[] = "{$wpdb->posts}.post_date";
96
+ $fields[] = "{$wpdb->posts}.post_author";
97
+ }
98
+
99
  $fields[] = 'ttt.postnumber as ID';
100
  $fields[] = 'ttt.cntaccess as total_count';
101
  $fields[] = 'SUM(ttd.cntaccess) as daily_count';
121
  // Create the base WHERE clause.
122
  if ( ! $this->network_wide ) {
123
  $where .= $wpdb->prepare( ' AND ttt.blog_id = %d ', $blog_id ); // Posts need to be from the current blog only.
124
+ $where .= " AND ($wpdb->posts.post_status = 'publish' OR $wpdb->posts.post_status = 'inherit') "; // Show published posts and attachments.
125
 
126
  // If search argument is set, do a search for it.
127
  if ( ! empty( $args['search'] ) ) {
131
  // If post filter argument is set, do a search for it.
132
  if ( isset( $args['post-type-filter'] ) && $this->all_post_type['all'] !== $args['post-type-filter'] ) {
133
  $where .= $wpdb->prepare( " AND $wpdb->posts.post_type = %s ", $args['post-type-filter'] );
134
+ } else {
135
+ $post_types = get_post_types(
136
+ array(
137
+ 'public' => true,
138
+ )
139
+ );
140
+ $where .= " AND $wpdb->posts.post_type IN ('" . join( "', '", $post_types ) . "') ";
141
  }
142
  }
143
 
145
  $groupby = ' ttt.postnumber, ttt.blog_id ';
146
 
147
  // Create the ORDER BY clause.
148
+ $orderby = '';
 
149
  if ( ! empty( $_REQUEST['orderby'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
150
  $orderby = sanitize_text_field( wp_unslash( $_REQUEST['orderby'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
151
+ } elseif ( ! empty( $args['orderby'] ) ) {
152
+ $orderby = $args['orderby'];
153
+ }
154
 
155
+ if ( $orderby ) {
156
  if ( ! in_array( $orderby, array( 'title', 'daily_count', 'total_count' ) ) ) { //phpcs:ignore WordPress.PHP.StrictInArray.MissingTrueStrict
157
  $orderby = ' total_count ';
158
  }
159
 
160
+ $order = '';
161
  if ( ! empty( $_REQUEST['order'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
162
  $order = sanitize_text_field( wp_unslash( $_REQUEST['order'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
163
+ } elseif ( ! empty( $args['order'] ) ) {
164
+ $order = $args['order'];
165
+ }
166
 
167
+ if ( $order && in_array( $order, array( 'asc', 'ASC', 'desc', 'DESC' ), true ) ) {
168
+ $orderby .= " {$order}";
169
+ } else {
170
+ $orderby .= ' DESC';
 
171
  }
172
+ } else {
173
+ $orderby = ' total_count DESC ';
174
  }
175
 
176
  // Create the base LIMITS clause.
202
  global $wpdb;
203
 
204
  $where = '';
205
+ $join = '';
206
 
207
  $sql = "SELECT COUNT(*) FROM {$wpdb->base_prefix}top_ten as ttt";
208
 
209
  if ( ! $this->network_wide ) {
210
+ $join = "INNER JOIN {$wpdb->posts} ON ttt.postnumber=ID";
211
  $where .= $wpdb->prepare( ' AND blog_id = %d ', get_current_blog_id() );
212
 
213
  if ( ! empty( $args['search'] ) ) {
216
 
217
  if ( isset( $args['post-type-filter'] ) && $this->all_post_type['all'] !== $args['post-type-filter'] ) {
218
  $where .= $wpdb->prepare( " AND {$wpdb->posts}.post_type = %s ", $args['post-type-filter'] );
219
+ } else {
220
+ $post_types = get_post_types(
221
+ array(
222
+ 'public' => true,
223
+ )
224
+ );
225
+ $where .= " AND $wpdb->posts.post_type IN ('" . join( "', '", $post_types ) . "') ";
226
  }
227
  }
228
+ return $wpdb->get_var( "$sql $join WHERE 1=1 $where" ); // phpcs:ignore WordPress.DB.DirectDatabaseQuery.DirectQuery, WordPress.DB.DirectDatabaseQuery.NoCaching, WordPress.DB.PreparedSQL.NotPrepared,WordPress.DB.PreparedSQL.InterpolatedNotPrepared
229
  }
230
 
231
  /**
469
  */
470
  public function get_sortable_columns() {
471
  $sortable_columns = array(
 
472
  'total_count' => array( 'total_count', true ),
473
  'daily_count' => array( 'daily_count', true ),
474
  );
475
+ if ( ! $this->network_wide ) {
476
+ $sortable_columns['title'] = array( 'title', false );
477
+ }
478
  return $sortable_columns;
479
  }
480
 
includes/class-top-ten-query.php CHANGED
@@ -34,7 +34,7 @@ if ( ! class_exists( 'Top_Ten_Query' ) ) :
34
  * @since 3.2.0
35
  * @var bool
36
  */
37
- public $multiple_blogs;
38
 
39
  /**
40
  * Cache set flag.
@@ -161,8 +161,10 @@ if ( ! class_exists( 'Top_Ten_Query' ) ) :
161
 
162
  // Parse the blog_id argument to get an array of IDs.
163
  $this->blog_id = wp_parse_id_list( $args['blog_id'] );
164
- if ( count( $this->blog_id ) > 1 || ( 1 === count( $this->blog_id ) && get_current_blog_id() !== (int) $this->blog_id[0] ) ) {
165
- $this->multiple_blogs = true;
 
 
166
  }
167
 
168
  // Set the number of posts to be retrieved.
@@ -644,7 +646,7 @@ if ( ! class_exists( 'Top_Ten_Query' ) ) :
644
  */
645
  public function switch_to_blog_in_loop( $post ) {
646
  global $blog_id;
647
- if ( ! $this->multiple_blogs ) {
648
  if ( $post->blog_id && (int) $blog_id !== (int) $post->blog_id ) {
649
  switch_to_blog( $post->blog_id );
650
  } else {
@@ -659,7 +661,7 @@ if ( ! class_exists( 'Top_Ten_Query' ) ) :
659
  * @since 3.2.0
660
  */
661
  public function loop_end() {
662
- if ( ! $this->multiple_blogs ) {
663
  restore_current_blog();
664
  }
665
  }
34
  * @since 3.2.0
35
  * @var bool
36
  */
37
+ public $multiple_blogs = false;
38
 
39
  /**
40
  * Cache set flag.
161
 
162
  // Parse the blog_id argument to get an array of IDs.
163
  $this->blog_id = wp_parse_id_list( $args['blog_id'] );
164
+ if ( is_multisite() ) {
165
+ if ( count( $this->blog_id ) > 1 || ( 1 === count( $this->blog_id ) && get_current_blog_id() !== (int) $this->blog_id[0] ) ) {
166
+ $this->multiple_blogs = true;
167
+ }
168
  }
169
 
170
  // Set the number of posts to be retrieved.
646
  */
647
  public function switch_to_blog_in_loop( $post ) {
648
  global $blog_id;
649
+ if ( $this->multiple_blogs ) {
650
  if ( $post->blog_id && (int) $blog_id !== (int) $post->blog_id ) {
651
  switch_to_blog( $post->blog_id );
652
  } else {
661
  * @since 3.2.0
662
  */
663
  public function loop_end() {
664
+ if ( $this->multiple_blogs ) {
665
  restore_current_blog();
666
  }
667
  }
languages/top-10-en_US.po CHANGED
@@ -2,7 +2,7 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Top 10\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2022-09-17 19:09+0100\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Ajay D'Souza\n"
8
  "Language-Team: Ajay D'Souza\n"
@@ -124,7 +124,7 @@ msgstr ""
124
  msgid "Top 10 Daily Popular Posts"
125
  msgstr ""
126
 
127
- #: includes/admin/admin.php:69 includes/admin/tools.php:82
128
  msgid "Top 10 Tools"
129
  msgstr ""
130
 
@@ -300,66 +300,66 @@ msgstr ""
300
  msgid "All post types"
301
  msgstr ""
302
 
303
- #: includes/admin/class-top-ten-statistics-table.php:214
304
  msgid "No popular posts available."
305
  msgstr ""
306
 
307
- #: includes/admin/class-top-ten-statistics-table.php:266
308
  msgid "Invalid post ID. This post might have been deleted."
309
  msgstr ""
310
 
311
- #: includes/admin/class-top-ten-statistics-table.php:272
312
  msgid "View"
313
  msgstr ""
314
 
315
- #: includes/admin/class-top-ten-statistics-table.php:273
316
  msgid "Edit"
317
  msgstr ""
318
 
319
- #: includes/admin/class-top-ten-statistics-table.php:275
320
  msgid "Delete"
321
  msgstr ""
322
 
323
- #: includes/admin/class-top-ten-statistics-table.php:411
324
  #: includes/modules/class-top-ten-count-widget.php:49
325
  #: includes/modules/class-top-ten-widget.php:79
326
  msgid "Title"
327
  msgstr ""
328
 
329
- #: includes/admin/class-top-ten-statistics-table.php:412
330
  msgid "Total visits"
331
  msgstr ""
332
 
333
- #: includes/admin/class-top-ten-statistics-table.php:413
334
  msgid "Daily visits"
335
  msgstr ""
336
 
337
- #: includes/admin/class-top-ten-statistics-table.php:414
338
  msgid "Post type"
339
  msgstr ""
340
 
341
- #: includes/admin/class-top-ten-statistics-table.php:415
342
  msgid "Author"
343
  msgstr ""
344
 
345
- #: includes/admin/class-top-ten-statistics-table.php:416
346
  #: includes/admin/import-export.php:212
347
  msgid "Date"
348
  msgstr ""
349
 
350
- #: includes/admin/class-top-ten-statistics-table.php:420
351
  msgid "Blog"
352
  msgstr ""
353
 
354
- #: includes/admin/class-top-ten-statistics-table.php:454
355
  msgid "Delete Count"
356
  msgstr ""
357
 
358
- #: includes/admin/class-top-ten-statistics-table.php:519
359
  msgid "Are you sure you want to do this"
360
  msgstr ""
361
 
362
- #: includes/admin/class-top-ten-statistics-table.php:606
363
  msgid "Filter"
364
  msgstr ""
365
 
@@ -1465,72 +1465,77 @@ msgstr ""
1465
  msgid "Top 10 tables have been recreated"
1466
  msgstr ""
1467
 
1468
- #: includes/admin/tools.php:62
1469
  msgid "Old settings key has been deleted"
1470
  msgstr ""
1471
 
1472
- #: includes/admin/tools.php:69
 
 
 
 
1473
  msgid "Duplicate rows cleaned from the tables"
1474
  msgstr ""
1475
 
1476
- #: includes/admin/tools.php:76
1477
  msgid "Post counts across blog IDs 0 and 1 have been merged"
1478
  msgstr ""
1479
 
1480
- #: includes/admin/tools.php:92 includes/admin/tools.php:94
1481
  msgid "Clear cache"
1482
  msgstr ""
1483
 
1484
- #: includes/admin/tools.php:97
1485
  msgid ""
1486
  "Clear the Top 10 cache. This will also be cleared automatically when you "
1487
  "save the settings page."
1488
  msgstr ""
1489
 
1490
- #: includes/admin/tools.php:100 includes/admin/tools.php:102
1491
  msgid "Recreate Primary Key"
1492
  msgstr ""
1493
 
1494
- #: includes/admin/tools.php:105
1495
  msgid ""
1496
  "Deletes and reinitializes the primary key in the database tables. If the "
1497
  "above function gives an error, then you can run the below code in phpMyAdmin "
1498
  "or Adminer. Remember to backup your database first!"
1499
  msgstr ""
1500
 
1501
- #: includes/admin/tools.php:111
1502
  msgid "Reset database"
1503
  msgstr ""
1504
 
1505
- #: includes/admin/tools.php:113
1506
  msgid ""
1507
- "This will reset the Top 10 tables. If you are running Top 10 on multisite "
1508
- "then it will delete the popular posts across the entire network. This cannot "
 
1509
  "be reversed. Make sure that your database has been backed up before "
1510
  "proceeding"
1511
  msgstr ""
1512
 
1513
- #: includes/admin/tools.php:116
1514
  msgid "Reset Popular Posts"
1515
  msgstr ""
1516
 
1517
- #: includes/admin/tools.php:116
1518
  msgid "Are you sure you want to reset the popular posts?"
1519
  msgstr ""
1520
 
1521
- #: includes/admin/tools.php:117
1522
  msgid "Reset Daily Popular Posts"
1523
  msgstr ""
1524
 
1525
- #: includes/admin/tools.php:117
1526
  msgid "Are you sure you want to reset the daily popular posts?"
1527
  msgstr ""
1528
 
1529
- #: includes/admin/tools.php:120 includes/admin/tools.php:125
1530
  msgid "Recreate Database Tables"
1531
  msgstr ""
1532
 
1533
- #: includes/admin/tools.php:122
1534
  msgid ""
1535
  "Only click the button below after performing a full backup of the database. "
1536
  "You can use any of the popular backup plugins or phpMyAdmin to achieve this. "
@@ -1539,15 +1544,15 @@ msgid ""
1539
  "comfortable, please do not proceed."
1540
  msgstr ""
1541
 
1542
- #: includes/admin/tools.php:125
1543
  msgid "Hit Cancel if you have not backed up your database"
1544
  msgstr ""
1545
 
1546
- #: includes/admin/tools.php:128
1547
  msgid "Other tools"
1548
  msgstr ""
1549
 
1550
- #: includes/admin/tools.php:130
1551
  msgid ""
1552
  "From v2.5.x, Top 10 stores the settings in a new key in the database. This "
1553
  "will delete the old settings for the current blog. It is recommended that "
@@ -1555,37 +1560,37 @@ msgid ""
1555
  "if you are comfortable with the new settings."
1556
  msgstr ""
1557
 
1558
- #: includes/admin/tools.php:133
1559
  msgid "Delete old settings"
1560
  msgstr ""
1561
 
1562
- #: includes/admin/tools.php:133
1563
  msgid "This will delete the settings before v2.5.x. Proceed?"
1564
  msgstr ""
1565
 
1566
- #: includes/admin/tools.php:137
1567
  msgid "This will merge post counts for posts with table entries of 0 and 1"
1568
  msgstr ""
1569
 
1570
- #: includes/admin/tools.php:140
1571
  msgid "Merge blog ID 0 and 1 post counts"
1572
  msgstr ""
1573
 
1574
- #: includes/admin/tools.php:140
1575
  msgid "This will merge post counts for blog IDs 0 and 1. Proceed?"
1576
  msgstr ""
1577
 
1578
- #: includes/admin/tools.php:144
1579
  msgid ""
1580
  "In older versions, the plugin created entries with duplicate post IDs. "
1581
  "Clicking the button below will merge these duplicate IDs"
1582
  msgstr ""
1583
 
1584
- #: includes/admin/tools.php:147
1585
  msgid "Merge duplicates across blog IDs"
1586
  msgstr ""
1587
 
1588
- #: includes/admin/tools.php:147
1589
  msgid "This will delete the duplicate entries in the tables. Proceed?"
1590
  msgstr ""
1591
 
2
  msgstr ""
3
  "Project-Id-Version: Top 10\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2022-09-19 15:40+0100\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Ajay D'Souza\n"
8
  "Language-Team: Ajay D'Souza\n"
124
  msgid "Top 10 Daily Popular Posts"
125
  msgstr ""
126
 
127
+ #: includes/admin/admin.php:69 includes/admin/tools.php:86
128
  msgid "Top 10 Tools"
129
  msgstr ""
130
 
300
  msgid "All post types"
301
  msgstr ""
302
 
303
+ #: includes/admin/class-top-ten-statistics-table.php:246
304
  msgid "No popular posts available."
305
  msgstr ""
306
 
307
+ #: includes/admin/class-top-ten-statistics-table.php:298
308
  msgid "Invalid post ID. This post might have been deleted."
309
  msgstr ""
310
 
311
+ #: includes/admin/class-top-ten-statistics-table.php:304
312
  msgid "View"
313
  msgstr ""
314
 
315
+ #: includes/admin/class-top-ten-statistics-table.php:305
316
  msgid "Edit"
317
  msgstr ""
318
 
319
+ #: includes/admin/class-top-ten-statistics-table.php:307
320
  msgid "Delete"
321
  msgstr ""
322
 
323
+ #: includes/admin/class-top-ten-statistics-table.php:443
324
  #: includes/modules/class-top-ten-count-widget.php:49
325
  #: includes/modules/class-top-ten-widget.php:79
326
  msgid "Title"
327
  msgstr ""
328
 
329
+ #: includes/admin/class-top-ten-statistics-table.php:444
330
  msgid "Total visits"
331
  msgstr ""
332
 
333
+ #: includes/admin/class-top-ten-statistics-table.php:445
334
  msgid "Daily visits"
335
  msgstr ""
336
 
337
+ #: includes/admin/class-top-ten-statistics-table.php:446
338
  msgid "Post type"
339
  msgstr ""
340
 
341
+ #: includes/admin/class-top-ten-statistics-table.php:447
342
  msgid "Author"
343
  msgstr ""
344
 
345
+ #: includes/admin/class-top-ten-statistics-table.php:448
346
  #: includes/admin/import-export.php:212
347
  msgid "Date"
348
  msgstr ""
349
 
350
+ #: includes/admin/class-top-ten-statistics-table.php:452
351
  msgid "Blog"
352
  msgstr ""
353
 
354
+ #: includes/admin/class-top-ten-statistics-table.php:488
355
  msgid "Delete Count"
356
  msgstr ""
357
 
358
+ #: includes/admin/class-top-ten-statistics-table.php:553
359
  msgid "Are you sure you want to do this"
360
  msgstr ""
361
 
362
+ #: includes/admin/class-top-ten-statistics-table.php:640
363
  msgid "Filter"
364
  msgstr ""
365
 
1465
  msgid "Top 10 tables have been recreated"
1466
  msgstr ""
1467
 
1468
+ #: includes/admin/tools.php:63
1469
  msgid "Old settings key has been deleted"
1470
  msgstr ""
1471
 
1472
+ #: includes/admin/tools.php:65
1473
+ msgid "Old settings key does not exist"
1474
+ msgstr ""
1475
+
1476
+ #: includes/admin/tools.php:73
1477
  msgid "Duplicate rows cleaned from the tables"
1478
  msgstr ""
1479
 
1480
+ #: includes/admin/tools.php:80
1481
  msgid "Post counts across blog IDs 0 and 1 have been merged"
1482
  msgstr ""
1483
 
1484
+ #: includes/admin/tools.php:96 includes/admin/tools.php:98
1485
  msgid "Clear cache"
1486
  msgstr ""
1487
 
1488
+ #: includes/admin/tools.php:101
1489
  msgid ""
1490
  "Clear the Top 10 cache. This will also be cleared automatically when you "
1491
  "save the settings page."
1492
  msgstr ""
1493
 
1494
+ #: includes/admin/tools.php:104 includes/admin/tools.php:106
1495
  msgid "Recreate Primary Key"
1496
  msgstr ""
1497
 
1498
+ #: includes/admin/tools.php:109
1499
  msgid ""
1500
  "Deletes and reinitializes the primary key in the database tables. If the "
1501
  "above function gives an error, then you can run the below code in phpMyAdmin "
1502
  "or Adminer. Remember to backup your database first!"
1503
  msgstr ""
1504
 
1505
+ #: includes/admin/tools.php:115
1506
  msgid "Reset database"
1507
  msgstr ""
1508
 
1509
+ #: includes/admin/tools.php:117
1510
  msgid ""
1511
+ "This will reset the Top 10 tables. If this is a multisite install, this will "
1512
+ "reset the popular posts for the current site. If this is the Network Admin "
1513
+ "screen, then it will reset the popular posts across all sites. This cannot "
1514
  "be reversed. Make sure that your database has been backed up before "
1515
  "proceeding"
1516
  msgstr ""
1517
 
1518
+ #: includes/admin/tools.php:120
1519
  msgid "Reset Popular Posts"
1520
  msgstr ""
1521
 
1522
+ #: includes/admin/tools.php:120
1523
  msgid "Are you sure you want to reset the popular posts?"
1524
  msgstr ""
1525
 
1526
+ #: includes/admin/tools.php:121
1527
  msgid "Reset Daily Popular Posts"
1528
  msgstr ""
1529
 
1530
+ #: includes/admin/tools.php:121
1531
  msgid "Are you sure you want to reset the daily popular posts?"
1532
  msgstr ""
1533
 
1534
+ #: includes/admin/tools.php:124 includes/admin/tools.php:129
1535
  msgid "Recreate Database Tables"
1536
  msgstr ""
1537
 
1538
+ #: includes/admin/tools.php:126
1539
  msgid ""
1540
  "Only click the button below after performing a full backup of the database. "
1541
  "You can use any of the popular backup plugins or phpMyAdmin to achieve this. "
1544
  "comfortable, please do not proceed."
1545
  msgstr ""
1546
 
1547
+ #: includes/admin/tools.php:129
1548
  msgid "Hit Cancel if you have not backed up your database"
1549
  msgstr ""
1550
 
1551
+ #: includes/admin/tools.php:132
1552
  msgid "Other tools"
1553
  msgstr ""
1554
 
1555
+ #: includes/admin/tools.php:134
1556
  msgid ""
1557
  "From v2.5.x, Top 10 stores the settings in a new key in the database. This "
1558
  "will delete the old settings for the current blog. It is recommended that "
1560
  "if you are comfortable with the new settings."
1561
  msgstr ""
1562
 
1563
+ #: includes/admin/tools.php:137
1564
  msgid "Delete old settings"
1565
  msgstr ""
1566
 
1567
+ #: includes/admin/tools.php:137
1568
  msgid "This will delete the settings before v2.5.x. Proceed?"
1569
  msgstr ""
1570
 
1571
+ #: includes/admin/tools.php:141
1572
  msgid "This will merge post counts for posts with table entries of 0 and 1"
1573
  msgstr ""
1574
 
1575
+ #: includes/admin/tools.php:144
1576
  msgid "Merge blog ID 0 and 1 post counts"
1577
  msgstr ""
1578
 
1579
+ #: includes/admin/tools.php:144
1580
  msgid "This will merge post counts for blog IDs 0 and 1. Proceed?"
1581
  msgstr ""
1582
 
1583
+ #: includes/admin/tools.php:148
1584
  msgid ""
1585
  "In older versions, the plugin created entries with duplicate post IDs. "
1586
  "Clicking the button below will merge these duplicate IDs"
1587
  msgstr ""
1588
 
1589
+ #: includes/admin/tools.php:151
1590
  msgid "Merge duplicates across blog IDs"
1591
  msgstr ""
1592
 
1593
+ #: includes/admin/tools.php:151
1594
  msgid "This will delete the duplicate entries in the tables. Proceed?"
1595
  msgstr ""
1596
 
languages/top-10-en_US.pot CHANGED
@@ -3,7 +3,7 @@ msgid ""
3
  msgstr ""
4
  "Project-Id-Version: Top 10\n"
5
  "Report-Msgid-Bugs-To: \n"
6
- "POT-Creation-Date: 2022-09-17 19:09+0100\n"
7
  "PO-Revision-Date: \n"
8
  "Last-Translator: Ajay D'Souza\n"
9
  "Language-Team: Ajay D'Souza\n"
@@ -125,7 +125,7 @@ msgstr ""
125
  msgid "Top 10 Daily Popular Posts"
126
  msgstr ""
127
 
128
- #: includes/admin/admin.php:69 includes/admin/tools.php:82
129
  msgid "Top 10 Tools"
130
  msgstr ""
131
 
@@ -301,66 +301,66 @@ msgstr ""
301
  msgid "All post types"
302
  msgstr ""
303
 
304
- #: includes/admin/class-top-ten-statistics-table.php:214
305
  msgid "No popular posts available."
306
  msgstr ""
307
 
308
- #: includes/admin/class-top-ten-statistics-table.php:266
309
  msgid "Invalid post ID. This post might have been deleted."
310
  msgstr ""
311
 
312
- #: includes/admin/class-top-ten-statistics-table.php:272
313
  msgid "View"
314
  msgstr ""
315
 
316
- #: includes/admin/class-top-ten-statistics-table.php:273
317
  msgid "Edit"
318
  msgstr ""
319
 
320
- #: includes/admin/class-top-ten-statistics-table.php:275
321
  msgid "Delete"
322
  msgstr ""
323
 
324
- #: includes/admin/class-top-ten-statistics-table.php:411
325
  #: includes/modules/class-top-ten-count-widget.php:49
326
  #: includes/modules/class-top-ten-widget.php:79
327
  msgid "Title"
328
  msgstr ""
329
 
330
- #: includes/admin/class-top-ten-statistics-table.php:412
331
  msgid "Total visits"
332
  msgstr ""
333
 
334
- #: includes/admin/class-top-ten-statistics-table.php:413
335
  msgid "Daily visits"
336
  msgstr ""
337
 
338
- #: includes/admin/class-top-ten-statistics-table.php:414
339
  msgid "Post type"
340
  msgstr ""
341
 
342
- #: includes/admin/class-top-ten-statistics-table.php:415
343
  msgid "Author"
344
  msgstr ""
345
 
346
- #: includes/admin/class-top-ten-statistics-table.php:416
347
  #: includes/admin/import-export.php:212
348
  msgid "Date"
349
  msgstr ""
350
 
351
- #: includes/admin/class-top-ten-statistics-table.php:420
352
  msgid "Blog"
353
  msgstr ""
354
 
355
- #: includes/admin/class-top-ten-statistics-table.php:454
356
  msgid "Delete Count"
357
  msgstr ""
358
 
359
- #: includes/admin/class-top-ten-statistics-table.php:519
360
  msgid "Are you sure you want to do this"
361
  msgstr ""
362
 
363
- #: includes/admin/class-top-ten-statistics-table.php:606
364
  msgid "Filter"
365
  msgstr ""
366
 
@@ -1466,72 +1466,77 @@ msgstr ""
1466
  msgid "Top 10 tables have been recreated"
1467
  msgstr ""
1468
 
1469
- #: includes/admin/tools.php:62
1470
  msgid "Old settings key has been deleted"
1471
  msgstr ""
1472
 
1473
- #: includes/admin/tools.php:69
 
 
 
 
1474
  msgid "Duplicate rows cleaned from the tables"
1475
  msgstr ""
1476
 
1477
- #: includes/admin/tools.php:76
1478
  msgid "Post counts across blog IDs 0 and 1 have been merged"
1479
  msgstr ""
1480
 
1481
- #: includes/admin/tools.php:92 includes/admin/tools.php:94
1482
  msgid "Clear cache"
1483
  msgstr ""
1484
 
1485
- #: includes/admin/tools.php:97
1486
  msgid ""
1487
  "Clear the Top 10 cache. This will also be cleared automatically when you "
1488
  "save the settings page."
1489
  msgstr ""
1490
 
1491
- #: includes/admin/tools.php:100 includes/admin/tools.php:102
1492
  msgid "Recreate Primary Key"
1493
  msgstr ""
1494
 
1495
- #: includes/admin/tools.php:105
1496
  msgid ""
1497
  "Deletes and reinitializes the primary key in the database tables. If the "
1498
  "above function gives an error, then you can run the below code in phpMyAdmin "
1499
  "or Adminer. Remember to backup your database first!"
1500
  msgstr ""
1501
 
1502
- #: includes/admin/tools.php:111
1503
  msgid "Reset database"
1504
  msgstr ""
1505
 
1506
- #: includes/admin/tools.php:113
1507
  msgid ""
1508
- "This will reset the Top 10 tables. If you are running Top 10 on multisite "
1509
- "then it will delete the popular posts across the entire network. This cannot "
 
1510
  "be reversed. Make sure that your database has been backed up before "
1511
  "proceeding"
1512
  msgstr ""
1513
 
1514
- #: includes/admin/tools.php:116
1515
  msgid "Reset Popular Posts"
1516
  msgstr ""
1517
 
1518
- #: includes/admin/tools.php:116
1519
  msgid "Are you sure you want to reset the popular posts?"
1520
  msgstr ""
1521
 
1522
- #: includes/admin/tools.php:117
1523
  msgid "Reset Daily Popular Posts"
1524
  msgstr ""
1525
 
1526
- #: includes/admin/tools.php:117
1527
  msgid "Are you sure you want to reset the daily popular posts?"
1528
  msgstr ""
1529
 
1530
- #: includes/admin/tools.php:120 includes/admin/tools.php:125
1531
  msgid "Recreate Database Tables"
1532
  msgstr ""
1533
 
1534
- #: includes/admin/tools.php:122
1535
  msgid ""
1536
  "Only click the button below after performing a full backup of the database. "
1537
  "You can use any of the popular backup plugins or phpMyAdmin to achieve this. "
@@ -1540,15 +1545,15 @@ msgid ""
1540
  "comfortable, please do not proceed."
1541
  msgstr ""
1542
 
1543
- #: includes/admin/tools.php:125
1544
  msgid "Hit Cancel if you have not backed up your database"
1545
  msgstr ""
1546
 
1547
- #: includes/admin/tools.php:128
1548
  msgid "Other tools"
1549
  msgstr ""
1550
 
1551
- #: includes/admin/tools.php:130
1552
  msgid ""
1553
  "From v2.5.x, Top 10 stores the settings in a new key in the database. This "
1554
  "will delete the old settings for the current blog. It is recommended that "
@@ -1556,37 +1561,37 @@ msgid ""
1556
  "if you are comfortable with the new settings."
1557
  msgstr ""
1558
 
1559
- #: includes/admin/tools.php:133
1560
  msgid "Delete old settings"
1561
  msgstr ""
1562
 
1563
- #: includes/admin/tools.php:133
1564
  msgid "This will delete the settings before v2.5.x. Proceed?"
1565
  msgstr ""
1566
 
1567
- #: includes/admin/tools.php:137
1568
  msgid "This will merge post counts for posts with table entries of 0 and 1"
1569
  msgstr ""
1570
 
1571
- #: includes/admin/tools.php:140
1572
  msgid "Merge blog ID 0 and 1 post counts"
1573
  msgstr ""
1574
 
1575
- #: includes/admin/tools.php:140
1576
  msgid "This will merge post counts for blog IDs 0 and 1. Proceed?"
1577
  msgstr ""
1578
 
1579
- #: includes/admin/tools.php:144
1580
  msgid ""
1581
  "In older versions, the plugin created entries with duplicate post IDs. "
1582
  "Clicking the button below will merge these duplicate IDs"
1583
  msgstr ""
1584
 
1585
- #: includes/admin/tools.php:147
1586
  msgid "Merge duplicates across blog IDs"
1587
  msgstr ""
1588
 
1589
- #: includes/admin/tools.php:147
1590
  msgid "This will delete the duplicate entries in the tables. Proceed?"
1591
  msgstr ""
1592
 
3
  msgstr ""
4
  "Project-Id-Version: Top 10\n"
5
  "Report-Msgid-Bugs-To: \n"
6
+ "POT-Creation-Date: 2022-09-19 15:40+0100\n"
7
  "PO-Revision-Date: \n"
8
  "Last-Translator: Ajay D'Souza\n"
9
  "Language-Team: Ajay D'Souza\n"
125
  msgid "Top 10 Daily Popular Posts"
126
  msgstr ""
127
 
128
+ #: includes/admin/admin.php:69 includes/admin/tools.php:86
129
  msgid "Top 10 Tools"
130
  msgstr ""
131
 
301
  msgid "All post types"
302
  msgstr ""
303
 
304
+ #: includes/admin/class-top-ten-statistics-table.php:246
305
  msgid "No popular posts available."
306
  msgstr ""
307
 
308
+ #: includes/admin/class-top-ten-statistics-table.php:298
309
  msgid "Invalid post ID. This post might have been deleted."
310
  msgstr ""
311
 
312
+ #: includes/admin/class-top-ten-statistics-table.php:304
313
  msgid "View"
314
  msgstr ""
315
 
316
+ #: includes/admin/class-top-ten-statistics-table.php:305
317
  msgid "Edit"
318
  msgstr ""
319
 
320
+ #: includes/admin/class-top-ten-statistics-table.php:307
321
  msgid "Delete"
322
  msgstr ""
323
 
324
+ #: includes/admin/class-top-ten-statistics-table.php:443
325
  #: includes/modules/class-top-ten-count-widget.php:49
326
  #: includes/modules/class-top-ten-widget.php:79
327
  msgid "Title"
328
  msgstr ""
329
 
330
+ #: includes/admin/class-top-ten-statistics-table.php:444
331
  msgid "Total visits"
332
  msgstr ""
333
 
334
+ #: includes/admin/class-top-ten-statistics-table.php:445
335
  msgid "Daily visits"
336
  msgstr ""
337
 
338
+ #: includes/admin/class-top-ten-statistics-table.php:446
339
  msgid "Post type"
340
  msgstr ""
341
 
342
+ #: includes/admin/class-top-ten-statistics-table.php:447
343
  msgid "Author"
344
  msgstr ""
345
 
346
+ #: includes/admin/class-top-ten-statistics-table.php:448
347
  #: includes/admin/import-export.php:212
348
  msgid "Date"
349
  msgstr ""
350
 
351
+ #: includes/admin/class-top-ten-statistics-table.php:452
352
  msgid "Blog"
353
  msgstr ""
354
 
355
+ #: includes/admin/class-top-ten-statistics-table.php:488
356
  msgid "Delete Count"
357
  msgstr ""
358
 
359
+ #: includes/admin/class-top-ten-statistics-table.php:553
360
  msgid "Are you sure you want to do this"
361
  msgstr ""
362
 
363
+ #: includes/admin/class-top-ten-statistics-table.php:640
364
  msgid "Filter"
365
  msgstr ""
366
 
1466
  msgid "Top 10 tables have been recreated"
1467
  msgstr ""
1468
 
1469
+ #: includes/admin/tools.php:63
1470
  msgid "Old settings key has been deleted"
1471
  msgstr ""
1472
 
1473
+ #: includes/admin/tools.php:65
1474
+ msgid "Old settings key does not exist"
1475
+ msgstr ""
1476
+
1477
+ #: includes/admin/tools.php:73
1478
  msgid "Duplicate rows cleaned from the tables"
1479
  msgstr ""
1480
 
1481
+ #: includes/admin/tools.php:80
1482
  msgid "Post counts across blog IDs 0 and 1 have been merged"
1483
  msgstr ""
1484
 
1485
+ #: includes/admin/tools.php:96 includes/admin/tools.php:98
1486
  msgid "Clear cache"
1487
  msgstr ""
1488
 
1489
+ #: includes/admin/tools.php:101
1490
  msgid ""
1491
  "Clear the Top 10 cache. This will also be cleared automatically when you "
1492
  "save the settings page."
1493
  msgstr ""
1494
 
1495
+ #: includes/admin/tools.php:104 includes/admin/tools.php:106
1496
  msgid "Recreate Primary Key"
1497
  msgstr ""
1498
 
1499
+ #: includes/admin/tools.php:109
1500
  msgid ""
1501
  "Deletes and reinitializes the primary key in the database tables. If the "
1502
  "above function gives an error, then you can run the below code in phpMyAdmin "
1503
  "or Adminer. Remember to backup your database first!"
1504
  msgstr ""
1505
 
1506
+ #: includes/admin/tools.php:115
1507
  msgid "Reset database"
1508
  msgstr ""
1509
 
1510
+ #: includes/admin/tools.php:117
1511
  msgid ""
1512
+ "This will reset the Top 10 tables. If this is a multisite install, this will "
1513
+ "reset the popular posts for the current site. If this is the Network Admin "
1514
+ "screen, then it will reset the popular posts across all sites. This cannot "
1515
  "be reversed. Make sure that your database has been backed up before "
1516
  "proceeding"
1517
  msgstr ""
1518
 
1519
+ #: includes/admin/tools.php:120
1520
  msgid "Reset Popular Posts"
1521
  msgstr ""
1522
 
1523
+ #: includes/admin/tools.php:120
1524
  msgid "Are you sure you want to reset the popular posts?"
1525
  msgstr ""
1526
 
1527
+ #: includes/admin/tools.php:121
1528
  msgid "Reset Daily Popular Posts"
1529
  msgstr ""
1530
 
1531
+ #: includes/admin/tools.php:121
1532
  msgid "Are you sure you want to reset the daily popular posts?"
1533
  msgstr ""
1534
 
1535
+ #: includes/admin/tools.php:124 includes/admin/tools.php:129
1536
  msgid "Recreate Database Tables"
1537
  msgstr ""
1538
 
1539
+ #: includes/admin/tools.php:126
1540
  msgid ""
1541
  "Only click the button below after performing a full backup of the database. "
1542
  "You can use any of the popular backup plugins or phpMyAdmin to achieve this. "
1545
  "comfortable, please do not proceed."
1546
  msgstr ""
1547
 
1548
+ #: includes/admin/tools.php:129
1549
  msgid "Hit Cancel if you have not backed up your database"
1550
  msgstr ""
1551
 
1552
+ #: includes/admin/tools.php:132
1553
  msgid "Other tools"
1554
  msgstr ""
1555
 
1556
+ #: includes/admin/tools.php:134
1557
  msgid ""
1558
  "From v2.5.x, Top 10 stores the settings in a new key in the database. This "
1559
  "will delete the old settings for the current blog. It is recommended that "
1561
  "if you are comfortable with the new settings."
1562
  msgstr ""
1563
 
1564
+ #: includes/admin/tools.php:137
1565
  msgid "Delete old settings"
1566
  msgstr ""
1567
 
1568
+ #: includes/admin/tools.php:137
1569
  msgid "This will delete the settings before v2.5.x. Proceed?"
1570
  msgstr ""
1571
 
1572
+ #: includes/admin/tools.php:141
1573
  msgid "This will merge post counts for posts with table entries of 0 and 1"
1574
  msgstr ""
1575
 
1576
+ #: includes/admin/tools.php:144
1577
  msgid "Merge blog ID 0 and 1 post counts"
1578
  msgstr ""
1579
 
1580
+ #: includes/admin/tools.php:144
1581
  msgid "This will merge post counts for blog IDs 0 and 1. Proceed?"
1582
  msgstr ""
1583
 
1584
+ #: includes/admin/tools.php:148
1585
  msgid ""
1586
  "In older versions, the plugin created entries with duplicate post IDs. "
1587
  "Clicking the button below will merge these duplicate IDs"
1588
  msgstr ""
1589
 
1590
+ #: includes/admin/tools.php:151
1591
  msgid "Merge duplicates across blog IDs"
1592
  msgstr ""
1593
 
1594
+ #: includes/admin/tools.php:151
1595
  msgid "This will delete the duplicate entries in the tables. Proceed?"
1596
  msgstr ""
1597
 
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Tags: popular posts, top 10, counter, top posts, daily popular, page views, statistics, tracker
3
  Contributors: webberzone, Ajay
4
  Donate link: https://ajaydsouza.com/donate/
5
- Stable tag: 3.2.0
6
  Requires at least: 5.6
7
  Tested up to: 6.0
8
  Requires PHP: 7.1
@@ -133,10 +133,18 @@ add_filter( 'manage_edit-projects_sortable_columns', 'tptn_column_register_sorta
133
 
134
  == Changelog ==
135
 
136
- = 3.2.0 =
137
 
138
  Release post: [https://webberzone.com/blog/top-10-v3-2-0/](https://webberzone.com/blog/top-10-v3-2-0/)
139
 
 
 
 
 
 
 
 
 
140
  * Features:
141
  * New setting in the Popular Posts block to select the style by block type
142
 
@@ -217,6 +225,6 @@ For previous changelog entries, please refer to the separate changelog.txt file
217
 
218
  == Upgrade Notice ==
219
 
220
- = 3.2.0 =
221
  Major release; Please check the plugin settings; Read all details in the release post
222
 
2
  Tags: popular posts, top 10, counter, top posts, daily popular, page views, statistics, tracker
3
  Contributors: webberzone, Ajay
4
  Donate link: https://ajaydsouza.com/donate/
5
+ Stable tag: 3.2.1
6
  Requires at least: 5.6
7
  Tested up to: 6.0
8
  Requires PHP: 7.1
133
 
134
  == Changelog ==
135
 
136
+ = 3.2.1 =
137
 
138
  Release post: [https://webberzone.com/blog/top-10-v3-2-0/](https://webberzone.com/blog/top-10-v3-2-0/)
139
 
140
+ * Other Enhancements/Modifications:
141
+ * Modified behaviour of Popular Posts page and Admin Dashboard widgets to limit to public post types
142
+
143
+ * Bug fixes:
144
+ * Fixed: `Fatal error: Uncaught Error: Call to undefined function restore_current_blog()`
145
+
146
+ = 3.2.0 =
147
+
148
  * Features:
149
  * New setting in the Popular Posts block to select the style by block type
150
 
225
 
226
  == Upgrade Notice ==
227
 
228
+ = 3.2.1 =
229
  Major release; Please check the plugin settings; Read all details in the release post
230
 
top-10.php CHANGED
@@ -14,7 +14,7 @@
14
  * Plugin Name: Top 10
15
  * Plugin URI: https://webberzone.com/plugins/top-10/
16
  * Description: Count daily and total visits per post and display the most popular posts based on the number of views
17
- * Version: 3.2.0
18
  * Author: Ajay D'Souza
19
  * Author URI: https://webberzone.com
20
  * License: GPL-2.0+
@@ -38,7 +38,7 @@ if ( ! defined( 'WPINC' ) ) {
38
  * @var string Top 10 Version.
39
  */
40
  if ( ! defined( 'TOP_TEN_VERSION' ) ) {
41
- define( 'TOP_TEN_VERSION', '3.1.3' );
42
  }
43
 
44
 
14
  * Plugin Name: Top 10
15
  * Plugin URI: https://webberzone.com/plugins/top-10/
16
  * Description: Count daily and total visits per post and display the most popular posts based on the number of views
17
+ * Version: 3.2.1
18
  * Author: Ajay D'Souza
19
  * Author URI: https://webberzone.com
20
  * License: GPL-2.0+
38
  * @var string Top 10 Version.
39
  */
40
  if ( ! defined( 'TOP_TEN_VERSION' ) ) {
41
+ define( 'TOP_TEN_VERSION', '3.2.1' );
42
  }
43
 
44