#6549 closed defect (bug) (fixed)
Output broken in wp-admin/widgets.php
Reported by: | hakre | Owned by: | |
---|---|---|---|
Milestone: | 2.8 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Widgets | Keywords: | Output has-patch |
Focuses: | Cc: |
Description
While calling my.blog/wp-admin/widgets.php the output is somewhat incomplete. Take a look in the source and you find stuff like:
"<label for="categories-title-%i%">"
that is not only invalid output it looks like the work in the file has not been finished or there has been put one % to much in a (s)printf call.
Change History (13)
#2
@
16 years ago
Yes I will do later on, just wanted to ticket my observation because this is live in a customers project. Will upload more info later on, I guess this is easily patchable.
#3
@
16 years ago
Okay, now I have got more Infos on the Issue:
This is "by Design". The %i% inside the ID is part of a codeblock that is used by some javascript as a pattern to create valid sourcecode later on. See line 62ff in widgets.js (?ver=20080319).
One solution which comes into my tired getting mind is to put the pattern-sourcecode inside a html comment (<!-- ... -->) and then use jQuery to create the elements later on. This would only slightly modify the code and would work quite the same. The only problem that comes into my mind is when a widget has got a HTML comment in it's own output.
I could verify this Idea by modifying the source:
wp-admin/includes/widgets.php line 91 ff
$widget_control_template = sprintf('%s<!-- %s -->%s', $sidebar_args['before_widget'], $widget_control_template, $sidebar_args['after_widget']);
wp-admin/js/widget.js: ~ line 63
var oldLi = $(this).parents('li:first').find('ul.widget-control-info li'); var comment = oldLi.html(); var pattern = comment.substr(5, comment.length - 8); var newLi = oldLi.clone(); newLi.html(pattern);
I dunno wether this work with "multi widgets" because I know none sothat I could test it against it. But if I read the code right, it should work. With all the other widgets, this worked.
#4
follow-up:
↓ 5
@
16 years ago
imo, this is asking for trouble... any widget with, not just a -->, but also a --, will break.
#5
in reply to:
↑ 4
;
follow-up:
↓ 9
@
16 years ago
Replying to Denis-de-Bernardy:
imo, this is asking for trouble... any widget with, not just a -->, but also a --, will break.
can you explain to me why even -- will break it?
#8
@
15 years ago
- Keywords has-patch added
- Milestone changed from 2.9 to 2.8
Patch available: #9429: qcop-r00-admin-widget.patch (created a new ticket by accident)
#9
in reply to:
↑ 5
;
follow-up:
↓ 13
@
15 years ago
Replying to hakre:
Replying to Denis-de-Bernardy:
imo, this is asking for trouble... any widget with, not just a -->, but also a --, will break.
can you explain to me why even -- will break it?
Sure. Some versions of IE or FF (can't recall) behave weird when they run into a -- enclosed within an html tag.
For what it's worth, I ran into such a bug with my mediacaster plugin. The user had a file like:
[media:foo--bar.flv]
I can't recall how the latter got transformed by the code that would be outputted should have worked fine on paper. Nonetheless, one of the browsers would consider it was an opening comment, and proceeded to "comment out" the rest of the page...
D.
#12
@
15 years ago
thanks. let me know when I can make the next iteration for validity issues on the admin backend.
#13
in reply to:
↑ 9
@
15 years ago
Replying to Denis-de-Bernardy:
Replying to hakre:
Replying to Denis-de-Bernardy:
imo, this is asking for trouble... any widget with, not just a -->, but also a --, will break.
can you explain to me why even -- will break it?
Sure. Some versions of IE or FF (can't recall) behave weird when they run into a -- enclosed within an html tag.
sounds like a bug in the sgml parser - comment related. the version of ie or ff (or both?) that have such a bug would be good to know.
tom, could you provide more information into what you did to produce this bug? At the minimum it would be nice to know what widgets you used when you observed the bug.