PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / 4.5.2
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance v4.5.2
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
wp-optimize / includes / list-tables / class-wp-optimize-queries-list-table.php

class-wp-optimize-queries-list-table.php in WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance 4.5.2, at includes/list-tables/class-wp-optimize-queries-list-table.php

84 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) die('No direct access allowed');
3
4 if (!class_exists('WP_Optimize_Queries_List_Table')) :
5
6 class WP_Optimize_Queries_List_Table extends WP_List_Table {
7
8 /**
9 * WP column headers definition
10 *
11 * @var array
12 */
13 public $_column_headers;
14
15 /**
16 * WP table property for table items
17 *
18 * @var array
19 */
20 public $items;
21
22 /**
23 * {@inheritdoc}
24 */
25 public function get_columns() {
26 $columns = array(
27 'last_used' => __('Last access', 'wp-optimize'),
28 'table_name' => __('Table name', 'wp-optimize'),
29 'total_queries' => __('Total queries', 'wp-optimize'),
30 'avg_per_min' => __('Average executions per minute', 'wp-optimize'),
31 'avg_time' => __('Average query time', 'wp-optimize'),
32 'slow_queries_count' => __('Slow queries', 'wp-optimize'),
33 'slow_queries_detail' => __('Details', 'wp-optimize')
34 );
35
36 return $columns;
37 }
38
39 /**
40 * {@inheritdoc}
41 */
42 public function prepare_items() {
43 $columns = $this->get_columns();
44 $hidden = array();
45 $sortable = array();
46 $this->_column_headers = array($columns, $hidden, $sortable);
47
48 $this->items = array();
49 }
50
51 /**
52 * Append a new item to the standard table
53 *
54 * @param array $row The information for each column of the new row
55 * Example:
56 * [
57 * "table_name" => string, # Name of the table
58 * "last_used" => datetime, # string Last execution timestamp
59 * "total_queries" => integer, # Total execution count
60 * "avg_per_min" => float, # Average total executions per minute for the query group
61 * "avg_time" => float, # Average execution time for the query group
62 * "slow_queries_count" => integer, # How many slow queries were detected
63 * "slow_queries_detail" => string, # Extended information about slow queries
64 * ]
65 * @return void
66 */
67 public function add_item($row) {
68 $this->items[] = $row;
69 }
70
71 /**
72 * Parse the column value
73 *
74 * @param array $item The row data
75 * @param string $column_name What column are we parsing
76 * @return string|integer
77 */
78 public function column_default($item, $column_name) {
79 return $item[$column_name];
80 }
81 }
82
83 endif;
84