[wp-trac] [WordPress Trac] #23282: Add shortcodes for inline HTML5 audio / video

WordPress Trac noreply at wordpress.org
Thu Jun 13 17:41:55 UTC 2013


#23282: Add shortcodes for inline HTML5 audio / video
-----------------------------+---------------------
 Reporter:  wonderboymusic   |       Owner:
     Type:  feature request  |      Status:  closed
 Priority:  normal           |   Milestone:  3.6
Component:  Media            |     Version:  trunk
 Severity:  normal           |  Resolution:  fixed
 Keywords:                   |
-----------------------------+---------------------

Comment (by Otto42):

 Replying to [comment:82 amereservant]:
 > I guess I'm curious why the {{{shortcode_exists()}}} function was added
 since this is so simple to check this by checking the global
 {{{$shortcode_tags}}}.  This function seems to just add extra bloat to the
 WordPress code.

 The shortcode_exists function is the correct way to check for this sort of
 thing, because checking the global $shortcode_tags directly in every place
 where it's used is not clear. Code should be self-explanatory and easy to
 maintain, not optimized beyond the point of sanity. The overhead of an
 additional function call is minimal, and the benefit of clarity in
 understanding what the code is doing is worth the cost.


 > The other curiosity is in regards to the performance impact
 {{{has_shortcode()}}} will have ... there are at least a few tutorials on
 how to make this function, but making it a part of the core code sort of
 encourages the use of such a function and can hurt the overall performance
 of WordPress.

 You seem to be suffering from the horrible curse of
 [http://en.wikipedia.org/wiki/Program_optimization#When_to_optimize
 Premature Optimization].

 If the function can be made faster, or clearer, or simpler, then it can be
 fixed later, or even now if you have a patch. But initially, the most
 important thing of any piece of code is that it works, and is clear, and
 makes sense. Speedups can be introduced later, if and when the code that
 is causing the slowdowns can be identified. You must Profile code before
 Optimizing it.

 Not saying that there's no room for performance improvements here, but
 shortcode_exists() is not an example of bloat. And while there may be
 better ways to implement has_shortcode(), it's not the same thing to find
 out if a shortcode exists immediately prior to executing it vs. before
 processing the content. Now, has_shortcode() may no longer be needed since
 post-formats is getting ripped out of core for 3.6 and I don't think it
 was used elsewhere. If it's going to become unused, it might be worth
 removing from 3.6 as well.

--
Ticket URL: <http://core.trac.wordpress.org/ticket/23282#comment:83>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list