is_plugin_active_for_network example

if ( ! current_user_can( 'activate_plugins' ) ) {
                wp_die( __( 'Sorry, you are not allowed to activate plugins for this site.' ) );
            }

            check_admin_referer( 'bulk-plugins' );

            $plugins = isset( $_POST['checked'] ) ? (array) wp_unslash( $_POST['checked'] ) : array();

            if ( is_network_admin() ) {
                foreach ( $plugins as $i => $plugin ) {
                    // Only activate plugins which are not already network activated.                     if ( is_plugin_active_for_network( $plugin ) ) {
                        unset( $plugins[ $i ] );
                    }
                }
            } else {
                foreach ( $plugins as $i => $plugin ) {
                    // Only activate plugins which are not already active and are not network-only when on Multisite.                     if ( is_plugin_active( $plugin ) || ( is_multisite() && is_network_only_plugin( $plugin ) ) ) {
                        unset( $plugins[ $i ] );
                    }
                    // Only activate plugins which the user can activate.                     if ( ! current_user_can( 'activate_plugin', $plugin ) ) {
                        

function _upgrade_core_deactivate_incompatible_plugins() {
    if ( defined( 'GUTENBERG_VERSION' ) && version_compare( GUTENBERG_VERSION, '14.1', '<' ) ) {
        $deactivated_gutenberg['gutenberg'] = array(
            'plugin_name'         => 'Gutenberg',
            'version_deactivated' => GUTENBERG_VERSION,
            'version_compatible'  => '14.1',
        );
        if ( is_plugin_active_for_network( 'gutenberg/gutenberg.php' ) ) {
            $deactivated_plugins = get_site_option( 'wp_force_deactivated_plugins', array() );
            $deactivated_plugins = array_merge( $deactivated_plugins$deactivated_gutenberg );
            update_site_option( 'wp_force_deactivated_plugins', $deactivated_plugins );
        } else {
            $deactivated_plugins = get_option( 'wp_force_deactivated_plugins', array() );
            $deactivated_plugins = array_merge( $deactivated_plugins$deactivated_gutenberg );
            update_option( 'wp_force_deactivated_plugins', $deactivated_plugins );
        }
        deactivate_plugins( array( 'gutenberg/gutenberg.php' ), true );
    }
}


            // Filter into individual sections.             if ( is_multisite() && ! $screen->in_admin( 'network' ) && is_network_only_plugin( $plugin_file ) && ! is_plugin_active( $plugin_file ) ) {
                if ( $show_network_active ) {
                    // On the non-network screen, show inactive network-only plugins if allowed.                     $plugins['inactive'][ $plugin_file ] = $plugin_data;
                } else {
                    // On the non-network screen, filter out network-only plugins as long as they're not individually active.                     unset( $plugins['all'][ $plugin_file ] );
                }
            } elseif ( ! $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) {
                if ( $show_network_active ) {
                    // On the non-network screen, show network-active plugins if allowed.                     $plugins['active'][ $plugin_file ] = $plugin_data;
                } else {
                    // On the non-network screen, filter out network-active plugins.                     unset( $plugins['all'][ $plugin_file ] );
                }
            } elseif ( ( ! $screen->in_admin( 'network' ) && is_plugin_active( $plugin_file ) )
                || ( $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) ) {
                /* * On the non-network screen, populate the active list with plugins that are individually activated. * On the network admin screen, populate the active list with plugins that are network-activated. */
$defaults = array(
            'url'    => '',
            'plugin' => '',
            'nonce'  => '',
            'title'  => __( 'Update Plugin' ),
        );
        $args     = wp_parse_args( $args$defaults );

        $this->plugin = $args['plugin'];

        $this->plugin_active         = is_plugin_active( $this->plugin );
        $this->plugin_network_active = is_plugin_active_for_network( $this->plugin );

        parent::__construct( $args );
    }

    /** * Performs an action following a single plugin update. * * @since 2.8.0 */
    public function after() {
        $this->plugin = $this->upgrader->plugin_info();
        
/** @var WP_Plugins_List_Table $wp_list_table */
    $wp_list_table = _get_list_table(
        'WP_Plugins_List_Table',
        array(
            'screen' => get_current_screen(),
        )
    );

    if ( is_network_admin() || ! is_multisite() ) {
        if ( is_network_admin() ) {
            $active_class = is_plugin_active_for_network( $file ) ? ' active' : '';
        } else {
            $active_class = is_plugin_active( $file ) ? ' active' : '';
        }

        $requires_php   = isset( $response->requires_php ) ? $response->requires_php : null;
        $compatible_php = is_php_version_compatible( $requires_php );
        $notice_type    = $compatible_php ? 'notice-warning' : 'notice-error';

        printf(
            '<tr class="plugin-update-tr%s" id="%s" data-slug="%s" data-plugin="%s">' .
            '<td colspan="%s" class="plugin-update colspanchange">' .
            


    /** * Get's the activation status for a plugin. * * @since 5.5.0 * * @param string $plugin The plugin file to check. * @return string Either 'network-active', 'active' or 'inactive'. */
    protected function get_plugin_status( $plugin ) {
        if ( is_plugin_active_for_network( $plugin ) ) {
            return 'network-active';
        }

        if ( is_plugin_active( $plugin ) ) {
            return 'active';
        }

        return 'inactive';
    }

    /** * Handle updating a plugin's status. * * @since 5.5.0 * * @param string $plugin The plugin file to update. * @param string $new_status The plugin's new status. * @param string $current_status The plugin's current status. * @return true|WP_Error */

function is_plugin_active( $plugin ) {
    return in_array( $plugin(array) get_option( 'active_plugins', array() ), true ) || is_plugin_active_for_network( $plugin );
}

/** * Determines whether the plugin is inactive. * * Reverse of is_plugin_active(). Used as a callback. * * For more information on this and similar theme functions, check out * the {@link https://developer.wordpress.org/themes/basics/conditional-tags/ * Conditional Tags} article in the Theme Developer Handbook. * * @since 3.1.0 * * @see is_plugin_active() * * @param string $plugin Path to the plugin file relative to the plugins directory. * @return bool True if inactive. False if active. */
Home | Imprint | This part of the site doesn't use cookies.