Constants.php
71 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Pods\Integrations\Query_Monitor\Outputters; |
| 4 | |
| 5 | // Don't load directly. |
| 6 | if ( ! defined( 'ABSPATH' ) ) { |
| 7 | die( '-1' ); |
| 8 | } |
| 9 | |
| 10 | use QM_Collector; |
| 11 | use QM_Output_Html; |
| 12 | |
| 13 | /** |
| 14 | * Class Constants |
| 15 | * |
| 16 | * @since 3.2.7 |
| 17 | */ |
| 18 | class Constants extends QM_Output_Html { |
| 19 | |
| 20 | public function __construct( QM_Collector $collector ) { |
| 21 | parent::__construct( $collector ); |
| 22 | |
| 23 | add_filter( 'qm/output/menus', [ $this, 'admin_menu' ], 999 ); |
| 24 | } |
| 25 | |
| 26 | public function name(): string { |
| 27 | return __( 'Pods', 'pods' ); |
| 28 | } |
| 29 | |
| 30 | public function output(): void { |
| 31 | $data = $this->collector->get_data(); |
| 32 | |
| 33 | $this->before_tabular_output(); |
| 34 | ?> |
| 35 | <thead> |
| 36 | <tr> |
| 37 | <th><?php esc_html_e( 'Constant Name', 'pods' ); ?></th> |
| 38 | <th><?php esc_html_e( 'Constant Value', 'pods' ); ?></th> |
| 39 | </tr> |
| 40 | </thead> |
| 41 | <tbody> |
| 42 | <?php |
| 43 | if ( ! empty( $data['constants'] ) ) { |
| 44 | foreach ( $data['constants'] as $key => $value ) { |
| 45 | ?> |
| 46 | <tr> |
| 47 | <th><?php echo esc_html( $key ); ?></th> |
| 48 | <td><?php echo esc_html( $value ); ?></td> |
| 49 | </tr> |
| 50 | <?php |
| 51 | } |
| 52 | } else { |
| 53 | ?> |
| 54 | <tr> |
| 55 | <td colspan="2" style="text-align:center !important;"><em>none</em></td> |
| 56 | </tr> |
| 57 | <?php |
| 58 | } |
| 59 | ?> |
| 60 | </tbody> |
| 61 | <tfoot> |
| 62 | <tr class="qm-items-shown qm-hide"> |
| 63 | <td><?php esc_html_e( 'Constant Name', 'pods' ); ?></td> |
| 64 | <td><?php esc_html_e( 'Constant Value', 'pods' ); ?></td> |
| 65 | </tr> |
| 66 | </tfoot> |
| 67 | <?php |
| 68 | $this->after_tabular_output(); |
| 69 | } |
| 70 | } |
| 71 |