Make WordPress Core

Opened 14 years ago

Closed 9 years ago

#15782 closed enhancement (wontfix)

Consolidate header Javascript

Reported by: dd32's profile dd32 Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.1
Component: Administration Keywords: has-patch needs-refresh
Focuses: Cc:


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)

garyc40-15782.patch (9.2 KB) - added by garyc40 14 years ago.
there's a patch for that
15782.2.diff (8.4 KB) - added by garyc40 13 years ago.
remove redundant admin_script_globals() function

Download all attachments as: .zip

Change History (10)

#1 @ocean90
14 years ago

Also wp_iframe().

#2 @duck_
14 years ago

And wp-admin/press-this.php

14 years ago

there's a patch for that

#3 @garyc40
14 years ago

  • Keywords has-patch needs-testing added

#4 @nacin
13 years ago

Re: press-this.php, see also the wp_tiny_mce and wp_tiny_mce_preload_dialogs calls.

Edit: reference, #15561.

Last edited 13 years ago by nacin (previous) (diff)

13 years ago

remove redundant admin_script_globals() function

#5 @scribu
13 years ago

  • Keywords 3.2-early removed
  • Summary changed from Consolodate header Javascript to Consolidate header Javascript

#6 @azaozz
13 years ago

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.

#7 @wonderboymusic
10 years ago

  • Keywords needs-refresh added; needs-testing removed

#8 @wonderboymusic
9 years ago

  • Milestone Future Release deleted
  • Resolution set to wontfix
  • Status changed from new to closed

I just tried to come up with a fresh patch, it's not really worth it at this point.

Note: See TracTickets for help on using tickets.