<?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>trickeries! &#187; twitter</title>
	<atom:link href="http://trickeries.com/tag/twitter/feed/" rel="self" type="application/rss+xml" />
	<link>http://trickeries.com</link>
	<description>it's tricky to rock a style thats liked online</description>
	<lastBuildDate>Tue, 02 Mar 2010 06:01:56 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Allowing periods in wordpress permalinks</title>
		<link>http://trickeries.com/739/allowing-periods-in-wordpress-permalinks/</link>
		<comments>http://trickeries.com/739/allowing-periods-in-wordpress-permalinks/#comments</comments>
		<pubDate>Mon, 04 Jan 2010 04:36:06 +0000</pubDate>
		<dc:creator>atom</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://trickeries.com/?p=739</guid>
		<description><![CDATA[John Resig tweeted the following:

Trying to get periods in Wordpress permalinks to work, but failing. How can I force WP to allow: http://example.com/foo.bar/



I was curious so I watched replies to him. There were many deeply misguided answers, my favorite being:

I&#8217;m not sure, but it seems like it might likely be a server configuration issue.


There was [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://ejohn.org/">John Resig</a> <a href="http://twitter.com/jeresig/statuses/7353012178">tweeted the following</a>:</p>
<blockquote><p>
Trying to get periods in Wordpress permalinks to work, but failing. How can I force WP to allow: http://example.com/foo.bar/
</p></blockquote>
<hr/>
<p>
I was curious so I watched replies to him. There were many deeply misguided answers, my favorite being:
</p>
<blockquote><p>I&#8217;m not sure, but it seems like it might likely be a server configuration issue.</p></blockquote>
<hr/>
<p>
There was a reference to this: <a href="http://firsttube.com/read/hacking-wordpress-day-two/">http://firsttube.com/read/hacking-wordpress-day-two/</a>, but hacking the core is a pretty poor solution, and will be overwritten the next time you upgrade.
</p>
<p>
The periods get dropped by sanitize_title_with_dashes, and there is no clean way to hook into it and fix the problem, so you can just use remove_filter to drop it, and replace it with a very similar function that allows for periods:
</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">remove_filter<span style="color: #FF6600;">&#40;</span><span style="color: #0000ff;">'sanitize_title'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'sanitize_title_with_dashes'</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">;</span>
add_filter<span style="color: #FF6600;">&#40;</span><span style="color: #0000ff;">'sanitize_title'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'sanitize_title_with_dashes_allow_periods'</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #FF00FF; font-weight: bold;">function</span> sanitize_title_with_dashes_allow_periods<span style="color: #FF6600;">&#40;</span><span style="color: #00FF00;">$title</span><span style="color: #FF6600;">&#41;</span><span style="color: #FF6600;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// same as sanitize_title_with_dashes minus the line replacing periods, </span>
        <span style="color: #666666; font-style: italic;">// and an alteration to the final catch all regex to allow periods</span>
        <span style="color: #666666; font-style: italic;">// please note, might be dangerous for some reason?  i don't rightly know.</span>
        <span style="color: #00FF00;">$title</span> <span style="color: #339933;">=</span> <span style="color: #0066FF;">strip_tags</span><span style="color: #FF6600;">&#40;</span><span style="color: #00FF00;">$title</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// Preserve escaped octets.</span>
        <span style="color: #00FF00;">$title</span> <span style="color: #339933;">=</span> <span style="color: #0066FF;">preg_replace</span><span style="color: #FF6600;">&#40;</span><span style="color: #0000ff;">'|%([a-fA-F0-9][a-fA-F0-9])|'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'---$1---'</span><span style="color: #339933;">,</span> <span style="color: #00FF00;">$title</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// Remove percent signs that are not part of an octet.</span>
        <span style="color: #00FF00;">$title</span> <span style="color: #339933;">=</span> <span style="color: #0066FF;">str_replace</span><span style="color: #FF6600;">&#40;</span><span style="color: #0000ff;">'%'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #00FF00;">$title</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #666666; font-style: italic;">// Restore octets.</span>
        <span style="color: #00FF00;">$title</span> <span style="color: #339933;">=</span> <span style="color: #0066FF;">preg_replace</span><span style="color: #FF6600;">&#40;</span><span style="color: #0000ff;">'|---([a-fA-F0-9][a-fA-F0-9])---|'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'%$1'</span><span style="color: #339933;">,</span> <span style="color: #00FF00;">$title</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #00FF00;">$title</span> <span style="color: #339933;">=</span> remove_accents<span style="color: #FF6600;">&#40;</span><span style="color: #00FF00;">$title</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #00FF00;">if</span> <span style="color: #FF6600;">&#40;</span>seems_utf8<span style="color: #FF6600;">&#40;</span><span style="color: #00FF00;">$title</span><span style="color: #FF6600;">&#41;</span><span style="color: #FF6600;">&#41;</span> <span style="color: #FF6600;">&#123;</span>
                <span style="color: #00FF00;">if</span> <span style="color: #FF6600;">&#40;</span><span style="color: #0066FF;">function_exists</span><span style="color: #FF6600;">&#40;</span><span style="color: #0000ff;">'mb_strtolower'</span><span style="color: #FF6600;">&#41;</span><span style="color: #FF6600;">&#41;</span> <span style="color: #FF6600;">&#123;</span>
                        <span style="color: #00FF00;">$title</span> <span style="color: #339933;">=</span> <span style="color: #0066FF;">mb_strtolower</span><span style="color: #FF6600;">&#40;</span><span style="color: #00FF00;">$title</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'UTF-8'</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">;</span>
                <span style="color: #FF6600;">&#125;</span>
                <span style="color: #00FF00;">$title</span> <span style="color: #339933;">=</span> utf8_uri_encode<span style="color: #FF6600;">&#40;</span><span style="color: #00FF00;">$title</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">200</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #FF6600;">&#125;</span>
&nbsp;
        <span style="color: #00FF00;">$title</span> <span style="color: #339933;">=</span> <span style="color: #0066FF;">strtolower</span><span style="color: #FF6600;">&#40;</span><span style="color: #00FF00;">$title</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #00FF00;">$title</span> <span style="color: #339933;">=</span> <span style="color: #0066FF;">preg_replace</span><span style="color: #FF6600;">&#40;</span><span style="color: #0000ff;">'/&amp;.+?;/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #00FF00;">$title</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// kill entities</span>
        <span style="color: #666666; font-style: italic;">//$title = str_replace('.', '-', $title);</span>
        <span style="color: #00FF00;">$title</span> <span style="color: #339933;">=</span> <span style="color: #0066FF;">preg_replace</span><span style="color: #FF6600;">&#40;</span><span style="color: #0000ff;">'/[^\.%a-z0-9 _-]/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #00FF00;">$title</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// allow for periods</span>
        <span style="color: #00FF00;">$title</span> <span style="color: #339933;">=</span> <span style="color: #0066FF;">preg_replace</span><span style="color: #FF6600;">&#40;</span><span style="color: #0000ff;">'/\s+/'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'-'</span><span style="color: #339933;">,</span> <span style="color: #00FF00;">$title</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #00FF00;">$title</span> <span style="color: #339933;">=</span> <span style="color: #0066FF;">preg_replace</span><span style="color: #FF6600;">&#40;</span><span style="color: #0000ff;">'|-+|'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'-'</span><span style="color: #339933;">,</span> <span style="color: #00FF00;">$title</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">;</span>
        <span style="color: #00FF00;">$title</span> <span style="color: #339933;">=</span> <span style="color: #0066FF;">trim</span><span style="color: #FF6600;">&#40;</span><span style="color: #00FF00;">$title</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'-'</span><span style="color: #FF6600;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #00FF00;">return</span> <span style="color: #00FF00;">$title</span><span style="color: #339933;">;</span>
<span style="color: #FF6600;">&#125;</span></pre></div></div>

<h3>Please note that this could be dangerous, they might be removing periods for a good reason</h3>
]]></content:encoded>
			<wfw:commentRss>http://trickeries.com/739/allowing-periods-in-wordpress-permalinks/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
