<?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>Is it just &#12415;? &#187; Plugin</title>
	<atom:link href="http://blog.himmelrath.net/tag/plugin/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.himmelrath.net</link>
	<description>ungeordneter Unfug</description>
	<lastBuildDate>Sun, 25 Jul 2010 08:00:00 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Zen Coding</title>
		<link>http://blog.himmelrath.net/tec/comp/zen-coding/</link>
		<comments>http://blog.himmelrath.net/tec/comp/zen-coding/#comments</comments>
		<pubDate>Mon, 03 May 2010 09:24:17 +0000</pubDate>
		<dc:creator>Jens</dc:creator>
				<category><![CDATA[Computer]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[rapid prototyping]]></category>
		<category><![CDATA[Webauthoring]]></category>

		<guid isPermaLink="false">http://blog.himmelrath.net/?p=614</guid>
		<description><![CDATA[Nur ganz kurz. Interessant für alle die HTML per Hand schreiben und nicht mit irgend einem WYSIWYMGIYAL-Editor arbeiten (What you see is what you might get if you are lucky): Zen Coding

Zen Coding ermöglicht es nach einer kurzen Einarbeitungszeit (sehr kurz, wenn man CSS kennt) unheimlich schnell HTML-Strukturen zu bauen. <a href="http://blog.himmelrath.net/tec/comp/zen-coding/">[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Nur ganz kurz. Interessant für alle die HTML per Hand schreiben und nicht mit irgend einem WYSIWYMGIYAL-Editor arbeiten (What you see is what you might get if you are lucky): <a href="http://code.google.com/p/zen-coding/">Zen Coding</a></p>
<p>Zen Coding ermöglicht es nach einer kurzen Einarbeitungszeit (sehr kurz, wenn man CSS kennt) unheimlich schnell HTML-Strukturen zu bauen. Das <a href="http://www.downloadsquad.com/2010/04/30/if-you-code-html-zen-coding-will-change-your-life/">Demostrationsvideo auf dieser Seite</a> hat mich erst einmal umgehauen.</p>
<p>Mal sehen wie es sich im täglichen Gebrauch schlägt.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.himmelrath.net/tec/comp/zen-coding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress: Highlight PHP Code</title>
		<link>http://blog.himmelrath.net/tec/prog/wordpress-highlight-php-code/</link>
		<comments>http://blog.himmelrath.net/tec/prog/wordpress-highlight-php-code/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 15:13:14 +0000</pubDate>
		<dc:creator>Jens</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[Technik]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://blog.himmelrath.net/?p=307</guid>
		<description><![CDATA[I like to write about programming, and since I am using Wordpress and writing plugins for it, PHP is the language of choice when it comes to blog-related development.

I wanted to put my PHP-Code into my entries and I wanted it to look nice, which means mono-spaced font and syntax <a href="http://blog.himmelrath.net/tec/prog/wordpress-highlight-php-code/">[...]</a>]]></description>
			<content:encoded><![CDATA[<p class="remark">Ich werde mal versuchen einige meiner Einträge auf Englisch zu verfassen &#8211; um in der Übung zu bleiben.</p>
<p>I like to write about programming, and since I am using WordPress and writing plugins for it, PHP is the language of choice when it comes to blog-related development.</p>
<p>I wanted to put my PHP-Code into my entries and I wanted it to look nice, which means mono-spaced font and syntax highlighting. The first one was fairly easy to archieve by just changing the CSS. Whenever I put code into my blog, I write it between &lt;pre&gt; and &lt;/pre&gt;, so I just had to change the CSS for the pre-element:</p>
<pre>
 pre {
    height: auto;
    overflow: auto;
    color: #EEE;
    padding: 5px;
    margin: 10px;
    scroll: auto;
    font-family: Courier New, monospace;
    font-weight: bold;
    white-space: pre;
    font-size: 9pt;
    line-height: 10pt;
}</pre>
<p>The highlighting however must be done on the server side by PHP, so I had to write another (in fact two) filter-function: </p>
<pre><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">highlightCode</span><span style="color: #007700">(</span><span style="color: #0000BB">$content</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">false&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">strpos</span><span style="color: #007700">(</span><span style="color: #0000BB">$content</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'&lt;pre&gt;'</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">$content</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$content&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">preg_replace_callback</span><span style="color: #007700">(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'|\&lt;pre\&gt;(.*?)\&lt;/pre\&gt;|is'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'highlightCodeCallback'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$content<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">$content</span><span style="color: #007700">;<br />}<br /><br />function&nbsp;</span><span style="color: #0000BB">highlightCodeCallback</span><span style="color: #007700">(</span><span style="color: #0000BB">$matches</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">false&nbsp;</span><span style="color: #007700">===&nbsp;</span><span style="color: #0000BB">strpos</span><span style="color: #007700">(</span><span style="color: #0000BB">$matches</span><span style="color: #007700">[</span><span style="color: #0000BB">0</span><span style="color: #007700">],&nbsp;</span><span style="color: #DD0000">'&lt;&nbsp;?php'</span><span style="color: #007700">))&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">$matches</span><span style="color: #007700">[</span><span style="color: #0000BB">0</span><span style="color: #007700">];<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$code&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$matches</span><span style="color: #007700">[</span><span style="color: #0000BB">0</span><span style="color: #007700">];<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$code&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">preg_replace</span><span style="color: #007700">(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'|\&lt;code\&gt;\s*\&lt;/code\&gt;|is'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'/*§§BR§§*/'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$code<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$code&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">strip_tags</span><span style="color: #007700">(</span><span style="color: #0000BB">$code</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF9900">//&nbsp;Wordpress&nbsp;adds&nbsp;the&nbsp;space&nbsp;when&nbsp;saving<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$code&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">str_replace</span><span style="color: #007700">(</span><span style="color: #DD0000">'&lt;&nbsp;?php'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'&lt;?php'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$code</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$code&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">highlight_string</span><span style="color: #007700">(</span><span style="color: #0000BB">$code</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">true</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$code&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">str_replace</span><span style="color: #007700">(</span><span style="color: #DD0000">'/*§§BR§§*/'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"\n\n"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$code</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$code&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">htmlspecialchars_decode</span><span style="color: #007700">(</span><span style="color: #0000BB">$code</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$code&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">str_replace</span><span style="color: #007700">(</span><span style="color: #DD0000">'&lt;?php'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'&amp;lt;?php'</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$code</span><span style="color: #007700">);<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #DD0000">'&lt;pre&gt;'</span><span style="color: #007700">.&nbsp;</span><span style="color: #0000BB">$code&nbsp;</span><span style="color: #007700">.</span><span style="color: #DD0000">'&lt;/pre&gt;'</span><span style="color: #007700">;<br />}</span>
</span>
</code></pre>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.himmelrath.net/tec/prog/wordpress-highlight-php-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress: Filter certain categories on main page</title>
		<link>http://blog.himmelrath.net/tec/prog/wordpress-filter-categories/</link>
		<comments>http://blog.himmelrath.net/tec/prog/wordpress-filter-categories/#comments</comments>
		<pubDate>Fri, 20 Nov 2009 17:11:03 +0000</pubDate>
		<dc:creator>Jens</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programmierung]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[Twitter Tools]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://blog.himmelrath.net/?p=295</guid>
		<description><![CDATA[I am using the Twitter Tools plugin to automatically create Tweets for my blog entries and vice versa to have some kind of tweet archive on my blog. That works flawlessly.

The only problem is: I tweet too much. I only want to show five entries on my front page, which <a href="http://blog.himmelrath.net/tec/prog/wordpress-filter-categories/">[...]</a>]]></description>
			<content:encoded><![CDATA[<p class="remark">Ich werde mal versuchen einige meiner Einträge auf Englisch zu verfassen &#8211; um in der Übung zu bleiben.</p>
<p>I am using the <a href="http://alexking.org/projects/wordpress/readme?project=twitter-tools">Twitter Tools</a> plugin to automatically create Tweets for my blog entries and vice versa to have some kind of tweet archive on my blog. That works flawlessly.</p>
<p>The only problem is: I tweet too much. I only want to show five entries on my front page, which basically means, that my last real blog entry is gone after one or two days, because of the twitter entries. The solution: Entries from the Tweets category should not be visible on the front page.</p>
<p>I had to extend my my-blog-exclusively-plugin with a function that filters the posts that appear on the front page, for this I added a filter to the hook &#8220;<strong>the_posts</strong>&#8221; which is called quite early in the loop before anything has been done to the posts. The posts that would be shown on the front page are given to the callback-function as first parameter in the form of an array. Here is the code:</p>
<pre><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /><br /></span><span style="color: #FF9900">/**/<br />//&nbsp;Filter&nbsp;post&nbsp;from&nbsp;the&nbsp;category&nbsp;Tweets&nbsp;on&nbsp;front&nbsp;page<br /></span><span style="color: #0000BB">add_filter</span><span style="color: #007700">(<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'the_posts'</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #DD0000">'filterTweets'<br /></span><span style="color: #007700">);&nbsp;</span><span style="color: #FF9900">/**/<br /><br /></span><span style="color: #007700">function&nbsp;</span><span style="color: #0000BB">filterTweets</span><span style="color: #007700">(</span><span style="color: #0000BB">$posts</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF9900">//&nbsp;Filter&nbsp;only&nbsp;on&nbsp;the&nbsp;front&nbsp;page!<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">if&nbsp;(!</span><span style="color: #0000BB">is_front_page</span><span style="color: #007700">())&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">$posts</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$tweetCategoryName&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #DD0000">'Tweets'</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$numVisiblePosts&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">5</span><span style="color: #007700">;<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$postsToShow&nbsp;</span><span style="color: #007700">=&nbsp;array();<br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$filteredPosts&nbsp;</span><span style="color: #007700">=&nbsp;array();<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$num&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;foreach&nbsp;(</span><span style="color: #0000BB">$posts&nbsp;</span><span style="color: #007700">as&nbsp;</span><span style="color: #0000BB">$post</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$cats&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">in_category</span><span style="color: #007700">(</span><span style="color: #0000BB">$tweetCategoryName</span><span style="color: #007700">,&nbsp;(int)&nbsp;</span><span style="color: #0000BB">$post</span><span style="color: #007700">-&</span><span style="color: #0000BB">gt</span><span style="color: #007700">;</span><span style="color: #0000BB">ID</span><span style="color: #007700">);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(!</span><span style="color: #0000BB">$cats</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$postsToShow</span><span style="color: #007700">[]&nbsp;=&nbsp;</span><span style="color: #0000BB">$post</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$num</span><span style="color: #007700">++;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}&nbsp;else&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$filteredPosts</span><span style="color: #007700">[]&nbsp;=&nbsp;</span><span style="color: #0000BB">$post</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">$num&nbsp;</span><span style="color: #007700">&</span><span style="color: #0000BB">gt</span><span style="color: #007700">;=&nbsp;</span><span style="color: #0000BB">$numVisiblePosts</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;break;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;if&nbsp;(</span><span style="color: #0000BB">$num&nbsp;</span><span style="color: #007700">&</span><span style="color: #0000BB">lt</span><span style="color: #007700">;&nbsp;</span><span style="color: #0000BB">$numVisiblePosts</span><span style="color: #007700">)&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #FF9900">//&nbsp;Too&nbsp;many&nbsp;twitter&nbsp;posts...&nbsp;what&nbsp;the&nbsp;hell...&nbsp;show&nbsp;some&nbsp;of&nbsp;them<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$numTwitterPosts&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$numVisiblePosts&nbsp;</span><span style="color: #007700">-&nbsp;</span><span style="color: #0000BB">$num</span><span style="color: #007700">;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$postsToShow&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">array_merge</span><span style="color: #007700">(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">$postsToShow</span><span style="color: #007700">,<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span style="color: #0000BB">array_slice</span><span style="color: #007700">(</span><span style="color: #0000BB">$filteredPosts</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$numTwitterPosts</span><span style="color: #007700">)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;return&nbsp;</span><span style="color: #0000BB">$postsToShow</span><span style="color: #007700">;<br />}<br /></span>
</span>
</code></pre>
<p>Another thing I had to do was increase the number of posts shown on the front page, since my plugin now handles restricting the number of posts and I have to ensure that my function gets at least some posts that are not tweets. (But even if there are not enough, it fills up the front page with twitter posts.)</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.himmelrath.net/tec/prog/wordpress-filter-categories/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
