Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
WC_WCCOM_Site_Installer::get_plugin_info( string $dir )
Get plugin info
Description Description
Parameters Parameters
- $dir
-
(Required) Directory name of the plugin.
Return Return
(bool|array)
Source Source
File: includes/wccom-site/class-wc-wccom-site-installer.php
private static function get_plugin_info( $dir ) { $plugin_folder = basename( $dir ); if ( ! function_exists( 'get_plugins' ) ) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $plugins = get_plugins(); $related_plugins = array_filter( $plugins, function( $key ) use ( $plugin_folder ) { return strpos( $key, $plugin_folder . '/' ) === 0; }, ARRAY_FILTER_USE_KEY ); if ( 1 === count( $related_plugins ) ) { $plugin_key = array_keys( $related_plugins )[0]; $plugin_data = $plugins[ $plugin_key ]; return array( 'name' => $plugin_data['Name'], 'version' => $plugin_data['Version'], 'active' => is_plugin_active( $plugin_key ), ); } return false; }
Changelog Changelog
Version | Description |
---|---|
3.9.0 | Introduced. |