WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана


Plugins_Handler::get_active_plugins() public WC 1.0

Gets all of the active plugins we can find.

{} Это метод класса: Plugins_Handler{}

Хуков нет.




$Plugins_Handler = new Plugins_Handler();
$Plugins_Handler->get_active_plugins( $include_deactivating, $record_unknown );
$include_deactivating(true|false) (обязательный)
When true, plugins deactivating this request will be considered active.
$record_unknown(true|false) (обязательный)
When true, the current plugin will be marked as active and recorded when unknown.

Код Plugins_Handler::get_active_plugins() WC 5.6.0

public function get_active_plugins( $include_deactivating, $record_unknown ) {
	global $jetpack_autoloader_activating_plugins_paths;

	// We're going to build a unique list of plugins from a few different sources
	// to find all of our "active" plugins. While we need to return an integer
	// array, we're going to use an associative array internally to reduce
	// the amount of time that we're going to spend checking uniqueness
	// and merging different arrays together to form the output.
	$active_plugins = array();

	// Make sure that plugins which have activated this request are considered as "active" even though
	// they probably won't be present in any option.
	if ( is_array( $jetpack_autoloader_activating_plugins_paths ) ) {
		foreach ( $jetpack_autoloader_activating_plugins_paths as $path ) {
			$active_plugins[ $path ] = $path;

	// This option contains all of the plugins that have been activated.
	$plugins = $this->plugin_locator->find_using_option( 'active_plugins' );
	foreach ( $plugins as $path ) {
		$active_plugins[ $path ] = $path;

	// This option contains all of the multisite plugins that have been activated.
	if ( is_multisite() ) {
		$plugins = $this->plugin_locator->find_using_option( 'active_sitewide_plugins', true );
		foreach ( $plugins as $path ) {
			$active_plugins[ $path ] = $path;

	// These actions contain plugins that are being activated/deactivated during this request.
	$plugins = $this->plugin_locator->find_using_request_action( array( 'activate', 'activate-selected', 'deactivate', 'deactivate-selected' ) );
	foreach ( $plugins as $path ) {
		$active_plugins[ $path ] = $path;

	// When the current plugin isn't considered "active" there's a problem.
	// Since we're here, the plugin is active and currently being loaded.
	// We can support this case (mu-plugins and non-standard activation)
	// by adding the current plugin to the active list and marking it
	// as an unknown (activating) plugin. This also has the benefit
	// of causing a reset because the active plugins list has
	// been changed since it was saved in the global.
	$current_plugin = $this->plugin_locator->find_current_plugin();
	if ( $record_unknown && ! in_array( $current_plugin, $active_plugins, true ) ) {
		$active_plugins[ $current_plugin ]             = $current_plugin;
		$jetpack_autoloader_activating_plugins_paths[] = $current_plugin;

	// When deactivating plugins aren't desired we should entirely remove them from the active list.
	if ( ! $include_deactivating ) {
		// These actions contain plugins that are being deactivated during this request.
		$plugins = $this->plugin_locator->find_using_request_action( array( 'deactivate', 'deactivate-selected' ) );
		foreach ( $plugins as $path ) {
			unset( $active_plugins[ $path ] );

	// Transform the array so that we don't have to worry about the keys interacting with other array types later.
	return array_values( $active_plugins );