Make WordPress Core

Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#21329 closed enhancement (wontfix)

Consolidate filters and functions in wp-admin/includes/media.php

Reported by: martythornley's profile martythornley Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Media Keywords: has-patch
Focuses: Cc:

Description

in wp-admin/media.php, there are several functions that do similar things and could be combined, simplifying how they get used.

Attachments (6)

21329.diff (2.7 KB) - added by martythornley 13 years ago.
21329-2.diff (2.7 KB) - added by martythornley 13 years ago.
21329.3.diff (8.2 KB) - added by martythornley 13 years ago.
Added some function descriptions to help clarify
21329.4.diff (9.4 KB) - added by martythornley 13 years ago.
remove media_upload_gallery and media_upload_library, add comments about functions that could be deprecated to end of file
21329.5.diff (7.1 KB) - added by martythornley 13 years ago.
Fixed version of previous patches
21329.8.diff (45.8 KB) - added by martythornley 13 years ago.
More reorganization and intro wp_upload_form()

Download all attachments as: .zip

Change History (18)

@martythornley
13 years ago

#1 @scribu
13 years ago

  • Type changed from defect (bug) to enhancement

It would be good if you added a useful description to this new media_upload() function.

Also, I'm not sure about the implications of changing the filter from:

"media_upload_$type"

to:

"media_upload", $type

#2 @scribu
13 years ago

You could use current_filter() to gleam the type in the callback.

#3 @martythornley
13 years ago

I wasn't aware of the current_filter() function. Here is take 2 with the original filters back in place.

@martythornley
13 years ago

Added some function descriptions to help clarify

#5 @martythornley
13 years ago

I'm just going to keep going with this ticket in an attempt to cleanup the media.php file and all its functions. Maybe some of it will be useful or some will be a waste of time but I have some time to kill. :)

@martythornley
13 years ago

remove media_upload_gallery and media_upload_library, add comments about functions that could be deprecated to end of file

#6 @martythornley
13 years ago

Ignore patch 3 and 4. I was grabbing wrong patch files. Sorry. Would remove them if I could see how.

#7 @martythornley
13 years ago

  • Summary changed from Consolidate media_upload filters and functions to Consolidate filters and functions in wp-admin/includes/media.php

@martythornley
13 years ago

Fixed version of previous patches

@martythornley
13 years ago

More reorganization and intro wp_upload_form()

#8 @martythornley
13 years ago

I have the patches between 5 and 8 if you want to see my steps but this was all just a reorganization of existing functions, making sure upload thickbox still worked for all tabs.

In 8, I grouped all the html for a standalone upload form ( the dragndrop area ) into one function wp_upload_form() that takes a number af $args to define it. I haven't tested replacing the inline form in media-new.php but it works as a replacement in the post/page upload window.

#9 @scribu
12 years ago

  • Keywords close added

Is this still relevant?

#10 @nacin
12 years ago

If this reduced the amount of code in the file, making it easier to maintain as we slowly wind down support for the legacy media code, I think I'd be for it. But it actually adds a few dozen lines.

#11 @c3mdigital
12 years ago

  • Keywords close removed
  • Resolution set to wontfix
  • Status changed from new to closed

Seems like a lot of code changes to be making on a legacy component. Mostly refactoring see: http://make.wordpress.org/core/2011/03/23/code-refactoring/

#12 @SergeyBiryukov
12 years ago

  • Milestone Awaiting Review deleted
Note: See TracTickets for help on using tickets.