<?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>Naufraghi nella rete &#187; wordpress</title>
	<atom:link href="http://www.slug.it/naufraghi/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.slug.it/naufraghi</link>
	<description>… dolce m’è il naufragar in questo mare?</description>
	<lastBuildDate>Fri, 03 Feb 2012 16:10:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<meta xmlns="http://www.w3.org/1999/xhtml" name="robots" content="noindex,follow" />
		<item>
		<title>Released PHP Math Publisher WordPress plugin</title>
		<link>http://www.slug.it/naufraghi/released-php-math-publisher-wordpress-plugin/</link>
		<comments>http://www.slug.it/naufraghi/released-php-math-publisher-wordpress-plugin/#comments</comments>
		<pubDate>Thu, 23 Mar 2006 11:45:39 +0000</pubDate>
		<dc:creator>Matteo</dc:creator>
				<category><![CDATA[informatica]]></category>
		<category><![CDATA[matematica]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.slug.it/naufraghi/php-math-publisher-wordpress-plugin/</guid>
		<description><![CDATA[This is a simple plugin for wordpress enabling the usage of the PHP Math Publisher lib: &#91;pmath&#93;&#40;a^2+b^2&#41;=a^2+2*a*b+b^2&#91;/pmath&#93; results in: Download it here PHP Math Publisher WordPress plugin.]]></description>
			<content:encoded><![CDATA[<p>This is a simple plugin for wordpress enabling the usage of the <a href="http://www.xm1math.net/phpmathpublisher/">PHP Math Publisher</a> lib:</p>
<div class="codesnip-container" >
<div class="ini codesnip" style="font-family:monospace;"><span class="re0"><span class="br0">&#91;</span>pmath<span class="br0">&#93;</span><span class="br0">&#40;</span>a^<span class="nu0">2</span>+b^<span class="nu0">2</span><span class="br0">&#41;</span><span class="sy0">=</span>a^<span class="nu0">2</span>+<span class="nu0">2</span>*a*b+b^<span class="nu0">2</span><span class="br0">&#91;</span>/pmath<span class="br0">&#93;</span></span></div>
</div>
<p>results in:</p>
<p><img src="/naufraghi/wp-content/plugins/phpmathpublisher/img/math_986.5_ac4042336b720f070edf0ad49294ba38.png" style="vertical-align:-13.5px; display: inline-block ;" alt="(a^2+b^2)=a^2+2*a*b+b^2" title="(a^2+b^2)=a^2+2*a*b+b^2"/></p>
<p>Download it here <a href="http://www.slug.it/naufraghi/programmazione-web/php-math-publisher-wordpress-plugin/">PHP Math Publisher WordPress plugin</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slug.it/naufraghi/released-php-math-publisher-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Remove curly quotes from WordPress 2.0 &lt;code&gt;</title>
		<link>http://www.slug.it/naufraghi/remove-curly-quotes-from-wordpress-20/</link>
		<comments>http://www.slug.it/naufraghi/remove-curly-quotes-from-wordpress-20/#comments</comments>
		<pubDate>Wed, 22 Mar 2006 01:26:00 +0000</pubDate>
		<dc:creator>Matteo</dc:creator>
				<category><![CDATA[informatica]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.slug.it/naufraghi/remove-curly-quotes-from-wordpress-20/</guid>
		<description><![CDATA[WordPress is a very good piece of software, so good that a problem can usually be solved in a few minutes. If you are a programmer you&#8217;l have noticed that a &#60;code&#62; tag containing some &#8230; code is sometime scrumbled &#8230; <a href="http://www.slug.it/naufraghi/remove-curly-quotes-from-wordpress-20/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>WordPress is a very good piece of software, so good that a problem can usually be solved in a few minutes.</p>
<p>If you are a programmer you&#8217;l have noticed that a &lt;code&gt; tag containing some &#8230; code is sometime scrumbled by wordpress, converting the normal quotes in the  culry ones.</p>
<p>This conversion happends in the <samp>wp-includes / functions-formatting.php</samp> file, we can see the loop is skipping the block following &lt;code&gt;, &lt;pre&gt;, etc tags:</p>
<p>But this is not enough in the case we are using some code colorizer plugins as <a href="http://blog.enargi.com/codesnippet/">Code Snippet</a>.</p>
<p>But&#8230; with a few keystrokes we can count +1 when we enter in a &#8220;skippable&#8221; tag and count -1 when we found the closing tag.</p>
<p>The resulting code is working right now on the diff-file on the 2.0.2 version:</p>
<div class="codesnip-container" >
<div class="php codesnip" style="font-family:monospace;">7c7<br />
<span class="sy0">&lt;</span> &nbsp; &nbsp; <span class="re0">$stop</span> <span class="sy0">=</span> <a href="http://www.php.net/count"><span class="kw3">count</span></a><span class="br0">&#40;</span><span class="re0">$textarr</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="re0">$next</span> <span class="sy0">=</span> <span class="kw4">true</span><span class="sy0">;</span> <span class="co1">// loop stuff</span><br />
<span class="sy0">&#8212;</span><br />
<span class="sy0">&gt;</span> &nbsp; &nbsp; <span class="re0">$stop</span> <span class="sy0">=</span> <a href="http://www.php.net/count"><span class="kw3">count</span></a><span class="br0">&#40;</span><span class="re0">$textarr</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="re0">$next</span> <span class="sy0">=</span> <span class="nu0">0</span><span class="sy0">;</span> <span class="co1">// loop stuff</span><br />
11c11<br />
<span class="sy0">&lt;</span> &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$curl</span><span class="br0">&#123;</span><span class="nu0">0</span><span class="br0">&#125;</span><span class="br0">&#41;</span> <span class="sy0">&amp;&amp;</span> <span class="st_h">&#8216;&lt;&#8217;</span> <span class="sy0">!=</span> <span class="re0">$curl</span><span class="br0">&#123;</span>0<span class="br0">&#125;</span> <span class="sy0">&amp;&amp;</span> <span class="re0">$next</span><span class="br0">&#41;</span> <span class="br0">&#123;</span> <span class="co1">// If it&#8217;s not a tag</span><br />
<span class="sy0">&#8212;</span><br />
<span class="sy0">&gt;</span> &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><a href="http://www.php.net/isset"><span class="kw3">isset</span></a><span class="br0">&#40;</span><span class="re0">$curl</span><span class="br0">&#123;</span><span class="nu0">0</span><span class="br0">&#125;</span><span class="br0">&#41;</span> <span class="sy0">&amp;&amp;</span> <span class="st_h">&#8216;&lt;&#8217;</span> <span class="sy0">!=</span> <span class="re0">$curl</span><span class="br0">&#123;</span>0<span class="br0">&#125;</span> <span class="sy0">&amp;&amp;</span> <span class="re0">$next</span> <span class="sy0">==</span> <span class="nu0">0</span> <span class="br0">&#41;</span> <span class="br0">&#123;</span> <span class="co1">// If it&#8217;s not a tag</span><br />
40<span class="sy0">,</span>42c40<span class="sy0">,</span>42<br />
<span class="sy0">&lt;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$next</span> <span class="sy0">=</span> <span class="kw4">false</span><span class="sy0">;</span><br />
<span class="sy0">&lt;</span> &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">else</span> <span class="br0">&#123;</span><br />
<span class="sy0">&lt;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$next</span> <span class="sy0">=</span> <span class="kw4">true</span><span class="sy0">;</span><br />
<span class="sy0">&#8212;</span><br />
<span class="sy0">&gt;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$next</span> <span class="sy0">+=</span> <span class="nu0">1</span><span class="sy0">;</span><br />
<span class="sy0">&gt;</span> &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span> <span class="kw1">elseif</span> <span class="br0">&#40;</span><a href="http://www.php.net/strstr"><span class="kw3">strstr</span></a><span class="br0">&#40;</span><span class="re0">$curl</span><span class="sy0">,</span> <span class="st_h">&#8216;&lt;/code&#8217;</span><span class="br0">&#41;</span> <span class="sy0">||</span> <a href="http://www.php.net/strstr"><span class="kw3">strstr</span></a><span class="br0">&#40;</span><span class="re0">$curl</span><span class="sy0">,</span> <span class="st_h">&#8216;&lt;/pre&#8217;</span><span class="br0">&#41;</span> <span class="sy0">||</span> <a href="http://www.php.net/strstr"><span class="kw3">strstr</span></a><span class="br0">&#40;</span><span class="re0">$curl</span><span class="sy0">,</span> <span class="st_h">&#8216;&lt;/kbd&#8217;</span> <span class="sy0">||</span> <a href="http://www.php.net/strstr"><span class="kw3">strstr</span></a><span class="br0">&#40;</span><span class="re0">$curl</span><span class="sy0">,</span> <span class="st_h">&#8216;&lt;/style&#8217;</span><span class="br0">&#41;</span> <span class="sy0">||</span> <a href="http://www.php.net/strstr"><span class="kw3">strstr</span></a><span class="br0">&#40;</span><span class="re0">$curl</span><span class="sy0">,</span> <span class="st_h">&#8216;&lt;/script&#8217;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span><br />
<span class="sy0">&gt;</span> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="re0">$next</span> <span class="sy0">-=</span> <span class="nu0">1</span><span class="sy0">;</span></div>
</div>
<p>Thanks to <a href="http://www.moskalyuk.com/blog/removing-curly-quotes-from-wordpress-20/996">www.moskalyuk.com</a> for the idea and to the <a href="http://www.wordpress.org">wordpress</a> team for &#8230; wordpress!</p>
<p>Due righe in italiano per chi proprio l&#8217;inglese non lo mastica.</p>
<p>WordPress converte virgolette e apostrofi semplici in curvi, e questo può essere un problema quando si vuole inserire del codice nella pagina. Infatti la versione attuale della funzione che fa il lavoro di &#8220;abbellimento&#8221; delle virgolette evita il contenuto di alcuni tag, come &lt;code&gt; e &lt;pre&gt;, ma non riesce a gestire i casi un po&#8217; più complessi, come i codici colorati da <a href="http://blog.enargi.com/codesnippet/">Code Snippet</a> ad esempio.</p>
<p>Qua sopra una patch che invece di saltare solo il primo &#8220;blocco&#8221; dopo un tag critico, salta fino a quando non incontra un tag critico chiuso. Se il codice è bilanciato e corretto&#8230; funziona, se il codice non è corretto&#8230; poco male, perderemo le belle virgolette.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.slug.it/naufraghi/remove-curly-quotes-from-wordpress-20/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

