| @@ -3,8 +3,9 @@ | ||
| 3 | 3 | |
| 4 | 4 | class Live_Update { |
| 5 | 5 | /** |
| 6 | 6 | * Hold Plugin class |
| 7 | + * | |
| 7 | 8 | * @var Plugin |
| 8 | 9 | */ |
| 9 | 10 | public $plugin; |
| 10 | 11 | |
| @@ -127,9 +128,9 @@ | ||
| 127 | 128 | |
| 128 | 129 | /** |
| 129 | 130 | * Sends Updated Actions to the List Table View |
| 130 | 131 | * |
| 131 | - * @param int $last_time Timestamp of last update | |
| 132 | + * @param int $last_time Timestamp of last update | |
| 132 | 133 | * @param array $args Query args |
| 133 | 134 | * |
| 134 | 135 | * @return array Array of recently updated items |
| 135 | 136 | */ |
| @@ -175,9 +176,14 @@ | ||
| 175 | 176 | |
| 176 | 177 | $enable_stream_update = ( 'off' !== $this->plugin->admin->get_user_meta( get_current_user_id(), $this->user_meta_key ) ); |
| 177 | 178 | |
| 178 | 179 | // Register list table |
| 179 | - $this->list_table = new List_Table( $this->plugin, array( 'screen' => 'toplevel_page_' . $this->plugin->admin->records_page_slug ) ); | |
| 180 | + $this->list_table = new List_Table( | |
| 181 | + $this->plugin, | |
| 182 | + array( | |
| 183 | + 'screen' => 'toplevel_page_' . $this->plugin->admin->records_page_slug, | |
| 184 | + ) | |
| 185 | + ); | |
| 180 | 186 | $this->list_table->prepare_items(); |
| 181 | 187 | |
| 182 | 188 | $total_items = isset( $this->list_table->_pagination_args['total_items'] ) ? $this->list_table->_pagination_args['total_items'] : null; |
| 183 | 189 | $total_pages = isset( $this->list_table->_pagination_args['total_pages'] ) ? $this->list_table->_pagination_args['total_pages'] : null; |
| @@ -182,9 +188,10 @@ | ||
| 182 | 188 | $total_items = isset( $this->list_table->_pagination_args['total_items'] ) ? $this->list_table->_pagination_args['total_items'] : null; |
| 183 | 189 | $total_pages = isset( $this->list_table->_pagination_args['total_pages'] ) ? $this->list_table->_pagination_args['total_pages'] : null; |
| 184 | 190 | |
| 185 | 191 | if ( isset( $data['wp-stream-heartbeat'] ) && isset( $total_items ) ) { |
| 186 | - $response['total_items'] = $total_items; | |
| 192 | + $response['total_items'] = $total_items; | |
| 193 | + // translators: Placeholder refers to a number of items (e.g. "42") | |
| 187 | 194 | $response['total_items_i18n'] = sprintf( _n( '%d item', '%d items', $total_items ), number_format_i18n( $total_items ) ); |
| 188 | 195 | } |
| 189 | 196 | |
| 190 | 197 | if ( isset( $data['wp-stream-heartbeat'] ) && 'live-update' === $data['wp-stream-heartbeat'] && $enable_stream_update ) { |
| @@ -196,9 +203,9 @@ | ||
| 196 | 203 | |
| 197 | 204 | $query_args = json_decode( $data['wp-stream-heartbeat-query'], true ); |
| 198 | 205 | $query_args['paged'] = $total_pages; |
| 199 | 206 | |
| 200 | - $response['last_page_link'] = add_query_arg( $query_args, admin_url( 'admin.php' ) ); | |
| 207 | + $response['last_page_link'] = esc_url( add_query_arg( $query_args, admin_url( 'admin.php' ) ) ); | |
| 201 | 208 | } else { |
| 202 | 209 | $response['total_pages'] = 0; |
| 203 | 210 | } |
| 204 | 211 | } |