开发者

wordpress plugins using '&' not '&'

开发者 https://www.devze.com 2023-01-11 14:24 出处:网络
Some Wordpress plugins (one is MapP开发者_如何学Pythonress which uses Google Maps) use ampersands in their links but do not convert them into the correct HTML character entity:

Some Wordpress plugins (one is MapP开发者_如何学Pythonress which uses Google Maps) use ampersands in their links but do not convert them into the correct HTML character entity:

&

This invalidates the markup and is very frustrating! Is there any way to convert the & to &?

I've searched for a long time and found no solution, but have read a lot of interesting articles on the topic!


I think you're looking for htmlentities: http://php.net/manual/en/function.htmlentities.php

<?php
$str = "A 'quote' is <b>bold</b>";

// Outputs: A 'quote' is &lt;b&gt;bold&lt;/b&gt;
echo htmlentities($str);

// Outputs: A &#039;quote&#039; is &lt;b&gt;bold&lt;/b&gt;
echo htmlentities($str, ENT_QUOTES);
?>


I'd write an email to him and ask him to use htmlentities in his plugin. Even better, make the changes yourself, then email him a patch.

0

精彩评论

暂无评论...
验证码 换一张
取 消