Bugfix: Fix invalid HTML generated by new hide_email() logic

This commit is contained in:
Starbeamrainbowlabs 2020-08-31 20:56:34 +01:00
parent 0b86e2ec70
commit 42971f573d
Signed by: sbrl
GPG Key ID: 1BE5172E637709C2
2 changed files with 3 additions and 1 deletions

View File

@ -6,6 +6,8 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
### Fixed
- Fixed `inbody:searchterm` advanced query syntax
- Fixed inaccessible colours in the page list when using the dark theme
- Fixed invalid HTML generated by new `hide_email` implementation
## v0.22-beta2

View File

@ -316,7 +316,7 @@ function hide_email(string $email, string $display_text = null) : string
$a = base64_encode(implode("|", $a));
$b = base64_encode(implode("|", $b));
$span_id = "he-".crypto_id(16);
return "<a href='#protected-with-javascript' id='$span_id'>[protected with javascript]</span><script>(() => {let c=\"$a|$b\".split('|').map(atob).map(s=>s.split('|'));let d=[],e=document.getElementById('$span_id');c[1].map((n,i)=>d[parseInt(n)]=c[0][i]);d=JSON.parse(d.join(''));e.textContent=d[1]==null?d[0]:d[1];e.setAttribute('href', 'mailto:'+d[0])})();</script>";
return "<a href='#protected-with-javascript' id='$span_id'>[protected with javascript]</a><script>(() => {let c=\"$a|$b\".split('|').map(atob).map(s=>s.split('|'));let d=[],e=document.getElementById('$span_id');c[1].map((n,i)=>d[parseInt(n)]=c[0][i]);d=JSON.parse(d.join(''));e.textContent=d[1]==null?d[0]:d[1];e.setAttribute('href', 'mailto:'+d[0])})();</script>";
}
/**