';
if ( !empty( $data['files'] ) ) {
$files_with_errors = 0;
$path_components = $components = array();
$largest_file = array(
'path' => null,
'size' => 0
);
foreach ( $data['files'] as &$file ) {
$file['_path_components'] = array();
foreach ( array_filter( explode( '/', str_replace( ABSPATH, '', dirname( $file['path'] ) ) ) ) as $path_component ) {
$path_components[$path_component]
= $file['_path_components'][$path_component]
= 1;
foreach ( explode( '-', $path_component ) as $smaller_path_component )
$path_components[$smaller_path_component]
= $file['_path_components'][$smaller_path_component]
= 1;
}
$components[$file['component']->name] = 1;
}
echo '
';
echo '' . esc_html( $this->collector->name() ) . '';
echo '';
echo '';
echo '| ';
echo $this->build_sorter( __( '', 'query-monitor-extend' ) );
echo ' | ';
echo '';
echo $this->build_filter( 'path', array_map( 'esc_attr', array_keys( $path_components ) ), __( 'Path', 'query-monitor-extend' ) );
echo ' | ';
echo '';
echo $this->build_sorter( __( 'Filesize', 'query-monitor-extend' ) );
echo ' | ';
echo '';
echo $this->build_filter( 'component', array_map( 'esc_attr', array_keys( $components ) ), __( 'Component', 'query-monitor-extend' ) );
echo ' | ';
echo '
';
echo '';
echo '';
foreach ( $data['files'] as $i => $file ) {
if ( filesize( $file['path'] ) > $largest_file['size'] )
$largest_file = array(
'path' => $file['path'],
'size' => filesize( $file['path'] ),
);
if ( !empty( $file['has_error'] ) )
$files_with_errors++;
echo 'name ) . '"' .
'data-qm-path="' . esc_attr( implode( ' ', array_keys( $file['_path_components'] ) ) ) . '"' .
( !empty( $file['has_error'] ) ? ' class="qm-warn"' : '' ) .
'>';
echo '| ' . ( $i + 1 ) . ' | ';
echo '' . esc_html( str_replace( ABSPATH, '/', $file['path'] ) ) . ' | ';
echo '' . $this->human_file_size( filesize( $file['path'] ) ) . ' | ';
echo '' . esc_html( $file['component']->name ) . ' | ';
echo '
';
}
echo '';
echo '';
echo '';
echo '| ';
printf(
esc_html__( 'Files in filter: %s', 'query-monitor-extend' ),
'' . esc_html( number_format_i18n( count( $data['files']) ) ) . ''
);
echo ' | ';
echo '
';
echo '';
echo '| ' .
'Total: ' . esc_html( number_format_i18n( count( $data['files'] ) ) ) . '' .
(
!empty( $files_with_errors )
? ', With error(s): ' . esc_html( number_format_i18n( $files_with_errors ) ) . ''
: ''
) .
' | ';
echo 'Largest: ' . $this->human_file_size( $largest_file['size'] ) . ' | ';
echo 'Components: ' . count( $components ) . ' | ';
echo '
';
echo '';
echo '
';
echo '';
} else {
echo '
';
echo '
' . esc_html__( 'None', 'query-monitor' ) . '
';
echo '
';
}
echo '
';
}
public function admin_title( array $title ) {
$data = $this->collector->get_data();
if ( !empty( $data['files'] ) ) {
$_title = sprintf( esc_html_x( '%s F', 'Files count', 'query-monitor-extend' ), number_format_i18n( count( $data['files'] ) ) );
$_title = preg_replace( '#\s?([^0-9,\.]+)#', '