PluginProbe
WebberZone Top 10 — Popular Posts / 4.5.1
WebberZone Top 10 — Popular Posts v4.5.1
4.5.1 4.5.0 4.4.3 4.4.2 4.4.1 4.4.0 4.3.4 4.3.3 4.3.2 4.3.1 4.3.0 trunk 1.0 1.0.1 1.1 1.2 1.3 1.4 1.4.1 1.5 1.5.1 1.5.2 1.5.3 1.6 1.6.1 All 117 releases
← All changes | includes/admin/class-columns.php +17 -3 4.3.1 → 4.5.1 View file →
@@ -68,9 +68,10 @@
68 68
69 69 if ( ( current_user_can( 'manage_options' ) ) || ( \tptn_get_option( 'show_count_non_admins' ) ) ) {
70 70 if ( \tptn_get_option( 'pv_in_admin' ) ) {
71 71 $cols['tptn_total'] = __( 'Total Views', 'top-10' );
72 - $cols['tptn_daily'] = __( "Today's Views", 'top-10' );
72 + /* translators: %s: Custom period label (e.g. Daily, Custom (7 days)). */
73 + $cols['tptn_daily'] = sprintf( __( '%s Views', 'top-10' ), Helpers::get_daily_range_label( 1 ) );
73 74 $cols['tptn_both'] = __( 'Views', 'top-10' );
74 75 }
75 76 }
76 77 return $cols;
@@ -123,9 +124,14 @@
123 124 * @param int $blog_id Blog ID.
124 125 * @return int
125 126 */
126 127 private static function get_daily_count( $id, $blog_id ) {
127 - return Counter::get_post_count_only( $id, 'daily', $blog_id );
128 + return Counter::get_post_count_only(
129 + $id,
130 + 'daily',
131 + $blog_id,
132 + array( 'from_date' => current_time( 'Y-m-d' ) . ' 00:00:00' )
133 + );
128 134 }
129 135
130 136 /**
131 137 * Format output based on column name.
@@ -192,9 +198,9 @@
192 198 $blog_id = get_current_blog_id();
193 199 $order = ( 'ASC' === strtoupper( (string) $wp_query->get( 'order' ) ) ) ? 'ASC' : 'DESC';
194 200
195 201 if ( $is_daily ) {
196 - $from_date = Helpers::get_from_date();
202 + $from_date = Helpers::get_from_date( current_time( 'Y-m-d' ) . ' 00:00:00', 0, 0 );
197 203 // phpcs:disable WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table name is generated internally.
198 204 $clauses['join'] .= $wpdb->prepare(
199 205 " LEFT JOIN {$table_name} AS tptn_counts
200 206 ON {$wpdb->posts}.ID = tptn_counts.postnumber
@@ -222,8 +228,16 @@
222 228 }
223 229
224 230 $clauses['orderby'] = "tptn_visits {$order}";
225 231
232 + /**
233 + * Filters the query clauses used to sort the admin posts list by view count.
234 + *
235 + * @since 3.4.0-RC2
236 + *
237 + * @param array $clauses The query clauses, keyed by clause name.
238 + * @param \WP_Query $wp_query The WP_Query instance.
239 + */
226 240 return apply_filters( 'tptn_posts_clauses', $clauses, $wp_query );
227 241 }
228 242
229 243 /**