PHPMailer\PHPMailer

PHPMailer::quotedString()public staticWP 1.0

If a string contains any "special" characters, double-quote the name, and escape any double quotes with a backslash.

Метод класса: PHPMailer{}

Хуков нет.

Возвращает

Строку.

Использование

$result = PHPMailer::quotedString( $str );
$str(строка) (обязательный)
-

Заметки

  • Смотрите: RFC822 3.4.1

Код PHPMailer::quotedString() WP 6.4.3

public static function quotedString($str)
{
    if (preg_match('/[ ()<>@,;:"\/\[\]?=]/', $str)) {
        //If the string contains any of these chars, it must be double-quoted
        //and any double quotes must be escaped with a backslash
        return '"' . str_replace('"', '\\"', $str) . '"';
    }

    //Return the string untouched, it doesn't need quoting
    return $str;
}