Version Description
- Bug fixes:
- Fixed missing semi-colon in tracker code
- Multi-site tracking failed in old installs where the PRIMARY KEY was not properly updated in the database. DB version has been updated to 6.0 to initiate primary key across all installs
Download this release
Release Info
Developer | Ajay |
Plugin | Top 10 – Popular posts plugin for WordPress |
Version | 2.5.5 |
Comparing to | |
See all releases |
Code changes from version 2.5.4 to 2.5.5
- README.md +1 -1
- includes/activate-deactivate.php +22 -26
- includes/public/media.php +3 -2
- includes/tracker.php +1 -1
- readme.txt +7 -1
- top-10.php +2 -2
README.md
CHANGED
@@ -7,7 +7,7 @@
|
|
7 |
|
8 |
__Requires:__ 4.1
|
9 |
|
10 |
-
__Tested up to:__
|
11 |
|
12 |
__License:__ [GPL-2.0+](http://www.gnu.org/licenses/gpl-2.0.html)
|
13 |
|
7 |
|
8 |
__Requires:__ 4.1
|
9 |
|
10 |
+
__Tested up to:__ 5.0
|
11 |
|
12 |
__License:__ [GPL-2.0+](http://www.gnu.org/licenses/gpl-2.0.html)
|
13 |
|
includes/activate-deactivate.php
CHANGED
@@ -67,7 +67,6 @@ function tptn_single_activate() {
|
|
67 |
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
68 |
dbDelta( $sql );
|
69 |
|
70 |
-
add_site_option( 'tptn_db_version', $tptn_db_version );
|
71 |
}
|
72 |
|
73 |
if ( $wpdb->get_var( "show tables like '$table_name_daily'" ) != $table_name_daily ) { // WPCS: unprepared SQL OK.
|
@@ -83,40 +82,37 @@ function tptn_single_activate() {
|
|
83 |
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
84 |
dbDelta( $sql );
|
85 |
|
86 |
-
add_site_option( 'tptn_db_version', $tptn_db_version );
|
87 |
}
|
88 |
|
|
|
|
|
89 |
// Upgrade table code.
|
90 |
$installed_ver = get_site_option( 'tptn_db_version' );
|
91 |
|
92 |
if ( $installed_ver != $tptn_db_version ) {
|
93 |
|
94 |
-
$
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
case '4.0':
|
99 |
-
case 4.0:
|
100 |
-
$wpdb->query( 'ALTER TABLE ' . $table_name . " CHANGE blog_id blog_id bigint(20) NOT NULL DEFAULT '1'" ); // WPCS: unprepared SQL OK.
|
101 |
-
$wpdb->query( 'ALTER TABLE ' . $table_name_daily . " CHANGE blog_id blog_id bigint(20) NOT NULL DEFAULT '1'" ); // WPCS: unprepared SQL OK.
|
102 |
-
break;
|
103 |
-
|
104 |
-
default:
|
105 |
-
$wpdb->query( 'ALTER TABLE ' . $table_name . ' MODIFY postnumber bigint(20) ' ); // WPCS: unprepared SQL OK.
|
106 |
-
$wpdb->query( 'ALTER TABLE ' . $table_name_daily . ' MODIFY postnumber bigint(20) ' ); // WPCS: unprepared SQL OK.
|
107 |
-
$wpdb->query( 'ALTER TABLE ' . $table_name . ' MODIFY cntaccess bigint(20) ' ); // WPCS: unprepared SQL OK.
|
108 |
-
$wpdb->query( 'ALTER TABLE ' . $table_name_daily . ' MODIFY cntaccess bigint(20) ' ); // WPCS: unprepared SQL OK.
|
109 |
-
$wpdb->query( 'ALTER TABLE ' . $table_name_daily . ' MODIFY dp_date DATETIME ' ); // WPCS: unprepared SQL OK.
|
110 |
-
$wpdb->query( 'ALTER TABLE ' . $table_name . ' DROP PRIMARY KEY, ADD PRIMARY KEY(postnumber, blog_id) ' ); // WPCS: unprepared SQL OK.
|
111 |
-
$wpdb->query( 'ALTER TABLE ' . $table_name_daily . ' DROP PRIMARY KEY, ADD PRIMARY KEY(postnumber, dp_date, blog_id) ' ); // WPCS: unprepared SQL OK.
|
112 |
-
$wpdb->query( 'ALTER TABLE ' . $table_name . " ADD blog_id bigint(20) NOT NULL DEFAULT '1'" ); // WPCS: unprepared SQL OK.
|
113 |
-
$wpdb->query( 'ALTER TABLE ' . $table_name_daily . " ADD blog_id bigint(20) NOT NULL DEFAULT '1'" ); // WPCS: unprepared SQL OK.
|
114 |
-
$wpdb->query( 'UPDATE ' . $table_name . ' SET blog_id = 1 WHERE blog_id = 0 ' ); // WPCS: unprepared SQL OK.
|
115 |
-
$wpdb->query( 'UPDATE ' . $table_name_daily . ' SET blog_id = 1 WHERE blog_id = 0 ' ); // WPCS: unprepared SQL OK.
|
116 |
|
117 |
-
|
|
|
|
|
|
|
|
|
|
|
118 |
|
119 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
|
121 |
update_site_option( 'tptn_db_version', $tptn_db_version );
|
122 |
}
|
67 |
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
68 |
dbDelta( $sql );
|
69 |
|
|
|
70 |
}
|
71 |
|
72 |
if ( $wpdb->get_var( "show tables like '$table_name_daily'" ) != $table_name_daily ) { // WPCS: unprepared SQL OK.
|
82 |
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
83 |
dbDelta( $sql );
|
84 |
|
|
|
85 |
}
|
86 |
|
87 |
+
add_site_option( 'tptn_db_version', $tptn_db_version );
|
88 |
+
|
89 |
// Upgrade table code.
|
90 |
$installed_ver = get_site_option( 'tptn_db_version' );
|
91 |
|
92 |
if ( $installed_ver != $tptn_db_version ) {
|
93 |
|
94 |
+
$sql = 'ALTER TABLE ' . $table_name . ' DROP PRIMARY KEY ';
|
95 |
+
$wpdb->query( $sql );
|
96 |
+
$sql = 'ALTER TABLE ' . $table_name_daily . ' DROP PRIMARY KEY ';
|
97 |
+
$wpdb->query( $sql );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
+
$sql = 'CREATE TABLE ' . $table_name . " (
|
100 |
+
postnumber bigint(20) NOT NULL,
|
101 |
+
cntaccess bigint(20) NOT NULL,
|
102 |
+
blog_id bigint(20) NOT NULL DEFAULT '1',
|
103 |
+
PRIMARY KEY (postnumber, blog_id)
|
104 |
+
);";
|
105 |
|
106 |
+
$sql .= 'CREATE TABLE ' . $table_name_daily . " (
|
107 |
+
postnumber bigint(20) NOT NULL,
|
108 |
+
cntaccess bigint(20) NOT NULL,
|
109 |
+
dp_date DATETIME NOT NULL,
|
110 |
+
blog_id bigint(20) NOT NULL DEFAULT '1',
|
111 |
+
PRIMARY KEY (postnumber, dp_date, blog_id)
|
112 |
+
);";
|
113 |
+
|
114 |
+
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
|
115 |
+
dbDelta( $sql );
|
116 |
|
117 |
update_site_option( 'tptn_db_version', $tptn_db_version );
|
118 |
}
|
includes/public/media.php
CHANGED
@@ -90,7 +90,7 @@ function tptn_get_the_post_thumbnail( $args = array() ) {
|
|
90 |
|
91 |
// Let's start fetching the thumbnail. First place to look is in the post meta defined in the Settings page.
|
92 |
if ( ! $postimage ) {
|
93 |
-
$postimage = get_post_meta( $result->ID, $args['thumb_meta'], true );
|
94 |
$pick = 'meta';
|
95 |
if ( $postimage ) {
|
96 |
$postimage_id = tptn_get_attachment_id_from_url( $postimage );
|
@@ -227,8 +227,9 @@ function tptn_get_the_post_thumbnail( $args = array() ) {
|
|
227 |
*
|
228 |
* @param array $output Formatted output
|
229 |
* @param array $args Argument list
|
|
|
230 |
*/
|
231 |
-
return apply_filters( 'tptn_get_the_post_thumbnail', $output, $args );
|
232 |
}
|
233 |
|
234 |
|
90 |
|
91 |
// Let's start fetching the thumbnail. First place to look is in the post meta defined in the Settings page.
|
92 |
if ( ! $postimage ) {
|
93 |
+
$postimage = get_post_meta( $result->ID, $args['thumb_meta'], true );
|
94 |
$pick = 'meta';
|
95 |
if ( $postimage ) {
|
96 |
$postimage_id = tptn_get_attachment_id_from_url( $postimage );
|
227 |
*
|
228 |
* @param array $output Formatted output
|
229 |
* @param array $args Argument list
|
230 |
+
* @param string $postimage Thumbnail URL
|
231 |
*/
|
232 |
+
return apply_filters( 'tptn_get_the_post_thumbnail', $output, $args, $postimage );
|
233 |
}
|
234 |
|
235 |
|
includes/tracker.php
CHANGED
@@ -178,7 +178,7 @@ function tptn_parse_request( $wp ) {
|
|
178 |
$output = get_tptn_post_count( $id );
|
179 |
|
180 |
header( 'content-type: application/x-javascript' );
|
181 |
-
echo 'document.write("' . $output . '")'; // WPCS: XSS OK.
|
182 |
|
183 |
// Stop anything else from loading as it is not needed.
|
184 |
exit;
|
178 |
$output = get_tptn_post_count( $id );
|
179 |
|
180 |
header( 'content-type: application/x-javascript' );
|
181 |
+
echo 'document.write("' . $output . '");'; // WPCS: XSS OK.
|
182 |
|
183 |
// Stop anything else from loading as it is not needed.
|
184 |
exit;
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Contributors: webberzone, Ajay
|
|
4 |
Donate link: https://ajaydsouza.com/donate/
|
5 |
Stable tag: trunk
|
6 |
Requires at least: 4.1
|
7 |
-
Tested up to:
|
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.
|
@@ -165,6 +165,12 @@ add_filter( 'manage_edit-projects_sortable_columns', 'tptn_column_register_sorta
|
|
165 |
|
166 |
== Changelog ==
|
167 |
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
= 2.5.4 =
|
169 |
|
170 |
* Features:
|
4 |
Donate link: https://ajaydsouza.com/donate/
|
5 |
Stable tag: trunk
|
6 |
Requires at least: 4.1
|
7 |
+
Tested up to: 5.0
|
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.
|
165 |
|
166 |
== Changelog ==
|
167 |
|
168 |
+
= 2.5.5 =
|
169 |
+
|
170 |
+
* Bug fixes:
|
171 |
+
* Fixed missing semi-colon in tracker code
|
172 |
+
* Multi-site tracking failed in old installs where the PRIMARY KEY was not properly updated in the database. DB version has been updated to 6.0 to initiate primary key across all installs
|
173 |
+
|
174 |
= 2.5.4 =
|
175 |
|
176 |
* Features:
|
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.5.
|
18 |
* Author: Ajay D'Souza
|
19 |
* Author URI: https://webberzone.com
|
20 |
* License: GPL-2.0+
|
@@ -72,7 +72,7 @@ if ( ! defined( 'TOP_TEN_PLUGIN_FILE' ) ) {
|
|
72 |
* @var string
|
73 |
*/
|
74 |
global $tptn_db_version;
|
75 |
-
$tptn_db_version = '
|
76 |
|
77 |
|
78 |
/**
|
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.5.5
|
18 |
* Author: Ajay D'Souza
|
19 |
* Author URI: https://webberzone.com
|
20 |
* License: GPL-2.0+
|
72 |
* @var string
|
73 |
*/
|
74 |
global $tptn_db_version;
|
75 |
+
$tptn_db_version = '6.0';
|
76 |
|
77 |
|
78 |
/**
|