<?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>Josh Stauffer&#187; PHP</title>
	<atom:link href="http://www.joshstauffer.com/tag/php/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.joshstauffer.com</link>
	<description>WordPress, Genesis, &#38; Things I Care About</description>
	<lastBuildDate>Sun, 11 Dec 2011 01:08:20 +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>Ternary Operators Anyone?</title>
		<link>http://www.joshstauffer.com/ternary-operators-anyone/</link>
		<comments>http://www.joshstauffer.com/ternary-operators-anyone/#comments</comments>
		<pubDate>Mon, 15 Nov 2010 00:51:43 +0000</pubDate>
		<dc:creator>Josh Stauffer</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.joshstauffer.com/?p=378</guid>
		<description><![CDATA[While reading through the WordPress Coding Standards, I read some good advice to follow when using ternary operators. To keep things from getting confusing when using ternary operators, always have the statements test for true instead of false. // (if statement is true) ? (do this) : (if false, do this); $basketballteam = ( 'lakers' [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.joshstauffer.com%2Fternary-operators-anyone%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.joshstauffer.com%2Fternary-operators-anyone%2F&amp;source=joshstauffer&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>While reading through the <a href="http://codex.wordpress.org/WordPress_Coding_Standards" target="_blank">WordPress Coding Standards</a>, I read some good advice to follow when using <a title="Ternary Operations" href="http://en.wikipedia.org/wiki/Ternary_operation" target="_blank">ternary</a> operators.</p>
<p>To keep things from getting confusing when using ternary operators, always have the statements test for true instead of false.</p>
<pre><code>// (if statement is true) ? (do this) : (if false, do this);
$basketballteam = ( 'lakers' == $team ) ? 'champions' : 'blah';</code></pre>
<p>In the example above, you&#8217;ll notice that the variable is on the right side of the comparison. This way, if an equal sign is omitted, a parse error will be thrown and execution will halt. If you can save one bug, do it. <img src='http://www.joshstauffer.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.joshstauffer.com/ternary-operators-anyone/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Search in File Contents in Windows</title>
		<link>http://www.joshstauffer.com/search-in-file-contents-in-windows/</link>
		<comments>http://www.joshstauffer.com/search-in-file-contents-in-windows/#comments</comments>
		<pubDate>Wed, 20 Oct 2010 04:30:35 +0000</pubDate>
		<dc:creator>Josh Stauffer</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.joshstauffer.com/?p=342</guid>
		<description><![CDATA[Problem By default, Windows will not search the contents of certain file types. This makes it very frustrating for anyone trying to locate the occurrence of words or phrases within a group of files. A Few Details First off, I am running Windows 7 and since I am a PHP developer, the solutions I provide [...]


Related posts:<ol><li><a href='http://www.joshstauffer.com/search-for-text-inside-of-php-files-with-vista/' rel='bookmark' title='Permanent Link: Search for Text Inside of PHP Files with Vista'>Search for Text Inside of PHP Files with Vista</a></li>
<li><a href='http://www.joshstauffer.com/open-links-in-new-windows/' rel='bookmark' title='Permanent Link: Open Links in New Windows'>Open Links in New Windows</a></li>
<li><a href='http://www.joshstauffer.com/see-websites-search-engine-result-for-a-specific-keyword/' rel='bookmark' title='Permanent Link: See Website&#8217;s Search Engine Result for a Specific Keyword'>See Website&#8217;s Search Engine Result for a Specific Keyword</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.joshstauffer.com%2Fsearch-in-file-contents-in-windows%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.joshstauffer.com%2Fsearch-in-file-contents-in-windows%2F&amp;source=joshstauffer&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<h2>Problem</h2>
<p>By default, Windows will not search the contents of certain file types. This makes it very frustrating for anyone trying to locate the occurrence of words or phrases within a group of files.</p>
<h2>A Few Details</h2>
<p>First off, I am running Windows 7 and since I am a PHP developer, the solutions I provide will allow you to search the file contents of PHP files. However, this should work for other file types that Windows has trouble searching within.</p>
<p>A while back, I solved this problem and was able to <a href="http://www.joshstauffer.com/search-for-text-inside-of-php-files-with-vista/">search for text inside of PHP files</a> but that was when I had Windows Search Indexing enabled.</p>
<p>Now, I&#8217;ve installed a fresh copy of Windows 7 and disabled Search Indexing in hopes of improving my system&#8217;s performance. To get this to work it requires you make a few minor changes to the Registry but please use caution when doing so. Incorrect changes to the Registry can cripple Windows.</p>
<h2>Solution</h2>
<ol>
<li>Press &#8216;WinKey + R&#8217; and type regedit then hit &#8216;Enter&#8217;.</li>
<li>Expand the &#8216;HKEY_CLASSES_ROOT&#8217; list and scroll down until you see &#8216;.php&#8217;.</li>
<li>Right click on &#8216;.php&#8217; and select New &gt;Key.</li>
<li>Rename the newly created key &#8216;PersistentHandler&#8217;.</li>
<li>With the &#8216;PersistentHandler&#8217; key selected, set the value of (Default) to<br />
&#8216;<code>{5E941D80-BF96-11CD-B579-08002B30BFEB}</code>&#8216; without the single quotes.</li>
<li>Exit out of the Registry.</li>
<li>Restart your computer.</li>
</ol>
<p>The end result will look something like this&#8230;</p>
<div id="attachment_343" class="wp-caption aligncenter" style="width: 610px"><img class="size-full wp-image-343" title="search-in-file-contents" src="http://www.joshstauffer.com/wp-content/uploads/2010/10/search-in-file-contents.gif" alt="" width="600" height="200" /><p class="wp-caption-text">Search in File Contents</p></div>
<p style="text-align: center;">


<p>Related posts:<ol><li><a href='http://www.joshstauffer.com/search-for-text-inside-of-php-files-with-vista/' rel='bookmark' title='Permanent Link: Search for Text Inside of PHP Files with Vista'>Search for Text Inside of PHP Files with Vista</a></li>
<li><a href='http://www.joshstauffer.com/open-links-in-new-windows/' rel='bookmark' title='Permanent Link: Open Links in New Windows'>Open Links in New Windows</a></li>
<li><a href='http://www.joshstauffer.com/see-websites-search-engine-result-for-a-specific-keyword/' rel='bookmark' title='Permanent Link: See Website&#8217;s Search Engine Result for a Specific Keyword'>See Website&#8217;s Search Engine Result for a Specific Keyword</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.joshstauffer.com/search-in-file-contents-in-windows/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to Disallow Direct Access to a File with PHP</title>
		<link>http://www.joshstauffer.com/how-to-disallow-direct-access-to-a-file-with-php/</link>
		<comments>http://www.joshstauffer.com/how-to-disallow-direct-access-to-a-file-with-php/#comments</comments>
		<pubDate>Thu, 06 Mar 2008 21:14:07 +0000</pubDate>
		<dc:creator>Josh Stauffer</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://www.joshstauffer.com/?p=170</guid>
		<description><![CDATA[Place this code at the top of your PHP script. if ( stristr( $_SERVER['SCRIPT_NAME'], basename( __FILE__ ) ) ) { exit( 'No direct script access allowed' ); } Related posts:Search in File Contents in Windows Search for Text Inside of PHP Files with Vista Get Post Slug in WordPress


Related posts:<ol><li><a href='http://www.joshstauffer.com/search-in-file-contents-in-windows/' rel='bookmark' title='Permanent Link: Search in File Contents in Windows'>Search in File Contents in Windows</a></li>
<li><a href='http://www.joshstauffer.com/search-for-text-inside-of-php-files-with-vista/' rel='bookmark' title='Permanent Link: Search for Text Inside of PHP Files with Vista'>Search for Text Inside of PHP Files with Vista</a></li>
<li><a href='http://www.joshstauffer.com/get-post-slug-in-wordpress/' rel='bookmark' title='Permanent Link: Get Post Slug in WordPress'>Get Post Slug in WordPress</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.joshstauffer.com%2Fhow-to-disallow-direct-access-to-a-file-with-php%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.joshstauffer.com%2Fhow-to-disallow-direct-access-to-a-file-with-php%2F&amp;source=joshstauffer&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>Place this code at the top of your PHP script.</p>
<pre>
if ( stristr( $_SERVER['SCRIPT_NAME'], basename( __FILE__ ) ) ) { exit( 'No direct script access allowed' ); }
</pre>


<p>Related posts:<ol><li><a href='http://www.joshstauffer.com/search-in-file-contents-in-windows/' rel='bookmark' title='Permanent Link: Search in File Contents in Windows'>Search in File Contents in Windows</a></li>
<li><a href='http://www.joshstauffer.com/search-for-text-inside-of-php-files-with-vista/' rel='bookmark' title='Permanent Link: Search for Text Inside of PHP Files with Vista'>Search for Text Inside of PHP Files with Vista</a></li>
<li><a href='http://www.joshstauffer.com/get-post-slug-in-wordpress/' rel='bookmark' title='Permanent Link: Get Post Slug in WordPress'>Get Post Slug in WordPress</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.joshstauffer.com/how-to-disallow-direct-access-to-a-file-with-php/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Search for Text Inside of PHP Files with Vista</title>
		<link>http://www.joshstauffer.com/search-for-text-inside-of-php-files-with-vista/</link>
		<comments>http://www.joshstauffer.com/search-for-text-inside-of-php-files-with-vista/#comments</comments>
		<pubDate>Wed, 30 Jan 2008 02:26:49 +0000</pubDate>
		<dc:creator>Josh Stauffer</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.joshstauffer.com/2008/01/search-for-text-inside-of-php-files-with-vista/</guid>
		<description><![CDATA[Problem Windows ignores text inside of PHP files because it doesn&#8217;t recognize them. This makes it very difficult to search for specific words or phrases inside of PHP files. Solution If you have Windows Search Indexing disabled, view this solution. Otherwise continue with the steps below. Perform a search on the Start Menu for &#8220;indexing&#8221;. [...]


Related posts:<ol><li><a href='http://www.joshstauffer.com/search-in-file-contents-in-windows/' rel='bookmark' title='Permanent Link: Search in File Contents in Windows'>Search in File Contents in Windows</a></li>
<li><a href='http://www.joshstauffer.com/disable-directory-browsing-with-hostgator/' rel='bookmark' title='Permanent Link: Disable Directory Browsing with HostGator'>Disable Directory Browsing with HostGator</a></li>
<li><a href='http://www.joshstauffer.com/send-test-emails-with-wampserver/' rel='bookmark' title='Permanent Link: Send test emails with WampServer'>Send test emails with WampServer</a></li>
</ol>]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.joshstauffer.com%2Fsearch-for-text-inside-of-php-files-with-vista%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.joshstauffer.com%2Fsearch-for-text-inside-of-php-files-with-vista%2F&amp;source=joshstauffer&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<h2>Problem</h2>
<p>Windows ignores text inside of PHP files because it doesn&#8217;t recognize them. This makes it very difficult to search for specific words or phrases inside of PHP files.</p>
<h2>Solution</h2>
<p>If you have Windows Search Indexing disabled, <a title="Search in File Contents in Windows" href="http://www.joshstauffer.com/search-in-file-contents-in-windows/">view this solution</a>. Otherwise continue with the steps below.</p>
<ol>
<li>Perform a search on the Start Menu for &#8220;indexing&#8221;. In the results, click on &#8220;Indexing Options&#8221;.</li>
<li>With &#8220;Indexing Options&#8221; open, click on the &#8220;Advanced&#8221; button.</li>
<li>Click on the &#8220;File Types&#8221; tab and scroll down the list until you see php in the Extension column.</li>
<li>Click on  php to select it, then select the radio button below that reads &#8220;Index Properties and File Contents&#8221;.</li>
<li>Click OK. Click Close.</li>
<li>Restart your computer.</li>
</ol>
<div id="attachment_348" class="wp-caption aligncenter" style="width: 610px"><a href="http://www.joshstauffer.com/wp-content/uploads/2008/01/search-php-files.jpg"><img class="size-full wp-image-348" title="search-php-files" src="http://www.joshstauffer.com/wp-content/uploads/2008/01/search-php-files.jpg" alt="Search within PHP files" width="600" height="350" /></a><p class="wp-caption-text">Search within PHP files</p></div>
<p>Now when you perform a search for a word, you will be able to click &#8220;Search in File Contents&#8221; and it will search all the text inside of the PHP files and return results for your query. That&#8217;s all there is to it.</p>


<p>Related posts:<ol><li><a href='http://www.joshstauffer.com/search-in-file-contents-in-windows/' rel='bookmark' title='Permanent Link: Search in File Contents in Windows'>Search in File Contents in Windows</a></li>
<li><a href='http://www.joshstauffer.com/disable-directory-browsing-with-hostgator/' rel='bookmark' title='Permanent Link: Disable Directory Browsing with HostGator'>Disable Directory Browsing with HostGator</a></li>
<li><a href='http://www.joshstauffer.com/send-test-emails-with-wampserver/' rel='bookmark' title='Permanent Link: Send test emails with WampServer'>Send test emails with WampServer</a></li>
</ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.joshstauffer.com/search-for-text-inside-of-php-files-with-vista/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

