PHP code example of ingenyus / configure-environment-plugins

1. Go to this page and download the library: Download ingenyus/configure-environment-plugins library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ingenyus / configure-environment-plugins example snippets


if ( env('ENABLED_PLUGINS') ) {
    Config::define( 'ENABLED_PLUGINS', explode(',', env('ENABLED_PLUGINS')) );
}
if ( env('DISABLED_PLUGINS') ) {
    Config::define( 'DISABLED_PLUGINS', explode(',', env('DISABLED_PLUGINS')) );
}

/**
 * Called after local plugins have been disabled
 *
 * @param string[] $disabled_plugins
 */
add_action( 'environment_plugins_after_disabling_local_plugins', function( $disabled_plugins ) { /* Do something */ } );

/**
 * Called after local plugins have been enabled
 *
 * @param string[] $enabled_plugins
 */
add_action( 'environment_plugins_after_enabling_local_plugins', function( $enabled_plugins ) { /* Do something */ } );

/**
 * Called after network plugins have been disabled
 *
 * @param string[] $disabled_plugins
 */
add_action( 'environment_plugins_after_disabling_network_plugins', function( $disabled_plugins ) { /* Do something */ } );

/**
 * Called after network plugins have been enabled
 *
 * @param string[] $enabled_plugins
 */
add_action( 'environment_plugins_after_enabling_network_plugins', function( $enabled_plugins ) { /* Do something */ } );

DISABLED_PLUGINS='akismet/akismet.php, hello-dolly/hello-dolly.php'
ENABLED_PLUGINS='disable-emails/disable-emails.php'