Automattic\WooCommerce\Database\Migrations\CustomOrderTable
CLIRunner::get_printable_plugin_names
Get the printable names for a set of plugins given their file names.
Method of the class: CLIRunner{}
No Hooks.
Returns
Array. A sorted array of plugin names or file names.
Usage
// private - for code of main (parent) class only $result = $this->get_printable_plugin_names( $plugins, $display_filenames ): array;
- $plugins(array) (required)
- The plugin file names.
- $display_filenames(true|false) (required)
- True to simply return the sorted list of plugin file names.
CLIRunner::get_printable_plugin_names() CLIRunner::get printable plugin names code WC 10.5.0
private function get_printable_plugin_names( array $plugins, bool $display_filenames ): array {
if ( $display_filenames ) {
sort( $plugins );
return $plugins;
}
$plugin_names = array_map(
fn( $plugin_file ) => get_plugin_data( WP_PLUGIN_DIR . DIRECTORY_SEPARATOR . $plugin_file, false )['Name'] ?? $plugin_file,
$plugins
);
sort( $plugin_names );
return $plugin_names;
}