Top 10 – Popular posts plugin for WordPress - Version 2.6.3

Version Description

Release post: https://wzn.io/2L7w8mi

  • Enhancements:

    • tptn_get_first_image filter has additional attributes $image_attributes[0], $postid, $thumb_width, $thumb_height
  • Bug fixes:

    • Reverted PolyLang implementation that was broken in v2.6.2
    • Delete deprecated settings on save
    • Fix settings link in plugins listing page
    • Fix exclude categories setting on save
Download this release

Release Info

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

Code changes from version 2.6.2 to 2.6.3

changelog.txt CHANGED
@@ -1,5 +1,47 @@
1
  This file holds the archive of changelog entries
2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 2.3.2 =
4
 
5
  * Bug fixes:
1
  This file holds the archive of changelog entries
2
 
3
+ = 2.4.4 =
4
+
5
+ * Enhancements:
6
+ * Changed tracker type to Query based for better compatibility
7
+
8
+ * Bug fixes:
9
+ * Security fix: Potential SQL injection vulnerability. Reported by [DefenseCode ThunderScan](http://www.defensecode.com/)
10
+ * Revisions no longer displayed in the "View Popular Posts" screen in admin area
11
+
12
+ = 2.4.3 =
13
+
14
+ * Bug fixes:
15
+ * Fatal error when running PHP 7.1.x
16
+
17
+ = 2.4.2 =
18
+
19
+ * Bug fixes:
20
+ * The plugin will no longer generate any notices if post author is missing
21
+ * Fixed T_FUNCTION error in admin area on blogs running on PHP versions before 5.3
22
+ * Fixed bug where any special characters in the post title would break the output
23
+
24
+ = 2.4.1 =
25
+
26
+ * Bug fixes:
27
+ * Fixes fatal error caused on installs which have versions below PHP5.6
28
+
29
+ = 2.4.0 =
30
+
31
+ * Features:
32
+ * New tracker using a properly enqueued `.js` file. Two inbuilt options to use query variables or ajaxurl to process the counts
33
+ * Shortcode and the widget now have an added parameter for 'offset'. This is useful if you would like to display different widgets/shortcodes but not always start from the first post
34
+
35
+ * Bug fixes:
36
+ * Attachments now work with the widget and elsewhere
37
+ * New tracker now works when jQuery is loaded in the footer
38
+ * Don't add tracker code when previewing in customizer
39
+ * Doesn't report an error if no author is assigned to a post
40
+
41
+ * Deprecated:
42
+ * `tptn_add_tracker` and `tptn_add_viewed_count` have been deprecated. These should no longer be needed with the new tracker option.
43
+ * wick script in Settings page which was used for fetching category slugs. You should now use the category name (prompted automatically). Slugs will be automatically converted into names.
44
+
45
  = 2.3.2 =
46
 
47
  * Bug fixes:
default.png CHANGED
Binary file
default2.png CHANGED
Binary file
includes/admin/admin.php CHANGED
@@ -363,7 +363,7 @@ function tptn_plugin_actions_links( $links ) {
363
 
364
  return array_merge(
365
  array(
366
- 'settings' => '<a href="' . admin_url( 'options-general.php?page=tptn_options_page' ) . '">' . __( 'Settings', 'top-10' ) . '</a>',
367
  ),
368
  $links
369
  );
363
 
364
  return array_merge(
365
  array(
366
+ 'settings' => '<a href="' . admin_url( 'admin.php?page=tptn_options_page' ) . '">' . __( 'Settings', 'top-10' ) . '</a>',
367
  ),
368
  $links
369
  );
includes/admin/save-settings.php CHANGED
@@ -109,11 +109,11 @@ function tptn_settings_sanitize( $input = array() ) {
109
  if ( ! isset( $input[ $key ] ) ) {
110
  unset( $output[ $key ] );
111
  }
112
- }
113
 
114
- // Delete any settings that are no longer part of our registered settings.
115
- if ( array_key_exists( $key, $output ) && ! array_key_exists( $key, $settings_types ) ) {
116
- unset( $output[ $key ] );
 
117
  }
118
 
119
  add_settings_error( 'tptn-notices', '', __( 'Settings updated.', 'top-10' ), 'updated' );
@@ -288,9 +288,9 @@ add_filter( 'tptn_settings_sanitize_posttypes', 'tptn_sanitize_posttypes_field'
288
  */
289
  function tptn_sanitize_exclude_cat( $settings ) {
290
 
291
- if ( ! empty( $settings['exclude_cat_slugs'] ) ) {
292
 
293
- $exclude_cat_slugs = explode( ',', $settings['exclude_cat_slugs'] );
294
 
295
  foreach ( $exclude_cat_slugs as $cat_name ) {
296
  $cat = get_term_by( 'name', $cat_name, 'category' );
109
  if ( ! isset( $input[ $key ] ) ) {
110
  unset( $output[ $key ] );
111
  }
 
112
 
113
+ // Delete any settings that are no longer part of our registered settings.
114
+ if ( array_key_exists( $key, $output ) && ! array_key_exists( $key, $settings_types ) ) {
115
+ unset( $output[ $key ] );
116
+ }
117
  }
118
 
119
  add_settings_error( 'tptn-notices', '', __( 'Settings updated.', 'top-10' ), 'updated' );
288
  */
289
  function tptn_sanitize_exclude_cat( $settings ) {
290
 
291
+ if ( isset( $settings['exclude_cat_slugs'] ) ) {
292
 
293
+ $exclude_cat_slugs = array_unique( explode( ',', $settings['exclude_cat_slugs'] ) );
294
 
295
  foreach ( $exclude_cat_slugs as $cat_name ) {
296
  $cat = get_term_by( 'name', $cat_name, 'category' );
includes/l10n.php CHANGED
@@ -38,17 +38,11 @@ function tptn_object_id_cur_lang( $post_id ) {
38
  $return_original_if_missing = apply_filters( 'tptn_wpml_return_original', $return_original_if_missing, $post_id );
39
 
40
  if ( function_exists( 'pll_get_post' ) ) {
41
- $lang_id = pll_get_post( $post_id );
42
- if ( $lang_id ) {
43
- $post_id = $lang_id;
44
- }
45
  } elseif ( function_exists( 'wpml_object_id' ) ) {
46
  $post_id = apply_filters( 'wpml_object_id', $post_id, get_post_type( $post_id ), $return_original_if_missing );
47
  } elseif ( function_exists( 'icl_object_id' ) ) {
48
- $lang_id = icl_object_id( $post_id, get_post_type( $post_id ), $return_original_if_missing );
49
- if ( $lang_id ) {
50
- $post_id = $lang_id;
51
- }
52
  }
53
 
54
  /**
38
  $return_original_if_missing = apply_filters( 'tptn_wpml_return_original', $return_original_if_missing, $post_id );
39
 
40
  if ( function_exists( 'pll_get_post' ) ) {
41
+ $post_id = pll_get_post( $post_id );
 
 
 
42
  } elseif ( function_exists( 'wpml_object_id' ) ) {
43
  $post_id = apply_filters( 'wpml_object_id', $post_id, get_post_type( $post_id ), $return_original_if_missing );
44
  } elseif ( function_exists( 'icl_object_id' ) ) {
45
+ $post_id = icl_object_id( $post_id, get_post_type( $post_id ), $return_original_if_missing );
 
 
 
46
  }
47
 
48
  /**
includes/public/media.php CHANGED
@@ -378,12 +378,14 @@ function tptn_get_first_image( $postid, $thumb_width, $thumb_height ) {
378
  /**
379
  * Filters first child attachment from the post.
380
  *
381
- * @since 1.9.10.1
382
  *
383
- * @param array $image_attributes[0] URL of the image
384
- * @param int $postid Post ID
 
 
385
  */
386
- return apply_filters( 'tptn_get_first_image', $image_attributes[0] );
387
  }
388
  } else {
389
  return false;
378
  /**
379
  * Filters first child attachment from the post.
380
  *
381
+ * @since 1.9.10.1
382
  *
383
+ * @param array $image_attributes[0] URL of the image
384
+ * @param int $postid Post ID
385
+ * @param int $thumb_width Thumb width
386
+ * @param int $thumb_height Thumb height
387
  */
388
+ return apply_filters( 'tptn_get_first_image', $image_attributes[0], $postid, $thumb_width, $thumb_height );
389
  }
390
  } else {
391
  return false;
languages/top-10-en_US.mo CHANGED
Binary file
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: 2019-03-02 13:07+0000\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Ajay D'Souza <me@ajaydsouza.com>\n"
8
  "Language-Team: WebberZone <plugins@webberzone.com>\n"
2
  msgstr ""
3
  "Project-Id-Version: Top 10\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2019-04-27 10:16+0100\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Ajay D'Souza <me@ajaydsouza.com>\n"
8
  "Language-Team: WebberZone <plugins@webberzone.com>\n"
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: 2019-03-02 13:07+0000\n"
7
  "PO-Revision-Date: \n"
8
  "Last-Translator: Ajay D'Souza <me@ajaydsouza.com>\n"
9
  "Language-Team: WebberZone <plugins@webberzone.com>\n"
3
  msgstr ""
4
  "Project-Id-Version: Top 10\n"
5
  "Report-Msgid-Bugs-To: \n"
6
+ "POT-Creation-Date: 2019-04-27 10:16+0100\n"
7
  "PO-Revision-Date: \n"
8
  "Last-Translator: Ajay D'Souza <me@ajaydsouza.com>\n"
9
  "Language-Team: WebberZone <plugins@webberzone.com>\n"
readme.txt CHANGED
@@ -3,8 +3,8 @@ Tags: popular posts, top 10, counter, top posts, daily popular, page views, stat
3
  Contributors: webberzone, Ajay
4
  Donate link: https://ajaydsouza.com/donate/
5
  Stable tag: trunk
6
- Requires at least: 4.5
7
- Tested up to: 5.1
8
  License: GPLv2 or later
9
 
10
  Track daily and total visits on your blog posts. Display the count as well as popular and trending posts.
@@ -116,21 +116,7 @@ The main CSS classes include:
116
 
117
  = Shortcodes =
118
 
119
- `[tptn_list]` lets you insert the popular posts anywhere in your post content. It takes three main optional attributes `limit`, `heading` and `daily` as follows:
120
-
121
- *limit* : Maximum number of posts to return. The actual number displayed may be lower depending on the category / post exclusion settings.
122
-
123
- *heading* : Set to 0 to disable the heading specified in **Title of popular posts:** under **Output options**
124
-
125
- *daily* : If set to 1, then the shortcode will return the daily popular posts list
126
-
127
- In addition to these attributes, the shortcode can take all the options as attributes. To see the detailed list take a look at the function `tptn_register_settings()` in **includes/admin/register-settings**
128
-
129
-
130
- `[tptn_views]` lets you display the number of visits. The plugin takes one optional attribute `daily` as follows:
131
-
132
- *daily* : If set to 1, then the shortcode will return the number of _daily_ views
133
-
134
 
135
  = Manual install =
136
 
@@ -170,6 +156,19 @@ add_filter( 'manage_edit-projects_sortable_columns', 'tptn_column_register_sorta
170
 
171
  == Changelog ==
172
 
 
 
 
 
 
 
 
 
 
 
 
 
 
173
  = 2.6.2 =
174
 
175
  * Enhancements:
@@ -270,54 +269,12 @@ add_filter( 'manage_edit-projects_sortable_columns', 'tptn_column_register_sorta
270
  * Deprecated:
271
  * `tptn_default_options` (no replacement) and `tptn_read_options` (Use `tptn_get_settings` instead)
272
 
273
- = 2.4.4 =
274
-
275
- * Enhancements:
276
- * Changed tracker type to Query based for better compatibility
277
-
278
- * Bug fixes:
279
- * Security fix: Potential SQL injection vulnerability. Reported by [DefenseCode ThunderScan](http://www.defensecode.com/)
280
- * Revisions no longer displayed in the "View Popular Posts" screen in admin area
281
-
282
- = 2.4.3 =
283
-
284
- * Bug fixes:
285
- * Fatal error when running PHP 7.1.x
286
-
287
- = 2.4.2 =
288
-
289
- * Bug fixes:
290
- * The plugin will no longer generate any notices if post author is missing
291
- * Fixed T_FUNCTION error in admin area on blogs running on PHP versions before 5.3
292
- * Fixed bug where any special characters in the post title would break the output
293
-
294
- = 2.4.1 =
295
-
296
- * Bug fixes:
297
- * Fixes fatal error caused on installs which have versions below PHP5.6
298
-
299
- = 2.4.0 =
300
-
301
- * Features:
302
- * New tracker using a properly enqueued `.js` file. Two inbuilt options to use query variables or ajaxurl to process the counts
303
- * Shortcode and the widget now have an added parameter for 'offset'. This is useful if you would like to display different widgets/shortcodes but not always start from the first post
304
-
305
- * Bug fixes:
306
- * Attachments now work with the widget and elsewhere
307
- * New tracker now works when jQuery is loaded in the footer
308
- * Don't add tracker code when previewing in customizer
309
- * Doesn't report an error if no author is assigned to a post
310
-
311
- * Deprecated:
312
- * `tptn_add_tracker` and `tptn_add_viewed_count` have been deprecated. These should no longer be needed with the new tracker option.
313
- * wick script in Settings page which was used for fetching category slugs. You should now use the category name (prompted automatically). Slugs will be automatically converted into names.
314
-
315
  For previous changelog entries, please refer to the separate changelog.txt file
316
 
317
 
318
  == Upgrade Notice ==
319
 
320
- = 2.6.2 =
321
  * Bug fix release! Please verify your settings after upgrade.
322
  Check the Changelog for more details
323
 
3
  Contributors: webberzone, Ajay
4
  Donate link: https://ajaydsouza.com/donate/
5
  Stable tag: trunk
6
+ Requires at least: 4.7
7
+ Tested up to: 5.2
8
  License: GPLv2 or later
9
 
10
  Track daily and total visits on your blog posts. Display the count as well as popular and trending posts.
116
 
117
  = Shortcodes =
118
 
119
+ You can find details of the shortcodes in this [article](https://webberzone.com/support/knowledgebase/top-10-shortcodes/)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
120
 
121
  = Manual install =
122
 
156
 
157
  == Changelog ==
158
 
159
+ = 2.6.3 =
160
+
161
+ Release post: [https://wzn.io/2L7w8mi](https://wzn.io/2L7w8mi)
162
+
163
+ * Enhancements:
164
+ * `tptn_get_first_image` filter has additional attributes `$image_attributes[0], $postid, $thumb_width, $thumb_height`
165
+
166
+ * Bug fixes:
167
+ * Reverted PolyLang implementation that was broken in v2.6.2
168
+ * Delete deprecated settings on save
169
+ * Fix settings link in plugins listing page
170
+ * Fix exclude categories setting on save
171
+
172
  = 2.6.2 =
173
 
174
  * Enhancements:
269
  * Deprecated:
270
  * `tptn_default_options` (no replacement) and `tptn_read_options` (Use `tptn_get_settings` instead)
271
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
272
  For previous changelog entries, please refer to the separate changelog.txt file
273
 
274
 
275
  == Upgrade Notice ==
276
 
277
+ = 2.6.3 =
278
  * Bug fix release! Please verify your settings after upgrade.
279
  Check the Changelog for more details
280
 
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: 2.6.2
18
  * Author: Ajay D'Souza
19
  * Author URI: https://webberzone.com
20
  * License: GPL-2.0+
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: 2.6.3
18
  * Author: Ajay D'Souza
19
  * Author URI: https://webberzone.com
20
  * License: GPL-2.0+