WC_REST_System_Status_V2_Controller::get_inactive_plugins()publicWC 1.0

Get a list of inplugins active on the site.

Метод класса: WC_REST_System_Status_V2_Controller{}

Хуков нет.

Возвращает

Массив.

Использование

$WC_REST_System_Status_V2_Controller = new WC_REST_System_Status_V2_Controller();
$WC_REST_System_Status_V2_Controller->get_inactive_plugins();

Код WC_REST_System_Status_V2_Controller::get_inactive_plugins() WC 7.3.0

public function get_inactive_plugins() {
	$plugins_data = get_transient( 'wc_system_status_inactive_plugins' );

	if ( false === $plugins_data ) {
		require_once ABSPATH . 'wp-admin/includes/plugin.php';

		if ( ! function_exists( 'get_plugins' ) ) {
			return array();
		}

		$plugins        = get_plugins();
		$active_plugins = (array) get_option( 'active_plugins', array() );

		if ( is_multisite() ) {
			$network_activated_plugins = array_keys( get_site_option( 'active_sitewide_plugins', array() ) );
			$active_plugins            = array_merge( $active_plugins, $network_activated_plugins );
		}

		$plugins_data = array();

		foreach ( $plugins as $plugin => $data ) {
			if ( in_array( $plugin, $active_plugins, true ) ) {
				continue;
			}
			$plugins_data[] = $this->format_plugin_data( $plugin, $data );
		}

		set_transient( 'wc_system_status_inactive_plugins', $plugins_data, HOUR_IN_SECONDS );
	}

	return $plugins_data;
}