[wp-trac] [WordPress Trac] #16692: Add hook to allow plugins to implement custom $wp->parse_request() logic to support arbitrary custom URLs

WordPress Trac wp-trac at lists.automattic.com
Mon Feb 28 18:45:09 UTC 2011


#16692: Add hook to allow plugins to implement custom $wp->parse_request() logic to
support arbitrary custom URLs
------------------------------------+------------------------------
 Reporter:  mikeschinkel            |       Owner:
     Type:  enhancement             |      Status:  reviewing
 Priority:  normal                  |   Milestone:  Awaiting Review
Component:  Rewrite Rules           |     Version:  3.1
 Severity:  normal                  |  Resolution:
 Keywords:  has-patch dev-feedback  |
------------------------------------+------------------------------

Comment (by mikeschinkel):

 Replying to [comment:8 scribu]:
 > Yeah, I think your approach allows the most flexibility,

 Well, it's cumbersome.  I could be made less cumbersome by making it a
 filter like so:

 {{{
 // This would go in /wp-includes/class-wp.php
 if ( !apply_filters( 'wp_parse_request', false, $this, $query_args ) )
    $this->parse_request( $query_args );
 }}}

 If we used the above then we would not need to add the action in `/wp-
 settings.php`. I'm liking this approach more as I write about it. You?



 > even though it's a blasphemy in the OOP paradigm. :)

 heh. :)  It's basically a really loose form of multiple inheritance.

 But I think  that anyone who really sees it as OOP blasphemy ''(not you,
 of course :)'' hasn't learned much since OOP became semi-mainstream in the
 mid 90s. For example they probably haven't read and/or groked the seminal
 work [http://en.wikipedia.org/wiki/Design_pattern_(computer_science)
 Design Patterns].  This approach has aspects of each of the following
 patterns, and it enables the
 [http://en.wikipedia.org/wiki/Interpreter_pattern Interpreter Pattern]:

  - [http://en.wikipedia.org/wiki/Strategy_pattern Strategy Pattern]
  - [http://en.wikipedia.org/wiki/Template_method_pattern Template Method
 Pattern]
  - [http://en.wikipedia.org/wiki/Visitor_pattern Visitor Pattern]
  - [http://en.wikipedia.org/wiki/Command_pattern Command Pattern]
  - [http://en.wikipedia.org/wiki/Chain-of-responsibility_pattern Chain-of-
 responsibility Pattern]

 WordPress already follows many of those patterns brilliantly in other
 areas.

 Replying to [comment:10 scribu]:
 > Yes, this can only be done once, so you couldn't have multiple plugins
 doing pre-processing.

 Exactly.

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


More information about the wp-trac mailing list