Index: plugin.php
===================================================================
--- plugin.php	(revision 6603)
+++ plugin.php	(working copy)
@@ -1,7 +1,92 @@
 <?php
+/**
+ * WordPress Plugin Administration API
+ *
+ * @package WordPress
+ * @subpackage Administration
+ */
 
+/**
+ * plugin_get_contents() - Retrieve just the plugin data in the plugin file.
+ *
+ * Some users have issues with pulling the contents of the entire file, so
+ * instead of pulling the entire contents, we just pull in the amount we need.
+ *
+ * @link http://trac.wordpress.org/ticket/5651 Ticket for this functions being.
+ *
+ * @since 2.5.0
+ * @uses plugin_has_required_fields() Checks for all required plugin data fields.
+ *
+ * @param string $plugin_file Path to plugin file
+ * @return string File contents retrieved 
+ */
+function plugin_get_contents($plugin_file) {
+	// We don't need to write to the file, so just open it for reading
+	// only. Hopefully, the file isn't binary.
+	$fp = fopen($plugin_file, 'r');
+
+	// Store the contents of the plugin file here
+	$contents = '';
+
+	// Keep reading the contents of the file until End of File
+	// is reached or we grabbed all we need.
+	while( !feof($fp) && !plugin_has_required_fields($contents) ) 
+		$contents .= fread( $fp, 1024 );
+
+	// Make sure we pick up any padding for long descriptions and
+	// version info.
+	if( !feof($fp) )
+		$contents .= fread( $fp, 512 );
+
+	// PHP will close file handle, but we are good citizens
+	fclose($fp);
+	return $contents;
+}
+
+/**
+ * plugin_has_required_fields() - Checks the contents of the string for required Plugin Data
+ *
+ * @since 2.5.0
+ * @usedby plugin_get_contents()
+ *
+ * @param string $plugin_contents Contents of the plugin file to check
+ * @return bool Whether all required Plugin Data items are in contents
+ */
+function plugin_has_required_fields($plugin_contents) {
+	$hasName = stripos($plugin_contents, 'Plugin Name:');
+	$hasPluginURI = stripos($plugin_contents, 'Plugin URI:');
+	$hasDescription = stripos($plugin_contents, '');
+	$hasAuthor = stripos($plugin_contents, '');
+	$hasAuthorURI = stripos($plugin_contents, '');
+	
+	if( false !== $hasName && false !== $hasPluginURI &&
+		false !== $hasDescription && false !== $hasAuthor &&
+		false !== $hasAuthorURI)
+		return true;
+
+	return false;
+}
+
+/**
+ * get_plugin_data() - Parse the plugin contents to retrieve the plugin's data
+ *
+ * While this function has only existed since WordPress 2.5, the functionality
+ * has existed in WordPress for longer.
+ *
+ * Plugin data contains the following:
+ *		'Name' - Name of the plugin, should be unique.
+ *		'Title' - Title of the plugin and the link to the plugin's web site.
+ *		'Description' - Description of what the plugin does and/or notes from the author.
+ *		'Author' - The author's web site and name.
+ *		'Version' - The version of the plugin in the file.
+ *
+ * @since 1.5.0
+ *
+ * @param string $plugin_file Full Plugin Path
+ * @return array Plugin's data
+ */
 function get_plugin_data( $plugin_file ) {
-	$plugin_data = implode( '', file( $plugin_file ));
+	$plugin_data = plugin_get_contents($plugin_file);
 	preg_match( '|Plugin Name:(.*)$|mi', $plugin_data, $plugin_name );
 	preg_match( '|Plugin URI:(.*)$|mi', $plugin_data, $plugin_uri );
 	preg_match( '|Description:(.*)$|mi', $plugin_data, $description );
