views:

240

answers:

1

Hello,

I'm using Subscribe2 plugin in my new upcoming WordPress blog (http://www.adlerr.com). My blog's title is "Roee Adler's Blog". When sending an email, Subscribe2 escapes the apostrophe in my blog's title, and the e-mail subject is received as follows:

[Roee Adler's Blog] Please confirm your request

The e-mail body is:

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

I would naturally like to have the "normal" un-escaped version of my blog name in the title and body.

I asked this question on doctype.com with no success (here's the question), however from the answers I understood this probably requires changes to the PHP code of the plugin, so I would rather ask it here.

Following the answers I received on doctype, I did alter the following section of code:

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);

In the code above, I added a htmlspecialchars_decode wrapper for the generation of both BLOGNAME and TITLE, however the e-mail subject and body still contains '.

What can I do to resolve this?

Thanks

+3  A: 

As per the documentation on htmlspecialchars_decode, you need to pass ENT_QUOTES as the $quote_style argument for it to convert ' to '. Try setting 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);
Rudd Zwolinski