[wp-trac] [WordPress Trac] #37677: Introduce WP_Plugin class analogous to WP_Theme

WordPress Trac noreply at wordpress.org
Wed Aug 17 17:09:23 UTC 2016


#37677: Introduce WP_Plugin class analogous to WP_Theme
-------------------------+------------------------------
 Reporter:  swissspidy   |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  Awaiting Review
Component:  Plugins      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:               |     Focuses:
-------------------------+------------------------------

Comment (by jdgrimes):

 Proposal from [https://core.trac.wordpress.org/ticket/37656#comment:4 a
 comment I left on #37656]:

 >As far as making `WP_Plugin` hold the plugin header data as `WP_Theme`
 does for themes, I have a proposal to make in regard to that. What if
 instead of having to read the file to parse the plugin headers, the header
 data was passed directly to a function?
 >
 >{{{#!php
 ><?php
 >
 >WP_Plugins::register(
 >   '
 >   Plugin Name: Foo
 >   ...
 >   '
 >);
 >
 >}}}
 >
 >The cool thing is that this will still work with the file parsing, since
 `get_file_data()` doesn't specifically look for this information only
 within PHP comments. But it also allows us to get the raw headers without
 having to read the files at all. So when the plugin is active, we can
 parse this string passed directly to our function to get the plugin data,
 and we can still read it with `get_file_data()` when the plugin is
 inactive.

 In other words, the main file of the plugin would call this function, in
 lieu of placing these headers in the opening docblock.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/37677#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list