Prev | Current Page 262 | Next

Rob Allen, Nick Lo, and Steven Brown

"Zend Framework in Action"


Listing 9.14: Adding filtering to our support email processing code
$filterStripTags = new Zend_Filter_StripTags;
$filterFormat = new Zend_Filter;
$filterFormat->addFilter(new Zend_Filter_StripTags)
->addFilter(new Places_Filter_Markdown);
Licensed to Menshu You
Zend Framework in Action (Ch010) Manning Publications Co. 17
foreach ($mail as $messageNum => $message) {
$part = $message;
while ($part->isMultipart()) {
$part = $message->getPart(1);
}
if (strtok($part->contentType, ';') == 'text/plain') {
$plainTextContent = $filterStripTags->filter(
$part->getContent());
}
$newSupport = $this->_supportTable->createRow();
$newSupport->priority = isset($message->xPriority) ?
$message->xPriority : 3;
$newSupport->status = 'open';
$newSupport->title = $filterStripTags->filter(
$message->subject);
$newSupport->date_created = date('Y-m-d H:i:s');
$newSupport->body = $plainTextContent;
$newSupport->body_formatted = $filterFormat->filter(
$plainTextContent);
$newSupport->reported_by = $filterStripTags->filter(
$message->from);
$id = $newSupport->save();
$messageString = '';
foreach ($message->getHeaders() as $name => $value) {
$messageString .= $name . ': ' . $value . "\n";
}
$messageString .= "\n" . $message->getContent();
file_put_contents(getcwd() .


Pages:
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274
Athlete biuro rachunkowe gdaƄsk geovision ABC mapy polski