Gets the names of plugins required by the plugin.
Parameters
$plugin_file
stringrequired- The dependent plugin’s filepath, relative to the plugins directory.
Source
public static function get_dependency_names( $plugin_file ) {
$dependency_api_data = self::get_dependency_api_data();
$dependencies = self::get_dependencies( $plugin_file );
$plugins = self::get_plugins();
$dependency_names = array();
foreach ( $dependencies as $dependency ) {
// Use the name if it's available, otherwise fall back to the slug.
if ( isset( $dependency_api_data[ $dependency ]['name'] ) ) {
$name = $dependency_api_data[ $dependency ]['name'];
} else {
$dependency_filepath = self::get_dependency_filepath( $dependency );
if ( false !== $dependency_filepath ) {
$name = $plugins[ $dependency_filepath ]['Name'];
} else {
$name = $dependency;
}
}
$dependency_names[ $dependency ] = $name;
}
return $dependency_names;
}
Changelog
Version | Description |
---|---|
6.5.0 | Introduced. |
User Contributed Notes
You must log in before being able to contribute a note or feedback.