function getHtml($Recipient = null, $ZendMail = null) { $html = $this->html; $data = $Recipient ? unserialize($Recipient->data) : array(); qg::fire('mail::gethtml', array('Mail' => $this, 'Recipient' => $Recipient, 'html' => &$html, 'data' => &$data, 'ZendMail' => $ZendMail)); if ($data) { $T = new template($data); $html = $T->renderMarker($html); } if ($ZendMail) { // deprecated preg_match_all("#<img.*?src=['\"]file://([^'\"]+)#i", $html, $matches); $matches = array_unique($matches[1]); if ($matches) { $ZendMail->setType(Zend_Mime::MULTIPART_RELATED); foreach ($matches as $key => $filename) { if (!is_readable($filename) || !image::able($filename)) { continue; } $at = $ZendMail->createAttachment(file_get_contents($filename)); $at->type = extensionToMime(preg_replace('/.*\\.([^.]+$)/', '$1', $filename)); $at->disposition = Zend_Mime::DISPOSITION_INLINE; $at->id = 'i' . md5_file($filename); $html = str_replace('file://' . $filename, 'cid:' . $at->id, $html); trigger_error('error: auto inline images are deprecated!'); } } } return $html; }
$separator = $separator ? $separator : ' - '; $previewImage = $Cont->SET['preview image']->setType('bool')->v; if ($previewImage) { $previewImageQuery = $Cont->SET->make('preview image query', '/w-120/h-400/max/')->v; } foreach ($res as $id => $r) { $C = Page($id); $P = $C->Page; $href = $C->url(); ?> <div class=-item> <?php if ($previewImage) { foreach ($C->Files() as $F) { if (!image::able($F->path)) { continue; } echo '<a href="' . $href . '"><img src="' . $F->url() . '/' . $previewImageQuery . '/' . $F->name() . '"></a>'; break; } } ?> <a href="<?php echo $href; ?> " class=-title><?php echo (string) $C->Title() ? $C->Title() : $P->Title(); ?> </a>