WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#21329 closed enhancement (wontfix)

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

Reported by: 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 3 years ago.
21329-2.diff (2.7 KB) - added by martythornley 3 years ago.
21329.3.diff (8.2 KB) - added by martythornley 3 years ago.
Added some function descriptions to help clarify
21329.4.diff (9.4 KB) - added by martythornley 3 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 3 years ago.
Fixed version of previous patches
21329.8.diff (45.8 KB) - added by martythornley 3 years ago.
More reorganization and intro wp_upload_form()

Download all attachments as: .zip

Change History (18)

@martythornley3 years ago

comment:1 @scribu3 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

comment:2 @scribu3 years ago

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

@martythornley3 years ago

comment:3 @martythornley3 years ago

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

@martythornley3 years ago

Added some function descriptions to help clarify

comment:5 @martythornley3 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. :)

@martythornley3 years ago

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

comment:6 @martythornley3 years ago

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

comment:7 @martythornley3 years ago

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

@martythornley3 years ago

Fixed version of previous patches

@martythornley3 years ago

More reorganization and intro wp_upload_form()

comment:8 @martythornley3 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.

comment:9 @scribu3 years ago

  • Keywords close added

Is this still relevant?

comment:10 @nacin3 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.

comment:11 @c3mdigital2 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/

comment:12 @SergeyBiryukov2 years ago

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