<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Chip's Tips for Developers » PHP</title>
	
	<link>http://www.chipstips.com</link>
	<description>Contains coding, but not narcotic.</description>
	<lastBuildDate>Mon, 04 Feb 2013 20:50:40 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/ChipsTipsPhp" /><feedburner:info uri="chipstipsphp" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Legendary new feature for OPML Browser for WordPress</title>
		<link>http://feedproxy.google.com/~r/ChipsTipsPhp/~3/Em8K7AmAUJc/</link>
		<comments>http://www.chipstips.com/?p=583#comments</comments>
		<pubDate>Sat, 18 Dec 2010 21:35:28 +0000</pubDate>
		<dc:creator>Sterling Camden</dc:creator>
				<category><![CDATA[OPML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[phpopmlbrowse]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[widgets]]></category>

		<guid isPermaLink="false">http://www.chipstips.com/?p=583</guid>
		<description><![CDATA[When we last left our valiant plugin, it had just succeeded in implementing all of the features requested by László Monda, except for one: László wanted to be able to use the rss.png from /wp-includes/images to avoid an extra GET request when loading the page. Although I had provided a way to override the location [...]]]></description>
				<content:encoded><![CDATA[<div class="socialize-in-content socialize-in-content-right"><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.chipstips.com/?p=583"></g:plusone></div><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.chipstips.com/?p=583" data-text="Legendary new feature for OPML Browser for WordPress" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.chipstips.com%2F%3Fp%3D583&amp;send=&amp;layout=box_count&amp;width=50&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">
			<!-- 
			reddit_url = "http://www.chipstips.com/?p=583";
			reddit_title = "Legendary new feature for OPML Browser for WordPress";	//-->
		</script><script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">var dzone_url = "http://www.chipstips.com/?p=583";</script>
		<script type="text/javascript">var dzone_title = "Legendary new feature for OPML Browser for WordPress";</script>
		<script type="text/javascript">
			<!-- 
			var dzone_style = "1";
			//-->
		</script><script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script></div></div><p>When we <a href="http://www.chipstips.com/?p=580">last left our valiant plugin</a>, it had just succeeded in implementing all of the features requested by <a href="http://monda.hu/">László Monda</a>, except for one:  László wanted to be able to use the rss.png from /wp-includes/images to avoid an extra GET request when loading the page.  Although I had provided a way to override the location for the images, he didn&#8217;t want to put all of the images in /wp-includes/images, because that directory gets overwritten by upgrades to WordPress.  He resorted to making a <a href="http://www.chipstips.com/?p=580&#038;cpage=1#comment-133592">one-line custom modification to the code</a>.</p>
<p>Well, I hate forcing people to patch my code for the functionality they desire.  I can also see his point.  Although the overhead of a single GET does not concern me much, I imagine in bandwidth-restricted circumstances every little bit helps.  On the other hand, I don&#8217;t want to hard-code the location of this image, because existing users may be customizing the images used for the opml-browser plugin.  So, I implemented László&#8217;s change as an option:  the &#8220;Monda option&#8221; &#8212; or more verbosely, &#8220;Use rss.png from wp-includes/images?&#8221;  This option overrides the &#8220;Image URL&#8221; option for rss.png only.</p>
<p>This one change accompanies a bump to version 2.4.  Download links below.</p>
<p>Oh, and if you&#8217;re wondering about the word &#8220;legendary&#8221; in the title of this post, just ask <a href="http://translate.google.com/#hu|en|Monda">Google a mindent tudni</a>.</p>
<div class="downloadbuttons">
    <a href="http://bitbucket.org/sterlingcamden/opml-browser"><img src="http://www.chipstips.com/images/bitbucket.png" alt="BitBucket repository" /></a><br />
    <a href="http://www.chipstips.com/download/opml-browser.tar.bz2"><img src="http://www.chipstips.com/images/tarball.png" alt="tarball" /></a><br />
    <a href="http://www.chipstips.com/download/opml-browser.zip"><img src="http://www.chipstips.com/images/zip.png" alt="zip" /></a>
</div>
<img src="http://feeds.feedburner.com/~r/ChipsTipsPhp/~4/Em8K7AmAUJc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.chipstips.com/?feed=rss2&amp;p=583</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://www.chipstips.com/?p=583</feedburner:origLink></item>
		<item>
		<title>OPML Browser for WordPress version 2.3</title>
		<link>http://feedproxy.google.com/~r/ChipsTipsPhp/~3/EZ0T87Bzpa8/</link>
		<comments>http://www.chipstips.com/?p=580#comments</comments>
		<pubDate>Sun, 12 Dec 2010 01:38:17 +0000</pubDate>
		<dc:creator>Sterling Camden</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[OPML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[phpopmlbrowse]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[widgets]]></category>

		<guid isPermaLink="false">http://www.chipstips.com/?p=580</guid>
		<description><![CDATA[I never seem to be able to stick my fingers in a WordPress plugin without getting them nasty. After I released version 2.2 of the OPML Browser, László came up with several more suggestions. I didn&#8217;t agree to all of them, but here are the ones I&#8217;ve included in version 2.3: Added option for &#8220;Show [...]]]></description>
				<content:encoded><![CDATA[<div class="socialize-in-content socialize-in-content-right"><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.chipstips.com/?p=580"></g:plusone></div><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.chipstips.com/?p=580" data-text="OPML Browser for WordPress version 2.3" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.chipstips.com%2F%3Fp%3D580&amp;send=&amp;layout=box_count&amp;width=50&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">
			<!-- 
			reddit_url = "http://www.chipstips.com/?p=580";
			reddit_title = "OPML Browser for WordPress version 2.3";	//-->
		</script><script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">var dzone_url = "http://www.chipstips.com/?p=580";</script>
		<script type="text/javascript">var dzone_title = "OPML Browser for WordPress version 2.3";</script>
		<script type="text/javascript">
			<!-- 
			var dzone_style = "1";
			//-->
		</script><script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script></div></div><p>I never seem to be able to stick my fingers in a WordPress plugin without getting them nasty.  After I released <a href="http://www.chipstips.com/?p=577">version 2.2</a> of the OPML Browser, <a href="http://monda.hu/">László</a> came up with several more suggestions.  I didn&#8217;t agree to all of them, but here are the ones I&#8217;ve included in version 2.3:</p>
<ul>
<li>Added option for &#8220;Show clickable folders for categories&#8221;, with a default value of true.  You can now uncheck this option to suppress the folder icons.  Of course, if you do that, the user cannot collapse categories.</li>
<li>Escape any special HTML characters found in the text, title, description, xmlUrl, or htmlUrl attributes, but without double-escaping.</li>
<li>Changed img tags to use the &#8220;id&#8221; attribute instead of the obsolete &#8220;name&#8221; attribute.</li>
</ul>
<p>The last two items allow the widget to validate cleanly at <a href="http://html5.validator.nu">html5.validator.nu</a>.</p>
<p>I shall now go wash the PHP off my hands.</p>
<div class="downloadbuttons">
    <a href="http://bitbucket.org/sterlingcamden/opml-browser"><img src="http://www.chipstips.com/images/bitbucket.png" alt="BitBucket repository" /></a><br />
    <a href="http://www.chipstips.com/download/opml-browser.tar.bz2"><img src="http://www.chipstips.com/images/tarball.png" alt="tarball" /></a><br />
    <a href="http://www.chipstips.com/download/opml-browser.zip"><img src="http://www.chipstips.com/images/zip.png" alt="zip" /></a>
</div>
<img src="http://feeds.feedburner.com/~r/ChipsTipsPhp/~4/EZ0T87Bzpa8" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.chipstips.com/?feed=rss2&amp;p=580</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.chipstips.com/?p=580</feedburner:origLink></item>
		<item>
		<title>OPML Browser version 2.2 for WordPress</title>
		<link>http://feedproxy.google.com/~r/ChipsTipsPhp/~3/k7ZfxrQwQzA/</link>
		<comments>http://www.chipstips.com/?p=577#comments</comments>
		<pubDate>Tue, 07 Dec 2010 22:55:34 +0000</pubDate>
		<dc:creator>Sterling Camden</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[OPML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[phpopmlbrowse]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[widgets]]></category>

		<guid isPermaLink="false">http://www.chipstips.com/?p=577</guid>
		<description><![CDATA[A user (I have users?!?) named László Monda offered some enhancement suggestions for my OPML Browser plugin for WordPress. I have implemented them in version 2.2, which you can download from the links below. Specifically, I added the following options: Image URL, defaulting to the previous hard-coded location (images subdirectory). László wanted to be able [...]]]></description>
				<content:encoded><![CDATA[<div class="socialize-in-content socialize-in-content-right"><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.chipstips.com/?p=577"></g:plusone></div><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.chipstips.com/?p=577" data-text="OPML Browser version 2.2 for WordPress" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.chipstips.com%2F%3Fp%3D577&amp;send=&amp;layout=box_count&amp;width=50&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">
			<!-- 
			reddit_url = "http://www.chipstips.com/?p=577";
			reddit_title = "OPML Browser version 2.2 for WordPress";	//-->
		</script><script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">var dzone_url = "http://www.chipstips.com/?p=577";</script>
		<script type="text/javascript">var dzone_title = "OPML Browser version 2.2 for WordPress";</script>
		<script type="text/javascript">
			<!-- 
			var dzone_style = "1";
			//-->
		</script><script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script></div></div><p>A user (I have users?!?) named <a href="http://monda.hu/">László Monda</a> offered some enhancement suggestions for my OPML Browser plugin for WordPress.  I have implemented them in version 2.2, which you can download from the links below.</p>
<p>Specifically,  I added the following options:</p>
<ul>
<li><strong>Image URL</strong>, defaulting to the previous hard-coded location (images subdirectory).  László wanted to be able to reuse the rss.png in the /wp-content/images directory instead of loading two RSS icons.  He can do that now by changing the &#8220;Image URL&#8221; in the widget options to that directory and making sure that all of the needed images are located there.</li>
<li><strong>Include OPML descriptions as tooltips</strong>, with a default value of true.  If you uncheck this option, then no tooltips will be displayed.  I also added a delay of one second between the mouseover and the tooltip display.</li>
<li><strong>Include &#8220;Get this widget&#8221; link?</strong>, with a default value of true.  If you uncheck this option, the link will not be displayed and you must either plaster my praises all over your blog or reconcile your conscience to your ingratitude in some other way.</li>
</ul>
<p>I also took this opportunity to move the OPML Browser project into a Mercurial repository on BitBucket, and to offer a .tar.bz2 download in addition to a .zip format.  Enjoy!</p>
<div class="downloadbuttons">
    <a href="http://bitbucket.org/sterlingcamden/opml-browser"><img src="http://www.chipstips.com/images/bitbucket.png" alt="BitBucket repository" /></a><br />
    <a href="http://www.chipstips.com/download/opml-browser.tar.bz2"><img src="http://www.chipstips.com/images/tarball.png" alt="tarball" /></a><br />
    <a href="http://www.chipstips.com/download/opml-browser.zip"><img src="http://www.chipstips.com/images/zip.png" alt="zip" /></a>
</div>
<img src="http://feeds.feedburner.com/~r/ChipsTipsPhp/~4/k7ZfxrQwQzA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.chipstips.com/?feed=rss2&amp;p=577</wfw:commentRss>
		<slash:comments>16</slash:comments>
		<feedburner:origLink>http://www.chipstips.com/?p=577</feedburner:origLink></item>
		<item>
		<title>WiPeD debugger for WordPress now has traceback</title>
		<link>http://feedproxy.google.com/~r/ChipsTipsPhp/~3/CdDyTVwBTwg/</link>
		<comments>http://www.chipstips.com/?p=402#comments</comments>
		<pubDate>Sat, 10 Oct 2009 23:13:41 +0000</pubDate>
		<dc:creator>Sterling Camden</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[debugger]]></category>
		<category><![CDATA[phpwpd]]></category>
		<category><![CDATA[phpwpd13]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[sammela]]></category>

		<guid isPermaLink="false">http://www.chipstips.com/?p=402</guid>
		<description><![CDATA[Sam Mela liked my WiPeD debugger for WordPress, but he wanted an easy way to include call traceback information.&#160; So he added it, and he kindly shared his addition with me. I’ve adapted what he did to my own tastes and included it in the download below.&#160; Whenever you want to add the current call [...]]]></description>
				<content:encoded><![CDATA[<div class="socialize-in-content socialize-in-content-right"><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.chipstips.com/?p=402"></g:plusone></div><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.chipstips.com/?p=402" data-text="WiPeD debugger for WordPress now has traceback" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.chipstips.com%2F%3Fp%3D402&amp;send=&amp;layout=box_count&amp;width=50&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">
			<!-- 
			reddit_url = "http://www.chipstips.com/?p=402";
			reddit_title = "WiPeD debugger for WordPress now has traceback";	//-->
		</script><script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">var dzone_url = "http://www.chipstips.com/?p=402";</script>
		<script type="text/javascript">var dzone_title = "WiPeD debugger for WordPress now has traceback";</script>
		<script type="text/javascript">
			<!-- 
			var dzone_style = "1";
			//-->
		</script><script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script></div></div><p><a href="http://sammela.com">Sam Mela</a> liked my WiPeD debugger for WordPress, but he wanted an easy way to include call traceback information.&#160; So <a href="http://sammela.com/2009/10/07/add-backtrace-to-the-wiped-wordpress-debugger/">he added it</a>, and he kindly shared his addition with me.</p>
<p>I’ve adapted what he did to my own tastes and included it in the download below.&#160; Whenever you want to add the current call stack to the debug log, just call:</p>
<p><code>WPD_backtrace();</code></p>
<p>In order to test this, I added a new option in the Options page:</p>
<p>Trace the following actions (comma-separated)</p>
<p>Just enter the name of any action hooks on which you want to get a traceback added to the debug log.&#160; This is not only useful for testing the plugin, it can also be used to find out where in the twisty little passages of WordPress each of the actions gets invoked.</p>
<p>Largely because of this feature, I now initialize this plugin whenever it is activated.&#160; Previously I delayed setting it up until WPD_print was invoked.&#160; So this plugin now imposes a small overhead if it is activated and not used.&#160; Be advised.</p>
<p>I also adopted Sam’s idea of providing default styling (which I modified significantly).&#160; If you don’t like it, you can remove or modify WiPeD.css.</p>
</p>
<div class="downloadbutton"><a href="http://www.chipstips.com/download/phpwpd13.zip"><img src="http://www.chipstips.com/images/download.gif" /></a></div>
<img src="http://feeds.feedburner.com/~r/ChipsTipsPhp/~4/CdDyTVwBTwg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.chipstips.com/?feed=rss2&amp;p=402</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.chipstips.com/?p=402</feedburner:origLink></item>
		<item>
		<title>Categories now have feeds, thanks to a new WordPress plugin</title>
		<link>http://feedproxy.google.com/~r/ChipsTipsPhp/~3/bUWJtfiGWWo/</link>
		<comments>http://www.chipstips.com/?p=360#comments</comments>
		<pubDate>Tue, 25 Aug 2009 19:02:26 +0000</pubDate>
		<dc:creator>Sterling Camden</dc:creator>
				<category><![CDATA[OPML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[Site News]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[categories]]></category>
		<category><![CDATA[feed]]></category>
		<category><![CDATA[feedburner]]></category>
		<category><![CDATA[phpcat2opml]]></category>

		<guid isPermaLink="false">http://www.chipstips.com/?p=360</guid>
		<description><![CDATA[On this site I write examples in a variety of programming languages.  I’m sure that some of my WordPress (PHP) audience gets tired of hearing about Synergy/DE, Ruby, and C#.  Some Rubyist readers have commented that I should stick to writing about Ruby.  I experienced a wave of subscriptions from Lispers when I posted twice [...]]]></description>
				<content:encoded><![CDATA[<div class="socialize-in-content socialize-in-content-right"><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.chipstips.com/?p=360"></g:plusone></div><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.chipstips.com/?p=360" data-text="Categories now have feeds, thanks to a new WordPress plugin" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.chipstips.com%2F%3Fp%3D360&amp;send=&amp;layout=box_count&amp;width=50&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">
			<!-- 
			reddit_url = "http://www.chipstips.com/?p=360";
			reddit_title = "Categories now have feeds, thanks to a new WordPress plugin";	//-->
		</script><script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">var dzone_url = "http://www.chipstips.com/?p=360";</script>
		<script type="text/javascript">var dzone_title = "Categories now have feeds, thanks to a new WordPress plugin";</script>
		<script type="text/javascript">
			<!-- 
			var dzone_style = "1";
			//-->
		</script><script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script></div></div><p><img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="image" src="http://chipstips.com/wp-content/images/CategoriesnowhavefeedsthankstoanewWordPr_9CE2/image.png" border="0" alt="image" width="122" height="39" align="left" /> On this site I write examples in a variety of programming languages.  I’m sure that some of my WordPress (PHP) audience gets tired of hearing about Synergy/DE, Ruby, and C#.  Some Rubyist readers have commented that I should stick to writing about Ruby.  I experienced a wave of subscriptions from Lispers when I posted twice about Lisp, but they’re probably sick of all the non-Lisp posts I’ve written since then.  So, it’s time to give subscribers more choice.</p>
<p>Take a look over at the right sidebar (<a href="http://chipstips.com">here</a>, if you’re in a feed reader).  Scroll down below the ads and notice the new “Categories” widget.  You can now subscribe to any category by clicking the orange RSS icon beside its name.  Categories that contain other categories also include their content in the feed.  So, you can subscribe to specific programming languages, or the “WordPress” feed, or the “.NET” feed, or the “OPML” feed – depending on what you’re interested in reading.  Note that I often post under more than one category, so for instance if you subscribe to “PHP” you’ll get a superset of “WordPress” &#8212; because all WordPress posts are also under PHP – at least, so far.</p>
<p><strong>How you, too, can display this glorious new Categories widget on your site</strong></p>
<p>Surprise!  It’s really my trusty <a href="http://chipstips.com/?tag=phpopmlbrowse">OPML Browser widget</a>.  But it’s feeding from an OPML file that is automatically updated by a new WordPress plugin that you can download below.  This plugin generates an OPML file containing links to your categories and their feeds.  You can override the feed URLs (in case you want to feed them through <a href="http://feedburner.com">FeedBurner</a>), or let the plugin use the default feed URL.  You can generate the file on demand, but the plugin will automatically regenerate it any time you add, change, or delete a category.</p>
<p>Once you’ve got the Categories OPML plugin all set up, just add the OPML Browser widget to your sidebar and tell it where the file is located.  Make sure you have the latest version of the OPML Browser – the OPML for hierarchical categories posed a few challenges for the older version and <a href="http://www.chipstips.com/?p=355">required an update</a>.</p>
<div class="downloadbutton"><a href="http://www.chipstips.com/download/phpcat2opml.zip"><img src="http://www.chipstips.com/images/download.gif" alt="" /></a></div>
<img src="http://feeds.feedburner.com/~r/ChipsTipsPhp/~4/bUWJtfiGWWo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.chipstips.com/?feed=rss2&amp;p=360</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.chipstips.com/?p=360</feedburner:origLink></item>
		<item>
		<title>OPML Browser for WordPress gets a new parser</title>
		<link>http://feedproxy.google.com/~r/ChipsTipsPhp/~3/DsOS4keRmgI/</link>
		<comments>http://www.chipstips.com/?p=355#comments</comments>
		<pubDate>Mon, 24 Aug 2009 22:36:49 +0000</pubDate>
		<dc:creator>Sterling Camden</dc:creator>
				<category><![CDATA[OPML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[phpopmlbrowse]]></category>
		<category><![CDATA[regexen]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://www.chipstips.com/?p=355</guid>
		<description><![CDATA[I thought of a new use for my OPML Browser plugin, but the OPML file I intended to use with it threw me a couple of curve balls. First of all, the file contained nested outline elements, with xmlURL attributes on the containing elements.  Until now, I displayed the feed icon if an item had [...]]]></description>
				<content:encoded><![CDATA[<div class="socialize-in-content socialize-in-content-right"><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.chipstips.com/?p=355"></g:plusone></div><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.chipstips.com/?p=355" data-text="OPML Browser for WordPress gets a new parser" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.chipstips.com%2F%3Fp%3D355&amp;send=&amp;layout=box_count&amp;width=50&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">
			<!-- 
			reddit_url = "http://www.chipstips.com/?p=355";
			reddit_title = "OPML Browser for WordPress gets a new parser";	//-->
		</script><script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">var dzone_url = "http://www.chipstips.com/?p=355";</script>
		<script type="text/javascript">var dzone_title = "OPML Browser for WordPress gets a new parser";</script>
		<script type="text/javascript">
			<!-- 
			var dzone_style = "1";
			//-->
		</script><script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script></div></div><p><img style="margin: 0px 10px 0px 0px; display: inline" src="http://www.chipstips.com/wp-content/images/opml.jpg" alt="" width="64" height="64" align="left" />I thought of a new use for my OPML Browser plugin, but the OPML file I intended to use with it threw me a couple of curve balls.</p>
<p>First of all, the file contained nested outline elements, with xmlURL attributes on the containing elements.  Until now, I displayed the feed icon if an item had a feed, and only displayed the folder icon if it didn’t (and it had child elements).  Because the only way to expand/collapse the tree is by clicking on the folder icon, I’ve changed this to display both icons in that case.</p>
<p>Second, my file nests the outline tags more than two levels deep.  I was using <a href="http://www.php.net/manual/en/function.preg-match.php">preg_match</a> to parse the XML, with a non-greedy search for the end tag.  Can you guess what the problem was with that approach?  I’d get the end tag for an internal outline item when I was looking for the end of the outer item.  This only happened, of course, when an inner item was terminated by &lt;/outline&gt;.</p>
<p>Rather than trying to get even fancier with my regular expressions, I decided to implement a real XML parser instead.  I took a look at <a href="http://www.php.net/simplexml">SimpleXML</a>, but it requires PHP5 and allow_fopen_url.  Then I looked at PHP’s built-in <a href="http://www.php.net/manual/en/ref.xml.php">XML parser functions</a>, but that’s event-based and I needed to wade through the document on my own terms.  So I implemented my own <a href="http://www.chipstips.com/?p=353">simple XML DOM parser</a>, and included that with the plugin.</p>
<div class="downloadbutton"><a href="http://www.chipstips.com/download/phpopmlbrowse21.zip"><img src="http://www.chipstips.com/images/download.gif" alt="" /></a></div>
<img src="http://feeds.feedburner.com/~r/ChipsTipsPhp/~4/DsOS4keRmgI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.chipstips.com/?feed=rss2&amp;p=355</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.chipstips.com/?p=355</feedburner:origLink></item>
		<item>
		<title>Simple XML DOM parser for PHP</title>
		<link>http://feedproxy.google.com/~r/ChipsTipsPhp/~3/q2HnHLp_Sbw/</link>
		<comments>http://www.chipstips.com/?p=353#comments</comments>
		<pubDate>Mon, 24 Aug 2009 21:57:47 +0000</pubDate>
		<dc:creator>Sterling Camden</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[dom]]></category>
		<category><![CDATA[parser]]></category>
		<category><![CDATA[phpxmlparse]]></category>

		<guid isPermaLink="false">http://www.chipstips.com/?p=353</guid>
		<description><![CDATA[I realize that I’ve just added to the pile of reinvented wheels here, but I needed something simpler than SimpleXML (particularly in the requirements department) that nevertheless translated the event-based model of PHP’s built-in parser to a DOM model. Thus, I created the very simple parser which you can download below.  It’s only 67 lines [...]]]></description>
				<content:encoded><![CDATA[<div class="socialize-in-content socialize-in-content-right"><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.chipstips.com/?p=353"></g:plusone></div><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.chipstips.com/?p=353" data-text="Simple XML DOM parser for PHP" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.chipstips.com%2F%3Fp%3D353&amp;send=&amp;layout=box_count&amp;width=50&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">
			<!-- 
			reddit_url = "http://www.chipstips.com/?p=353";
			reddit_title = "Simple XML DOM parser for PHP";	//-->
		</script><script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">var dzone_url = "http://www.chipstips.com/?p=353";</script>
		<script type="text/javascript">var dzone_title = "Simple XML DOM parser for PHP";</script>
		<script type="text/javascript">
			<!-- 
			var dzone_style = "1";
			//-->
		</script><script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script></div></div><p><a href="http://www.warningsigngenerator.com/"><img style="border-right-width: 0px; margin: 0px 10px 0px 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" src="http://chipstips.com/wp-content/images/SimpleXMLDOMparserforPHP_CCD5/image.png" border="0" alt="image" width="166" height="200" align="left" /></a> I realize that I’ve just added to the pile of reinvented wheels here, but I needed something simpler than <a href="http://www.php.net/simplexml">SimpleXML</a> (particularly in the <a href="http://www.php.net/manual/en/simplexml.requirements.php">requirements</a> department) that nevertheless translated the event-based model of <a href="http://www.php.net/manual/en/ref.xml.php">PHP’s built-in parser</a> to a DOM model.</p>
<p>Thus, I created the very simple parser which you can download below.  It’s only 67 lines long.  It’s partially based on <a href="http://www.php.net/manual/en/ref.xml.php#84758">the example from wolfon</a>, but simplified even further by adding an xmlElement class instead of trying to force all of the relationships into an array format.</p>
<p>To use:</p>
<p><code>require("xmlparse.php"); </code></p>
<p><code>$dom = new xmlDOM($xml_text);   // Parses $xml_text </code></p>
<p><code>$dom-&gt;root</code> is an xmlElement with a zero-length tagName whose children member is an array of the top-level elements (of which there should only be 1) .</p>
<p><code>$dom-&gt;find_tag($tagName, $from);</code></p>
<p>Returns the first xmlElement whose tagName matches <code>$tagName</code>, starting with the children of $from.  If <code>$from</code> is null, it starts from the root.  If not found, false is returned.</p>
<p>An xmlElement has the following members:</p>
<p><code>parent</code> &#8211; the parent element<br />
<code>tagName</code> &#8211; the tag name<br />
<code>attributes</code> &#8211; an associative array of name =&gt; value<br />
<code>children</code> &#8211; an array of child elements<br />
<code>data</code> – any character data within the element</p>
<p><code>find_tag($tagName)</code> &#8211; finds a descendant element with the specified tag name.  Returns false if none found.</p>
<div class="downloadbutton"><a href="http://www.chipstips.com/download/phpxmlparse.zip"><img src="http://www.chipstips.com/images/download.gif" alt="" /></a></div>
<img src="http://feeds.feedburner.com/~r/ChipsTipsPhp/~4/q2HnHLp_Sbw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.chipstips.com/?feed=rss2&amp;p=353</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.chipstips.com/?p=353</feedburner:origLink></item>
		<item>
		<title>OPML Browser 2.0 for WordPress</title>
		<link>http://feedproxy.google.com/~r/ChipsTipsPhp/~3/xsShP-jPHRg/</link>
		<comments>http://www.chipstips.com/?p=272#comments</comments>
		<pubDate>Mon, 11 May 2009 23:38:37 +0000</pubDate>
		<dc:creator>Sterling Camden</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[ATOM]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[OPML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[phpopmlbrowse]]></category>
		<category><![CDATA[phpopmlroll]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[widget]]></category>

		<guid isPermaLink="false">http://www.chipstips.com/?p=272</guid>
		<description><![CDATA[Yes, this is such a major upgrade to my OPML Browser plugin for WordPress that it warrants bumping the initial digit in the version number.  Here’s what changed: The plugin now expects to be installed in its own folder: (siteurl)/wp-content/plugins/opml-browser JavaScript and CSS have been separated into their own files. JavaScript events are now hooked [...]]]></description>
				<content:encoded><![CDATA[<div class="socialize-in-content socialize-in-content-right"><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.chipstips.com/?p=272"></g:plusone></div><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.chipstips.com/?p=272" data-text="OPML Browser 2.0 for WordPress" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.chipstips.com%2F%3Fp%3D272&amp;send=&amp;layout=box_count&amp;width=50&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">
			<!-- 
			reddit_url = "http://www.chipstips.com/?p=272";
			reddit_title = "OPML Browser 2.0 for WordPress";	//-->
		</script><script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">var dzone_url = "http://www.chipstips.com/?p=272";</script>
		<script type="text/javascript">var dzone_title = "OPML Browser 2.0 for WordPress";</script>
		<script type="text/javascript">
			<!-- 
			var dzone_style = "1";
			//-->
		</script><script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script></div></div><p><img style="margin: 0px 10px 0px 0px; display: inline" src="http://www.chipstips.com/wp-content/images/opml.jpg" alt="" width="31" height="31" align="left" /> Yes, this is such a major upgrade to my OPML Browser plugin for WordPress that it warrants bumping the initial digit in the version number.  Here’s what changed:</p>
<ol>
<li>The plugin now expects to be installed in its own folder: (siteurl)/wp-content/plugins/opml-browser</li>
<li>JavaScript and CSS have been separated into their own files.</li>
<li>JavaScript events are now hooked on window load instead of in the HTML.</li>
<li>Added &#8220;alt&#8221; attribute to all &#8220;img&#8221; tags.</li>
<li>Images are now looked for in (siteurl)/wp-content/plugins/opml-browser/images</li>
<li>If an image cannot be found, it will be replaced by the supplied unknown.png (a question mark).</li>
<li>Added &#8220;Sort items?&#8221; option.  This sorts within categories, unless the “flatten” option is enabled (see next item).</li>
<li>Added the &#8220;Flatten hierarchy?&#8221; option.  This combines all items into one level.  If sorting, all items get sorted together.</li>
<li>The OPML description attribute is now displayed as a tooltip (as in the OPML Blogroll widget, but it also works in IE and Opera now!).</li>
</ol>
<p>As far as I know, the OPML Browser can now do everything that the <a href="http://chipstips.com/?tag=phpopmlroll">OPML Blogroll widget</a> could do (items 7 through 9 filled that out), so I am herewith declaring the OPML Blogroll widget retired from further upgrades.  Please use this plugin’s widget instead from now on.  Let me know if I’ve forgotten any functionality that you need.</p>
<p>A big “thank you” to all of my users who requested various features and reported bugs.  This plugin would not be what it is today without your input. </p>
<div class="downloadbutton"><a href="http://www.chipstips.com/download/phpopmlbrowse20.zip"><img src="http://www.chipstips.com/images/download.gif" alt="" /></a></div>
<img src="http://feeds.feedburner.com/~r/ChipsTipsPhp/~4/xsShP-jPHRg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.chipstips.com/?feed=rss2&amp;p=272</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<feedburner:origLink>http://www.chipstips.com/?p=272</feedburner:origLink></item>
		<item>
		<title>Sorting array keys in natural order in PHP</title>
		<link>http://feedproxy.google.com/~r/ChipsTipsPhp/~3/COdya-jGLXs/</link>
		<comments>http://www.chipstips.com/?p=269#comments</comments>
		<pubDate>Mon, 11 May 2009 19:21:29 +0000</pubDate>
		<dc:creator>Sterling Camden</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wildly popular]]></category>
		<category><![CDATA[arrays]]></category>
		<category><![CDATA[ksort]]></category>
		<category><![CDATA[natcasesort]]></category>
		<category><![CDATA[naturalorder]]></category>
		<category><![CDATA[phpnatcaseksort]]></category>
		<category><![CDATA[sorting]]></category>

		<guid isPermaLink="false">http://www.chipstips.com/?p=269</guid>
		<description><![CDATA[PHP, the language of myriad functions, devotes quite a few of those to the problem of sorting arrays.  One flavor of sort function useful in presenting data on web pages is natcasesort, which performs a case-insensitive, natural order sort.  However, even though natcasesort preserves key =&#62; value associations, you cannot use it to sort an [...]]]></description>
				<content:encoded><![CDATA[<div class="socialize-in-content socialize-in-content-right"><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.chipstips.com/?p=269"></g:plusone></div><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.chipstips.com/?p=269" data-text="Sorting array keys in natural order in PHP" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.chipstips.com%2F%3Fp%3D269&amp;send=&amp;layout=box_count&amp;width=50&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">
			<!-- 
			reddit_url = "http://www.chipstips.com/?p=269";
			reddit_title = "Sorting array keys in natural order in PHP";	//-->
		</script><script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">var dzone_url = "http://www.chipstips.com/?p=269";</script>
		<script type="text/javascript">var dzone_title = "Sorting array keys in natural order in PHP";</script>
		<script type="text/javascript">
			<!-- 
			var dzone_style = "1";
			//-->
		</script><script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script></div></div><p>PHP, the language of <a href="http://www.tnx.nl/php.html">myriad functions</a>, devotes quite a few of those to the problem of <a href="http://www.php.net/manual/en/array.sorting.php">sorting arrays</a>.  One flavor of sort function useful in presenting data on web pages is <a href="http://www.php.net/manual/en/function.natcasesort.php">natcasesort</a>, which performs a case-insensitive, <a href="http://sourcefrog.net/projects/natsort/">natural order</a> sort.  However, even though natcasesort preserves key =&gt; value associations, you cannot use it to sort an array by its keys.  The sort order is determined by the value alone.</p>
<p>Consider the following:</p>
<div id="codeSnippetWrapper" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 121.66%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 355px; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px; clear:both;">
<div id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum1" style="color: #606060">   1:</span> $<span style="color: #0000ff">array</span> = <span style="color: #0000ff">array</span>(<span style="color: #006080">'wilma'</span> =&gt; <span style="color: #0000ff">array</span>(<span style="color: #006080">'role'</span> =&gt; <span style="color: #006080">'wife'</span>, <span style="color: #006080">'sex'</span> =&gt; <span style="color: #006080">'female'</span>, <span style="color: #006080">'haircolor'</span> =&gt; <span style="color: #006080">'red'</span>),</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum2" style="color: #606060">   2:</span>                <span style="color: #006080">'fred'</span> =&gt; <span style="color: #0000ff">array</span>(<span style="color: #006080">'role'</span> =&gt; <span style="color: #006080">'husband'</span>, <span style="color: #006080">'sex'</span> =&gt; <span style="color: #006080">'male'</span>, <span style="color: #006080">'haircolor'</span> =&gt; <span style="color: #006080">'black'</span>),</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum3" style="color: #606060">   3:</span>                <span style="color: #006080">'barney'</span> =&gt; <span style="color: #0000ff">array</span>(<span style="color: #006080">'role'</span> =&gt; <span style="color: #006080">'neighbor'</span>, <span style="color: #006080">'sex'</span> =&gt; <span style="color: #006080">'male'</span>, <span style="color: #006080">'haircolor'</span> =&gt; <span style="color: #006080">'blond'</span>),</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum4" style="color: #606060">   4:</span>                <span style="color: #006080">'Betty'</span> =&gt; <span style="color: #0000ff">array</span>(<span style="color: #006080">'role'</span> =&gt; <span style="color: #006080">'neighbor'</span>, <span style="color: #006080">'sex'</span> =&gt; <span style="color: #006080">'female'</span>, <span style="color: #006080">'haircolor'</span> =&gt; <span style="color: #006080">'black'</span>),</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum5" style="color: #606060">   5:</span>                <span style="color: #006080">'pebbles'</span> =&gt; <span style="color: #0000ff">array</span>(<span style="color: #006080">'role'</span> =&gt; <span style="color: #006080">'child'</span>, <span style="color: #006080">'sex'</span> =&gt; <span style="color: #006080">'female'</span>, <span style="color: #006080">'haircolor'</span> =&gt; <span style="color: #006080">'red'</span>),</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum6" style="color: #606060">   6:</span>                <span style="color: #006080">'bam bam'</span> =&gt; <span style="color: #0000ff">array</span>(<span style="color: #006080">'role'</span> =&gt; <span style="color: #006080">'neighbor\'s child'</span>, <span style="color: #006080">'sex'</span> =&gt; <span style="color: #006080">'male'</span>, <span style="color: #006080">'haircolor'</span> =&gt; <span style="color: #006080">'blond'</span>));</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum7" style="color: #606060">   7:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum8" style="color: #606060">   8:</span> natcasesort($<span style="color: #0000ff">array</span>);</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum9" style="color: #606060">   9:</span></pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum10" style="color: #606060">  10:</span> <span style="color: #0000ff">echo</span> <span style="color: #006080">"&lt;h3&gt;using natcasesort&lt;/h3&gt;"</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum11" style="color: #606060">  11:</span> <span style="color: #0000ff">foreach</span>($<span style="color: #0000ff">array</span> <span style="color: #0000ff">as</span> $name =&gt; $features) {</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum12" style="color: #606060">  12:</span>   <span style="color: #0000ff">echo</span> $name . <span style="color: #006080">"&lt;br/&gt;"</span>;</pre>
<p><!--CRLF--></p>
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100.39%; font-family: 'Courier New', courier, monospace; direction: ltr; height: 110px; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum13" style="color: #606060">  13:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>Since natcasesort sorts on the value rather than the key, and the value in this case is another array, the sort order appears to be almost random:</p>
<p>pebbles</p>
<p>bam bam</p>
<p>Betty</p>
<p>barney</p>
<p>fred</p>
<p>wilma</p>
<p>To sort by the keys instead you can use <a href="http://www.php.net/manual/en/function.ksort.php">ksort</a>, but unfortunately it supports neither natural ordering nor case-insensitivity.  What you’d like here is a natcaseksort, but no such animal exists.</p>
<p>However, you can easily create one by combining two other functions:  <a href="http://www.php.net/manual/en/function.uksort.php">uksort</a> and <a href="http://www.php.net/manual/en/function.strnatcasecmp.php">strnatcasecmp</a>.  The former performs a key sort using a supplied function taking two parameters (two key values) and returning &lt;0, 0, or &gt;0 to indicate their collational relationship.  The latter performs a case-insensitive, natural order string comparison, returning precisely those values.  Thus, the equivalent of the mythical natcaseksort is the following one-liner:</p>
<div id="codeSnippetWrapper" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text; border: silver 1px solid; padding: 4px;">
<div id="codeSnippet" style="text-align: left; line-height: 12pt; background-color: #f4f4f4; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;">
<pre style="text-align: left; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New', courier, monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible; border-style: none; padding: 0px;"><span id="lnum1" style="color: #606060">   1:</span> uksort($<span style="color: #0000ff">array</span>, <span style="color: #006080">'strnatcasecmp'</span>);</pre>
<p><!--CRLF--></div>
</div>
<p>which faithfully produces:</p>
<p>bam bam</p>
<p>barney</p>
<p>Betty</p>
<p>fred</p>
<p>pebbles</p>
<p>wilma</p>
<p>For once, the authors of PHP refrained from creating yet another sort function.  It just happened to be the one I needed.  But two functions that each <a rel="nofollow" href="http://en.wikipedia.org/wiki/Unix_philosophy">Do One Thing Well</a> fit together with surprisingly Unix-like elegance to do the job.</p>
<div class="downloadbutton"><a href="http://www.chipstips.com/download/phpnatcaseksort.zip"><img src="http://www.chipstips.com/images/download.gif" alt="" /></a></div>
<img src="http://feeds.feedburner.com/~r/ChipsTipsPhp/~4/COdya-jGLXs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.chipstips.com/?feed=rss2&amp;p=269</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.chipstips.com/?p=269</feedburner:origLink></item>
		<item>
		<title>My apologies for your not being able to comment</title>
		<link>http://feedproxy.google.com/~r/ChipsTipsPhp/~3/MibKdQx5jWc/</link>
		<comments>http://www.chipstips.com/?p=218#comments</comments>
		<pubDate>Thu, 08 Jan 2009 21:45:30 +0000</pubDate>
		<dc:creator>Sterling Camden</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[apotheon]]></category>
		<category><![CDATA[briansthreadedcomments]]></category>
		<category><![CDATA[subscribetocomments]]></category>

		<guid isPermaLink="false">http://www.chipstips.com/?p=218</guid>
		<description><![CDATA[I made the classic web developer mistake:   &#8220;It&#8217;s just a simple change, what could possibly go wrong?&#8221;  So I didn&#8217;t test it thoroughly before launching it on my unsuspecting readers. For about a day, the &#8220;Add comment&#8221; button on posts here and at Chip&#8217;s Quips and Camden Software would only work if you were already [...]]]></description>
				<content:encoded><![CDATA[<div class="socialize-in-content socialize-in-content-right"><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.chipstips.com/?p=218"></g:plusone></div><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.chipstips.com/?p=218" data-text="My apologies for your not being able to comment" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.chipstips.com%2F%3Fp%3D218&amp;send=&amp;layout=box_count&amp;width=50&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">
			<!-- 
			reddit_url = "http://www.chipstips.com/?p=218";
			reddit_title = "My apologies for your not being able to comment";	//-->
		</script><script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">var dzone_url = "http://www.chipstips.com/?p=218";</script>
		<script type="text/javascript">var dzone_title = "My apologies for your not being able to comment";</script>
		<script type="text/javascript">
			<!-- 
			var dzone_style = "1";
			//-->
		</script><script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script></div></div><p>I made the classic web developer mistake:   &#8220;It&#8217;s just a simple change, what could possibly go wrong?&#8221;  So I didn&#8217;t test it thoroughly before launching it on my unsuspecting readers.</p>
<p>For about a day, the &#8220;Add comment&#8221; button on posts here and at <a href="http://chipsquips.com">Chip&#8217;s Quips</a> and <a href="http://camdensoftware.com">Camden Software</a> would only work if you were already subscribed to email notifications for the post in question.  My sin was particularly egregious, because you would only discover the impotence of that button <em>after </em>you&#8217;d already typed in your masterfully crafted response and were ready to submit it.  Shame on me.</p>
<p>Details:  I added a feature to allow you to subscribe to email notifications without leaving a comment, using a function that comes built into the <a href="http://txfx.net/code/wordpress/subscribe-to-comments/">Subscribe to Comments</a> plugin for WordPress.  That function creates the necessary form for submitting those subscriptions, and I inadvertently placed it within the &lt;form&gt; tags for the comment form (thanks to the exceptionally cluttered version of comments.php that comes with the <a href="http://meidell.dk/threadedcomments/">Brian&#8217;s Threaded Comments</a> plugin).  When a form contains another form, the JavaScript method &#8220;submit&#8221; does not exist for that element, and that&#8217;s what the &#8220;Add comment&#8221; button calls when clicked.  I found my error using the very handy JavaScript debugger in Google Chrome.</p>
<p>But it&#8217;s all right now (in fact it&#8217;s a gas).  I also modified the comment form such that the email subscription checkbox is now in the tabbing order.  The Subscribe to Comments plugin adds this checkbox, but does not specify a &#8220;tabindex&#8221; attribute.  So I hacked my copy of the plugin and my copy of the comments.php that comes with Brian&#8217;s Threaded Comments to move this checkbox to <em>before </em>the &#8220;Add comment&#8221; button, both visually and in the tabbing order.  Thanks to <a href="http://sob.apotheon.org">apotheon</a> for complaining about this, or I would never have noticed (being the author of each post, I never see the checkbox).  I left a comment on the <a href="http://txfx.net/code/wordpress/subscribe-to-comments/">Subscribe to Comments home page</a> requesting the ability to specify a tabindex for the checkbox, but in the mean time I&#8217;m posting my modified version here, along with my modified comments.php.</p>
<p><a href="http://www.chipstips.com/download/phpcomments.zip"><img src="http://www.chipstips.com/images/download.gif" alt="" /></a></p>
<div class="downloadbutton"> </div>
<img src="http://feeds.feedburner.com/~r/ChipsTipsPhp/~4/MibKdQx5jWc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.chipstips.com/?feed=rss2&amp;p=218</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://www.chipstips.com/?p=218</feedburner:origLink></item>
		<item>
		<title>Delicious.com threw my Taglicious plugin off the scent</title>
		<link>http://feedproxy.google.com/~r/ChipsTipsPhp/~3/YrRdEPLzQhY/</link>
		<comments>http://www.chipstips.com/?p=194#comments</comments>
		<pubDate>Sun, 03 Aug 2008 17:53:16 +0000</pubDate>
		<dc:creator>Sterling Camden</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[del.icio.us]]></category>
		<category><![CDATA[phptaglicious]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[tagging]]></category>

		<guid isPermaLink="false">http://www.chipstips.com/?p=194</guid>
		<description><![CDATA[I just updated&#160;the Taglicious plugin for WordPress to account for a change in the URL for links to delicious tags. I suddenly noticed that my automatic link posts weren&#8217;t getting tagged in WordPress, and I simultaneously noticed that the heading for those posts had been changed to include &#8220;delicious.com&#8221;.&#160; A quick inspection of the page [...]]]></description>
				<content:encoded><![CDATA[<div class="socialize-in-content socialize-in-content-right"><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.chipstips.com/?p=194"></g:plusone></div><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.chipstips.com/?p=194" data-text="Delicious.com threw my Taglicious plugin off the scent" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.chipstips.com%2F%3Fp%3D194&amp;send=&amp;layout=box_count&amp;width=50&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">
			<!-- 
			reddit_url = "http://www.chipstips.com/?p=194";
			reddit_title = "Delicious.com threw my Taglicious plugin off the scent";	//-->
		</script><script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">var dzone_url = "http://www.chipstips.com/?p=194";</script>
		<script type="text/javascript">var dzone_title = "Delicious.com threw my Taglicious plugin off the scent";</script>
		<script type="text/javascript">
			<!-- 
			var dzone_style = "1";
			//-->
		</script><script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script></div></div><p>I just updated&nbsp;the <a href="http://www.chipstips.com/?p=186">Taglicious plugin for WordPress</a> to account for a change in the URL for links to delicious tags.</p>
<p>I suddenly noticed that my <a href="http://www.chipsquips.com/?cat=17">automatic link posts</a> weren&#8217;t getting tagged in WordPress, and I simultaneously noticed that the heading for those posts had been changed to include &#8220;delicious.com&#8221;.&nbsp; A quick inspection of the page source revealed the problem.&nbsp; The URL for the tag links was changed from del.icio.us to delicious.com.&nbsp; In fact, if you try to navigate to del.icio.us now, you get redirected to delicious.com.&nbsp; The site seems to have been dressed up quite a bit of late, also.</p>
<p>This shows just how brittle any piece of software can be when it depends on the behavior of an outside service.&nbsp; I might have had an idea this was coming if I &nbsp;had subscribed to the <a href="http://blog.delicious.com/blog/2008/07/oh-happy-day.html">delicious blog</a>&nbsp;&#8211;&nbsp; but I hadn&#8217;t even known that there was one before.&nbsp; Oh well, update below.</p>
<p><a href="http://www.chipstips.com/download/phptaglicious.zip"><img src="http://www.chipstips.com/images/download.gif"></a></p>
<img src="http://feeds.feedburner.com/~r/ChipsTipsPhp/~4/YrRdEPLzQhY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.chipstips.com/?feed=rss2&amp;p=194</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<feedburner:origLink>http://www.chipstips.com/?p=194</feedburner:origLink></item>
		<item>
		<title>Subscribe to comment edits plugin for WordPress</title>
		<link>http://feedproxy.google.com/~r/ChipsTipsPhp/~3/UuLJRcl4W90/</link>
		<comments>http://www.chipstips.com/?p=187#comments</comments>
		<pubDate>Mon, 23 Jun 2008 23:20:36 +0000</pubDate>
		<dc:creator>Sterling Camden</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[briansthreadedcomments]]></category>
		<category><![CDATA[comments]]></category>
		<category><![CDATA[dynamicprogramming]]></category>
		<category><![CDATA[email]]></category>
		<category><![CDATA[markjaquith]]></category>
		<category><![CDATA[phpwpsubedit]]></category>
		<category><![CDATA[scriptygoddess]]></category>
		<category><![CDATA[subscribetocomments]]></category>
		<category><![CDATA[teeni]]></category>

		<guid isPermaLink="false">http://www.chipstips.com/?p=187</guid>
		<description><![CDATA[For blog surfers who still rely on their email Inbox, the Subscribe to Comments plugin (originally by scriptygoddess, updated by Mark Jaquith) is truly a goddesssend.  Just by ticking a box, commenters can be notified by email whenever additional comments are added to a post.  But, it doesn&#8217;t notify them when comments are edited. OK, [...]]]></description>
				<content:encoded><![CDATA[<div class="socialize-in-content socialize-in-content-right"><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.chipstips.com/?p=187"></g:plusone></div><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.chipstips.com/?p=187" data-text="Subscribe to comment edits plugin for WordPress" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.chipstips.com%2F%3Fp%3D187&amp;send=&amp;layout=box_count&amp;width=50&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">
			<!-- 
			reddit_url = "http://www.chipstips.com/?p=187";
			reddit_title = "Subscribe to comment edits plugin for WordPress";	//-->
		</script><script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">var dzone_url = "http://www.chipstips.com/?p=187";</script>
		<script type="text/javascript">var dzone_title = "Subscribe to comment edits plugin for WordPress";</script>
		<script type="text/javascript">
			<!-- 
			var dzone_style = "1";
			//-->
		</script><script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script></div></div><p>For blog surfers who still rely on their email Inbox, the <a href="http://txfx.net/code/wordpress/subscribe-to-comments/">Subscribe to Comments plugin</a> (originally by <a href="http://scriptygoddess.com/">scriptygoddess</a>, updated by <a href="http://txfx.net/">Mark Jaquith</a>) is truly a goddesssend.  Just by ticking a box, commenters can be notified by email whenever additional comments are added to a post.  But, it doesn&#8217;t notify them when comments are <em>edited</em>.</p>
<p>OK, you&#8217;re thinking &#8220;Why do I care to know when user &#8216;teratroll&#8217; corrects his/her misspelling of &#8216;turd-for-brains&#8217;?&#8221;  Ah, but that&#8217;s not all the &#8220;edit comment&#8221; functionality can be used for.</p>
<p>The <a href="http://www.vtroom.com/">ever so conversational Teeni</a> uses the &#8220;edit comment&#8221; facility to respond to comments.  She adds her response in bold right underneath the original.  While I prefer to use <a href="http://meidell.dk/threadedcomments/">Brian&#8217;s Threaded Comments</a> and take my place among all the other respondents, Teeni&#8217;s technique does feel more intimate.  The only problem with it, from a commenter perspective, is that the &#8220;Notify me of followup comments via e-mail&#8221; checkbox would notify me of all the comments except those from Teeni herself.  That is, until now.</p>
<p>I created the &#8220;Subscribe to Comment Edits&#8221; plugin (which you can download below) to piggyback on the &#8220;Subscribe to Comments&#8221; plugin.  It adds notification to all subscribers whenever a comment on a subscribed post is edited.  It does nothing if &#8220;Subscribe to Comments&#8221; is not activated.</p>
<p>Even though PHP is mostly a baling-wire and bubblegum excuse for a programming language, it does support some dynamic programming features &#8211; a couple of which can be seen in the few lines of code that comprise this plugin.  For instance, <a href="http://www.php.net/manual/en/function.function-exists.php">function_exists</a> is used to determine whether the &#8220;Subscribe to Comments&#8221; plugin has been activated.  And <a href="http://www.php.net/manual/en/function.create-function.php">create_function</a> does just what its name implies &#8212; it creates an anonymous function to pass as a parameter.  That&#8217;s nice, because the anonymous function doesn&#8217;t introduce any possible name collisions &#8212; but on the other hand, if the original function had been named I wouldn&#8217;t have to duplicate it here.</p>
<p>I would have also made the &#8216;init&#8217; function anonymous, but the escaping of quotes gets ridiculous.  That&#8217;s one case where less dynamic, more functional would be preferable.  In languages like Javascript and Ruby (and of course Lisp), you can write functions in-line wherever a datum can go, without any quoting.   But in PHP, functions aren&#8217;t really first-class objects &#8212; they&#8217;re always passed by name, and create_function returns a generated name.</p>
<p>Also note that the fact that $sg_subscribe is a global object (yuck) is exactly what makes it possible for me to piggyback onto its functionality without modifying the original plugin (yay).</p>
<p><a href="http://www.chipstips.com/download/phpwpsubedit.zip"><img src="http://www.chipstips.com/images/download.gif" alt="" /></a></p>
<img src="http://feeds.feedburner.com/~r/ChipsTipsPhp/~4/UuLJRcl4W90" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.chipstips.com/?feed=rss2&amp;p=187</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<feedburner:origLink>http://www.chipstips.com/?p=187</feedburner:origLink></item>
		<item>
		<title>Automatically saving del.icio.us tags as WordPress tags</title>
		<link>http://feedproxy.google.com/~r/ChipsTipsPhp/~3/zwvT1S9d9o4/</link>
		<comments>http://www.chipstips.com/?p=186#comments</comments>
		<pubDate>Fri, 23 May 2008 23:59:36 +0000</pubDate>
		<dc:creator>Sterling Camden</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[del.icio.us]]></category>
		<category><![CDATA[phptaglicious]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[tags]]></category>
		<category><![CDATA[taxonomy]]></category>

		<guid isPermaLink="false">http://www.chipstips.com/?p=186</guid>
		<description><![CDATA[Over on Chip&#8217;s Quips, I use the &#8220;daily blog posting&#8221; feature of del.icio.us to post links on my blog.&#160; These posts automatically contain links to each of the del.icio.us tags that I assigned to each link.&#160; But I also use tags in WordPress, so I wanted to have a way to combine these taxonomies (that&#8217;s [...]]]></description>
				<content:encoded><![CDATA[<div class="socialize-in-content socialize-in-content-right"><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.chipstips.com/?p=186"></g:plusone></div><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.chipstips.com/?p=186" data-text="Automatically saving del.icio.us tags as WordPress tags" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.chipstips.com%2F%3Fp%3D186&amp;send=&amp;layout=box_count&amp;width=50&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">
			<!-- 
			reddit_url = "http://www.chipstips.com/?p=186";
			reddit_title = "Automatically saving del.icio.us tags as WordPress tags";	//-->
		</script><script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">var dzone_url = "http://www.chipstips.com/?p=186";</script>
		<script type="text/javascript">var dzone_title = "Automatically saving del.icio.us tags as WordPress tags";</script>
		<script type="text/javascript">
			<!-- 
			var dzone_style = "1";
			//-->
		</script><script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script></div></div><p>Over on <a href="http://chipsquips.com">Chip&#8217;s Quips</a>, I use the &#8220;daily blog posting&#8221; feature of <a href="http://del.icio.us">del.icio.us</a> to post links on my blog.&nbsp; These posts automatically contain links to each of the del.icio.us tags that I assigned to each link.&nbsp; But I also use tags in WordPress, so I wanted to have a way to combine these taxonomies (that&#8217;s a <a href="http://www.chipsquips.com/?p=1083">megalellenicologism</a> for classification systems) automagically.</p>
<p>Hence and forthwith, I present the Taglicious plugin for WordPress (not to be confused with the <a href="http://planetozh.com/blog/2004/10/tagalicious-a-way-to-integrate-delicious/">taga.licio.us plugin for WordPress</a>), which you can download below.&nbsp; Whenever a post or page is saved, the content is scanned for any del.icio.us tags, and the corresponding WordPress tag is added to the post if it doesn&#8217;t already exist.&nbsp; There&#8217;s also a management page in the admin panel (Manage/Taglicious) that contains a single button to update all existing posts and pages.</p>
<p>The regex for detecting del.icio.us tags bears some discussion.&nbsp; It looks like this:</p>
<p><code>|&lt;a href="http://del.icio.us/(\w*/)+([^"#]*)|</code></p>
<p>(using | as the delimiter to avoid having to escape /).</p>
<p>We look first for a link to the del.icio.us site, followed by one or more word-like URL &#8220;folders&#8221;, followed by anything up to but not including an end-quote (terminating the link) or # (which is used for specifying a starting date, etc.).&nbsp; This means that <em>any </em>del.icio.us link will get translated into a tag, even if it is someone else&#8217;s link.&nbsp; So be warned.</p>
</p>
<div class="downloadbutton"><a href="http://www.chipstips.com/download/phptaglicious.zip"><img src="http://www.chipstips.com/images/download.gif"></a></div>
<p>UPDATE (8/3/2008): Changed the URL match from del.icio.us to delicious.com.</p>
<img src="http://feeds.feedburner.com/~r/ChipsTipsPhp/~4/zwvT1S9d9o4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.chipstips.com/?feed=rss2&amp;p=186</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.chipstips.com/?p=186</feedburner:origLink></item>
		<item>
		<title>OPML Blogroll widget 1.3 for WordPress adds tooltips</title>
		<link>http://feedproxy.google.com/~r/ChipsTipsPhp/~3/ZMiNrXCCtuc/</link>
		<comments>http://www.chipstips.com/?p=182#comments</comments>
		<pubDate>Thu, 17 Apr 2008 20:47:33 +0000</pubDate>
		<dc:creator>Sterling Camden</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[OPML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[RSS]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[addingajax]]></category>
		<category><![CDATA[Blogroll]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[phpopmlroll]]></category>
		<category><![CDATA[phpopmlroll13]]></category>
		<category><![CDATA[safari]]></category>
		<category><![CDATA[shelleypowers]]></category>

		<guid isPermaLink="false">http://www.chipstips.com/?p=182</guid>
		<description><![CDATA[Thanks to a suggestion from Diego, I have added tooltips to each entry in the OPML Blogroll widget for WordPress.  These tooltips display the content of the &#8220;description&#8221; attribute of each outline entry, if one exists, when the user hovers the mouse over the entry. Note that this is not an update to the OPML [...]]]></description>
				<content:encoded><![CDATA[<div class="socialize-in-content socialize-in-content-right"><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.chipstips.com/?p=182"></g:plusone></div><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.chipstips.com/?p=182" data-text="OPML Blogroll widget 1.3 for WordPress adds tooltips" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.chipstips.com%2F%3Fp%3D182&amp;send=&amp;layout=box_count&amp;width=50&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">
			<!-- 
			reddit_url = "http://www.chipstips.com/?p=182";
			reddit_title = "OPML Blogroll widget 1.3 for WordPress adds tooltips";	//-->
		</script><script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">var dzone_url = "http://www.chipstips.com/?p=182";</script>
		<script type="text/javascript">var dzone_title = "OPML Blogroll widget 1.3 for WordPress adds tooltips";</script>
		<script type="text/javascript">
			<!-- 
			var dzone_style = "1";
			//-->
		</script><script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script></div></div><p><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" src="http://chipstips.com/wp-content/images/cb20502a2268_B6BD/image03.png" border="0" alt="" width="395" height="220" /></p>
<p>Thanks to a <a href="http://www.chipstips.com/?p=159#comment-30471">suggestion</a> from <a href="http://www.profesorblog.com/">Diego</a>, I have added tooltips to each entry in the OPML Blogroll widget for WordPress.  These tooltips display the content of the &#8220;description&#8221; attribute of each outline entry, if one exists, when the user hovers the mouse over the entry.</p>
<p>Note that this is <em>not </em>an update to the <a href="http://chipstips.com/?tag=phpopmlbrowse">OPML Browser plugin</a>, although I plan to add the same feature to that plugin as well (along with a ton of other enhancements).</p>
<p>I used JavaScript to pop up and remove the Tooltips.  I decided to roll my own (with much help from Shelley Powers&#8217; book <a href="http://www.amazon.com/dp/0596529368?tag=chipsquips-20&amp;camp=0&amp;creative=0&amp;linkCode=as1&amp;creativeASIN=0596529368&amp;adid=0A4T0EQMT4C59FH7D955&amp;">Adding Ajax</a>) rather than use an existing library, in order to keep the widget lean and to avoid conflicts with other libraries that might be in use on your blog.</p>
<p>Thanks to Internet Explorer, this seemingly simple enhancement required about twice as much JavaScript code as as a Firefox/Opera/Safari-only version would have.  Here are the differences that required special code for IE:</p>
<ol>
<li>Of course, events don&#8217;t get passed to event handlers.  So you use window.event.  No big deal.</li>
<li>And we all know about addEventListener vs. attachEvent.  Not a problem, just wrap it in a function.</li>
<li>If you attach a property to a DOM object, lose the reference, and then reacquire that same element from the DOM later, it doesn&#8217;t have the property you added any more.  Apparently IE gives you a new object each time.  So in IE, this plugin has to look up the tooltip for the current item every time it wants to be displayed.</li>
<li>Not having the &#8220;currentTarget&#8221; property on the Event object in IE really sucks.  <a href="http://alex.dojotoolkit.org/?p=536">You can use &#8220;srcElement&#8221;</a>, but it isn&#8217;t the same element as &#8220;currentTarget&#8221;.  For instance, if you have a &#8220;mouseover&#8221; event on an element that contains a link around an image, &#8220;currentTarget&#8221; gives you the element on which the event was specified, whereas srcElement will give you whatever contained element the mouse was actually over.  So this plugin accesses parentNode until it finds the one that&#8217;s meaningful.</li>
</ol>
<p>Another nice &#8220;feature&#8221; of Internet Explorer keeps the tooltips from displaying at all in my theme &#8211; perhaps due to the use of float on nearby div&#8217;s.  I tried <a href="http://www.brunildo.org/test/IE_raf3.html">the fix outlined here</a> to no avail.  It does work using the WordPress default theme, though, so there is hope.  Let me know how it works with your theme.</p>
<p>I also fixed a problem with the auto-discovery link in which the ending quote on the href was missing. <img src='http://www.chipstips.com/wp-includes/images/smilies/icon_redface.gif' alt=':oops:' class='wp-smiley' /> </p>
<p>Linking to <a href="http://www.chipstips.com/?p=159">earlier</a> <a href="http://www.chipstips.com/?p=150">versions</a> for <a href="http://www.chipstips.com/?p=134">pingback</a>.</p>
<p>UPDATE: 2009-05-11: I have incorporated all the features of this widget into my <a href="http://www.chipstips.com/?p=272">OPML Browser plugin version 2.0</a>.  Please upgrade (it&#8217;s free). </p>
<p> </p>
<p> </p>
<div class="downloadbutton"><a href="http://www.chipstips.com/download/phpopmlroll13.zip"><img src="http://www.chipstips.com/images/download.gif" alt="" /></a></div>
<img src="http://feeds.feedburner.com/~r/ChipsTipsPhp/~4/ZMiNrXCCtuc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.chipstips.com/?feed=rss2&amp;p=182</wfw:commentRss>
		<slash:comments>16</slash:comments>
		<feedburner:origLink>http://www.chipstips.com/?p=182</feedburner:origLink></item>
		<item>
		<title>Chart mixer for prototyping Google Chart API</title>
		<link>http://feedproxy.google.com/~r/ChipsTipsPhp/~3/2kbCuQKqQrQ/</link>
		<comments>http://www.chipstips.com/?p=175#comments</comments>
		<pubDate>Wed, 12 Dec 2007 01:10:59 +0000</pubDate>
		<dc:creator>Sterling Camden</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[phpchart]]></category>
		<category><![CDATA[tool]]></category>

		<guid isPermaLink="false">http://www.chipstips.com/?p=175</guid>
		<description><![CDATA[In a recent article I wrote on [Geeks are Sexy] Technology News about the new Google Chart API, I mentioned that the only thing that&#8217;s not simple about this API is the data encoding. So, I set to work to remedy that and I whipped up the little tool you can download below to help [...]]]></description>
				<content:encoded><![CDATA[<div class="socialize-in-content socialize-in-content-right"><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.chipstips.com/?p=175"></g:plusone></div><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.chipstips.com/?p=175" data-text="Chart mixer for prototyping Google Chart API" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.chipstips.com%2F%3Fp%3D175&amp;send=&amp;layout=box_count&amp;width=50&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">
			<!-- 
			reddit_url = "http://www.chipstips.com/?p=175";
			reddit_title = "Chart mixer for prototyping Google Chart API";	//-->
		</script><script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">var dzone_url = "http://www.chipstips.com/?p=175";</script>
		<script type="text/javascript">var dzone_title = "Chart mixer for prototyping Google Chart API";</script>
		<script type="text/javascript">
			<!-- 
			var dzone_style = "1";
			//-->
		</script><script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script></div></div><p><img style="WIDTH: 200px; HEIGHT: 150px" alt="Sample chart" hspace="10" src="http://chart.apis.google.com/chart?chd=s:KUeoy9&amp;cht=p3&amp;chs=200x150&amp;chco=ff0000,ffff00,00ff00,00ffff,0000ff,ff00ff" align="left" border="0" />In a recent <a href="http://www.geeksaresexy.net/2007/12/06/google-publishes-chart-api-for-web-pages/">article I wrote on [Geeks are Sexy] Technology News about the new Google Chart API</a>, I mentioned that the only thing that&#8217;s not simple about this API is the data encoding.  So, I set to work to remedy that and I whipped up the little tool you can download below to help prototype Google charts and generate the URL.</p>
<p>It doesn&#8217;t include all of the options in the API, but I did provide an &#8220;Additional qualifiers&#8221; field where you can append anything you want to the chart&#8217;s URL.</p>
<p>For now, it only supports Simple Encoding.  I may add Text and Extended Encoding at some point in the future.</p>
<p>Next in line is to add some JavaScript to make this more interactive, as well as to wrap the Chart object in a WordPress plugin.</p>
<p>You can see this in action (and use it all you want) at <a href="http://chipstips.com/demo/chartmixer.php">http://chipstips.com/demo/chartmixer.php</a>.</p>
<div class="downloadbutton"><a href="http://www.chipstips.com/download/phpchart.zip"><img src="http://www.chipstips.com/images/download.gif" /></a></div>
<img src="http://feeds.feedburner.com/~r/ChipsTipsPhp/~4/2kbCuQKqQrQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.chipstips.com/?feed=rss2&amp;p=175</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://www.chipstips.com/?p=175</feedburner:origLink></item>
		<item>
		<title>WiPeD away the class constants for PHP 4 compatibility</title>
		<link>http://feedproxy.google.com/~r/ChipsTipsPhp/~3/lO8WaPAkCs0/</link>
		<comments>http://www.chipstips.com/?p=174#comments</comments>
		<pubDate>Thu, 15 Nov 2007 18:06:21 +0000</pubDate>
		<dc:creator>Sterling Camden</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Wildly popular]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[php4]]></category>
		<category><![CDATA[phpwpd]]></category>
		<category><![CDATA[phpwpd12]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[tonypeak]]></category>

		<guid isPermaLink="false">http://www.chipstips.com/?p=174</guid>
		<description><![CDATA[Tony Peak (aka Rirath) helped to identify an incompatibility with PHP version 4 in my WiPeD plugin for WordPress.&#160; Now, if back-porting to version 4 had involved a major rewrite I would have said &#8220;Routta Ruck, Rirath&#8221; &#8212; but it turned out to be pretty easy.&#160; I had used class constants for the values in [...]]]></description>
				<content:encoded><![CDATA[<div class="socialize-in-content socialize-in-content-right"><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.chipstips.com/?p=174"></g:plusone></div><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.chipstips.com/?p=174" data-text="WiPeD away the class constants for PHP 4 compatibility" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.chipstips.com%2F%3Fp%3D174&amp;send=&amp;layout=box_count&amp;width=50&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">
			<!-- 
			reddit_url = "http://www.chipstips.com/?p=174";
			reddit_title = "WiPeD away the class constants for PHP 4 compatibility";	//-->
		</script><script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">var dzone_url = "http://www.chipstips.com/?p=174";</script>
		<script type="text/javascript">var dzone_title = "WiPeD away the class constants for PHP 4 compatibility";</script>
		<script type="text/javascript">
			<!-- 
			var dzone_style = "1";
			//-->
		</script><script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script></div></div><p>Tony Peak (aka <a href="http://www.twiddlegeek.com/">Rirath</a>) helped to identify an incompatibility with PHP version 4 in my <a href="http://www.chipstips.com/?p=172">WiPeD plugin for WordPress</a>.&nbsp; Now, if back-porting to version 4 had involved a major rewrite I would have said &#8220;Routta Ruck, Rirath&#8221; &#8212; but it turned out to be pretty easy.&nbsp; I had used class constants for the values in the database fields to indicate types of entries, and class constants weren&#8217;t supported in PHP 4.&nbsp; Luckily, there&#8217;s a simple replacement:&nbsp; define.&nbsp; So, if you want to debug WordPress on PHP 4, download version 1.2 below.</p>
<p><a href="http://www.chipstips.com/download/phpwpd12.zip"><img src="http://www.chipstips.com/images/download.gif"></a></p>
<img src="http://feeds.feedburner.com/~r/ChipsTipsPhp/~4/lO8WaPAkCs0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.chipstips.com/?feed=rss2&amp;p=174</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.chipstips.com/?p=174</feedburner:origLink></item>
		<item>
		<title>WiPeD out trying to debug WordPress XMLRPC</title>
		<link>http://feedproxy.google.com/~r/ChipsTipsPhp/~3/25ftGfi8mPc/</link>
		<comments>http://www.chipstips.com/?p=172#comments</comments>
		<pubDate>Mon, 15 Oct 2007 12:40:15 +0000</pubDate>
		<dc:creator>Sterling Camden</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Wildly popular]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[metaweblogapi]]></category>
		<category><![CDATA[phpwpd]]></category>
		<category><![CDATA[phpwpd11]]></category>
		<category><![CDATA[xmlrpc]]></category>

		<guid isPermaLink="false">http://www.chipstips.com/?p=172</guid>
		<description><![CDATA[So I was coding along one fine day, happily using my WiPeD debugger for WordPress, when I suddenly stumbled on a problem with it.&#160; I was attempting to debug a function that was hooked to an action that was&#160;supposed to be&#160;triggered by the MetaWebLog API (&#8216;save_post&#8217;, when posting from a blog authoring tool), and none [...]]]></description>
				<content:encoded><![CDATA[<div class="socialize-in-content socialize-in-content-right"><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.chipstips.com/?p=172"></g:plusone></div><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.chipstips.com/?p=172" data-text="WiPeD out trying to debug WordPress XMLRPC" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.chipstips.com%2F%3Fp%3D172&amp;send=&amp;layout=box_count&amp;width=50&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">
			<!-- 
			reddit_url = "http://www.chipstips.com/?p=172";
			reddit_title = "WiPeD out trying to debug WordPress XMLRPC";	//-->
		</script><script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">var dzone_url = "http://www.chipstips.com/?p=172";</script>
		<script type="text/javascript">var dzone_title = "WiPeD out trying to debug WordPress XMLRPC";</script>
		<script type="text/javascript">
			<!-- 
			var dzone_style = "1";
			//-->
		</script><script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script></div></div><p>So I was coding along one fine day, happily using my <a href="http://www.chipstips.com/?p=170">WiPeD debugger for WordPress</a>, when I suddenly stumbled on a problem with it.&nbsp; I was attempting to debug a function that was hooked to an action that was&nbsp;supposed to be&nbsp;triggered by the MetaWebLog API (&#8216;save_post&#8217;, when posting from a blog authoring tool), and none of my debug messages were being displayed!&nbsp; Suddenly the heel of my hand went *bonk* on my forehead &#8212; of course I couldn&#8217;t&nbsp;retrieve any messages from XMLRPC processing, because I was saving the messages in a session variable, and&nbsp;the client in that case is my authoring tool instead of my browser &#8211;&nbsp;so the sessions aren&#8217;t the same.&nbsp; Duh, time to rethink.</p>
<p>The downloadable version below saves the debug messages to the database instead of to a session variable.&nbsp; Obviously, that means that multiple users will mix their output in the log.&nbsp; Of course, you&#8217;d expect to be debugging on a private site, but just in case I added an options page where you can exclude users based on their capabilities &#8212; with the default being &#8216;level_9&#8242; (administrators only).&nbsp; I also added options to allow you to customize when the debug log is displayed, as well as when it&#8217;s cleared.&nbsp; Spin it up, and check out the Readme-WiPeD.txt file.</p>
<p><a href="http://www.chipstips.com/download/phpwpd11.zip"><img src="http://www.chipstips.com/images/download.gif"></a></p>
<p>UPDATE:  get the latest version <a href="http://www.chipstips.com/?p=174">here</a>.</p>
<img src="http://feeds.feedburner.com/~r/ChipsTipsPhp/~4/25ftGfi8mPc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.chipstips.com/?feed=rss2&amp;p=172</wfw:commentRss>
		<slash:comments>10</slash:comments>
		<feedburner:origLink>http://www.chipstips.com/?p=172</feedburner:origLink></item>
		<item>
		<title>More OPML Browser corrections</title>
		<link>http://feedproxy.google.com/~r/ChipsTipsPhp/~3/vqcEH3PwRiA/</link>
		<comments>http://www.chipstips.com/?p=171#comments</comments>
		<pubDate>Wed, 26 Sep 2007 21:19:04 +0000</pubDate>
		<dc:creator>Sterling Camden</dc:creator>
				<category><![CDATA[OPML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[phpopmlbrowse]]></category>
		<category><![CDATA[phpopmlbrowse13]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[shackdougall]]></category>
		<category><![CDATA[widget]]></category>

		<guid isPermaLink="false">http://www.chipstips.com/?p=171</guid>
		<description><![CDATA[Shack Dougall spotted several HTML coding errors in the latest verion of my OPML Browser plugin.&#160; Get the version 1.3 below. Pingbacks to previous posts.]]></description>
				<content:encoded><![CDATA[<div class="socialize-in-content socialize-in-content-right"><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.chipstips.com/?p=171"></g:plusone></div><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.chipstips.com/?p=171" data-text="More OPML Browser corrections" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.chipstips.com%2F%3Fp%3D171&amp;send=&amp;layout=box_count&amp;width=50&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">
			<!-- 
			reddit_url = "http://www.chipstips.com/?p=171";
			reddit_title = "More OPML Browser corrections";	//-->
		</script><script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">var dzone_url = "http://www.chipstips.com/?p=171";</script>
		<script type="text/javascript">var dzone_title = "More OPML Browser corrections";</script>
		<script type="text/javascript">
			<!-- 
			var dzone_style = "1";
			//-->
		</script><script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script></div></div><p><a href="http://liferain.com/">Shack Dougall</a> spotted <a href="http://www.chipstips.com/?p=169#comments">several HTML coding errors</a> in the latest verion of my OPML Browser plugin.&nbsp; Get the version 1.3 below.</p>
<p><a href="http://chipstips.com/?p=169">Pingbacks</a> <a href="http://chipstips.com/?p=162">to</a> <a href="http://chipstips.com/?p=161">previous</a> <a href="http://chipstips.com/?p=159">posts</a>.</p>
<p><a href="http://www.chipstips.com/download/phpopmlbrowse13.zip"><img src="http://www.chipstips.com/images/download.gif"></a></p>
<img src="http://feeds.feedburner.com/~r/ChipsTipsPhp/~4/vqcEH3PwRiA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.chipstips.com/?feed=rss2&amp;p=171</wfw:commentRss>
		<slash:comments>25</slash:comments>
		<feedburner:origLink>http://www.chipstips.com/?p=171</feedburner:origLink></item>
		<item>
		<title>Wiping the mystery out of WordPress debugging</title>
		<link>http://feedproxy.google.com/~r/ChipsTipsPhp/~3/c0csCl0W8dE/</link>
		<comments>http://www.chipstips.com/?p=170#comments</comments>
		<pubDate>Tue, 25 Sep 2007 00:33:52 +0000</pubDate>
		<dc:creator>Sterling Camden</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Wildly popular]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[phpwpd]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[printf]]></category>
		<category><![CDATA[themes]]></category>

		<guid isPermaLink="false">http://www.chipstips.com/?p=170</guid>
		<description><![CDATA[Speaking of the deficiencies of PHP, another one is the complete lack of built-in debugging capabilities.&#160; Sure, you can find debuggers for PHP, if you&#8217;ve got the time and ability to configure them on your server.&#160; I guess if I was really serious about PHP I&#8217;d have to get one of those, but so far [...]]]></description>
				<content:encoded><![CDATA[<div class="socialize-in-content socialize-in-content-right"><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.chipstips.com/?p=170"></g:plusone></div><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.chipstips.com/?p=170" data-text="Wiping the mystery out of WordPress debugging" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.chipstips.com%2F%3Fp%3D170&amp;send=&amp;layout=box_count&amp;width=50&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">
			<!-- 
			reddit_url = "http://www.chipstips.com/?p=170";
			reddit_title = "Wiping the mystery out of WordPress debugging";	//-->
		</script><script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">var dzone_url = "http://www.chipstips.com/?p=170";</script>
		<script type="text/javascript">var dzone_title = "Wiping the mystery out of WordPress debugging";</script>
		<script type="text/javascript">
			<!-- 
			var dzone_style = "1";
			//-->
		</script><script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script></div></div><p><a href="http://sob.apotheon.org/?p=305">Speaking</a> of the <a href="http://www.chipstips.com/?p=168">deficiencies of PHP</a>, another one is the complete lack of built-in debugging capabilities.&nbsp; Sure, you can find <a href="http://sourceforge.net/project/showfiles.php?group_id=75605">debuggers</a> <a href="http://www.nusphere.com/products/php_debugger.htm">for</a> <a href="http://dd.cron.ru/dbg/">PHP</a>, if you&#8217;ve got the time and ability to configure them on your server.&nbsp; I guess if I was really serious about PHP I&#8217;d have to get one of those, but so far I only use PHP for WordPress customization, so it hardly seems worth the effort.</p>
<p>Some people will tell you that you shouldn&#8217;t need a debugger.&nbsp; That it&#8217;s a sign of lazy programming.&nbsp; But PHP has so many pitfalls, and WordPress has so many actions and interactions between plugins and themes provided by so many different developers, that I think you&#8217;re excused if you need a little help figuring out just what the heck is going on in your code.</p>
<p>When writing a plugin or modifying a theme for WordPress, usually all I need to know is the order of events and the values in various variables.&nbsp; Sometimes you can get away with inserting &#8220;echo&#8221; statements in your code &#8212; but sometimes you can&#8217;t, like when your code executes ahead of&nbsp;a &#8220;wp_head&#8221; action that wants to add headers.&nbsp; Besides, randomly placed &#8220;echo&#8221; statements can easily get lost from view in the whirl of words and images that comprise your theme and content.</p>
<p>So, I developed a simple little plugin that collects debug statements and prints them out nicely above the footer of your theme, or below the admin footer, whichever gets executed first.&nbsp; I call it WiPeD, for &#8220;WordPress Printf Debugger&#8221;.&nbsp; Anywhere in your code, you can call WPD_print() and pass it whatever text you want to output.&nbsp; The lines of text are aggregated in a session variable until they are output together (in separate divs, surrounded by a single containing div).&nbsp; Thus you can use styling to set the messages off from the rest of your blog, if you desire.</p>
<p>Here&#8217;s an example, from a project I&#8217;m currently working on.&nbsp; My plugin was producing no results, and I couldn&#8217;t figure out why.&nbsp; So I added some calls to WPD_print():</p>
<p><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="207" src="http://chipstips.com/wp-content/images/WipingthemysteryoutofWordPressdebugging_FBC8/image03.png" width="602" border="0"> </p>
<p>Then, when I executed the code to trigger this action, here&#8217;s what I saw at the bottom of my page:</p>
<p><img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="253" src="http://chipstips.com/wp-content/images/WipingthemysteryoutofWordPressdebugging_FBC8/image07.png" width="451" border="0"> </p>
<p>That tells me that I got into my function and passed the tests, but the post has no content at that point.&nbsp; Now I just need to figure out why.</p>
<p>See the enclosed readme file for more details.&nbsp; Have fun&nbsp;debugging your PHP!</p>
<p>UPDATE: get an updated version <a href="http://www.chipstips.com/?p=174">here</a>.</p>
<p><a href="http://www.chipstips.com/download/phpwpd.zip"><img src="http://www.chipstips.com/images/download.gif"></a></p>
<img src="http://feeds.feedburner.com/~r/ChipsTipsPhp/~4/c0csCl0W8dE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.chipstips.com/?feed=rss2&amp;p=170</wfw:commentRss>
		<slash:comments>19</slash:comments>
		<feedburner:origLink>http://www.chipstips.com/?p=170</feedburner:origLink></item>
		<item>
		<title>OPML browsing just got better</title>
		<link>http://feedproxy.google.com/~r/ChipsTipsPhp/~3/kX_GJDW_kBo/</link>
		<comments>http://www.chipstips.com/?p=169#comments</comments>
		<pubDate>Sat, 22 Sep 2007 21:21:03 +0000</pubDate>
		<dc:creator>Sterling Camden</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[OPML]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[Wildly popular]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[feeddemon]]></category>
		<category><![CDATA[markbarnes]]></category>
		<category><![CDATA[phpopmlbrowse]]></category>
		<category><![CDATA[phpopmlbrowse12]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[tdavid]]></category>
		<category><![CDATA[tonylindskog]]></category>
		<category><![CDATA[widget]]></category>

		<guid isPermaLink="false">http://www.chipstips.com/?p=169</guid>
		<description><![CDATA[Version 1.2 of the OPML Browser plugin for WordPress has just been released!  This version includes some significant upgrades, including: You may now have up to 9 opml-browser widgets. When upgrading, the options from your existing opml-browser widget are copied to the first opml-browser widget.  Thanks to Mark Barnes for suggesting this enhancement. The option [...]]]></description>
				<content:encoded><![CDATA[<div class="socialize-in-content socialize-in-content-right"><div class="socialize-in-button socialize-in-button-right"><g:plusone size="tall" href="http://www.chipstips.com/?p=169"></g:plusone></div><div class="socialize-in-button socialize-in-button-right"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://www.chipstips.com/?p=169" data-text="OPML browsing just got better" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-right"><iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.chipstips.com%2F%3Fp%3D169&amp;send=&amp;layout=box_count&amp;width=50&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=arial&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:65px;" allowTransparency="true"></iframe></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">
			<!-- 
			reddit_url = "http://www.chipstips.com/?p=169";
			reddit_title = "OPML browsing just got better";	//-->
		</script><script type="text/javascript" src="http://www.reddit.com/static/button/button2.js"></script></div><div class="socialize-in-button socialize-in-button-right"><script type="text/javascript">var dzone_url = "http://www.chipstips.com/?p=169";</script>
		<script type="text/javascript">var dzone_title = "OPML browsing just got better";</script>
		<script type="text/javascript">
			<!-- 
			var dzone_style = "1";
			//-->
		</script><script language="javascript" src="http://widgets.dzone.com/links/widgets/zoneit.js"></script></div></div><p>Version 1.2 of the OPML Browser plugin for WordPress has just been released!  This version includes some significant upgrades, including:</p>
<ol>
<li>You may now have up to 9 opml-browser widgets. When upgrading, the options from your existing opml-browser widget are copied to the first opml-browser widget.  Thanks to <a href="http://www.4-14.org.uk/">Mark Barnes</a> for <a href="http://www.chipstips.com/?p=159#comment-12363">suggesting</a> this enhancement.</li>
<li>The option to exclude your domain now ignores differences in case when comparing domain names.  Thanks to <a href="http://www.wpviews.info/">Tony Lindskog</a> for <a href="http://www.chipstips.com/?p=162#comment-14795">finding</a> that one.</li>
<li>You can now override the title for the OPML link by entering text into the &#8220;OPML title override&#8221; field.  I didn&#8217;t want mine to read &#8220;FeedDemon Subscriptions&#8221;, so I added that for myself.</li>
<li>Added the ability to embed the browser within a page or post using a special [ opml-browser ] element in the text.  See the readme.</li>
<li>Added a &#8220;Get this widget&#8221; link at the bottom of the widget.  Thanks to <a href="http://makeyougohmm.com">TDavid</a> for suggesting that little bit of self-promotion.</li>
</ol>
<p>Download version 1.2 via the button below.  Pinging <a href="http://www.chipstips.com/?p=134">back</a> <a href="http://www.chipstips.com/?p=150">to</a> <a href="http://www.chipstips.com/?p=159">all</a> <a href="http://www.chipstips.com/?p=161">previous</a> <a href="http://www.chipstips.com/?p=162">posts</a> for those following comments.</p>
<p>UPDATE: More corrections <a href="http://www.chipstips.com/?p=171">here</a>.</p>
<div class="downloadbutton"><a href="http://www.chipstips.com/download/phpopmlbrowse12.zip"><img src="http://www.chipstips.com/images/download.gif" alt="" /></a></div>
<img src="http://feeds.feedburner.com/~r/ChipsTipsPhp/~4/kX_GJDW_kBo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.chipstips.com/?feed=rss2&amp;p=169</wfw:commentRss>
		<slash:comments>22</slash:comments>
		<feedburner:origLink>http://www.chipstips.com/?p=169</feedburner:origLink></item>
	</channel>
</rss>
