<?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>{curlybracket} &#187; PHP</title>
	<atom:link href="http://curlybracket.net/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://curlybracket.net</link>
	<description>Development &#38; Design for digital media</description>
	<lastBuildDate>Thu, 02 Feb 2012 14:56:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Adding Vimeo videos to WordPress via extra fields</title>
		<link>http://curlybracket.net/2011/04/13/adding-vimeo-videos-to-wordpress-via-extra-fields/</link>
		<comments>http://curlybracket.net/2011/04/13/adding-vimeo-videos-to-wordpress-via-extra-fields/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 19:57:43 +0000</pubDate>
		<dc:creator>rike</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[vimeo]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">http://curlybracket.net/?p=1856</guid>
		<description><![CDATA[I wanted an easy solution for people to add videos from Vimeo to their WordPress articles (without having to add them to the editor for several reasons) and I came up with the following: a function to be added to &#8230; <a href="http://curlybracket.net/2011/04/13/adding-vimeo-videos-to-wordpress-via-extra-fields/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>I wanted an easy solution for people to add videos from Vimeo to their WordPress articles (without having to add them to the editor for several reasons) and I came up with the following:</p>
<ul>
<li>a function to be added to the teme</li>
<li>a piece of code to add to one or more templates(s) of the theme</li>
<li>an extra field to fill in for each post or page by the editor of the website</li>
</ul>
<p><strong>The function</strong></p>
<p>Add this to functions.php in your theme. It is based on the vimeo shortcode plugin for WordPress.</p>
<pre>function insert_vimeo($clip_id) {
   $width = '640';
   $height = '360';
   if (empty($clip_id) || !is_numeric($clip_id)) return '&lt;!-- Vimeo: Invalid clip_id --&gt;';
   if ($height &amp;&amp; !$width) $width = intval($height * 16 / 9);
   if (!$height &amp;&amp; $width) $height = intval($width * 9 / 16);
   return "&lt;iframe src='http://player.vimeo.com/video/$clip_id?title=0&amp;amp;byline=0&amp;amp;portrait=0'
           width='$width' height='$height' frameborder='0'&gt;&lt;/iframe&gt;";
}</pre>
<p><strong>The piece of code for your template :</strong></p>
<p>Put this in single.php or page.php, within the loop.<strong><br />
</strong></p>
<pre>&lt;?php
if ( get_post_meta($post-&gt;ID, 'vimeo', true) ) :
    $vimeo = get_post_meta($post-&gt;ID, 'vimeo', true);
    echo (insert_vimeo($vimeo));
endif;
?&gt;</pre>
<p>Now you just have to add an extra field called &laquo;&nbsp;vimeo&nbsp;&raquo; to your posts or pages and add as a value the ID of the clip, that means the numbers in the URL. If, for example, you want to add the video at <a href="http://vimeo.com/20732587">http://vimeo.com/20732587</a> you would add <em>20732587</em> to the value of your field.</p>
]]></content:encoded>
			<wfw:commentRss>http://curlybracket.net/2011/04/13/adding-vimeo-videos-to-wordpress-via-extra-fields/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hands up! Studio de graphisme</title>
		<link>http://curlybracket.net/2011/02/20/handsup-studio/</link>
		<comments>http://curlybracket.net/2011/02/20/handsup-studio/#comments</comments>
		<pubDate>Sun, 20 Feb 2011 12:12:54 +0000</pubDate>
		<dc:creator>rike</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[font-face]]></category>
		<category><![CDATA[Javascript/jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<guid isPermaLink="false">http://curlybracket.net/?p=1823</guid>
		<description><![CDATA[hands up ! est un studio de graphisme à Paris dont je fais partie en tant que responsable du développement web.]]></description>
			<content:encoded><![CDATA[<p><img class="alignnone size-full wp-image-1824" title="handsup" src="http://curlybracket.net/wp-content/uploads/2011/02/handsup.png" alt="" width="720" height="507" /></p>
<p><em>hands up !</em> est un studio de graphisme à Paris dont je fais partie en tant que responsable du développement web.</p>
]]></content:encoded>
			<wfw:commentRss>http://curlybracket.net/2011/02/20/handsup-studio/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Automatically generate a RSS feed from static pages with PHP</title>
		<link>http://curlybracket.net/2010/09/30/how-to-generate-a-rss-feed-from-a-static-html-page/</link>
		<comments>http://curlybracket.net/2010/09/30/how-to-generate-a-rss-feed-from-a-static-html-page/#comments</comments>
		<pubDate>Thu, 30 Sep 2010 17:51:23 +0000</pubDate>
		<dc:creator>rike</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[RSS]]></category>
		<guid isPermaLink="false">http://curlybracket.net/?p=1555</guid>
		<description><![CDATA[This may sound a stupid thing to do, however, there are websites out there in plain and badly formatted HTML out there that need RSS feeds. See the script in action here : http://airdeparis.com/rss.php Here I am considering that we &#8230; <a href="http://curlybracket.net/2010/09/30/how-to-generate-a-rss-feed-from-a-static-html-page/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>This may sound a stupid thing to do, however, there are websites out there in plain and badly formatted HTML out there that need RSS feeds.</p>
<p>See the script in action here : <a href="http://airdeparis.com/rss.php">http://airdeparis.com/rss.php</a></p>
<p>Here I am considering that we update some files every now and then and we want those updates  to appear in a dynamic RSS feed. In order to do so save the following code as a file called &laquo;&nbsp;rss.php&nbsp;&raquo;, edit it to suit your needs and then upload it to  your site. You may access the file like this : http://example.com/rss.php.</p>
<h3>How does it work?</h3>
<p>We declare the files we want to have in our PHP file in an array. We will use the last modification time of each of these files, filter out the &lt;title&gt; and contents and then create the feed.</p>
<p>(By the way, if you want this to work on PHP4 you will have to replace the <em>html_entity_decode</em> function otherwise it will not function.<em>)<br />
</em></p>
<p><span id="more-1555"></span></p>
<h3>The code</h3>
<pre>&lt;?php
/*************************************************************************************
WTFPL, copyright 2010 curlybracket.net
html strip function from http://nadeausoftware.com/articles/2007/09/php_tip_how_strip_html_tags_web_page
**************************************************************************************/
//////////////////////////////////////////////////////////////////////////////////////
// adjust to your needs
$sitename = "My example site";
$siteurl = "http://example.com/";
$sitedescription = "On example.com we talk a lot about examples.";
$files = array("firstpage.htm", "second.html", "directory/lol.html");
$lang = "en";
//////////////////////////////////////////////////////////////////////////////////////
$now = date("D, d M Y H:i:s O");
$rss = readfiles($files);
//////////////////////////////////////////////////////////////////////////////////////
// RSS output
header("Content-Type: application/rss+xml");
echo '&lt;?xml version="1.0" encoding="UTF-8"?&gt;'."\n"; ?&gt;
&lt;rss version="2.0"&gt;
  &lt;channel&gt;
    &lt;title&gt;&lt;?php echo $sitename; ?&gt;&lt;/title&gt;
    &lt;link&gt;&lt;?php echo $siteurl; ?&gt;&lt;/link&gt;
    &lt;description&gt;&lt;?php echo $sitedescription; ?&gt;&lt;/description&gt;
    &lt;lastBuildDate&gt;&lt;?php echo $now ?&gt;&lt;/lastBuildDate&gt;
    &lt;language&gt;&lt;?php echo $lang; ?&gt;&lt;/language&gt;
    &lt;?php if($rss) {
          foreach($rss as $item) {
            echo '    &lt;item&gt;
            &lt;title&gt;'.$item['title'].'&lt;/title&gt;
            &lt;guid&gt;'.$siteurl.$item['file'].'&lt;/guid&gt;
            &lt;pubDate&gt;'.$item['lastmod'].'&lt;/pubDate&gt;
            &lt;description&gt;'.$item['description'].'&lt;/description&gt;
            &lt;link&gt;'.$siteurl.$item['file'].'&lt;/link&gt;
            &lt;/item&gt;\n';
          }
    } ?&gt;
  &lt;/channel&gt;
&lt;/rss&gt;
//////////////////////////////////////////////////////////////////////////////////////
function readfiles($files) {
    $i = 0;
    foreach($files as $file) {
        if(file_exists($file) &amp;&amp; is_readable($file)) {
             //which file, for link construction
             $rss[$i]['file'] = $file;
             // find the page last modification time
             $rss[$i]['lastmod'] = date("D, d M Y H:i O", filemtime($file));
             // find the page title from the &lt;title&gt; atrribute
             $file_contents = file_get_contents($file);
             $start = strpos($file_contents, '&lt;title&gt;');
             $end = strpos($file_contents, '&lt;/title&gt;');
             if ($start !== false) {
                 $start = $start + 7; //href=" = 6 chars
                 if ($end !== false) {
                     $end = $end - $start; //length of string
                 }
                 $rss[$i]['title'] = substr($file_contents, $start, $end);
            } else {
                 $rss[$i]['title'] = $sitename;
            }
            // get file description from file content
            // Get the file's character encoding from a &lt;meta&gt; tag
            preg_match('@&lt;meta\s+http-equiv="Content-Type"\s+content="([\w/]+)(;\s+charset=([^\s"]+))?@i', $file_contents, $matches);
            $encoding = $matches[3];
            // Convert to UTF-8 before doing anything else
            $utf8_text = iconv($encoding, "utf-8", $file_contents);
            // Strip HTML tags and invisible text
            $utf8_text = strip_html_tags($utf8_text);
            // remove empty lines
            $utf8_text = preg_replace("/(^[\r\n]*|[\r\n]+)[\s\t]*[\r\n]+/", "", $utf8_text);
            // Decode HTML entities, this works in PHP5
            $utf8_text = trim(html_entity_decode($utf8_text, ENT_QUOTES, "UTF-8"));
            $rss[$i]['description'] = $utf8_text;
        } else {
            // the file does not exist or is not readable.
           return FALSE;
        }
        $i++;
    }
    return($rss);
}
//////////////////////////////////////////////////////////////////////////////////////
/**
 * Remove HTML tags, including invisible text such as style and
 * script code, and embedded objects. Add line breaks around
 * block-level tags to prevent word joining after tag removal.
 */
function strip_html_tags($text) {
    $text = preg_replace(
    array(
    // Remove invisible content
    '@&lt;head[^&gt;]*?&gt;.*?&lt;/head&gt;@siu',
    '@&lt;style[^&gt;]*?&gt;.*?&lt;/style&gt;@siu',
    '@&lt;script[^&gt;]*?.*?&lt;/script&gt;@siu',
    '@&lt;object[^&gt;]*?.*?&lt;/object&gt;@siu',
    '@&lt;embed[^&gt;]*?.*?&lt;/embed&gt;@siu',
    '@&lt;applet[^&gt;]*?.*?&lt;/applet&gt;@siu',
    '@&lt;noframes[^&gt;]*?.*?&lt;/noframes&gt;@siu',
    '@&lt;noscript[^&gt;]*?.*?&lt;/noscript&gt;@siu',
    '@&lt;noembed[^&gt;]*?.*?&lt;/noembed&gt;@siu',
    // Add line breaks before and after blocks
    '@&lt;/?((address)|(blockquote)|(center)|(del))@iu',
    '@&lt;/?((div)|(h[1-9])|(ins)|(isindex)|(p)|(pre))@iu',
    '@&lt;/?((dir)|(dl)|(dt)|(dd)|(li)|(menu)|(ol)|(ul))@iu',
    '@&lt;/?((table)|(th)|(td)|(caption))@iu',
    '@&lt;/?((form)|(button)|(fieldset)|(legend)|(input))@iu',
    '@&lt;/?((label)|(select)|(optgroup)|(option)|(textarea))@iu',
    '@&lt;/?((frameset)|(frame)|(iframe))@iu',
    ),
    array(
    ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
    "\n\$0", "\n\$0", "\n\$0", "\n\$0", "\n\$0", "\n\$0",
    "\n\$0", "\n\$0",
    ),
    $text );
    return strip_tags($text);
}</pre>
]]></content:encoded>
			<wfw:commentRss>http://curlybracket.net/2010/09/30/how-to-generate-a-rss-feed-from-a-static-html-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>php-indexes &#8211; a file tree generator</title>
		<link>http://curlybracket.net/2009/07/31/php-indexes-file-tree-generator-with-rss/</link>
		<comments>http://curlybracket.net/2009/07/31/php-indexes-file-tree-generator-with-rss/#comments</comments>
		<pubDate>Fri, 31 Jul 2009 13:51:56 +0000</pubDate>
		<dc:creator>rike</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[PHP]]></category>
		<guid isPermaLink="false">http://curlybracket.net/?p=564</guid>
		<description><![CDATA[php-indexes generates an index of files in a defined folder, similar to the Apache file listing. Files may be ordered by name or date. It also generates an RSS feed. It does not require a database and is configurable via &#8230; <a href="http://curlybracket.net/2009/07/31/php-indexes-file-tree-generator-with-rss/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img class="size-thumbnail wp-image-927 alignright" title="php-in" src="http://curlybracket.net/wp-content/uploads/2009/07/php-in-305x148.png" alt="php-in" width="305" height="148" />php-indexes generates an index of files in a defined folder, similar to the Apache file listing. Files may be ordered by name or date. It also generates an RSS feed. It does not require a database and is configurable via a simple config file for:</p>
<ul>
<li>title and description</li>
<li>search engine friendly permalink support (thank you <a href="http://manurevah.com">Emmanuel</a>)</li>
<li>defining the number of entries in RSS feed</li>
<li>modify style to your needs</li>
</ul>
<p>php-indexes is distributed under the GNU Public License (GPL), version 3. Use at your own risk.</p>
<p>I&#8217;m happy with feedback &amp; criticism.</p>
<p><a href="http://curlybracket.net/php-indexes/">Try a demo here</a>.</p>
<p>download <a href="http://curlybracket.net/wp-content/uploads/2009/07/php-indexes-v1.1.tar.gz">php-indexes-v1.1.tar.gz</a> | <a href="http://curlybracket.net/wp-content/uploads/2009/07/php-indexes-v1.1.zip">php-indexes-v1.1.zip</a> (mai 2010)<em><br />
</em></p>
]]></content:encoded>
			<wfw:commentRss>http://curlybracket.net/2009/07/31/php-indexes-file-tree-generator-with-rss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AC Matière</title>
		<link>http://curlybracket.net/2008/06/27/ac-matiere/</link>
		<comments>http://curlybracket.net/2008/06/27/ac-matiere/#comments</comments>
		<pubDate>Fri, 27 Jun 2008 16:01:20 +0000</pubDate>
		<dc:creator>rike</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">http://curlybracket.net/?p=137</guid>
		<description><![CDATA[Le magasin AC Matière vend des peintures et des éléments décoratifs originaux. Dans le cadre d&#8217;une restructuration du site web, conçu en 2005, toujours en collaboration avec design ex machina, nous sommes aussi revenus sur le développement original du site &#8230; <a href="http://curlybracket.net/2008/06/27/ac-matiere/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://curlybracket.net/wp-content/uploads/2008/06/acm.png"><img class="alignnone size-full wp-image-751" title="acmsmall" src="http://curlybracket.net/wp-content/uploads/2008/06/acmsmall1.png" alt="acmsmall" width="620" height="180" /></a></p>
<p><strong>Le magasin AC Matière vend des peintures et des éléments décoratifs originaux.<br />
Dans le cadre d&#8217;une restructuration du site web, conçu en 2005, toujours en collaboration avec <a href="http://designexmachina.net" target="_blank">design ex machina</a>, nous sommes aussi revenus sur le développement original du site web. Le site a maintenant des URLs propres et peut être mis à jour plus facilement. Le graphisme original de <a href="http://designexmachina.net" target="_blank">design ex machina</a> a été légèrement modifié.</strong></p>
<p><em>AC Matière sells paints and original decorative elements.<br />
In a collective effort with <a href="http://designexmachina.net/" target="_blank">design ex machina</a>, we have restructured the website we created originally in 2005, and abandoned our old PHP developments. The website has now search engine friendly URLs and can be updated more easily. The original design by <a href="http://designexmachina.net/" target="_blank">design ex machina</a> ahs been slightly modified.</em></p>
<p><a class="refer" href="http://acmatiere.fr">http://acmatiere.fr</a></p>
]]></content:encoded>
			<wfw:commentRss>http://curlybracket.net/2008/06/27/ac-matiere/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Air de Paris</title>
		<link>http://curlybracket.net/2006/11/09/docairdpariscom/</link>
		<comments>http://curlybracket.net/2006/11/09/docairdpariscom/#comments</comments>
		<pubDate>Thu, 09 Nov 2006 04:37:13 +0000</pubDate>
		<dc:creator>rike</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[graphics]]></category>
		<category><![CDATA[PHP]]></category>
		<guid isPermaLink="false">http://curlybracket.org/2006/11/09/docairdpariscom/</guid>
		<description><![CDATA[Pour la galerie parisienne «Air de Paris»j&#8217;ai développé un simple système de gestion d&#8217;accès public et semi-public aux documents et documentations sur les artistes. Une interface d&#8217;administration permet la génération de mots de passe, et l&#8217;édition de permissions d&#8217;accès à &#8230; <a href="http://curlybracket.net/2006/11/09/docairdpariscom/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><a href="http://curlybracket.net/wp-content/uploads/2006/11/doc.png"><img class="alignnone size-full wp-image-826" title="docsmall" src="http://curlybracket.net/wp-content/uploads/2006/11/docsmall.png" alt="docsmall" width="620" height="215" /></a><br />
<strong>Pour la galerie parisienne «Air de Paris»j&#8217;ai développé un simple système de gestion d&#8217;accès public et semi-public aux documents et documentations sur les artistes. Une interface d&#8217;administration permet la génération de mots de passe, et l&#8217;édition de permissions d&#8217;accès à certains dossiers.</strong></p>
<p>Für die Pariser Galerie &laquo;&nbsp;Air de Paris&nbsp;&raquo; habe ich ein einfaches System entwickelt, das es erlaubt öffentliche und halböffentliche Dokumente und Dokumentationen über die Künstler der Galerie zum Download bereitzustellen. Über ein Administrationsinterface können Paßwörter generiert werden, sowie Zugangsbeschränkungen für einzelne Verzeichnisse erstellt und editiert werden.</p>
]]></content:encoded>
			<wfw:commentRss>http://curlybracket.net/2006/11/09/docairdpariscom/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

