<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Hit a Moving Target in your WordPress Plugin</title>
	<atom:link href="http://striderweb.com/nerdaphernalia/2008/09/hit-a-moving-target-in-your-wordpress-plugin/feed/" rel="self" type="application/rss+xml" />
	<link>http://striderweb.com/nerdaphernalia/2008/09/hit-a-moving-target-in-your-wordpress-plugin/</link>
	<description>"It's All Geek To Me"</description>
	<lastBuildDate>Mon, 09 Apr 2012 03:49:20 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
	<item>
		<title>By: Stephen</title>
		<link>http://striderweb.com/nerdaphernalia/2008/09/hit-a-moving-target-in-your-wordpress-plugin/comment-page-1/#comment-1581</link>
		<dc:creator>Stephen</dc:creator>
		<pubDate>Thu, 11 Sep 2008 21:17:43 +0000</pubDate>
		<guid isPermaLink="false">http://striderweb.com/nerdaphernalia/?p=209#comment-1581</guid>
		<description>Just for clarity:

&lt;pre&gt;&lt;code&gt;$x = &#039;/home/public_html/wp-content/plugins/myplugin/myplugin.php&#039;;

//dirname($x) == &#039;/home/public_html/wp-content/plugins/myplugin&#039;
//dirname(dirname($x)) == &#039;/home/public_html/wp-content/plugins&#039;
&lt;/code&gt;&lt;/pre&gt;

Regarding trailing slashes, it&#039;s a matter of preference, but a &lt;strong&gt;really&lt;/strong&gt; good idea to be consistent within a particular project.

Personally I prefer no-slash, for two reasons:
1) It&#039;s easier to add a slash when you need it than to take one off when you don&#039;t.
2) &quot;$x/$y/$z/file.php&quot; looks more like a path than &quot;$x$y$zfile.php&quot;</description>
		<content:encoded><![CDATA[<p>Just for clarity:</p>
<pre><code>$x = '/home/public_html/wp-content/plugins/myplugin/myplugin.php';

//dirname($x) == '/home/public_html/wp-content/plugins/myplugin'
//dirname(dirname($x)) == '/home/public_html/wp-content/plugins'
</code></pre>
<p>Regarding trailing slashes, it&#8217;s a matter of preference, but a <strong>really</strong> good idea to be consistent within a particular project.</p>
<p>Personally I prefer no-slash, for two reasons:<br />
1) It&#8217;s easier to add a slash when you need it than to take one off when you don&#8217;t.<br />
2) &#8220;$x/$y/$z/file.php&#8221; looks more like a path than &#8220;$x$y$zfile.php&#8221;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kahi</title>
		<link>http://striderweb.com/nerdaphernalia/2008/09/hit-a-moving-target-in-your-wordpress-plugin/comment-page-1/#comment-1580</link>
		<dc:creator>Kahi</dc:creator>
		<pubDate>Thu, 11 Sep 2008 19:40:11 +0000</pubDate>
		<guid isPermaLink="false">http://striderweb.com/nerdaphernalia/?p=209#comment-1580</guid>
		<description>Ah, I thought `dirname` returns name of the last folder in hierarchy (and you&#039;re trying to get the path to the current plugin folder), sorry, I got your message completely wrongly. Now I see. :-)

Yes, trailing slashes inconsistency is sometimes annoying too. Anyway, I do not understand why not to *always* add trailing slash. Do you know any motivation for that?</description>
		<content:encoded><![CDATA[<p>Ah, I thought `dirname` returns name of the last folder in hierarchy (and you&#8217;re trying to get the path to the current plugin folder), sorry, I got your message completely wrongly. Now I see. <img src='http://striderweb.com/nerdaphernalia/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Yes, trailing slashes inconsistency is sometimes annoying too. Anyway, I do not understand why not to *always* add trailing slash. Do you know any motivation for that?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stephen</title>
		<link>http://striderweb.com/nerdaphernalia/2008/09/hit-a-moving-target-in-your-wordpress-plugin/comment-page-1/#comment-1578</link>
		<dc:creator>Stephen</dc:creator>
		<pubDate>Thu, 11 Sep 2008 18:07:37 +0000</pubDate>
		<guid isPermaLink="false">http://striderweb.com/nerdaphernalia/?p=209#comment-1578</guid>
		<description>Well, &lt;em&gt;theoretically&lt;/em&gt; the folder above your plugin&#039;s folder is the &quot;plugins&quot; directory, so setting WP_PLUGIN_DIR to &lt;code&gt;dirname(dirname(__FILE__))&lt;/code&gt; should work.  In &lt;em&gt;practice&lt;/em&gt;, it doesn&#039;t always.

RE constant names, I have no problem with the ones they&#039;re using.  They&#039;re consistent, which is nice. :)  My pet peeve is that ABSPATH has the slash at the end, but none of the other path constants do.  ABSPATH is so deeply embedded it would be impossible to change at this point, short of just replacing it outright.</description>
		<content:encoded><![CDATA[<p>Well, <em>theoretically</em> the folder above your plugin&#8217;s folder is the &#8220;plugins&#8221; directory, so setting WP_PLUGIN_DIR to <code>dirname(dirname(__FILE__))</code> should work.  In <em>practice</em>, it doesn&#8217;t always.</p>
<p>RE constant names, I have no problem with the ones they&#8217;re using.  They&#8217;re consistent, which is nice. <img src='http://striderweb.com/nerdaphernalia/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   My pet peeve is that ABSPATH has the slash at the end, but none of the other path constants do.  ABSPATH is so deeply embedded it would be impossible to change at this point, short of just replacing it outright.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kahi</title>
		<link>http://striderweb.com/nerdaphernalia/2008/09/hit-a-moving-target-in-your-wordpress-plugin/comment-page-1/#comment-1577</link>
		<dc:creator>kahi</dc:creator>
		<pubDate>Thu, 11 Sep 2008 17:52:43 +0000</pubDate>
		<guid isPermaLink="false">http://striderweb.com/nerdaphernalia/?p=209#comment-1577</guid>
		<description>&gt; You might be tempted to set WP_PLUGIN_DIR as something like dirname(dirname(__FILE__))...

Before all other reasons you mentioned, this could create some new problems - like if another plugin would need the constant (then it would get it with unexpected value). 

I think plugin coders (mostly) know, that when they need to store some plugin-specific data, they should use variables or constant of specifically prefixed names, or store them inside the own class.

And I also think that the names of new constants weren&#039;t created too well. Instead of WP_PLUGIN_DIR and WP_PLUGIN_URL it would be IMHO more correct to make WP_PLUGINS_DIR_PATH and WP_PLUGINS_DIR_URL. (I&#039;m interested in other&#039;s opionions...)</description>
		<content:encoded><![CDATA[<p>&gt; You might be tempted to set WP_PLUGIN_DIR as something like dirname(dirname(__FILE__))&#8230;</p>
<p>Before all other reasons you mentioned, this could create some new problems &#8211; like if another plugin would need the constant (then it would get it with unexpected value). </p>
<p>I think plugin coders (mostly) know, that when they need to store some plugin-specific data, they should use variables or constant of specifically prefixed names, or store them inside the own class.</p>
<p>And I also think that the names of new constants weren&#8217;t created too well. Instead of WP_PLUGIN_DIR and WP_PLUGIN_URL it would be IMHO more correct to make WP_PLUGINS_DIR_PATH and WP_PLUGINS_DIR_URL. (I&#8217;m interested in other&#8217;s opionions&#8230;)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

