<?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>( f o o b a r . l u ) &#187; PHP</title>
	<atom:link href="http://foobar.lu/wp/category/coding/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://foobar.lu/wp</link>
	<description>coding should be fun</description>
	<lastBuildDate>Thu, 09 Jun 2011 15:20:07 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Zend Studio forgetting about your ZF Project</title>
		<link>http://foobar.lu/wp/2009/06/16/zend-studio-forgetting-about-your-zf-project/</link>
		<comments>http://foobar.lu/wp/2009/06/16/zend-studio-forgetting-about-your-zf-project/#comments</comments>
		<pubDate>Tue, 16 Jun 2009 14:40:21 +0000</pubDate>
		<dc:creator>wickeddoc</dc:creator>
				<category><![CDATA[PHP]]></category>
		<category><![CDATA[Zend Framework]]></category>

		<guid isPermaLink="false">http://foobar.lu/wp/?p=56</guid>
		<description><![CDATA[as a php developer i&#8217;m using zend studio for eclipse on a daily basis. sometimes zend studio forgets about my zend framework projects, especially projects which are hosted on a SVN repository. i close my project, reopen it, and for no obvious reasons zend studio no longer recognizes it as a zend framework project. huch!? [...]]]></description>
			<content:encoded><![CDATA[<p>as a php developer i&#8217;m using zend studio for eclipse on a daily basis. sometimes zend studio forgets about my zend framework projects, especially projects which are hosted on a SVN repository. i close my project, reopen it, and for no obvious reasons zend studio no longer recognizes it as a zend framework project. huch!?</p>
<p>until now i was unable to find a real solution to my problem, but here&#8217;s a little workaround which should get you up and running again, in case you&#8217;re running into the same problem.</p>
<p>close the project, then just open the .project file at the root of your project in your favourite text editor and check the &#8216;natures&#8217; section, make sure it contains the following line:</p>
<div class="codecolorer-container xml twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="xml codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;nature<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>org.zend.php.framework.ZendFrameworkNature<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/nature<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></div></div>
<p>that should do the trick.</p>
]]></content:encoded>
			<wfw:commentRss>http://foobar.lu/wp/2009/06/16/zend-studio-forgetting-about-your-zf-project/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>OverkillFlickr: a Flickr API interface for PHP5</title>
		<link>http://foobar.lu/wp/2007/07/09/overkillflickr-a-flickr-api-interface-for-php5/</link>
		<comments>http://foobar.lu/wp/2007/07/09/overkillflickr-a-flickr-api-interface-for-php5/#comments</comments>
		<pubDate>Mon, 09 Jul 2007 15:55:55 +0000</pubDate>
		<dc:creator>wickeddoc</dc:creator>
				<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://foobar.lu/wp/2007/07/09/overkillflickr-a-flickr-api-interface-for-php5/</guid>
		<description><![CDATA[I create a small Flickr API interface for PHP5 which takes advantage of the Overloading feature of PHP5. Using the __call method we can dynamically create an interface to all the Flickr API functions using only a very small script. The name of the class is purely ironic as it is a very simple and [...]]]></description>
			<content:encoded><![CDATA[<p>I create a small Flickr API interface for PHP5 which takes advantage of the Overloading feature of PHP5.</p>
<p>Using the __call method we can dynamically create an interface to all the Flickr API functions using only a very small script.</p>
<p>The name of the class is purely ironic as it is a very simple and easy-to-use class and far from Overkill.</p>
<p><span id="more-12"></span></p>
<div class="codecolorer-container php twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; <span style="color: #000000; font-weight: bold;">class</span> OverkillFlickr <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># the API key we got from flickr<br />
</span> &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$API</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; static <span style="color: #000000; font-weight: bold;">private</span> <span style="color: #000088;">$instance</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># singleton constructor<br />
</span> &nbsp; &nbsp;static <span style="color: #000000; font-weight: bold;">function</span> instance<span style="color: #009900;">&#40;</span><span style="color: #000088;">$api_key</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>OverkillFlickr<span style="color: #339933;">::</span><span style="color: #000088;">$instance</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; OverkillFlickr<span style="color: #339933;">::</span><span style="color: #000088;">$instance</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> OverkillFlickr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$api_key</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> OverkillFlickr<span style="color: #339933;">::</span><span style="color: #000088;">$instance</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #000088;">$api_key</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">API</span> &nbsp;<span style="color: #339933;">=</span> <span style="color: #000088;">$api_key</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># the __call method allows us to dynamically create any<br />
</span>&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># flickr api function we want.<br />
</span>&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># takes an array of arguments<br />
</span>&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># example: to call the flickr.people.findByEmail service<br />
</span>&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># $flickr = OverkillFlickr::instance(&quot;my API key&quot;); // API key only needed on the first call<br />
</span>&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># $result = $flickr-&gt;people_findByEmail(array(&quot;find_email&quot; =&gt; &quot;my.pattern@domain.com&quot;));<br />
</span> &nbsp; &nbsp;<span style="color: #000000; font-weight: bold;">function</span> __call<span style="color: #009900;">&#40;</span><span style="color: #000088;">$method</span><span style="color: #339933;">,</span> <span style="color: #000088;">$arguments</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$method</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;_&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;.&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$method</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$argument</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$arguments</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$method</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$argument</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">||</span> <span style="color: #339933;">!</span><span style="color: #990000;">is_array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$argument</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$params</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_merge</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$params</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$argument</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$params</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'api_key'</span><span style="color: #009900;">&#93;</span> &nbsp;<span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">API</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$params</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'method'</span><span style="color: #009900;">&#93;</span> &nbsp; <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;flickr.&quot;</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$method</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$params</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'format'</span><span style="color: #009900;">&#93;</span> &nbsp; <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;php_serial&quot;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$encoded_params</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$params</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$k</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$encoded_params</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$k</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'='</span><span style="color: #339933;">.</span><span style="color: #990000;">urlencode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$v</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;"># call the API and decode the response<br />
</span> &nbsp; &nbsp; &nbsp;<span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;http://api.flickr.com/services/rest/?&quot;</span><span style="color: #339933;">.</span><span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&amp;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$encoded_params</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$rsp</span> <span style="color: #339933;">=</span> <span style="color: #990000;">file_get_contents</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #000088;">$rsp_obj</span> <span style="color: #339933;">=</span> <span style="color: #990000;">unserialize</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$rsp</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
&nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">#<br />
</span> &nbsp; &nbsp; &nbsp;<span style="color: #666666; font-style: italic;"># return the response from flickr<br />
</span> &nbsp; &nbsp; &nbsp;<span style="color: #666666; font-style: italic;">#<br />
</span> &nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">return</span> <span style="color: #000088;">$rsp_obj</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<br />
&nbsp; <span style="color: #009900;">&#125;</span></div></div>
<p>I suggest that you add some caching of the results you get from Flickr if you don&#8217;t want to hammer their servers too much.</p>
]]></content:encoded>
			<wfw:commentRss>http://foobar.lu/wp/2007/07/09/overkillflickr-a-flickr-api-interface-for-php5/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

