WCSF 2011 Voodoo

Rarst asks: what magic turns pretty permalinks into query variables?

The setup:

The magic:

foreach ( $rewrite as $match => $query ) {
	if ( preg_match("#^$match#", $request_match, $matches) ) {
		// Got a match.
		$this->matched_rule = $match;
		break;
	}
}

The real voodoo is in creating the rewrite rules. Example: bbPress

  • register_post_types
  • register_taxonomies
  • add_rewrite_tags
  • generate_rewrite_rules

Exercise: optimize parse_request by restructuring the rules into a tree.

Nacin suggests: wp-hackers Skip Main Query

  • the grand scheme of things (png, blog post)
  • $wp->init()
  • class freshlypressed_wp extends wp
  • wp() calls $wp->main()
  • $wp->main() calls $this->parse_request()
  • $this is a freshlypressed_wp

Problems:

  • Can’t extend a variable class (class my_wp extends $wp_class)
  • No pluggable inheritance chaining
  • No way for several plugins to cooperatively extend a class

Shape My WordCamp Talk

Now that Jane’s announcement has made it official, I need to prepare for my talk at WordCamp San Francisco. The working title is “Deep Voodoo: How the innermost innards of WordPress work” and the working content is nil.

This is where you come in. As a core contributor or plugin developer, you are aware of areas in WordPress code that scare you. I’ve been there and back again. I’ve digested, debugged and patched some of the most labyrinthine logic. I’ve even written some of the worst of it. On Saturday, August 13, I will try to make sense of it for everyone.

Please take a minute to recall something in the core code of WordPress that really stumps you. Ask me about it. I will try to work all of your comments into my talk, provided that I can’t answer it with a quick reply, a link to the Codex or a Google search.

If this gambit of asking for questions beforehand fails, maybe I’ll just give a tour of my personal favorite fork of WordPress in which every function block is shaped like a pony. (Please don’t let that happen.)

My Musical Interlude at WordCamp 2007

John Pozadzides’ camera had the best view of WordCamp and he did a fine job of filming (and he kindly edited my floundering after) my performance. Thanks, John!

Set list:

  1. Brooke’s Song by Andy Skelton
  2. Deserve by Andy Skelton
  3. Political Science by Randy Newman

More WordCamp Road Trip Plans

Planning continues: map, calendar.

Through my new couchsurfing.com account I have begun to make lodging arrangements.

I’m planning to lodge and ride for a few days with WordPresser and motorcyclist Brooke Kuhlmann. He plotted a scenic route to cover the 1,300 miles between Colorado City and San Francisco.

Are you interested in joining the road trip to WordCamp? If enough people get involved we might even call it a rally. Cars are welcome, too. :-)

Riding to WordCamp

WordCamp 2007 is coming up! Instead of flying to San Francisco, I’m planning a motorcycle trip around the country. I hope to meet other bloggers along the way. Please take a look at the trip plans and let me know if you think we can meet up somewhere along the way.

Follow

Get every new post delivered to your Inbox.

Join 1,657 other followers