public static function load($plugin, array $config = [])
    {
        if (is_array($plugin)) {
            foreach ($plugin as $name => $conf) {
                list($name, $conf) = (is_numeric($name)) ? [$conf, $config] : [$name, $conf];
                static::load($name, $conf);
            }

            return;
        }

        static::loadConfig();

        $config += [
            'bootstrap' => false,
            'classBase' => 'src',
            'ignoreMissing' => false
        ];

        if (!isset($config['path'])) {
            $config['path'] = Configure::read('plugins.' . $plugin);
        }

        if (empty($config['path'])) {
            $paths = (array)Configure::read('App.paths.plugins');
            $pluginPath = str_replace('/', DIRECTORY_SEPARATOR, $plugin);
            foreach ($paths as $path) {
                if (is_dir($path . $pluginPath)) {
                    $config['path'] = $path . $pluginPath . DIRECTORY_SEPARATOR;
                    break;
                }
            }
        }

        if (empty($config['path'])) {
            throw new MissingPluginException(['plugin' => $plugin]);
        }

        $config['classPath'] = $config['path'] . $config['classBase'] . DIRECTORY_SEPARATOR;
        if (!isset($config['configPath'])) {
            $config['configPath'] = $config['path'] . 'config' . DIRECTORY_SEPARATOR;
        }

        static::$plugins[$plugin] = $config;


        if ($config['bootstrap'] === true) {
            static::bootstrap($plugin);
        }
    }
public static function load($plugin, array $config = [])
    {
        if (is_array($plugin)) {
            foreach ($plugin as $name => $conf) {
                list($name, $conf) = (is_numeric($name)) ? [$conf, $config] : [$name, $conf];
                static::load($name, $conf);
            }

            return;
        }

        static::loadConfig();

        $config += [
            'bootstrap' => false,
            'classBase' => 'src',
            'ignoreMissing' => false
        ];

        if (!isset($config['path'])) {
            $config['path'] = Configure::read('plugins.' . $plugin);
        }

        if (empty($config['path'])) {
            $paths = (array)Configure::read('App.paths.plugins');
            $pluginPath = str_replace('/', DIRECTORY_SEPARATOR, $plugin);
            foreach ($paths as $path) {
                if (is_dir($path . $pluginPath)) {
                    $config['path'] = $path . $pluginPath . DIRECTORY_SEPARATOR;
                    break;
                }
            }
        }

        if (empty($config['path'])) {
            throw new MissingPluginException(['plugin' => $plugin]);
        }

        $config['classPath'] = $config['path'] . $config['classBase'] . DIRECTORY_SEPARATOR;
        if (!isset($config['configPath'])) {
            $config['configPath'] = $config['path'] . 'config' . DIRECTORY_SEPARATOR;
        }

        static::$plugins[$plugin] = $config;


        if ($config['bootstrap'] === true) {
            static::bootstrap($plugin);
        }
    }
public static function load ( $ plugin , array $ config = [ ] ) { if ( is_array ( $ plugin ) ) { foreach ( $ plugin as $ name => $ conf ) { list ( $ name , $ conf ) = ( is_numeric ( $ name ) ) ? [ $ conf , $ config ] : [ $ name , $ conf ] ; static :: load ( $ name , $ conf ) ; } return ; } static :: loadConfig ( ) ; $ config += [ 'bootstrap' => false , 'classBase' => 'src' , 'ignoreMissing' => false ] ; if ( ! isset ( $ config [ 'path' ] ) ) { $ config [ 'path' ] = Configure :: read ( 'plugins.' . $ plugin ) ; } if ( empty ( $ config [ 'path' ] ) ) { $ paths = ( array ) Configure :: read ( 'App.paths.plugins' ) ; $ pluginPath = str_replace ( '/' , DIRECTORY_SEPARATOR , $ plugin ) ; foreach ( $ paths as $ path ) { if ( is_dir ( $ path . $ pluginPath ) ) { $ config [ 'path' ] = $ path . $ pluginPath . DIRECTORY_SEPARATOR ; break ; } } } if ( empty ( $ config [ 'path' ] ) ) { throw new MissingPluginException ( [ 'plugin' => $ plugin ] ) ; } $ config [ 'classPath' ] = $ config [ 'path' ] . $ config [ 'classBase' ] . DIRECTORY_SEPARATOR ; if ( ! isset ( $ config [ 'configPath' ] ) ) { $ config [ 'configPath' ] = $ config [ 'path' ] . 'config' . DIRECTORY_SEPARATOR ; } static :: $ plugins [ $ plugin ] = $ config ; if ( $ config [ 'bootstrap' ] === true ) { static :: bootstrap ( $ plugin ) ; } }
Loads a plugin and optionally loads bootstrap files.

### Examples:

`Plugin::load('Basic')`

Will load the Basic plugin and will not load the bootstrap file.

`Plugin::load('Basic', ['bootstrap' => true])`

Will load the bootstrap.php file.

It is also possible to load multiple plugins at once. Examples:

`Plugin::load(['Basic', 'Developer'])`

Will load the Basic and Developer plugins.

`Plugin::load(['Basic', 'Developer'], ['bootstrap' => true])`

Will load bootstrap file for both plugins


### Configuration options

- `bootstrap` - array - Whether or not you want the $plugin/config/bootstrap.php file loaded.
- `ignoreMissing` - boolean - Set to true to ignore missing bootstrap files.
- `path` - string - The path the plugin can be found on. If empty the default plugin path will be used.
- `classBase` - string - The path relative to `path` which contains the folders with class files.
Defaults to "src".

@param string|array $plugin Name of the plugin to be loaded in CamelCase format or array or plugins to load.
@param array $config Configuration options for the plugin.

@throws \Skinny\Core\Exception\MissingPluginException If the folder for the plugin to be loaded is not found.

@return void
Loads a plugin and optionally loads bootstrap files .