Example #1
0
 private function extractPart($part, $data)
 {
     switch ($part->encoding) {
         case '0':
             // 7bit
         // 7bit
         case '1':
             // 8 bit
         // 8 bit
         case '2':
             // binary
             break;
         case '3':
             // base 64
             //$this->body	= base64_decode($this->body);
             $data = base64_decode($data);
             break;
         case '4':
             // quoted-printable
             //$this->body	= quoted_printable_decode($this->body);
             $data = quoted_printable_decode($data);
             break;
         case '5':
             // other
         // other
         default:
             break;
     }
     $params = EasyblogMailboxMessage::getformatedParams($part);
     $encoding = 'UTF-8';
     if (isset($params['charset'])) {
         $encoding = $params['charset'];
     }
     $type = $part->type;
     $subtype = strtolower($part->subtype);
     $id = isset($part->id) ? $part->id : '';
     /*
      * Text
      */
     if ($type == 0 && $subtype == 'plain') {
         $this->plain_data .= EasyblogMailboxMessage::stringToUTF8($encoding, trim($data));
     } elseif ($type == 0 && $subtype == 'html') {
         $this->html_data .= EasyblogMailboxMessage::stringToUTF8($encoding, trim($data));
     } elseif ($type == 2) {
         $this->plain_data .= EasyblogMailboxMessage::stringToUTF8($encoding, trim($data));
     } elseif ($type == 5) {
         $image = array();
         $image['mime'] = $subtype;
         // GIF
         $image['data'] = $data;
         // binary
         $image['name'] = isset($params['name']) ? $params['name'] : $params['filename'];
         // 35D.gif
         $image['id'] = $id;
         // <*****@*****.**>
         $image['size'] = $part->bytes;
         $this->attachment[] = $image;
     }
     return;
 }