WC_Tracker::get_all_plugins()
Get all plugins grouped into activated or not.
Метод класса: WC_Tracker{}
Хуков нет.
Возвращает
Массив
.
Использование
$result = WC_Tracker::get_all_plugins();
Код WC_Tracker::get_all_plugins() WC Tracker::get all plugins WC 9.3.3
private static function get_all_plugins() { // Ensure get_plugins function is loaded. if ( ! function_exists( 'get_plugins' ) ) { include ABSPATH . '/wp-admin/includes/plugin.php'; } $plugins = wc_get_container()->get( LegacyProxy::class )->call_function( 'get_plugins' ); $active_plugins_keys = get_option( 'active_plugins', array() ); $active_plugins = array(); foreach ( $plugins as $k => $v ) { // Take care of formatting the data how we want it. $formatted = array(); $formatted['name'] = wp_strip_all_tags( $v['Name'] ); if ( isset( $v['Version'] ) ) { $formatted['version'] = wp_strip_all_tags( $v['Version'] ); } if ( isset( $v['Author'] ) ) { $formatted['author'] = wp_strip_all_tags( $v['Author'] ); } if ( isset( $v['Network'] ) ) { $formatted['network'] = wp_strip_all_tags( $v['Network'] ); } if ( isset( $v['PluginURI'] ) ) { $formatted['plugin_uri'] = wp_strip_all_tags( $v['PluginURI'] ); } $formatted['feature_compatibility'] = array(); if ( wc_get_container()->get( PluginUtil::class )->is_woocommerce_aware_plugin( $k ) ) { $formatted['feature_compatibility'] = array_filter( FeaturesUtil::get_compatible_features_for_plugin( $k ) ); } if ( in_array( $k, $active_plugins_keys, true ) ) { // Remove active plugins from list so we can show active and inactive separately. unset( $plugins[ $k ] ); $active_plugins[ $k ] = $formatted; } else { $plugins[ $k ] = $formatted; } } return array( 'active_plugins' => $active_plugins, 'inactive_plugins' => $plugins, ); }