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

WordPress Trac wp-trac at lists.automattic.com
Tue Jul 31 17:06:46 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 santosj):

 Well, I suppose the multiple if statements are not needed. If speed is
 what you are looking for then it should be slightly faster than with both
 of them. I suppose, since it would fail with the first statement and not
 evaluate the second once it sees that the two are AND.

 Replying to [comment:10 santosj]:

 {{{
 function add_filter($tag, $function_to_add, $priority = 10, $accepted_args
 = 1) {
     global $wp_filter;

     $serialized = &$function_to_add;
     if(is_array($function_to_add) && is_object($function_to_add[0]))
     {
         $serialized = array(get_class($function_to_add[0]),
 $function_to_add[1]);
     }

     $wp_filter[$tag][$priority][serialize($serialized)] = array('function'
 => $function_to_add, 'accepted_args' => $accepted_args);
     return true;
 }
 }}}

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


More information about the wp-trac mailing list