Ticket #3089: 3089.patch1.diff
| File 3089.patch1.diff, 1.6 kB (added by darkdragon, 5 months ago) |
|---|
-
plugin.php
old new 1 1 <?php 2 2 3 function get_plugin_data_has_locale_header($content) 4 { 5 if ( preg_match('/[\{\[]{1}([a-z]{2}_[A-Z]{2})[\}\]]{1}/m', $content, $matches) ) { 6 var_dump($matches); 7 } 8 } 9 3 10 function get_plugin_data( $plugin_file ) { 4 11 $plugin_data = implode( '', file( $plugin_file )); 12 13 get_plugin_data_has_locale_header($plugin_data); 5 14 preg_match( '|Plugin Name:(.*)$|mi', $plugin_data, $plugin_name ); 6 15 preg_match( '|Plugin URI:(.*)$|mi', $plugin_data, $plugin_uri ); 7 16 preg_match( '|Description:(.*)$|mi', $plugin_data, $description ); … … 13 22 else 14 23 $version = ''; 15 24 25 if( preg_match( '|Text Domain:(.*)$|mi', $plugin_data, $text_domain ) ) { 26 if( preg_match( '|Domain Path:(.*)$|mi', $plugin_data, $domain_path ) ) 27 $domain_path = trim( $domain_path[1] ); 28 29 $text_domain = trim( $text_domain[1] ); 30 31 if( !empty( $text_domain ) ) { 32 if( !empty( $domain_path ) ) 33 load_plugin_textdomain($text_domain, dirname($plugin_file). $domain_path); 34 else 35 load_plugin_textdomain($text_domain); 36 } 37 } 38 39 if( isset($text_domain) ) { 40 $description[1] = __($description[1], $text_domain); 41 $plugin_name[1] = __($plugin_name[1], $text_domain); 42 $plugin_uri[1] = __($plugin_uri[1], $text_domain); 43 $author_name[1] = __($author_name[1], $text_domain); 44 $author_uri[1] = __($author_uri[1], $text_domain); 45 } 46 16 47 $description = wptexturize( trim( $description[1] )); 17 48 18 49 $name = $plugin_name[1];
