Make WordPress Core


Ignore:
Timestamp:
04/27/2009 04:17:24 PM (17 years ago)
Author:
ryan
Message:

Eliminate preg_replace with /e. Props tbaboon. fixes #8689

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-phpmailer.php

    r10459 r11098  
    14041404
    14051405  /**
     1406   * Callback for converting to "=XX".
     1407   * @access private
     1408   * @return string
     1409   */
     1410  function EncodeQ_callback ($matches) {
     1411    return "=".sprintf("%02X", ord($matches[1]));
     1412  }
     1413
     1414  /**
    14061415   * Encode string to q encoding.
    14071416   * @access private
    … …  
    14141423    switch (strtolower($position)) {
    14151424      case 'phrase':
    1416         $encoded = preg_replace("/([^A-Za-z0-9!*+\/ -])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
     1425        $encoded = preg_replace_callback("/([^A-Za-z0-9!*+\/ -])/",
     1426                                         "EncodeQ_callback", $encoded);
    14171427        break;
    14181428      case 'comment':
    1419         $encoded = preg_replace("/([\(\)\"])/e", "'='.sprintf('%02X', ord('\\1'))", $encoded);
     1429        $encoded = preg_replace_callback("/([\(\)\"])/",
     1430                                         "EncodeQ_callback", $encoded);
     1431        break;
    14201432      case 'text':
    14211433      default:
    14221434        /* Replace every high ascii, control =, ? and _ characters */
    1423         $encoded = preg_replace('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/e',
    1424               "'='.sprintf('%02X', ord('\\1'))", $encoded);
     1435        $encoded = preg_replace_callback('/([\000-\011\013\014\016-\037\075\077\137\177-\377])/',
     1436                                         "EncodeQ_callback", $encoded);
    14251437        break;
    14261438    }
Note: See TracChangeset for help on using the changeset viewer.