<?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>Per Søderlind</title>
	<atom:link href="http://soderlind.no/feed/" rel="self" type="application/rss+xml" />
	<link>http://soderlind.no</link>
	<description>I code for fun</description>
	<lastBuildDate>Tue, 14 May 2013 18:34:20 +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>
		<item>
		<title>WordPress Debug Bar, List Script &amp; Style Dependencies</title>
		<link>http://soderlind.no/debug-bar-list-script-and-style-dependencies/</link>
		<comments>http://soderlind.no/debug-bar-list-script-and-style-dependencies/#comments</comments>
		<pubDate>Wed, 08 May 2013 19:24:37 +0000</pubDate>
		<dc:creator>PerS</dc:creator>
				<category><![CDATA[wp-plugins]]></category>

		<guid isPermaLink="false">http://soderlind.no/?p=4078</guid>
		<description><![CDATA[We all know that when we&#8217;re add a script or style to WordPress, we should use wp_enqueue_script( $handle, $src, $deps, $ver, $in_footer ) and wp_enqueue_style( $handle, $src, $deps, $ver, $media ) as in: [crayon-519f5a81a693a/] $deps (dependencies), the handle name and an optional parameter, lets you control when/where your script or style should be added. If $deps [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://d178exrgcizrb6.cloudfront.net/db001/wblob/18CDE396934352/14/587/ABB3vUO7bR0klSfToDq-PAfbTBYfhCyEwk7kq7-8IE0/screenshot-1.png"><img class="aligncenter size-medium wp-image-4100" alt="Debug Front-end" src="http://d178exrgcizrb6.cloudfront.net/db001/wblob/18CDE396934352/14/589/Fn4kq3q6ybD1Vsh4exTfywoTntUgCYnb1yrn6bCgy3k/screenshot-1-300x181.png" width="300" height="181" /></a></p>
<p>We all know that when we&#8217;re add a script or style to WordPress, we should use <a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script">wp_enqueue_script</a>( $handle, $src, <span style="color: #339966;">$deps</span>, $ver, $in_footer ) and <a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_style">wp_enqueue_style</a>( $handle, $src, <span style="color: #339966;">$deps</span>, $ver, $media ) as in:</p>
<p><span id="more-4078"></span></p><pre class="crayon-plain-tag">function themeslug_enqueue_style() {
wp_enqueue_style( 'core', 'style.css', array('twentytwelve-style') );
}

function themeslug_enqueue_script() {
wp_enqueue_script( 'my-js', 'filename.js', array('jquery') );
}

add_action( 'wp_enqueue_scripts', 'themeslug_enqueue_style' );
add_action( 'wp_enqueue_scripts', 'themeslug_enqueue_script' )</pre><p><span style="color: #339966;">$deps</span> (dependencies), the handle name and an optional parameter, lets you control when/where your script or style should be added. If <span style="color: #339966;">$deps</span> is array(&#8216;jquery&#8217;), your script will be loaded after jquery is loaded.</p>
<p>The problem is, which one exists and in which order are they loaded ?</p>
<p>I&#8217;ve written an add-on to <a href="http://wordpress.org/extend/plugins/debug-bar/">Debug Bar</a> that list the loaded scripts and styles, it&#8217;s available at:</p>
<ul>
<li><a href="https://github.com/soderlind/debug-bar-list-dependencies"><span style="line-height: 1.714285714; font-size: 1rem;">GitHub</span></a></li>
<li><a href="http://wordpress.org/extend/plugins/debug-bar-list-dependencies/">WordPress Plugin Directory</a></li>
</ul>
<p><strong style="line-height: 1.714285714; font-size: 1rem;">Use</strong></p>
<p>Script and styles loaded on the front-end: Go to the front-end, and on the admin bar choose Debug and view Script &amp; Style Dependencies</p>
<p>Back-end: Do the same, on the admin bar choose Debug and view Script &amp; Style Dependencies</p>
<p>Note, the front-end and back-end loads different scripts and styles. Also, different pages on the front-end and back-end can load different scripts and styles.</p>
<p><strong>Changelog</strong><br />
1.0.2 Added styling<br />
1.0.1 Bugfix, fixed listing of styles and their dependencies<br />
1.0 Initial release</p>
]]></content:encoded>
			<wfw:commentRss>http://soderlind.no/debug-bar-list-script-and-style-dependencies/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Debug WordPress with Sublime Text 2 and XDebug</title>
		<link>http://soderlind.no/debug-wordpress-with-sublime-text-2-and-xdebug/</link>
		<comments>http://soderlind.no/debug-wordpress-with-sublime-text-2-and-xdebug/#comments</comments>
		<pubDate>Tue, 09 Apr 2013 21:55:53 +0000</pubDate>
		<dc:creator>PerS</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[sublime text]]></category>
		<category><![CDATA[xdebug]]></category>

		<guid isPermaLink="false">http://soderlind.no/?p=3998</guid>
		<description><![CDATA[XDebug installation Run the Xdebug wizard and follow the instructions.I develop on Mac OS X Mountain Lion, and phpize complained that autoconf is missing. Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable is set correctly and then rerun this script. Luckily Sebastien has the recipe on how to add autoconf to Mountain Lion [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://d178exrgcizrb6.cloudfront.net/db001/wblob/18CDE396934352/B/577/nGsLpJVzP8xcmMeSIhndvU1kZuVStSPOIh68wT3HNl4/sublime-text-plugin-debug.png"><img class="aligncenter size-medium wp-image-4001" alt="sublime-text-plugin-debug" src="http://d178exrgcizrb6.cloudfront.net/db001/wblob/18CDE396934352/B/579/VpvkinQXag9uUz-wfNcSTkDjQZAkgFJUExxxP1iR9X8/sublime-text-plugin-debug-300x189.png" width="300" height="189" /></a></p>
<p><span id="more-3998"></span></p>
<a name="xdebug-installation"></a><h3>XDebug installation</h3>
<ol>
<li>Run the <a href="http://www.xdebug.org/wizard.php">Xdebug wizard</a> and follow the instructions.I develop on <a href="http://soderlind.no/my-digital-tool-chest/">Mac OS X Mountain Lion</a>, and phpize complained that autoconf is missing.
<pre>Cannot find autoconf. Please check your autoconf installation and the $PHP_AUTOCONF environment variable is set correctly and then rerun this script.</pre>
<p>Luckily Sebastien has the <a href="http://jsdelfino.blogspot.no/2012/08/autoconf-and-automake-on-mac-os-x.html">recipe</a> on how to add autoconf to Mountain Lion</li>
<li>When you&#8217;re editing php.ini, add the following to the [xdebug] section
<pre class="lang:default decode:true">xdebug.remote_enable=On
xdebug.remote_host="localhost"
xdebug.remote_port=9000
xdebug.remote_handler="dbgp"
xdebug.remote_autostart=1</pre>
</li>
<li>Save php.ini and restart your webserver. I do <a href="http://soderlind.no/running-wordpress-locally-on-mac-os-x-lion/">sudo apachectl restart</a></li>
</ol>
<a name="debug-your-wordpress-plugin-in-sublime-text-2"></a><h3>Debug your WordPress plugin in Sublime Text 2</h3>
<ol>
<li>If you haven&#8217;t allready, add the <a href="https://github.com/Kindari/SublimeXdebug#readme">SublimeXdebug</a> package using <a href="http://wbond.net/sublime_packages/package_control">Sublime Package Control</a>
<ul>
<li>Shift-Cmd P and select Package Install</li>
<li>Find Xdebug and install it</li>
</ul>
</li>
<li>Open the folder with the plugin you want to debug in Sublime Text and save as project (Project -&gt; Save Project As&#8230;)</li>
<li>Edit project properties (Project-&gt;Edit Project) and add the &#8220;settings&#8221;: {&#8220;xdebug&#8221; : url-to-your-test-site}. Mine is:<br />
<pre class="crayon-plain-tag">{
	"folders":
	[
		{
			"path": "/Users/&lt;user&gt;/Sites/wp.local/wp-content/plugins/acf-field-date-time-picker"
		}
	],
	"settings": {
		"xdebug": { "url": "http://wp.local/" }
	}
}</pre></li>
<li>Now you&#8217;re ready to debug:
<ul>
<li>Select the line where you want a breakpoint. Shift + F8 opens the debug menu. Select Add Breakpoint</li>
<li>Shift + F8, and choose Start debugging. Your default broweser will open with the url you set in project properties. Browse to the page where you know the plugin will be triggered, and go back to Sublime Text.</li>
<li>Use the following shortcut keys to step through the code:
<ul>
<li>Ctrl+Shift+F6 &#8211; Step over</li>
<li>Ctrl+Shift+F7 &#8211; Step into</li>
<li>Ctrl+Shift+F8 &#8211; Step out from</li>
<li>Ctrl+Shift+F5 &#8211; Continue (until next breakpoint)</li>
</ul>
</li>
</ul>
</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://soderlind.no/debug-wordpress-with-sublime-text-2-and-xdebug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Relocating my WordPress plugins to GitHub</title>
		<link>http://soderlind.no/relocating-my-wordpress-plugins-to-github/</link>
		<comments>http://soderlind.no/relocating-my-wordpress-plugins-to-github/#comments</comments>
		<pubDate>Tue, 05 Feb 2013 00:46:34 +0000</pubDate>
		<dc:creator>PerS</dc:creator>
				<category><![CDATA[general]]></category>

		<guid isPermaLink="false">http://soderlind.no/?p=3734</guid>
		<description><![CDATA[I&#8217;m, slowly .. literally, git svn is sooo slow , copying my plugins to GitHub. I&#8217;m using my svn2git.sh bash script to do the job. I&#8217;ll use the GitHub repositories during development, and publish my plugins in the WordPress Plugin Directory]]></description>
				<content:encoded><![CDATA[<p><span style="line-height: 1.714285714; font-size: 1rem;"><a href="https://github.com/soderlind?tab=repositories"><img class="alignright size-thumbnail wp-image-3735" alt="octocat" src="http://d178exrgcizrb6.cloudfront.net/db001/wblob/18CDE396934352/3/542/3TWCq2DEMp54QJCIBLFyVFENAIZeAIGaY2KCFXWl7Rg/octocat-150x150.png" width="150" height="150" /></a>I&#8217;m, slowly .. literally, </span><code style="line-height: 1.714285714;">git svn</code><span style="line-height: 1.714285714; font-size: 1rem;"> is sooo slow , copying my plugins to GitHub. I&#8217;m using my </span><a style="line-height: 1.714285714; font-size: 1rem;" href="https://gist.github.com/4711214">svn2git.sh</a><span style="line-height: 1.714285714; font-size: 1rem;"> bash script to do the job.</span></p>
<p>I&#8217;ll use the <a href="https://github.com/soderlind?tab=repositories">GitHub repositories</a> during development, and publish my plugins in <a href="http://soderlind.no/projects/">the WordPress Plugin Directory</a></p>
]]></content:encoded>
			<wfw:commentRss>http://soderlind.no/relocating-my-wordpress-plugins-to-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CloudFlare API and WordPress</title>
		<link>http://soderlind.no/cloudflare-api-and-wordpress/</link>
		<comments>http://soderlind.no/cloudflare-api-and-wordpress/#comments</comments>
		<pubDate>Mon, 07 Jan 2013 18:46:21 +0000</pubDate>
		<dc:creator>PerS</dc:creator>
				<category><![CDATA[general]]></category>

		<guid isPermaLink="false">http://soderlind.no/?p=3715</guid>
		<description><![CDATA[CloudFlare protects and accelerates any website online. Once your website is a part of the CloudFlare community, its web traffic is routed through our intelligent global network. We automatically optimize the delivery of your web pages so your visitors get the fastest page load times and best performance. We also block threats and limit abusive [...]]]></description>
				<content:encoded><![CDATA[<blockquote><p>CloudFlare protects and accelerates any website online. Once your website is a part of the CloudFlare community, its web traffic is routed through our intelligent global network. We automatically optimize the delivery of your web pages so your visitors get the fastest page load times and best performance. We also block threats and limit abusive bots and crawlers from wasting your bandwidth and server resources.<br />
<cite><a href="http://www.cloudflare.com/overview">www.cloudflare.com</a></cite>
</p></blockquote>
<p>You&#8217;ll find the CloudFlare API at <a href="https://www.cloudflare.com/docs/client-api.html">https://www.cloudflare.com/docs/client-api.html</a></p>
<p><span id="more-3715"></span></p>
<p><strong>Syntax</strong>:</p>
<p></p><pre class="crayon-plain-tag">define('CLOUDFLARE_APIEMAIL','emailadr'); // replace emailadr with your api email
define('CLOUDFLARE_APIKEY','abc'); // replace abc with your api key
define('APIURL','https://www.cloudflare.com/api_json.html');

$response = wp_remote_request(APIURL, array(
    'method'    =&gt; 'POST',
    'timeout'   =&gt; 60,
    'sslverify' =&gt; false,
    'body'      =&gt; array(
         'email'    =&gt; CLOUDFLARE_APIEMAIL
        ,'tkn'      =&gt; CLOUDFLARE_APIKEY
        ,'a'        =&gt; 'ACTION' // see https://www.cloudflare.com/docs/client-api.html actions ('a') and parameters
        ,'param1'   =&gt; ''
        ,'paramN'   =&gt; ''
    )
));

if (is_wp_error( $response )) {
   echo 'Something went wrong! &lt;br /&gt;';
} else {
    $json = json_decode( wp_remote_retrieve_body($response), true); // true = return an assoc array  
    print_r($json);  
}</pre><p></p>
<p><strong>Example:</strong></p>
<p></p><pre class="crayon-plain-tag">define('CLOUDFLARE_APIEMAIL','emailadr'); // replace emailadr with your api email
define('CLOUDFLARE_APIKEY','abc'); // replace abc with your api key
define('APIURL','https://www.cloudflare.com/api_json.html');

function is_ip_ok($ip) {
    global $errmsg;
    $errmsg = '';
    $response = wp_remote_request(APIURL, array(
        'method' =&gt; 'POST',
        'timeout' =&gt; 60,
        'sslverify' =&gt; false,
        'body' =&gt;  array(
             'email' =&gt; CLOUDFLARE_APIEMAIL
            ,'tkn'   =&gt; CLOUDFLARE_APIKEY
            ,'a'     =&gt; 'ip_lkup'
            ,'ip'    =&gt;  $ip
        )
    ));
    if (is_wp_error( $response )) {
       $errmsg = $response-&gt;get_error_message();
       return true; // don't block if is_ip_ok fails
    } else {
        $json = json_decode( wp_remote_retrieve_body($response), true); // true = return an assoc array
        if ($json['result'] != 'success') {
            $errmsg = $json['msg'];
            return true; // don't block if is_ip_ok fails
        } else {
            if ($json['response'][$ip] == &quot;&quot;) {
                return true;
            } else {
                return false;
            }
        }
    }
}</pre><p></p>
]]></content:encoded>
			<wfw:commentRss>http://soderlind.no/cloudflare-api-and-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MemCachier backend for the WP Object Cache</title>
		<link>http://soderlind.no/memcachier-backend-for-the-wp-object-cache/</link>
		<comments>http://soderlind.no/memcachier-backend-for-the-wp-object-cache/#comments</comments>
		<pubDate>Tue, 18 Dec 2012 23:36:08 +0000</pubDate>
		<dc:creator>PerS</dc:creator>
				<category><![CDATA[wp-plugins]]></category>
		<category><![CDATA[AppFog]]></category>
		<category><![CDATA[appharbor]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[cloudbees]]></category>
		<category><![CDATA[cloudcontrol]]></category>
		<category><![CDATA[dotcloud]]></category>
		<category><![CDATA[ec2]]></category>
		<category><![CDATA[heroku]]></category>
		<category><![CDATA[joyent]]></category>
		<category><![CDATA[manage cache]]></category>
		<category><![CDATA[Memcached]]></category>
		<category><![CDATA[Memcachier]]></category>
		<category><![CDATA[object cache]]></category>
		<category><![CDATA[WP Object Cache]]></category>

		<guid isPermaLink="false">http://soderlind.no/?p=3682</guid>
		<description><![CDATA[I have a test site at AppFog running WordPress. Being the geek I am, I had to test MemCachier (you&#8217;ll find it in AppFog Add-Ons) MemCachier manages and scales clusters of memcache servers so you can focus on your app. Memcache is commonly used to speed up page load time and increase scalability by allowing you to [...]]]></description>
				<content:encoded><![CDATA[<p><img class="aligncenter size-medium wp-image-3704" alt="memcachier" src="http://d178exrgcizrb6.cloudfront.net/db001/wblob/18CDE396934352/3/539/EbnY7AcI5RxvcMpD8CMrfc6RWMOv-nAMAMpCqYvl44w/memcachier-300x85.png" width="300" height="85" /></p>
<p>I have a test site at AppFog running <a href="https://www.appfog.com/products/appfog/jumpstarts/">WordPress</a>. Being the geek I am, I had to test <a href="http://www.memcachier.com/">MemCachier</a> (you&#8217;ll find it in <a href="https://www.appfog.com/products/appfog/add-ons/">AppFog Add-Ons</a>)</p>
<blockquote><p>MemCachier manages and scales clusters of memcache servers so you can focus on your app. Memcache is commonly used to speed up page load time and increase scalability by allowing you to cache expensive database queries and view renders.</p></blockquote>
<p><span id="more-3682"></span><br />
Using the <a href="http://wordpress.org/extend/plugins/memcached/">Memcached Object Cache</a> source code as a starting point it was rather simple to implement MemCachier, all I had to do was to modify WP_Object_Cache::close(), WP_Object_Cache::flush() and rewrite the WP_Object_Cache constructor (line 4-28):</p>
<p></p><pre class="crayon-plain-tag">// WP_Object_Cache constructor
function WP_Object_Cache() {

include_once('plugins/memcachier/MemcacheSASL.php');

global $memcachier_servers;

if ( isset($memcachier_servers) )
$buckets = $memcachier_servers;
else
$buckets = array(
'default' =&gt; array(
getenv("MEMCACHIER_SERVERS")
)
);

reset($buckets);

foreach ( $buckets as $bucket =&gt; $servers) {
$this-&gt;mc[$bucket] = new MemcacheSASL;
foreach ( $servers as $server ) {
list ( $node, $port ) = explode(':', $server);

$this-&gt;mc[$bucket]-&gt;addServer($node, $port);
$this-&gt;mc[$bucket]-&gt;setSaslAuthData(getenv("MEMCACHIER_USERNAME"), getenv("MEMCACHIER_PASSWORD"));

}
}

global $blog_id, $table_prefix;
$this-&gt;global_prefix = '';
$this-&gt;blog_prefix = '';
if ( function_exists( 'is_multisite' ) ) {
$this-&gt;global_prefix = ( is_multisite() || defined('CUSTOM_USER_TABLE') &amp;&amp; defined('CUSTOM_USER_META_TABLE') ) ? '' : $table_prefix;
$this-&gt;blog_prefix = ( is_multisite() ? $blog_id : $table_prefix ) . ':';
}

$this-&gt;cache_hits =&amp; $this-&gt;stats['get'];
$this-&gt;cache_misses =&amp; $this-&gt;stats['add'];
}</pre><p></p>
<p><strong>Installation</strong></p>
<blockquote><p>The instructions are simple, and although they’re catered specifically for AppFog, the MemCachier WordPress plugin will work in any of our supported partners. As long as you’ve configured the MEMCACHIER_SERVERS, MEMCACHIER_USERNAME, and MEMCACHIER_PASSWORD environment variables, the plugin will work.<br />
<cite><a href="http://www.memcachier.com/2012/12/19/memcachier-powered-wordpress-object-caching/">MemCachier blog</a></cite></p></blockquote>
<ol>
<li>Add <a href="https://www.appfog.com/products/appfog/add-ons/">MemCachier</a> to your WordPress site at AppFog</li>
<li>Install the plugin by copying it to the plugins/memcachier folder</li>
<li>Move plugins/memcachier/object-cache.php to wp-content/object-cache.php</li>
</ol>
<p><strong>Changelog</strong></p>
<p>1.0</p>
<ul>
<li>Initial release</li>
</ul>
<p><strong>Credits</strong></p>
<p>I&#8217;ve only changed the WP_Object_Cache constructor, so the credits goes to <a href="http://profiles.wordpress.org/ryan/">ryan</a> and <a href="http://profiles.wordpress.org/sivel/">sivel</a> for creating the excellent <a href="http://wordpress.org/extend/plugins/memcached/">Memcached Object Cache</a>, and ronnywang for <a href="https://github.com/ronnywang/PHPMemcacheSASL">PHPMemcacheSASL</a></p>
]]></content:encoded>
			<wfw:commentRss>http://soderlind.no/memcachier-backend-for-the-wp-object-cache/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress and Pow</title>
		<link>http://soderlind.no/wordpress-and-pow/</link>
		<comments>http://soderlind.no/wordpress-and-pow/#comments</comments>
		<pubDate>Sun, 02 Dec 2012 17:41:08 +0000</pubDate>
		<dc:creator>PerS</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[how-to]]></category>
		<category><![CDATA[brew]]></category>
		<category><![CDATA[Homebrew]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Pow]]></category>
		<category><![CDATA[Powder]]></category>
		<category><![CDATA[rbenv]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[Xquartz]]></category>

		<guid isPermaLink="false">http://soderlind.no/?p=3615</guid>
		<description><![CDATA[Here is my second take on running WordPress and WordPress Multisite locally on my Mac (first is here). I just discovered Pow; &#8221;Pow is a zero-config Rack server for Mac OS X. Have it serving your apps locally in under a minute&#8221;, and my first thought was &#8220;can I run WordPress on Pow?&#8221;.  Well, here&#8217;s how I did [...]]]></description>
				<content:encoded><![CDATA[<p><img class="aligncenter size-medium wp-image-3635" alt="Apple + WordPress = POW!" src="http://d178exrgcizrb6.cloudfront.net/db001/wblob/18CDE396934352/3/535/ynbZ6S_8NASPfzINO9CKXiG89z52stonG6BFJRAhKTI/AppleWordPressPOW-300x129.png" width="300" height="129" /></p>
<p>Here is my second take on running WordPress and WordPress Multisite locally on <a href="http://soderlind.no/archives/2008/10/04/my-digital-tool-chest/">my Mac</a> (first is <a href="http://soderlind.no/archives/2011/08/26/running-wordpress-locally-on-mac-os-x-lion/">here</a>). I just discovered <a href="http://pow.cx/">Pow</a>; &#8221;<em>Pow is a zero-config Rack server for Mac OS X. Have it serving your apps locally in under a minute&#8221;, </em>and my first thought was &#8220;can I run WordPress on Pow?&#8221;.  Well, here&#8217;s how I did it (I&#8217;ll also show you how to install <strong>MySQL, PHP 5.4 and Ruby 1.93</strong> on Mac OS X Mountain Lion):</p>
<p><span id="more-3615"></span></p>
<p style="text-align: center;"><span style="color: #e91533;">This guide is work in progress, I&#8217;ll keep you updated on <a href="https://twitter.com/soderlind">twitter</a></span></p>
<a name="prerequisite"></a><h2>Prerequisite</h2>
<ul>
<li>Mac OS X Mountain Lion. I did this on a fresh Mac OS X Mountain Lion installation.</li>
<li>Download and install <a href="https://developer.apple.com/downloads/index.action">Command Line Tools (Mountain Lion) for Xcode</a>. If you&#8217;re not already registered for a free Mac Developer account, <a href="https://developer.apple.com/programs/register/">do so</a>.</li>
<li>Download and install <a href="http://xquartz.macosforge.org/landing/">Xquartz</a> so that the png.h header exists for compilation of certain brews. Mountain Lion removes X11, which contained many headers.</li>
<li>Install <a href="http://mxcl.github.com/homebrew/">Homebrew</a>, &#8220;<em>The missing package manager for OS X</em>&#8220;. Open <a href="http://en.wikipedia.org/wiki/Terminal_(OS_X)">Terminal</a>, and from the command line run:<pre class="crayon-plain-tag">ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"</pre></li>
</ul>
<p>There&#8217;s going to be a lot of cut and past from now on, but in 15 minutes you&#8217;re up and running with WordPress on Pow :).</p>
<p>One by one, copy the commands below and run them in Terminal</p>
<a name="mysql"></a><h2>MySQL</h2>
<p>When you run <code>mysql_secure_installation</code> (line 7 below), answer <strong>Y</strong> to all the questions.</p>
<p></p><pre class="crayon-plain-tag">brew install mysql
unset TMPDIR
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
mkdir -p ~/Library/LaunchAgents
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
launchctl load -w ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
/usr/local/opt/mysql/bin/mysql_secure_installation</pre><p></p>
<a name="add-wordpress-database-and-user-to-mysql"></a><h2>Add WordPress database and user to MySQL</h2>
<p></p><pre class="crayon-plain-tag">mysql -u root -p

mysql&gt; CREATE DATABASE wordpress;
mysql&gt; GRANT ALL PRIVILEGES ON wordpress.* TO wordpress@localhost IDENTIFIED BY 'Pa$$w0rd';
mysql&gt; FLUSH PRIVILEGES;
mysql&gt; EXIT</pre><p></p>
<a name="php-54"></a><h2>PHP 5.4</h2>
<p>PHP is no longer part of the default Homebrew repository, and hence you need to add the <a href="https://github.com/josegonzalez/homebrew-php">Homebrew-PHP</a> repository. WordPress and Pow only needs mysql and php-cgi. If you&#8217;d like to add more features, run <code>brew options php54</code> from the command line to see the available configurations.</p>
<p></p><pre class="crayon-plain-tag">brew tap homebrew/dupes
brew tap josegonzalez/homebrew-php
brew install php54 --with-mysql --with-cgi</pre><p></p>
<a name="ruby-upgraded-using-rbenv"></a><h2>Ruby upgraded using rbenv</h2>
<p>The default Ruby version on Mountain Lion is a bit old (yepp, that&#8217;s an understatement). Pow is a Ruby/Rack web server, and it runs best on the latest version of Ruby. <a href="https://github.com/sstephenson/rbenv">rbenv</a> in combination with <a href="https://github.com/sstephenson/ruby-build">ruby-build</a>, allows you to install Ruby in your user space.</p>
<p></p><pre class="crayon-plain-tag">brew update
brew install rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' &gt;&gt; ~/.bash_profile
echo 'eval "$(rbenv init -)"' &gt;&gt; ~/.bash_profile
source .bash_profile
brew install ruby-build
rbenv install --list
rbenv install 1.9.3-p327
rbenv rehash
rbenv global 1.9.3-p327</pre><p></p>
<a name="pow-and-powder"></a><h2>Pow and Powder</h2>
<p>Pow was created to run Rails/Rack applications, but we want to <a href="http://stuff-things.net/2011/05/16/legacy-development-with-pow/">run legacy applications on Pow</a> (ie PHP / WordPress) and need the rack-legacy rack-rewrite gems.<br />
<a href="http://pow.cx/manual.html">Pow is easy</a>, but <a href="https://github.com/rodreegez/powder">Powder</a> makes it even easier, with a lot of <a href="https://github.com/rodreegez/powder#readme">management commands for Pow</a>.</p>
<p></p><pre class="crayon-plain-tag">gem install rack-legacy rack-rewrite
gem install powder
rbenv rehash
powder install</pre><p></p>
<a name="wordpress"></a><h2>WordPress</h2>
<p>Ta-da, finally there, just have to grab wget first.<br />
The config.ru file, saved in ~/Sites/config, is a configuration file with <a href="https://github.com/jtrupiano/rack-rewrite#readme">rewrite rules</a> (think .htaccess) for WordPress. <del datetime="2012-12-04T21:01:47+00:00">At the moment it doesn&#8217;t support multisite, but I&#8217;m working on it.</del> <a href="https://gist.github.com/4208560">Forked the git</a> below and added support for WordPress Multisite</p>
<p></p><pre class="crayon-plain-tag">brew install wget
mkdir ~/Sites
cd ~/Sites
git clone git://gist.github.com/4208560.git config
wget http://wordpress.org/latest.tar.gz
tar zxvf latest.tar.gz
mv wordpress myblog
cd ~/Sites/myblog
ln -s ~/Sites/config/config.ru
powder link
powder open</pre><p></p>
<a name="adding-another-wordpress-site"></a><h2>Adding another WordPress site</h2>
<p>Yes, you can :)</p>
<p></p><pre class="crayon-plain-tag">cd ~/Sites
tar zxvf latest.tar.gz
mv wordpress myblog2
cd ~/Sites/myblog2
ln -s ~/Sites/config/config.ru
powder link
powder open</pre><p></p>
<p><a name="multisite"></a></p>
<a name="wordpress-multisite-on-pow"></a><h2>WordPress Multisite on Pow</h2>
<p>I highly recommend that you create a separate database for your multisite, so let&#8217;s do that first</p>
<p></p><pre class="crayon-plain-tag">mysql -u root -p

mysql&gt; CREATE DATABASE multisite;
mysql&gt; GRANT ALL PRIVILEGES ON multisite.* TO wordpress@localhost IDENTIFIED BY 'Pa$$w0rd';
mysql&gt; FLUSH PRIVILEGES;
mysql&gt; EXIT</pre><p></p>
<p>next, install WordPress</p>
<p></p><pre class="crayon-plain-tag">cd ~/Sites
tar zxvf latest.tar.gz
mv wordpress multisite
cd ~/Sites/multisite
ln -s ~/Sites/config/config.ru
powder link
powder open</pre><p></p>
<p>When you&#8217;re finished adding your site to the multisite database and it&#8217;s up and running, edit multisite/wp-config.php and add the following just <strong>above</strong> the line reading<br />
<code>/* That’s all, stop editing! Happy blogging. */</code></p>
<p></p><pre class="crayon-plain-tag">/* Multisite */
define('WP_ALLOW_MULTISITE', true);</pre><p></p>
<p>You will need to refresh your browser to continue, then go to <strong>Tools &gt; Network Setup</strong>.</p>
<p>In Network Setup, select <strong>Sub-domains</strong> (more about why, below), fill in the Network Details and click Install. On the next page follow step 1 and 2. You don&#8217;t need a .htaccess file, config.ru added above handles rewrites.</p>
<p>Why sub-domains:</p>
<p><a href="http://pow.cx/manual.html#section_2.1.1">In Pow</a>, once a virtual host is installed, it&#8217;s also automatically accessible from all subdomains of the named host. For example, the http://multisite.dev/ virtual host added above can also be accessed at http://subdomain.multisite.dev/ and http://blog.multisite.dev/, which is perfect for a WordPress Multisite installation.</p>
]]></content:encoded>
			<wfw:commentRss>http://soderlind.no/wordpress-and-pow/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>WordPress plugins and permalinks, how to use pretty links in your plugin</title>
		<link>http://soderlind.no/wordpress-plugins-and-permalinks-how-to-use-pretty-links-in-your-plugin/</link>
		<comments>http://soderlind.no/wordpress-plugins-and-permalinks-how-to-use-pretty-links-in-your-plugin/#comments</comments>
		<pubDate>Thu, 01 Nov 2012 01:12:04 +0000</pubDate>
		<dc:creator>PerS</dc:creator>
				<category><![CDATA[wp-plugins]]></category>
		<category><![CDATA[flush_rewrite_rules]]></category>
		<category><![CDATA[generate_rewrite_rules]]></category>
		<category><![CDATA[parse_request]]></category>
		<category><![CDATA[permalink_structure]]></category>
		<category><![CDATA[query_vars]]></category>
		<category><![CDATA[wp_rewrite]]></category>

		<guid isPermaLink="false">http://soderlind.no/?p=3534</guid>
		<description><![CDATA[I&#8217;m working on a plugin, Read Offline, and one of the wishes was for url friendly links. After intensive googling, here&#8217;s how I did it: &#8220;My Permalink Demo&#8221; plugin: [crayon-519f5a81aab41/] How to test the &#8220;My Permalink Demo&#8221; plugin Save the code above as wp-content/plugins/ps_my_permalink.php Activate the &#8220;My Permalink Demo&#8221; plugin add the [mypermalink] or [mypermalink [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;m working on a plugin, <a href="http://soderlind.no/archives/2012/10/01/read-offline/">Read Offline</a>, and one of the wishes was for url friendly links. After intensive googling, here&#8217;s how I did it:</p>
<p><span id="more-3534"></span></p>
<p><strong>&#8220;My Permalink Demo&#8221; plugin:</strong></p>
<p></p><pre class="crayon-plain-tag">&lt;?php
/*
Plugin Name: My Permalink Demo
Plugin URI: http://soderlind.no/archives/2012/11/01/wordpress-plugins-and-permalinks-how-to-use-pretty-links-in-your-plugin/
Description: Demo plugin to show how to implement your custom permalink for your plugin. To test, add the [mypermalink] or [mypermalink val=&quot;ipsum&quot;] shortcode to a page or post.
Version: 1.0.1
Author: Per Soderlind
Author URI: http://soderlind.no/
*/

if (!class_exists('my_permalink')) {
    class my_permalink {

        function __construct(){
            // demo shortcode
            add_shortcode('mypermalink', array(&amp;$this,'my_permalink_demo_shortcode'));

            // permalink hooks:
            add_filter('generate_rewrite_rules', array(&amp;$this,'my_permalink_rewrite_rule'));
            add_filter('query_vars', array(&amp;$this,'my_permalink_query_vars'));
            add_filter('admin_init', array(&amp;$this, 'my_permalink_flush_rewrite_rules'));
            add_action(&quot;parse_request&quot;, array(&amp;$this,&quot;my_permalink_parse_request&quot;));
        }

        /**************************************************************************
         * Demo shortcode
         * A simple shortcode used to demonstrate the plugin.
         *
         * @see http://codex.wordpress.org/Shortcode_API
         * @param array $atts shortcode parameters
         * @return string URL to demonstrate custom permalink
         **************************************************************************/
        function my_permalink_demo_shortcode($atts) {
            extract(shortcode_atts(array(
                // default values
                'val'       =&gt;   'lorem'
            ), $atts));
            return sprintf('&lt;a href=&quot;%s&quot;&gt;My permalink&lt;/a&gt;',$this-&gt;my_permalink_url($val));
        }

        /**************************************************************************
         * Create your URL
         * If the blog has a permalink structure, a permalink is returned. Otherwise
         * a standard URL with param=val.
         *
         * @param sting $val Parameter to custom url
         * @return string URL
         **************************************************************************/
        function my_permalink_url($val) {
            if ( get_option('permalink_structure')) { // check if the blog has a permalink structure
                return sprintf(&quot;%s/my-permalink/%s&quot;,home_url(),$val);
            } else {
                return sprintf(&quot;%s/index.php?my_permalink_variable_01=%s&quot;,home_url(),$val);
            }
        }

        /**************************************************************************
         * Add your rewrite rule.
         * The rewrite rules array is an associative array with permalink URLs as regular
         * expressions (regex) keys, and the corresponding non-permalink-style URLs as values
         * For the rule to take effect, For the rule to take effect, flush the rewrite cache,
         * either by re-saving permalinks in Settings-&gt;Permalinks, or running the
         * my_permalink_flush_rewrite_rules() method below.
         *
         * @see http://codex.wordpress.org/Custom_Queries#Permalinks_for_Custom_Archives
         * @param object $wp_rewrite
         * @return array New permalink structure
         **************************************************************************/
        function my_permalink_rewrite_rule( $wp_rewrite ) {
            $new_rules = array(
                 'my-permalink/(.*)$' =&gt; sprintf(&quot;index.php?my_permalink_variable_01=%s&quot;,$wp_rewrite-&gt;preg_index(1))
                 /*
                 // a more complex permalink:
                 'my-permalink/([^/]+)/([^.]+).html$' =&gt; sprintf(&quot;index.php?my_permalink_variable_01=%s&amp;my_permalink_variable_02=%s&quot;,$wp_rewrite-&gt;preg_index(1),$wp_rewrite-&gt;preg_index(2))
                 */
            );

            $wp_rewrite-&gt;rules = $new_rules + $wp_rewrite-&gt;rules;
            return $wp_rewrite-&gt;rules;
        }

        /**************************************************************************
         * Add your custom query variables.
         * To make sure that our parameter value(s) gets saved,when WordPress parse the URL,
         * we have to add our variable(s) to the list of query variables WordPress
         * understands (query_vars filter)
         *
         * @see http://codex.wordpress.org/Custom_Queries
         * @param array $query_vars
         * @return array $query_vars with custom query variables
         **************************************************************************/
        function my_permalink_query_vars( $query_vars ) {
            $query_vars[] = 'my_permalink_variable_01';
            /*
            // need more variables?:
            $query_vars[] = 'my_permalink_variable_02';
            $query_vars[] = 'my_permalink_variable_03';
            */
            return $query_vars;
        }

        /**************************************************************************
         * Parses a URL into a query specification
         * This is where you should add your code.
         *
         * @see http://codex.wordpress.org/Query_Overview
         * @param array $atts shortcode parameters
         * @return string URL to demonstrate custom permalink
         **************************************************************************/
        function my_permalink_parse_request($wp_query) {
            if (isset($wp_query-&gt;query_vars['my_permalink_variable_01'])) { // same as the first custom variable in my_permalink_query_vars( $query_vars )
                // add your code here, code below is for this demo
                printf(&quot;&lt;pre&gt;%s&lt;/pre&gt;&quot;,print_r($wp_query-&gt;query_vars,true));
                exit(0);
            }
        }

        /**************************************************************************
         * Flushes the permalink structure.
         * flush_rules is an extremely costly function in terms of performance, and
         * should only be run when changing the rule.
         *
         * @see http://codex.wordpress.org/Rewrite_API/flush_rules
         **************************************************************************/
        function my_permalink_flush_rewrite_rules() {
            $rules = $GLOBALS['wp_rewrite']->wp_rewrite_rules();
            if ( ! isset( $rules['my-permalink/(.*)$'] ) ) { // must be the same rule as in my_permalink_rewrite_rule($wp_rewrite)
                global $wp_rewrite;
                $wp_rewrite-&gt;flush_rules();
            }
        }
    } //End Class
} //End if class exists statement

if (class_exists('my_permalink')) {
    $my_permalink_var = new my_permalink();
}
?&gt;</pre><p></p>
<p><strong>How to test the &#8220;</strong><strong>My Permalink Demo&#8221; plugin</strong></p>
<ul>
<li>Save the code above as wp-content/plugins/ps_my_permalink.php</li>
<li>Activate the &#8220;My Permalink Demo&#8221; plugin</li>
<li>add the <code>[mypermalink]</code> or <code>[mypermalink val="ipsum"]</code> shortcode to a page or post</li>
</ul>
<p><strong>Tools</strong></p>
<ul>
<li>Debugging permalink errors is hard, I highly recommend <a href="http://wordpress.org/extend/plugins/monkeyman-rewrite-analyzer/">Rewrite Analyzer</a> (it helped me).</li>
</ul>
<p><strong>Changelog</strong></p>
<p>1.0.2</p>
<ul>
<li>Thanks to <a href="http://soderlind.no/read-offline/comment-page-1/#comment-209996">Paul</a>, the plugin now only flushes the rewrite rules when needed.</li>
</ul>
<p>1.0.1</p>
<ul>
<li>Fixed a bug in my_permalink_url() that gave 404 for blogs in a subdirectory</li>
</ul>
<p>1.0.0</p>
<ul>
<li>Initial release</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://soderlind.no/wordpress-plugins-and-permalinks-how-to-use-pretty-links-in-your-plugin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Making cbnet Multi Author Comment Notification 1.1.2  WordPress multisite aware</title>
		<link>http://soderlind.no/making-cbnet-multi-author-comment-notification-1-1-2-wordpress-multisite-aware/</link>
		<comments>http://soderlind.no/making-cbnet-multi-author-comment-notification-1-1-2-wordpress-multisite-aware/#comments</comments>
		<pubDate>Wed, 03 Oct 2012 22:03:40 +0000</pubDate>
		<dc:creator>PerS</dc:creator>
				<category><![CDATA[wp-plugins]]></category>

		<guid isPermaLink="false">http://soderlind.no/?p=3428</guid>
		<description><![CDATA[You don&#8217;t need this fix any more, the latest version works with multi site. 2.0 WARNING: Old settings will not be retained Changelog Here&#8217;s a quick fix (test it before deploying to production) that lets you use the cbnet Multi Author Comment Notification 1.1.2 plugin in a WordPress multisite environment: Replace: [crayon-519f5a81ab054/] With: [crayon-519f5a81ab0d0/] Provided [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://d178exrgcizrb6.cloudfront.net/db001/wblob/18CDE396934352/3/511/9SpNWYFklwg6cyXQobWc0zfn8eNEDSJbo0bJEqqq2TA/mu-multi-author-notification.png"><img class="aligncenter size-medium wp-image-3441" alt="multisite multi author notification" src="http://d178exrgcizrb6.cloudfront.net/db001/wblob/18CDE396934352/3/516/626uSkk4jBU1vL6yNNmVlrdzEcjGMlssakfgtX2SrTA/mu-multi-author-notification-300x236.png" width="300" height="236" /></a></p>
<p><strong>You don&#8217;t need this fix any more, the <a href="http://wordpress.org/extend/plugins/cbnet-multi-author-comment-notification/">latest version</a> works with multi site.</strong></p>
<blockquote><p>2.0 WARNING: Old settings will not be retained<br />
<cite><a href="http://wordpress.org/extend/plugins/cbnet-multi-author-comment-notification/changelog/">Changelog</a></cite></p></blockquote>
<p>Here&#8217;s a quick fix (test it before deploying to production) that lets you use the <a href="http://wordpress.org/extend/plugins/cbnet-multi-author-comment-notification/">cbnet Multi Author Comment Notification 1.1.2</a> plugin in a WordPress multisite environment:</p>
<p><span id="more-3428"></span></p>
<p><strong>Replace</strong>:</p>
<p></p><pre class="crayon-plain-tag">$user_array = array();
$query = "SELECT ID FROM $wpdb-&gt;users";
$result = $wpdb-&gt;get_results($query, ARRAY_A);
foreach ( (array)$result as $key=&gt;$row ) {
$data = get_userdata($row['ID']);
$data-&gt;wp_user_level = intval($data-&gt;wp_user_level);
$userid = $data-&gt;ID;
$username = $data-&gt;user_login;
$fullname = $data-&gt;first_name.' '.$data-&gt;last_name;
$email = $data-&gt;user_email;
$level = @key($data-&gt;wp_capabilities);
$user_array[$data-&gt;wp_user_level][] = array($userid, $username, $fullname, $email, $level);
}</pre><p></p>
<p><strong>With</strong>:</p>
<p></p><pre class="crayon-plain-tag">$user_array = array();
$get_users_args = array(
'blog_id' =&gt; get_current_blog_id()
);
$current_blog_base_prefix = (is_multisite()) ? $wpdb-&gt;base_prefix . get_current_blog_id() . '_' : $wpdb-&gt;base_prefix;
$result = get_users($get_users_args);
foreach ($result as $row) {
$data = get_userdata($row-&gt;ID);
$data-&gt;wp_user_level = intval(get_user_meta($row-&gt;ID, $current_blog_base_prefix . 'user_level',true));
$userid = $data-&gt;ID;
$username = $data-&gt;user_login;
$fullname = $data-&gt;first_name.' '.$data-&gt;last_name;
$email = $data-&gt;user_email;
$level = @key(get_user_meta($row-&gt;ID, $current_blog_base_prefix . 'capabilities',true));
$user_array[$data-&gt;wp_user_level][] = array($userid, $username, $fullname, $email, $level);
}</pre><p></p>
<p>Provided as-is, aka not supported (yet)</p>
]]></content:encoded>
			<wfw:commentRss>http://soderlind.no/making-cbnet-multi-author-comment-notification-1-1-2-wordpress-multisite-aware/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Read Offline</title>
		<link>http://soderlind.no/read-offline/</link>
		<comments>http://soderlind.no/read-offline/#comments</comments>
		<pubDate>Sun, 30 Sep 2012 23:15:06 +0000</pubDate>
		<dc:creator>PerS</dc:creator>
				<category><![CDATA[wp-plugins]]></category>

		<guid isPermaLink="false">http://soderlind.no/?p=3392</guid>
		<description><![CDATA[I&#8217;m working on a plugin which allows you to download and read posts and pages offline in pdf, epub and mobi formats, and I need beta testers (please share this page with WordPress friends). Please use the comments field below if you find bugs, typos etc. Features Settings page (Settings-&#62;Read Offline) Read Offline widget (output shown [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://d178exrgcizrb6.cloudfront.net/db001/wblob/18CDE396934352/3/525/jqFYk1GsBV-0h3Qm60WiuXiz4wqF6nyiV_u7erVBogw/readoffline-example1.png"><img class="aligncenter size-medium wp-image-3843" alt="Read Offline example" src="http://d178exrgcizrb6.cloudfront.net/db001/wblob/18CDE396934352/3/529/l83Trw-lf7ylCKblVRXRhkg-02EIHpkwAB5dD3cWfm0/readoffline-example1-300x190.png" width="300" height="190" /></a><br />
I&#8217;m working on a plugin which allows you to download and read posts and pages offline in pdf, epub and mobi formats, and <strong>I need beta testers </strong>(please share this page with WordPress friends).</p>
<p>Please use the <a href="http://soderlind.no/archives/2012/10/01/read-offline/#respond">comments field below</a> if you find bugs, typos etc.</p>
<p><span id="more-3392"></span></p>
<p><strong>Features</strong></p>
<ul>
<li><a href="http://d178exrgcizrb6.cloudfront.net/db001/wblob/18CDE396934352/3/51E/1jBTdDqJN3H1CV9bOIv64p5L5yjj7onqwrf4hlTO6Yg/readoffline-settings.png">Settings page</a> (Settings-&gt;Read Offline)</li>
<li><a href="http://d178exrgcizrb6.cloudfront.net/db001/wblob/18CDE396934352/3/51C/Wjao97Qrpl2lxJ2g1EnXmyO7EoSoa7MZu9vPzuzRCsE/readoffline-widget.png">Read Offline widget</a> (output shown in the image above)</li>
<li>Read Offline shortcode</li>
<li>You can download a pdf, epub or mobi file containing the current post or page (you have to add the Read Offline widget to see the download links)</li>
<li>The download filename is based on the posts slug (<code>$post-&gt;post_name</code>)</li>
<li>Adds meta data to the file
<ul>
<li>Title (PDF, ePub and mobi)<pre class="crayon-plain-tag">$post-&gt;post_title</pre></li>
<li>Author (PDF, ePub and mobi)<pre class="crayon-plain-tag">get_the_author_meta('display_name',$post-&gt;post_author)</pre></li>
<li>Subject (mobi)<pre class="crayon-plain-tag">implode(' ,',array_map("get_cat_name", wp_get_post_categories($post-&gt;ID)))</pre></li>
<li>Publisher (ePub)<pre class="crayon-plain-tag">setPublisher(get_bloginfo( 'name' ), get_bloginfo( 'url' ))</pre></li>
<li>Identifier (uPub)<pre class="crayon-plain-tag">$post-&gt;guid</pre></li>
<li>Source URL (ePub)<pre class="crayon-plain-tag">$post-&gt;guid</pre></li>
<li>Language (ePub)<pre class="crayon-plain-tag">$iso6391 = ( '' == get_locale() ) ? 'en' : strtolower( substr(get_locale(), 0, 2) );</pre></li>
</ul>
</li>
<li>Option: Add download links to the top and bottom of a post or page.</li>
<li>Permalink support (/read-offline/&#8221;postid&#8221;/&#8221;post-name&#8221;.&#8221;type&#8221;). I&#8217;ve written a <a href="http://soderlind.no/archives/2012/11/01/wordpress-plugins-and-permalinks-how-to-use-pretty-links-in-your-plugin/">how-to add permalink to plugins</a> guide.</li>
<li>Option: Add a custom style to the ePub and PDF file</li>
<li>Option: Google Analytics read-offline event tracking. You can find these under Content » Events in your Google Analytics reports. Assumes you’re using the <a href="&quot;http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html&quot;">Asynchronous version of Google Analytics</a>.</li>
<li>languages/read-offline.po for easy translation.</li>
</ul>
<p><strong>To-do / Wish List</strong></p>
<ul>
<li><a href="http://soderlind.no/archives/2012/10/01/read-offline/#comment-209934">Bookmark posts</a></li>
<li>Export post / page as Word (.docx)</li>
<li><a href="http://soderlind.no/archives/2012/10/01/read-offline/#comment-209949">Add unique headers/footers</a></li>
<li>more ? Please <a href="http://soderlind.no/archives/2012/10/01/read-offline/#respond">post a comment</a> if you have any suggestions</li>
</ul>
<p><strong>Use</strong></p>
<p>There are 3 ways you can add the Read Offline link</p>
<ol>
<li>At the top or bottom of each post and/or page (See Settings-&gt;Read Offline)</li>
<li>Using the Read Offline widget</li>
<li>Using the <code>[readoffline]</code> shortcode</li>
</ol>
<p><a name="shortcode"></a><br />
The <code>[readoffline]</code> shortcode has the following parameters</p>
<ul>
<li>format=&#8221;epub&#8221;, default: format=&#8221;pdf,epub,mobi&#8221;</li>
<li>text=&#8221;Read %title offline:&#8221;, default: text=&#8221;". <code>%title%</code> will be replaced with the post or page title</li>
<li>icononly=&#8221;true&#8221;, default=&#8221;false&#8221;</li>
</ul>
<p>Examples</p>
<ul>
<li><code>[readoffline]</code> is the same as <code>[readoffline text="" format="pdf,epub,mobi" icononly="false"]</code></li>
<li><code>[readoffline text="Download %title%:" format="epub"]</code></li>
</ul>
<p><strong>Credits</strong>:</p>
<p>The plugin is using the following libraries</p>
<ul>
<li><a href="http://www.phpclasses.org/package/6115">Epub</a> , License: GNU LGPL, Attribution required for commercial implementations, requested for everything else.</li>
<li><a href="http://www.phpclasses.org/package/6110">Zip</a>, License: GNU LGPL, Attribution required for commercial implementations, requested for everything else.</li>
<li><a href="https://github.com/raiju/phpMobi">phpMobi</a>, License: Apache license (version 2.0)</li>
<li><a href="http://www.mpdf1.com/mpdf/index.php">mpdf</a>, License: GNU General Public License version 2</li>
</ul>
<p>The plugin is using the following icons</p>
<ul>
<li>PDF icon from the <a href="http://p.yusukekamiyamane.com/">Fugue Icons set</a> by Yusuke Kamiyamane, released under a <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons attribution license</a></li>
<li><a href="http://smithsrus.com/e-book-download-icons/">ePub and mobi icons by Doug Smith</a>, also released under a <a href="http://creativecommons.org/licenses/by/3.0/">Creative Commons attribution license</a></li>
</ul>
<p><strong>Changelog</strong></p>
<p>0.1.9</p>
<ul>
<li>Fixed a bug in permalinks that gave 404 for blogs in a subdirectory. Also removed code that gave error when downloading an ePub.</li>
</ul>
<p>0.1.8</p>
<ul>
<li>Added Google Analytics read-offline event tracking. You can find these under Content » Events in your Google Analytics reports. Assumes you’re using the <a href="&quot;http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html&quot;">Asynchronous version of Google Analytics</a></li>
</ul>
<p>0.1.7</p>
<ul>
<li>Minor bug fix</li>
</ul>
<p>0.1.6</p>
<ul>
<li>Added the option to add custom css to PDF</li>
</ul>
<p>0.1.5</p>
<ul>
<li>In Settings-&gt;Read Offline, added the option to add custom css to EPub</li>
<li>Added languages/read-offline.po for easy translation.</li>
</ul>
<p>0.1.4</p>
<ul>
<li>Added permalink support (/read-offline/&#8221;postid&#8221;/&#8221;post-name&#8221;.&#8221;type&#8221;). I&#8217;ve written a <a href="http://soderlind.no/archives/2012/11/01/wordpress-plugins-and-permalinks-how-to-use-pretty-links-in-your-plugin/">how-to add permalink to plugins guide</a></li>
<li>removed the obsolete download.php</li>
</ul>
<p>0.1.3</p>
<ul>
<li>epub will now validate against <a href="http://www.epubconversion.com/ePub-validator-iBook.jsp" rel="nofollow">http://www.epubconversion.com/ePub-validator-iBook.jsp</a></li>
<li>Added language variable to the epub file, ISO 639-1 two letter tag based on the WordPress get_locale()</li>
</ul>
<p>0.1.2</p>
<ul>
<li>Fix typo in download.php, was including  &#8221;Epub.inc.php&#8221;,  correct is &#8220;EPub.inc.php&#8221;</li>
</ul>
<p>0.1.1</p>
<ul>
<li>Bugfix, v0.1.0 will give you &#8220;gray screen of death&#8221;, so please upgrade to this version</li>
</ul>
<p>0.1.0</p>
<ul>
<li>Added the Read Offline shortcode</li>
<li>Added, in Settings-&gt;Read Offline, option to add Read Offline to top and/or bottom of post and page</li>
</ul>
<p>0.0.2</p>
<ul>
<li>Filename based on the posts slug</li>
<li>Added meta data</li>
</ul>
<p>0.0.1</p>
<ul>
<li>Initial release</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://soderlind.no/read-offline/feed/</wfw:commentRss>
		<slash:comments>60</slash:comments>
		</item>
		<item>
		<title>Arrays, Arrays, Arrays; aka Piklist for WordPress</title>
		<link>http://soderlind.no/arrays-arrays-arrays-aka-piklist-for-wordpress/</link>
		<comments>http://soderlind.no/arrays-arrays-arrays-aka-piklist-for-wordpress/#comments</comments>
		<pubDate>Tue, 25 Sep 2012 20:45:14 +0000</pubDate>
		<dc:creator>PerS</dc:creator>
				<category><![CDATA[general]]></category>
		<category><![CDATA[wp_list_table]]></category>

		<guid isPermaLink="false">http://soderlind.no/?p=3372</guid>
		<description><![CDATA[Piklist, still in beta, is a must-have that will save you hours of development time. It&#8217;s also a WordPress framework (maybe THE WordPress framework). Here&#8217;s an example I&#8217;ve created. This is still very beta, the table.php I&#8217;ve written is based upon the Custom List Table Example plugin, and I haven&#8217;t created the class-piklist-table.php backend yet: [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://piklist.com/">Piklist</a>, still in beta, is a must-have that will save you hours of development time. It&#8217;s also a WordPress framework (maybe THE WordPress framework).</p>
<p>Here&#8217;s an example I&#8217;ve created. This is still very beta, the table.php I&#8217;ve written is based upon the <a href="http://wordpress.org/extend/plugins/custom-list-table-example/">Custom List Table Example plugin</a>, and I haven&#8217;t created the class-piklist-table.php backend yet:</p>
<p><span id="more-3372"></span><br />
The following piklist array:</p>
<p><a href="http://d178exrgcizrb6.cloudfront.net/db001/wblob/18CDE396934352/3/50C/zz6nKbrlYMpHoOiDCzhdVJSAj-rYtxuGcA4Fen6oM6o/piklist-table.png"><img class="aligncenter size-medium wp-image-3374" title="Piklist table definition" src="http://d178exrgcizrb6.cloudfront.net/db001/wblob/18CDE396934352/3/50E/tHv3u7qvsIDIVjgiw_1TSrtllgC_tMJ-O_UG7jo9vEY/piklist-table-300x283.png" alt="" width="300" height="283" /></a></p>
<p>Creates this table:</p>
<p><a href="http://d178exrgcizrb6.cloudfront.net/db001/wblob/18CDE396934352/3/501/RzUIk_j8yVxY_p51m2jzErgi1QbaNQVPQaaGRF9Ae9A/piklist-table-rendered.png"><img class="aligncenter size-medium wp-image-3373" title="Piklist table rendered" src="http://d178exrgcizrb6.cloudfront.net/db001/wblob/18CDE396934352/3/507/FdKCWY8QiFUNrc_PSmrPN6_yeS68-5vLGTZzojxFHjY/piklist-table-rendered-300x111.png" alt="" width="300" height="111" /></a></p>
<p>If I have whet your appetite and you want to learn more about Piklist, start with the WordCamp NYC 2012 presentation (coding starts 13 minutes into the presentation):</p>
<p style="text-align: center;"><object width="600" height="336" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="src" value="http://s0.videopress.com/player.swf?v=1.03" /><param name="wmode" value="direct" /><param name="seamlesstabbing" value="true" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="overstretch" value="true" /><param name="flashvars" value="guid=sxdJ6peX&isDynamicSeeking=true" /><embed width="600" height="336" type="application/x-shockwave-flash" src="http://s0.videopress.com/player.swf?v=1.03" wmode="direct" seamlesstabbing="true" allowfullscreen="true" allowscriptaccess="always" overstretch="true" flashvars="guid=sxdJ6peX&isDynamicSeeking=true" /></object></p>
<p>After you&#8217;ve viewed the presentation, read the Piklist <a href="http://piklist.com/user-guide/tutorials/">tutorials</a> and <a href="http://piklist.com/user-guide/docs/">documentation</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://soderlind.no/arrays-arrays-arrays-aka-piklist-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using apc
Object Caching 992/1156 objects using apc
Content Delivery Network via Amazon Web Services: CloudFront: d239d8n5dx9u4v.cloudfront.net
Application Monitoring using New Relic

 Served from: soderlind.no @ 2013-05-24 12:18:09 by W3 Total Cache -->