public function getBodyPartSize($id) { return isset($this->_data[Horde_Imap_Client::FETCH_BODYPARTSIZE][$id]) ? $this->_data[Horde_Imap_Client::FETCH_BODYPARTSIZE][$id] : null; }
/** * Build the data needed for the BodyPart part. * * @param Horde_Imap_Client_Data_Fetch $data The FETCH results. * @param Horde_Mime_Part $mime The plaintext MIME part. * @param boolean $to_html If true, $id is assumed to be a text/plain * part and is converted to html. * * @return array The BodyPart data. * - charset: (string) The charset of the text. * - body: (string) The body text. * - truncated: (boolean) True if text was truncated. * - size: (integer) The original part size, in bytes. */ protected function _getBodyPart(Horde_Imap_Client_Data_Fetch $data, Horde_Mime_Part $mime, $to_html) { $id = $mime->getMimeId(); $text = $data->getBodyPart($id); if (!$data->getBodyPartDecode($id)) { $mime->setContents($text); $text = $mime->getContents(); } if ($to_html) { $text = Horde_Text_Filter::filter($text, 'Text2html', array('parselevel' => Horde_Text_Filter_Text2html::MICRO, 'charset' => $mime->getCharset())); $size = strlen($text); } else { $size = !is_null($data->getBodyPartSize($id)) ? $data->getBodyPartSize($id) : strlen($text); } if (!empty($this->_options['bodypartprefs']['truncationsize'])) { $text = Horde_String::substr($text, 0, $this->_options['bodypartprefs']['truncationsize'], $mime->getCharset()); } return array('charset' => $mime->getCharset(), 'body' => $text, 'truncated' => $size > strlen($text), 'size' => $size); }