Opened 2 years ago
Last modified 2 years ago
#15782 new enhancement
Consolidate header Javascript
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Future Release |
| Component: | Administration | Version: | 3.1 |
| Severity: | normal | Keywords: | has-patch needs-testing |
| Cc: |
Description
As a followon to #15781
Currently there is a block of Javascript required on all admin pages, this is stored directly within admin-header.php, and iframe_header(). Unfortunately, when someone changes/adds code to one, the other is not always updated.
This inline Javascript should be moved to a function and printed on a header action in order to reduce code duplication and prevent future issues.
Attachments (2)
Change History (8)
Re: press-this.php, see also the wp_tiny_mce and wp_tiny_mce_preload_dialogs calls.
Edit: reference, #15561.
- Keywords 3.2-early removed
- Summary changed from Consolodate header Javascript to Consolidate header Javascript
At first look the patch seems right, it removes few duplicate lines of HTML and replaces them with two PHP functions. However at closer look it actually adds more code instead of reducing it.
It also seems to loose the $hook_suffix global which seems to be redundant in the first place as only the $admin_body_class global is needed in the script. Another weakness is that the patch allows defaults to be overwritten. These JS globals should be consistent and exactly the same as the PHP globals.
Perhaps a better approach is to just output the script as it is in the admin head at the moment, without much PHP processing.

Also wp_iframe().