<?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>RyanD &#187; Code</title>
	<atom:link href="http://blog.ryandonahue.net/topics/code/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ryandonahue.net</link>
	<description>Culture + Technology</description>
	<lastBuildDate>Thu, 26 Jan 2012 01:01:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>An Adventure in arbitrary PHP in WordPress.</title>
		<link>http://blog.ryandonahue.net/2009/08/an-adventure-in-arbitrary-php-in-wordpress/</link>
		<comments>http://blog.ryandonahue.net/2009/08/an-adventure-in-arbitrary-php-in-wordpress/#comments</comments>
		<pubDate>Thu, 06 Aug 2009 05:06:09 +0000</pubDate>
		<dc:creator>RyanD</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Server Side]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Roman Numerals]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://blog.ryandonahue.net/?p=20</guid>
		<description><![CDATA[One of the finishing touches I wanted to add to this blog theme was a copyright statement in roman numerals. Inserting arbitrary PHP into WordPress isn’t as straightforward as it should be, so I’ve outlined instructions below: 1. Edit the functions.php file of your theme to add the following code (courtesy Pradeep S). // A [...]]]></description>
			<content:encoded><![CDATA[<p>One of the finishing touches I wanted to add to this blog theme was a copyright<br />
statement in <a href="http://en.wikipedia.org/wiki/roman_numerals">roman numerals</a>. Inserting arbitrary PHP into <a href="http://www.wordpress.org">WordPress</a> isn’t as straightforward as it should be, so I’ve outlined instructions below:</p>
<p>1. Edit the <code>functions.php</code> file of your theme to add the following code (courtesy <a href="http://blog.pradeep.net.in/">Pradeep S</a>).</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// A function to return the Roman Numeral, given an integer</span>
  <span style="color: #000000; font-weight: bold;">function</span> numberToRoman<span style="color: #009900;">&#40;</span><span style="color: #000088;">$num</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    <span style="color: #666666; font-style: italic;">// use int value</span>
    <span style="color: #000088;">$n</span> <span style="color: #339933;">=</span> <span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$num</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$result</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$lookup</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
      <span style="color: #0000ff;">'M'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1000</span><span style="color: #339933;">,</span> 
      <span style="color: #0000ff;">'CM'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">900</span><span style="color: #339933;">,</span> 
      <span style="color: #0000ff;">'D'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">500</span><span style="color: #339933;">,</span> 
      <span style="color: #0000ff;">'CD'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">400</span><span style="color: #339933;">,</span>
      <span style="color: #0000ff;">'C'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">100</span><span style="color: #339933;">,</span> 
      <span style="color: #0000ff;">'XC'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">90</span><span style="color: #339933;">,</span> 
      <span style="color: #0000ff;">'L'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">50</span><span style="color: #339933;">,</span> 
      <span style="color: #0000ff;">'XL'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">40</span><span style="color: #339933;">,</span>
      <span style="color: #0000ff;">'X'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span> 
      <span style="color: #0000ff;">'IX'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">9</span><span style="color: #339933;">,</span> 
      <span style="color: #0000ff;">'V'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">5</span><span style="color: #339933;">,</span> 
      <span style="color: #0000ff;">'IV'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">4</span><span style="color: #339933;">,</span> 
      <span style="color: #0000ff;">'I'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span>
     <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$lookup</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$roman</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      <span style="color: #000088;">$matches</span> <span style="color: #339933;">=</span> <span style="color: #990000;">intval</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$n</span> <span style="color: #339933;">/</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$result</span> <span style="color: #339933;">.=</span> <span style="color: #990000;">str_repeat</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$roman</span><span style="color: #339933;">,</span> <span style="color: #000088;">$matches</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
      <span style="color: #000088;">$n</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$n</span> <span style="color: #339933;">%</span> <span style="color: #000088;">$value</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #b1b100;">return</span> <span style="color: #000088;">$result</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>2. Edit the <code>footer.php</code> file in the theme to add a reference to the new function in the copyright block.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;">    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;footer&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;grid_12&quot;</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span><span style="color: #ddbb00;">&amp;copy;</span> <span style="color: #009900;">&lt;?php echo numberToRoman<span style="color: #66cc66;">&#40;</span>date<span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">&quot;Y&quot;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>; ?&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
  <span style="color: #009900;">&lt;?php wp_footer<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; ?&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span></pre></div></div>

<p>3. You&#8217;re done!</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ryandonahue.net/2009/08/an-adventure-in-arbitrary-php-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

