[wp-trac] Re: [WordPress Trac] #3875: Proposal for a new plugin architecture

WordPress Trac wp-trac at lists.automattic.com
Tue Jul 31 17:24:00 GMT 2007


#3875: Proposal for a new plugin architecture
----------------------------------------------------------------------------------+
 Reporter:  FraT                                                                  |        Owner:  ryan    
     Type:  defect                                                                |       Status:  reopened
 Priority:  normal                                                                |    Milestone:  2.2.2   
Component:  Optimization                                                          |      Version:  2.1.1   
 Severity:  normal                                                                |   Resolution:          
 Keywords:  2nd-opinion plugin plugins plugin.php filters $wp_filter wp-includes  |  
----------------------------------------------------------------------------------+
Comment (by fedallah):

 When I replied to the Trac email on this post earlier in the month, I
 figured the list would thread my response to Trac, too. Oops. So here's a
 link to the wp-hackers email about this bug for reference:

 http://comox.textdrive.com/pipermail/wp-hackers/2007-July/013734.html

 Anyway, re: santosj, the get_class() approach fails whenever an object is
 instantiated more than once, and each instance is attempted to be
 registered with the same method. I wrote about this in my message to the
 list earlier this month.

 Example code:

 {{{
 class Foobar {
         var $name;

         function Foobar( $name ){
                 $this->name = $name;
         }

         function hook( $v ) {
                 return $this->name . " Hooked! $v";
         }
 }

 $foo1 = new Foobar("baz");
 $foo2 = new Foobar("quux");

 create_filter( 'the_content', array( &$foo1, "hook" ) );
 create_filter( 'the_content', array( &$foo2, "hook" ) );
 }}}

 $foo1 and $foo2 will have the same class name, and therefore, will be the
 same index in the filter array. So sadly, this solution doesn't work. See
 my post for one which I think has a better shot.

 Also, serialize is big and expensive. I think we should avoid calling it.

-- 
Ticket URL: <http://trac.wordpress.org/ticket/3875#comment:12>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list