Version Description
- Improvements to WPP's upgrade process.
- Fixes ALT text missing from IMG tags.
Download this release
Release Info
Developer | hcabrera |
Plugin | WordPress Popular Posts |
Version | 4.0.13 |
Comparing to | |
See all releases |
Code changes from version 4.0.11 to 4.0.13
- admin/class-wordpress-popular-posts-admin.php +124 -108
- includes/class-wordpress-popular-posts-activator.php +12 -9
- includes/class-wordpress-popular-posts-image.php +2 -2
- includes/class-wordpress-popular-posts-output.php +21 -1
- includes/class-wordpress-popular-posts.php +1 -1
- readme.txt +13 -88
- wordpress-popular-posts.php +3 -1
admin/class-wordpress-popular-posts-admin.php
CHANGED
@@ -39,7 +39,7 @@ class WPP_Admin {
|
|
39 |
* @var string $version The current version of this plugin.
|
40 |
*/
|
41 |
private $version;
|
42 |
-
|
43 |
/**
|
44 |
* Administrative settings.
|
45 |
*
|
@@ -47,7 +47,7 @@ class WPP_Admin {
|
|
47 |
* @var array
|
48 |
*/
|
49 |
private $options = array();
|
50 |
-
|
51 |
/**
|
52 |
* Slug of the plugin screen.
|
53 |
*
|
@@ -68,10 +68,10 @@ class WPP_Admin {
|
|
68 |
$this->plugin_name = $plugin_name;
|
69 |
$this->version = $version;
|
70 |
$this->options = WPP_Settings::get( 'admin_options' );
|
71 |
-
|
72 |
// Delete old data on demand
|
73 |
if ( 1 == $this->options['tools']['log']['limit'] ) {
|
74 |
-
|
75 |
if ( !wp_next_scheduled( 'wpp_cache_event' ) ) {
|
76 |
$tomorrow = time() + 86400;
|
77 |
$midnight = mktime(
|
@@ -84,20 +84,20 @@ class WPP_Admin {
|
|
84 |
);
|
85 |
wp_schedule_event( $midnight, 'daily', 'wpp_cache_event' );
|
86 |
}
|
87 |
-
|
88 |
} else {
|
89 |
// Remove the scheduled event if exists
|
90 |
if ( $timestamp = wp_next_scheduled( 'wpp_cache_event' ) ) {
|
91 |
wp_unschedule_event( $timestamp, 'wpp_cache_event' );
|
92 |
}
|
93 |
-
|
94 |
}
|
95 |
-
|
96 |
// Allow WP themers / coders to override data sampling status (active/inactive)
|
97 |
$this->options['tools']['sampling']['active'] = apply_filters( 'wpp_data_sampling', $this->options['tools']['sampling']['active'] );
|
98 |
|
99 |
}
|
100 |
-
|
101 |
/**
|
102 |
* Fired when a new blog is activated on WP Multisite.
|
103 |
*
|
@@ -117,7 +117,7 @@ class WPP_Admin {
|
|
117 |
restore_current_blog();
|
118 |
|
119 |
} // end activate_new_site
|
120 |
-
|
121 |
/**
|
122 |
* Fired when a blog is deleted on WP Multisite.
|
123 |
*
|
@@ -129,10 +129,10 @@ class WPP_Admin {
|
|
129 |
public function delete_site_data( $tables, $blog_id ){
|
130 |
|
131 |
global $wpdb;
|
132 |
-
|
133 |
$tables[] = $wpdb->prefix . 'popularpostsdata';
|
134 |
$tables[] = $wpdb->prefix . 'popularpostssummary';
|
135 |
-
|
136 |
return $tables;
|
137 |
|
138 |
} // end delete_site_data
|
@@ -143,19 +143,19 @@ class WPP_Admin {
|
|
143 |
* @since 4.0.0
|
144 |
*/
|
145 |
public function enqueue_styles() {
|
146 |
-
|
147 |
if ( !isset( $this->plugin_screen_hook_suffix ) ) {
|
148 |
return;
|
149 |
}
|
150 |
|
151 |
$screen = get_current_screen();
|
152 |
-
|
153 |
if ( isset( $screen->id ) && $screen->id == $this->plugin_screen_hook_suffix ) {
|
154 |
wp_enqueue_style( 'font-awesome', plugin_dir_url( __FILE__ ) . 'css/vendor/font-awesome.min.css', array(), '4.7.0', 'all' );
|
155 |
wp_enqueue_style( 'wpp-datepicker-theme', plugin_dir_url( __FILE__ ) . 'css/datepicker.css', array(), $this->version, 'all' );
|
156 |
wp_enqueue_style( 'wordpress-popular-posts-admin-styles', plugin_dir_url( __FILE__ ) . 'css/admin.css', array(), $this->version, 'all' );
|
157 |
}
|
158 |
-
|
159 |
}
|
160 |
|
161 |
/**
|
@@ -164,15 +164,15 @@ class WPP_Admin {
|
|
164 |
* @since 4.0.0
|
165 |
*/
|
166 |
public function enqueue_scripts() {
|
167 |
-
|
168 |
if ( ! isset( $this->plugin_screen_hook_suffix ) ) {
|
169 |
return;
|
170 |
}
|
171 |
|
172 |
$screen = get_current_screen();
|
173 |
-
|
174 |
if ( $screen->id == $this->plugin_screen_hook_suffix ) {
|
175 |
-
|
176 |
wp_enqueue_script( 'thickbox' );
|
177 |
wp_enqueue_style( 'thickbox' );
|
178 |
wp_enqueue_script( 'media-upload' );
|
@@ -184,11 +184,11 @@ class WPP_Admin {
|
|
184 |
'nonce' => wp_create_nonce( "wpp_admin_nonce" )
|
185 |
));
|
186 |
wp_enqueue_script( 'wordpress-popular-posts-admin-script' );
|
187 |
-
|
188 |
}
|
189 |
-
|
190 |
}
|
191 |
-
|
192 |
/**
|
193 |
* Hooks into getttext to change upload button text when uploader is called by WPP.
|
194 |
*
|
@@ -197,7 +197,7 @@ class WPP_Admin {
|
|
197 |
public function thickbox_setup() {
|
198 |
|
199 |
global $pagenow;
|
200 |
-
|
201 |
if ( 'media-upload.php' == $pagenow || 'async-upload.php' == $pagenow ) {
|
202 |
add_filter( 'gettext', array( $this, 'replace_thickbox_text' ), 1, 3 );
|
203 |
}
|
@@ -608,7 +608,7 @@ class WPP_Admin {
|
|
608 |
remove_filter( 'wpp_query_limit', array( $this, 'chart_query_limit' ), 1 );
|
609 |
|
610 |
if (
|
611 |
-
( is_array($views_data) && !empty($views_data) )
|
612 |
|| ( is_array($comments_data) && !empty($comments_data) )
|
613 |
) {
|
614 |
|
@@ -842,7 +842,7 @@ class WPP_Admin {
|
|
842 |
$color_scheme = get_user_option( 'admin_color', $current_user->ID );
|
843 |
|
844 |
if (
|
845 |
-
empty( $color_scheme )
|
846 |
|| !isset( $_wp_admin_css_colors[ $color_scheme ] )
|
847 |
) {
|
848 |
$color_scheme = 'fresh';
|
@@ -858,7 +858,7 @@ class WPP_Admin {
|
|
858 |
return array( '#333', '#999', '#881111', '#a80000' );
|
859 |
|
860 |
}
|
861 |
-
|
862 |
/**
|
863 |
* Render the settings page for this plugin.
|
864 |
*
|
@@ -867,7 +867,7 @@ class WPP_Admin {
|
|
867 |
public function display_plugin_admin_page() {
|
868 |
include_once( plugin_dir_path(__FILE__) . 'partials/admin.php' );
|
869 |
}
|
870 |
-
|
871 |
/**
|
872 |
* Registers Settings link on plugin description.
|
873 |
*
|
@@ -881,7 +881,7 @@ class WPP_Admin {
|
|
881 |
$plugin_file = 'wordpress-popular-posts/wordpress-popular-posts.php';
|
882 |
|
883 |
if (
|
884 |
-
is_plugin_active( $plugin_file )
|
885 |
&& $plugin_file == $file
|
886 |
) {
|
887 |
$links[] = '<a href="' . admin_url( 'options-general.php?page=wordpress-popular-posts' ) . '">' . __( 'Settings' ) . '</a>';
|
@@ -890,7 +890,7 @@ class WPP_Admin {
|
|
890 |
return $links;
|
891 |
|
892 |
}
|
893 |
-
|
894 |
/**
|
895 |
* Register the WPP widget.
|
896 |
*
|
@@ -899,7 +899,7 @@ class WPP_Admin {
|
|
899 |
public function register_widget() {
|
900 |
register_widget( 'WPP_Widget' );
|
901 |
}
|
902 |
-
|
903 |
/**
|
904 |
* Flushes post's cached thumbnail(s) when the image is changed.
|
905 |
*
|
@@ -918,13 +918,13 @@ class WPP_Admin {
|
|
918 |
$wpp_image = WPP_Image::get_instance();
|
919 |
|
920 |
if ( $wpp_image->can_create_thumbnails() ) {
|
921 |
-
|
922 |
$wpp_uploads_dir = $wpp_image->get_plugin_uploads_dir();
|
923 |
-
|
924 |
if ( is_array($wpp_uploads_dir) && !empty($wpp_uploads_dir) ) {
|
925 |
-
|
926 |
$files = glob( "{$wpp_uploads_dir['basedir']}/{$object_id}-featured-*.*" ); // get all related images
|
927 |
-
|
928 |
if ( is_array($files) && !empty($files) ) {
|
929 |
|
930 |
foreach( $files as $file ){ // iterate files
|
@@ -942,7 +942,7 @@ class WPP_Admin {
|
|
942 |
}
|
943 |
|
944 |
}
|
945 |
-
|
946 |
/**
|
947 |
* Truncates thumbnails cache on demand.
|
948 |
*
|
@@ -950,51 +950,51 @@ class WPP_Admin {
|
|
950 |
* @global object wpdb
|
951 |
*/
|
952 |
public function clear_thumbnails() {
|
953 |
-
|
954 |
$wpp_image = WPP_Image::get_instance();
|
955 |
|
956 |
if ( $wpp_image->can_create_thumbnails() ) {
|
957 |
-
|
958 |
$wpp_uploads_dir = $wpp_image->get_plugin_uploads_dir();
|
959 |
-
|
960 |
if ( is_array($wpp_uploads_dir) && !empty($wpp_uploads_dir) ) {
|
961 |
-
|
962 |
$token = isset( $_POST['token'] ) ? $_POST['token'] : null;
|
963 |
-
$key = get_option( "wpp_rand" );
|
964 |
-
|
965 |
if (
|
966 |
-
current_user_can( 'manage_options' )
|
967 |
&& ( $token === $key )
|
968 |
) {
|
969 |
-
|
970 |
if ( is_dir( $wpp_uploads_dir['basedir'] ) ) {
|
971 |
-
|
972 |
$files = glob( "{$wpp_uploads_dir['basedir']}/*" ); // get all related images
|
973 |
-
|
974 |
if ( is_array($files) && !empty($files) ) {
|
975 |
-
|
976 |
foreach( $files as $file ){ // iterate files
|
977 |
if ( is_file( $file ) ) {
|
978 |
@unlink( $file ); // delete file
|
979 |
}
|
980 |
}
|
981 |
-
|
982 |
echo 1;
|
983 |
-
|
984 |
} else {
|
985 |
echo 2;
|
986 |
}
|
987 |
-
|
988 |
} else {
|
989 |
echo 3;
|
990 |
}
|
991 |
-
|
992 |
} else {
|
993 |
echo 4;
|
994 |
}
|
995 |
-
|
996 |
}
|
997 |
-
|
998 |
} else {
|
999 |
echo 3;
|
1000 |
}
|
@@ -1002,7 +1002,7 @@ class WPP_Admin {
|
|
1002 |
wp_die();
|
1003 |
|
1004 |
}
|
1005 |
-
|
1006 |
/**
|
1007 |
* Truncates data and cache on demand.
|
1008 |
*
|
@@ -1016,43 +1016,43 @@ class WPP_Admin {
|
|
1016 |
$key = get_option( "wpp_rand" );
|
1017 |
|
1018 |
if (
|
1019 |
-
current_user_can( 'manage_options' )
|
1020 |
-
&& ( $token === $key )
|
1021 |
&& $clear
|
1022 |
) {
|
1023 |
-
|
1024 |
global $wpdb;
|
1025 |
|
1026 |
// set table name
|
1027 |
$prefix = $wpdb->prefix . "popularposts";
|
1028 |
|
1029 |
if ( $clear == 'cache' ) {
|
1030 |
-
|
1031 |
if ( $wpdb->get_var("SHOW TABLES LIKE '{$prefix}summary'") ) {
|
1032 |
-
|
1033 |
$wpdb->query("TRUNCATE TABLE {$prefix}summary;");
|
1034 |
$this->flush_transients();
|
1035 |
-
|
1036 |
echo 1;
|
1037 |
-
|
1038 |
} else {
|
1039 |
echo 2;
|
1040 |
}
|
1041 |
-
|
1042 |
} elseif ( $clear == 'all' ) {
|
1043 |
-
|
1044 |
if ( $wpdb->get_var("SHOW TABLES LIKE '{$prefix}data'") && $wpdb->get_var("SHOW TABLES LIKE '{$prefix}summary'") ) {
|
1045 |
-
|
1046 |
$wpdb->query("TRUNCATE TABLE {$prefix}data;");
|
1047 |
$wpdb->query("TRUNCATE TABLE {$prefix}summary;");
|
1048 |
$this->flush_transients();
|
1049 |
-
|
1050 |
echo 1;
|
1051 |
-
|
1052 |
} else {
|
1053 |
echo 2;
|
1054 |
}
|
1055 |
-
|
1056 |
} else {
|
1057 |
echo 3;
|
1058 |
}
|
@@ -1063,7 +1063,7 @@ class WPP_Admin {
|
|
1063 |
wp_die();
|
1064 |
|
1065 |
}
|
1066 |
-
|
1067 |
/**
|
1068 |
* Deletes cached (transient) data.
|
1069 |
*
|
@@ -1075,16 +1075,16 @@ class WPP_Admin {
|
|
1075 |
$wpp_transients = get_option( 'wpp_transients' );
|
1076 |
|
1077 |
if ( $wpp_transients && is_array( $wpp_transients ) && !empty( $wpp_transients ) ) {
|
1078 |
-
|
1079 |
for ( $t=0; $t < count( $wpp_transients ); $t++ )
|
1080 |
delete_transient( $wpp_transients[$t] );
|
1081 |
|
1082 |
update_option( 'wpp_transients', array() );
|
1083 |
-
|
1084 |
}
|
1085 |
|
1086 |
}
|
1087 |
-
|
1088 |
/**
|
1089 |
* Purges post from data/summary tables.
|
1090 |
*
|
@@ -1112,11 +1112,11 @@ class WPP_Admin {
|
|
1112 |
// Delete from data table
|
1113 |
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}popularpostsdata WHERE postid = %d;", $post_ID ) );
|
1114 |
// Delete from summary table
|
1115 |
-
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}popularpostssummary WHERE postid = %d;", $post_ID ) );
|
1116 |
}
|
1117 |
|
1118 |
}
|
1119 |
-
|
1120 |
/**
|
1121 |
* Purges old post data from summary table.
|
1122 |
*
|
@@ -1130,35 +1130,14 @@ class WPP_Admin {
|
|
1130 |
$wpdb->query( "DELETE FROM {$wpdb->prefix}popularpostssummary WHERE view_date < DATE_SUB('" . WPP_Helper::curdate() . "', INTERVAL {$this->options['tools']['log']['expires_after']} DAY);" );
|
1131 |
|
1132 |
} // end purge_data
|
1133 |
-
|
1134 |
/**
|
1135 |
* Checks if an upgrade procedure is required.
|
1136 |
*
|
1137 |
* @since 2.4.0
|
1138 |
*/
|
1139 |
public function upgrade_check(){
|
1140 |
-
|
1141 |
-
// Multisite setup, upgrade all sites
|
1142 |
-
if ( function_exists( 'is_multisite' ) && is_multisite() ) {
|
1143 |
-
global $wpdb;
|
1144 |
-
|
1145 |
-
$original_blog_id = get_current_blog_id();
|
1146 |
-
$blogs_ids = $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" );
|
1147 |
-
|
1148 |
-
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
|
1149 |
-
|
1150 |
-
foreach( $blogs_ids as $blog_id ) {
|
1151 |
-
switch_to_blog( $blog_id );
|
1152 |
-
$this->upgrade_site();
|
1153 |
-
}
|
1154 |
-
|
1155 |
-
// Switch back to current blog
|
1156 |
-
switch_to_blog( $original_blog_id );
|
1157 |
-
}
|
1158 |
-
else {
|
1159 |
-
$this->upgrade_site();
|
1160 |
-
}
|
1161 |
-
|
1162 |
} // end upgrade_check
|
1163 |
|
1164 |
/**
|
@@ -1187,57 +1166,94 @@ class WPP_Admin {
|
|
1187 |
*/
|
1188 |
private function upgrade() {
|
1189 |
|
|
|
|
|
1190 |
// Keep the upgrade process from running too many times
|
1191 |
-
if ( get_option('wpp_update') )
|
1192 |
-
|
1193 |
-
|
1194 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1195 |
|
1196 |
global $wpdb;
|
1197 |
|
1198 |
// Set table name
|
1199 |
$prefix = $wpdb->prefix . "popularposts";
|
1200 |
|
1201 |
-
//
|
1202 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
|
1212 |
$summaryIndexes = $wpdb->get_results( "SHOW INDEX FROM {$prefix}summary;" );
|
1213 |
foreach( $summaryIndexes as $index ) {
|
1214 |
if ( 'ID_date' == $index->Key_name ) {
|
1215 |
-
$wpdb->query( "ALTER TABLE {$prefix}summary DROP INDEX ID_date
|
1216 |
-
|
|
|
|
|
|
|
1217 |
}
|
1218 |
}
|
1219 |
|
|
|
|
|
|
|
1220 |
// Check storage engine
|
1221 |
$storage_engine_data = $wpdb->get_var( "SELECT `ENGINE` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA`='{$wpdb->dbname}' AND `TABLE_NAME`='{$prefix}data';" );
|
1222 |
-
|
1223 |
if ( 'InnoDB' != $storage_engine_data ) {
|
1224 |
$wpdb->query( "ALTER TABLE {$prefix}data ENGINE=InnoDB;" );
|
1225 |
}
|
1226 |
-
|
1227 |
$storage_engine_summary = $wpdb->get_var( "SELECT `ENGINE` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA`='{$wpdb->dbname}' AND `TABLE_NAME`='{$prefix}summary';" );
|
1228 |
-
|
1229 |
if ( 'InnoDB' != $storage_engine_summary ) {
|
1230 |
$wpdb->query( "ALTER TABLE {$prefix}summary ENGINE=InnoDB;" );
|
1231 |
}
|
1232 |
|
1233 |
// Update WPP version
|
1234 |
update_option( 'wpp_ver', $this->version );
|
1235 |
-
|
1236 |
// Remove upgrade flag
|
1237 |
delete_option( 'wpp_update' );
|
1238 |
|
1239 |
} // end __upgrade
|
1240 |
-
|
1241 |
/**
|
1242 |
* Checks if the technical requirements are met.
|
1243 |
*
|
@@ -1273,7 +1289,7 @@ class WPP_Admin {
|
|
1273 |
return $errors;
|
1274 |
|
1275 |
} // end check_requirements
|
1276 |
-
|
1277 |
/**
|
1278 |
* Outputs error messages to wp-admin.
|
1279 |
*
|
39 |
* @var string $version The current version of this plugin.
|
40 |
*/
|
41 |
private $version;
|
42 |
+
|
43 |
/**
|
44 |
* Administrative settings.
|
45 |
*
|
47 |
* @var array
|
48 |
*/
|
49 |
private $options = array();
|
50 |
+
|
51 |
/**
|
52 |
* Slug of the plugin screen.
|
53 |
*
|
68 |
$this->plugin_name = $plugin_name;
|
69 |
$this->version = $version;
|
70 |
$this->options = WPP_Settings::get( 'admin_options' );
|
71 |
+
|
72 |
// Delete old data on demand
|
73 |
if ( 1 == $this->options['tools']['log']['limit'] ) {
|
74 |
+
|
75 |
if ( !wp_next_scheduled( 'wpp_cache_event' ) ) {
|
76 |
$tomorrow = time() + 86400;
|
77 |
$midnight = mktime(
|
84 |
);
|
85 |
wp_schedule_event( $midnight, 'daily', 'wpp_cache_event' );
|
86 |
}
|
87 |
+
|
88 |
} else {
|
89 |
// Remove the scheduled event if exists
|
90 |
if ( $timestamp = wp_next_scheduled( 'wpp_cache_event' ) ) {
|
91 |
wp_unschedule_event( $timestamp, 'wpp_cache_event' );
|
92 |
}
|
93 |
+
|
94 |
}
|
95 |
+
|
96 |
// Allow WP themers / coders to override data sampling status (active/inactive)
|
97 |
$this->options['tools']['sampling']['active'] = apply_filters( 'wpp_data_sampling', $this->options['tools']['sampling']['active'] );
|
98 |
|
99 |
}
|
100 |
+
|
101 |
/**
|
102 |
* Fired when a new blog is activated on WP Multisite.
|
103 |
*
|
117 |
restore_current_blog();
|
118 |
|
119 |
} // end activate_new_site
|
120 |
+
|
121 |
/**
|
122 |
* Fired when a blog is deleted on WP Multisite.
|
123 |
*
|
129 |
public function delete_site_data( $tables, $blog_id ){
|
130 |
|
131 |
global $wpdb;
|
132 |
+
|
133 |
$tables[] = $wpdb->prefix . 'popularpostsdata';
|
134 |
$tables[] = $wpdb->prefix . 'popularpostssummary';
|
135 |
+
|
136 |
return $tables;
|
137 |
|
138 |
} // end delete_site_data
|
143 |
* @since 4.0.0
|
144 |
*/
|
145 |
public function enqueue_styles() {
|
146 |
+
|
147 |
if ( !isset( $this->plugin_screen_hook_suffix ) ) {
|
148 |
return;
|
149 |
}
|
150 |
|
151 |
$screen = get_current_screen();
|
152 |
+
|
153 |
if ( isset( $screen->id ) && $screen->id == $this->plugin_screen_hook_suffix ) {
|
154 |
wp_enqueue_style( 'font-awesome', plugin_dir_url( __FILE__ ) . 'css/vendor/font-awesome.min.css', array(), '4.7.0', 'all' );
|
155 |
wp_enqueue_style( 'wpp-datepicker-theme', plugin_dir_url( __FILE__ ) . 'css/datepicker.css', array(), $this->version, 'all' );
|
156 |
wp_enqueue_style( 'wordpress-popular-posts-admin-styles', plugin_dir_url( __FILE__ ) . 'css/admin.css', array(), $this->version, 'all' );
|
157 |
}
|
158 |
+
|
159 |
}
|
160 |
|
161 |
/**
|
164 |
* @since 4.0.0
|
165 |
*/
|
166 |
public function enqueue_scripts() {
|
167 |
+
|
168 |
if ( ! isset( $this->plugin_screen_hook_suffix ) ) {
|
169 |
return;
|
170 |
}
|
171 |
|
172 |
$screen = get_current_screen();
|
173 |
+
|
174 |
if ( $screen->id == $this->plugin_screen_hook_suffix ) {
|
175 |
+
|
176 |
wp_enqueue_script( 'thickbox' );
|
177 |
wp_enqueue_style( 'thickbox' );
|
178 |
wp_enqueue_script( 'media-upload' );
|
184 |
'nonce' => wp_create_nonce( "wpp_admin_nonce" )
|
185 |
));
|
186 |
wp_enqueue_script( 'wordpress-popular-posts-admin-script' );
|
187 |
+
|
188 |
}
|
189 |
+
|
190 |
}
|
191 |
+
|
192 |
/**
|
193 |
* Hooks into getttext to change upload button text when uploader is called by WPP.
|
194 |
*
|
197 |
public function thickbox_setup() {
|
198 |
|
199 |
global $pagenow;
|
200 |
+
|
201 |
if ( 'media-upload.php' == $pagenow || 'async-upload.php' == $pagenow ) {
|
202 |
add_filter( 'gettext', array( $this, 'replace_thickbox_text' ), 1, 3 );
|
203 |
}
|
608 |
remove_filter( 'wpp_query_limit', array( $this, 'chart_query_limit' ), 1 );
|
609 |
|
610 |
if (
|
611 |
+
( is_array($views_data) && !empty($views_data) )
|
612 |
|| ( is_array($comments_data) && !empty($comments_data) )
|
613 |
) {
|
614 |
|
842 |
$color_scheme = get_user_option( 'admin_color', $current_user->ID );
|
843 |
|
844 |
if (
|
845 |
+
empty( $color_scheme )
|
846 |
|| !isset( $_wp_admin_css_colors[ $color_scheme ] )
|
847 |
) {
|
848 |
$color_scheme = 'fresh';
|
858 |
return array( '#333', '#999', '#881111', '#a80000' );
|
859 |
|
860 |
}
|
861 |
+
|
862 |
/**
|
863 |
* Render the settings page for this plugin.
|
864 |
*
|
867 |
public function display_plugin_admin_page() {
|
868 |
include_once( plugin_dir_path(__FILE__) . 'partials/admin.php' );
|
869 |
}
|
870 |
+
|
871 |
/**
|
872 |
* Registers Settings link on plugin description.
|
873 |
*
|
881 |
$plugin_file = 'wordpress-popular-posts/wordpress-popular-posts.php';
|
882 |
|
883 |
if (
|
884 |
+
is_plugin_active( $plugin_file )
|
885 |
&& $plugin_file == $file
|
886 |
) {
|
887 |
$links[] = '<a href="' . admin_url( 'options-general.php?page=wordpress-popular-posts' ) . '">' . __( 'Settings' ) . '</a>';
|
890 |
return $links;
|
891 |
|
892 |
}
|
893 |
+
|
894 |
/**
|
895 |
* Register the WPP widget.
|
896 |
*
|
899 |
public function register_widget() {
|
900 |
register_widget( 'WPP_Widget' );
|
901 |
}
|
902 |
+
|
903 |
/**
|
904 |
* Flushes post's cached thumbnail(s) when the image is changed.
|
905 |
*
|
918 |
$wpp_image = WPP_Image::get_instance();
|
919 |
|
920 |
if ( $wpp_image->can_create_thumbnails() ) {
|
921 |
+
|
922 |
$wpp_uploads_dir = $wpp_image->get_plugin_uploads_dir();
|
923 |
+
|
924 |
if ( is_array($wpp_uploads_dir) && !empty($wpp_uploads_dir) ) {
|
925 |
+
|
926 |
$files = glob( "{$wpp_uploads_dir['basedir']}/{$object_id}-featured-*.*" ); // get all related images
|
927 |
+
|
928 |
if ( is_array($files) && !empty($files) ) {
|
929 |
|
930 |
foreach( $files as $file ){ // iterate files
|
942 |
}
|
943 |
|
944 |
}
|
945 |
+
|
946 |
/**
|
947 |
* Truncates thumbnails cache on demand.
|
948 |
*
|
950 |
* @global object wpdb
|
951 |
*/
|
952 |
public function clear_thumbnails() {
|
953 |
+
|
954 |
$wpp_image = WPP_Image::get_instance();
|
955 |
|
956 |
if ( $wpp_image->can_create_thumbnails() ) {
|
957 |
+
|
958 |
$wpp_uploads_dir = $wpp_image->get_plugin_uploads_dir();
|
959 |
+
|
960 |
if ( is_array($wpp_uploads_dir) && !empty($wpp_uploads_dir) ) {
|
961 |
+
|
962 |
$token = isset( $_POST['token'] ) ? $_POST['token'] : null;
|
963 |
+
$key = get_option( "wpp_rand" );
|
964 |
+
|
965 |
if (
|
966 |
+
current_user_can( 'manage_options' )
|
967 |
&& ( $token === $key )
|
968 |
) {
|
969 |
+
|
970 |
if ( is_dir( $wpp_uploads_dir['basedir'] ) ) {
|
971 |
+
|
972 |
$files = glob( "{$wpp_uploads_dir['basedir']}/*" ); // get all related images
|
973 |
+
|
974 |
if ( is_array($files) && !empty($files) ) {
|
975 |
+
|
976 |
foreach( $files as $file ){ // iterate files
|
977 |
if ( is_file( $file ) ) {
|
978 |
@unlink( $file ); // delete file
|
979 |
}
|
980 |
}
|
981 |
+
|
982 |
echo 1;
|
983 |
+
|
984 |
} else {
|
985 |
echo 2;
|
986 |
}
|
987 |
+
|
988 |
} else {
|
989 |
echo 3;
|
990 |
}
|
991 |
+
|
992 |
} else {
|
993 |
echo 4;
|
994 |
}
|
995 |
+
|
996 |
}
|
997 |
+
|
998 |
} else {
|
999 |
echo 3;
|
1000 |
}
|
1002 |
wp_die();
|
1003 |
|
1004 |
}
|
1005 |
+
|
1006 |
/**
|
1007 |
* Truncates data and cache on demand.
|
1008 |
*
|
1016 |
$key = get_option( "wpp_rand" );
|
1017 |
|
1018 |
if (
|
1019 |
+
current_user_can( 'manage_options' )
|
1020 |
+
&& ( $token === $key )
|
1021 |
&& $clear
|
1022 |
) {
|
1023 |
+
|
1024 |
global $wpdb;
|
1025 |
|
1026 |
// set table name
|
1027 |
$prefix = $wpdb->prefix . "popularposts";
|
1028 |
|
1029 |
if ( $clear == 'cache' ) {
|
1030 |
+
|
1031 |
if ( $wpdb->get_var("SHOW TABLES LIKE '{$prefix}summary'") ) {
|
1032 |
+
|
1033 |
$wpdb->query("TRUNCATE TABLE {$prefix}summary;");
|
1034 |
$this->flush_transients();
|
1035 |
+
|
1036 |
echo 1;
|
1037 |
+
|
1038 |
} else {
|
1039 |
echo 2;
|
1040 |
}
|
1041 |
+
|
1042 |
} elseif ( $clear == 'all' ) {
|
1043 |
+
|
1044 |
if ( $wpdb->get_var("SHOW TABLES LIKE '{$prefix}data'") && $wpdb->get_var("SHOW TABLES LIKE '{$prefix}summary'") ) {
|
1045 |
+
|
1046 |
$wpdb->query("TRUNCATE TABLE {$prefix}data;");
|
1047 |
$wpdb->query("TRUNCATE TABLE {$prefix}summary;");
|
1048 |
$this->flush_transients();
|
1049 |
+
|
1050 |
echo 1;
|
1051 |
+
|
1052 |
} else {
|
1053 |
echo 2;
|
1054 |
}
|
1055 |
+
|
1056 |
} else {
|
1057 |
echo 3;
|
1058 |
}
|
1063 |
wp_die();
|
1064 |
|
1065 |
}
|
1066 |
+
|
1067 |
/**
|
1068 |
* Deletes cached (transient) data.
|
1069 |
*
|
1075 |
$wpp_transients = get_option( 'wpp_transients' );
|
1076 |
|
1077 |
if ( $wpp_transients && is_array( $wpp_transients ) && !empty( $wpp_transients ) ) {
|
1078 |
+
|
1079 |
for ( $t=0; $t < count( $wpp_transients ); $t++ )
|
1080 |
delete_transient( $wpp_transients[$t] );
|
1081 |
|
1082 |
update_option( 'wpp_transients', array() );
|
1083 |
+
|
1084 |
}
|
1085 |
|
1086 |
}
|
1087 |
+
|
1088 |
/**
|
1089 |
* Purges post from data/summary tables.
|
1090 |
*
|
1112 |
// Delete from data table
|
1113 |
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}popularpostsdata WHERE postid = %d;", $post_ID ) );
|
1114 |
// Delete from summary table
|
1115 |
+
$wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}popularpostssummary WHERE postid = %d;", $post_ID ) );
|
1116 |
}
|
1117 |
|
1118 |
}
|
1119 |
+
|
1120 |
/**
|
1121 |
* Purges old post data from summary table.
|
1122 |
*
|
1130 |
$wpdb->query( "DELETE FROM {$wpdb->prefix}popularpostssummary WHERE view_date < DATE_SUB('" . WPP_Helper::curdate() . "', INTERVAL {$this->options['tools']['log']['expires_after']} DAY);" );
|
1131 |
|
1132 |
} // end purge_data
|
1133 |
+
|
1134 |
/**
|
1135 |
* Checks if an upgrade procedure is required.
|
1136 |
*
|
1137 |
* @since 2.4.0
|
1138 |
*/
|
1139 |
public function upgrade_check(){
|
1140 |
+
$this->upgrade_site();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1141 |
} // end upgrade_check
|
1142 |
|
1143 |
/**
|
1166 |
*/
|
1167 |
private function upgrade() {
|
1168 |
|
1169 |
+
$now = WPP_Helper::now();
|
1170 |
+
|
1171 |
// Keep the upgrade process from running too many times
|
1172 |
+
if ( $wpp_update = get_option('wpp_update') ) {
|
1173 |
+
|
1174 |
+
$from_time = strtotime( $wpp_update );
|
1175 |
+
$to_time = strtotime( $now );
|
1176 |
+
$difference_in_minutes = round( abs( $to_time - $from_time ) / 60, 2 );
|
1177 |
+
|
1178 |
+
// Upgrade flag is still valid, abort
|
1179 |
+
if ( $difference_in_minutes <= 15 )
|
1180 |
+
return;
|
1181 |
+
|
1182 |
+
// Upgrade flag expired, delete it and continue
|
1183 |
+
delete_option( 'wpp_update' );
|
1184 |
+
|
1185 |
+
}
|
1186 |
+
|
1187 |
+
add_option( 'wpp_update', $now );
|
1188 |
|
1189 |
global $wpdb;
|
1190 |
|
1191 |
// Set table name
|
1192 |
$prefix = $wpdb->prefix . "popularposts";
|
1193 |
|
1194 |
+
// Update data table structure and indexes
|
1195 |
+
$dataFields = $wpdb->get_results( "SHOW FIELDS FROM {$prefix}data;" );
|
1196 |
+
foreach ( $dataFields as $column ) {
|
1197 |
+
if ( "day" == $column->Field ) {
|
1198 |
+
$wpdb->query( "ALTER TABLE {$prefix}data ALTER COLUMN day DROP DEFAULT;" );
|
1199 |
+
}
|
1200 |
+
|
1201 |
+
if ( "last_viewed" == $column->Field ) {
|
1202 |
+
$wpdb->query( "ALTER TABLE {$prefix}data ALTER COLUMN last_viewed DROP DEFAULT;" );
|
1203 |
+
}
|
1204 |
+
}
|
1205 |
|
1206 |
// Update summary table structure and indexes
|
1207 |
$summaryFields = $wpdb->get_results( "SHOW FIELDS FROM {$prefix}summary;" );
|
1208 |
foreach ( $summaryFields as $column ) {
|
1209 |
if ( "last_viewed" == $column->Field ) {
|
1210 |
+
$wpdb->query( "ALTER TABLE {$prefix}summary CHANGE last_viewed view_datetime datetime NOT NULL, ADD KEY view_datetime (view_datetime);" );
|
1211 |
+
}
|
1212 |
+
|
1213 |
+
if ( "view_date" == $column->Field ) {
|
1214 |
+
$wpdb->query( "ALTER TABLE {$prefix}summary ALTER COLUMN view_date DROP DEFAULT;" );
|
1215 |
+
}
|
1216 |
+
|
1217 |
+
if ( "view_datetime" == $column->Field ) {
|
1218 |
+
$wpdb->query( "ALTER TABLE {$prefix}summary ALTER COLUMN view_datetime DROP DEFAULT;" );
|
1219 |
}
|
1220 |
}
|
1221 |
|
1222 |
$summaryIndexes = $wpdb->get_results( "SHOW INDEX FROM {$prefix}summary;" );
|
1223 |
foreach( $summaryIndexes as $index ) {
|
1224 |
if ( 'ID_date' == $index->Key_name ) {
|
1225 |
+
$wpdb->query( "ALTER TABLE {$prefix}summary DROP INDEX ID_date;" );
|
1226 |
+
}
|
1227 |
+
|
1228 |
+
if ( 'last_viewed' == $index->Key_name ) {
|
1229 |
+
$wpdb->query( "ALTER TABLE {$prefix}summary DROP INDEX last_viewed;" );
|
1230 |
}
|
1231 |
}
|
1232 |
|
1233 |
+
// Validate the structure of the tables, create missing tables / fields if necessary
|
1234 |
+
WPP_Activator::track_new_site();
|
1235 |
+
|
1236 |
// Check storage engine
|
1237 |
$storage_engine_data = $wpdb->get_var( "SELECT `ENGINE` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA`='{$wpdb->dbname}' AND `TABLE_NAME`='{$prefix}data';" );
|
1238 |
+
|
1239 |
if ( 'InnoDB' != $storage_engine_data ) {
|
1240 |
$wpdb->query( "ALTER TABLE {$prefix}data ENGINE=InnoDB;" );
|
1241 |
}
|
1242 |
+
|
1243 |
$storage_engine_summary = $wpdb->get_var( "SELECT `ENGINE` FROM `information_schema`.`TABLES` WHERE `TABLE_SCHEMA`='{$wpdb->dbname}' AND `TABLE_NAME`='{$prefix}summary';" );
|
1244 |
+
|
1245 |
if ( 'InnoDB' != $storage_engine_summary ) {
|
1246 |
$wpdb->query( "ALTER TABLE {$prefix}summary ENGINE=InnoDB;" );
|
1247 |
}
|
1248 |
|
1249 |
// Update WPP version
|
1250 |
update_option( 'wpp_ver', $this->version );
|
1251 |
+
|
1252 |
// Remove upgrade flag
|
1253 |
delete_option( 'wpp_update' );
|
1254 |
|
1255 |
} // end __upgrade
|
1256 |
+
|
1257 |
/**
|
1258 |
* Checks if the technical requirements are met.
|
1259 |
*
|
1289 |
return $errors;
|
1290 |
|
1291 |
} // end check_requirements
|
1292 |
+
|
1293 |
/**
|
1294 |
* Outputs error messages to wp-admin.
|
1295 |
*
|
includes/class-wordpress-popular-posts-activator.php
CHANGED
@@ -75,13 +75,16 @@ class WPP_Activator {
|
|
75 |
*/
|
76 |
private static function plugin_activate() {
|
77 |
|
78 |
-
|
|
|
79 |
|
80 |
-
|
81 |
-
|
|
|
|
|
|
|
82 |
|
83 |
-
|
84 |
-
if ( "{$prefix}data" != $wpdb->get_var("SHOW TABLES LIKE '{$prefix}data'") ) {
|
85 |
self::do_db_tables( $prefix );
|
86 |
}
|
87 |
|
@@ -108,8 +111,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 +120,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),
|
75 |
*/
|
76 |
private static function plugin_activate() {
|
77 |
|
78 |
+
// Get WPP version
|
79 |
+
$wpp_ver = get_option( 'wpp_ver' );
|
80 |
|
81 |
+
if (
|
82 |
+
!$wpp_ver
|
83 |
+
|| version_compare( $wpp_ver, WPP_VER, '<' )
|
84 |
+
) {
|
85 |
+
global $wpdb;
|
86 |
|
87 |
+
$prefix = $wpdb->prefix . "popularposts";
|
|
|
88 |
self::do_db_tables( $prefix );
|
89 |
}
|
90 |
|
111 |
$sql = "
|
112 |
CREATE TABLE {$prefix}data (
|
113 |
postid bigint(20) NOT NULL,
|
114 |
+
day datetime NOT NULL,
|
115 |
+
last_viewed datetime NOT NULL,
|
116 |
pageviews bigint(20) DEFAULT 1,
|
117 |
PRIMARY KEY (postid)
|
118 |
) {$charset_collate} ENGINE=InnoDB;
|
120 |
ID bigint(20) NOT NULL AUTO_INCREMENT,
|
121 |
postid bigint(20) NOT NULL,
|
122 |
pageviews bigint(20) NOT NULL DEFAULT 1,
|
123 |
+
view_date date NOT NULL,
|
124 |
+
view_datetime datetime NOT NULL,
|
125 |
PRIMARY KEY (ID),
|
126 |
KEY postid (postid),
|
127 |
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 |
|
@@ -346,7 +346,7 @@ class WPP_Image {
|
|
346 |
$img_tag = '<!-- ' . $error . ' --> ';
|
347 |
}
|
348 |
|
349 |
-
$img_tag .= '<img src="' . ( is_ssl() ? str_ireplace( "http://", "https://", $src ) : $src ) . '" width="' . $size[0] . '" height="' . $size[1] . '" alt="' . ( ($post_object instanceof stdClass &&
|
350 |
|
351 |
return apply_filters( 'wpp_render_image', $img_tag );
|
352 |
|
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 |
|
346 |
$img_tag = '<!-- ' . $error . ' --> ';
|
347 |
}
|
348 |
|
349 |
+
$img_tag .= '<img src="' . ( is_ssl() ? str_ireplace( "http://", "https://", $src ) : $src ) . '" width="' . $size[0] . '" height="' . $size[1] . '" alt="' . ( ($post_object instanceof stdClass && isset($post_object->title) ? esc_attr( wp_strip_all_tags($post_object->title) ) : '' ) ) . '" class="' . $class . '" />';
|
350 |
|
351 |
return apply_filters( 'wpp_render_image', $img_tag );
|
352 |
|
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 =
|
32 |
|
33 |
$this->load_dependencies();
|
34 |
$this->set_locale();
|
28 |
public function __construct(){
|
29 |
|
30 |
$this->plugin_name = 'wordpress-popular-posts';
|
31 |
+
$this->version = WPP_VER;
|
32 |
|
33 |
$this->load_dependencies();
|
34 |
$this->set_locale();
|
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.
|
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,98 +82,23 @@ 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.
|
86 |
-
|
87 |
-
**If you're using a caching plugin, flushing its cache after installing / upgrading to this version is highly recommended.**
|
88 |
-
|
89 |
-
- Fixes reference to tracking script.
|
90 |
-
|
91 |
-
= 4.0.10 =
|
92 |
-
|
93 |
-
**If you're using a caching plugin, flushing its cache after installing / upgrading to this version is highly recommended.**
|
94 |
-
|
95 |
-
- Renames tracking script to prevent issues with ad blockers (props @Damienov).
|
96 |
-
- Widget: fixes caching (props @zu2).
|
97 |
-
- Exposes offset parameter to wpp shortcode / `wpp_get_mostpopular` template tag.
|
98 |
-
|
99 |
-
= 4.0.9 =
|
100 |
-
- Widget: fixes Author ID field not saving/updating.
|
101 |
-
- Fixes WPP data caching (props @zu2).
|
102 |
-
- Dashboard: updates Content Tags' documentation.
|
103 |
-
- Main POT file updated.
|
104 |
-
- Other minor bug fixes & improvements.
|
105 |
-
|
106 |
-
= 4.0.8 =
|
107 |
-
- Multisite: plugin can now be installed individually on each site.
|
108 |
-
- Multisite: improved upgrade process.
|
109 |
-
- Dashboard: adds multisite check to Debug screen.
|
110 |
-
- Dashboard: have the Debug screen display active plugins only.
|
111 |
-
- Improves compatibility with Beaver Builder.
|
112 |
-
- Adds onload event to ajax widget (props @cawa-93).
|
113 |
-
- Other minor bug fixes.
|
114 |
-
|
115 |
-
= 4.0.6 =
|
116 |
|
117 |
-
-
|
118 |
-
- Fixes
|
119 |
-
- Improves compatibility with Beaver Builder.
|
120 |
|
121 |
-
= 4.0.
|
122 |
|
123 |
-
- Fixes the
|
124 |
-
-
|
125 |
-
-
|
126 |
-
-
|
127 |
-
- Other minor bug fixes and improvements.
|
128 |
|
129 |
-
= 4.0.
|
130 |
-
|
131 |
-
**This is a hotfix release.**
|
132 |
-
|
133 |
-
- Dashboard: escapes post titles to prevent potential XSS (props Delta!)
|
134 |
-
- Restores ability to use a custom default thumbnail.
|
135 |
-
|
136 |
-
= 4.0.2 =
|
137 |
-
|
138 |
-
**This is a hotfix release.**
|
139 |
-
|
140 |
-
- Dashboard: fixes thumbnail picker on HTTPS.
|
141 |
-
- Adds the wpp_custom_html filter back.
|
142 |
-
|
143 |
-
= 4.0.1 =
|
144 |
-
|
145 |
-
**This is a hotfix release.**
|
146 |
-
|
147 |
-
- Fixes a warning message triggered on old PHP versions.
|
148 |
-
- Fixes undefined default_thumbnail_sizes warning message.
|
149 |
-
- Removes a hardcoded table prefix causing issues on sites that uses a different prefix than the stock one.
|
150 |
-
|
151 |
-
= 4.0.0 =
|
152 |
|
153 |
**If you're using a caching plugin, flushing its cache after installing / upgrading to this version is highly recommended.**
|
154 |
|
155 |
-
-
|
156 |
-
- Dashboard section redesigned (now mobile-friendly, too!)
|
157 |
-
- New Statistics chart and other goodies.
|
158 |
-
- Adds ability to pick a Custom Time Range!
|
159 |
-
- Adds ability to filter posts by other taxonomies than just categories!
|
160 |
-
- Adds Relative Date Format.
|
161 |
-
- Fixes broken views tracking caused by changeset 41508 https://core.trac.wordpress.org/changeset/41508 (props hykw!)
|
162 |
-
- Improves PHP7+ compatibility.
|
163 |
-
- Improves compatibility with WP-SpamShield, WooCommerce, Polylang and WPML.
|
164 |
-
- Drops qTranslate support (that plugin has been long removed from WordPress.org anyways.)
|
165 |
-
- New content tags added: {img_url}, {taxonomy}.
|
166 |
-
- New filters: wpp_post_class, wpp_post_exclude_terms.
|
167 |
-
- French and German translation files became too outdated and so support has been dropped for now (want to help? Contact me!)
|
168 |
-
- Tons of minor bug fixes and improvements.
|
169 |
-
|
170 |
-
Also, see [Release notes](https://cabrerahector.com/development/wordpress-popular-posts-4-0-is-finally-out/).
|
171 |
-
|
172 |
-
= 3.3.4 =
|
173 |
-
- Attempt to convert tables to InnoDB during upgrade if other engine is being used.
|
174 |
-
- Adds a check to prevent the upgrade process from running too many times.
|
175 |
-
- Minor improvements and bug fixes.
|
176 |
-
- Documentation updated.
|
177 |
|
178 |
See [full changelog](https://github.com/cabrerahector/wordpress-popular-posts/blob/master/changelog.md).
|
179 |
|
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.9.1
|
7 |
+
Stable tag: 4.0.13
|
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.13 =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
|
87 |
+
- Improvements to WPP's upgrade process.
|
88 |
+
- Fixes ALT text missing from IMG tags.
|
|
|
89 |
|
90 |
+
= 4.0.12 =
|
91 |
|
92 |
+
- Fixes bug where WPP didn't return the right URL when using Polylang / WPML.
|
93 |
+
- Fixes a compatibility issue with Yoast SEO (and potentially other plugins as well).
|
94 |
+
- Improves compatibility with MySQL 5.7+.
|
95 |
+
- Other minor fixes and improvements.
|
|
|
96 |
|
97 |
+
= 4.0.11 =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
**If you're using a caching plugin, flushing its cache after installing / upgrading to this version is highly recommended.**
|
100 |
|
101 |
+
- Fixes reference to tracking script.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
102 |
|
103 |
See [full changelog](https://github.com/cabrerahector/wordpress-popular-posts/blob/master/changelog.md).
|
104 |
|
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+
|
@@ -29,6 +29,8 @@ if ( ! defined( 'WPINC' ) ) {
|
|
29 |
die();
|
30 |
}
|
31 |
|
|
|
|
|
32 |
/*
|
33 |
* The code that runs during plugin activation.
|
34 |
*/
|
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.13
|
20 |
* Author: Hector Cabrera
|
21 |
* Author URI: http://cabrerahector.com/
|
22 |
* License: GPL-2.0+
|
29 |
die();
|
30 |
}
|
31 |
|
32 |
+
define( 'WPP_VER', '4.0.13' );
|
33 |
+
|
34 |
/*
|
35 |
* The code that runs during plugin activation.
|
36 |
*/
|