<?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: Announcing the WordPress Image Browser Extender Plugin</title>
	<atom:link href="http://benjaminsterling.com/announcing-the-wordpress-image-browser-extender-plugin/feed/" rel="self" type="application/rss+xml" />
	<link>http://benjaminsterling.com/announcing-the-wordpress-image-browser-extender-plugin/</link>
	<description>Ok, you did not judge the book by it&#039;s cover, great.  Now, read the whole thing before passing judgment.</description>
	<lastBuildDate>Sat, 03 Jan 2009 04:54:23 -0600</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Otto</title>
		<link>http://benjaminsterling.com/announcing-the-wordpress-image-browser-extender-plugin/comment-page-1/#comment-3967</link>
		<dc:creator>Otto</dc:creator>
		<pubDate>Thu, 07 Aug 2008 19:45:14 +0000</pubDate>
		<guid isPermaLink="false">http://benjaminsterling.com/?p=80#comment-3967</guid>
		<description>Hey, for off-the-cuff folk code, I think I did pretty well. ;)

But yes, okay, there&#039;s some minor issues with that bit of code. Nevertheless, it illustrates the point, I think.</description>
		<content:encoded><![CDATA[<p>Hey, for off-the-cuff folk code, I think I did pretty well. ;)</p>
<p>But yes, okay, there&#8217;s some minor issues with that bit of code. Nevertheless, it illustrates the point, I think.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Benjamin Sterling</title>
		<link>http://benjaminsterling.com/announcing-the-wordpress-image-browser-extender-plugin/comment-page-1/#comment-3966</link>
		<dc:creator>Benjamin Sterling</dc:creator>
		<pubDate>Thu, 07 Aug 2008 18:49:03 +0000</pubDate>
		<guid isPermaLink="false">http://benjaminsterling.com/?p=80#comment-3966</guid>
		<description>@Evita that is in the works, not entirely sure of the timeframe though.

@Otto Let me start of by saying that everything I know about WP plugins is from looking at what other people did, some tutorials here and there and from digging thru the code to see where things can be hooked into.

With that said, your example is actually perfect for what I&#039;ve been doing for most of my plugins where there is a need to communicate directly with the plugins file.

In your example you mean test_var and not test-var correct?  Don&#039;t think test-var would work, but I could be wrong.

&lt;cite&gt;&quot;You never, ever, need to include wp-config.php. It&#039;s just not necessary. There&#039;s always a forward compatible way to do things.&quot;&lt;/cite&gt;

Yes, I believe there is always a forward compatible way of doing things, but sometimes its hard to see the forest thru the trees.  No matter how hard you look at someone else&#039;s code, you may not always take the best route.

I do appreciate you taking the time to educate me on that point, I will be testing that approach on my PhotoXhibit plugin and see what I come up with.</description>
		<content:encoded><![CDATA[<p>@Evita that is in the works, not entirely sure of the timeframe though.</p>
<p>@Otto Let me start of by saying that everything I know about WP plugins is from looking at what other people did, some tutorials here and there and from digging thru the code to see where things can be hooked into.</p>
<p>With that said, your example is actually perfect for what I&#8217;ve been doing for most of my plugins where there is a need to communicate directly with the plugins file.</p>
<p>In your example you mean test_var and not test-var correct?  Don&#8217;t think test-var would work, but I could be wrong.</p>
<p><cite>&#8220;You never, ever, need to include wp-config.php. It&#8217;s just not necessary. There&#8217;s always a forward compatible way to do things.&#8221;</cite></p>
<p>Yes, I believe there is always a forward compatible way of doing things, but sometimes its hard to see the forest thru the trees.  No matter how hard you look at someone else&#8217;s code, you may not always take the best route.</p>
<p>I do appreciate you taking the time to educate me on that point, I will be testing that approach on my PhotoXhibit plugin and see what I come up with.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Otto</title>
		<link>http://benjaminsterling.com/announcing-the-wordpress-image-browser-extender-plugin/comment-page-1/#comment-3965</link>
		<dc:creator>Otto</dc:creator>
		<pubDate>Thu, 07 Aug 2008 17:19:38 +0000</pubDate>
		<guid isPermaLink="false">http://benjaminsterling.com/?p=80#comment-3965</guid>
		<description>Whoops. I typed &quot;mytest&quot; in that second function by mistake. My bad, that should be just &quot;test&quot;. :)</description>
		<content:encoded><![CDATA[<p>Whoops. I typed &#8220;mytest&#8221; in that second function by mistake. My bad, that should be just &#8220;test&#8221;. :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Otto</title>
		<link>http://benjaminsterling.com/announcing-the-wordpress-image-browser-extender-plugin/comment-page-1/#comment-3964</link>
		<dc:creator>Otto</dc:creator>
		<pubDate>Thu, 07 Aug 2008 17:18:03 +0000</pubDate>
		<guid isPermaLink="false">http://benjaminsterling.com/?p=80#comment-3964</guid>
		<description>I saw your comment over here:
http://planetozh.com/blog/2008/08/2008-plugin-competition-review-part-one/

The main problem you&#039;re talking about here is the necessity to include wp-config and how that keeps changing and breaking plugins. 

Here&#039;s the problem with that: It&#039;s really never necessary to include wp-config.php. Ever. Why? Because it&#039;s also never necessary to link to your plugin directly. Just code the plugin to have an alternate output path.

Think of it like this. You&#039;re calling your plugin directly for some purpose, possibly to output an image or something. Great. Instead of doing that, have it link to the main blog URL and pass a new parameter on the command line. 

Then, the magic: you hook your plugin to template_redirect.

At that point, you can check for that parameter, do whatever it needs to do, and then exit the script, to prevent WordPress from creating any output.

Voila, done. No need to include config or load or anything else. All you need is to create a special GET parameter.

In fact, you can even make your own query_var, if you don&#039;t want to look at the GET superglobal.

Example code: 
[php]
//create the &quot;test&quot; var
function test-var($public_query_vars) {
$public_query_vars[] = &#039;test&#039;;
return $public_query_vars;
}
add_filter(&#039;query_vars&#039;, &#039;test-vars&#039;);

// check for it and do our own output instead of WP&#039;s
function test-output() {
if (get_query_var(&#039;mytest&#039;)) {
echo &quot;hahah!&quot;;
exit;
}
}
add_action(&#039;template_redirect&#039;, &#039;test-output&#039;);
[/php]
See how simple that is? Now a hit to http://example.com/blog/?test=1 will output &quot;hahah!&quot; and then exit.

You never, ever, need to include wp-config.php. It&#039;s just not necessary. There&#039;s always a forward compatible way to do things.</description>
		<content:encoded><![CDATA[<p>I saw your comment over here:<br />
<a href="http://planetozh.com/blog/2008/08/2008-plugin-competition-review-part-one/" rel="nofollow">http://planetozh.com/blog/2008.....-part-one/</a></p>
<p>The main problem you're talking about here is the necessity to include wp-config and how that keeps changing and breaking plugins. </p>
<p>Here's the problem with that: It's really never necessary to include wp-config.php. Ever. Why? Because it's also never necessary to link to your plugin directly. Just code the plugin to have an alternate output path.</p>
<p>Think of it like this. You're calling your plugin directly for some purpose, possibly to output an image or something. Great. Instead of doing that, have it link to the main blog URL and pass a new parameter on the command line. </p>
<p>Then, the magic: you hook your plugin to template_redirect.</p>
<p>At that point, you can check for that parameter, do whatever it needs to do, and then exit the script, to prevent WordPress from creating any output.</p>
<p>Voila, done. No need to include config or load or anything else. All you need is to create a special GET parameter.</p>
<p>In fact, you can even make your own query_var, if you don't want to look at the GET superglobal.</p>
<p>Example code: </p>
<div class="igBar"><span id="lphp-1"><a href="#" onclick="javascript:showPlainTxt('php-1'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">PHP:</span>
<div id="php-1">
<div class="php">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">//create the &quot;test&quot; var</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> test-<span style="color:#000000; font-weight:bold;">var</span><span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#0000FF;">$public_query_vars</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#0000FF;">$public_query_vars</span><span style="color:#006600; font-weight:bold;">&#91;</span><span style="color:#006600; font-weight:bold;">&#93;</span> = <span style="color:#FF0000;">'test'</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">return</span> <span style="color:#0000FF;">$public_query_vars</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">add_filter<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'query_vars'</span>, <span style="color:#FF0000;">'test-vars'</span><span style="color:#006600; font-weight:bold;">&#41;</span>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#FF9933; font-style:italic;">// check for it and do our own output instead of WP's</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#000000; font-weight:bold;">function</span> test-output<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#616100;">if</span> <span style="color:#006600; font-weight:bold;">&#40;</span>get_query_var<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'mytest'</span><span style="color:#006600; font-weight:bold;">&#41;</span><span style="color:#006600; font-weight:bold;">&#41;</span> <span style="color:#006600; font-weight:bold;">&#123;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/echo"><span style="color:#000066;">echo</span></a> <span style="color:#FF0000;">"hahah!"</span>;</div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><a href="http://www.php.net/exit"><span style="color:#000066;">exit</span></a>;</div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-weight: bold;color:#26536A;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color:#006600; font-weight:bold;">&#125;</span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#3A6A8B;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">add_action<span style="color:#006600; font-weight:bold;">&#40;</span><span style="color:#FF0000;">'template_redirect'</span>, <span style="color:#FF0000;">'test-output'</span><span style="color:#006600; font-weight:bold;">&#41;</span>; </div>
</li>
</ol>
</div>
</div>
</div>
<p>
See how simple that is? Now a hit to <a href="http://example.com/blog/?test=1" rel="nofollow">http://example.com/blog/?test=1</a> will output "hahah!" and then exit.</p>
<p>You never, ever, need to include wp-config.php. It's just not necessary. There's always a forward compatible way to do things.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Evita</title>
		<link>http://benjaminsterling.com/announcing-the-wordpress-image-browser-extender-plugin/comment-page-1/#comment-3631</link>
		<dc:creator>Evita</dc:creator>
		<pubDate>Wed, 02 Jul 2008 15:26:38 +0000</pubDate>
		<guid isPermaLink="false">http://benjaminsterling.com/?p=80#comment-3631</guid>
		<description>Hi!

Is there any chance to make this great plugin working without the richtext editor?</description>
		<content:encoded><![CDATA[<p>Hi!</p>
<p>Is there any chance to make this great plugin working without the richtext editor?</p>
]]></content:encoded>
	</item>
</channel>
</rss>
