_get_alt_message() protected method

Provides the raw message for use in plain-text headers of HTML-formatted emails. If the user hasn't specified his own alternative message it creates one by stripping the HTML
protected _get_alt_message ( ) : string
return string
Esempio n. 1
0
 protected function _get_alt_message()
 {
     $generate_alt_message = empty($this->alt_message);
     if ($generate_alt_message) {
         $protect_body = $this->_body;
         $html = str_get_html($this->_body, true, true, DEFAULT_TARGET_CHARSET, false);
         foreach ($html->find('a') as $a_tag) {
             if ($a_tag->plaintext != $a_tag->href) {
                 $a_tag_clone = clone $a_tag;
                 $a_tag_clone->innertext = $a_tag_clone->href;
                 $new_a_tag = $a_tag->innertext . '[' . $a_tag_clone . ']';
                 $a_tag->outertext = $new_a_tag;
                 unset($a_tag_clone);
             }
         }
         $this->_body = $html->__toString();
     }
     $output = parent::_get_alt_message();
     if ($generate_alt_message) {
         $output = html_entity_decode($output);
         $this->_body = $protect_body;
     }
     return $output;
 }