partIterator() public method

Returns the recursive iterator needed to iterate through this part.
Since: 2.8.0
public partIterator ( boolean $current = true ) : Iterator
$current boolean Include the current part as the base?
return Iterator Recursive iterator.
示例#1
0
 /**
  * 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');
     }
     $id = null;
     $ids = array();
     $related_id = $mime_part->getMimeId();
     /* Build a list of parts -> CIDs. */
     foreach ($mime_part->partIterator() as $val) {
         $part_id = $val->getMimeId();
         $ids[] = $part_id;
         if (strcmp($related_id, $part_id) !== 0 && ($cid = $val->getContentId())) {
             $this->_cids[$part_id] = $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]). */
     if ($start = $mime_part->getContentTypeParameter('start')) {
         $id = $this->cidSearch(trim($start, '<> '));
     }
     if (empty($id)) {
         reset($ids);
         $id = next($ids);
     }
     $this->_start = $id;
 }
示例#2
0
 /**
  */
 public function matchStructure(Horde_Mime_Part $data)
 {
     foreach ($data->partIterator() as $val) {
         if (IMP_Mime_Attachment::isAttachment($val)) {
             return true;
         }
     }
     return false;
 }
示例#3
0
文件: Contents.php 项目: horde/horde
 /**
  * Get download all list.
  *
  * @return array  An array of downloadable parts.
  */
 public function downloadAllList()
 {
     $ret = array();
     $this->_buildMessage();
     foreach ($this->_message->partIterator() as $val) {
         if ($val->isAttachment()) {
             $ret[] = $val->getMimeId();
         }
     }
     return $ret;
 }