[wp-trac] [WordPress Trac] #8964: Allow adding headers to get_plugin_data

WordPress Trac wp-trac at lists.automattic.com
Thu Sep 10 05:54:10 UTC 2009


#8964: Allow adding headers to get_plugin_data
-------------------------+--------------------------------------------------
 Reporter:  strider72    |       Owner:  westi                        
     Type:  enhancement  |      Status:  accepted                     
 Priority:  normal       |   Milestone:  2.9                          
Component:  Plugins      |     Version:                               
 Severity:  normal       |    Keywords:  has-patch tested commit early
-------------------------+--------------------------------------------------

Comment(by strider72):

 New patch.  I've abstracted the header-fetching to a separate function
 which is used by both plugins and themes.  So, yes, this patch adds both
 an extra_plugin_headers hook and an extra_theme_headers hook.

 Basically, you can make a wrapper function that:

 1) defines an array of the headers to be searched for
 2) passes it to get_file_data() along with the file
 3) optionally, passes a $context string that automatically instantiates an
 extra_$context_headers hook.

 This also allows plugins to use this function to search for similarly
 styled headers in different types of files.  Makes it easy for a plugin to
 fetch data relating to custom config files or such that apply to itself.
 :)

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


More information about the wp-trac mailing list