<?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>www.nerdscene.com &#187; PHP script</title>
	<atom:link href="http://www.nerdscene.com/tag/php-script/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nerdscene.com</link>
	<description>bitching about everything, one post at a time...</description>
	<lastBuildDate>Tue, 06 Apr 2010 17:40:42 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>EasyPayPal WordPress plugin fix</title>
		<link>http://www.nerdscene.com/2008/02/11/26/</link>
		<comments>http://www.nerdscene.com/2008/02/11/26/#comments</comments>
		<pubDate>Tue, 12 Feb 2008 02:31:01 +0000</pubDate>
		<dc:creator>Eli Sand</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[EasyPayPal]]></category>
		<category><![CDATA[PayPal]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP script]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress plugin]]></category>

		<guid isPermaLink="false">http://www.elisand.com/archives/41</guid>
		<description><![CDATA[This is just a small nerd post for those of you who may be trying to use the beta 3.0 series of EasyPayPal for WordPress. The script has a very common bug in it that shows up if you don&#8217;t configure any categories to be hidden unless purchased in the options. The fix is very [...]]]></description>
			<content:encoded><![CDATA[<p>This is just a small nerd post for those of you who may be trying to use the beta 3.0 series of EasyPayPal for WordPress.  The script has a very common bug in it that shows up if you don&#8217;t configure any categories to be hidden unless purchased in the options.   The fix is very simple and I&#8217;m rather amazed it hasn&#8217;t been committed yet.  All that has to be done is to initialize the $cats variable to an empty array since the variable is only created inside a conditional (bad coding!).<br />
<span id="more-26"></span><br />
Anyways, here&#8217;s a patch you can apply to fix the bug:</p>
<p><code>--- easypaypal.php    2008-02-11 21:24:24.000000000 -0500<br />
+++ easypaypal.php    2008-02-11 21:23:39.000000000 -0500<br />
@@ -211,6 +211,7 @@</code><br />
<code><br />
if(!EasyPayPal_BypassCheck())<br />
{<br />
+             $cats = array();<br />
$post_ID = $post-&gt;ID;</code><br />
<code><br />
$temp = get_option("easypaypal_categories");</code></p>
<p>Just copy this in to a file and use <code>patch -p0 &lt; file</code> to apply the patch &#8211; or just find line 211 and add in the line indicated with the + symbol.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nerdscene.com/2008/02/11/26/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>With boredom comes php_template v2.9.2</title>
		<link>http://www.nerdscene.com/2007/04/24/22/</link>
		<comments>http://www.nerdscene.com/2007/04/24/22/#comments</comments>
		<pubDate>Wed, 25 Apr 2007 00:45:40 +0000</pubDate>
		<dc:creator>Eli Sand</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP plugin]]></category>
		<category><![CDATA[PHP Program]]></category>
		<category><![CDATA[PHP script]]></category>
		<category><![CDATA[php_template]]></category>
		<category><![CDATA[SVN]]></category>
		<category><![CDATA[Visual C++]]></category>

		<guid isPermaLink="false">http://www.hoktar.com/archives/37</guid>
		<description><![CDATA[It&#8217;s been a very, very long time since I last touched php_template and just out of the blue today I decided I&#8217;d finally get off my ass and create a Visual C++ project out of it so I could compile it for Windows users. Well, after several hours of tinkering and encountering PHP source code [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s been a very, very long time since I last touched php_template and just out of the blue today I decided I&#8217;d finally get off my ass and create a Visual C++ project out of it so I could compile it for Windows users.</p>
<p>Well, after several hours of tinkering and encountering PHP source code <a href="http://bugs.php.net/bug.php?id=39130">&#8220;bugs&#8221;</a>, I finally got it to compile.  I had to do a few fixes too apparently &#8211; I was missing some TSRM junk to the parse_tag() function (and I believe that&#8217;s because it passes a zval around, so it needs the thread-safe stuff with it), and I had some calls to strlen() which needed to be explicitly cast to avoid warnings.  This got rid of some of the compile-time warnings (there are still warnings about strcat() and cousins being used, but I&#8217;m smart and know how to use them properly) generated by VC++ 2005 and popped out a tasty php_template.dll for PHP 5.2.1.<br />
<span id="more-22"></span><br />
The VC++ project files are now included in the official releases of php_template (along with a pre-compiled version of php_template.dll) so that all of you lovely folks out there can compile your own versions too.  Compiling it isn&#8217;t too tough &#8211; grab the free version of VC++ 2005 (Express), the Microsoft Platform SDK which has the headers and such required to compile, PHP source code and a package from PHP as well called &#8220;bindlib_w32&#8243; which contains some additional header files.  Throw the bindlib_w32 directory in to the root of the PHP directory, and the php_template directory in to the ext directory in PHP.  Load up the VC++ solution file (.sln) and build it &#8211; that&#8217;s it!</p>
<p>I&#8217;ve also finally put the code in to an SVN repository on my local home server so I can keep track of the working trunk code, and some branched code which was supposed to be better but suffers from memory leaks &#8211; I may not end up using it, but kept it for the ideas it involved.  I think I might instead look towards using a lexer as the parser engine as it should provide much more flexibility in the language structure, however I&#8217;d really have to pay attention to potential speed losses due to lexers being naturally slow parsers in some cases.</p>
<p>You can get your shiny new copy from the downloads section &#8211; more specifically, right <a href="http://www.elisand.com/downloads/programs/php_template-2.9.2.tar.gz">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nerdscene.com/2007/04/24/22/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A few useful tidbits of PHP</title>
		<link>http://www.nerdscene.com/2007/03/07/12/</link>
		<comments>http://www.nerdscene.com/2007/03/07/12/#comments</comments>
		<pubDate>Wed, 07 Mar 2007 20:20:01 +0000</pubDate>
		<dc:creator>Eli Sand</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[PHP script]]></category>

		<guid isPermaLink="false">http://www.hoktar.com/archives/11</guid>
		<description><![CDATA[I was fooling around with some stuff when I noticed one of the scripts I was trying to use had some hard-coded paths in it meaning I couldn&#8217;t rename it&#8217;s base directory (which really wasn&#8217;t a good name to begin with). Anyways, I thought I&#8217;d post a few simple things every PHP programmer can add [...]]]></description>
			<content:encoded><![CDATA[<p>I was fooling around with some stuff when I noticed one of the scripts I was trying to use had some hard-coded paths in it meaning I couldn&#8217;t rename it&#8217;s base directory (which really wasn&#8217;t a good name to begin with).  Anyways, I thought I&#8217;d post a few simple things every PHP programmer can add to their repository of useful junk which may help them deal with using relative paths to include files in both their PHP scripts and any HTML pages that need relative source paths too.<br />
<span id="more-12"></span><br />
First, one of the most useful things you may come across is simply adding this one line and then using __PATH__ in your code where you need it:</p>
<p><code>define('__PATH__', dirname(__FILE__));</code></p>
<p>This gives you a new constant, __PATH__, which will be the full directory part of __FILE__.  This saves you writing dirname(__FILE__) all over the place since you will no doubt end up using that if you use any sort of relative path include system.  Oh and yes I know it&#8217;s &#8220;bad practice&#8221; to define something like __PATH__, but the nice part is that if PHP ever does implement that constant &#8211; it should be what we have it as right now, so you just remove the define() statement and be on your merry way.</p>
<p>The second useful thing to add is a function which helps you in crafting relative URLs (though I&#8217;m sure it can be used elsewhere too):</p>
<p><code>function basepath($source, $search = '') {<br />
$source = strtr($source, DIRECTORY_SEPARATOR, '/');<br />
return substr($source, strpos($source, $search) + strlen($search));<br />
}</code></p>
<p>You pass the function a path to a file and a string to search for in that path.  If it finds the search string, it removes it and everything before it in the path and returns what&#8217;s left.  So, say you called it as basepath(__FILE__, &#8216;/public_html/&#8217;) and __FILE__ was something like &#8216;/home/username/public_html/website/includes/file.php&#8217;, it would return &#8216;website/includes/file.php&#8217;.  Since you will no doubt know the name of a parent path somewhere a long the lines, you can use that to strip out what you already know (so in this case, the non-url portion of a URL for your site) and end up with a path a client browser can access.</p>
<p>I&#8217;ll leave it up to you to see how useful these may be and how you want to use them &#8211; but the purpose is to remind you to never hard code paths if you can avoid it &#8211; especially if it&#8217;s a 3rd party addon (like themes and plugins for WordPress, for example).</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nerdscene.com/2007/03/07/12/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

