Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




get_mu_plugins [ WordPress Function ]

get_mu_plugins ( No parameters )
Returns:
  • (array) Key is the mu-plugin file path and the value is an array of the mu-plugin data.
Defined at:



Check the mu-plugins directory and retrieve all mu-plugin files with any plugin data.

WordPress only includes mu-plugin files in the base mu-plugins directory (wp-content/mu-plugins).

Source


<?php
function get_mu_plugins() {
    
$wp_plugins = array();
    
// Files in wp-content/mu-plugins directory
    
$plugin_files = array();

    if ( ! 
is_dirWPMU_PLUGIN_DIR ) )
        return 
$wp_plugins;
    if ( 
$plugins_dir = @ opendirWPMU_PLUGIN_DIR ) ) {
        while ( ( 
$file readdir$plugins_dir ) ) !== false ) {
            if ( 
substr$file, -) == '.php' )
                
$plugin_files[] = $file;
        }
    } else {
        return 
$wp_plugins;
    }

    @
closedir$plugins_dir );

    if ( empty(
$plugin_files) )
        return 
$wp_plugins;

    foreach ( 
$plugin_files as $plugin_file ) {
        if ( !
is_readableWPMU_PLUGIN_DIR "/$plugin_file) )
            continue;

        
$plugin_data get_plugin_dataWPMU_PLUGIN_DIR "/$plugin_file"falsefalse ); //Do not apply markup/translate as it'll be cached.

        
if ( empty ( $plugin_data['Name'] ) )
            
$plugin_data['Name'] = $plugin_file;

        
$wp_plugins$plugin_file ] = $plugin_data;
    }

    if ( isset( 
$wp_plugins['index.php'] ) && filesizeWPMU_PLUGIN_DIR '/index.php') <= 30 // silence is golden
        
unset( $wp_plugins['index.php'] );

    
uasort$wp_plugins'_sort_uname_callback' );

    return 
$wp_plugins;
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics