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

<channel>
	<title>Nazgul on WordPress</title>
	<atom:link href="http://wordpress.nazgul.nu/feed/" rel="self" type="application/rss+xml" />
	<link>http://wordpress.nazgul.nu</link>
	<description>Bits about WordPress</description>
	<lastBuildDate>Sat, 29 Mar 2008 19:20:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2-bleeding</generator>
		<item>
		<title>WordPress 2.5</title>
		<link>http://wordpress.nazgul.nu/2008/03/29/wordpress-25/</link>
		<comments>http://wordpress.nazgul.nu/2008/03/29/wordpress-25/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 19:20:48 +0000</pubDate>
		<dc:creator>Nazgul</dc:creator>
				<category><![CDATA[Releases]]></category>
		<category><![CDATA[2.5]]></category>

		<guid isPermaLink="false">http://wordpress.nazgul.nu/?p=15</guid>
		<description><![CDATA[As you may, or may not, have noticed, WordPress 2.5 was released earlier today. This release has some large changes including, but not limited to: New admin interface Multi file upload Automatic plugin updates Built in galleries And much, much more... For a more complete list, I'd suggest looking at the release notes. A big [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start -->
<p>As you may, or may not, have noticed, WordPress 2.5 was released earlier today.</p>
<p>This release has some large changes including, but not limited to:</p>
<ul>
<li>New admin interface</li>
<li>Multi file upload</li>
<li>Automatic plugin updates</li>
<li>Built in galleries</li>
<li>And much, much more...</li>
</ul>
<p>For a more complete list, I'd suggest looking at the <a href="http://wordpress.org/development/2008/03/wordpress-25-brecker/" class="liexternal">release notes</a>.</p>
<p>A big thank you to <a href="http://blog.ftwr.co.uk/archives/2008/03/29/wordpress-25-contributors/" class="liexternal">all those people</a> that contributed to this release.</p>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://wordpress.nazgul.nu/2008/03/29/wordpress-25/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress GSoC (Backup-)Mentor</title>
		<link>http://wordpress.nazgul.nu/2008/03/04/wordpress-gsoc-backup-mentor/</link>
		<comments>http://wordpress.nazgul.nu/2008/03/04/wordpress-gsoc-backup-mentor/#comments</comments>
		<pubDate>Tue, 04 Mar 2008 19:02:17 +0000</pubDate>
		<dc:creator>Nazgul</dc:creator>
				<category><![CDATA[General]]></category>
		<category><![CDATA[GSoC]]></category>

		<guid isPermaLink="false">http://wordpress.nazgul.nu/?p=14</guid>
		<description><![CDATA[Ok, it happened... Lloyd convinced me to sign up as a Mentor for the WordPress application to the Google Summer of Code (GSoC) 2008. For now it's only as a backup mentor because I don't know what work is going to do around the summer, but I'm still pretty excited.]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start -->
<p>Ok, it happened... <a href="http://foolswisdom.com/" class="liexternal">Lloyd</a> convinced me to sign up as a Mentor for the <a href="http://codex.wordpress.org/GSoC2008" class="liexternal">WordPress application to the Google Summer of Code (GSoC) 2008</a>.</p>
<p>For now it's only as a backup mentor because I don't know what work is going to do around the summer, but I'm still pretty excited.</p>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://wordpress.nazgul.nu/2008/03/04/wordpress-gsoc-backup-mentor/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress 2.3.3</title>
		<link>http://wordpress.nazgul.nu/2008/02/09/wordpress-233/</link>
		<comments>http://wordpress.nazgul.nu/2008/02/09/wordpress-233/#comments</comments>
		<pubDate>Sat, 09 Feb 2008 08:13:11 +0000</pubDate>
		<dc:creator>Nazgul</dc:creator>
				<category><![CDATA[Releases]]></category>

		<guid isPermaLink="false">http://wordpress.nazgul.nu/?p=13</guid>
		<description><![CDATA[A few days ago WordPress 2.3.3 was released. If you're running the 2.3 branch of WordPress it's a required update, as it fixes a security issue (among other things) For the issue to be exploitable. the bad guy would need an account on your blog (even if it's just subscriber). When he has an account [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start -->
<p>A few days ago <a href="http://wordpress.org/development/2008/02/wordpress-233/" class="liexternal">WordPress 2.3.3 was released</a>.</p>
<p>If you're running the 2.3 branch of WordPress it's a required update, as it fixes a security issue (among <a href="http://trac.wordpress.org/query?status=closed&milestone=2.3.3" class="liexternal">other things</a>)</p>
<p>For the issue to be exploitable. the bad guy would need an account on your blog (even if it's just subscriber). When he has an account he can change the content of any post on your blog. (Inserting a malicious ifame is what we've seen most so far)</p>
<p>So to summerize this post in one word: <strong>UPGRADE</strong>.</p>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://wordpress.nazgul.nu/2008/02/09/wordpress-233/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ideas for 2.4</title>
		<link>http://wordpress.nazgul.nu/2007/09/26/ideas-for-24/</link>
		<comments>http://wordpress.nazgul.nu/2007/09/26/ideas-for-24/#comments</comments>
		<pubDate>Wed, 26 Sep 2007 21:58:21 +0000</pubDate>
		<dc:creator>Nazgul</dc:creator>
				<category><![CDATA[Features & Bugs]]></category>
		<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://wordpress.nazgul.nu/2007/09/26/ideas-for-24/</guid>
		<description><![CDATA[The first post 2.3 IRC meetup just took place. It was a very constructive meeting in which we discussed a few of the things we want to accomplish for version 2.4. A few of the proposed things that I like: Implement the usage of $wpdb->prepare. (improves security) Use jQuery for our AJAX (Asynchronous Javascript And [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start -->
<p>The first <a href="http://codex.wordpress.org/IRC_Meetups" class="liexternal">post 2.3 IRC meetup</a> just took place. It was a very constructive meeting in which we discussed a few of the things we want to accomplish for version 2.4.</p>
<p>A few of the proposed things that I like:</p>
<ul>
<li>Implement the usage of $wpdb->prepare. (improves security)</li>
<li>Use jQuery for our <span class="ubernym uttAcronym" onmouseover="domTT_activate(this, event, 'content', 'How we make web-pages truly dynamic','caption', 'Asynchronous Javascript And XML' );"><acronym class="uttAcronym">AJAX</acronym></span> (Asynchronous Javascript And <a href="http://www.w3.org/XML/" class="ubernym uttInitialism" onmouseover="domTT_activate(this, event, 'content', 'eXtensible Markup Language' );"><abbr class="uttInitialism">XML</abbr></a>) stuff</li>
<li>Admin interface redesign</li>
<li>Basic undo functionality</li>
<li>...</li>
</ul>
<p>A complete transcript of the meeting can be found <a href="http://codex.wordpress.org/IRC_Meetups/2007/September/September26RawLog" class="liexternal">here</a>.</p>
<p>It's too early to really comment on any of the stuff, but I like the general direction.</p>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://wordpress.nazgul.nu/2007/09/26/ideas-for-24/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress 2.3</title>
		<link>http://wordpress.nazgul.nu/2007/09/25/wordpress-23/</link>
		<comments>http://wordpress.nazgul.nu/2007/09/25/wordpress-23/#comments</comments>
		<pubDate>Tue, 25 Sep 2007 17:56:29 +0000</pubDate>
		<dc:creator>Nazgul</dc:creator>
				<category><![CDATA[Releases]]></category>

		<guid isPermaLink="false">http://wordpress.nazgul.nu/2007/09/25/wordpress-23/</guid>
		<description><![CDATA[As you've probably noticed, version 2.3 of WordPress has been released to the general public. Next to the new features which I blogged about before, we welcome native tagging, update notifications, canonical URLs, pending review and a lot of other big and small changes. Take a look at the 2.3 codex page for an overview. [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start -->
<p>As you've probably noticed, version 2.3 of WordPress has <a href="http://wordpress.org/development/2007/09/wordpress-23/" class="liexternal">been released</a> to the general public.</p>
<p>Next to the new features which I blogged about before, we welcome native tagging, update notifications, canonical URLs, pending review and <a href="http://trac.wordpress.org/query?status=closed&type=enhancement&milestone=2.3&resolution=fixed&order=priority" class="liexternal">a lot of other big and small changes</a>. Take a look at <a href="http://codex.wordpress.org/Version_2.3" class="liexternal">the 2.3 codex page</a> for an overview.</p>
<p>As this blog has been running pre-releases of 2.3 for some time, all the issues I had during upgrades have been fixed in the final version. So upgrading should be relatively pain free. There is a catch with <a href="http://codex.wordpress.org/Plugins/Plugin_Compatibility/2.3" class="liexternal">plugins</a> and <a href="http://codex.wordpress.org/Themes/Theme_Compatibility/2.3" class="liexternal">themes</a> that reference the now defunct categories (and link2cat and post2cat) tables. They will break your blog. So as always, disable all plugins before upgrading and activate them one by one afterwards to see if they cause issues. Most of those plugins have newer versions which are compatible with 2.3 and if they haven't, notify the author so he can make one.</p>
<p>Another issue that's popped up for a small group of upgraders is that they're unable to log into their blog after upgrading. If you experience this issue please report <a href="http://trac.wordpress.org/ticket/5076" class="liexternal">here</a>, so we can pinpoint what's causing it and fix it!</p>
<p>All in all the first reactions to 2.3 are <a href="http://comox.textdrive.com/pipermail/wp-hackers/2007-September/014989.html" class="liexternal">positive</a> although some <a href="http://yro.slashdot.org/article.pl?sid=07/09/25/1632246" class="liexternal">negative</a> remarks are to be expected as well. I personally believe the positive things outweigh the negative things by far, so I'm quite pleased with the new release.</p>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://wordpress.nazgul.nu/2007/09/25/wordpress-23/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New in 2.3: Unfiltered upload</title>
		<link>http://wordpress.nazgul.nu/2007/09/16/new-in-23-unfiltered-upload/</link>
		<comments>http://wordpress.nazgul.nu/2007/09/16/new-in-23-unfiltered-upload/#comments</comments>
		<pubDate>Sun, 16 Sep 2007 18:15:50 +0000</pubDate>
		<dc:creator>Nazgul</dc:creator>
				<category><![CDATA[Features & Bugs]]></category>
		<category><![CDATA[2.3]]></category>
		<category><![CDATA[new feature]]></category>
		<category><![CDATA[unfiltered_upload]]></category>

		<guid isPermaLink="false">http://wordpress.nazgul.nu/2007/09/16/new-in-23-unfiltered-upload/</guid>
		<description><![CDATA[Another article on a new feature in the soon to be released 2.3 version. This time we'll be talking about something new called Unfiltered upload. Let's take the following scenario: We wan't to write an article about something (we'll use geocaching in this example) and want to suplement that post with a file (gpx in [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start -->
<p>Another article on a new feature in the soon to be released 2.3 version. This time we'll be talking about something new called <em>Unfiltered upload</em>.</p>
<p>Let's take the following scenario: We wan't to write an article about something (we'll use geocaching in this example) and want to suplement that post with a file (gpx in this case) that your users can download and use.<br />
Our first step would be to go to the <em>Write Post</em> screen, start typing and upload that file using the build-in uploader:</p>
<p><img src='http://wordpress.nazgul.nu/wp-content/uploads/2007/09/upload1.JPG' alt='Upload file' /></p>
<p style="clear:left">In the 2.2.x version (and earlier) when we press <em>Upload</em> we get the following result:</p>
<p><img src='http://wordpress.nazgul.nu/wp-content/uploads/2007/09/upload2.jpg' alt='Upload file failed' /></p>
<p style="clear:left">Due to security reasons we're only allowed to upload a pre-defined list of file types. And that's a <em>Good thing &trade;</em>. You wouldn't want a Contributer for instance to be able to upload a <a href="http://www.php.net" class="ubernym uttInitialism" onmouseover="domTT_activate(this, event, 'content', 'PHP: Hypertext Preprocessor' );"><abbr class="uttInitialism">PHP</abbr></a> file and take over your blog, or worse, your machine. Looking at the 2.3 sources shows us that the following types of files are allowed:</p>
<pre code="php">$mimes = is_array($mimes) ? $mimes : apply_filters('upload_mimes', array (
	'jpg|jpeg|jpe' => 'image/jpeg',
	'gif' => 'image/gif',
	'png' => 'image/png',
	'bmp' => 'image/bmp',
	'tif|tiff' => 'image/tiff',
	'ico' => 'image/x-icon',
	'asf|asx|wax|wmv|wmx' => 'video/asf',
	'avi' => 'video/avi',
	'mov|qt' => 'video/quicktime',
	'mpeg|mpg|mpe' => 'video/mpeg',
	'txt|c|cc|h' => 'text/plain',
	'rtx' => 'text/richtext',
	'css' => 'text/css',
	'htm|html' => 'text/html',
	'mp3|mp4' => 'audio/mpeg',
	'ra|ram' => 'audio/x-realaudio',
	'wav' => 'audio/wav',
	'ogg' => 'audio/ogg',
	'mid|midi' => 'audio/midi',
	'wma' => 'audio/wma',
	'rtf' => 'application/rtf',
	'js' => 'application/javascript',
	'pdf' => 'application/pdf',
	'doc' => 'application/msword',
	'pot|pps|ppt' => 'application/vnd.ms-powerpoint',
	'wri' => 'application/vnd.ms-write',
	'xla|xls|xlt|xlw' => 'application/vnd.ms-excel',
	'mdb' => 'application/vnd.ms-access',
	'mpp' => 'application/vnd.ms-project',
	'swf' => 'application/x-shockwave-flash',
	'class' => 'application/java',
	'tar' => 'application/x-tar',
	'zip' => 'application/zip',
	'gz|gzip' => 'application/x-gzip',
	'exe' => 'application/x-msdownload',
	// openoffice formats
	'odt' => 'application/vnd.oasis.opendocument.text',
	'odp' => 'application/vnd.oasis.opendocument.presentation',
	'ods' => 'application/vnd.oasis.opendocument.spreadsheet',
	'odg' => 'application/vnd.oasis.opendocument.graphics',
	'odc' => 'application/vnd.oasis.opendocument.chart',
	'odb' => 'application/vnd.oasis.opendocument.database',
	'odf' => 'application/vnd.oasis.opendocument.formula',
));</pre>
<p>But I do want to attach that gpx file to that post. I know it's safe. So how can I do this? That's where unfiltered uploads come into play. Version 2.3 introduces a new capability which let's you upload any type of file you want. But for security reasons that capability is by default only given to users in the Administrators role. So if I try the previous as an Administrator in 2.3 I get the following screen:</p>
<p><img src='http://wordpress.nazgul.nu/wp-content/uploads/2007/09/upload3.jpg' alt='Upload file succeeded' /></p>
<p style="clear:left">That's in short what the new unfiltered_upload capability does.</p>
<p>Please note that if you use a certain filetype often, but don't want to give the unfiltered_upload capability to somebody, try the <a href="http://blog.ftwr.co.uk/wordpress/mime-config/" class="liexternal">WordPress mime-config</a> plugin. It allows you to extend the default list of allowed file types.</p>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://wordpress.nazgul.nu/2007/09/16/new-in-23-unfiltered-upload/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>New in 2.3: Importer Plugins</title>
		<link>http://wordpress.nazgul.nu/2007/09/14/new-in-23-importer-plugins/</link>
		<comments>http://wordpress.nazgul.nu/2007/09/14/new-in-23-importer-plugins/#comments</comments>
		<pubDate>Fri, 14 Sep 2007 11:00:55 +0000</pubDate>
		<dc:creator>Nazgul</dc:creator>
				<category><![CDATA[Features & Bugs]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[2.3]]></category>
		<category><![CDATA[importer]]></category>
		<category><![CDATA[new feature]]></category>
		<category><![CDATA[plugin]]></category>

		<guid isPermaLink="false">http://wordpress.nazgul.nu/2007/09/14/new-in-23-importer-plugins/</guid>
		<description><![CDATA[Eventhough WordPress 2.3 hasn't yet been released to the general public at the moment I'm writing this, I'd like to do one or more posts on some of the new features that went into 2.3. Although tagging is propably the biggest new addition, everybody is already blogging about it, or will be. So I'll be [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start -->
<p>Eventhough WordPress 2.3 hasn't yet been released to the general public at the moment I'm writing this, I'd like to do one or more posts on some of the new features that went into 2.3. Although tagging is propably the biggest new addition, everybody is already blogging about it, or will be. So I'll be concentrating one some smaller, but still very usefull new features.</p>
<p>In this post, that will be Importer Plugins. What are Importer Plugins? As most of you know, WordPress comes with a set of importers which can be used to import data from other formats/blogs into your blog. (Think DotClear, Blogger and many more) But there are many more systems out there which don't have importers that are build into WordPress. That's where plugins come in. A plugin can be used to extend the default WordPress behaviour and starting with 2.3 can also be used to add your own importer to WordPress.</p>
<p>So how do you create such a Importer Plugin? Let's build one step by step. We start with an empty plugin template. (For basic information on writing plugins I recommend reading the Codex <a href="http://codex.wordpress.org/Writing_a_Plugin" class="liexternal">Writing a Plugin</a> article or <a href="http://wpbits.wordpress.com/2007/06/18/writing-wordpress-plugin-widget-loader/" class="liexternal">this tutorial by Leonid Mamchenkov</a>)</p>
<pre class="php"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #808080; font-style: italic;">/*
Plugin Name: Importer Plugin
Version: 0.1
Plugin URI: http://wordpress.nazgul.nu/
Description: Example of an importer plugin.
Author: Nazgul
Author URI: http://nazgul.nu/
*/</span>
&nbsp;
<span style="color: #808080; font-style: italic;">/*  Copyright 2007 Nazgul
&nbsp;
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.
&nbsp;
    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.
&nbsp;
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
*/</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre>
<p>So how do we turn this into an importer? We create a class which will do the importing for us. I based this class on the bundled importers, as they almost all use this form, but stripped out the fluff for now.</p>
<pre class="php"><span style="color: #808080; font-style: italic;">// The importer</span>
<span style="color: #000000; font-weight: bold;">class</span> Test_Import <span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0000ff;">$importer_code</span> = <span style="color: #ff0000;">'importerplugin'</span>;
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0000ff;">$importer_name</span> = <span style="color: #ff0000;">'Importer Plugin'</span>;
	<span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0000ff;">$importer_desc</span> = <span style="color: #ff0000;">'Import stuff'</span>;
&nbsp;
	<span style="color: #808080; font-style: italic;">// Function that will handle the wizard-like behaviour</span>
	<span style="color: #000000; font-weight: bold;">function</span> dispatch<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/empty" class="liexternal"><span style="color: #000066;">empty</span></a> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$_GET</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'step'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
			<span style="color: #0000ff;">$step</span> = <span style="color: #cc66cc;">0</span>;
		<span style="color: #b1b100;">else</span>
			<span style="color: #0000ff;">$step</span> = <span style="color: #66cc66;">&#40;</span>int<span style="color: #66cc66;">&#41;</span> <span style="color: #0000ff;">$_GET</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'step'</span><span style="color: #66cc66;">&#93;</span>;
&nbsp;
		<span style="color: #b1b100;">switch</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$step</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">0</span> :
				wp_import_upload_form<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'admin.php?import='</span>.<span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">importer_code</span>.<span style="color: #ff0000;">'&amp;amp;step=1'</span><span style="color: #66cc66;">&#41;</span>;
				<span style="color: #b1b100;">break</span>;
			<span style="color: #b1b100;">case</span> <span style="color: #cc66cc;">1</span> :
				check_admin_referer<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'import-upload'</span><span style="color: #66cc66;">&#41;</span>;
				<span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">import</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				<span style="color: #b1b100;">break</span>;
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">// Function that does the actual importing</span>
	<span style="color: #000000; font-weight: bold;">function</span> import<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #0000ff;">$file</span> = wp_import_handle_upload<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span> <a href="http://www.php.net/isset" class="liexternal"><span style="color: #000066;">isset</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$file</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'error'</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
			<a href="http://www.php.net/echo" class="liexternal"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt; p&gt;Sorry, there has been an error.&lt; /p&gt;'</span>;
			<a href="http://www.php.net/echo" class="liexternal"><span style="color: #000066;">echo</span></a> <span style="color: #ff0000;">'&lt; p&gt;&lt;strong&gt;'</span> . <span style="color: #0000ff;">$file</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'error'</span><span style="color: #66cc66;">&#93;</span> . <span style="color: #ff0000;">'&lt;/strong&gt;&lt; /p&gt;'</span>;
			<span style="color: #b1b100;">return</span>;
		<span style="color: #66cc66;">&#125;</span>
		<span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">file</span> = <span style="color: #0000ff;">$file</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'file'</span><span style="color: #66cc66;">&#93;</span>;
		<span style="color: #0000ff;">$this</span>-&gt;<span style="color: #006600;">id</span> = <span style="color: #66cc66;">&#40;</span>int<span style="color: #66cc66;">&#41;</span> <span style="color: #0000ff;">$file</span><span style="color: #66cc66;">&#91;</span><span style="color: #ff0000;">'id'</span><span style="color: #66cc66;">&#93;</span>;
&nbsp;
		<span style="color: #808080; font-style: italic;">// TODO: Write import code</span>
	<span style="color: #66cc66;">&#125;</span>
&nbsp;
	<span style="color: #808080; font-style: italic;">// Default constructor</span>
	<span style="color: #000000; font-weight: bold;">function</span> Test_Import<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #808080; font-style: italic;">// Nothing.</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>
<p>What we see is a class with a constructor which does nothing, 2 functions and a couple of variables. Let's start with those variables. <em>importer_code</em> is the name which WordPress will be using to identify the importer internally. <em>importer_name</em> is the human readable name which will be shown on the Importer screen end <em>importer_desc</em> is the description which is displayed on that same page.</p>
<p>The importers are wizards. That means they can have multiple screens during various stages of the import process. That's where our dispatch function comes in. It shows the different screens based on the step in the wizard where you currently are. Currently the first step (0) shows an upload form and the second step does some security checking and runs the actual import by means of the <em>import</em> function.</p>
<p>So now that we have an importer, how do we let WordPress know it exists? We register it using the <em>register_importer</em> function. That function is part of <em>wp-admin/includes/import.php</em> which isn't loaded by default, so we'll have to do that as well.</p>
<pre class="php"><span style="color: #808080; font-style: italic;">// Instantiate and register the importer</span>
<span style="color: #b1b100;">include_once</span><span style="color: #66cc66;">&#40;</span>ABSPATH . <span style="color: #ff0000;">'wp-admin/includes/import.php'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><a href="http://www.php.net/function_exists" class="liexternal"><span style="color: #000066;">function_exists</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'register_importer'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #0000ff;">$test_import</span> = <span style="color: #000000; font-weight: bold;">new</span> Test_Import<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
	register_importer<span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$test_import</span>-&gt;<span style="color: #006600;">importer_code</span>, <span style="color: #0000ff;">$test_import</span>-&gt;<span style="color: #006600;">importer_name</span>,
		<span style="color: #0000ff;">$test_import</span>-&gt;<span style="color: #006600;">importer_desc</span>, <a href="http://www.php.net/array" class="liexternal"><span style="color: #000066;">array</span></a> <span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$test_import</span>, <span style="color: #ff0000;">'dispatch'</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span></pre>
<p>We use <em>include_once</em> and <em>function_exists</em> because we don't want to kill the blog if the inclusion fails for some reason. (It will on pre 2.3 version because the <em>import.php</em> was located elsewhere) Next we instantiate our importer and register it, passing in our plugin code, name, description and dispatch function. That's all there is to building an Importer Plugin. I admit that this plugin doesn't actually import anything, but I'll leave that up as an exercise for the reader. <img src='http://wordpress.nazgul.nu/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>One last thing I'd like to include is some sort of protection. As stated, this behaviour is new to 2.3 and this plugin therefore won't work on older versions. Let's make sure people who try this plugin on older versions can't accidentally activate this plugin.</p>
<pre class="php">add_action<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'activate_'</span>.plugin_basename<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">__FILE__</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #ff0000;">'importerplugin_activate'</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> importerplugin_activate<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
	<a href="http://www.php.net/global" class="liexternal"><span style="color: #000066;">global</span></a> <span style="color: #0000ff;">$wp_db_version</span>;
&nbsp;
	<span style="color: #808080; font-style: italic;">// Deactivate on pre 2.3 blogs</span>
	<span style="color: #b1b100;">if</span><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$wp_db_version</span>&lt;<span style="color: #cc66cc;">6075</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
		<span style="color: #0000ff;">$current</span> = get_settings<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'active_plugins'</span><span style="color: #66cc66;">&#41;</span>;
		<a href="http://www.php.net/array_splice" class="liexternal"><span style="color: #000066;">array_splice</span></a><span style="color: #66cc66;">&#40;</span><span style="color: #0000ff;">$current</span>, <a href="http://www.php.net/array_search" class="liexternal"><span style="color: #000066;">array_search</span></a><span style="color: #66cc66;">&#40;</span> plugin_basename<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">__FILE__</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #0000ff;">$current</span><span style="color: #66cc66;">&#41;</span>, <span style="color: #cc66cc;">1</span> <span style="color: #66cc66;">&#41;</span>;
		update_option<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'active_plugins'</span>, <span style="color: #0000ff;">$current</span><span style="color: #66cc66;">&#41;</span>;
		do_action<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'deactivate_'</span>.plugin_basename<span style="color: #66cc66;">&#40;</span><span style="color: #000000; font-weight: bold;">__FILE__</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre>
<p>You can download the complete sourcecode for the plugin <a href="http://wordpress.nazgul.nu/wp-content/uploads/2007/09/importerplugin.phps" title='Importer Plugin example code' class="liinternal">here</a>.</p>
<p>That's it for now. Stay tuned for more posts about new 2.3 features.</p>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://wordpress.nazgul.nu/2007/09/14/new-in-23-importer-plugins/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Nazgul on WordPress</title>
		<link>http://wordpress.nazgul.nu/2007/09/11/nazgul-on-wordpress/</link>
		<comments>http://wordpress.nazgul.nu/2007/09/11/nazgul-on-wordpress/#comments</comments>
		<pubDate>Mon, 10 Sep 2007 22:10:46 +0000</pubDate>
		<dc:creator>Nazgul</dc:creator>
				<category><![CDATA[General]]></category>

		<guid isPermaLink="false">http://wordpress.nazgul.nu/2007/09/11/nazgul-on-wordpress/</guid>
		<description><![CDATA[It had to hapen sooner or later. I've been using WordPress for 1.5 years and have contributed to the source for about a year. I've made the occasional blogpost about it on my personal blog, but as that's a dutch blog and has a different target audience those posts wheren't really getting out. Therefore I [...]]]></description>
			<content:encoded><![CDATA[<!-- google_ad_section_start -->
<p>It had to hapen sooner or later. I've been using WordPress for 1.5 years and have contributed to the source for about a year. I've made the occasional blogpost about it on my <a href="http://nazgul.nu/blog/" class="liexternal">personal blog</a>, but as that's a dutch blog and has a different target audience those posts wheren't really getting out.</p>
<p>Therefore I decided to start a new English blog dedicated to WordPress related stuff next to my personal blog. And as it's dedicated to WordPress development it will be running the bleeding edge version of WordPress (trunk), but with manual updates (svn up), because I'm crazy, not stupid <img src='http://wordpress.nazgul.nu/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>For those of you still interested in those old (Dutch) posts about WordPress, look here:</p>
<ul>
<li><a href="http://nazgul.nu/blog/2007/09/10/wordpress-bedankjes/" class="liexternal">WordPress bedankjes</a></li>
<li><a href="http://nazgul.nu/blog/2007/05/25/wordpress-22/" class="liexternal">WordPress 2.2+</a></li>
<li><a href="http://nazgul.nu/blog/2007/03/13/bijdrage-in-wordpress-deel-2/" class="liexternal">Bijdrage in WordPress (deel 2)</a></li>
<li><a href="http://nazgul.nu/blog/2007/02/23/bijdrage-in-wordpress/" class="liexternal">Bijdrage in WordPress</a></li>
<li><a href="http://nazgul.nu/blog/2006/08/23/wordpress-204/" class="liexternal">WordPress 2.0.4</a></li>
<li><a href="http://nazgul.nu/blog/2006/06/13/customizen/" class="liexternal">Customizen</a></li>
<li><a href="http://nazgul.nu/blog/2006/06/01/wordpress-203/" class="liexternal">WordPress 2.0.3</a></li>
</ul>
<!-- google_ad_section_end -->]]></content:encoded>
			<wfw:commentRss>http://wordpress.nazgul.nu/2007/09/11/nazgul-on-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

