Ticket #12130: 12130.3.diff
File 12130.3.diff, 3.9 KB (added by , 15 years ago) |
---|
-
wp-includes/functions.php
3998 3998 * @param string $file Path to the file 3999 3999 * @param bool $markup If the returned data should have HTML markup applied 4000 4000 * @param string $context If specified adds filter hook "extra_<$context>_headers" 4001 * @param int $max_bytes Maximum bytes to read in file. Defaults to 8192 = 8kB 4001 4002 */ 4002 function get_file_data( $file, $default_headers, $context = '' ) { 4003 function get_file_data( $file, $default_headers, $context = '', $max_bytes = 8192 ) { 4004 $max_bytes = apply_filters('get_max_' . $context . '_file_bytes', $max_bytes); 4005 4003 4006 // We don't need to write to the file, so just open for reading. 4004 4007 $fp = fopen( $file, 'r' ); 4005 4008 4006 // Pull only the first 8kiB of the file in.4007 $file_data = fread( $fp, 8192);4009 // Pull only the beginning start of the file. 4010 $file_data = fread( $fp, $max_bytes ); 4008 4011 4009 4012 // PHP will close file handle, but we are good citizens. 4010 4013 fclose( $fp ); -
wp-admin/includes/plugin.php
42 42 * from the author. 43 43 * 'Author' - The author's name 44 44 * 'AuthorURI' - The authors web site address. 45 * 'DonateURI' - Web address to donate to the plugin author. 45 46 * 'Version' - The plugin version number. 46 47 * 'PluginURI' - Plugin web site address. 47 48 * 'TextDomain' - Plugin's text domain for localization. … … 78 79 'Description' => 'Description', 79 80 'Author' => 'Author', 80 81 'AuthorURI' => 'Author URI', 82 'DonateURI' => 'Donate URI', 81 83 'TextDomain' => 'Text Domain', 82 84 'DomainPath' => 'Domain Path', 83 85 'Network' => 'Network', … … 98 100 //For backward compatibility by default Title is the same as Name. 99 101 $plugin_data['Title'] = $plugin_data['Name']; 100 102 103 if ( empty($plugin_data['DonateURI']) ) { 104 // Read info in from readme.txt 105 $readme_headers = array( 106 'DonateURI' => 'Donate URI', 107 ); 108 109 $readme_file = plugin_dir_path( $plugin_file ) . 'readme.txt'; 110 if ( file_exists( $readme_file ) ) { 111 $readme_data = get_file_data( $readme_file, $readme_headers, 'readme', 1024 ); 112 $plugin_data = array_merge( $readme_data, $plugin_data); 113 } 114 } 115 101 116 if ( $markup || $translate ) 102 117 $plugin_data = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, $markup, $translate ); 103 118 … … 113 128 else 114 129 load_plugin_textdomain($plugin_data['TextDomain'], false, dirname($plugin_file)); 115 130 116 foreach ( array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version' ) as $field )131 foreach ( array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version', 'DonateURI') as $field ) 117 132 $plugin_data[ $field ] = translate($plugin_data[ $field ], $plugin_data['TextDomain']); 118 133 } 119 134 135 // Sanitize urls 136 foreach ( array('PluginURI', 'AuthorURI', 'DonateURI') as $field ) { 137 if ( !empty($plugin_data[$field]) ) 138 $plugin_data[$field] = esc_url($plugin_data[$field]); 139 } 140 141 120 142 //Apply Markup 121 143 if ( $markup ) { 122 144 if ( ! empty($plugin_data['PluginURI']) && ! empty($plugin_data['Name']) ) -
wp-admin/plugins.php
620 620 } 621 621 if ( ! empty($plugin_data['PluginURI']) ) 622 622 $plugin_meta[] = '<a href="' . $plugin_data['PluginURI'] . '" title="' . __( 'Visit plugin site' ) . '">' . __('Visit plugin site') . '</a>'; 623 623 if ( ! empty($plugin_data['DonateURI']) ) 624 $plugin_meta[] = '<a href="' . $plugin_data['DonateURI'] . '" title="' . __( 'Donate' ) . '">' . __('Donate') . '</a>'; 625 624 626 $plugin_meta = apply_filters('plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $context); 625 627 echo implode(' | ', $plugin_meta); 626 628 echo "</td>