| @@ -4,14 +4,59 @@ | ||
| 4 | 4 | } |
| 5 | 5 | |
| 6 | 6 | /** |
| 7 | 7 | * @var array $reports |
| 8 | + * @var array $required_plugins_properties | |
| 8 | 9 | * @var int $tabs_count |
| 9 | 10 | */ |
| 11 | + | |
| 10 | 12 | $tabs_count++; |
| 11 | 13 | |
| 14 | +$required_plugins_properties = array_flip( $required_plugins_properties ); | |
| 15 | + | |
| 16 | +unset( $required_plugins_properties['Name'] ); | |
| 17 | + | |
| 12 | 18 | foreach ( $reports as $report_name => $report ) : |
| 13 | - $report['report']->print_raw( $tabs_count ); | |
| 19 | + $indent = str_repeat( "\t", $tabs_count - 1 ); | |
| 20 | + | |
| 21 | + $is_plugins = in_array( $report_name, [ | |
| 22 | + 'plugins', | |
| 23 | + 'network_plugins', | |
| 24 | + 'mu_plugins', | |
| 25 | + ] ); | |
| 26 | + | |
| 27 | + if ( ! $is_plugins ) : | |
| 28 | + echo PHP_EOL . $indent . '== ' . $report['label'] . ' =='; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 29 | + endif; | |
| 30 | + | |
| 31 | + echo PHP_EOL; | |
| 32 | + | |
| 33 | + foreach ( $report['report'] as $field_name => $field ) : | |
| 34 | + $sub_indent = str_repeat( "\t", $tabs_count ); | |
| 35 | + | |
| 36 | + if ( $is_plugins ) { | |
| 37 | + echo "== {$field['label']} ==" . PHP_EOL; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 38 | + | |
| 39 | + foreach ( $field['value'] as $plugin_info ) : | |
| 40 | + $plugin_properties = array_intersect_key( $plugin_info, $required_plugins_properties ); | |
| 41 | + | |
| 42 | + echo esc_html( $sub_indent . $plugin_info['Name'] ); | |
| 43 | + | |
| 44 | + foreach ( $plugin_properties as $property_name => $property ) : | |
| 45 | + echo PHP_EOL . "{$sub_indent}\t{$property_name}: {$property}"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 46 | + endforeach; | |
| 47 | + | |
| 48 | + echo PHP_EOL . PHP_EOL; | |
| 49 | + endforeach; | |
| 50 | + } else { | |
| 51 | + $label = $field['label']; | |
| 52 | + | |
| 53 | + if ( ! empty( $label ) ) { | |
| 54 | + $label .= ': '; | |
| 55 | + } | |
| 56 | + echo "{$sub_indent}{$label}{$field['value']}" . PHP_EOL; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped | |
| 57 | + } | |
| 58 | + endforeach; | |
| 14 | 59 | |
| 15 | 60 | if ( ! empty( $report['sub'] ) ) : |
| 16 | 61 | $this->print_report( $report['sub'], $template, true ); |
| 17 | 62 | endif; |