get_dropins

Definition:
function get_dropins() {}

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

Return values

returns:Key is the file path and the value is an array of the plugin data.

Source code

function get_dropins() {

	$dropins = array();

	$plugin_files = array();



	$_dropins = _get_dropins();



	// These exist in the wp-content directory

	if ( $plugins_dir = @ opendir( WP_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_readable( WP_CONTENT_DIR . "/$plugin_file" ) )

			continue;

		$plugin_data = get_plugin_data( WP_CONTENT_DIR . "/$plugin_file", false, false ); //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;

}

1368

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: