Changeset 907

Show
Ignore:
Timestamp:
02/22/04 00:31:25 (5 years ago)
Author:
michelvaldrighi
Message:

fixes to handle ISO-scrambled email subjects in wp-mail

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/functions-formatting.php

    r876 r907  
    376376} 
    377377 
     378 
     379// used by wp-mail to handle charsets in email subjects 
     380 
     381function wp_iso_descrambler($string) { 
     382  /* this may only work with iso-8859-1, I'm afraid */ 
     383  if (!preg_match('#\=\?(.+)\?Q\?(.+)\?\=#i', $string, $matches)) { 
     384    return $string; 
     385  } else { 
     386    $subject = str_replace('_', ' ', $matches[2]); 
     387    $subject = preg_replace('#\=([0-9a-f]{2})#ei', "chr(hexdec(strtolower('$1')))", $subject); 
     388    return $subject; 
     389  } 
     390} 
     391 
    378392?> 
  • trunk/wp-mail.php

    r771 r907  
    7474                $subject = trim($line); 
    7575                $subject = substr($subject, 9, strlen($subject)-9); 
     76                if (!preg_match('#\=\?(.+)\?Q\?(.+)\?\=#i', $subject)) { 
     77                  $subject = wp_iso_descrambler($subject); 
     78                } 
    7679                if ($use_phoneemail) { 
    7780                    $subject = explode($phoneemail_separator, $subject);