[wp-trac] [WordPress Trac] #15536: Introduce register_plugin

WordPress Trac wp-trac at lists.automattic.com
Mon Nov 22 10:15:17 UTC 2010


#15536: Introduce register_plugin
-------------------------+--------------------------------------------------
 Reporter:  filosofo     |       Owner:  filosofo        
     Type:  enhancement  |      Status:  new             
 Priority:  normal       |   Milestone:  Future Release  
Component:  Plugins      |     Version:                  
 Severity:  normal       |    Keywords:  has-patch, close
-------------------------+--------------------------------------------------

Comment(by filosofo):

 What about avoiding code duplication?  It's a real problem solved by this
 proposal. And education is simplified with a simpler API.

 Besides, there are plenty of examples in WP where syntactic sugar enhances
 existing APIs: `register_activation/deactivation_hook` on top of action
 hooks; the admin settings API, many taxonomy functions, much of the
 post_type API, are some examples that come to mind where developers
 ''could'' do something another way, but the API was extended to make it
 simpler and easier.

 Not to mention, there are lots of other potential arguments that could be
 added to the `$args` array, such as activation and deactivation callbacks,
 PHP or WP version checks, etc.  For example, a little more code and you
 could do something like:

 {{{
 register_plugin( 'My_Great_Plugin', array(
    'domain' => 'my-plugin-domain',
    'activation_callback' => array( 'My_Great_Plugin', 'do_on_activation'
 ),
    'deactivation_callback' => array( 'My_Great_Plugin',
 'do_on_deactivation' ),
    'php_min' => '5.2',
    'wp_min' => '3.2',
 ) );
 }}}

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


More information about the wp-trac mailing list