<?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>Libre Things &#187; PHP</title>
	<atom:link href="http://positon.org/tag/php/feed" rel="self" type="application/rss+xml" />
	<link>http://positon.org</link>
	<description></description>
	<lastBuildDate>Tue, 23 Feb 2016 20:01:11 +0000</lastBuildDate>
	<language>en-US</language>
		<sy:updatePeriod>hourly</sy:updatePeriod>
		<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.7.1</generator>
	<item>
		<title>PHP escapeshellarg function, UTF8 and locales</title>
		<link>http://positon.org/php-escapeshellarg-function-utf8-and-locales</link>
		<comments>http://positon.org/php-escapeshellarg-function-utf8-and-locales#comments</comments>
		<pubDate>Tue, 14 Jun 2011 22:09:00 +0000</pubDate>
		<dc:creator><![CDATA[dooblem]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[locales]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[UTF8]]></category>

		<guid isPermaLink="false">http://positon.org:81/?p=111</guid>
		<description><![CDATA[The PHP escapeshellarg function depends on your current locale. I think it&#8217;s bad, but PHP developers made this choice. If like me your default locale is &#8216;C&#8217; you lose all UTF8 characters. They suggest you to call something like setlocale(LC_CTYPE, "en_US.UTF-8"). It doesn&#8217;t work if the en_US.utf8 locale is not installed on your system. Of [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>The PHP <code>escapeshellarg</code> function depends on your current locale. I think it&#8217;s bad, but PHP developers made this choice. If like me your default locale is &#8216;C&#8217; you lose all UTF8 characters.</p>
<p>They suggest you to call something like <code>setlocale(LC_CTYPE, "en_US.UTF-8")</code>. It doesn&#8217;t work if the <code>en_US.utf8</code> locale is not installed on your system. Of course maybe you have the <code>fr_FR.utf8</code>, or <code>de_DE.utf8</code>, but you will have to try all of them until you find one utf8 matching locale. And if there is not, you&#8217;re screwed. It&#8217;s also bad if you want code that runs everywhere.</p>
<p>Simply use that:</p>
<pre>
$escapedArg = &quot;'&quot;.str_replace(&quot;'&quot;, &quot;'\\''&quot;, $arg).&quot;'&quot;;
</pre>
<p>It will do the same as the <code>escapeshellarg</code> function: replace <code>yourstringthat'slong</code> by</p>
<pre>
'yourstringthat'\''slong'
</pre>
<p>as described in the <a href="http://www.php.net/escapeshellarg">escapeshellarg manual</a> (and I also looked into the PHP source code to be sure).</p>
<p>See also:</p>
<ul>
<li><a href="http://www.php.net/escapeshellarg" title="http://www.php.net/escapeshellarg">http://www.php.net/escapeshellarg</a></li>
<li><a href="http://bugs.php.net/bug.php?id=44945" title="http://bugs.php.net/bug.php?id=44945">http://bugs.php.net/bug.php?id=44945</a></li>
<li><a href="http://bugs.php.net/bug.php?id=44564" title="http://bugs.php.net/bug.php?id=44564">http://bugs.php.net/bug.php?id=44564</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://positon.org/php-escapeshellarg-function-utf8-and-locales/feed</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>Preload web content using link prefetch or javascript</title>
		<link>http://positon.org/preload-web-content-using-link-prefetch-or-javascript</link>
		<comments>http://positon.org/preload-web-content-using-link-prefetch-or-javascript#comments</comments>
		<pubDate>Sat, 30 Oct 2010 15:50:00 +0000</pubDate>
		<dc:creator><![CDATA[dooblem]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Bizou]]></category>
		<category><![CDATA[Chromium]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[HTTP]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://positon.org:81/?p=104</guid>
		<description><![CDATA[For the Bizou php gallery, I looked for different ways of preloading next image in &#8220;view&#8221; mode (example). With Firefox it&#8217;s very simple. Just use the following element and the browser will preload your contents. Contents are preloaded in background, once the whole current page is loaded. [html] &#60;link rel=&#34;prefetch&#34; href=&#34;/images/nextimage.jpg&#34; /&#62; Problem: only Firefox [&#8230;]]]></description>
				<content:encoded><![CDATA[<p>For the <a href="http://www.positon.org/bizou/en.html">Bizou</a> php gallery, I looked for different ways of preloading next image in &#8220;view&#8221; mode (<a href="http://www.positon.org/images/view.php/2008%20Corse/001%20ajaccio.jpg">example</a>).</p>
<p>With <a href="http://www.mozilla.com/firefox/">Firefox</a> it&#8217;s very simple. Just use the following element and the browser will preload your contents.<br />
Contents are preloaded in background, once the whole current page is loaded.</p>
<pre> [html]
&lt;link rel=&quot;prefetch&quot; href=&quot;/images/nextimage.jpg&quot; /&gt;
</pre>
<p>Problem: only Firefox supports this currently.<br />
Note: a <a href="http://code.google.com/p/chromium/issues/detail?id=52878">ticket is opened</a> about this in the <a href="http://www.chromium.org/Home">Chromium</a> project.</p>
<p>For other browsers, use some Javascript triggered by the <code>window.onload</code> event:</p>
<pre> [javascript]
&lt;script type=&quot;text/javascript&quot;&gt;
window.onload = function() {
    // for images
    var im = new Image();
    im.src = '/images/nextimage.jpg';
    // and for other content
    var req = new XMLHttpRequest();
    req.open('GET', 'nextpage.php', false);
    req.send(null);
};
&lt;/script&gt;
</pre>
<p>Beware of HTTP cache headers sent by the server to the browser.<br />
To preload correctly PHP pages, make your script send an Expires header:</p>
<pre>
header('Expires: '.gmdate('D, d M Y H:i:s \G\M\T', time() + 3600));
</pre>
<p>Then, for a simple browser detection from your PHP script:</p>
<pre>
&lt;?php if (strpos($_SERVER['HTTP_USER_AGENT'], 'Firefox') !== false) { ?&gt;
&lt;link rel=&quot;prefetch&quot; href=&quot;nextpage.php&quot; /&gt;

&lt;?php } else { ?&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
window.onload = function() {
    var req = new XMLHttpRequest();
    req.open('GET', 'nextpage.php', false);
    req.send(null);
};
&lt;/script&gt;
&lt;?php } ?&gt;
</pre>
<p><ins>Links</ins> :</p>
<ul>
<li><a href="https://developer.mozilla.org/en/Link_prefetching_FAQ" title="https://developer.mozilla.org/en/Link_prefetching_FAQ">https://developer.mozilla.org/en/Link_prefetching_FAQ</a></li>
<li><a href="http://www.4thkingdom.com/wp-content/uploads/dotclearold/computers/789073-web-site-speed-prefetching-images-css/view-post.html" title="http://www.4thkingdom.com/wp-content/uploads/dotclearold/computers/789073-web-site-speed-prefetching-images-css/view-post.html">http://www.4thkingdom.com/wp-content/uploads/dotclearold/computers/789073-web-site-speed-prefetching-images-css/view-post.html</a> (using jQuery)</li>
<li><a href="http://orip.org/2009/03/prefetching-javascript-or-anything-with.html" title="http://orip.org/2009/03/prefetching-javascript-or-anything-with.html">http://orip.org/2009/03/prefetching-javascript-or-anything-with.html</a> (using jQuery)</li>
<li><a href="http://www.positon.org/git/?p=bizou.git;a=commitdiff;h=3287102a856be64262a9db0c98e7be7f9c26dbb8">commit sur Bizou</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://positon.org/preload-web-content-using-link-prefetch-or-javascript/feed</wfw:commentRss>
		<slash:comments></slash:comments>
		</item>
		<item>
		<title>(Français) Perles PHP</title>
		<link>http://positon.org/perles-php</link>
		<comments>http://positon.org/perles-php#comments</comments>
		<pubDate>Thu, 19 Jun 2008 07:30:00 +0000</pubDate>
		<dc:creator><![CDATA[dooblem]]></dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[laugh]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://positon.org:81/?p=27</guid>
		<description><![CDATA[Sorry, this entry is only available in Français.]]></description>
				<content:encoded><![CDATA[<p>Sorry, this entry is only available in <a href="http://fr.positon.org/tag/php/feed">Français</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://positon.org/perles-php/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
