-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Editorial Backend Header Content must be valid XHTML. #33
Comments
The plugin attempts to reduce the risk of broken HTML breaking the whole administration area by validating the HTML you submit (see this comment). However, it looks like the parser doesn't like HTML elements inside Here's a minimal-ish example that shows the problem outside of OJS: <?php
ini_set('display_errors', E_ALL);
$input = '
<script>
var html = \'<span>thing</span>\';
</script>
';
$dom = new DOMDocument();
$dom->loadHTML($input); Expected output: Nothing.
This seems to be an unsolved problem on StackOverflow, judging by many unanswered questions like this one. Some basic work-arounds (wrapping It looks like we might have to revisit the |
@lpanebr, meanwhile -- if you don't mind taking the risk of bad HTML breaking your site -- you can work around it by applying this change: diff --git a/CustomHeaderSettingsForm.php b/CustomHeaderSettingsForm.php
index 1a0bba1..066a7c1 100644
--- a/CustomHeaderSettingsForm.php
+++ b/CustomHeaderSettingsForm.php
@@ -90,6 +90,7 @@ class CustomHeaderSettingsForm extends Form {
* @return boolean
*/
function validateWellFormed($input) {
+ return true;
$libxml_errors_setting = libxml_use_internal_errors();
libxml_use_internal_errors(true);
libxml_clear_errors(); |
Oh thanks a lot for all the research @asmecher ! I really appreciate the patch but I rather just not defaulting any validateXXX method to returning true. I'm too afraid! 😆 I might do it in the development server just for fun or for a proof of concept. If I had time or a team I would really try finding a comfortable middle ground for this validation and send a pull request. Thanks! ❤️ |
Actually, @lpanebr, I think I found a better work-around. If you escape the
...with...
|
Dude, I was just reading about that on the SO below were I got from the one you mentioned before! I'll try it. |
It saved! Uncaught TypeError: Cannot read properties of null (reading 'appendChild') |
anyway. I guess now it's on me! Thanks! |
all right! It works! I just had to wrap it all in a Please feel free to close the issue, unless you still want to revisit the validation thing. 😉 Thanks and happy holidays! |
@lpanebr, that's a great example of use for the back-end custom header support! I'll leave this open for a little refinement of the validation tools; @ctgraham had a good suggestion that would at least allow the quirk to be easily worked around (at some risk). |
Hi! I'm trying to add a helper button that checks when we have submissions with more than 2 evaluations, alerts how many and paints their background, but I'm getting the following error when saving: Editorial Backend Header Content must be valid XHTML.
I've tried vanilla and jquery javascript but neither works.
However, when I paste them on the developer console both work as expected.
Any idea?
thanks!
The text was updated successfully, but these errors were encountered: