Top 10 – Popular posts plugin for WordPress - Version 1.6.1

Version Description

  • Turned the credit option to false by default. This setting won't effect current users.
  • Turned off borders on post thumbnails. You can customise the CSS class "tptn_thumb" to style the post thumbnail.
  • The plugin will now display a list of changes in the WordPress Admin > Plugins area whenever an update is available
  • Fixed: Display of caching plugin compliant daily top posts lists
Download this release

Release Info

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

Code changes from version 1.6 to 1.6.1

admin.inc.php CHANGED
@@ -402,6 +402,7 @@ function tptn_pop_display($daily = false, $page = 0, $limit = 10) {
402
  $sql .= "FROM $table_name INNER JOIN ". $wpdb->posts ." ON postnumber=ID " ;
403
  if ($tptn_settings['exclude_pages']) $sql .= "AND post_type = 'post' ";
404
  $sql .= "AND post_status = 'publish' ";
 
405
  $sql .= "ORDER BY cntaccess DESC LIMIT $page, $limit";
406
  } else {
407
  $sql = "SELECT postnumber, SUM(cntaccess) as sumCount, dp_date, ID, post_type, post_status ";
402
  $sql .= "FROM $table_name INNER JOIN ". $wpdb->posts ." ON postnumber=ID " ;
403
  if ($tptn_settings['exclude_pages']) $sql .= "AND post_type = 'post' ";
404
  $sql .= "AND post_status = 'publish' ";
405
+ $sql .= "GROUP BY postnumber ";
406
  $sql .= "ORDER BY cntaccess DESC LIMIT $page, $limit";
407
  } else {
408
  $sql = "SELECT postnumber, SUM(cntaccess) as sumCount, dp_date, ID, post_type, post_status ";
languages/tptn-be_BY.mo CHANGED
Binary file
languages/tptn-be_BY.po CHANGED
@@ -2,7 +2,7 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Топ 10\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2010-02-14 01:08+0530\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Ajay D'Souza <me@ajaydsouza.com>\n"
8
  "Language-Team: FatCow <zhr@tut.by>\n"
2
  msgstr ""
3
  "Project-Id-Version: Топ 10\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2010-02-20 19:27+0530\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Ajay D'Souza <me@ajaydsouza.com>\n"
8
  "Language-Team: FatCow <zhr@tut.by>\n"
languages/tptn-it_IT.mo CHANGED
Binary file
languages/tptn-it_IT.po CHANGED
@@ -2,9 +2,9 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Top 10 in italiano\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2010-02-14 01:08+0530\n"
6
  "PO-Revision-Date: \n"
7
- "Last-Translator: Gianni Diurno (aka gidibao) <gidibao[at]gmail[dot]com>\n"
8
  "Language-Team: Gianni Diurno |gidibao.net <gidibao[at]gmail[dot]com>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
@@ -309,10 +309,12 @@ msgstr "Donazione"
309
 
310
  #~ msgid "If you find "
311
  #~ msgstr "Avessi trovato utile il mio"
 
312
  #~ msgid "useful, please do"
313
  #~ msgstr ", effettua"
 
314
  #~ msgid "drop in your contribution"
315
  #~ msgstr "una donazione"
 
316
  #~ msgid "Some reasons why you should."
317
  #~ msgstr "alcuni motivi affinché tu lo faccia"
318
-
2
  msgstr ""
3
  "Project-Id-Version: Top 10 in italiano\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2010-02-20 19:27+0530\n"
6
  "PO-Revision-Date: \n"
7
+ "Last-Translator: Ajay D'Souza <me@ajaydsouza.com>\n"
8
  "Language-Team: Gianni Diurno |gidibao.net <gidibao[at]gmail[dot]com>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
309
 
310
  #~ msgid "If you find "
311
  #~ msgstr "Avessi trovato utile il mio"
312
+
313
  #~ msgid "useful, please do"
314
  #~ msgstr ", effettua"
315
+
316
  #~ msgid "drop in your contribution"
317
  #~ msgstr "una donazione"
318
+
319
  #~ msgid "Some reasons why you should."
320
  #~ msgstr "alcuni motivi affinché tu lo faccia"
 
languages/tptn-ru_RU.mo CHANGED
Binary file
languages/tptn-ru_RU.po CHANGED
@@ -2,7 +2,7 @@ msgid ""
2
  msgstr ""
3
  "Project-Id-Version: Топ 10\n"
4
  "Report-Msgid-Bugs-To: \n"
5
- "POT-Creation-Date: 2010-02-14 01:08+0530\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Ajay D'Souza <me@ajaydsouza.com>\n"
8
  "Language-Team: Elvis (fweb.org.ru) <kopper@rkmail.ru>\n"
2
  msgstr ""
3
  "Project-Id-Version: Топ 10\n"
4
  "Report-Msgid-Bugs-To: \n"
5
+ "POT-Creation-Date: 2010-02-20 19:27+0530\n"
6
  "PO-Revision-Date: \n"
7
  "Last-Translator: Ajay D'Souza <me@ajaydsouza.com>\n"
8
  "Language-Team: Elvis (fweb.org.ru) <kopper@rkmail.ru>\n"
readme.txt CHANGED
@@ -4,7 +4,7 @@ Contributors: Ajay, Mark Ghosh
4
  Donate link: http://ajaydsouza.com/donate/
5
  Stable tag: trunk
6
  Requires at least: 2.5
7
- Tested up to: 2.9.1
8
 
9
 
10
  Track daily and total visits on your blog posts and display the count as well as popular posts.
@@ -29,6 +29,12 @@ Includes a sidebar widget to display the popular posts. And, all settings can be
29
 
30
  == Changelog ==
31
 
 
 
 
 
 
 
32
  = 1.6 =
33
  * Added: Added support for excerpts and detection of first image in the post
34
  * Added: Daily posts are tracked using the blog time instead of server time
@@ -76,6 +82,11 @@ Includes a sidebar widget to display the popular posts. And, all settings can be
76
  = 1.0.1 =
77
  * Release
78
 
 
 
 
 
 
79
 
80
  == Installation ==
81
 
4
  Donate link: http://ajaydsouza.com/donate/
5
  Stable tag: trunk
6
  Requires at least: 2.5
7
+ Tested up to: 2.9.2
8
 
9
 
10
  Track daily and total visits on your blog posts and display the count as well as popular posts.
29
 
30
  == Changelog ==
31
 
32
+ = 1.6.1 =
33
+ * Turned the credit option to false by default. This setting won't effect current users.
34
+ * Turned off borders on post thumbnails. You can customise the CSS class "tptn_thumb" to style the post thumbnail.
35
+ * The plugin will now display a list of changes in the WordPress Admin > Plugins area whenever an update is available
36
+ * Fixed: Display of caching plugin compliant daily top posts lists
37
+
38
  = 1.6 =
39
  * Added: Added support for excerpts and detection of first image in the post
40
  * Added: Daily posts are tracked using the blog time instead of server time
82
  = 1.0.1 =
83
  * Release
84
 
85
+ == Upgrade Notice ==
86
+
87
+ = 1.6.1 =
88
+ * Turned the credit option to false by default. This setting won't effect current users.
89
+
90
 
91
  == Installation ==
92
 
top-10-daily.js.php CHANGED
@@ -46,20 +46,27 @@ function tptn_daily_lists() {
46
  if (($tptn_settings['post_thumb_op']=='inline')||($tptn_settings['post_thumb_op']=='thumbs_only')) {
47
  $output .= '<a href="'.get_permalink($result->postnumber).'" rel="bookmark">';
48
  if ((function_exists('has_post_thumbnail')) && (has_post_thumbnail($result->postnumber))) {
49
- $output .= get_the_post_thumbnail( $result->postnumber, array($tptn_settings[thumb_width],$tptn_settings[thumb_height]), array('title' => $title,'alt' => $title));
50
  } else {
51
- $postimage = get_post_meta($result->postnumber, 'post-image', true);
52
- if ($postimage) {
53
- $output .= '<img src="'.$postimage.'" alt="'.$title.'" title="'.$title.'" width="'.$tptn_settings[thumb_width].'" height="'.$tptn_settings[thumb_height].'" />';
54
- } else {
55
- $output .= '<img src="'.$tptn_settings[thumb_default].'" alt="'.$title.'" title="'.$title.'" width="'.$tptn_settings[thumb_width].'" height="'.$tptn_settings[thumb_height].'" />';
 
 
56
  }
 
 
57
  }
58
  $output .= '</a> ';
59
  }
60
  if (($tptn_settings['post_thumb_op']=='inline')||($tptn_settings['post_thumb_op']=='text_only')) {
61
  $output .= '<a href="'.get_permalink($result->postnumber).'" rel="bookmark">'.$title.'</a>';
62
  }
 
 
 
63
  if ($tptn_settings['disp_list_count']) $output .= ' ('.$result->sumCount.')';
64
  $output .= $tptn_settings['after_list_item'];
65
  }
46
  if (($tptn_settings['post_thumb_op']=='inline')||($tptn_settings['post_thumb_op']=='thumbs_only')) {
47
  $output .= '<a href="'.get_permalink($result->postnumber).'" rel="bookmark">';
48
  if ((function_exists('has_post_thumbnail')) && (has_post_thumbnail($result->postnumber))) {
49
+ $output .= get_the_post_thumbnail( $result->postnumber, array($tptn_settings[thumb_width],$tptn_settings[thumb_height]), array('title' => $title,'alt' => $title, 'class' => 'tptn_thumb', 'border' => '0'));
50
  } else {
51
+ $postimage = get_post_meta($result->postnumber, $tptn_settings[thumb_meta], true); // Check
52
+ if ((!$postimage)&&($tptn_settings['scan_images'])) {
53
+ preg_match_all( '|<img.*?src=[\'"](.*?)[\'"].*?>|i', $result->post_content, $matches );
54
+ // any image there?
55
+ if( isset( $matches ) && $matches[1][0] ) {
56
+ $postimage = $matches[1][0]; // we need the first one only!
57
+ }
58
  }
59
+ if (!$postimage) $postimage = $tptn_settings[thumb_default];
60
+ $output .= '<img src="'.$postimage.'" alt="'.$title.'" title="'.$title.'" width="'.$tptn_settings[thumb_width].'" height="'.$tptn_settings[thumb_height].'" border="0" class="tptn_thumb" />';
61
  }
62
  $output .= '</a> ';
63
  }
64
  if (($tptn_settings['post_thumb_op']=='inline')||($tptn_settings['post_thumb_op']=='text_only')) {
65
  $output .= '<a href="'.get_permalink($result->postnumber).'" rel="bookmark">'.$title.'</a>';
66
  }
67
+ if ($tptn_settings['show_excerpt']) {
68
+ $output .= '<span class="tptn_excerpt"> '.tptn_excerpt($result->post_content,$tptn_settings['excerpt_length']).'</span>';
69
+ }
70
  if ($tptn_settings['disp_list_count']) $output .= ' ('.$result->sumCount.')';
71
  $output .= $tptn_settings['after_list_item'];
72
  }
top-10.php CHANGED
@@ -1,7 +1,7 @@
1
  <?php
2
  /*
3
  Plugin Name: Top 10
4
- Version: 1.6
5
  Plugin URI: http://ajaydsouza.com/wordpress/plugins/top-10/
6
  Description: Count daily and total visits per post and display the most popular posts based on the number of views. Based on the plugin by <a href="http://weblogtoolscollection.com">Mark Ghosh</a>
7
  Author: Ajay D'Souza
@@ -153,7 +153,7 @@ function tptn_pop_posts( $daily = false , $widget = false ) {
153
  if (($tptn_settings['post_thumb_op']=='inline')||($tptn_settings['post_thumb_op']=='thumbs_only')) {
154
  $output .= '<a href="'.get_permalink($result->postnumber).'" rel="bookmark">';
155
  if ((function_exists('has_post_thumbnail')) && (has_post_thumbnail($result->postnumber))) {
156
- $output .= get_the_post_thumbnail( $result->postnumber, array($tptn_settings[thumb_width],$tptn_settings[thumb_height]), array('title' => $title,'alt' => $title, 'class' => 'tptn_thumb'));
157
  } else {
158
  $postimage = get_post_meta($result->postnumber, $tptn_settings[thumb_meta], true); // Check
159
  if ((!$postimage)&&($tptn_settings['scan_images'])) {
@@ -164,7 +164,7 @@ function tptn_pop_posts( $daily = false , $widget = false ) {
164
  }
165
  }
166
  if (!$postimage) $postimage = $tptn_settings[thumb_default];
167
- $output .= '<img src="'.$postimage.'" alt="'.$title.'" title="'.$title.'" width="'.$tptn_settings[thumb_width].'" height="'.$tptn_settings[thumb_height].'" class="tptn_thumb" />';
168
  }
169
  $output .= '</a> ';
170
  }
@@ -245,7 +245,7 @@ function tptn_default_options() {
245
  $thumb_default = $tptn_url.'/default.png';
246
 
247
  $tptn_settings = Array (
248
- show_credit => true, // Add link to plugin page of my blog in top posts list
249
  add_to_content => true, // Add post count to content (only on single posts)
250
  exclude_pages => true, // Exclude Pages
251
  count_on_pages => true, // Display on pages
@@ -438,7 +438,30 @@ if ( version_compare( $wp_version, '2.8alpha', '>' ) )
438
  add_filter( 'plugin_row_meta', 'tptn_plugin_actions', 10, 2 ); // only 2.8 and higher
439
  else add_filter( 'plugin_action_links', 'tptn_plugin_actions', 10, 2 );
440
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
441
  }
 
 
 
 
442
 
443
 
444
  ?>
1
  <?php
2
  /*
3
  Plugin Name: Top 10
4
+ Version: 1.6.1
5
  Plugin URI: http://ajaydsouza.com/wordpress/plugins/top-10/
6
  Description: Count daily and total visits per post and display the most popular posts based on the number of views. Based on the plugin by <a href="http://weblogtoolscollection.com">Mark Ghosh</a>
7
  Author: Ajay D'Souza
153
  if (($tptn_settings['post_thumb_op']=='inline')||($tptn_settings['post_thumb_op']=='thumbs_only')) {
154
  $output .= '<a href="'.get_permalink($result->postnumber).'" rel="bookmark">';
155
  if ((function_exists('has_post_thumbnail')) && (has_post_thumbnail($result->postnumber))) {
156
+ $output .= get_the_post_thumbnail( $result->postnumber, array($tptn_settings[thumb_width],$tptn_settings[thumb_height]), array('title' => $title,'alt' => $title, 'class' => 'tptn_thumb', 'border' => '0'));
157
  } else {
158
  $postimage = get_post_meta($result->postnumber, $tptn_settings[thumb_meta], true); // Check
159
  if ((!$postimage)&&($tptn_settings['scan_images'])) {
164
  }
165
  }
166
  if (!$postimage) $postimage = $tptn_settings[thumb_default];
167
+ $output .= '<img src="'.$postimage.'" alt="'.$title.'" title="'.$title.'" width="'.$tptn_settings[thumb_width].'" height="'.$tptn_settings[thumb_height].'" border="0" class="tptn_thumb" />';
168
  }
169
  $output .= '</a> ';
170
  }
245
  $thumb_default = $tptn_url.'/default.png';
246
 
247
  $tptn_settings = Array (
248
+ show_credit => false, // Add link to plugin page of my blog in top posts list
249
  add_to_content => true, // Add post count to content (only on single posts)
250
  exclude_pages => true, // Exclude Pages
251
  count_on_pages => true, // Display on pages
438
  add_filter( 'plugin_row_meta', 'tptn_plugin_actions', 10, 2 ); // only 2.8 and higher
439
  else add_filter( 'plugin_action_links', 'tptn_plugin_actions', 10, 2 );
440
 
441
+ // Display message about plugin update option
442
+ function tptn_check_version($file, $plugin_data) {
443
+ global $wp_version;
444
+ static $this_plugin;
445
+ $wp_version = str_replace(".","",$wp_version);
446
+ if (!$this_plugin) $this_plugin = plugin_basename(__FILE__);
447
+ if ($file == $this_plugin){
448
+ $current = $wp_version < 28 ? get_option('update_plugins') : get_transient('update_plugins');
449
+ if (!isset($current->response[$file])) return false;
450
+
451
+ $columns = $wp_version < 28 ? 5 : 3;
452
+ $url = 'http://svn.wp-plugins.org/top-10/trunk/update-info.txt';
453
+ $update = wp_remote_fopen($url);
454
+ if ($update != "") {
455
+ echo '<tr class="plugin-update-tr"><td colspan="'.$columns.'" class="plugin-update"><div class="update-message">';
456
+ echo $update;
457
+ echo '</div></td></tr>';
458
+ }
459
+ }
460
  }
461
+ add_action('after_plugin_row', 'tptn_check_version', 10, 2);
462
+
463
+
464
+ } // End admin.inc
465
 
466
 
467
  ?>
update-info.txt ADDED
@@ -0,0 +1,4 @@
 
 
 
 
1
+ * Turned the credit option to false by default. This setting won't effect current users.<br />
2
+ * Turned off borders on post thumbnails. You can customise the CSS class "tptn_thumb" to style the post thumbnail.<br />
3
+ * The plugin will now display a list of changes in the WordPress Admin > Plugins area whenever an update is available<br />
4
+ * Fixed: Display of caching plugin compliant daily top posts lists