[wp-trac] Re: [WordPress Trac] #2433: Provide some API for WP_Rewrite

WordPress Trac wp-trac at lists.automattic.com
Wed Feb 15 23:50:07 GMT 2006


#2433: Provide some API for WP_Rewrite
----------------------------+-----------------------------------------------
       Id:  2433            |      Status:  new                     
Component:  Administration  |    Modified:  Wed Feb 15 23:50:07 2006
 Severity:  normal          |   Milestone:  2.1                     
 Priority:  normal          |     Version:  2.0.1                   
    Owner:  anonymous       |    Reporter:  davidhouse              
----------------------------+-----------------------------------------------
Comment (by majelbstoat):

 I've just realised that Trac stripped the pipe operator from between those
 flags in my first comment (but I think you guessed that).

 There would have to be some sort of decoding mechanism, but that wouldn't
 be to hard to implement.

 define (DAY_LINK, 1);
 define (MONTH_LINK, 2);
 define (YEAR_LINK, 4);

 function add_endpoint($function_name, $flags)
 {
   if ($flags & DAY_LINK) add_filter('day_link', $function_name);
 }

 or something more extensible:

 $links = array (DAY_LINK => 'day_link', YEAR_LINK => 'year_link');

 then

 function add_endpoint($function_name, $flags)
 {
   global $links

   foreach ($links as $flag => $filter) if ($flags & $flag)
 add_filter($filter, $function_name);
 }

-- 
Ticket URL: <http://trac.wordpress.org/ticket/2433>
WordPress Trac <http://wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list