Return Zend_Mime_Part representing body HTML

@param  bool $htmlOnly Whether to return the body HTML only, or the MIME part; defaults to false, the MIME part
@return false|Zend_Mime_Part|string
779561
public function getBodyHtml($htmlOnly = false)
    {
        if ($htmlOnly && $this->_bodyHtml) {
            $body = $this->_bodyHtml;
            return $body->getContent();
        }

        return $this->_bodyHtml;
    }
974617
public function _render($textOnly) {
        $tracingLinkNum = count($this->tracingLinks);
        $str = "";

        if ($textOnly) {
            $str .= "\nFeature Traceability\n====================\n" .
                 "The following $tracingLinkNum tracing links were found:\n\n";
            $maxLen = fphp\Helper\_String::getMaxLength($this->tracingLinks, "getFeatureName")
                    + fphp\Helper\_String::getMaxLength($this->tracingLinks, "getType");
            foreach ($this->tracingLinks as $tracingLink)
                $str .= $this->analyzeTracingLink($tracingLink, true, $maxLen);
        } else {
            $str .= "<h2>Feature Traceability</h2>";
            $str .= "<p>The following $tracingLinkNum tracing links were found:</p>";
            $str .= "<table cellpadding='2'>";
            $str .= "<tr align='left'><th>Feature</th><th>Type</th><th>Source</th><th>Target</th></tr>";
            foreach ($this->tracingLinks as $tracingLink)
                $str .= $this->analyzeTracingLink($tracingLink);
            $str .= "</table>";
        }
        
        return $str;
    }
740811
public static function getFlagIcon($region, $filePathOnly = false)
    {
        $val = \Core::make('helper/validation/strings');
        if ($val->alphanum($region, false, true)) {
            $region = h(strtolower($region));
        } else {
            $region = false;
        }

        if ($region) {
            $v = \View::getInstance();

            if ($v->getThemeDirectory() != '' && file_exists(
                $v->getThemeDirectory() . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png'
            )) {
                $icon = $v->getThemePath() . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png';
            } elseif (file_exists(
                DIR_APPLICATION . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png'
            )) {
                $icon = REL_DIR_APPLICATION . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png';
            } else {
                $icon = ASSETS_URL . '/' . DIRNAME_IMAGES . '/' . DIRNAME_IMAGES_LANGUAGES . '/' . $region . '.png';
            }

            if (isset($icon)) {
                if ($filePathOnly) {
                    return $icon;
                } else {
                    $img = new Image($icon, $region, ['id' => 'ccm-region-flag-' . $region, 'class' => 'ccm-region-flag']);
                    return $img;
                }
            }
        }
    }
924028
public function getCustomHTMLBody($callback = false) {
        $body = $this->getHtmlBody();
        if($body === null) return null;

        if ($callback !== false) {
            $aAttachment = $this->parent->getAttachments();
            $aAttachment->each(function($oAttachment) use(&$body, $callback) {
                /** @var Attachment $oAttachment */
                if(is_callable($callback)) {
                    $body = $callback($body, $oAttachment);
                }elseif(is_string($callback)) {
                    call_user_func($callback, [$body, $oAttachment]);
                }
            });
        }

        return $body;
    }
149135
public function bbToHtml($bbcode)
    {
        if (empty($bbcode)) {
            $em = \MUtil_Html::create('em');
            $em->raw($this->_('&laquo;empty&raquo;'));

            return $em;
        }

        $text = \MUtil_Markup::render($bbcode, 'Bbcode', 'Html');

        $div = \MUtil_Html::create('div', array('class' => 'mailpreview'));
        $div->raw($text);

        return $div;
    }
352461
public function __toHtml($submitted = false, $blnSimpleLayout = false)
    {
        if (! $blnSimpleLayout) {
            // Call this right before __getMetaString();
            $this->setConditionalMeta();

            $strOutput = str_replace("[[metaString]]", $this->__getMetaString(), $this->__body);
        } else {
            $this->setMeta("class", "vf__multifielditem");
            $strOutput = "<div " . $this->__getMetaString() . "><span>{$this->__body}</span></div>\n";
        }

        return $strOutput;
    }
1331016
function getHtmlInnerBody($pHtml)
    {
        $returnValue = NULL;
        if (gettype($pHtml) === "string") {
            $start = strpos($pHtml, "<body");
            $start = strpos($pHtml, '>', $start + 5) + 1;
            $end = strpos($pHtml, "</body>", $start) - $start;
            $returnValue = substr($pHtml, $start, $end);
        }
        return $returnValue;
    }
146739
public function _render($textOnly) {
        $str = "";
        if ($textOnly)
            $str .= "\nModel Analysis\n==============\n";
        else
            $str .= "<h2>Model Analysis</h2>";
        $str .= $this->analyzeModel($this->configuration->getModel(), $textOnly);
        if ($textOnly)
            $str .= "\nConfiguration Analysis\n======================\n";
        else
            $str .= "</td><td valign='top'><h2>Configuration Analysis</h2>";
        $str .= $this->analyzeConfiguration($this->configuration, $textOnly);
        return $str;
    }
696962
public function metaCanonical($url = null, $full = false) {
		$canonical = $this->Url->build($url, $full);
		$options = ['rel' => 'canonical', 'link' => $canonical];
		return $this->Html->meta($options);
	}
1137330
public function render($plainOnly = false)
    {
        if ($existingPlainPart = $this->findPlainPart()) {
            $this->getSwiftMessage()->detach($existingPlainPart);
        }
        unset($existingPlainPart);

        // Respect explicitly set body
        $htmlPart = $plainOnly ? null : $this->getBody();
        $plainPart = $plainOnly ? $this->getBody() : null;

        // Ensure we can at least render something
        $htmlTemplate = $this->getHTMLTemplate();
        $plainTemplate = $this->getPlainTemplate();
        if (!$htmlTemplate && !$plainTemplate && !$plainPart && !$htmlPart) {
            return $this;
        }

        // Do not interfere with emails styles
        Requirements::clear();
        
        // Render plain part
        if ($plainTemplate && !$plainPart) {
            $plainPart = $this->renderWith($plainTemplate, $this->getData());
        }

        // Render HTML part, either if sending html email, or a plain part is lacking
        if (!$htmlPart && $htmlTemplate && (!$plainOnly || empty($plainPart))) {
            $htmlPart = $this->renderWith($htmlTemplate, $this->getData());
        }

        // Plain part fails over to generated from html
        if (!$plainPart && $htmlPart) {
            /** @var DBHTMLText $htmlPartObject */
            $htmlPartObject = DBField::create_field('HTMLFragment', $htmlPart);
            $plainPart = $htmlPartObject->Plain();
        }
        
        // Rendering is finished
        Requirements::restore();

        // Fail if no email to send
        if (!$plainPart && !$htmlPart) {
            return $this;
        }

        // Build HTML / Plain components
        if ($htmlPart && !$plainOnly) {
            $this->setBody($htmlPart);
            $this->getSwiftMessage()->setContentType('text/html');
            $this->getSwiftMessage()->setCharset('utf-8');
            if ($plainPart) {
                $this->getSwiftMessage()->addPart($plainPart, 'text/plain', 'utf-8');
            }
        } else {
            if ($plainPart) {
                $this->setBody($plainPart);
            }
            $this->getSwiftMessage()->setContentType('text/plain');
            $this->getSwiftMessage()->setCharset('utf-8');
        }

        return $this;
    }
707123
public static function to_html($body)
    {
        $body = str_replace('<<','&lt;',$body);
        $body = self::convert_newlines($body);
        $body = str_replace("\n", '<br>', $body);
        $body = self::convert_formatting($body);
        $body = self::convert_color($body);
        $body = self::convert_font($body);
        $body = self::convert_excerpt($body);
        //$body = nl2br($body);

        return $body;
    }
650769
public function body(string $body, bool $isHTML = false, string $alternativeText = null)
    {
        $this->body = is_object($body) && method_exists($body, '__toString') ? $body->__toString() : $body;
        $this->isHTML = $isHTML;
        $this->alternativeText = $alternativeText;
        return $this;
    }
1218513
protected function buildHtmlPart()
    {
        if ($this->bodyHTML === false) {
            $result = null;
        } else {
            $html = new MimePart($this->bodyHTML);
            $html->setType(Mime::TYPE_HTML);
            $html->setCharset(APP_CHARSET);
            $inlineAttachments = [];
            foreach ($this->attachments as $attachment) {
                if ($this->isInlineAttachment($attachment)) {
                    $inlineAttachments[] = $attachment;
                }
            }
            if (empty($inlineAttachments)) {
                $result = $html;
            } else {
                $related = new MimeMessage();
                $related->addPart($html);
                foreach ($inlineAttachments as $inlineAttachment) {
                    $related->addPart($inlineAttachment);
                }
                $result = new MimePart($related->generateMessage());
                $result->setType(Mime::MULTIPART_RELATED);
                $result->setBoundary($related->getMime()->boundary());
            }
        }

        return $result;
    }
1301621
public function getResponseBody($encodeEntities = true)
    {
        $body = (string) $this->getResponse()->getBody();

        if ($encodeEntities) {
            return htmlentities($body);
        }

        return $body;
    }
504915
public function html() {
    if (($el = $this->getElement()) === NULL) return NULL;
    
    return implode('',xml::export($el->childNodes));
  }
110846
public function html($plain, $nice = false)
    {
        $paragraphs = explode("\n\n", trim($plain));

        $html = '';

        if (count($paragraphs) == 1) {
            return nl2br(trim($paragraphs[0]));
        }

        foreach ($paragraphs as $paragraph) {
            $html .= '<p>'.nl2br(trim($paragraph)).'</p>';
        }

        return $html;
    }
889488
public function getMsgBody()
    {
        $body = null;

        if (!empty($this->_parts)) {
            if (count($this->_parts) > 1) {
                foreach ($this->_parts as $part) {
                    if ($part->contentType != Content::CT_TEXT_PLAIN && $this->getHeaders()->getMessageContentType() == Content::CT_MULTIPART_ALTERNATIVE) {
                        $body = $part->getContentDecode();
                        break;
                    }

                    $body .= PHP_EOL.$part->getContentDecode();
                }
            } else {
                $body = $this->_parts[0]->getContentDecode();
            }
        }

        return $body;
    }