diff --git a/classes/Collector_Assets.php b/classes/Collector_Assets.php index 8dacdbf7..58411a69 100644 --- a/classes/Collector_Assets.php +++ b/classes/Collector_Assets.php @@ -203,6 +203,12 @@ public function process() { } } + $extra = array(); + + foreach ( $dependency->extra as $key => $value ) { + $extra[ $key ] = is_array( $value ) ? count( $value ) : true; + } + $this->data->assets[ $position ][ $handle ] = array( 'host' => $host, 'port' => $port, @@ -213,6 +219,7 @@ public function process() { 'display' => $display, 'dependents' => $dependents, 'dependencies' => $dependencies, + 'extra' => $extra, ); $this->data->counts[ $position ]++; diff --git a/output/html/assets.php b/output/html/assets.php index 499f8c47..4ca0cbea 100644 --- a/output/html/assets.php +++ b/output/html/assets.php @@ -83,6 +83,7 @@ public function output() { echo $this->build_filter( $type . '-dependents', $data->dependents, __( 'Dependents', 'query-monitor' ) ); // WPCS: XSS ok. echo ''; echo '' . esc_html__( 'Version', 'query-monitor' ) . ''; + echo '' . esc_html__( 'Extra', 'query-monitor' ) . ''; echo ''; echo ''; @@ -102,7 +103,7 @@ public function output() { echo ''; printf( - '%1$s', + '%1$s', sprintf( esc_html( $type_label['total'] ), '' . esc_html( number_format_i18n( $data->counts['total'] ) ) . '' @@ -152,6 +153,14 @@ protected function dependency_row( $handle, array $asset, $label ) { $qm_host = ( $asset['local'] ) ? 'local' : __( 'Other', 'query-monitor' ); + $extra = array(); + + if ( ! empty( $asset['extra'] ) ) { + foreach ( $asset['extra'] as $key => $count ) { + $extra[] = $key . ( is_numeric( $count ) ? ' (' . $count . ')' : '' ); + } + } + $class = ''; if ( $asset['warning'] ) { @@ -223,6 +232,7 @@ protected function dependency_row( $handle, array $asset, $label ) { echo ''; echo '' . implode( ', ', array_map( 'esc_html', $asset['dependents'] ) ) . ''; echo '' . esc_html( $asset['ver'] ) . ''; + echo '' . implode( ', ', array_map( 'esc_html', $extra ) ) . ''; echo ''; }