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 ); |
| 78 | $search_params = array( |
| 79 | 'Name'=>'Plugin Name', |
| 80 | 'PluginURI'=>'Plugin URI', |
| 81 | 'Version'=>'Version', |
| 82 | 'Description'=>'Description', |
| 83 | 'Author'=>'Author', |
| 84 | 'AuthorURI'=>'Author URI', |
| 85 | 'TextDomain'=>'Text Domain', |
| 86 | 'DomainPath'=>'Domain Path' |
| 87 | ); |
87 | | foreach ( array( 'name', 'uri', 'version', 'description', 'author_name', 'author_uri', 'text_domain', 'domain_path' ) as $field ) { |
88 | | if ( !empty( ${$field} ) ) |
89 | | ${$field} = trim(${$field}[1]); |
| 89 | // Filter can add headers, but not change existing ones. |
| 90 | $custom_params = apply_filters( 'plugin_data_headers', (array) $custom_params, $plugin_file ); |
| 91 | // Use keys to reduce conflicts and make conflicts easier to find. |
| 92 | foreach ( $custom_params as $key=>$value ) { $custom_params[$key] = $key; } |
| 93 | |
| 94 | $search_params = array_merge( $custom_params, $search_params ); |
| 95 | |
| 96 | $plugin_data = array(); |
| 97 | foreach ( $search_params as $key=>$header ) { |
| 98 | preg_match( '|' . $header . ':(.*)$|mi', $plugin_header, $field ); |
| 99 | |
| 100 | if ( ! empty( $field ) ) |
| 101 | $field = trim($field[1]); |