Ticket #3089: 3089.diff
File 3089.diff, 5.3 KB (added by , 17 years ago) |
---|
-
wp-admin/includes/plugin.php
112 112 */ 113 113 function get_plugin_data( $plugin_file ) { 114 114 $plugin_data = plugin_get_contents( $plugin_file ); 115 preg_match( '|Plugin Name:(.*)$|mi', $plugin_data, $plugin_name ); 116 preg_match( '|Plugin URI:(.*)$|mi', $plugin_data, $plugin_uri ); 115 preg_match( '|Plugin Name:(.*)$|mi', $plugin_data, $name ); 116 preg_match( '|Plugin URI:(.*)$|mi', $plugin_data, $uri ); 117 preg_match( '|Version:(.*)|i', $plugin_data, $version ); 117 118 preg_match( '|Description:(.*)$|mi', $plugin_data, $description ); 118 119 preg_match( '|Author:(.*)$|mi', $plugin_data, $author_name ); 119 120 preg_match( '|Author URI:(.*)$|mi', $plugin_data, $author_uri ); 121 preg_match( '|Text Domain:(.*)$|mi', $plugin_data, $text_domain ); 122 preg_match( '|Domain Path:(.*)$|mi', $plugin_data, $domain_path ); 120 123 121 if ( preg_match( "|Version:(.*)|i", $plugin_data, $version )) 122 $version = trim( $version[1] ); 123 else 124 $version = ''; 125 126 if( preg_match( '|Text Domain:(.*)$|mi', $plugin_data, $text_domain ) ) { 127 if( preg_match( '|Domain Path:(.*)$|mi', $plugin_data, $domain_path ) ) 128 $domain_path = trim( $domain_path[1] ); 129 130 $text_domain = trim( $text_domain[1] ); 131 132 if( !empty( $text_domain ) ) { 133 if( !empty( $domain_path ) ) 134 load_plugin_textdomain($text_domain, dirname($plugin_file). $domain_path); 135 else 136 load_plugin_textdomain($text_domain, dirname($plugin_file)); 137 } 138 139 $description[1] = translate(trim($description[1]), $text_domain); 140 $plugin_name[1] = translate(trim($plugin_name[1]), $text_domain); 141 $plugin_uri[1] = translate(trim($plugin_uri[1]), $text_domain); 142 $author_name[1] = translate(trim($author_name[1]), $text_domain); 143 $author_uri[1] = translate(trim($author_uri[1]), $text_domain); 124 foreach ( array( 'name', 'uri', 'version', 'description', 'author_name', 'author_uri', 'text_domain', 'domain_path' ) as $field ) { 125 if ( !empty( ${$field} ) ) 126 ${$field} = trim(${$field}[1]); 127 else 128 ${$field} = ''; 144 129 } 145 130 146 $description = wptexturize( trim( $description[1] )); 147 148 $name = $plugin_name[1]; 149 $name = trim( $name ); 150 $plugin = $name; 151 if ('' != trim($plugin_uri[1]) && '' != $name ) { 152 $plugin = '<a href="' . trim( $plugin_uri[1] ) . '" title="'.__( 'Visit plugin homepage' ).'">'.$plugin.'</a>'; 153 } 154 155 if ('' == $author_uri[1] ) { 156 $author = trim( $author_name[1] ); 157 } else { 158 $author = '<a href="' . trim( $author_uri[1] ) . '" title="'.__( 'Visit author homepage' ).'">' . trim( $author_name[1] ) . '</a>'; 159 } 160 161 return array('Name' => $name, 'Title' => $plugin, 'Description' => $description, 'Author' => $author, 'Version' => $version); 131 return array( 132 'Name' => $name, 'PluginURI' => $uri, 'Description' => $description, 133 'Author' => $author_name, 'AuthorURI' => $author_uri, 'Version' => $version, 134 'TextDomain' => $text_domain, 'DomainPath' => $domain_path 135 ); 162 136 } 163 137 164 138 function get_plugins($plugin_folder = '') { -
wp-admin/plugins.php
216 217 217 218 foreach( (array)$all_plugins as $plugin_file => $plugin_data) { 218 219 220 //Translate fields 221 if( !empty($plugin_data['TextDomain']) ) { 222 if( !empty( $plugin_data['DomainPath'] ) ) 223 load_plugin_textdomain($plugin_data['TextDomain'], dirname($plugin_file). $plugin_data['DomainPath']); 224 else 225 load_plugin_textdomain($plugin_data['TextDomain'], dirname($plugin_file)); 226 227 foreach ( array('Name', 'PluginURI', 'Description', 'Author', 'AuthorURI', 'Version') as $field ) 228 $plugin_data[ $field ] = translate($plugin_data[ $field ], $plugin_data['TextDomain']); 229 } 230 231 //Apply Markup 232 $plugin_data['Title'] = $plugin_data['Name']; 233 if ( !empty($plugin_data['PluginURI']) && !empty($plugin_data['Name']) ) 234 $plugin_data['Title'] = '<a href="' . $plugin_data['PluginURI'] . '" title="'.__( 'Visit plugin homepage' ).'">' . $plugin_data['Name'] . '</a>'; 235 236 if ( ! empty($plugin_data['AuthorURI']) ) 237 $plugin_data['Author'] = '<a href="' . $plugin_data['AuthorURI'] . '" title="'.__( 'Visit author homepage' ).'">' . $plugin_data['Author'] . '</a>'; 238 239 $plugin_data['Description'] = wptexturize( $plugin_data['Description'] ); 240 219 241 // Sanitize all displayed data 220 242 $plugin_data['Title'] = wp_kses($plugin_data['Title'], $plugins_allowedtags); 221 243 $plugin_data['Version'] = wp_kses($plugin_data['Version'], $plugins_allowedtags); … … 263 285 264 286 if( 'active' == $context ) 265 287 $action_links[] = '<a href="' . wp_nonce_url('plugins.php?action=deactivate&plugin=' . $plugin_file, 'deactivate-plugin_' . $plugin_file) . '" title="' . __('Deactivate this plugin') . '" class="delete">' . __('Deactivate') . '</a>'; 266 else // Available or Recently deactivated288 else //Inactive or Recently deactivated 267 289 $action_links[] = '<a href="' . wp_nonce_url('plugins.php?action=activate&plugin=' . $plugin_file, 'activate-plugin_' . $plugin_file) . '" title="' . __('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>'; 268 290 269 291 if ( current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) )