本文整理汇总了PHP中Horde_Mime_Part::getMimeId方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Mime_Part::getMimeId方法的具体用法?PHP Horde_Mime_Part::getMimeId怎么用?PHP Horde_Mime_Part::getMimeId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde_Mime_Part
的用法示例。
在下文中一共展示了Horde_Mime_Part::getMimeId方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* Constructor.
*
* @param Horde_Mime_Part $mime_part A MIME part object. Must be of
* type multipart/related.
*/
public function __construct(Horde_Mime_Part $mime_part)
{
if ($mime_part->getType() != 'multipart/related') {
throw new InvalidArgumentException('MIME part must be of type multipart/related');
}
$ids = array_keys($mime_part->contentTypeMap());
$related_id = $mime_part->getMimeId();
$id = null;
/* Build a list of parts -> CIDs. */
foreach ($ids as $val) {
if (strcmp($related_id, $val) !== 0 && ($cid = $mime_part->getPart($val)->getContentId())) {
$this->_cids[$val] = $cid;
}
}
/* Look at the 'start' parameter to determine which part to start
* with. If no 'start' parameter, use the first part (RFC 2387
* [3.1]). */
$start = $mime_part->getContentTypeParameter('start');
if (!empty($start)) {
$id = $this->cidSearch($start);
}
if (empty($id)) {
reset($ids);
$id = next($ids);
}
$this->_start = $id;
}
示例2: addMimeAction
/**
* Adds a MIME Viewer action to the status text.
*
* @param string $action Action ID.
* @param string $text Action description.
* @param array $attr Additional attributes.
*/
public function addMimeAction($action, $text, array $attr = array())
{
$attr['mimevieweraction'] = $action;
if (!is_null($this->_part)) {
$attr['mimeviewerid'] = $this->_part->getMimeId();
}
$url = new Horde_Url('#');
$this->addText($url->link($attr) . $text . '</a>');
}
示例3: _getBodyPart
/**
* 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);
}
示例4: _addTreeNodes
/**
* Adds MIME parts to the tree instance.
*
* @param Horde_Tree_Renderer_Base tree A tree instance.
* @param Horde_Mime_Part $part The MIME part to add.
*/
protected function _addTreeNodes($tree, $part)
{
$mimeid = $part->getMimeId();
$summary_mask = self::SUMMARY_ICON_RAW | self::SUMMARY_DESCRIP_LINK | self::SUMMARY_SIZE | self::SUMMARY_DOWNLOAD;
if ($GLOBALS['prefs']->getValue('strip_attachments')) {
$summary_mask += self::SUMMARY_STRIP;
}
$summary = $this->getSummary($mimeid, $summary_mask);
$tree->addNode(array('id' => $mimeid, 'parent' => is_null($part->parent) ? null : $part->parent->getMimeId(), 'label' => sprintf('%s (%s) %s %s', $summary['description'], $summary['size'], $summary['download'], $summary['strip']), 'params' => array('class' => 'partsTreeDiv', 'icon' => $summary['icon'])));
}
示例5: subMimeStructToFlatStruct
/**
*
* @param unknown $struct
* @param unknown $partno
* @param unknown $outStruct
*/
public function subMimeStructToFlatStruct(Horde_Mime_Part $struct, &$outStruct)
{
$partno = $struct->getMimeId();
$outStruct[$partno] = array();
$outStruct[$partno]['type'] = $struct->getType(false);
$outStruct[$partno]['subtype'] = $struct->getSubType();
$outStruct[$partno]['content'] = $struct->getContents(array('stream' => false));
if ($v = $struct->getCharset()) {
$outStruct[$partno]['charset'] = $v;
}
if ($v = $struct->getName(false)) {
$outStruct[$partno]['name'] = $v;
}
if ($v = $struct->getSize(false)) {
$outStruct[$partno]['bytes'] = $v;
}
if ($v = $struct->getContentId()) {
$outStruct[$partno]['id'] = $v;
}
foreach ($struct->getParts() as $sStruct) {
$this->subMimeStructToFlatStruct($sStruct, $outStruct);
}
}
示例6: _renderReturn
/**
* Internal helper function to create render data array for a MIME Part
* object that only has a single part.
*
* @param string $data The rendered data.
* @param string $type The rendered type.
*
* @return array See render().
*/
protected function _renderReturn($data = null, $type = null)
{
return array($this->_mimepart->getMimeId() => array('data' => is_null($data) ? $this->_mimepart->getContents() : $data, 'status' => array(), 'type' => is_null($type) ? $this->_mimepart->getType() : $type));
}