[wp-trac] [WordPress Trac] #25275: Checking if attachment is audio/video

WordPress Trac noreply at wordpress.org
Wed Sep 11 15:39:52 UTC 2013


#25275: Checking if attachment is audio/video
--------------------------+------------------------------
 Reporter:  danielpataki  |       Owner:
     Type:  enhancement   |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  3.6
 Severity:  normal        |  Resolution:
 Keywords:  has-patch     |
--------------------------+------------------------------

Comment (by DrewAPicture):

 Hi Daniel,

 Thanks for the patch, just a couple of suggestions:

 * Since it looks like `*_video()` and `*_audio()` are essentially verbatim
 copies of `wp_attachment_is_image()` with some small changes, it might
 make more sense to deprecate `*_image()` and combine all three into a
 single function with a type flag, maybe something like
 `wp_attachment_is_type()`.

 * Also, we could probably just use `wp_ext2type()` to determine the
 extension type because it opens the door for future types to be added to a
 `*_type()` function. It looks like you forgot to change `image/` to
 `video/` or `audio/` in the type checks anyway.

 * Last, in the future, please generate patches from the !WordPress root :)

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


More information about the wp-trac mailing list