Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions collectors/assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,14 @@ public function process() {
}
}

$extra = array();

if ( ! empty( $dependency->extra ) ) {
foreach ( $dependency->extra as $key => $value ) {
$extra[ $key ] = is_array( $value ) ? count( $value ) : true;
}
}

$this->data['assets'][ $position ][ $handle ] = array(
'host' => $host,
'source' => $source,
Expand All @@ -145,6 +153,7 @@ public function process() {
'display' => $display,
'dependents' => $dependents,
'dependencies' => $dependencies,
'extra' => $extra,
);
}
}
Expand Down
12 changes: 11 additions & 1 deletion output/html/assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public function output() {
echo $this->build_filter( $type . '-dependents', $data['dependents'], __( 'Dependents', 'query-monitor' ) ); // WPCS: XSS ok.
echo '</th>';
echo '<th scope="col">' . esc_html__( 'Version', 'query-monitor' ) . '</th>';
echo '<th scope="col">' . esc_html__( 'Extra', 'query-monitor' ) . '</th>';
echo '</tr>';
echo '</thead>';

Expand All @@ -84,7 +85,7 @@ public function output() {

echo '<tr>';
printf(
'<td colspan="7">%1$s</td>',
'<td colspan="8">%1$s</td>',
sprintf(
esc_html( $type_label['total'] ),
'<span class="qm-items-number">' . esc_html( number_format_i18n( $total ) ) . '</span>'
Expand All @@ -107,6 +108,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'] ) {
Expand Down Expand Up @@ -151,6 +160,7 @@ protected function dependency_row( $handle, array $asset, $label ) {
echo '<td class="qm-ltr qm-highlighter" data-qm-highlight="' . esc_attr( implode( ' ', $highlight_deps ) ) . '">' . implode( ', ', array_map( 'esc_html', $asset['dependencies'] ) ) . '</td>';
echo '<td class="qm-ltr qm-highlighter" data-qm-highlight="' . esc_attr( implode( ' ', $highlight_dependents ) ) . '">' . implode( ', ', array_map( 'esc_html', $asset['dependents'] ) ) . '</td>';
echo '<td class="qm-ltr">' . esc_html( $asset['ver'] ) . '</td>';
echo '<td>' . implode( ', ', array_map( 'esc_html', $extra ) ) . '</td>';

echo '</tr>';
}
Expand Down