Initial Commit
This commit is contained in:
@ -0,0 +1,68 @@
|
||||
<?php
|
||||
/**
|
||||
* WP Ultimo overview collector.
|
||||
*
|
||||
* @package query-monitor
|
||||
* @since 2.0.11
|
||||
*/
|
||||
|
||||
namespace WP_Ultimo\Development\Query_Monitor\Collectors;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
/**
|
||||
* Every QM Panel needs a collector.
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
class Collector_Overview extends \QM_Collector {
|
||||
|
||||
/**
|
||||
* Sets the id of the collector.
|
||||
*
|
||||
* @since 2.0.11
|
||||
* @var string
|
||||
*/
|
||||
public $id = 'wp-ultimo';
|
||||
|
||||
/**
|
||||
* Set-up routines.
|
||||
*
|
||||
* @since 2.0.11
|
||||
* @return void
|
||||
*/
|
||||
public function set_up() {
|
||||
|
||||
parent::set_up();
|
||||
|
||||
} // end set_up;
|
||||
|
||||
/**
|
||||
* Tear down routines.
|
||||
*
|
||||
* @since 2.0.11
|
||||
* @return void
|
||||
*/
|
||||
public function tear_down() {
|
||||
|
||||
parent::tear_down();
|
||||
|
||||
} // end tear_down;
|
||||
|
||||
/**
|
||||
* Process the collection.
|
||||
*
|
||||
* Here, we just need to add items to the
|
||||
* data property array.
|
||||
*
|
||||
* @since 2.0.11
|
||||
* @return void
|
||||
*/
|
||||
public function process() {
|
||||
|
||||
$this->data = $_REQUEST;
|
||||
|
||||
} // end process;
|
||||
|
||||
} // end class Collector_Overview;
|
120
inc/development/query-monitor/panel/class-overview.php
Normal file
120
inc/development/query-monitor/panel/class-overview.php
Normal file
@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/**
|
||||
* The WP Ultimo Overview QM Panel
|
||||
*
|
||||
* @package WP_Ultimo
|
||||
* @subpackage Development\Query_Monitor\Panel
|
||||
* @since 2.0.11
|
||||
*/
|
||||
|
||||
namespace WP_Ultimo\Development\Query_Monitor\Panel;
|
||||
|
||||
// Exit if accessed directly
|
||||
defined('ABSPATH') || exit;
|
||||
|
||||
/**
|
||||
* The WP Ultimo Overview QM Panel
|
||||
*
|
||||
* @since 2.0.11
|
||||
*/
|
||||
class Overview extends \QM_Output_Html {
|
||||
|
||||
/**
|
||||
* Initializes the panel.
|
||||
*
|
||||
* @since 2.0.11
|
||||
*
|
||||
* @param \QM_Collector $collector The collector associated with the panel.
|
||||
*/
|
||||
public function __construct($collector) {
|
||||
|
||||
parent::__construct($collector);
|
||||
|
||||
add_filter('qm/output/menus', array($this, 'admin_menu'), 1000);
|
||||
|
||||
add_filter('qm/output/panel_menus', array($this, 'panel_menu'), 1000);
|
||||
|
||||
} // end __construct;
|
||||
|
||||
/**
|
||||
* The name of the panel.
|
||||
*
|
||||
* @since 2.0.11
|
||||
* @return string
|
||||
*/
|
||||
public function name() {
|
||||
|
||||
return __('WP Ultimo', 'wp-ultimo');
|
||||
|
||||
} // end name;
|
||||
|
||||
/**
|
||||
* Output the contents of the panel.
|
||||
*
|
||||
* @since 2.0.11
|
||||
* @return void
|
||||
*/
|
||||
public function output() {
|
||||
|
||||
$data = $this->collector->get_data();
|
||||
|
||||
$this->before_tabular_output(); // phpcs:disable ?>
|
||||
|
||||
<thead>
|
||||
<th>Header 1</th>
|
||||
<th>Header 2</th>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
<td>Value Title</td>
|
||||
<td>Value</td>
|
||||
</tbody>
|
||||
|
||||
<?php // phpcs:enable
|
||||
|
||||
$this->after_tabular_output();
|
||||
|
||||
$this->before_non_tabular_output();
|
||||
|
||||
$data = $this->collector->get_data();
|
||||
|
||||
$this->after_non_tabular_output();
|
||||
|
||||
} // end output;
|
||||
|
||||
/**
|
||||
* Adds the panel to the admin panel.
|
||||
*
|
||||
* @since 2.0.11
|
||||
*
|
||||
* @param array $menu The original menu.
|
||||
* @return array
|
||||
*/
|
||||
public function admin_menu(array $menu) {
|
||||
|
||||
return $menu;
|
||||
|
||||
} // end admin_menu;
|
||||
|
||||
/**
|
||||
* Adds a panel menu for the panel.
|
||||
*
|
||||
* @since 2.0.11
|
||||
*
|
||||
* @param array $menu The admin panel menu.
|
||||
* @return array
|
||||
*/
|
||||
public function panel_menu(array $menu) {
|
||||
|
||||
$new_menu = array(
|
||||
'wp-ultimo' => $this->menu(array(
|
||||
'title' => esc_html__('WP Ultimo', 'wp-ultimo'),
|
||||
'id' => 'wp-ultimo',
|
||||
)),
|
||||
);
|
||||
|
||||
return $new_menu + $menu;
|
||||
|
||||
} // end panel_menu;
|
||||
|
||||
} // end class Overview;
|
Reference in New Issue
Block a user