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

Chip Bennett chip at chipbennett.net
Wed Jun 29 14:02:46 UTC 2011


Ah, yeah. comments_popup_link() is a bit of a unique function; what sort of
filters do you have in mind through which to run its output?

Problems with dynamic sidebars inside of the_content()?

1) Sidebar management via Dashboard -> Appearance -> Widgets would quickly
become unwieldy and untenable
2) Arbitrary code execution inside of the_content(), based on the type of
Widgets used
3) Overkill. If you *really* wanted to output Widgets inside of
the_content(), why not just write a custom shortcode for
the_widget()<http://codex.wordpress.org/Function_Reference/the_widget>
?

Chip

On Wed, Jun 29, 2011 at 8:55 AM, Sayontan Sinha <sayontan at gmail.com> wrote:

> I think some of the comment link functions such as comments_popup_link and
> comments_number directly print output.
>
> What kind of potential problems do you see with dynamic sidebars inside
> the_content? It is not something a theme includes by default, but it is
> something explicitly invoked by a post author to put in specific widgets in
> the content.
>
>
> On Wed, Jun 29, 2011 at 6:41 AM, Chip Bennett <chip at chipbennett.net>wrote:
>
>> Can you give an example of such functions? Almost every core WordPress
>> function either has a get_*() analog, or else incorporates apply_filters().
>>
>> A dynamic sidebar *inside* of the_content()? That sounds somewhat fraught
>> with potential problems...
>>
>> Chip
>>
>>
>> On Wed, Jun 29, 2011 at 8:36 AM, Sayontan Sinha <sayontan at gmail.com>wrote:
>>
>>> There are some specific uses I can think of:
>>>
>>>    1. Some functions have no "echo" parameter and always print the
>>>    output. If you wanted to run a filter over the output of such a function,
>>>    this seems like an easy way to do so.
>>>    2. Ad hoc insertions of widgets/widget areas. Let's say you have
>>>    defined a sidebar that you want to be able to insert within your posts. You
>>>    could do this by defining a shortcode, which prints out dynamic_sidebar in
>>>    an output buffer.
>>>
>>>
>>> On Wed, Jun 29, 2011 at 5:18 AM, Ryan Hellyer <ryan at pixopoint.com>wrote:
>>>
>>>> There are many reasons to use output buffering (ob_start etc), but
>>>> they would rarely be used within a theme. I've seen themes which use
>>>> buffering as a way to dynamically minify the markup, but that's a
>>>> horrid way to do it - much better incorporated within a caching plugin
>>>> IMO.
>>>>
>>>> There may be a practical use for output buffer in a theme, but I'm
>>>> darned if I can think of a good example. I wouldn't want to see it
>>>> banned outright, as someone may come up with a cunning use for it that
>>>> none of us have thought of.
>>>>
>>>> Perhaps the theme check plugin could check for output buffering
>>>> functions and leave a request for the theme developer to provide a
>>>> reason for using it? That way they'll know it's non-standard and
>>>> provide a reason (good or bad) for the theme reviewers to read. Could
>>>> potentially save a little to and fro'ing in the future. Just an idea.
>>>> _______________________________________________
>>>> theme-reviewers mailing list
>>>> theme-reviewers at lists.wordpress.org
>>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>>
>>>
>>>
>>>
>>> --
>>> Sayontan Sinha
>>> http://mynethome.net | http://mynethome.net/blog
>>>  --
>>> Beating Australia in Cricket is like killing a celebrity. The death gets
>>> more coverage than the crime.
>>>
>>>
>>> _______________________________________________
>>> theme-reviewers mailing list
>>> theme-reviewers at lists.wordpress.org
>>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>>
>>>
>>
>> _______________________________________________
>> theme-reviewers mailing list
>> theme-reviewers at lists.wordpress.org
>> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>>
>>
>
>
> --
> Sayontan Sinha
> http://mynethome.net | http://mynethome.net/blog
> --
> Beating Australia in Cricket is like killing a celebrity. The death gets
> more coverage than the crime.
>
>
> _______________________________________________
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
> http://lists.wordpress.org/mailman/listinfo/theme-reviewers
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.wordpress.org/pipermail/theme-reviewers/attachments/20110629/5c8ba419/attachment-0001.htm>


More information about the theme-reviewers mailing list