2

我在即将发布的新 WordPress 博客 ( http://www.adlerr.com ) 中使用了 Subscribe2 插件。我的博客标题是“Roee Adler 的博客”。发送邮件时,Subscribe2 将我博客标题中的撇号转义,收到邮件主题如下:

[Roee Adler's Blog] Please confirm your request

电子邮件正文是:

Roee Adler's Blog has received a request to 
subscribe for this email address. To complete your 
request please click on the link below:
...

我自然希望在标题和正文中有我的博客名称的“正常”未转义版本。

我在doctype.com上问了这个问题,但没有成功(这里是问题),但是从答案中我了解到这可能需要更改插件的 PHP 代码,所以我宁愿在这里问。

根据我在 doctype 上收到的答案,我确实更改了以下代码部分:

function substitute($string = '') {
    if ('' == $string) {
        return;
    }
    $string = htmlspecialchars_decode(str_replace("BLOGNAME", get_option('blogname'), $string));
    $string = str_replace("BLOGLINK", get_bloginfo('url'), $string);
    $string = htmlspecialchars_decode(str_replace("TITLE", stripslashes($this->post_title), $string));
    $string = str_replace("PERMALINK", $this->permalink, $string);

在上面的代码中,我添加了一个htmlspecialchars_decode用于生成 BLOGNAME 和 TITLE 的包装器,但是电子邮件主题和正文仍然包含'.

我能做些什么来解决这个问题?

谢谢

4

2 回答 2

3

根据有关 的文档htmlspecialchars_decode,您需要将ENT_QUOTES其作为$quote_style参数传递以将其转换''. 尝试设置ENT_QUOTES

function substitute($string = '') {
        if ('' == $string) {
                return;
        }
        $string = htmlspecialchars_decode(str_replace("BLOGNAME", get_option('blogname'), $string), ENT_QUOTES);
        $string = str_replace("BLOGLINK", get_bloginfo('url'), $string);
        $string = htmlspecialchars_decode(str_replace("TITLE", stripslashes($this->post_title), $string), ENT_QUOTES);
        $string = str_replace("PERMALINK", $this->permalink, $string);
于 2009-08-25T20:30:27.653 回答
0

WordPress 将博客标题中的撇号替换为将'其存储在数据库中之前。如果要覆盖它,请编辑 functions.php 文件并插入以下语句:

update_option("blogname", "My Blog's Title With Apostrophe");

这将强制标题与您输入的内容完全相同。您在“设置”菜单中对博客标题所做的更改将无效。

于 2013-03-12T06:59:31.187 回答