<?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>Konstantin Kovshenin</title>
	<atom:link href="http://kovshenin.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://kovshenin.com</link>
	<description>WordPress, Automattic and Open Source</description>
	<lastBuildDate>Tue, 11 Jun 2013 19:37:35 +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>Don&#8217;t do_shortcode</title>
		<link>http://kovshenin.com/2013/dont-do_shortcode/</link>
		<comments>http://kovshenin.com/2013/dont-do_shortcode/#comments</comments>
		<pubDate>Mon, 10 Jun 2013 14:02:23 +0000</pubDate>
		<dc:creator>Konstantin Kovshenin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[shortcodes]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kovshenin.com/?p=7433</guid>
		<description><![CDATA[Shortcodes are pretty cool, and the do_shortcode function is pretty neat as it can parse and execute shortcode callbacks from arbitrary strings, but that function invokes a fairly large regex every time it is called. That regex looks for all registered shortcodes within a string. For each match, it runs a replacement with a callback [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://codex.wordpress.org/Shortcode_API">Shortcodes</a> are pretty cool, and the <a href="http://codex.wordpress.org/Function_Reference/do_shortcode">do_shortcode</a> function is pretty neat as it can parse and execute shortcode callbacks from arbitrary strings, but that function invokes a <a href="http://core.trac.wordpress.org/browser/trunk/wp-includes/shortcodes.php">fairly large regex</a> every time it is called.</p>
<p>That regex looks for all registered shortcodes within a string. For each match, it runs a replacement with a callback function, which also take the time to parse the shortcode attributes, before finally calling the actual callback function that&#8217;s been registered with <code>add_shortcode</code>.</p>
<p>Regular expressions are pretty fast in PHP, especially for short strings, but do we really have to have WordPress do all that extra work, when all we really intended was to call our shortcode callback function?</p>
<pre>echo do_shortcode( '[foo]' ); // Boo
echo foo_shortcode_callback(); // Yey!
</pre>
<p>I ran a quick search in the plugins directory, using the following regex:</p>
<pre>do_shortcode\(\s*['"]\[
</pre>
<p>Not the best crafted regex, but it&#8217;s supposed to look for calls to <code>do_shortcode</code> followed by a string literal starting with an opening square bracket. Obviously it might get a few false positives for special cases, but it also misses quite a few matches where the shortcode string is put into a variable first.</p>
<p>I found over <a href="https://gist.github.com/kovshenin/5748924">600 entries</a> in over 270 plugins, including some of my own. Guilty! So the lesson I learned today is: don&#8217;t use <code>do_shortcode</code> when you can use your callback function directly, which is much more efficient.</p>
<p><a href="http://kovshenin.com/2013/dont-do_shortcode/?utm_source=feed&#038;utm_medium=click_here_to_comment&#038;utm_campaign=feed#comments">Click here to comment</a></p>
<h3>More from Konstantin Kovshenin</h3>
<ul>
<li><a href="http://kovshenin.com/2013/wordpress-turns-10/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">WordPress Turns 10!</a></a></li>
<li><a href="http://kovshenin.com/2013/wordcamp-austin-was-a-blast/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">WordCamp Austin Was a Blast!</a></a></li>
<li><a href="http://kovshenin.com/2013/dont-hide-the-fact-that-youre-using-wordpress/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Don&#8217;t Hide the Fact That You&#8217;re Using WordPress</a></a></li>
<li><a href="http://kovshenin.com/2013/get_template_part-within-shortcodes/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Using get_template_part within Shortcodes</a></a></li>
<li><a href="http://kovshenin.com/2013/attending-wordcamp-austin-2013/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Attending WordCamp Austin 2013</a></a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://kovshenin.com/2013/dont-do_shortcode/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>WordPress Turns 10!</title>
		<link>http://kovshenin.com/2013/wordpress-turns-10/</link>
		<comments>http://kovshenin.com/2013/wordpress-turns-10/#comments</comments>
		<pubDate>Mon, 27 May 2013 07:32:22 +0000</pubDate>
		<dc:creator>Konstantin Kovshenin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[meetup]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kovshenin.com/?p=7427</guid>
		<description><![CDATA[Ten years of WordPress, wow! I started a simple tech blog as a hobby using WordPress 2.6 over five years ago. Today I work on some of the largest WordPress instances in the world, I write plugins and themes, and contribute to WordPress Core. WordPress has changed my life. I&#8217;m co-organizing a WordPress anniversary meetup [...]]]></description>
				<content:encoded><![CDATA[<p>Ten years of WordPress, wow! I started a simple tech blog as a hobby using WordPress 2.6 over five years ago. Today I work on some of the largest WordPress instances in the world, I write plugins and themes, and contribute to WordPress Core. WordPress has changed my life.</p>
<p>I&#8217;m co-organizing a <a href="http://www.meetup.com/WordPress/">WordPress anniversary meetup</a> tonight here <a href="http://wp.me/p2zDBA-dq">in Moscow</a>. We&#8217;ll be looking through some of the WordPress releases, and maybe peek into <a href="http://cafelog.com/">b2</a>. We&#8217;ll also talk about translating WordPress themes and plugins into Russian, so come join us if you&#8217;re in town.</p>
<h3>More from Konstantin Kovshenin</h3>
<ul>
<li><a href="http://kovshenin.com/2013/dont-do_shortcode/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Don&#8217;t do_shortcode</a></a></li>
<li><a href="http://kovshenin.com/2013/wordcamp-austin-was-a-blast/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">WordCamp Austin Was a Blast!</a></a></li>
<li><a href="http://kovshenin.com/2013/dont-hide-the-fact-that-youre-using-wordpress/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Don&#8217;t Hide the Fact That You&#8217;re Using WordPress</a></a></li>
<li><a href="http://kovshenin.com/2013/get_template_part-within-shortcodes/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Using get_template_part within Shortcodes</a></a></li>
<li><a href="http://kovshenin.com/2013/attending-wordcamp-austin-2013/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Attending WordCamp Austin 2013</a></a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://kovshenin.com/2013/wordpress-turns-10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordCamp Austin Was a Blast!</title>
		<link>http://kovshenin.com/2013/wordcamp-austin-was-a-blast/</link>
		<comments>http://kovshenin.com/2013/wordcamp-austin-was-a-blast/#comments</comments>
		<pubDate>Sun, 19 May 2013 23:08:06 +0000</pubDate>
		<dc:creator>Konstantin Kovshenin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[travel]]></category>
		<category><![CDATA[wordcamp]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kovshenin.com/?p=7415</guid>
		<description><![CDATA[Austin has always been on my list of places to visit, and now that I did I know it was totally worth the long travel. Huge WordPress community, very friendly people and a well organized WordCamp, not to mention that wonderful food experience. I met and chatted with a lot of new folks &#8211; developers, [...]]]></description>
				<content:encoded><![CDATA[<p><img class="alignnone size-large wp-image-7418" alt="WordCamp Austin 2013" src="http://s.kovshenin.com/files/2013/05/wordcamp-austin-2013-680x510.jpg" width="525" height="393" /></p>
<p>Austin has always been on my list of places to visit, and now that I did I know it was totally worth the long travel. <a title="WordPress Austin" href="http://wpaustin.com/">Huge WordPress community</a>, very friendly people and a well organized WordCamp, not to mention that wonderful food experience.</p>
<p>I met and chatted with a lot of new folks &#8211; developers, designers, bloggers, business owners and beginners eager to use and learn WordPress. It was so overwhelming, in a good way obviously, and the BBQ &#8211; so delicious! The unofficial <a href="http://cigarcamp.wpengine.com/">CigarCamp</a> was the perfect way to end the day.</p>
<p>Dev Day on Sunday was a total blast, that&#8217;s where all the super geek talk happened over pizza. That&#8217;s where I was able to get a few minutes on stage to talk about contributing to WordPress and encouraged people to <a href="http://make.wordpress.org/">chime in</a>.</p>
<p>So huge props to everybody who made it happen: <a href="http://2013.austin.wordcamp.org/volunteers/">organizers and volunteers</a>, <a href="http://2013.austin.wordcamp.org/speakers/">speakers</a>, <a href="http://2013.austin.wordcamp.org/sponsors/">sponsors</a>, <a href="http://2013.austin.wordcamp.org/attendees/">attendees</a>, and a very special thanks to the <a href="http://wpengine.com/">WP Engine</a> folks for hosting Dev Day.</p>
<p>Hope to make it next year!</p>
<p><a href="http://kovshenin.com/2013/wordcamp-austin-was-a-blast/?utm_source=feed&#038;utm_medium=click_here_to_comment&#038;utm_campaign=feed#comments">Click here to comment</a></p>
<h3>More from Konstantin Kovshenin</h3>
<ul>
<li><a href="http://kovshenin.com/2013/dont-do_shortcode/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Don&#8217;t do_shortcode</a></a></li>
<li><a href="http://kovshenin.com/2013/wordpress-turns-10/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">WordPress Turns 10!</a></a></li>
<li><a href="http://kovshenin.com/2013/dont-hide-the-fact-that-youre-using-wordpress/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Don&#8217;t Hide the Fact That You&#8217;re Using WordPress</a></a></li>
<li><a href="http://kovshenin.com/2013/get_template_part-within-shortcodes/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Using get_template_part within Shortcodes</a></a></li>
<li><a href="http://kovshenin.com/2013/attending-wordcamp-austin-2013/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Attending WordCamp Austin 2013</a></a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://kovshenin.com/2013/wordcamp-austin-was-a-blast/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Don&#8217;t Hide the Fact That You&#8217;re Using WordPress</title>
		<link>http://kovshenin.com/2013/dont-hide-the-fact-that-youre-using-wordpress/</link>
		<comments>http://kovshenin.com/2013/dont-hide-the-fact-that-youre-using-wordpress/#comments</comments>
		<pubDate>Tue, 14 May 2013 16:56:38 +0000</pubDate>
		<dc:creator>Konstantin Kovshenin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kovshenin.com/?p=7411</guid>
		<description><![CDATA[There are quite a few blog posts, plugins and hacks suggesting to hide the WordPress version number, or hide the overall fact that you&#8217;re using WordPress. Don&#8217;t do it &#8212; it&#8217;s pretty useless. There are hundreds if not thousands of ways to not only find out the fact that you&#8217;re using WordPress, but also find [...]]]></description>
				<content:encoded><![CDATA[<p>There are quite a few blog posts, plugins and hacks suggesting to hide the WordPress version number, or hide the overall fact that you&#8217;re using WordPress. Don&#8217;t do it &#8212; it&#8217;s pretty useless.</p>
<p>There are hundreds if not thousands of ways to not only find out the fact that you&#8217;re using WordPress, but also find out the exact version number, regardless of any plugins or hacks changing or hiding the &#8220;generator&#8221; meta tag, the readme file and so on. A <a href="http://codeseekah.com/2012/02/20/the-wordpress-meta-generator-tag-paranoia/">great post</a> by my brother Gennady illustrates that.</p>
<h2>Security</h2>
<p>Most of these &#8220;hide my WP&#8221; solutions tend to market themselves from a security standpoint, especially with the recent botnet attack on WordPress sites. The truth is that these attacks don&#8217;t really care which version of WordPress you&#8217;re running. In fact, they don&#8217;t even care whether you&#8217;re running WordPress at all! How? Well that&#8217;s easy, they just take your domain and blindly fire POST requests to a file called wp-login.php, even if you&#8217;re running a non-CMS pure HTML website.</p>
<p>The same applies to known theme and plugin vulnerabilities. Go ahead and check your web server&#8217;s access logs, there&#8217;s a pretty good chance you&#8217;ll find requests to timthumb.php even though none of your themes or plugins use the TimThumb library.</p>
<p>So from a security perspective, the secret sauce is to <strong>use a strong password</strong>, as well as keep your themes, plugins and especially WordPress core up to date. Plugins such as <a href="http://wordpress.org/extend/plugins/google-authenticator/">Google Authenticator</a> and <a href="http://wordpress.org/extend/plugins/limit-login-attempts/">Limit Login Attempts</a> can give you that little extra protection.<strong><br />
</strong></p>
<h2>The Ferrari Analogy</h2>
<p>Sometimes people try hide the fact that they&#8217;re running WordPress because they&#8217;re afraid other humans will spot that and think they&#8217;re &#8220;unprofessional&#8221; or cheap. Well WordPress is the most professional content management system known to human kind, trusted by <a href="http://wordpress.org/showcase/">some of the largest companies</a> worldwide and although free and open source, <a href="http://vip.wordpress.com/our-services/">certainly not cheap</a>.</p>
<p>When you buy yourself a new Ferrari, do you remove the Ferrari logos before showing it to your friends? No. Although if you did, it would still be obvious.</p>
<p>To wrap that up &#8212; don&#8217;t hide the fact that you&#8217;re using WordPress. Use a strong password, keep it updated and drive it with pride. If you bought a premium &#8220;hide my WordPress&#8221; plugin, you should ask for a refund and buy something useful instead.</p>
<p><a href="http://kovshenin.com/2013/dont-hide-the-fact-that-youre-using-wordpress/?utm_source=feed&#038;utm_medium=click_here_to_comment&#038;utm_campaign=feed#comments">Click here to comment</a></p>
<h3>More from Konstantin Kovshenin</h3>
<ul>
<li><a href="http://kovshenin.com/2013/dont-do_shortcode/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Don&#8217;t do_shortcode</a></a></li>
<li><a href="http://kovshenin.com/2013/wordpress-turns-10/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">WordPress Turns 10!</a></a></li>
<li><a href="http://kovshenin.com/2013/wordcamp-austin-was-a-blast/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">WordCamp Austin Was a Blast!</a></a></li>
<li><a href="http://kovshenin.com/2013/get_template_part-within-shortcodes/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Using get_template_part within Shortcodes</a></a></li>
<li><a href="http://kovshenin.com/2013/attending-wordcamp-austin-2013/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Attending WordCamp Austin 2013</a></a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://kovshenin.com/2013/dont-hide-the-fact-that-youre-using-wordpress/feed/</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
		<item>
		<title>Using get_template_part within Shortcodes</title>
		<link>http://kovshenin.com/2013/get_template_part-within-shortcodes/</link>
		<comments>http://kovshenin.com/2013/get_template_part-within-shortcodes/#comments</comments>
		<pubDate>Mon, 13 May 2013 22:47:08 +0000</pubDate>
		<dc:creator>Konstantin Kovshenin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kovshenin.com/?p=7404</guid>
		<description><![CDATA[The get_template_part function is one of the most useful things available to WordPress theme developers. Although mostly used in themes for public, get_template_part is often used in custom WordPress websites as an alternative to the PHP include or require. When using get_template_part with the Shortcode API, there are two things you should always keep in [...]]]></description>
				<content:encoded><![CDATA[<p>The <a title="Understanding get_template_part" href="http://kovshenin.com/2013/get_template_part/">get_template_part</a> function is one of the most useful things available to WordPress theme developers. Although mostly used in themes for public, get_template_part is often used in custom WordPress websites as an alternative to the PHP include or require.</p>
<p>When using get_template_part with the <a title="Shortcode API" href="http://codex.wordpress.org/Shortcode_API">Shortcode API</a>, there are two things you should always keep in mind:</p>
<ul>
<li><span style="line-height: 15px;">get_template_part executes .php files which (most likely) generates output</span></li>
<li>shortcode callback functions are expected to return a string and not generate any output</li>
</ul>
<p>So when calling get_template_part within a shortcode callback function, you&#8217;ll see that all the output generated by get_template_part is output before the post content, and not replaced inline.</p>
<p>The solution is to use PHP&#8217;s <a href="http://php.net/manual/en/book.outcontrol.php">output buffering</a>. Create a buffer in your shortcode callback before running get_template_part, clear the buffer and return the content right after. Here&#8217;s a quick example with an ads shortcode, which can insert your theme&#8217;s ads.php file contents anywhere within a post or page:</p>
<pre>function my_ads_shortcode( $attr ) {
    ob_start();
    get_template_part( 'ads' );
    return ob_get_clean();
}
add_shortcode( 'ads', 'my_ads_shortcode' );</pre>
<p>The <code>ob_get_clean()</code> function stops buffering and returns whatever was output to the buffer after <code>ob_start()</code>. The same approach could be used with other functions and statement that generate output, such as <code>include</code> and <code>require</code>.</p>
<p><a href="http://kovshenin.com/2013/get_template_part-within-shortcodes/?utm_source=feed&#038;utm_medium=click_here_to_comment&#038;utm_campaign=feed#comments">Click here to comment</a></p>
<h3>More from Konstantin Kovshenin</h3>
<ul>
<li><a href="http://kovshenin.com/2013/dont-do_shortcode/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Don&#8217;t do_shortcode</a></a></li>
<li><a href="http://kovshenin.com/2013/wordpress-turns-10/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">WordPress Turns 10!</a></a></li>
<li><a href="http://kovshenin.com/2013/wordcamp-austin-was-a-blast/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">WordCamp Austin Was a Blast!</a></a></li>
<li><a href="http://kovshenin.com/2013/dont-hide-the-fact-that-youre-using-wordpress/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Don&#8217;t Hide the Fact That You&#8217;re Using WordPress</a></a></li>
<li><a href="http://kovshenin.com/2013/attending-wordcamp-austin-2013/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Attending WordCamp Austin 2013</a></a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://kovshenin.com/2013/get_template_part-within-shortcodes/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Attending WordCamp Austin 2013</title>
		<link>http://kovshenin.com/2013/attending-wordcamp-austin-2013/</link>
		<comments>http://kovshenin.com/2013/attending-wordcamp-austin-2013/#comments</comments>
		<pubDate>Wed, 08 May 2013 17:25:39 +0000</pubDate>
		<dc:creator>Konstantin Kovshenin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[travel]]></category>
		<category><![CDATA[wordcamp]]></category>

		<guid isPermaLink="false">http://kovshenin.com/?p=7400</guid>
		<description><![CDATA[Texas has been on my list for a while now and Austin sounds like a great place to start. Looking forward for some sunshine, good company, great food and an exciting WordCamp Austin 2013. Maybe even a roundhouse kick to the face. Click here to comment More from Konstantin Kovshenin Don&#8217;t do_shortcode WordPress Turns 10! [...]]]></description>
				<content:encoded><![CDATA[<p>Texas has been on my list for a while now and Austin sounds like a great place to start. Looking forward for some sunshine, good company, great food and an exciting <a href="http://2013.austin.wordcamp.org/">WordCamp Austin 2013</a>. Maybe even a roundhouse kick to the face.</p>
<p><a href="http://kovshenin.com/2013/attending-wordcamp-austin-2013/?utm_source=feed&#038;utm_medium=click_here_to_comment&#038;utm_campaign=feed#comments">Click here to comment</a></p>
<h3>More from Konstantin Kovshenin</h3>
<ul>
<li><a href="http://kovshenin.com/2013/dont-do_shortcode/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Don&#8217;t do_shortcode</a></a></li>
<li><a href="http://kovshenin.com/2013/wordpress-turns-10/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">WordPress Turns 10!</a></a></li>
<li><a href="http://kovshenin.com/2013/wordcamp-austin-was-a-blast/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">WordCamp Austin Was a Blast!</a></a></li>
<li><a href="http://kovshenin.com/2013/dont-hide-the-fact-that-youre-using-wordpress/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Don&#8217;t Hide the Fact That You&#8217;re Using WordPress</a></a></li>
<li><a href="http://kovshenin.com/2013/get_template_part-within-shortcodes/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Using get_template_part within Shortcodes</a></a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://kovshenin.com/2013/attending-wordcamp-austin-2013/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Columns for WordPress</title>
		<link>http://kovshenin.com/2013/columns-for-wordpress/</link>
		<comments>http://kovshenin.com/2013/columns-for-wordpress/#comments</comments>
		<pubDate>Tue, 07 May 2013 15:35:32 +0000</pubDate>
		<dc:creator>Konstantin Kovshenin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[plugins]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kovshenin.com/?p=7393</guid>
		<description><![CDATA[Sometimes you need to split your content into two or more columns, perhaps for a list of features on your front page. Unfortunately the standard WordPress editor does not support that out of the box (yet) so you turn to plugins. With quite a few options available, it&#8217;s not easy to make the right choice, [...]]]></description>
				<content:encoded><![CDATA[<p>Sometimes you need to split your content into two or more columns, perhaps for a list of features on your front page. Unfortunately the standard WordPress editor does not support that out of the box (yet) so you turn to plugins.</p>
<p>With quite a few options available, it&#8217;s not easy to make the right choice, plus, there&#8217;s almost always a learning curve involved, especially with shortcodes like:</p>
<pre>[fourcol_two_last]</pre>
<p>I crafted an experimental columns plugin quite a while ago, which hopefully simplifies the shortcodes to a bare minimum, and makes them look slightly more like HTML. Put as much columns as you want into a column group, and it can figure out the rest:</p>
<pre>[column-group]
    [column]This is my first column[/column]
    [column]This is my second column[/column]
[/column-group]</pre>
<p>Hopefully this is much easier than memorizing cryptic shortcode names, and even if you end up deactivating the plugin in the future, you can always run a (fairly) simple regex search and replace to &#8220;lock yourself out.&#8221;</p>
<p>I recently released the plugin for public use. It&#8217;s called <a href="http://wordpress.org/plugins/columns/" title="WordPress Columns Plugin">Columns</a> (duh!) and it&#8217;s available at the WordPress.org plugins directory. Give it a spin and let me know what you think!</p>
<p><a href="http://kovshenin.com/2013/columns-for-wordpress/?utm_source=feed&#038;utm_medium=click_here_to_comment&#038;utm_campaign=feed#comments">Click here to comment</a></p>
<h3>More from Konstantin Kovshenin</h3>
<ul>
<li><a href="http://kovshenin.com/2013/dont-do_shortcode/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Don&#8217;t do_shortcode</a></a></li>
<li><a href="http://kovshenin.com/2013/wordpress-turns-10/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">WordPress Turns 10!</a></a></li>
<li><a href="http://kovshenin.com/2013/wordcamp-austin-was-a-blast/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">WordCamp Austin Was a Blast!</a></a></li>
<li><a href="http://kovshenin.com/2013/dont-hide-the-fact-that-youre-using-wordpress/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Don&#8217;t Hide the Fact That You&#8217;re Using WordPress</a></a></li>
<li><a href="http://kovshenin.com/2013/get_template_part-within-shortcodes/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Using get_template_part within Shortcodes</a></a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://kovshenin.com/2013/columns-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>On $matches in preg_match functions</title>
		<link>http://kovshenin.com/2013/on-matches-in-preg_match-functions/</link>
		<comments>http://kovshenin.com/2013/on-matches-in-preg_match-functions/#comments</comments>
		<pubDate>Mon, 29 Apr 2013 14:48:23 +0000</pubDate>
		<dc:creator>Konstantin Kovshenin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://kovshenin.com/?p=7387</guid>
		<description><![CDATA[I&#8217;ve seen many people define an empty $matches variable before using it in preg_match and preg_match_all functions in PHP. I&#8217;ve done it myself, and I was quite surprised to learn that you don&#8217;t really have to &#8212; even if there&#8217;s no match, you will not get an undefined variable notice. More from Konstantin Kovshenin Don&#8217;t [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve seen many people define an empty <code>$matches</code> variable before using it in <code>preg_match</code> and <code>preg_match_all</code> functions in PHP. I&#8217;ve done it myself, and I was quite surprised to learn that you don&#8217;t really have to &#8212; even if there&#8217;s no match, you will not get an undefined variable notice.</p>
<h3>More from Konstantin Kovshenin</h3>
<ul>
<li><a href="http://kovshenin.com/2013/dont-do_shortcode/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Don&#8217;t do_shortcode</a></a></li>
<li><a href="http://kovshenin.com/2013/wordpress-turns-10/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">WordPress Turns 10!</a></a></li>
<li><a href="http://kovshenin.com/2013/wordcamp-austin-was-a-blast/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">WordCamp Austin Was a Blast!</a></a></li>
<li><a href="http://kovshenin.com/2013/dont-hide-the-fact-that-youre-using-wordpress/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Don&#8217;t Hide the Fact That You&#8217;re Using WordPress</a></a></li>
<li><a href="http://kovshenin.com/2013/get_template_part-within-shortcodes/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Using get_template_part within Shortcodes</a></a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://kovshenin.com/2013/on-matches-in-preg_match-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Maintaining a Local WordPress Subversion Repository</title>
		<link>http://kovshenin.com/2013/maintaining-a-local-wordpress-subversion-repository/</link>
		<comments>http://kovshenin.com/2013/maintaining-a-local-wordpress-subversion-repository/#comments</comments>
		<pubDate>Tue, 16 Apr 2013 09:38:58 +0000</pubDate>
		<dc:creator>Konstantin Kovshenin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[svn]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://kovshenin.com/?p=7370</guid>
		<description><![CDATA[When working with WordPress core, you often have to go back and forth through commits, scroll or search through revision logs, switch between tags and branches and so on. This can be annoying with a slow Internet connection and impossible without a connection at all, but what if you&#8217;re working on a core patch on [...]]]></description>
				<content:encoded><![CDATA[<p>When working with WordPress core, you often have to go back and forth through commits, scroll or search through revision logs, switch between tags and branches and so on. This can be annoying with a slow Internet connection and impossible without a connection at all, but what if you&#8217;re working on a core patch on a plane or a submarine?</p>
<p><span id="more-7370"></span>Lucky for us, Subversion comes with a remote repository mirroring tool called <strong>svnsync</strong>. It&#8217;s like database replication, but for Subversion. It allows us to create a complete mirror of the WordPress Subversion repository and host it locally, for quicker access. We can then set up a cron task to keep the mirror in sync every once in a while.</p>
<h2>Preparing the Mirror Repository</h2>
<p>It&#8217;s fairly easy to start a mirror. You&#8217;ll need to create an empty Subversion repository with svnadmin, like so:</p>
<pre>mkdir /home/kovshenin/svn
cd /home/kovshenin/svn
svnadmin create wordpress</pre>
<p>Since svnsync will need to modify revision properties after revisions have been committed, we&#8217;ll need to allow revision property changes, which are disabled by default. To do that, we&#8217;ll just have the pre-revprop-change hook exit with code 0:</p>
<pre>cd wordpress/hooks
echo '#!/bin/sh' &gt; pre-revprop-change
echo 'exit 0' &gt;&gt; pre-revprop-change
chmod +x pre-revprop-change</pre>
<h2>Initializing the Mirror and Syncing</h2>
<p>The destination repository is now ready to become a mirror.</p>
<pre>svnsync init file:///home/kovshenin/svn/wordpress https://core.svn.wordpress.org
svnsync sync file:///home/kovshenin/svn/wordpress</pre>
<p>At this point, svnsync will start reading revisions from the WordPress Subversion repository, and replaying them on your local mirror. At the time of writing, WordPress has over 24,000 revisions, so this may take a while, especially on a slower connection. Another option is to use a dump file, which we&#8217;ll talk about in a sec. If the sync process is interrupted, you can start it again with &#8220;svnsync sync&#8221; and it&#8217;ll always pick up where it left.</p>
<h2>Using the Mirror</h2>
<p>After the sync is complete, you can use your new repository mirror to check out working copies, browse revision logs, switch branches and so on, which will be extremely fast:</p>
<pre>cd /home/kovshenin/www
svn checkout file:///home/kovshenin/svn/wordpress .
svn log -r 9
svn sw ^/branches/3.5</pre>
<p>If you&#8217;ve already have a working copy of the WordPress source code checked out, you can easily relocate it to your new local mirror with svn relocate:</p>
<pre>cd /home/kovshenin/existing/
svn relocate file:///home/kovshenin/svn/wordpress/trunk</pre>
<p>Note, that for a successful relocate, the UUID of both repositories should match. You can change the UUID of your mirror repository with <a href="http://svnbook.red-bean.com/en/1.7/svn.ref.svnadmin.c.setuuid.html">svnadmin setuuid</a>.</p>
<p>Finally, since running svn update on any working copy, will not pull in the new changes from the original Subversion repository, but rather update from your mirror, it&#8217;s important to keep your mirror in sync:</p>
<pre>svnsync sync file:///home/kovshenin/svn/wordpress</pre>
<p>It&#8217;s also a good idea to create a cron job that would run svnsync every hour or so.</p>
<p>The most painful part is reading all the 24k revisions from the WordPress Subversion repository, which can take a while, depending on your Internet connection. Luckily, there&#8217;s a trick you can use to speed up the process.</p>
<h2>Starting from a Subversion Dump File</h2>
<p>Before initializing the mirror, you can use a Subversion dump file (or backup file) to pre-populate your empty repository, which will only take a few minutes, and then have svnsync simply fill in the remaining revisions from source.</p>
<pre>svnadmin load /home/kovshenin/svn/wordpress &lt; wordpress.dump
svnsync init --allow-non-empty file:///home/kovshenin/svn/wordpress https://core.svn.wordpress.org
svnsync sync file:///home/kovshenin/svn/wordpress</pre>
<p>So the question is where does one get a 24,000 revision dump file? Unfortunately, at the time of writing, there isn&#8217;t one you can get directly from WordPress.org, but you can <a href="http://kovshenin.com/public/wordpress-23998-deltas.dump.gz">download my dump file</a> if you like.</p>
<p>That&#8217;s about it! Hopefully the above tips will help you maintain a local mirror and make your Subversion experience faster, as well as not require an Internet connection at all times. Make sure you keep your mirror in sync, and also make sure you never commit anything to your mirror manually &#8212; svnsync doesn&#8217;t like that, and may easily result in a corrupt repository. You can learn more about svnsync <a href="http://svnbook.red-bean.com/en/1.7/svn.ref.svnsync.html">here</a>.</p>
<p>A final word to Git and Mercurial fans: I love Git and Mercurial as much as you do, in fact, I use Git (not necessarily GitHub) on a daily basis. And if you came here to say I &#8220;should try git,&#8221; please go away :)</p>
<h3>More from Konstantin Kovshenin</h3>
<ul>
<li><a href="http://kovshenin.com/2013/dont-do_shortcode/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Don&#8217;t do_shortcode</a></a></li>
<li><a href="http://kovshenin.com/2013/wordpress-turns-10/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">WordPress Turns 10!</a></a></li>
<li><a href="http://kovshenin.com/2013/wordcamp-austin-was-a-blast/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">WordCamp Austin Was a Blast!</a></a></li>
<li><a href="http://kovshenin.com/2013/dont-hide-the-fact-that-youre-using-wordpress/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Don&#8217;t Hide the Fact That You&#8217;re Using WordPress</a></a></li>
<li><a href="http://kovshenin.com/2013/get_template_part-within-shortcodes/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Using get_template_part within Shortcodes</a></a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://kovshenin.com/2013/maintaining-a-local-wordpress-subversion-repository/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Subversion 1.7 on Ubuntu 12.04</title>
		<link>http://kovshenin.com/2013/subversion-1-7-on-ubuntu-12-04/</link>
		<comments>http://kovshenin.com/2013/subversion-1-7-on-ubuntu-12-04/#comments</comments>
		<pubDate>Thu, 04 Apr 2013 11:05:26 +0000</pubDate>
		<dc:creator>Konstantin Kovshenin</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">https://kovshenin.com/?p=7361</guid>
		<description><![CDATA[Ubuntu&#8217;s default packages ship Subversion 1.6 with the 12.04 distribution. This is annoying if you want to use the newer Subversion 1.7, without upgrading your OS, and especially if you&#8217;re dealing with newer working copies: svn: The path '.' appears to be part of a Subversion 1.7 or greater working copy. Please upgrade your Subversion [...]]]></description>
				<content:encoded><![CDATA[<p>Ubuntu&#8217;s default packages ship Subversion 1.6 with the 12.04 distribution. This is annoying if you want to use the newer Subversion 1.7, without upgrading your OS, and especially if you&#8217;re dealing with newer working copies:</p>
<pre>svn: The path '.' appears to be part of a Subversion 1.7 or greater
working copy. Please upgrade your Subversion client to use this
working copy.
</pre>
<p>Turns out there&#8217;s an official <a href="https://launchpad.net/~svn/+archive/ppa">Subversion PPA</a> on Launchpad, so for Ubuntu 12.04 all you have to do is add the following couple lines to your <code>/etc/apt/sources.list</code> file:</p>
<pre>deb http://ppa.launchpad.net/svn/ppa/ubuntu precise main 
deb-src http://ppa.launchpad.net/svn/ppa/ubuntu precise main 
</pre>
<p>And upgrade Subversion to its latest version with apt-get:</p>
<pre>sudo apt-get update
sudo apt-get install subversion
</pre>
<p>At this point you should be running the latest, and the greatest:</p>
<pre>$ svn --version
svn, version 1.7.8 (r1419691)
   compiled Mar 23 2013, 23:38:40
</pre>
<p>Hope this helps!</p>
<h3>More from Konstantin Kovshenin</h3>
<ul>
<li><a href="http://kovshenin.com/2013/dont-do_shortcode/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Don&#8217;t do_shortcode</a></a></li>
<li><a href="http://kovshenin.com/2013/wordpress-turns-10/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">WordPress Turns 10!</a></a></li>
<li><a href="http://kovshenin.com/2013/wordcamp-austin-was-a-blast/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">WordCamp Austin Was a Blast!</a></a></li>
<li><a href="http://kovshenin.com/2013/dont-hide-the-fact-that-youre-using-wordpress/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Don&#8217;t Hide the Fact That You&#8217;re Using WordPress</a></a></li>
<li><a href="http://kovshenin.com/2013/get_template_part-within-shortcodes/?utm_source=feed&#038;utm_medium=latest_posts&#038;utm_campaign=feed">Using get_template_part within Shortcodes</a></a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://kovshenin.com/2013/subversion-1-7-on-ubuntu-12-04/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>