<?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>Web Sites for Small Businesses</title>
	<atom:link href="http://softconsultant.ro/feed/" rel="self" type="application/rss+xml" />
	<link>http://softconsultant.ro</link>
	<description>Quickly setup your web-sites</description>
	<lastBuildDate>Sun, 27 Nov 2011 09:34:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Pretty debug for PHP &#8211; pdebug() and pdie()</title>
		<link>http://softconsultant.ro/2011/11/27/pretty-debug-for-php-pdebug-and-pdie/</link>
		<comments>http://softconsultant.ro/2011/11/27/pretty-debug-for-php-pdebug-and-pdie/#comments</comments>
		<pubDate>Sun, 27 Nov 2011 09:32:32 +0000</pubDate>
		<dc:creator>Ilie P.</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[debug]]></category>
		<category><![CDATA[die]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[web dev]]></category>

		<guid isPermaLink="false">http://softconsultant.ro/?p=163</guid>
		<description><![CDATA[Overview <p>I like pretty things! And I believe that pretty debug messages can go a long way in speeding up finding and fixing the problem.</p> <p>So without further ado here is what pdebug() and pdie() output looks like:</p> <p></p> How to use <p>The function names are self explanatory. All you have to do is include [...]]]></description>
			<content:encoded><![CDATA[<h2>Overview</h2>
<p>I like pretty things! And I believe that pretty debug messages can go a long way in speeding up finding and fixing the problem.</p>
<p>So without further ado here is what <em>pdebug()</em> and <em>pdie() </em>output looks like:</p>
<p><img src="http://softconsultant.ro/wp-content/uploads/2011/11/pdebug.jpg" alt="" title="pdebug() and pdie()" width="542" height="395" class="aligncenter size-full wp-image-164" /></p>
<h2>How to use</h2>
<p>The function names are self explanatory. All you have to do is include the &#8220;pdebug.php&#8221; file and then call the functions. <em>pdie()</em> will obviously terminate the process.</p>
<p>Both <em>pdebug()</em> and <em>pdie()</em> can output anything you give them as parameters. They even support the <em>sprintf()</em> format.</p>
<pre class="brush: php; title: ; notranslate">
//include the source file
require( &quot;pdebug.php&quot; );

//some test function
function test( ){
	pdebug( &quot;The value is: %d&quot;, 3 );
}

//testing the code
test();
pdie( &quot;Something is terribly WRONG!&quot; );
</pre>
<h2>Source Code</h2>
<p><a href='http://softconsultant.ro/wp-content/uploads/2011/11/pdebug.zip'>Download ZIP Archive</a></p>
]]></content:encoded>
			<wfw:commentRss>http://softconsultant.ro/2011/11/27/pretty-debug-for-php-pdebug-and-pdie/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful PHP File Logger &#8211; flog()</title>
		<link>http://softconsultant.ro/2011/11/27/useful-php-file-logger-flog/</link>
		<comments>http://softconsultant.ro/2011/11/27/useful-php-file-logger-flog/#comments</comments>
		<pubDate>Sun, 27 Nov 2011 08:18:47 +0000</pubDate>
		<dc:creator>Ilie P.</dc:creator>
				<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://softconsultant.ro/?p=146</guid>
		<description><![CDATA[Overview of flog() <p>When writing PHP code, that will be included in other people&#8217;s code (like plugins, widgets, callbacks, or callback pages), debugging is usually done with log files. This way you will not break the page structure and you can output stuff to your hearts content.</p> <p>The simple <a href="http://php.net/manual/en/function.error-log.php" target="_blank">error_log()</a> that PHP provides, [...]]]></description>
			<content:encoded><![CDATA[<h2>Overview of flog()</h2>
<p>When writing PHP code, that will be included in other people&#8217;s code (like plugins, widgets, callbacks, or callback pages), debugging is usually done with log files. This way you will not break the page structure and you can output stuff to your hearts content.</p>
<p>The simple <em><a href="http://php.net/manual/en/function.error-log.php" target="_blank">error_log()</a></em> that PHP provides, is not helpful enough in most of the cases, because it does not automatically log the context of where the function was called. If for example you have multiple <em>if</em> branches in your code and you just want to check what branches are followed, you would need to log a  unique message in each branch.</p>
<p>When writing code, coming up with unique log messages is not the best way to spend your creativity and you end up with things like &#8220;crap&#8221;, &#8220;wft!?!&#8221;, &#8220;jeez&#8221;, &#8220;crap2&#8243; and so on&#8230;</p>
<p>With the <em>flog()</em> function a simple call to flog(), with no parameters, will write enough data in the log file so you can determine exactly where that log comes from. <em>It&#8217;s all about context.</em></p>
<h2>Features</h2>
<p>Here is what <em>flog()</em> can do for you:</p>
<ul>
<li>log the file name and line in that file where the function was called</li>
<li>log the stack trace</li>
<li>log the time stamp</li>
<li>it can print objects, arrays, simple strings and even support the <em>sprintf()</em> formats.</li>
<li>can be called with no parameters, just to leave a &#8220;trace&#8221; in the log file</li>
<li>auto indents multi-line logs for easy reading. For example objects and arrays.</li>
<li>can be configured to automatically disable itself when script runs on live server</li>
</ul>
<h2>How to use it</h2>
<p>To use <em>flog()</em> you just have to include (include/require) the &#8220;flog.php&#8221; file and then just do <em>flog()</em> calls.</p>
<p>Below are some examples:</p>
<pre class="brush: php; title: ; notranslate">
//do your config - OPTIONAL
define( &quot;FLOG_SHOW_STACK&quot;, true );
define( &quot;FLOG_CLEAR_LOG&quot;, true );

//include the source file
require( &quot;flog.php&quot; );

$obj = new stdclass();
$obj-&gt;a = array(
	&quot;p1&quot; =&gt; 10.0,
	&quot;p3&quot; =&gt; 10.0
	);
$array = array( &quot;option1&quot;, &quot;option2&quot; );

//example of different calls
flog( );
flog( $obj );
flog( $array );
flog( &quot;Value for text is: %5.2f %s.&quot;, 11.113, &quot;BOO!&quot; );
</pre>
<h2>Configuration Flags</h2>
<p>The function is pre-configured to work well out of the box, but you can still customize it, if you wish.</p>
<p>Configuration is done with &#8220;define&#8221;, defining true/false values for most flags and some string values for others.</p>
<p>Available configuration flags:</p>
<ul>
<li>FLOG_IGNORE &#8211; set to <em>true</em> to disable flog() (default is <em>false</em>)</li>
<li>FLOG_SHOW_TIME &#8211; <em>true</em> shows time stamp in logs (default is <em>true</em>)</li>
<li>FLOG_SHOW_STACK &#8211; <em>true</em> shows call stack in logs (default is <em>false</em>)</li>
<li>FLOG_CLEAR_LOG &#8211; when <em>true</em> the log file gets cleared at every page loag (default is <em>false</em>)</li>
<li>FLOG_STRIP_PATH &#8211; the string you define here will be removed from the script file name, making the log line much shorter. This should be set to your web root. (default is your web-root)</li>
<li>FLOG_ONLINE_SERVER &#8211; if you set here the name of your production server, flog will disable itself on that server. (default is &#8220;softconsultant.ro&#8221;)</li>
<li>FLOG_FILE_NAME &#8211; the name of the log file (default is &#8220;flog.log&#8221;)</li>
</ul>
<p>Log file location is always in the same folder as the &#8220;flog.php&#8221; file.</p>
<h2>Source code</h2>
<p><a href="http://softconsultant.ro/wp-content/uploads/2011/11/flog.zip">Download Source Code</a></p>
]]></content:encoded>
			<wfw:commentRss>http://softconsultant.ro/2011/11/27/useful-php-file-logger-flog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Free PHP PayPal Tool Box</title>
		<link>http://softconsultant.ro/2011/11/25/free-php-paypal-tool-box/</link>
		<comments>http://softconsultant.ro/2011/11/25/free-php-paypal-tool-box/#comments</comments>
		<pubDate>Fri, 25 Nov 2011 21:38:54 +0000</pubDate>
		<dc:creator>Ilie P.</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[ipn]]></category>
		<category><![CDATA[paypal]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://softconsultant.ro/?p=89</guid>
		<description><![CDATA[What is this? <p>PHP PayPal Tools Box is a PHP class that you can use to:</p> generate PayPal Donation button generate PayPal Recurring Donation button generate PayPal payment forms validate the IPN (Instant Payment Notifications) <p>The Class also has a simple way to prevent tampering with the items price. This class requires PHP&#160;5.</p> View Demo [...]]]></description>
			<content:encoded><![CDATA[<h2><img class="alignleft size-full wp-image-133" title="paypal_toolbox_logo" src="http://softconsultant.ro/wp-content/uploads/2011/11/paypal_toolbox_logo.jpg" alt="" width="132" height="163" />What is this?</h2>
<p>PHP PayPal Tools Box is a PHP class that you can use to:</p>
<ul>
<li>generate PayPal Donation button</li>
<li>generate PayPal Recurring Donation button</li>
<li>generate PayPal payment forms</li>
<li>validate the IPN (Instant Payment Notifications)</li>
</ul>
<p>The Class also has a simple way to prevent tampering with the items price. This class requires PHP&nbsp;5.</p>
<h2>View Demo</h2>
<p>Follow the link for a small demo of the forms. <a href="/demos/paypaltoolbox/">View Demo.</a><br />
<a href="/demos/paypaltoolbox/" target="_blank"><img src="http://softconsultant.ro/wp-content/uploads/2011/11/demo-300x111.jpg" alt="PHP PayPal Tool Box Demo" title="PHP PayPal Tool Box Demo" width="300" height="111" class="aligncenter size-medium wp-image-137" /></a></p>
<h2>Short history</h2>
<p>Lately I&#8217;ve spent a lot of time integrating PayPal into different websites that use Joomla or WordPress or even custom made code. For what I needed, the already available plugins where not enough, so I always ended up writing code. Therefore I decided to create a PHP class to handle the creation of the PayPal form and the handling of Instant Payment Notification without too much hassle.</p>
<h2>Create a PayPal payment HTML form</h2>
<p><strong>Step1.</strong> Include the &#8220;paypaltoolbox.php&#8221; file where the main class is.</p>
<p><strong>Step2.</strong> Instantiate the class giving as parameters your PayPal account, if you want to use the sand box and the URL that should be used for IPN (Instant Payment Notifications).</p>
<p><strong>Step3.</strong> Prepare your list of items and their price and optionally a unique invoice id.</p>
<p><strong>Step4.</strong> Generate and output the PayPal forum with the Buy Now button</p>
<pre class="brush: php; title: ; notranslate">
//include the required file
require ( dirname( __FILE__ ) . &quot;/&quot; . &quot;paypaltoolbox.php&quot; );

//instantiate the Class( paypal_email, test_mode, options_array )
$pp =  &amp;new PayPalToolBox( &quot;johndow&quot;.&quot;@&quot;.&quot;example.com&quot;, false, array (
        &quot;notify_url&quot; =&gt; &quot;http://example.com/paypal/ipn_process.php&quot; )
	);

//setup the items you need to sell and a unique invoice id to track this
//transatiocn
$items = array( &quot;My Super Product&quot; =&gt; &quot;49.00&quot; );
$invoice_id  = 12345; //should be unique number

//display the HTML form with the PayPal button
echo $pp-&gt;getHtmlForm( $items, array( &quot;invoice_id&quot; =&gt;  $invoice_id ) );
</pre>
<h2>Validate and take action on IPN</h2>
<p>Validating the IPN from PayPal is done with a simple method call.</p>
<p>In your file that will process the IPNs you have to include the PHP class, instantiate it and then call the <em>validateIPN()</em> method. This method returns true if the IPN is a valid one and if the form data was not tampered with!</p>
<p>In case of validation failure use the <em>getValidationError()</em> method to get an explicative text message.</p>
<pre class="brush: php; title: ; notranslate">
//include the class file
require( dirname( __FILE__) . &quot;/&quot; . &quot;paypaltoolbox.php&quot; );

//instantiate the class
$pp = &amp;new PayPalToolBox();

//validating the IPN is a simple method call
if( $pp-&gt;validateIPN() ){
	//TODO: Add here code to handle a IPN Success
	//$_POST[&quot;invoice&quot;] will have you uniquite invoice_id
}else{
	$error = $pp-&gt;getValidationError();
	//TODO: Add here code to handle a IPN Falure
}
</pre>
<h2>Generate PayPal Donation Buttons</h2>
<p>After you instantiate the <em>PayPalToolBox</em> class all you have to do is call the <em>getDonationButton()</em> method.</p>
<pre class="brush: php; title: ; notranslate">
//instantiate the Class( paypal_email, test_mode, options_array )
$pp =  &amp;new PayPalToolBox( &quot;johndow&quot;.&quot;@&quot;.&quot;example.com&quot;, $test_mode, array (
        &quot;notify_url&quot; =&gt; &quot;http://example.com/paypal/ipn_process.php&quot; )
	);
//generate and output a donation button
echo $pp-&gt;getDonationButton();
</pre>
<p><a href='/demos/paypaltoolbox/'>View Demo</a></p>
<h2>Generate PayPal Recurring Donation Buttons</h2>
<p>OK, I admit PayPal does not support recurring donations. However! You can setup a recurring payment and present that as a recurring donation on your web site. And you can do that with PayPal using subscriptions. So basically the visitor agrees to send you a monthly payment, and you can can consider that as a monthly Donation.</p>
<p>Here is how to do it (of course you need to include the proper files first):</p>
<pre class="brush: php; title: ; notranslate">
//instantiate the Class( paypal_email, test_mode, options_array )
$pp =  &amp;new PayPalToolBox( &quot;johndow&quot;.&quot;@&quot;.&quot;example.com&quot;, $test_mode, array (
        &quot;notify_url&quot; =&gt; &quot;http://example.com/paypal/ipn_process.php&quot; )
	);
//generate and output a recurring donation button for $50.00
echo $pp-&gt;getRecurringDonationForm( 50.00 );
</pre>
<p>You can also present a <em>select box</em> for the visitor to select the amount they would like to donate monthly. Use the same <em>getRecurringDonationForm()</em> but as the first parameter set an array with the labels and donations amounts, as in the example below:</p>
<pre class="brush: php; title: ; notranslate">
//instantiate the Class( paypal_email, test_mode, options_array )
$pp =  &amp;new PayPalToolBox( &quot;john&quot;.&quot;@&quot;.&quot;example.com&quot;, $test_mode, array (
        &quot;notify_url&quot; =&gt; &quot;http://example.com/paypal/ipn_process.php&quot; )
	);
//generate and output a recurring donation button that allows
//the visitor to select the amount from a given list
echo $pp-&gt;getRecurringDonationForm( array(
        &quot;Donate $1&quot; =&gt; 1.00,
        &quot;Donate $10&quot; =&gt; 10.00,
        &quot;Donate $100&quot; =&gt; 100.00
) );
</pre>
<p>See this in action: <a href='/demos/paypaltoolbox/' target='_blank'>view demos</a></p>
<h2>Features</h2>
<ul>
<li>Can generate Donation buttons</li>
<li>Can generate PayPal payments forms</li>
<li>Easy validation of IPNs</li>
<li>This class will sign the form data to make sure users do not tamper with the price or the currency</li>
<li>Is JavaScript ready. You can configure it to hide the submit button and so create a completely hidden form that you can submit with JavaScript (using jQuery, mootools or something like that). You can even set your custom HTML id for the form if the default one (&#8220;<em>paypal_toolbox_form</em>&#8220;) is not suitable for you.</li>
<li>Has support for PayPal sandbox so you can do your tests before going live.</li>
<li>Being a class can be easily integrated without danger of names collision in your PHP code.</li>
<li>If you miss configure it, or forget to add required configuration, the class will complain about it with a clear message.</li>
<li>It supports an array of options allowing you to customize every aspect of the form: form id, IPN notify URL, currency, button image, show/hide the submit button.</li>
</ul>
<p><a href="/demos/paypaltoolbox/">View Demo.</a></p>
<h2>What this is not</h2>
<p>This is NOT a shopping cart. This is just a payment gateway. This means that once you have your items collected, you can use this class to place an order with PayPal and then validate and process the IPN.</p>
<h2>How to create a hidden form for JavaScript</h2>
<p>To create a hidden form that you can submit from JavaScript (using jQuery, mootool or other libraries), you just have to tell this class not to draw a submit button.</p>
<p>You do that by setting the flag <em>show_submit</em> to <em>false</em>. And you should also provide a unique HTML id. See below:</p>
<pre class="brush: php; title: ; notranslate">
//generate a hidden form to be submitted with JavaScript
echo $pp-&gt;getHtmlForm( $items, array(
		&quot;invoice_id&quot; =&gt; $invoice_id,
		&quot;form_id&quot; =&gt; &quot;my_form_id&quot;,
		&quot;show_submit&quot; =&gt; false
		));
</pre>
<p>Then you just have to do something similar to this:</p>
<pre class="brush: xml; title: ; notranslate">
&lt;a href=&quot;javascript:void(0);&quot;
   onclick='document.getElementById(&quot;my_form_id&quot;).submit();'&gt;Click me&lt;/a&gt;
</pre>
<h2>Integrations</h2>
<p>At the moment of writing the class comes stand alone, but it can easily be integrated into a WordPress Plugin, or Joomla! extension, or simply in your PHP application. In the future I plan to write some simple integrations for WordPress and Joomla!</p>
<h2>Download</h2>
<p>Download the <a href="http://softconsultant.ro/wp-content/uploads/2011/11/paypaltoolbox.zip">ZIP archive</a>. It contains a few examples to get you started.</p>
<h2>Requirements</h2>
<p>This requires PHP 5.</p>
<h2>Support</h2>
<p>If you have questions or need help on how to use this Class, either <a title="Contact" href="http://softconsultant.ro/contact/" target="_blank">contact </a>me or comment on this post.</p>
<h2>Licence</h2>
<p>This code is free to use as long as you leave my name in the PHP comments and the links back to this site. Also this code is offered to you as is with absolutely no warranty. Please do you own testing.</p>
]]></content:encoded>
			<wfw:commentRss>http://softconsultant.ro/2011/11/25/free-php-paypal-tool-box/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Advanced Features</title>
		<link>http://softconsultant.ro/2011/08/14/advanced-features/</link>
		<comments>http://softconsultant.ro/2011/08/14/advanced-features/#comments</comments>
		<pubDate>Sun, 14 Aug 2011 19:33:34 +0000</pubDate>
		<dc:creator>Ilie P.</dc:creator>
				<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://softconsultant.ro/?p=83</guid>
		<description><![CDATA[<p>If you are looking for something more advanced and complex, or a new set of features for your website, I am confident that I can help.</p> <p>The features can vary from customizing frameworks such as Joomla, WordPress and vBulletin forum to creating small and medium web-applications from scratch using rapid development tools such as CakePHP.</p> [...]]]></description>
			<content:encoded><![CDATA[<p>If you are looking for something more advanced and complex, or a new set of features for your website, I am confident that I can help.</p>
<p>The features can vary from customizing frameworks such as Joomla, WordPress and vBulletin forum to creating small and medium web-applications from scratch using rapid development tools such as CakePHP.</p>
<p>Please find below a list of technologies that I know very well. And if you need help with any of those don’t hesitate to <a title="Click to contact me" href="http://softconsultant.ro/contact/" target="_blank">contact me</a>.</p>
<p><strong>Frameworks and Web Applications:</strong></p>
<ul>
<li>WordPress (blog manager )</li>
<li>Joomla (content management systems)</li>
<li>phpBB (forum)</li>
<li>vBulletin (forum)</li>
<li>CachePHP (rapid application development framework)</li>
<li>osCommerce (online store)</li>
<li>plugins and add ons for all the above</li>
<li>PayPal integrations</li>
<li>custom shopping carts</li>
</ul>
<p><strong>Email management</strong></p>
<ul>
<li>Setting up auto responders</li>
<li>Newsletters</li>
<li>moving your email to GMail</li>
<li>email notifications</li>
</ul>
<p><strong>Web developer Languages and standards:</strong></p>
<ul>
<li>PHP (Apache+PHP+MySQL setup)</li>
<li>Java Script</li>
<li>HTML</li>
<li>CSS</li>
</ul>
<p><strong>Server Administration</strong></p>
<ul>
<li>Linux Server Administration</li>
<li>Apace</li>
<li>MySQL</li>
<li>Setting up recurrent backups</li>
<li>tighten server security</li>
<li>move web sites to another server</li>
<li>data migration (import and export)</li>
<li>log managers and parsers</li>
<li>usage statics</li>
<li>server load monitors</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://softconsultant.ro/2011/08/14/advanced-features/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

