<?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/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
	>
<channel>
	<title>Comments on: WordPress Plugin Pet Peeve #2: Direct Calls to Plugin Files</title>
	<atom:link href="http://willnorris.com/2009/06/wordpress-plugin-pet-peeve-2-direct-calls-to-plugin-files/feed" rel="self" type="application/rss+xml" />
	<link>http://willnorris.com/2009/06/wordpress-plugin-pet-peeve-2-direct-calls-to-plugin-files</link>
	<description>there&#039;s more to life than this</description>
	<lastBuildDate>Sun, 31 Jul 2011 08:06:56 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4-beta3-20574</generator>
	<item>
		<title>By: michaelwender.com &#187; An In-Depth Introduction to my First Commercial WordPress Theme</title>
		<link>http://willnorris.com/2009/06/wordpress-plugin-pet-peeve-2-direct-calls-to-plugin-files#comment-64779</link>
		<dc:creator>michaelwender.com &#187; An In-Depth Introduction to my First Commercial WordPress Theme</dc:creator>
		<pubDate>Tue, 26 Jul 2011 16:10:44 +0000</pubDate>
		<guid isPermaLink="false">http://willnorris.com/?p=637#comment-64779</guid>
		<description>&lt;p&gt;[...] Using jQuery to Query Featured Images To achieve these goals, I began coding the front-end using jQuery. Then for my AJAX calls, I added code to my theme’s functions.php so that WordPress could receive my query requests directly. This meant my AJAX calls could reference the theme’s main URL (e.g. http://example.com?action=getimage) rather than referencing some additional PHP file setup to specifically handle AJAX requests (for more info on this, check out this post by Will Norris). [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[&#8230;] Using jQuery to Query Featured Images To achieve these goals, I began coding the front-end using jQuery. Then for my AJAX calls, I added code to my theme’s functions.php so that WordPress could receive my query requests directly. This meant my AJAX calls could reference the theme’s main URL (e.g. <a href="http://example.com?action=getimage" rel="nofollow">http://example.com?action=getimage</a>) rather than referencing some additional PHP file setup to specifically handle AJAX requests (for more info on this, check out this post by Will Norris). [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John Eckman</title>
		<link>http://willnorris.com/2009/06/wordpress-plugin-pet-peeve-2-direct-calls-to-plugin-files#comment-39670</link>
		<dc:creator>John Eckman</dc:creator>
		<pubDate>Sat, 09 Jan 2010 23:34:04 +0000</pubDate>
		<guid isPermaLink="false">http://willnorris.com/?p=637#comment-39670</guid>
		<description>&lt;p&gt;Thanks for this great series, Will - I&#039;ve updated &lt;a href=&quot;http://wordpress.org/extend/plugins/wpbook/&quot;&gt;WPBook&lt;/a&gt; to comply with them (I think!).&lt;/p&gt;

&lt;p&gt;When constructing in code the full url that will be used (example.com/index.php in your example), is it better to use get_bloginfo(&#039;wpurl&#039;) or get_bloginfo(&#039;home&#039;)?&lt;/p&gt;

&lt;p&gt;That is, do I need to point at index.php in the directory where WordPress is installed or the index.php where they set their home url to be, in cases where they&#039;ve moved WordPress into a subdirectory?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thanks for this great series, Will - I&#8217;ve updated <a href="http://wordpress.org/extend/plugins/wpbook/">WPBook</a> to comply with them (I think!).</p>

<p>When constructing in code the full url that will be used (example.com/index.php in your example), is it better to use get_bloginfo(&#8216;wpurl&#8217;) or get_bloginfo(&#8216;home&#8217;)?</p>

<p>That is, do I need to point at index.php in the directory where WordPress is installed or the index.php where they set their home url to be, in cases where they&#8217;ve moved WordPress into a subdirectory?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: WPBook 1.4 Released &#124; Open Parenthesis</title>
		<link>http://willnorris.com/2009/06/wordpress-plugin-pet-peeve-2-direct-calls-to-plugin-files#comment-39505</link>
		<dc:creator>WPBook 1.4 Released &#124; Open Parenthesis</dc:creator>
		<pubDate>Mon, 04 Jan 2010 15:20:52 +0000</pubDate>
		<guid isPermaLink="false">http://willnorris.com/?p=637#comment-39505</guid>
		<description>&lt;p&gt;[...] Removed hard coded reference to config.php, routing Facebook comment submission through WordPress&#8217; built in query parser instead (See http://willnorris.com/2009/06/wordpress-plugin-pet-peeve-2-direct-calls-to-plugin-files) [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[&#8230;] Removed hard coded reference to config.php, routing Facebook comment submission through WordPress&#8217; built in query parser instead (See <a href="http://willnorris.com/2009/06/wordpress-plugin-pet-peeve-2-direct-calls-to-plugin-files" rel="nofollow">http://willnorris.com/2009/06/wordpress-plugin-pet-peeve-2-direct-calls-to-plugin-files</a>) [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will Norris</title>
		<link>http://willnorris.com/2009/06/wordpress-plugin-pet-peeve-2-direct-calls-to-plugin-files#comment-38053</link>
		<dc:creator>Will Norris</dc:creator>
		<pubDate>Tue, 17 Nov 2009 18:41:10 +0000</pubDate>
		<guid isPermaLink="false">http://willnorris.com/?p=637#comment-38053</guid>
		<description>&lt;p&gt;Olivier: the only way you would need something like &lt;code&gt;require_once(&#039;../../../wp-config.php&#039;)&lt;/code&gt; in your code is if you are calling your plugin files directly, and they need access to WP functions.  This is really bad, you never want to do this.&lt;/p&gt;

&lt;p&gt;So instead of calling your plugin file directly, and having it try to bootstrap the WP environment, what you want to do is actually send the request through WordPress (so the environment gets setup properly) and then have the requested passed off to your plugin to process it.  You accomplish the same thing, but this is the Right Way to do it.&lt;/p&gt;

&lt;p&gt;The &lt;a href=&quot;http://codex.wordpress.org/AJAX_in_Plugins&quot;&gt;AJAX in Plugins&lt;/a&gt; Codex page suggests that you can still use &lt;code&gt;/wp-admin/admin-ajax.php&lt;/code&gt; to process user facing AJAX calls.  I was thinking that wasn&#039;t possibly, but I certainly could be wrong... might be worth looking into.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Olivier: the only way you would need something like <code>require_once('../../../wp-config.php')</code> in your code is if you are calling your plugin files directly, and they need access to WP functions.  This is really bad, you never want to do this.</p>

<p>So instead of calling your plugin file directly, and having it try to bootstrap the WP environment, what you want to do is actually send the request through WordPress (so the environment gets setup properly) and then have the requested passed off to your plugin to process it.  You accomplish the same thing, but this is the Right Way to do it.</p>

<p>The <a href="http://codex.wordpress.org/AJAX_in_Plugins">AJAX in Plugins</a> Codex page suggests that you can still use <code>/wp-admin/admin-ajax.php</code> to process user facing AJAX calls.  I was thinking that wasn&#8217;t possibly, but I certainly could be wrong&#8230; might be worth looking into.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Kiper IT-konsult</title>
		<link>http://willnorris.com/2009/06/wordpress-plugin-pet-peeve-2-direct-calls-to-plugin-files#comment-38050</link>
		<dc:creator>Kiper IT-konsult</dc:creator>
		<pubDate>Tue, 17 Nov 2009 18:00:48 +0000</pubDate>
		<guid isPermaLink="false">http://willnorris.com/?p=637#comment-38050</guid>
		<description>&lt;p&gt;Thank you Will for this great post and thanks to Alex that posted about it so I could find it!
I have been delving deeper and deeper under the hood of WP lately and it is great to find articles that are so clear and to the point. It is sometimes hard to see the forest for all the trees...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Thank you Will for this great post and thanks to Alex that posted about it so I could find it!
I have been delving deeper and deeper under the hood of WP lately and it is great to find articles that are so clear and to the point. It is sometimes hard to see the forest for all the trees&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Olivier</title>
		<link>http://willnorris.com/2009/06/wordpress-plugin-pet-peeve-2-direct-calls-to-plugin-files#comment-38039</link>
		<dc:creator>Olivier</dc:creator>
		<pubDate>Tue, 17 Nov 2009 11:41:25 +0000</pubDate>
		<guid isPermaLink="false">http://willnorris.com/?p=637#comment-38039</guid>
		<description>&lt;p&gt;Sorry, I see that my comment has been truncated. Before the admin-ajax call, I am echoing the site_url path.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Sorry, I see that my comment has been truncated. Before the admin-ajax call, I am echoing the site_url path.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Olivier</title>
		<link>http://willnorris.com/2009/06/wordpress-plugin-pet-peeve-2-direct-calls-to-plugin-files#comment-38038</link>
		<dc:creator>Olivier</dc:creator>
		<pubDate>Tue, 17 Nov 2009 11:38:11 +0000</pubDate>
		<guid isPermaLink="false">http://willnorris.com/?p=637#comment-38038</guid>
		<description>&lt;p&gt;Hello,&lt;/p&gt;

&lt;p&gt;Great post however I am not really clear on how to deal with the :
require_once(&#039;../../../wp-config.php&#039;);&lt;/p&gt;

&lt;p&gt;I need to use the get_option function to get the site url which I then use in an ajax call :
jQuery.post(&quot;/wp-admin/admin-ajax.php&quot;...&lt;/p&gt;

&lt;p&gt;I have been through the methods you suggest but I don&#039;t really understand. The codex describes the method to perform Ajax calls on the admin and frontend sides. You need to include the wp-config.php to get the site url... I fully agree on the fact that this may cause some problems if the installation uses non standard paths but I don&#039;t get from your note the way to deal with that... I should have missed something...&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hello,</p>

<p>Great post however I am not really clear on how to deal with the :
require_once(&#8216;../../../wp-config.php&#8217;);</p>

<p>I need to use the get_option function to get the site url which I then use in an ajax call :
jQuery.post(&#8220;/wp-admin/admin-ajax.php&#8221;&#8230;</p>

<p>I have been through the methods you suggest but I don&#8217;t really understand. The codex describes the method to perform Ajax calls on the admin and frontend sides. You need to include the wp-config.php to get the site url&#8230; I fully agree on the fact that this may cause some problems if the installation uses non standard paths but I don&#8217;t get from your note the way to deal with that&#8230; I should have missed something&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: No more direct calls at alex.rabe</title>
		<link>http://willnorris.com/2009/06/wordpress-plugin-pet-peeve-2-direct-calls-to-plugin-files#comment-38008</link>
		<dc:creator>No more direct calls at alex.rabe</dc:creator>
		<pubDate>Mon, 16 Nov 2009 12:17:10 +0000</pubDate>
		<guid isPermaLink="false">http://willnorris.com/?p=637#comment-38008</guid>
		<description>&lt;p&gt;[...] be the solution for my problems and in the same second I spin my ideas he linked to an article from Will Norris. I never ever get the same idea since I wrote my first plugin, it&#8217;s really simple to realize [...]&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>[&#8230;] be the solution for my problems and in the same second I spin my ideas he linked to an article from Will Norris. I never ever get the same idea since I wrote my first plugin, it&#8217;s really simple to realize [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Will Norris</title>
		<link>http://willnorris.com/2009/06/wordpress-plugin-pet-peeve-2-direct-calls-to-plugin-files#comment-32580</link>
		<dc:creator>Will Norris</dc:creator>
		<pubDate>Mon, 20 Jul 2009 17:54:27 +0000</pubDate>
		<guid isPermaLink="false">http://willnorris.com/?p=637#comment-32580</guid>
		<description>&lt;p&gt;both &lt;code&gt;wp_mail&lt;/code&gt; and &lt;code&gt;wp_verify_nonce&lt;/code&gt; are defined in &lt;code&gt;pluggable.php&lt;/code&gt; which is loaded before either of those hooks.  If you&#039;re seeing an error about the functions being undefined, it must be caused by something else.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>both <code>wp_mail</code> and <code>wp_verify_nonce</code> are defined in <code>pluggable.php</code> which is loaded before either of those hooks.  If you&#8217;re seeing an error about the functions being undefined, it must be caused by something else.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rajeevan</title>
		<link>http://willnorris.com/2009/06/wordpress-plugin-pet-peeve-2-direct-calls-to-plugin-files#comment-32533</link>
		<dc:creator>Rajeevan</dc:creator>
		<pubDate>Fri, 17 Jul 2009 06:50:14 +0000</pubDate>
		<guid isPermaLink="false">http://willnorris.com/?p=637#comment-32533</guid>
		<description>&lt;p&gt;Okay, I got to admit I&#039;ve been doing this dirty trick on my plugin for a while now. After reading this, I&#039;ve converted to using HOOK to &quot;parse_request&quot;.&lt;/p&gt;

&lt;p&gt;But there comes errors, My plugin uses wp_mail() and wp_verify_nonce()!
Both failed as Undefined functions? so I try changing the parse_request HOOK to &#039;wp&#039;. Same result, I guess this method have its limit!&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Okay, I got to admit I&#8217;ve been doing this dirty trick on my plugin for a while now. After reading this, I&#8217;ve converted to using HOOK to &#8220;parse_request&#8221;.</p>

<p>But there comes errors, My plugin uses wp_mail() and wp_verify_nonce()!
Both failed as Undefined functions? so I try changing the parse_request HOOK to &#8216;wp&#8217;. Same result, I guess this method have its limit!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

