Version Description
- Fixes bug where WPP didn't return the right URL when using Polylang / WPML.
- Fixes a compatibility issue with Yoast SEO (and potentially other plugins as well).
- Improves compatibility with MySQL 5.7+.
- Other minor fixes and improvements.
Download this release
Release Info
Developer | hcabrera |
Plugin | WordPress Popular Posts |
Version | 4.0.12 |
Comparing to | |
See all releases |
Code changes from version 4.0.11 to 4.0.12
- admin/class-wordpress-popular-posts-admin.php +21 -1
- includes/class-wordpress-popular-posts-activator.php +4 -4
- includes/class-wordpress-popular-posts-image.php +1 -1
- includes/class-wordpress-popular-posts-output.php +21 -1
- includes/class-wordpress-popular-posts.php +2 -2
- readme.txt +10 -3
- wordpress-popular-posts.php +1 -1
admin/class-wordpress-popular-posts-admin.php
CHANGED
@@ -1201,11 +1201,31 @@ class WPP_Admin {
|
|
1201 |
// Validate the structure of the tables, create missing tables / fields if necessary
|
1202 |
WPP_Activator::track_new_site();
|
1203 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1204 |
// Update summary table structure and indexes
|
1205 |
$summaryFields = $wpdb->get_results( "SHOW FIELDS FROM {$prefix}summary;" );
|
1206 |
foreach ( $summaryFields as $column ) {
|
1207 |
if ( "last_viewed" == $column->Field ) {
|
1208 |
-
$wpdb->query( "ALTER TABLE {$prefix}summary CHANGE last_viewed view_datetime datetime NOT NULL
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1209 |
}
|
1210 |
}
|
1211 |
|
1201 |
// Validate the structure of the tables, create missing tables / fields if necessary
|
1202 |
WPP_Activator::track_new_site();
|
1203 |
|
1204 |
+
// Update data table structure and indexes
|
1205 |
+
$dataFields = $wpdb->get_results( "SHOW FIELDS FROM {$prefix}data;" );
|
1206 |
+
foreach ( $dataFields as $column ) {
|
1207 |
+
if ( "day" == $column->Field ) {
|
1208 |
+
$wpdb->query( "ALTER TABLE {$prefix}data ALTER COLUMN day DROP DEFAULT;" );
|
1209 |
+
}
|
1210 |
+
|
1211 |
+
if ( "last_viewed" == $column->Field ) {
|
1212 |
+
$wpdb->query( "ALTER TABLE {$prefix}data ALTER COLUMN last_viewed DROP DEFAULT;" );
|
1213 |
+
}
|
1214 |
+
}
|
1215 |
+
|
1216 |
// Update summary table structure and indexes
|
1217 |
$summaryFields = $wpdb->get_results( "SHOW FIELDS FROM {$prefix}summary;" );
|
1218 |
foreach ( $summaryFields as $column ) {
|
1219 |
if ( "last_viewed" == $column->Field ) {
|
1220 |
+
$wpdb->query( "ALTER TABLE {$prefix}summary CHANGE last_viewed view_datetime datetime NOT NULL, ADD KEY view_datetime (view_datetime);" );
|
1221 |
+
}
|
1222 |
+
|
1223 |
+
if ( "view_date" == $column->Field ) {
|
1224 |
+
$wpdb->query( "ALTER TABLE {$prefix}summary ALTER COLUMN view_date DROP DEFAULT;" );
|
1225 |
+
}
|
1226 |
+
|
1227 |
+
if ( "view_datetime" == $column->Field ) {
|
1228 |
+
$wpdb->query( "ALTER TABLE {$prefix}summary ALTER COLUMN view_datetime DROP DEFAULT;" );
|
1229 |
}
|
1230 |
}
|
1231 |
|
includes/class-wordpress-popular-posts-activator.php
CHANGED
@@ -108,8 +108,8 @@ class WPP_Activator {
|
|
108 |
$sql = "
|
109 |
CREATE TABLE {$prefix}data (
|
110 |
postid bigint(20) NOT NULL,
|
111 |
-
day datetime NOT NULL
|
112 |
-
last_viewed datetime NOT NULL
|
113 |
pageviews bigint(20) DEFAULT 1,
|
114 |
PRIMARY KEY (postid)
|
115 |
) {$charset_collate} ENGINE=InnoDB;
|
@@ -117,8 +117,8 @@ class WPP_Activator {
|
|
117 |
ID bigint(20) NOT NULL AUTO_INCREMENT,
|
118 |
postid bigint(20) NOT NULL,
|
119 |
pageviews bigint(20) NOT NULL DEFAULT 1,
|
120 |
-
view_date date NOT NULL
|
121 |
-
view_datetime datetime NOT NULL
|
122 |
PRIMARY KEY (ID),
|
123 |
KEY postid (postid),
|
124 |
KEY view_date (view_date),
|
108 |
$sql = "
|
109 |
CREATE TABLE {$prefix}data (
|
110 |
postid bigint(20) NOT NULL,
|
111 |
+
day datetime NOT NULL,
|
112 |
+
last_viewed datetime NOT NULL,
|
113 |
pageviews bigint(20) DEFAULT 1,
|
114 |
PRIMARY KEY (postid)
|
115 |
) {$charset_collate} ENGINE=InnoDB;
|
117 |
ID bigint(20) NOT NULL AUTO_INCREMENT,
|
118 |
postid bigint(20) NOT NULL,
|
119 |
pageviews bigint(20) NOT NULL DEFAULT 1,
|
120 |
+
view_date date NOT NULL,
|
121 |
+
view_datetime datetime NOT NULL,
|
122 |
PRIMARY KEY (ID),
|
123 |
KEY postid (postid),
|
124 |
KEY view_date (view_date),
|
includes/class-wordpress-popular-posts-image.php
CHANGED
@@ -239,7 +239,7 @@ class WPP_Image {
|
|
239 |
|
240 |
// ELSE
|
241 |
// image file path is invalid
|
242 |
-
return $this->render_image($this->default_thumbnail, $
|
243 |
|
244 |
} // end image_resize
|
245 |
|
239 |
|
240 |
// ELSE
|
241 |
// image file path is invalid
|
242 |
+
return $this->render_image( $this->default_thumbnail, array( $image_meta['width'], $image_meta['height'] ), 'wpp-thumbnail wpp_imgeditor_error wpp_' . $image_meta['source'], null, $image->get_error_message() );
|
243 |
|
244 |
} // end image_resize
|
245 |
|
includes/class-wordpress-popular-posts-output.php
CHANGED
@@ -143,7 +143,7 @@ class WPP_Output {
|
|
143 |
$postID = $post_object->id;
|
144 |
|
145 |
// Permalink
|
146 |
-
$permalink = get_permalink( $
|
147 |
|
148 |
// Thumbnail
|
149 |
$post_thumbnail = $this->get_thumbnail( $post_object );
|
@@ -257,6 +257,26 @@ class WPP_Output {
|
|
257 |
|
258 |
}
|
259 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
260 |
/**
|
261 |
* Return the processed post/page title.
|
262 |
*
|
143 |
$postID = $post_object->id;
|
144 |
|
145 |
// Permalink
|
146 |
+
$permalink = $this->get_permalink( $post_object );
|
147 |
|
148 |
// Thumbnail
|
149 |
$post_thumbnail = $this->get_thumbnail( $post_object );
|
257 |
|
258 |
}
|
259 |
|
260 |
+
/**
|
261 |
+
* Return the permalink.
|
262 |
+
*
|
263 |
+
* @since 4.0.12
|
264 |
+
* @access private
|
265 |
+
* @param object $post_object
|
266 |
+
* @return string
|
267 |
+
*/
|
268 |
+
private function get_permalink( stdClass $post_object ) {
|
269 |
+
|
270 |
+
$translate = WPP_translate::get_instance();
|
271 |
+
$trid = $translate->get_object_id( $post_object->id, get_post_type( $post_object->id ) );
|
272 |
+
|
273 |
+
if ( $post_object->id != $trid ) {
|
274 |
+
return get_permalink( $trid );
|
275 |
+
}
|
276 |
+
|
277 |
+
return get_permalink( $post_object->id );
|
278 |
+
}
|
279 |
+
|
280 |
/**
|
281 |
* Return the processed post/page title.
|
282 |
*
|
includes/class-wordpress-popular-posts.php
CHANGED
@@ -28,7 +28,7 @@ class WordPressPopularPosts {
|
|
28 |
public function __construct(){
|
29 |
|
30 |
$this->plugin_name = 'wordpress-popular-posts';
|
31 |
-
$this->version = '4.0.
|
32 |
|
33 |
$this->load_dependencies();
|
34 |
$this->set_locale();
|
@@ -125,7 +125,7 @@ class WordPressPopularPosts {
|
|
125 |
// Check admin notices
|
126 |
$this->loader->add_action( 'admin_notices', $plugin_admin, 'check_admin_notices' );
|
127 |
// Upgrade check
|
128 |
-
$this->loader->add_action( '
|
129 |
// Hook fired when a new blog is activated on WP Multisite
|
130 |
$this->loader->add_action( 'wpmu_new_blog', $plugin_admin, 'activate_new_site' );
|
131 |
// Hook fired when a blog is deleted on WP Multisite
|
28 |
public function __construct(){
|
29 |
|
30 |
$this->plugin_name = 'wordpress-popular-posts';
|
31 |
+
$this->version = '4.0.12';
|
32 |
|
33 |
$this->load_dependencies();
|
34 |
$this->set_locale();
|
125 |
// Check admin notices
|
126 |
$this->loader->add_action( 'admin_notices', $plugin_admin, 'check_admin_notices' );
|
127 |
// Upgrade check
|
128 |
+
$this->loader->add_action( 'admin_head', $plugin_admin, 'upgrade_check' );
|
129 |
// Hook fired when a new blog is activated on WP Multisite
|
130 |
$this->loader->add_action( 'wpmu_new_blog', $plugin_admin, 'activate_new_site' );
|
131 |
// Hook fired when a blog is deleted on WP Multisite
|
readme.txt
CHANGED
@@ -3,8 +3,8 @@ Contributors: hcabrera
|
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=hcabrerab%40gmail%2ecom&lc=GB&item_name=WordPress%20Popular%20Posts%20Plugin¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG_global%2egif%3aNonHosted
|
4 |
Tags: popular, posts, widget, popularity, top
|
5 |
Requires at least: 4.1
|
6 |
-
Tested up to: 4.8.
|
7 |
-
Stable tag: 4.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -23,7 +23,7 @@ WordPress Popular Posts is a highly customizable widget that displays your most
|
|
23 |
* **Sorting options** - Order your popular list by comments, views (default) or average views per day!
|
24 |
* **Use your own layout!** - WPP is flexible enough to let you customize the look and feel of your popular posts! (see [customizing WPP's HTML markup](https://github.com/cabrerahector/wordpress-popular-posts/wiki/5.-FAQ#how-can-i-use-my-own-html-markup-with-your-plugin) and [How to style WordPress Popular Posts](https://github.com/cabrerahector/wordpress-popular-posts/wiki/6.-Styling-the-list) for more.)
|
25 |
* **Disqus support** - Sort your popular posts by Disqus comments count!
|
26 |
-
* **Polylang & WPML support!**
|
27 |
* **WordPress Multisite support** - Each site on the network can have its own popular posts!
|
28 |
|
29 |
= Other Features =
|
@@ -82,6 +82,13 @@ The FAQ section has been moved [here](https://github.com/cabrerahector/wordpress
|
|
82 |
4. WordPress Popular Posts Stats panel.
|
83 |
|
84 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
85 |
= 4.0.11 =
|
86 |
|
87 |
**If you're using a caching plugin, flushing its cache after installing / upgrading to this version is highly recommended.**
|
3 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=hcabrerab%40gmail%2ecom&lc=GB&item_name=WordPress%20Popular%20Posts%20Plugin¤cy_code=USD&bn=PP%2dDonationsBF%3abtn_donateCC_LG_global%2egif%3aNonHosted
|
4 |
Tags: popular, posts, widget, popularity, top
|
5 |
Requires at least: 4.1
|
6 |
+
Tested up to: 4.8.3
|
7 |
+
Stable tag: 4.0.12
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
23 |
* **Sorting options** - Order your popular list by comments, views (default) or average views per day!
|
24 |
* **Use your own layout!** - WPP is flexible enough to let you customize the look and feel of your popular posts! (see [customizing WPP's HTML markup](https://github.com/cabrerahector/wordpress-popular-posts/wiki/5.-FAQ#how-can-i-use-my-own-html-markup-with-your-plugin) and [How to style WordPress Popular Posts](https://github.com/cabrerahector/wordpress-popular-posts/wiki/6.-Styling-the-list) for more.)
|
25 |
* **Disqus support** - Sort your popular posts by Disqus comments count!
|
26 |
+
* **Polylang & WPML 3.2+ support!**
|
27 |
* **WordPress Multisite support** - Each site on the network can have its own popular posts!
|
28 |
|
29 |
= Other Features =
|
82 |
4. WordPress Popular Posts Stats panel.
|
83 |
|
84 |
== Changelog ==
|
85 |
+
= 4.0.12 =
|
86 |
+
|
87 |
+
- Fixes bug where WPP didn't return the right URL when using Polylang / WPML.
|
88 |
+
- Fixes a compatibility issue with Yoast SEO (and potentially other plugins as well).
|
89 |
+
- Improves compatibility with MySQL 5.7+.
|
90 |
+
- Other minor fixes and improvements.
|
91 |
+
|
92 |
= 4.0.11 =
|
93 |
|
94 |
**If you're using a caching plugin, flushing its cache after installing / upgrading to this version is highly recommended.**
|
wordpress-popular-posts.php
CHANGED
@@ -16,7 +16,7 @@
|
|
16 |
* Plugin Name: WordPress Popular Posts
|
17 |
* Plugin URI: https://wordpress.org/plugins/wordpress-popular-posts/
|
18 |
* Description: A highly customizable widget that displays the most popular posts on your blog.
|
19 |
-
* Version: 4.0.
|
20 |
* Author: Hector Cabrera
|
21 |
* Author URI: http://cabrerahector.com/
|
22 |
* License: GPL-2.0+
|
16 |
* Plugin Name: WordPress Popular Posts
|
17 |
* Plugin URI: https://wordpress.org/plugins/wordpress-popular-posts/
|
18 |
* Description: A highly customizable widget that displays the most popular posts on your blog.
|
19 |
+
* Version: 4.0.12
|
20 |
* Author: Hector Cabrera
|
21 |
* Author URI: http://cabrerahector.com/
|
22 |
* License: GPL-2.0+
|