PHPMailer::html2text()publicWP 1.0

Convert an HTML string into plain text. This is used by msgHTML(). Note - older versions of this function used a bundled advanced converter which was removed for license reasons in #232. Example usage:

//Use default conversion
$plain = $mail->html2text($html);
//Use your own custom converter
$plain = $mail->html2text($html, function($html) {
	$converter = new MyHtml2text($html);
	return $converter->get_text();

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

Хуков нет.




$PHPMailer = new PHPMailer();
$PHPMailer->html2text( $html, $advanced );
$html(строка) (обязательный)
The HTML text to convert
Any boolean value to use the internal converter, or provide your own callable for custom conversion.
Never pass user-supplied data into this parameter
По умолчанию: false

Код PHPMailer::html2text() WP 6.1.1

public function html2text($html, $advanced = false)
    if (is_callable($advanced)) {
        return call_user_func($advanced, $html);

    return html_entity_decode(
        trim(strip_tags(preg_replace('/<(head|title|style|script)[^>]*>.*?<\/\\1>/si', '', $html))),