本文整理汇总了PHP中Horde_Mime_Part::getParts方法的典型用法代码示例。如果您正苦于以下问题:PHP Horde_Mime_Part::getParts方法的具体用法?PHP Horde_Mime_Part::getParts怎么用?PHP Horde_Mime_Part::getParts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Horde_Mime_Part
的用法示例。
在下文中一共展示了Horde_Mime_Part::getParts方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: armorToPart
/**
* Converts armored input into a Horde_Mime_Part object.
*
* @param mixed $input Armored input.
* @param array $opts Additional options:
* - charset: (string) Charset of the armored input.
*
* @return mixed Either null if no PGP data was found, or a
* Horde_Mime_Part object.
*/
public function armorToPart($input, array $opts = array())
{
$opts = array_merge(array('charset' => 'UTF-8'), $opts);
$armor = Horde_Pgp_Armor::create($input);
$new_part = new Horde_Mime_Part();
$new_part->setType('multipart/mixed');
foreach ($armor as $val) {
switch (get_class($val)) {
case 'Horde_Pgp_Element_Text':
$part = new Horde_Mime_Part();
$part->setType('text/plain');
$part->setCharset($opts['charset']);
$part->setContents($val->message[0]->data);
$new_part[] = $part;
break;
case 'Horde_Pgp_Element_PrivateKey':
case 'Horde_Pgp_Element_PublicKey':
$part = new Horde_Mime_Part();
$part->setType('application/pgp-keys');
$part->setContents(strval($val));
$new_part[] = $part;
break;
case 'Horde_Pgp_Element_Message':
// TODO: Message can also be text or signature
$part = $this->_encryptBase($val);
$part->setMetadata(self::PGP_ARMOR, true);
$part['2']->setMetadata(self::PGP_CHARSET, isset($val->headers['Charset']) ? $val->headers['Charset'] : 'UTF-8');
$new_part[] = $part;
break;
case 'Horde_Pgp_Element_SignedMessage':
$part = $this->_signPart($val->text, $val->signature);
$new_part[] = $part;
break;
}
}
return count($new_part->getParts()) ? $new_part : null;
}
示例2: handleMultiPartMessage
/**
* @param \Horde_Mime_Part $part
* @param int $partNo
*/
private function handleMultiPartMessage($part, $partNo)
{
$i = 1;
foreach ($part->getParts() as $p) {
$this->getPart($p, "{$partNo}.{$i}");
$i++;
}
}
示例3: 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);
}
}
示例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 to the
* tree, including its sub-parts.
* @param string $parent The parent part's MIME id.
*/
protected function _addTreeNodes($tree, $part, $parent = null)
{
$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' => $parent, 'label' => sprintf('%s (%s) %s %s', $summary['description'], $summary['size'], $summary['download'], $summary['strip']), 'params' => array('class' => 'partsTreeDiv', 'icon' => $summary['icon'])));
foreach ($part->getParts() as $part) {
$this->_addTreeNodes($tree, $part, $mimeid);
}
}