<?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>Konstruktors &#187; php</title>
	<atom:link href="http://konstruktors.com/blog/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://konstruktors.com</link>
	<description>Web Design, WordPress and Performance Services</description>
	<lastBuildDate>Sat, 19 May 2012 16:41:40 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-beta4-20805</generator>
<atom:link rel="hub" href="http://konstruktors.superfeedr.com/"/><atom:link rel="hub" href="http://pubsubhubbub.appspot.com/"/>		<item>
		<title>How to Avoid Widow &#8220;Read More&#8221; Links in Post&#160;Excerpts</title>
		<link>http://konstruktors.com/blog/wordpress/3462-avoid-widow-read-more-links/</link>
		<comments>http://konstruktors.com/blog/wordpress/3462-avoid-widow-read-more-links/#comments</comments>
		<pubDate>Wed, 22 Feb 2012 09:30:34 +0000</pubDate>
		<dc:creator>Kaspars</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[action]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://konstruktors.com/?p=3462</guid>
		<description><![CDATA[A &#8220;widow&#8221; in typography is defined as: A paragraph-ending line that falls at the beginning of the following page/column, thus separated from the rest of the text. If you are using the standard inline &#8220;Read more&#8221; links at the end of post excerpts on index and archive pages, here is a simple filter to ensure [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://konstruktors.com/wp-content/uploads/2012/02/read-more-widow-last-word-wordpress.jpg"><img class="aligncenter size-medium wp-image-3549" title="Read more link widow in WordPress excerpts" src="http://konstruktors.com/wp-content/uploads/2012/02/read-more-widow-last-word-wordpress-500x150.jpg" alt="Read more link widow in WordPress excerpts" width="500" height="150" /></a></p>
<p>A &#8220;widow&#8221; in typography is defined as:</p>
<blockquote><p>A paragraph-ending line that falls at the beginning of the following page/column, thus separated from the rest of the text.</p></blockquote>
<p>If you are using the standard inline &#8220;Read more&#8221; links at the end of post excerpts on index and archive pages, here is a simple filter to ensure that a non-breaking space is added before the &#8220;Read more&#8221; link:</p>
<pre>add_filter('the_content_more_link', 'prepend_non_breaking');
function prepend_non_breaking($more_link) {
	return str_replace(' &lt;a ', '&amp;nbsp;&lt;a ', $more_link);
}</pre>
<h4>Related posts</h4><ol>
<li><a href='http://konstruktors.com/blog/wordpress/3364-sticky-posts-as-category-description/' rel='bookmark' title='Use Sticky Posts as Category&nbsp;Description'>Use Sticky Posts as Category&nbsp;Description</a></li>
<li><a href='http://konstruktors.com/blog/wordpress/944-widget-context-update-word-count-check/' rel='bookmark' title='Widget Context Update &#8212; Word Count&nbsp;Check'>Widget Context Update &#8212; Word Count&nbsp;Check</a></li>
<li><a href='http://konstruktors.com/blog/media-publishing/873-rights-to-read-a-book-out-loud/' rel='bookmark' title='Rights to Read a Book Out&nbsp;Loud'>Rights to Read a Book Out&nbsp;Loud</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://konstruktors.com/blog/wordpress/3462-avoid-widow-read-more-links/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rasmus Lerdorf on the History and Future&#160;of&#160;PHP</title>
		<link>http://konstruktors.com/blog/the-web/3543-rasmus-lerdorf-on-the-history-and-future-of-php/</link>
		<comments>http://konstruktors.com/blog/the-web/3543-rasmus-lerdorf-on-the-history-and-future-of-php/#comments</comments>
		<pubDate>Tue, 21 Feb 2012 21:03:47 +0000</pubDate>
		<dc:creator>Kaspars</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://konstruktors.com/?p=3543</guid>
		<description><![CDATA[Etsy Code as Craft on LiveStream]]></description>
			<content:encoded><![CDATA[<p><iframe width="500" height="310" src="http://cdn.livestream.com/embed/etsycodeascraft?layout=4&#038;clip=pla_e00bfe34-e377-42d1-b859-ccf97b12c519&#038;color=0xe7e7e7&#038;autoPlay=false&#038;mute=false&#038;iconColorOver=0x888888&#038;iconColor=0x777777&#038;allowchat=true&#038;height=310&#038;width=500" frameborder="0" scrolling="no"></iframe></p>
<p><a href="http://www.livestream.com/etsycodeascraft">Etsy Code as Craft on LiveStream</a></p>
]]></content:encoded>
			<wfw:commentRss>http://konstruktors.com/blog/the-web/3543-rasmus-lerdorf-on-the-history-and-future-of-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add Custom URL Redirects to Your WordPress Dashboard Areas or Login&#160;Page</title>
		<link>http://konstruktors.com/blog/wordpress/3529-custom-redirect-to-wordpress-login-dashboard/</link>
		<comments>http://konstruktors.com/blog/wordpress/3529-custom-redirect-to-wordpress-login-dashboard/#comments</comments>
		<pubDate>Mon, 20 Feb 2012 10:00:30 +0000</pubDate>
		<dc:creator>Kaspars</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[filter]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://konstruktors.com/?p=3529</guid>
		<description><![CDATA[Ever wanted to use something like example.com/backend or example.com/dash to access your WordPress dashboard or login area? Here is a simple snippet of PHP for your functionality plugin or functions.php to do just that &#8212; it uses standard WordPress URL rewrite API. Update: turns out that in WordPress 3.4 there are new default redirects (/admin, [...]]]></description>
			<content:encoded><![CDATA[<p>Ever wanted to use something like <code>example.com/backend</code> or <code>example.com/dash</code> to access your WordPress dashboard or login area? <del>Here is a simple snippet of PHP for your <em>functionality</em> plugin or <code>functions.php</code> to do just that &#8212; it uses standard WordPress URL rewrite API.</del></p>
<p><strong>Update:</strong> turns out that in WordPress 3.4 there are new default redirects (<code>/admin</code>, <code>/dashboard</code> and <code>/login</code>) implemented in the core (see <a href="http://core.trac.wordpress.org/changeset/19880">this ticket</a>). So here is a better way to add your own redirects which will work only if you don&#8217;t have a page or post with the same name (slug) already:</p>
<h3>Updated Version:</h3>
<pre>add_action('template_redirect', 'add_my_custom_redirects');
function add_my_custom_redirects() {
	if (!is_404())
		return;
	$current_uri = untrailingslashit($_SERVER['REQUEST_URI']);
	$my_admin_uris = array(
		home_url('dash', 'relative'),
		home_url('your-custom-uri', 'relative')
	);
	if (in_array($current_uri, $my_admin_uris)) {
 		wp_redirect(admin_url());
 		exit;
	}
}</pre>
<h3>The Obsolete Version:</h3>
<pre>add_filter('generate_rewrite_rules', 'add_my_custom_rewrites');
function add_my_custom_rewrites($wp_rewrite) {
    $my_rewrites = array(
	'dash' =&gt; 'wp-admin'
    );
    $wp_rewrite-&gt;rules = $my_rewrites + $wp_rewrite-&gt;rules;
}</pre>
<h4>Related posts</h4><ol>
<li><a href='http://konstruktors.com/blog/wordpress/3594-wordpress-dashboard-quick-login/' rel='bookmark' title='Enable WordPress Dashboard Quick&nbsp;Login'>Enable WordPress Dashboard Quick&nbsp;Login</a></li>
<li><a href='http://konstruktors.com/blog/web-design/570-wordpress-dashboard-ui-idea-3/' rel='bookmark' title='WordPress Dashboard UI Idea&nbsp;#3'>WordPress Dashboard UI Idea&nbsp;#3</a></li>
<li><a href='http://konstruktors.com/blog/wordpress/270-baltic-amber-1-32-removed-youhave-from-dashboard/' rel='bookmark' title='Baltic Amber 1.32 &#8212; removed .youare section from your WordPress&nbsp;Dashboard'>Baltic Amber 1.32 &#8212; removed .youare section from your WordPress&nbsp;Dashboard</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://konstruktors.com/blog/wordpress/3529-custom-redirect-to-wordpress-login-dashboard/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		</item>
		<item>
		<title>How to Remove All Line Breaks from Text Using&#160;Regex</title>
		<link>http://konstruktors.com/blog/web-design/3517-regex-remove-all-line-breaks-from-text/</link>
		<comments>http://konstruktors.com/blog/web-design/3517-regex-remove-all-line-breaks-from-text/#comments</comments>
		<pubDate>Sat, 18 Feb 2012 10:45:27 +0000</pubDate>
		<dc:creator>Kaspars</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://konstruktors.com/?p=3517</guid>
		<description><![CDATA[If you are generating &#60;meta&#62; description tags automatically (e.g. by including all headings of the document), chances are that you&#8217;re extracting it from various sources of content that contain different HTML elements and line breaks in them. Here is a simple regular expression to remove all line breaks, carriage returns and tabs, and replace them with an [...]]]></description>
			<content:encoded><![CDATA[<p>If you are generating <code>&lt;meta&gt;</code> <em>description</em> tags automatically (e.g. by <a title="Extract headings and headlines from HTML documents" href="http://konstruktors.com/blog/web-design/3507-regex-extract-headings-h1-h2-h3-from-html/">including all headings of the document</a>), chances are that you&#8217;re extracting it from various sources of content that contain different HTML elements and line breaks in them. Here is a simple regular expression to <strong>remove all line breaks, carriage returns and tabs</strong>, and replace them with an empty space.</p>
<pre>$text = preg_replace("/\r\n+|\r+|\n+|\t+/i", " ", $text);</pre>
<h4>Related posts</h4><ol>
<li><a href='http://konstruktors.com/blog/wordpress/2920-remove-inline-css-line-breaks-galleries/' rel='bookmark' title='Remove Inline CSS and Line Breaks in WordPress&nbsp;Galleries'>Remove Inline CSS and Line Breaks in WordPress&nbsp;Galleries</a></li>
<li><a href='http://konstruktors.com/blog/web-design/3507-regex-extract-headings-h1-h2-h3-from-html/' rel='bookmark' title='How to Extract Heading Content (H1, H2, etc.) from an HTML String Using&nbsp;Regex'>How to Extract Heading Content (H1, H2, etc.) from an HTML String Using&nbsp;Regex</a></li>
<li><a href='http://konstruktors.com/blog/random-musings/191-simple-fullscreen-text-editors-for-students-bloggers-writers/' rel='bookmark' title='Simple Fullscreen Text Editors for Students, Bloggers, Journalists and&nbsp;Writers'>Simple Fullscreen Text Editors for Students, Bloggers, Journalists and&nbsp;Writers</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://konstruktors.com/blog/web-design/3517-regex-remove-all-line-breaks-from-text/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Extract Heading Content (H1, H2, etc.) from an HTML String Using&#160;Regex</title>
		<link>http://konstruktors.com/blog/web-design/3507-regex-extract-headings-h1-h2-h3-from-html/</link>
		<comments>http://konstruktors.com/blog/web-design/3507-regex-extract-headings-h1-h2-h3-from-html/#comments</comments>
		<pubDate>Fri, 17 Feb 2012 10:10:49 +0000</pubDate>
		<dc:creator>Kaspars</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[regex]]></category>
		<category><![CDATA[snippet]]></category>

		<guid isPermaLink="false">http://konstruktors.com/?p=3507</guid>
		<description><![CDATA[Headlines and headings are usually very relevant and descriptive pieces of information for any HTML page. You might want to include them into the description &#60;meta&#62; tag on that page. Here is a simple regular expression to extract all those headings: preg_match_all('&#124;&#60;h[^&#62;]+&#62;(.*)&#60;/h[^&#62;]+&#62;&#124;iU', $html, $headings); Related posts Logos and Names Are Not&#160;Headings How to Create Beautiful [...]]]></description>
			<content:encoded><![CDATA[<p>Headlines and headings are usually very relevant and descriptive pieces of information for any HTML page. You might want to include them into the <em>description</em> <code>&lt;meta&gt;</code> tag on that page. Here is a simple regular expression to extract all those headings:</p>
<pre>preg_match_all('|&lt;h[^&gt;]+&gt;(.*)&lt;/h[^&gt;]+&gt;|iU', $html, $headings);</pre>
<h4>Related posts</h4><ol>
<li><a href='http://konstruktors.com/blog/web-design/31-logos-names-are-not-h1-headings/' rel='bookmark' title='Logos and Names Are Not&nbsp;Headings'>Logos and Names Are Not&nbsp;Headings</a></li>
<li><a href='http://konstruktors.com/blog/web-design/125-how-to-create-beautiful-and-elegant-html-lists-using-css/' rel='bookmark' title='How to Create Beautiful and Elegant HTML Lists Using&nbsp;CSS'>How to Create Beautiful and Elegant HTML Lists Using&nbsp;CSS</a></li>
<li><a href='http://konstruktors.com/blog/web-design/2036-remove-index-html-from-the-url/' rel='bookmark' title='Remove index.html from the&nbsp;URL'>Remove index.html from the&nbsp;URL</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://konstruktors.com/blog/web-design/3507-regex-extract-headings-h1-h2-h3-from-html/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to Add Post Categories and Tags as #Hashtags to Tweets Automatically with the Simple Twitter Connect&#160;Plugin</title>
		<link>http://konstruktors.com/blog/wordpress/3478-add-post-categories-tags-as-hashtags-to-tweets-automatically-stc-plugin/</link>
		<comments>http://konstruktors.com/blog/wordpress/3478-add-post-categories-tags-as-hashtags-to-tweets-automatically-stc-plugin/#comments</comments>
		<pubDate>Wed, 15 Feb 2012 00:16:03 +0000</pubDate>
		<dc:creator>Kaspars</dc:creator>
				<category><![CDATA[WordPress]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://konstruktors.com/?p=3478</guid>
		<description><![CDATA[Simple Twitter Connect is a really useful, simple and well coded plugin by Otto (@Otto42) that allows you to post tweets right from your WordPress dashboard or automatically after publishing new posts. A standard tweet containing a prefix (such as &#8220;New blog post:&#8221;), post title and a link to that post is generated automatically by the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://ottopress.com/wordpress-plugins/simple-twitter-connect/">Simple Twitter Connect</a> is a really useful, simple and well coded plugin by <a href="http://ottopress.com/">Otto</a> (<a href="https://twitter.com/#!/Otto42">@Otto42</a>) that allows you to post tweets right from your WordPress dashboard or automatically after publishing new posts.</p>
<p>A standard tweet containing a prefix (such as &#8220;New blog post:&#8221;), post title and a link to that post is generated automatically by the plugin. Wouldn&#8217;t it be nice to include also <strong>post categories and tags as hashtags</strong> in order to add additional metadata along with the post title? Like so:</p>
<div id="attachment_3483" class="wp-caption aligncenter" style="width: 510px"><a href="http://konstruktors.com/wp-content/uploads/2012/02/twitter-publisher-before-after.jpg"><img class="size-medium wp-image-3483" title="Post categories and tags added as hashtags in Twitter Publisher using Simple Twitter Connect plugin" src="http://konstruktors.com/wp-content/uploads/2012/02/twitter-publisher-before-after-500x292.jpg" alt="Post categories and tags added as hashtags in Twitter Publisher using Simple Twitter Connect plugin" width="500" height="292" /></a><p class="wp-caption-text">Post categories and tags replaced or added to tweet as hashtags</p></div>
<p>Thanks to the <code>stc_publish_text</code> filter supplied with the plugin there is an easy way to do it. Add this snippet to your theme&#8217;s <code>functions.php</code>:</p>
<pre>add_filter('stc_publish_text', 'add_taxonomies_to_tweets', 10, 2);
function add_taxonomies_to_tweets($output, $id) {
	if ($cats = get_the_category($id))
		foreach ($cats as $c =&gt; $cat)
			$output = add_taxonomy_hashtag($output, $cat-&gt;cat_name);
	if ($tags = get_the_tags($id))
		foreach ($tags as $t =&gt; $tag)
			$output = add_taxonomy_hashtag($output, $tag-&gt;name);
	return $output;
}
function add_taxonomy_hashtag($tweet, $tax) {
	if (stripos($tax, ' ')) // Remove whitespace
		$tax = str_replace(' ', '', $tax);
	if (strlen($tweet) + 1 &gt; 140) { // Check if the new tweet is not too long
		return $tweet;
	} elseif (stripos($tweet, $tax)) {  // Replace an existing word with a tag
		return str_replace($tax, '#' . $tax, $tweet);
	} elseif (strlen($tweet) + strlen($tax) + 1 &lt; 140) { // or simply append it
		return $tweet . ' #' . $tax;
	}
	return $tweet;
}</pre>
<h4>Related posts</h4><ol>
<li><a href='http://konstruktors.com/blog/wordpress/3203-how-to-automatically-add-image-credit-or-source-url-to-photo-captions-in-wordpress/' rel='bookmark' title='How to Automatically Add Image Credit or Source URL to Photo Captions in&nbsp;WordPress'>How to Automatically Add Image Credit or Source URL to Photo Captions in&nbsp;WordPress</a></li>
<li><a href='http://konstruktors.com/blog/wordpress/1850-automatically-escape-html-entities-of-code-fragments-in-comments/' rel='bookmark' title='Automatically Escape HTML Entities of Code Fragments in&nbsp;Comments'>Automatically Escape HTML Entities of Code Fragments in&nbsp;Comments</a></li>
<li><a href='http://konstruktors.com/blog/wordpress/2667-how-to-add-shortlink-support-to-twitter-tools/' rel='bookmark' title='How to Add Shortlink Support to Twitter&nbsp;Tools'>How to Add Shortlink Support to Twitter&nbsp;Tools</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://konstruktors.com/blog/wordpress/3478-add-post-categories-tags-as-hashtags-to-tweets-automatically-stc-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML5 Notepad App&#160;Update</title>
		<link>http://konstruktors.com/blog/web-design/3451-html5-notepad-app-update/</link>
		<comments>http://konstruktors.com/blog/web-design/3451-html5-notepad-app-update/#comments</comments>
		<pubDate>Sun, 12 Feb 2012 03:21:13 +0000</pubDate>
		<dc:creator>Kaspars</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[offline]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://konstruktors.com/?p=3451</guid>
		<description><![CDATA[I have released an updated version of my HTML5 Notepad app which features a new user interface, adds support for Markdown syntax (along with a simple editor and preview) and fixes a synchronization bug which in some cases converted line breaks into text. Please note that there could still be some bugs and the code hasn&#8217;t been polished for [...]]]></description>
			<content:encoded><![CDATA[<p>I have released an updated version of my <a title="HTML5 Notepad app with sync, markdown and offline access" href="http://konstruktors.com/projects/html5-notepad/">HTML5 Notepad app</a> which features a new user interface, adds support for Markdown syntax (along with a simple editor and preview) and fixes a synchronization bug which in some cases converted line breaks into text.</p>
<p><a href="http://konstruktors.com/projects/html5-notepad/"><img class="aligncenter size-medium wp-image-3438" title="HTML5 Notepad with Markdown syntax and sync support" src="http://konstruktors.com/wp-content/uploads/2011/05/html5-notepad-2012-editor-markdown-500x316.png" alt="HTML5 Notepad with Markdown syntax and sync support" width="500" height="316" /></a></p>
<p>Please note that there could still be some bugs and the code hasn&#8217;t been polished for a production use, but it serves as a very useful example of some of the most interesting HTML5 features such as localStorage and offline cache.</p>
<p>You can fork it on <a title="HTML5 notepad app with offline storage and sync" href="https://github.com/kasparsd/HTML5-Notepad-with-Sync">GitHub</a> or download from the <a title="HTML5 Notepad app with offline access, synchronization and Markdown syntax" href="http://konstruktors.com/projects/html5-notepad/">project page</a>.</p>
<h4>Related posts</h4><ol>
<li><a href='http://konstruktors.com/blog/the-web/2991-hosted-html5-notepad-app-sync/' rel='bookmark' title='Self-hosted HTML5 Notepad App With&nbsp;Synchronization'>Self-hosted HTML5 Notepad App With&nbsp;Synchronization</a></li>
<li><a href='http://konstruktors.com/blog/web-design/91-got-ie8-meta-tag-in-head-html5-doctype-progress/' rel='bookmark' title='Got a meta in a heada&#8217; — supporting standards and welcoming IEn where n =&nbsp;1…∞'>Got a meta in a heada&#8217; — supporting standards and welcoming IEn where n =&nbsp;1…∞</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://konstruktors.com/blog/web-design/3451-html5-notepad-app-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Self-hosted HTML5 Notepad App With&#160;Synchronization</title>
		<link>http://konstruktors.com/blog/the-web/2991-hosted-html5-notepad-app-sync/</link>
		<comments>http://konstruktors.com/blog/the-web/2991-hosted-html5-notepad-app-sync/#comments</comments>
		<pubDate>Fri, 27 May 2011 09:41:03 +0000</pubDate>
		<dc:creator>Kaspars</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[localstorage]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://konstruktors.com/?p=2991</guid>
		<description><![CDATA[Update: On February 12, 2012 I released an updated version of this app with new UI, support for Markdown syntax (incl. editor) and a few bug fixes. Please see the project page for more screenshots and downloads. Ever since the days of Google Gears which enabled local storage and offline syncing for online applications such [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Update:</strong> On February 12, 2012 I released an updated version of this app with new UI, support for Markdown syntax (incl. editor) and a few bug fixes. Please see the <a title="Self-hosted HTML5 Notepad App" href="http://konstruktors.com/projects/html5-notepad/">project page</a> for more screenshots and downloads.</p>
<p>Ever since the days of Google Gears which enabled local storage and offline syncing for online applications such as Google Reader and Docs, I have always wished for <strong>a very simple and instantly accesible notepad application that I could host on my server and use also without an internet connection</strong>. A place where I could instantly write down an idea or paste a link or a quote from an article.</p>
<p>Google Docs and Evernote is great but they have way more features than I would normally use. WordPress is fine, but it takes several steps to get to the actual writing, and you must be connected to the internet to use it.</p>
<h3>The Solution</h3>
<p>Now that we have HTML5 with support for <code>localStorage</code> and offline apps in all of the modern browsers, it seems to be the perfect solution. All that is needed is a little PHP script that <strong>synchronizes</strong> the content of <code>localStorage</code> with the server. Here is how it looks:</p>
<div id="attachment_3439" class="wp-caption aligncenter" style="width: 510px"><a href="http://konstruktors.com/wp-content/uploads/2011/05/html5-notepad-2012-index.png"><img class="size-medium wp-image-3439" title="HTML5 Notepad lists all notes" src="http://konstruktors.com/wp-content/uploads/2011/05/html5-notepad-2012-index-500x316.png" alt="HTML5 Notepad lists all notes" width="500" height="316" /></a><p class="wp-caption-text">HTML5 Notepad version 2012</p></div>
<div id="attachment_2976" class="wp-caption aligncenter" style="width: 510px"><a href="http://konstruktors.com/wp-content/uploads/2011/05/hifive.png" rel="fancybox"><img class="size-medium wp-image-2976" title="Self-hosted HTML5 Notepad (with Sync)" src="http://konstruktors.com/wp-content/uploads/2011/05/hifive-500x304.png" alt="" width="500" height="304" /></a><p class="wp-caption-text">Version 0.1 of HTML5 Notepad with Sync</p></div>
<p>You have your files on the left and a very big plain text editor on the right.</p>
<h3>How Does it Work</h3>
<p>The app consists of the following:</p>
<ul>
<li>One HTML file with enabled offline access (cache manifest).</li>
<li>jQuery for all the Javascript and AJAX magic.</li>
<li>One PHP file with HTTP authentication for syncing with the server.</li>
</ul>
<p>The files are stored in browser&#8217;s <code>localStorage</code> as key/value pairs with unique timestamp IDs as key and JSON formated content as value. An index of all files and their version timestamps is kept and used for synchronization during which all the content of <code>localStorage</code> is sent to <code>sync.php</code> in a POST request. The server reads its own index file and determines which new or edited entries need to be stored and which returned to the browser. All entries are stored on the server as JSON strings in simple text files.</p>
<h3>Demo, Download and Installation</h3>
<p>Please visit the <a href="http://konstruktors.com/projects/html5-notepad/">project page of the HTML5 Notepad App</a>. There is also a sample Chrome app.</p>
<h4>Related posts</h4><ol>
<li><a href='http://konstruktors.com/blog/web-design/3451-html5-notepad-app-update/' rel='bookmark' title='HTML5 Notepad App&nbsp;Update'>HTML5 Notepad App&nbsp;Update</a></li>
<li><a href='http://konstruktors.com/blog/wordpress/2538-automatic-updates-for-plugins-and-themes-hosted-outside-wordpress-extend/' rel='bookmark' title='Automatic Updates for Plugins and Themes Hosted Outside WordPress&nbsp;Extend'>Automatic Updates for Plugins and Themes Hosted Outside WordPress&nbsp;Extend</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://konstruktors.com/blog/the-web/2991-hosted-html5-notepad-app-sync/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>A Simple PHP Utility to Migrate Emails Between Two IMAP/POP&#160;Accounts</title>
		<link>http://konstruktors.com/blog/the-web/2915-php-migrate-emails-imap-pop/</link>
		<comments>http://konstruktors.com/blog/the-web/2915-php-migrate-emails-imap-pop/#comments</comments>
		<pubDate>Wed, 16 Mar 2011 18:53:46 +0000</pubDate>
		<dc:creator>Kaspars</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[how to]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://konstruktors.com/?p=2915</guid>
		<description><![CDATA[I wrote this little (quick &#38; dirty) PHP command line utility to migrate around 10 email accounts from my IMAP server to Google Apps. Related posts How to Add Simple Google Site Search to Any&#160;Website OpenID Plugin and WordPress&#160;2.8 Self-hosted HTML5 Notepad App With&#160;Synchronization]]></description>
			<content:encoded><![CDATA[<p>I wrote this <a title="Migrate / transfer email from IMAP/POP to Google Apps" href="http://t.co/9qrMZZU">little (quick &amp; dirty) PHP command line utility</a> to migrate around 10 email accounts from my IMAP server to Google Apps.</p>
<h4>Related posts</h4><ol>
<li><a href='http://konstruktors.com/blog/web-design/2865-how-to-add-google-site-search/' rel='bookmark' title='How to Add Simple Google Site Search to Any&nbsp;Website'>How to Add Simple Google Site Search to Any&nbsp;Website</a></li>
<li><a href='http://konstruktors.com/blog/wordpress/1241-openid-plugin-and-wordpress-2-8/' rel='bookmark' title='OpenID Plugin and WordPress&nbsp;2.8'>OpenID Plugin and WordPress&nbsp;2.8</a></li>
<li><a href='http://konstruktors.com/blog/the-web/2991-hosted-html5-notepad-app-sync/' rel='bookmark' title='Self-hosted HTML5 Notepad App With&nbsp;Synchronization'>Self-hosted HTML5 Notepad App With&nbsp;Synchronization</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://konstruktors.com/blog/the-web/2915-php-migrate-emails-imap-pop/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable WordPress Plugin, Theme Updates and Pretty Permalinks on&#160;Nginx</title>
		<link>http://konstruktors.com/blog/wordpress/2885-enable-plugin-theme-updates-and-pretty-permalinks-nginx/</link>
		<comments>http://konstruktors.com/blog/wordpress/2885-enable-plugin-theme-updates-and-pretty-permalinks-nginx/#comments</comments>
		<pubDate>Tue, 22 Feb 2011 18:47:42 +0000</pubDate>
		<dc:creator>Kaspars</dc:creator>
				<category><![CDATA[Performance]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[nginx]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[snippet]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://konstruktors.com/?p=2885</guid>
		<description><![CDATA[WordPress doesn&#8217;t know that your Nginx web server is capable of doing URL rewrites without mod_rewrite and Apache, so we explain that by adding: add_filter('got_rewrite', 'nginx_has_rewrites'); function nginx_has_rewrites() { return true; } in your theme&#8217;s functions.php. It is very likely that along Nginx you are also running PHP-FPM for all your PHP needs, and for [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress doesn&#8217;t know that your Nginx web server is capable of doing URL rewrites without <code>mod_rewrite</code> and Apache, so we explain that by adding:</p>
<pre><code>add_filter('got_rewrite', 'nginx_has_rewrites');
function nginx_has_rewrites() {
	return true;
}</code></pre>
<p>in your theme&#8217;s <code>functions.php</code>.</p>
<p>It is very likely that along Nginx you are also running PHP-FPM for all your PHP needs, and for some reason WordPress thinks its PHP process can&#8217;t write to disk. We tell WordPress that it can:</p>
<pre><code>add_filter('filesystem_method', 'nginx_make_filesystem_direct');
function nginx_make_filesystem_direct() {
	return 'direct';
}</code></pre>
<h4>Related posts</h4><ol>
<li><a href='http://konstruktors.com/blog/wordpress/1660-enable-automatic-updates-for-plugins-hosted-by-developers/' rel='bookmark' title='Enable Automatic Updates for Plugins Hosted by&nbsp;Developers'>Enable Automatic Updates for Plugins Hosted by&nbsp;Developers</a></li>
<li><a href='http://konstruktors.com/blog/wordpress/2752-rewrite-wp-minify-urls-for-css-and-js-offloading/' rel='bookmark' title='Rewrite WP-Minify URLs for CSS and JS&nbsp;Offloading'>Rewrite WP-Minify URLs for CSS and JS&nbsp;Offloading</a></li>
<li><a href='http://konstruktors.com/blog/wordpress/3594-wordpress-dashboard-quick-login/' rel='bookmark' title='Enable WordPress Dashboard Quick&nbsp;Login'>Enable WordPress Dashboard Quick&nbsp;Login</a></li>
</ol>]]></content:encoded>
			<wfw:commentRss>http://konstruktors.com/blog/wordpress/2885-enable-plugin-theme-updates-and-pretty-permalinks-nginx/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
