[theme-reviewers] Question about ob_start and ob_get_clean (Vicky Arulsingam)

Darren Slatten darrenslatten at gmail.com
Sun Jul 3 07:21:35 UTC 2011


>
> Themes should never use ob_* functions. The header case mentioned here
> included, it should be relegated to a plugin which wants to offer it if it's
> absolutely necessary. The plugin would simply hook in at priority 1, and
> start buffering, and hook in at priority 1000 or similar, and stop buffering
> there, do it's thing, and output; Those who "need" it, can have it, and
> those that don't, don't need to worry about performance issues or the
> possibility to use it wrong, and the theme remains as clean (as it should)
>

In my opinion, this is the first reasonable alternative that's been
presented. Personally, I wouldn't really consider this a *better* solution;
just a *different* solution.

Here are some concerns that come to mind--questions I don't have an answer
to:

   1. What if another plugin uses the same priority? In other words, how
   would the buffer plugin recover in situations where another plugin attaches
   to the same priority numbers, but is called after our plugin? Would this
   other plugin effectively "steal our spot" in the call stack? Would our
   plugin be bumped down in the stack? Replaced? Fatal error?
   2. What happens if the condition described in the previous bullet point
   occurs at one end but not the other? In other words, what if our plugin
   opens the output buffer but is prevented from closing it? Vice versa?
   3. What if I want to include theme functionality that relies on this
   output buffering? Should I require all theme users to install the plugin,
   just for the sake of keeping my theme "clean"? In other words, would a
   "clean" theme be accepted into the WP repository if it wasn't 100%
   functional out-of-the-box?
   4. My biggest concern is simply whether or not using a plugin for this
   would even work. For example, where in the overall execution thread would
   our custom function (the one that processes the output of wp_head) be
   called, and how might this differ between a plugin-based solution and a
   theme-based solution? Does this even matter? Every time I try to step
   through the code in my head, I get stuck in an infinite loop. :(


As a side note, I'd like to address this sentiment:

*Themes shouldn't try to correct plugins, Themes should display what
> WordPress tells it to, and style it according to the users & plugins
> wishes...
> *


This is just one example of what seems like an endless stream of pretentious
opinions being dictated as facts to the general subscriber base of this
mailing list. If every discussion thread ends with an unsupported statement
from a WP veteran, why even have a mailing list in the first place? We could
all save ourselves a heap of trouble if those WP vets just wrote a list of
their opinions, called it "WP Theme Laws," and posted it somewhere.

Assuming one of the goals of this mailing list is to actually facilitate
community participation and solicit unbiased feedback, then I'd say we're
failing. Collaboration means more than "a group of individuals taking turns
proclaiming their self-righteousness." In my opinion, that is.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20110703/f0024e7f/attachment-0001.htm>


More information about the theme-reviewers mailing list