[wp-trac] [WordPress Trac] #10814: Plugin GUIDs

WordPress Trac wp-trac at lists.automattic.com
Sat Sep 19 04:57:04 UTC 2009


#10814: Plugin GUIDs
-------------------------+--------------------------------------------------
 Reporter:  mdawaffe     |       Owner:  westi                 
     Type:  enhancement  |      Status:  new                   
 Priority:  normal       |   Milestone:  2.9                   
Component:  Plugins      |     Version:  2.8.4                 
 Severity:  normal       |    Keywords:  has-patch dev-feedback
-------------------------+--------------------------------------------------

Comment(by dd32):

 Sounds good to me, However, You've got an error in the logic:

 {{{
 foreach ( $data_keys as $field => $preg ) {
                 preg_match( "|$preg:(.*)\$|mi", $plugin_head, $match );
                 if ( empty( $field ) )
                     $plugin_data[$field] = '';
                 else
                     $plugin_data[$field] = _cleanup_header_comment(
 $match[1] );
 }}}

 empty($field) probably isnt what you were after... probably empty($match)

 But it could also be written as:

 {{{
                 if ( !preg_match( "|$preg:(.*)\$|mi", $plugin_head, $match
 ) )
                     $plugin_data[$field] = '';
                 else
                     $plugin_data[$field] = _cleanup_header_comment(
 $match[1] );
 }}}

 Also, This overlaps with the ticket to add a filter to the list of plugin
 headers returned, All that would be extra is a preg_quote on $preg and a
 filter.. - #8964: enhancement: Allow adding headers to get_plugin_data
 (accepted) - However, looking at that patch.......lot of extra code there
 :)

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/10814#comment:1>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list