@param $sHtml
@param $sPlain

@return Mime\Message
496926
protected function getContentMessage($sHtml, $sPlain)
    {
        $oMessage = new Mime\Message();

        if ($sPlain != '') {
            $oPlain = new Mime\Part();
            $oPlain
                ->setContent($sPlain)
                ->setType(Mime\Mime::TYPE_TEXT)
                ->setCharset('UTF-8')
                ->setEncoding(Mime\Mime::ENCODING_QUOTEDPRINTABLE);

            $oMessage->addPart($oPlain);
        }

        if ($sHtml != '') {
            $oHtml = new Mime\Part();
            $oHtml
                ->setContent($sHtml)
                ->setType(Mime\Mime::TYPE_HTML)
                ->setCharset('UTF-8')
                ->setEncoding(Mime\Mime::ENCODING_QUOTEDPRINTABLE);

            $oMessage->addPart($oHtml);
        }

        return $oMessage;
    }
624753
protected function getItemHtmlMessage($exception)
    {
        $html = sprintf('<div><strong>Type:</strong> %s</div>', get_class($exception));
        
        if (($code = $exception->getCode())) {
            $html .= sprintf('<div><strong>Code:</strong> %s</div>', $code);
        }
        
        if (($message = $exception->getMessage())) {
            $html .= sprintf('<div><strong>Message:</strong> %s</div>', htmlentities($message));
        }
        
        if (($file = $exception->getFile())) {
            $html .= sprintf('<div><strong>File:</strong> %s</div>', $file);
        }
        
        if (($line = $exception->getLine())) {
            $html .= sprintf('<div><strong>Line:</strong> %s</div>', $line);
        }
        
        if (($trace = $exception->getTraceAsString())) {
            $html .= '<h2>Trace</h2>';
            $html .= sprintf('<pre>%s</pre>', htmlentities($trace));
        }
        
        return $html;
    }
378169
function(sHTML, sClassName) {
    var elCell = this._elMsgTd;
    if(lang.isString(sHTML)) {
        elCell.firstChild.innerHTML = sHTML;
    }
    if(lang.isString(sClassName)) {
        elCell.className = sClassName;
    }

    this._elMsgTbody.style.display = "";

    this.fireEvent("tableMsgShowEvent", {html:sHTML, className:sClassName});
    YAHOO.log("DataTable showing message: " + sHTML, "info", this.toString());
}
1137333
protected function setBodyWithAttachments(Mail\Message $oMessage, array $aAttachments, $sHtml, $sPlain)
    {
        $oContent = $this->getContentMessage($sHtml, $sPlain);

        $oContentPart = new Mime\Part($oContent->generateMessage());
        $oContentPart->setType(Mime\Mime::MULTIPART_ALTERNATIVE);
        $oContentPart->setBoundary($oContent->getMime()->boundary());

        $oBody = new Mime\Message();
        $oBody->addPart($oContentPart);

        foreach ($aAttachments as $aAttachmentData) {
            if (isset($aAttachmentData['file_path']) && is_readable($aAttachmentData['file_path'])) {
                $aAttachmentData['file_data'] = file_get_contents($aAttachmentData['file_path']);
            }

            if (isset($aAttachmentData['file_data']) && $aAttachmentData['file_data'] != '') {
                $oAttachment = new Mime\Part();
                $oAttachment
                    ->setContent($aAttachmentData['file_data'])
                    ->setType(Mime\Mime::TYPE_OCTETSTREAM)
                    ->setFileName($aAttachmentData['name'])
                    ->setDisposition(Mime\Mime::DISPOSITION_ATTACHMENT)
                    ->setEncoding(Mime\Mime::ENCODING_BASE64);

                $oBody->addPart($oAttachment);
            }
        }

        $oMessage->setBody($oBody);

        return $this;
    }
736670
public function toHtml($submitted = false, $blnSimpleLayout = false, $blnLabel = true, $blnDisplayErrors = true)
    {
        $strOutput = "";

        $intDynamicCount = $this->getDynamicCount();
        for ($intCount = 0; $intCount <= $intDynamicCount; $intCount ++) {
            $strOutput .= $this->__toHtml($submitted, $blnSimpleLayout, $blnLabel, $blnDisplayErrors, $intCount);
        }

        return $strOutput;
    }
874871
public function setHtml($html = null)
    {
        $html = trim($html);
        $this->html = 0 < strlen($html) ? $html : null;

        return $this;
    }
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;
    }
763400
private function processFile(SplFileInfo $file, $replaceExisting, $dryRun)
    {
        if ($file->isDir()) {
            return;
        }

        $tokens = token_get_all($file->getContents());

        $licenseTokenIndex = $this->getLicenseTokenIndex($tokens);

        if (null !== $licenseTokenIndex && true === $replaceExisting) {
            $this->removeExistingLicense($file, $tokens, $licenseTokenIndex, $dryRun);
        }

        if (null === $licenseTokenIndex || true === $replaceExisting) {
            $this->log(sprintf('<fg=green>[+]</> Adding license header for <options=bold>%s</>', $file->getRealPath()));

            if (true === $dryRun) {
                return;
            }

            $license = $this->getLicenseAsComment();
            $content = preg_replace('/<\?php/', '<?php' . PHP_EOL . PHP_EOL . $license, $file->getContents(), 1);
            file_put_contents($file->getRealPath(), $content);
        } else {
            $this->log(sprintf('<fg=cyan>[S]</> Skipping <options=bold>%s</>', $file->getRealPath()));
        }
    }
142827
public static function logout_file_session($spsessionid) {
        global $CFG;

        if (!empty($CFG->session_file_save_path)) {
            $dir = $CFG->session_file_save_path;
        } else {
            $dir = $CFG->dataroot . '/sessions';
        }

        if (is_dir($dir)) {
            if ($dh = opendir($dir)) {
                // Read all session files.
                while (($file = readdir($dh)) !== false) {
                    // Check if it is a file.
                    if (is_file($dir.'/'.$file)) {
                        // Read session file data.
                        $data = file($dir.'/'.$file);
                        if (isset($data[0])) {
                            $usersession = self::unserializesession($data[0]);
                            // Check if we have found session that shall be deleted.
                            if (isset($usersession['SESSION']) && isset($usersession['SESSION']->shibboleth_session_id)) {
                                // If there is a match, delete file.
                                if ($usersession['SESSION']->shibboleth_session_id == $spsessionid) {
                                    // Delete session file.
                                    if (!unlink($dir.'/'.$file)) {
                                        return new SoapFault('LogoutError', 'Could not delete Moodle session file.');
                                    }
                                }
                            }
                        }
                    }
                }
                closedir($dh);
            }
        }
    }
39928
public function actionShowSubmission(string $submissionId = null, string $siteHandle = null)
    {
        $query = new ContactFormSubmissionQuery(ContactFormSubmission::class);
        $query->id = $submissionId;

        /* @var ContactFormSubmission $submission */
        $submission = $query->one();

        $messageObject = ContactFormExtensions::$plugin->contactFormExtensionsService->utf8AllTheThings((array) json_decode($submission->message));
        $variables = [
            'submission'    => $submission,
            'siteHandle'    => $siteHandle,
            'messageObject' => $messageObject,
        ];

        return $this->renderTemplate('contact-form-extensions/submissions/_show', $variables);
    }
1162435
public function toHtml($submitted = false, $blnSimpleLayout = false, $blnLabel = true, $blnDisplayError = true)
    {
        // Call this before __getMetaString();
        $this->setConditionalMeta();

        $this->setMeta("class", "vf__paragraph");

        $strOutput = "<div{$this->__getMetaString()}>\n";

        // Add header if not empty.
        if (! empty($this->__header)) {
            $strOutput .= "<h3{$this->__getLabelMetaString()}>{$this->__header}</h3>\n";
        }

        if (! empty($this->__body)) {
            if (preg_match("/<p.*?>/", $this->__body) > 0) {
                $strOutput .= "{$this->__body}\n";
            } else {
                $strOutput .= "<p{$this->__getFieldMetaString()}>{$this->__body}</p>\n";
            }
        }

        $strOutput .= "</div>\n";

        return $strOutput;
    }
1307357
public HtmlEmailImpl setHtmlMsg(String aHtml) throws EmailException {
	if (StringUtil.isEmpty(aHtml)) {
	    throw new EmailException("Invalid message supplied");
	}
	this.html = aHtml;
	return this;
    }
862505
public static function create($errorMessageFile = '')
    {
        if (!isset(self::$instances[$errorMessageFile])) {
            self::$instances[$errorMessageFile] = new self($errorMessageFile);
        }
        return self::$instances[$errorMessageFile];
    }
1147338
public function transformSprintfToArray(FuncCall $sprintfFuncCall): ?Array_
    {
        /** @var Node[] $arrayItems */
        [$arrayItems, $stringArgument] = $this->splitMessageAndArgs($sprintfFuncCall);
        if (! $stringArgument instanceof String_) {
            // we need to know "%x" parts → nothing we can do
            return null;
        }

        if ($arrayItems === []) {
            return null;
        }

        $message = $stringArgument->value;
        $messageParts = $this->splitBySpace($message);

        foreach ($messageParts as $key => $messagePart) {
            $messageParts[$key] = Strings::match($messagePart, '#^%\w$#') ? array_shift($arrayItems) : new String_(
                $messagePart
            );
        }

        return new Array_($messageParts);
    }
1124189
public function setBreak($pCell = 'A1', $pBreak = PHPExcel_Worksheet::BREAK_NONE)
    {
        // Uppercase coordinate
        $pCell = strtoupper($pCell);

        if ($pCell != '') {
        	if ($pBreak == PHPExcel_Worksheet::BREAK_NONE) {
        		if (isset($this->_breaks[$pCell])) {
	            	unset($this->_breaks[$pCell]);
        		}
        	} else {
	            $this->_breaks[$pCell] = $pBreak;
	        }
        } else {
            throw new PHPExcel_Exception('No cell coordinate specified.');
        }

        return $this;
    }
894939
public function write($mask = '%s')
    {
        $content='';
        foreach ($this->get() as $entry) {
            $content .= $entry."\n";
        }
        $str = sprintf($mask, Html::writeHtmlTag('script', $content));
        return $str;
    }
1035257
public function GetDescriptionAsHTML()
    {
        $sText = trim($this->fieldDescription);
        $sText = TGlobal::OutHTML($sText);
        $sText = nl2br($sText);

        return $sText;
    }