Description
Returns an associative version of the active plugins array- $active_plugins is an array that looks like column 1 in the table below.
- bw_plug() is able to handle it so we can do the same here
- EXCEPT bw_plug works at the "top level" not the child plugins
- We convert this array into an associative array keyed on the sub-plugin name
| $active_plugins | $names (keys only - |
|---|---|
| [0] => abt-featured-heroes/abt-featured-heroes.php | [‘abt-featured-heroes’] |
| [1] => effort/tasks.php | [‘tasks’] |
| [2] => fancybox-for-wordpress/fancybox.php | [‘fancybox’] |
| [3] => oik/oik-bob-bing-wide.php | [‘oik-bob-bing-wide’] |
| [4] => oik/oik-bwtrace.php | [‘oik-bwtrace’] |
| etcetera | … |
oik and oik v3.1 Usage
$array = bw_get_all_plugin_names( $active_plugins );Parameters
- $active_plugins
- ( mixed ) required –
Returns
array associative array of active plugins – may be empty, but very unlikelySource
File name: oik/libs/oik-depends.phpLines:
1 to 21 of 21
function bw_get_all_plugin_names( $active_plugins ) { $names = array(); if ( is_array( $active_plugins ) ) { if ( count( $active_plugins ) ) { foreach ( $active_plugins as $key => $value ) { $name = basename( $value, '.php' ); $dir = dirname( $value ); if ( ( $name == $dir ) && !isset( $names[ $name ] ) ) { $names[$name] = $value; } } foreach ( $active_plugins as $key => $value ) { $name = basename( $value, '.php' ); if ( !isset( $names[ $name ] ) ) { $names[ $name ] = $value; } } } } return( $names ); }View on GitHub View on Trac
Called by
1 to 2 of 2
