<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Marcus Povey &#187; example</title>
	<atom:link href="http://www.marcus-povey.co.uk/tag/example/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.marcus-povey.co.uk</link>
	<description>Making the world a better place, one byte at a time...</description>
	<lastBuildDate>Mon, 06 Feb 2012 19:13:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.1</generator>
	<atom:link rel='hub' href='http://www.marcus-povey.co.uk/?pushpress=hub'/>
		<item>
		<title>Traffic reports using twitter as a data source</title>
		<link>http://www.marcus-povey.co.uk/2011/12/09/traffic-reports-using-twitter-as-a-data-source/</link>
		<comments>http://www.marcus-povey.co.uk/2011/12/09/traffic-reports-using-twitter-as-a-data-source/#comments</comments>
		<pubDate>Fri, 09 Dec 2011 08:00:12 +0000</pubDate>
		<dc:creator>Marcus Povey</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[gps]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[road]]></category>
		<category><![CDATA[skunk]]></category>
		<category><![CDATA[social]]></category>
		<category><![CDATA[street level urls]]></category>
		<category><![CDATA[traffic]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[url]]></category>

		<guid isPermaLink="false">http://www.marcus-povey.co.uk/?p=841</guid>
		<description><![CDATA[Following on from my post yesterday, I would like to introduce something I quickly hacked together to show how the kind of thing I was talking about might work. As discussed in yesterday&#8217;s article, I already use twitter to provide a data feed for selective traffic alerts. Street Level URLs provides a simple wrapper around [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.marcus-povey.co.uk/wp-content/DSC_0237-300x199.jpg" width="150" align="right" />Following on from <a href="http://www.marcus-povey.co.uk/2011/12/08/idea-lets-give-roads-junctions-and-intersections-urls/">my post yesterday</a>, I would like to introduce <a href="http://skunk.marcus-povey.co.uk/traffic/" target="_blank">something I quickly hacked together</a> to show how the kind of thing I was talking about might work.</p>
<p>As discussed in <a href="http://www.marcus-povey.co.uk/2011/12/08/idea-lets-give-roads-junctions-and-intersections-urls/">yesterday&#8217;s article</a>, I already use twitter to provide a data feed for selective traffic alerts.</p>
<p><a href="http://skunk.marcus-povey.co.uk/traffic/" target="_blank">Street Level URLs</a> provides a simple wrapper around this search, providing you with a nice summary page and the option to access the data in a number of different formats. </p>
<p>It uses twitter for the actual data and uses <a href="http://httpd.apache.org/docs/current/mod/mod_rewrite.html" target="_blank">mod_rewrite rules</a> to wrap the actual search up into an addressable URL.</p>
<p>Have fun!</p>
<p>&raquo; <a href="http://skunk.marcus-povey.co.uk/traffic">Street Level URLs</a></p>
<div class="wsbuttons">
	<div class="shareblob facebook">
		<div class="fb-like" data-href="http://www.marcus-povey.co.uk/2011/12/09/traffic-reports-using-twitter-as-a-data-source/" data-send="false" data-layout="box_count" data-width="60" data-show-faces="false" data-colorscheme="light"></div>
	</div>

	<div class="shareblob google">
		<div class="g-plusone" data-size="tall" data-href="http://www.marcus-povey.co.uk/2011/12/09/traffic-reports-using-twitter-as-a-data-source/"></div>
	</div>

	<div class="shareblob twitter">
		<div class="twitter">
			<a href="https://twitter.com/share?url=http%3A%2F%2Fwww.marcus-povey.co.uk%2F2011%2F12%2F09%2Ftraffic-reports-using-twitter-as-a-data-source%2F&count=vertical" class="twitter-share-button" data-lang="en">Tweet</a>
			<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
		</div>
	</div>

</div>
	]]></content:encoded>
			<wfw:commentRss>http://www.marcus-povey.co.uk/2011/12/09/traffic-reports-using-twitter-as-a-data-source/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Post processing Elgg views &#8211; Trac tags example</title>
		<link>http://www.marcus-povey.co.uk/2009/07/06/post-processing-elgg-views-trac-tags-example/</link>
		<comments>http://www.marcus-povey.co.uk/2009/07/06/post-processing-elgg-views-trac-tags-example/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 09:43:29 +0000</pubDate>
		<dc:creator>Marcus Povey</dc:creator>
				<category><![CDATA[elgg]]></category>
		<category><![CDATA[#ue]]></category>
		<category><![CDATA[example]]></category>
		<category><![CDATA[hook]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[plugin hook]]></category>
		<category><![CDATA[post processing]]></category>
		<category><![CDATA[processing]]></category>
		<category><![CDATA[tags]]></category>
		<category><![CDATA[trac]]></category>
		<category><![CDATA[views]]></category>

		<guid isPermaLink="false">http://www.marcus-povey.co.uk/?p=232</guid>
		<description><![CDATA[There are a number of ways that an Elgg plugin developer can manipulate views via the powerful Elgg views system. Most Elgg programmers are by now familiar with extending or replacing existing views, or providing new views for new objects etc. But what if you just wanted to make a simple tweak to an existing [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://trac.edgewall.org"><img title="Trac_Logo_512x512" src="http://www.marcus-povey.co.uk/wp-content/Trac_Logo_512x512-150x150.png" alt="Trac_Logo_512x512" width="150" height="150" align="right" /></a>There are a number of ways that an Elgg plugin developer can manipulate views via the powerful <a href="http://docs.elgg.org/wiki/Views">Elgg views system</a>.</p>
<p>Most Elgg programmers are by now familiar with <a href="http://docs.elgg.org/wiki/Views#Extending_views">extending</a> or replacing existing views, or providing new views for new objects etc.</p>
<p>But what if you just wanted to make a simple tweak to an existing view &#8211; for example to replace all instances of rude words in a feed article, or to turn passive links into active ones?</p>
<p>Well, fortunately Elgg provides a post processing hook for views which can do just that.</p>
<p>After every view has been generated, the framework will trigger a <a href="http://docs.elgg.org/wiki/PluginHooks">plugin hook</a> called &#8220;&#8216;display&#8217;, &#8216;view&#8217;&#8221;. This hook is passed a parameter &#8216;view&#8217; which contains the name of the view being processed (eg. object/blog).</p>
<p>The contents of the view are passed in the <code>$returnvalue</code> variable which you can perform any processing on before returning it from the hook.</p>
<p>I have just uploaded a <a href="http://community.elgg.org/pg/plugins/marcus/read/168854/trac-tags">Trac tags plugin</a> to the <a href="http://community.elgg.org">Elgg community</a> site which provides a good example of this.</p>
<p>The Trac tags plugin is a tiny plugin which uses the views post processing hook to turn <a href="http://trac.edgewall.org">Trac</a> links (e.g. #xxxxx for tickets and [xxxxx] for changesets) into active links into your repository, and here&#8217;s how &#8211; first we register the hook:</p>
<blockquote><p><code>function tractags_init()<br />
{<br />
....<br />
// Register our post processing hook<br />
register_plugin_hook('display', 'view', 'tractags_rewrite');</code></p>
<p><code><br />
// define views we want to rewrite codes on (means we don't have to process *everything*)<br />
$CONFIG-&gt;tractags_views = array(<br />
'object/thewire',<br />
'object/blog'<br />
);</code></p>
<p><code> ....<br />
}</code></p></blockquote>
<p>Then in our handler looks something like this:</p>
<blockquote><p><code>function tractags_rewrite($hook, $entity_type, $returnvalue, $params)<br />
{<br />
global $CONFIG;</code></p>
<p><code>$view = $params['view'];</code></p>
<p><code>if (($view) &amp;&amp; (in_array($view, $CONFIG-&gt;tractags_views)))<br />
{<br />
// Search and replace ticket numbers<br />
$returnvalue =  preg_replace_callback('/(#)([0-9]+)/i',<br />
create_function(<br />
'$matches',<br />
'<br />
global $CONFIG;</code></p>
<p><code>return "&lt;a href=\"{$CONFIG-&gt;trac_baseurl}ticket/{$matches[2]}\"&gt;{$matches[0]}&lt;/a&gt;";<br />
'<br />
), $returnvalue);</code></p>
<p><code>// Search and replace changesets<br />
$returnvalue =  preg_replace_callback('/(\[)([0-9]+)(\])/i',<br />
create_function(<br />
'$matches',<br />
'<br />
global $CONFIG;</code></p>
<p><code>return "&lt;a href=\"{$CONFIG-&gt;trac_baseurl}changeset/{$matches[2]}\"&gt;{$matches[0]}&lt;/a&gt;";<br />
'<br />
), $returnvalue);</code></p>
<p><code>return $returnvalue;<br />
}<br />
}</code></p></blockquote>
<p>I&#8217;m sure you will be able to come up with some much more interesting uses!</p>
<p><small>Image from the <a href="http://trac.edgewall.org">Trac project</a>.</small></p>
<div class="wsbuttons">
	<div class="shareblob facebook">
		<div class="fb-like" data-href="http://www.marcus-povey.co.uk/2009/07/06/post-processing-elgg-views-trac-tags-example/" data-send="false" data-layout="box_count" data-width="60" data-show-faces="false" data-colorscheme="light"></div>
	</div>

	<div class="shareblob google">
		<div class="g-plusone" data-size="tall" data-href="http://www.marcus-povey.co.uk/2009/07/06/post-processing-elgg-views-trac-tags-example/"></div>
	</div>

	<div class="shareblob twitter">
		<div class="twitter">
			<a href="https://twitter.com/share?url=http%3A%2F%2Fwww.marcus-povey.co.uk%2F2009%2F07%2F06%2Fpost-processing-elgg-views-trac-tags-example%2F&count=vertical" class="twitter-share-button" data-lang="en">Tweet</a>
			<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0];if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src="//platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script>
		</div>
	</div>

</div>
	]]></content:encoded>
			<wfw:commentRss>http://www.marcus-povey.co.uk/2009/07/06/post-processing-elgg-views-trac-tags-example/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>

