Switch language

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




get_dropins [ WordPress Function ]

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



Check the wp-content directory and retrieve all drop-ins with any plugin data.

Source


<?php
function get_dropins() {
    
$dropins = array();
    
$plugin_files = array();

    
$_dropins _get_dropins();

    
// These exist in the wp-content directory
    
if ( $plugins_dir = @ opendirWP_CONTENT_DIR ) ) {
        while ( ( 
$file readdir$plugins_dir ) ) !== false ) {
            if ( isset( 
$_dropins$file ] ) )
                
$plugin_files[] = $file;
        }
    } else {
        return 
$dropins;
    }

    @
closedir$plugins_dir );

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

    foreach ( 
$plugin_files as $plugin_file ) {
        if ( !
is_readableWP_CONTENT_DIR "/$plugin_file) )
            continue;
        
$plugin_data get_plugin_dataWP_CONTENT_DIR "/$plugin_file"falsefalse ); //Do not apply markup/translate as it'll be cached.
        
if ( empty( $plugin_data['Name'] ) )
            
$plugin_data['Name'] = $plugin_file;
        
$dropins$plugin_file ] = $plugin_data;
    }

    
uksort$dropins'strnatcasecmp' );

    return 
$dropins;
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

Gebruikersdiscussies [ wordpress.org ]

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



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