I arrived in Boston about 5pm yesterday. Unfortunately, my early flight on AA had been cancelled and they put me an a layover at DCA schedule, so my expected arrival went from 10am to 5pm. This also meant that I missed the American Craft Brewing Festival that Jon had been working at on Friday & Saturday. We decided to head out, eat at Sunset Grille & Tap, and then play some pool at the bar on the top floor of the same building.
Today we explored Cambridge, got free ice cream from Ben & Jerry’s, ate at the post-Festival brunch buffet that the Publik Roadhouse hosted for all the folks who staffed the Brewing Festival, and went shopping at REI for a new rain jacket for Jon. Also, on the way over to REI, I got to check out Fenway Park from the car.
I wonder what this says about the Political makeup of Missouri. I’m inclined to think that this gain is increasingly shifting the landscape purple (from red). Especially as the majority of these movers are coming from traditionally blue states. Notice that Illinois & NY are losing alot. Although, the folks moving out of Illinois (and maybe into Missouri are probably from south of I-80, which means they are most likely republican. So…who knows…
I spoke at ACM in Chicago on March 11th. My presentation was about the work I was allowed to be a part of while on the staff of the Obama New Media Team.
There exist several plugins within the pantheon of textpattern plugins that could really use a tweak or addition to the callback system that allows for event-based plugin integration.
The two plugins most concerning me are wlk_article_glyph and wlk_sphereit. Both of these require that the user of the plugin replaces the <txp:body /> tag in their article form. This is inconvenient, at best. For instance, should a user wish to employ both of these tags, they will quickly find that they cannot.
wlk_sphereit, as part of the Sphere.com indexing method, generates it’s own body tag so that it can add some tags around the body to improve the Sphere search engine’s indexing capabilities (and it’s specificity…what is and isn’t article content).
wlk_article_glyph was created in a few minutes at the request of someone of the textpattern forums as a method of adding a glyph to the end of an article, as they do in some newspaper and magazines.
So, to allow both of these to work in textpattern, I forked the unofficial dev 4.0 branch over at github and started hacking at it.
First I added a new callback_event function called “callback_out_event”. This function is only in use in areas like <txp:body /> and <txp:excerpt /> so I removed the $step and $pre variables. Also, I created this function because, while php5 will let you set a default attribute for a function argument that’s being passed by reference, php4 will not.
function callback_out_event($event, &$the_out)
{
global $plugin_callback;
if (!is_array($plugin_callback))
return;
$return_value = '';
foreach ($plugin_callback as $c) {
if ($c['event'] == $event) {
if (is_callable($c['function'])) {
$return_value .= call_user_func($c['function'], &$the_out);
}
}
}
return $return_value;
}
I also now pass by reference whatever variable is being returned by the tag function where I’m placing the callback event. In the case of the body tag, I placed it here:
The wlk_test_body function gets called whenever the pre_body_render callback is called. I can access the body content (as it’s passed by reference) and add whatever I need to the body.