<?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>GS Design &#187; phpclasses</title>
	<atom:link href="http://www.gsdesign.ro/blog/category/projects/phpclasses/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gsdesign.ro/blog</link>
	<description>Just another developer blog</description>
	<lastBuildDate>Fri, 23 Jul 2010 07:33:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>[phpclass] dinamicParams &#8211; Calling function with named params</title>
		<link>http://www.gsdesign.ro/blog/phpclass-dinamicparams-calling-function-with-named-params/</link>
		<comments>http://www.gsdesign.ro/blog/phpclass-dinamicparams-calling-function-with-named-params/#comments</comments>
		<pubDate>Sun, 23 Nov 2008 15:17:49 +0000</pubDate>
		<dc:creator>Gabi Solomon</dc:creator>
				<category><![CDATA[phpclasses]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[php classes]]></category>
		<category><![CDATA[php5]]></category>
		<category><![CDATA[reflection]]></category>

		<guid isPermaLink="false">http://www.gsdesign.ro/blog/?p=258</guid>
		<description><![CDATA[A lot of time while developing a function or a method of a class you need to specify 1, 2 or 3 parameters as inputs for that function or method. But usually as you develop further you might end-up in the situation where you would want to add a new parameter to your function. And [...]]]></description>
			<content:encoded><![CDATA[<p>A lot of time while developing a function or a method of a class you need to specify 1, 2 or 3 parameters as inputs for that function or method. But usually as you develop further you might end-up in the situation where you would want to add a new parameter to your function. </p>
<p>And so you might have coded a function that has 5 or more parameters, and although it works fine, eventually you will want to call that function and leave the first 4 parameters with the default value and only change the last one. I ended up here a lot of times, and normally in php there is nothing you can do.</p>
<p>A workaround would be to specify the params as a single array variable, but that is just making you write more code and it looks really bad ( at least in my opinion).</p>
<p>Well today i found a new method of doing this in php5 with the help of the <a href="http://www.php.net/reflection">Reflection API</a> that is offer in php5. I will not get into to much details about what it does, you can read that in the documentation, basicly it provides a way to reverse-engineer classes, interfaces, functions and methods.</p>
<p>So i wrote a simple class that is going to solve that problem.</p>
<p>With the help of the Reflection API from php5 the class will allow you to call function and methods by providing the parameters as an array specifying names and values even if the original function or methods receives them in the normal fashion.</p>
<p>But enough talk, heres the example.</p>
<div class="igBar"><span id="lphp-2"><a href="#" onclick="javascript:showCodeTxt('php-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-2">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">&lt;?php</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">require</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'dinamicParams.class.php'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">class</span> news <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#000000; font-weight:bold;">function</span> fetch <span style="color:#006600; font-weight:bold;">&#40;</span> <span style="color:#0000FF;">$id</span>, <span style="color:#0000FF;">$page</span> = <span style="color:#CC66CC;color:#800000;">0</span>, <span style="color:#0000FF;">$items_pp</span> = <span style="color:#CC66CC;color:#800000;">10</span>, <span style="color:#0000FF;">$order_by</span> = <span style="color:#FF0000;">'date'</span>, <span style="color:#0000FF;">$method</span> = <span style="color:#FF0000;">'desc'</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; &nbsp; &nbsp; <a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; id: $id,</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; page: $page,</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; items_pp: $items_pp,</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; order_by: $order_by,</span></div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; method: $method</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF0000;">&nbsp; &nbsp; &nbsp; &nbsp; "</span>;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; &nbsp; <span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$news</span> = <span style="color:#000000; font-weight:bold;">new</span> news<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$dinamicParams</span> = <span style="color:#000000; font-weight:bold;">new</span> dinamicParams<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-weight: bold;color:IG_LINE_COLOUR_2;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:IG_LINE_COLOUR_1;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$dinamicParams</span>-&gt;<span style="color:#006600;">call</span><span style="color:#006600; font-weight:bold;">&#40;</span><a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$news</span>, <span style="color:#FF0000;">'fetch'</span><span style="color:#006600; font-weight:bold;">&#41;</span>, <a href="http://www.php.net/array"><span style="color:#000066;">array</span></a><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'order_by'</span> =&gt; <span style="color:#FF0000;">'name'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>This will output :</p>
<blockquote><p>
id: , page: 0, items_pp: 10, order_by: name, method: desc
</p></blockquote>
<p>This class is based on <a href="http://loveandtheft.org/2008/03/23/reflection-calling-methodsfunctions-with-named-arguments/">this implementation</a> of the reflection API.<br />
It is available on <a href="http://solomongaby.users.phpclasses.org/">phpclasses</a> can be downloaded <a href="http://solomongaby.users.phpclasses.org/browse/package/4986.html">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.gsdesign.ro/blog/phpclass-dinamicparams-calling-function-with-named-params/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Want to build an application to update all major social services ?</title>
		<link>http://www.gsdesign.ro/blog/want-to-build-an-application-to-update-all-major-social-services/</link>
		<comments>http://www.gsdesign.ro/blog/want-to-build-an-application-to-update-all-major-social-services/#comments</comments>
		<pubDate>Thu, 24 Jul 2008 18:43:45 +0000</pubDate>
		<dc:creator>Gabi Solomon</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Programing]]></category>
		<category><![CDATA[Web Aplications]]></category>
		<category><![CDATA[phpclasses]]></category>
		<category><![CDATA[classes]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[ping.fm]]></category>
		<category><![CDATA[social networks]]></category>

		<guid isPermaLink="false">http://www.gsdesign.ro/blog/?p=117</guid>
		<description><![CDATA[As social networks seem to get bigger and bigger and new ways of online communication spring up, people get more and more caught up into updating their accounts on various networks. So wheres there's a need there's an application . As i was talking a few days ago a new service has been borne a [...]]]></description>
			<content:encoded><![CDATA[<p>As social networks seem to get bigger and bigger and new ways of online communication spring up, people get more and more caught up into updating their accounts on various networks.</p>
<p>So wheres there's a need there's an application <img src='http://www.gsdesign.ro/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> . </p>
<p>As i was <a href="http://www.gsdesign.ro/blog/how-to-update-social-networks-like-twitter-jaiku-facebook-tumblr-and-pownce-at-once/">talking</a> a few days ago a new service has been borne a few months ago called <a href="http://ping.fm/">ping.fm</a> that allows users to update their services all from one place. Well today i stumble upon a class on <a href="http://solomongaby.users.phpclasses.org/">phpclasses.org</a> called 	<a href="http://solomongaby.users.phpclasses.org/browse/package/4647.html">Ping.FM Wrapper</a>  that  can be used to update multiple social networks using the Ping.FM API.</p>
<p>It accesses the Ping.FM Web services API server and can perform several operations to update social networks of a given user. It can for instance post messages or the user status, retrieve received messages, etc..</p>
<p>I guess this will make the life of developers required to do an application that will update social networks a whole lot easyer. <img src='http://www.gsdesign.ro/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Cheers</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gsdesign.ro/blog/want-to-build-an-application-to-update-all-major-social-services/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Google Translate Tool Class v0.9</title>
		<link>http://www.gsdesign.ro/blog/google-translate-tool-class-v09/</link>
		<comments>http://www.gsdesign.ro/blog/google-translate-tool-class-v09/#comments</comments>
		<pubDate>Wed, 09 Jul 2008 21:48:33 +0000</pubDate>
		<dc:creator>Gabi Solomon</dc:creator>
				<category><![CDATA[Google Translate Tool]]></category>
		<category><![CDATA[phpclasses]]></category>
		<category><![CDATA[projects]]></category>
		<category><![CDATA[class]]></category>
		<category><![CDATA[google]]></category>
		<category><![CDATA[oop]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[translate]]></category>

		<guid isPermaLink="false">http://www.gsdesign.ro/blog/?p=90</guid>
		<description><![CDATA[As almost all of my classes i have developed this class for a project requirement, and i decided to make it public on phpclasses.com that is available for download at this link. This is quite a simple class can translate text, and webpages using Google translate services. The class usses curl to make a tranlation [...]]]></description>
			<content:encoded><![CDATA[<p>As almost all of my classes i have developed this class for a project requirement, and i decided to make it public on <a href="http://solomongaby.users.phpclasses.org/">phpclasses.com </a> that is available for download at this <a href="http://solomongaby.users.phpclasses.org/browse/package/4691.html">link.</a></p>
<p>This is quite a simple class can translate text, and webpages using Google translate services.</p>
<p>The class usses curl to make a tranlation request to the Google translate Web page and asking for the translation of the given text or URL from the selected from and to languages. The result is parsed to obtain the translation and returned by the class.</p>
<p>The translation class supports all the languages currently available at google including:<br />
English, German, Spanish, French, Italian, Portuguese, Arabic, Chinese and Russian.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gsdesign.ro/blog/google-translate-tool-class-v09/feed/</wfw:commentRss>
		<slash:comments>34</slash:comments>
		</item>
	</channel>
</rss>
