Opened 19 years ago
Closed 18 years ago
#4563 closed defect (bug) (worksforme)
actions `admin_print_scripts-*' and `admin_head-*' useless
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 2.2.1 |
| Component: | Administration | Keywords: | hooks |
| Focuses: | Cc: |
Description
There are some problems.
- The code doesn't consider of localized menu string.
add_menu_page()inadmin-functions.phpuses hook name from menu title.
so a hook of an option page's custom plugin menu in Japanese turns like:
admin_head-%e8%a8%ad%e5%ae%9a_page_my-plugin_dir/my-plugin
Not only gettext-ed string but also url encoded. Nonsense.
- Non unique hooks
"admin_print_scripts-"and"admin_head-". When plugins callsadd_options_page()without the last argument(hook function name), those hooks called just as literaly the above: without any plugins name.
I think the patch of ticket:3835 should be applied.
For plugins like need to insert<script>tag only to their setting page,"admin_print_scripts-<my-plugin>"hook is better than
"admin_print_scripts", I think.
Attachments (1)
Change History (7)
#2
@
19 years ago
- Keywords reporter-feedback added
- Owner changed from anonymous to westi
- Status changed from new to assigned
#3
@
19 years ago
Well, made 3 files. Archived in ticket-4563-demo.tar.gz.
5 steps:
- please install the http://svn.automattic.com/wordpress-i18n/ja_JP/trunk/messages/ja.mo Japanese .mo file and set
WPLANGto"ja". - extract ticket-4563-demo.tar.gz into the plugins directory.
- apply patch file
plugin.php.diffin the archive againstwp-includes/plugin.php. This makesapply_filters()anddo_action()' log their arguments to/tmp/wp_ticket_4563.log`. - for the problem #1 of my first post, in the admin panel activate the plugin #4563-1, click [options] - [#4563-1], then
grepas the option page displays. - for the problem #2, deactivate the plugin #4563-1 and activate #4563-2, click [options] - [#4563-2], then
grepas the option page displays.
#4
@
19 years ago
this can be worked around by constructing the action name like this:
sanitize_title(__("Options")) . "_page_$myname";
maybe $admin_page_hooks should be built before calling load_default_textdomain?
#6
@
18 years ago
- Keywords reporter-feedback removed
- Milestone 2.4 deleted
- Resolution set to worksforme
- Status changed from assigned to closed
admin_print_script and admin_page_hook are both generated based on the $file argument passed to add_menu_page and so will not contain a translated string but a plugin defined unique one.
Closing as works for me
Note: See
TracTickets for help on using
tickets.
Please provide a simple example plugin which demonstrates these issues to help us understand the issue.