Ticket #10814: 10814b.diff
| File 10814b.diff, 2.6 KB (added by , 17 years ago) |
|---|
-
wp-admin/includes/plugin.php
43 43 * 'PluginURI' - Plugin web site address. 44 44 * 'TextDomain' - Plugin's text domain for localization. 45 45 * 'DomainPath' - Plugin's relative directory path to .mo files. 46 * 'GUID' - Plugin's globally unique identifier 46 47 * 47 48 * Some users have issues with opening large files and manipulating the contents 48 49 * for want is usually the first 1kiB or 2kiB. This function stops pulling in … … 70 71 $fp = fopen($plugin_file, 'r'); 71 72 72 73 // Pull only the first 8kiB of the file in. 73 $plugin_ data= fread( $fp, 8192 );74 $plugin_head = fread( $fp, 8192 ); 74 75 75 76 // PHP will close file handle, but we are good citizens. 76 77 fclose($fp); 77 78 78 preg_match( '|Plugin Name:(.*)$|mi', $plugin_data, $name ); 79 preg_match( '|Plugin URI:(.*)$|mi', $plugin_data, $uri ); 80 preg_match( '|Version:(.*)|i', $plugin_data, $version ); 81 preg_match( '|Description:(.*)$|mi', $plugin_data, $description ); 82 preg_match( '|Author:(.*)$|mi', $plugin_data, $author_name ); 83 preg_match( '|Author URI:(.*)$|mi', $plugin_data, $author_uri ); 84 preg_match( '|Text Domain:(.*)$|mi', $plugin_data, $text_domain ); 85 preg_match( '|Domain Path:(.*)$|mi', $plugin_data, $domain_path ); 79 $data_keys = array( 80 'Name' => 'Plugin Name', // |Plugin Name:(.*)$|mi 81 'PluginURI' => 'Plugin URI', 82 'Description' => 'Description', 83 'Author' => 'Author', 84 'AuthorURI' => 'Author URI', 85 'Version' => 'Version', 86 'TextDomain' => 'Text Domain', 87 'DomainPath' => 'DomainPath', 88 'GUID' => 'GUID', 89 ); 86 90 87 foreach ( array( 'name', 'uri', 'version', 'description', 'author_name', 'author_uri', 'text_domain', 'domain_path' ) as $field ) { 88 if ( !empty( ${$field} ) ) 89 ${$field} = _cleanup_header_comment(${$field}[1]); 91 $plugin_data = array(); 92 foreach ( $data_keys as $field => $preg ) { 93 if ( !preg_match( "|$preg:(.*)\$|mi", $plugin_head, $match ) ) 94 $plugin_data[$field] = ''; 90 95 else 91 $ {$field} = '';96 $plugin_data[$field] = _cleanup_header_comment( $match[1] ); 92 97 } 93 98 94 $plugin_data = array( 95 'Name' => $name, 'Title' => $name, 'PluginURI' => $uri, 'Description' => $description, 96 'Author' => $author_name, 'AuthorURI' => $author_uri, 'Version' => $version, 97 'TextDomain' => $text_domain, 'DomainPath' => $domain_path 98 ); 99 $plugin_data['Title'] = $plugin_data['Name']; 100 99 101 if ( $markup || $translate ) 100 102 $plugin_data = _get_plugin_data_markup_translate($plugin_file, $plugin_data, $markup, $translate); 101 103