roundcubemail/program/lib/Roundcube/rcube_imap_generic.php
public static function getStructurePartData($structure, $part)
    {
        $part_a = self::getStructurePartArray($structure, $part);
        $data   = array();

        if (empty($part_a)) {
            return $data;
        }

        // content-type
        if (is_array($part_a[0])) {
            $data['type'] = 'multipart';
        }
        else {
            $data['type']     = strtolower($part_a[0]);
            $data['encoding'] = strtolower($part_a[5]);

            // charset
            if (is_array($part_a[2])) {
               foreach ($part_a[2] as $key => $val) {
                    if (strcasecmp($val, 'charset') == 0) {
                        $data['charset'] = $part_a[2][$key+1];
                        break;
                    }
                }
            }
        }

        // size
        $data['size'] = intval($part_a[6]);

        return $data;
    }
public static function getStructurePartData($structure, $part)
    {
        $part_a = self::getStructurePartArray($structure, $part);
        $data   = array();

        if (empty($part_a)) {
            return $data;
        }

        // content-type
        if (is_array($part_a[0])) {
            $data['type'] = 'multipart';
        }
        else {
            $data['type']     = strtolower($part_a[0]);
            $data['encoding'] = strtolower($part_a[5]);

            // charset
            if (is_array($part_a[2])) {
               foreach ($part_a[2] as $key => $val) {
                    if (strcasecmp($val, 'charset') == 0) {
                        $data['charset'] = $part_a[2][$key+1];
                        break;
                    }
                }
            }
        }

        // size
        $data['size'] = intval($part_a[6]);

        return $data;
    }
public static function getStructurePartData ( $ structure , $ part ) { $ part_a = self :: getStructurePartArray ( $ structure , $ part ) ; $ data = array ( ) ; if ( empty ( $ part_a ) ) { return $ data ; } // content-type if ( is_array ( $ part_a [ 0 ] ) ) { $ data [ 'type' ] = 'multipart' ; } else { $ data [ 'type' ] = strtolower ( $ part_a [ 0 ] ) ; $ data [ 'encoding' ] = strtolower ( $ part_a [ 5 ] ) ; // charset if ( is_array ( $ part_a [ 2 ] ) ) { foreach ( $ part_a [ 2 ] as $ key => $ val ) { if ( strcasecmp ( $ val , 'charset' ) == 0 ) { $ data [ 'charset' ] = $ part_a [ 2 ] [ $ key + 1 ] ; break ; } } } } // size $ data [ 'size' ] = intval ( $ part_a [ 6 ] ) ; return $ data ; }
Returns data of a message part according to specified structure.

@param array  $structure Message structure (getStructure() result)
@param string $part      Message part identifier

@return array Part data as hash array (type, encoding, charset, size)
Returns data of a message part according to specified structure .