collector->get_data(); $this->before_non_tabular_output(); echo '
'; echo '

PHP

'; echo ''; echo ''; $append = ''; $class = ''; $php_warning = $data->php['old']; if ( $php_warning ) { $append .= sprintf( ' (%s)', 'https://wordpress.org/support/update-php/', esc_html__( 'Help', 'query-monitor' ) ); $class = 'qm-warn'; } echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; if ( ! empty( $data->php['user'] ) ) { echo ''; } else { echo ''; } echo ''; foreach ( $data->php['variables'] as $key => $val ) { echo ''; echo ''; echo ''; echo ''; } $out = array(); foreach ( $data->php['error_levels'] as $level => $reported ) { if ( $reported ) { $out[] = esc_html( $level ) . ' ✓'; } else { $out[] = '' . esc_html( $level ) . ''; } } $error_levels = implode( '
  • ', $out ); echo '
  • '; echo ''; echo ''; echo ''; if ( ! empty( $data->php['extensions'] ) ) { echo ''; echo ''; echo ''; echo ''; } echo ''; echo '
    ' . esc_html__( 'Version', 'query-monitor' ) . ''; if ( $php_warning ) { // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo QueryMonitor::icon( 'warning' ); } echo esc_html( $data->php['version'] ?: esc_html__( 'Unknown', 'query-monitor' ) ); echo $append; // WPCS: XSS ok. echo '
    SAPI' . esc_html( $data->php['sapi'] ?: esc_html__( 'Unknown', 'query-monitor' ) ) . '
    ' . esc_html__( 'User', 'query-monitor' ) . '' . esc_html( $data->php['user'] ) . '' . esc_html__( 'Unknown', 'query-monitor' ) . '
    ' . esc_html( $key ) . ''; echo esc_html( $val ); echo '
    ' . esc_html__( 'Error Reporting', 'query-monitor' ) . ''; echo esc_html( (string) $data->php['error_reporting'] ); echo self::build_toggler(); // WPCS: XSS ok; echo '
    '; echo "
    • {$error_levels}
    "; // WPCS: XSS ok. echo '
    '; echo '
    ' . esc_html__( 'Extensions', 'query-monitor' ) . ''; printf( // WPCS: XSS ok. '
    %1$s %2$s
    ', esc_html( number_format_i18n( count( $data->php['extensions'] ) ) ), self::build_toggler() ); echo '
    '; self::output_inner( $data->php['extensions'] ); echo '
    '; echo '
    '; echo '
    '; if ( isset( $data->db ) ) { echo '
    '; echo '

    ' . esc_html__( 'Database', 'query-monitor' ) . '

    '; echo ''; echo ''; $info = array( 'server-version' => __( 'Server Version', 'query-monitor' ), 'extension' => __( 'Extension', 'query-monitor' ), 'client-version' => __( 'Client Version', 'query-monitor' ), 'user' => __( 'User', 'query-monitor' ), 'host' => __( 'Host', 'query-monitor' ), 'database' => __( 'Database', 'query-monitor' ), ); foreach ( $info as $field => $label ) { echo ''; echo ''; if ( ! isset( $data->db['info'][ $field ] ) ) { // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped echo ''; } else { echo ''; } echo ''; } foreach ( $data->db['variables'] as $setting ) { // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase $key = (string) $setting->Variable_name; // phpcs:ignore WordPress.NamingConventions.ValidVariableName.UsedPropertyNotSnakeCase $val = (string) $setting->Value; $append = ''; if ( is_numeric( $val ) && ( $val >= ( 1024 * 1024 ) ) ) { $append .= sprintf( ' (~%s)', esc_html( (string) size_format( $val ) ) ); } echo ''; echo ''; echo ''; echo ''; } echo ''; echo '
    ' . esc_html( $label ) . '' . QueryMonitor::icon( 'warning' ) . esc_html__( 'Unknown', 'query-monitor' ) . '' . esc_html( $data->db['info'][ $field ] ) . '
    ' . esc_html( $key ) . ''; echo esc_html( $val ); echo $append; // WPCS: XSS ok. echo '
    '; echo '
    '; } echo '
    '; echo '

    WordPress

    '; echo ''; echo ''; echo ''; echo ''; echo ''; echo ''; if ( isset( $data->wp['environment_type'] ) ) { echo ''; echo ''; echo ''; echo ''; } if ( isset( $data->wp['development_mode'] ) ) { echo ''; echo ''; echo ''; echo ''; } foreach ( $data->wp['constants'] as $key => $val ) { echo ''; echo ''; echo ''; echo ''; } echo ''; echo '
    ' . esc_html__( 'Version', 'query-monitor' ) . '' . esc_html( $data->wp['version'] ) . '
    '; esc_html_e( 'Environment Type', 'query-monitor' ); printf( ' (%s)', 'https://make.wordpress.org/core/2020/07/24/new-wp_get_environment_type-function-in-wordpress-5-5/', esc_html__( 'Help', 'query-monitor' ) ); echo '' . esc_html( $data->wp['environment_type'] ) . '
    '; esc_html_e( 'Development Mode', 'query-monitor' ); printf( ' (%s)', 'https://core.trac.wordpress.org/changeset/56042', esc_html__( 'Help', 'query-monitor' ) ); echo '' . esc_html( $data->wp['development_mode'] ) . '
    ' . esc_html( $key ) . '' . esc_html( $val ) . '
    '; echo '
    '; echo '
    '; echo '

    ' . esc_html__( 'Server', 'query-monitor' ) . '

    '; $server = array( 'name' => __( 'Software', 'query-monitor' ), 'version' => __( 'Version', 'query-monitor' ), 'address' => __( 'IP Address', 'query-monitor' ), 'host' => __( 'Host', 'query-monitor' ), /* translators: OS stands for Operating System */ 'OS' => __( 'OS', 'query-monitor' ), 'arch' => __( 'Architecture', 'query-monitor' ), ); echo ''; echo ''; foreach ( $server as $field => $label ) { echo ''; echo ''; if ( ! empty( $data->server[ $field ] ) ) { echo ''; } else { echo ''; } echo ''; } echo ''; echo '
    ' . esc_html( $label ) . '' . esc_html( $data->server[ $field ] ) . '' . esc_html__( 'Unknown', 'query-monitor' ) . '
    '; echo '
    '; $this->after_non_tabular_output(); } } /** * @param array $output * @param QM_Collectors $collectors * @return array */ function register_qm_output_html_environment( array $output, QM_Collectors $collectors ) { $collector = QM_Collectors::get( 'environment' ); if ( $collector ) { $output['environment'] = new QM_Output_Html_Environment( $collector ); } return $output; } add_filter( 'qm/outputter/html', 'register_qm_output_html_environment', 120, 2 );