Get vcard data for specified contact
498953
private function get_contact_vcard($source, $cid, &$filename = null)
    {
        $rcmail  = rcmail::get_instance();
        $source  = $rcmail->get_address_book($source);
        $contact = $source->get_record($cid, true);

        if ($contact) {
            $fieldmap = $source ? $source->vcard_map : null;

            if (empty($contact['vcard'])) {
                $vcard = new rcube_vcard('', RCUBE_CHARSET, false, $fieldmap);
                $vcard->reset();

                foreach ($contact as $key => $values) {
                    list($field, $section) = explode(':', $key);
                    // avoid unwanted casting of DateTime objects to an array
                    // (same as in rcube_contacts::convert_save_data())
                    if (is_object($values) && is_a($values, 'DateTime')) {
                        $values = array($values);
                    }

                    foreach ((array) $values as $value) {
                        if (is_array($value) || is_a($value, 'DateTime') || @strlen($value)) {
                            $vcard->set($field, $value, strtoupper($section));
                        }
                    }
                }

                $contact['vcard'] = $vcard->export();
            }

            $name     = rcube_addressbook::compose_list_name($contact);
            $filename = (self::parse_filename($name) ?: 'contact') . '.vcf';

            // fix folding and end-of-line chars
            $vcard = preg_replace('/\r|\n\s+/', '', $contact['vcard']);
            $vcard = preg_replace('/\n/', rcube_vcard::$eol, $vcard);

            return rcube_vcard::rfc2425_fold($vcard) . rcube_vcard::$eol;
        }
    }
159951
public function load($vcard, $charset = RCUBE_CHARSET, $detect = false)
    {
        self::$values_decoded = false;
        $this->raw = self::vcard_decode(self::cleanup($vcard));

        // resolve charset parameters
        if ($charset == null) {
            $this->raw = self::charset_convert($this->raw);
        }
        // vcard has encoded values and charset should be detected
        else if ($detect && self::$values_decoded
            && ($detected_charset = self::detect_encoding(self::vcard_encode($this->raw)))
            && $detected_charset != RCUBE_CHARSET
        ) {
            $this->raw = self::charset_convert($this->raw, $detected_charset);
        }

        // find well-known address fields
        $this->displayname  = $this->raw['FN'][0][0];
        $this->surname      = $this->raw['N'][0][0];
        $this->firstname    = $this->raw['N'][0][1];
        $this->middlename   = $this->raw['N'][0][2];
        $this->nickname     = $this->raw['NICKNAME'][0][0];
        $this->organization = $this->raw['ORG'][0][0];
        $this->business     = ($this->raw['X-ABSHOWAS'][0][0] == 'COMPANY') || (join('', (array)$this->raw['N'][0]) == '' && !empty($this->organization));

        foreach ((array)$this->raw['EMAIL'] as $i => $raw_email) {
            $this->email[$i] = is_array($raw_email) ? $raw_email[0] : $raw_email;
        }

        // make the pref e-mail address the first entry in $this->email
        $pref_index = $this->get_type_index('EMAIL', 'pref');
        if ($pref_index > 0) {
            $tmp = $this->email[0];
            $this->email[0] = $this->email[$pref_index];
            $this->email[$pref_index] = $tmp;
        }

        // fix broken vcards from Outlook that only supply ORG but not the required N or FN properties
        if (!strlen(trim($this->displayname . $this->surname . $this->firstname)) && strlen($this->organization)) {
            $this->displayname = $this->organization;
        }
    }
693168
def _get_ex_data(self):
        """"""
        func_id, func_name = self._get_callable_path()
        if self._full_cname:
            func_name = self.encode_call(func_name)
        return func_id, func_name
778731
def context(self):
        
        type = "client_associate" if self.key is None else "client_update"
        data = {
            "type": type,
            "application_type": self.type,
        }

        # is this an update?
        if self.key:
            data["client_id"] = self.key
            data["client_secret"] = self.secret

        # Add optional params
        if self.name:
            data["application_name"] = self.name

        if self.logo:
            data["logo_url"] = self.logo

        if self.contacts:
            # space seporated list
            data["contacts"] = " ".join(self.contacts)

        if self.redirect:
            data["redirect_uri"] = " ".join(self.redirect)

        # Convert to JSON  and send
        return json.dumps(data)
98233
def do_contact_person_info(ava):
    """"""
    cper = md.ContactPerson()
    cper.loadd(ava)
    if not cper.contact_type:
        cper.contact_type = "technical"
    return cper
1200054
def SetVcardField(new_vcard, field_name, values):
    """"""
    for val in values:
        new_field = new_vcard.add(field_name)
        new_field.value = val.value
        if val.params:
            new_field.params = val.params
    return new_vcard
43326
def get_details(self):
        
        data = []
        if isinstance(self.model, vCenterCloneVMFromVMResourceModel):
            data.append(VmDetailsProperty(key='Cloned VM Name', value=self.model.vcenter_vm))

        if isinstance(self.model, VCenterDeployVMFromLinkedCloneResourceModel):
            template = self.model.vcenter_vm
            snapshot = self.model.vcenter_vm_snapshot
            data.append(VmDetailsProperty(key='Cloned VM Name',value= '{0} (snapshot: {1})'.format(template, snapshot)))

        if isinstance(self.model, vCenterVMFromImageResourceModel):
            data.append(VmDetailsProperty(key='Base Image Name', value=self.model.vcenter_image.split('/')[-1]))

        if isinstance(self.model, vCenterVMFromTemplateResourceModel):
            data.append(VmDetailsProperty(key='Template Name', value=self.model.vcenter_template))

        return data
914440
def get_app_data(app_id):
    
    try:
        conn = get_conn()
        c = conn.cursor()
        c.execute("SELECT id,name,app_data FROM app WHERE id='{0}' ".format(app_id))
        result = c.fetchone()
        conn.close()

        if result:
            appname = result[1]
            app_data = utils.str2dict( base64.b64decode(result[2]) )

            return (appname,app_data)
        else:
            return (None,None)

    except Exception,e:
        raise RuntimeError('get app data failed! %s' % e)
486895
function _findVcards(content) {
    var vcardChildDepth = 0, fields;
    var vcards = [], vcard;
    var parser = Sax.parser();
    parser.onopentag = function(node) {
	if (node.attributes['class'] &&
	    node.attributes['class'].search(/(^|\s)vcard(\s|$)/i)>=0) {

	    vcardChildDepth = 1;
	    vcards.push(vcard = {});
	} else if (vcardChildDepth > 0) {
	    vcardChildDepth++;
	}

	if (vcardChildDepth > 0) {
	    fields = node.attributes['class'] &&
		node.attributes['class'].split(/\s/).filter(function(field) {
		    return elements.indexOf(field);
		}) ||
		[];
	}
    };
    parser.ontext = function(s) {
	if (vcardChildDepth > 0) {
	    fields.forEach(function(field) {
		vcard[field] = s.trim();
	    });
	}
    };
    parser.onclosetag = function() {
	if (vcardChildDepth > 0)
	    vcardChildDepth--;
    };

    parser.write(content).close();
    return vcards;
}
1307885
def get_vcl(self, service_id, version_number, name, include_content=True):
		""""""
		content = self._fetch("/service/%s/version/%d/vcl/%s?include_content=%d" % (service_id, version_number, name, int(include_content)))
		return FastlyVCL(self, content)
593824
public function getContactData($addressData, $contact)
    {
        $result = array();
        // if account is set, take account's name
        if ($addressData && isset($addressData['firstName']) && isset($addressData['lastName'])) {
            $result['firstName'] = $addressData['firstName'];
            $result['lastName'] = $addressData['lastName'];
            $result['fullName'] = $result['firstName'] . ' ' . $result['lastName'];
            if (isset($addressData['title'])) {
                $result['title'] = $addressData['title'];
            }
            if (isset($addressData['salutation'])) {
                $result['salutation'] = $addressData['salutation'];
            }
        } else {
            if ($contact) {
                $result['firstName'] = $contact->getFirstName();
                $result['lastName'] = $contact->getLastName();
                $result['fullName'] = $contact->getFullName();
                $result['salutation'] = $contact->getFormOfAddress();
                if ($contact->getTitle() !== null) {
                    $result['title'] = $contact->getTitle()->getTitle();
                }
            } else {
                throw new MissingOrderAttributeException('firstName, lastName or contact');
            }
        }

        return $result;
    }
1227884
def get_contact_info(self, obj):
        

        info = self.get_base_info(obj)
        fullname = obj.getFullname()
        email = obj.getEmailAddress()

        # Note: It might get a circular dependency when calling:
        #       map(self.get_contact_info, obj.getCCContact())
        cccontacts = {}
        for contact in obj.getCCContact():
            uid = api.get_uid(contact)
            fullname = contact.getFullname()
            email = contact.getEmailAddress()
            cccontacts[uid] = {
                "fullname": fullname,
                "email": email
            }

        info.update({
            "fullname": fullname,
            "email": email,
            "cccontacts": cccontacts,
        })

        return info
1013154
public static synchronized VCardManager getInstanceFor(XMPPConnection connection) {
        VCardManager vcardManager = INSTANCES.get(connection);
        if (vcardManager == null) {
            vcardManager = new VCardManager(connection);
            INSTANCES.put(connection, vcardManager);
        }
        return vcardManager;
    }
531594
function(apiKey, contactList, fromAddress,
        toAddress, ccAddresses, bccAddresses, contentType, subject, htmlBody,
        textBody, _templateId) {}
486953
def to_array(self):
        
        array = super(InputContactMessageContent, self).to_array()
        array['phone_number'] = u(self.phone_number)  # py2: type unicode, py3: type str
        array['first_name'] = u(self.first_name)  # py2: type unicode, py3: type str
        if self.last_name is not None:
            array['last_name'] = u(self.last_name)  # py2: type unicode, py3: type str
        if self.vcard is not None:
            array['vcard'] = u(self.vcard)  # py2: type unicode, py3: type str
        return array
826986
def get_user_contact_lists_contacts(self, id, contact_list_id, **data):
        
        
        return self.get("/users/{0}/contact_lists/{0}/contacts/".format(id,contact_list_id), data=data)
14247
static function vcard_encode($data)
    {
        foreach ((array)$data as $type => $entries) {
            // valid N has 5 properties
            while ($type == "N" && is_array($entries[0]) && count($entries[0]) < 5) {
                $entries[0][] = "";
            }

            // make sure FN is not empty (required by RFC2426)
            if ($type == "FN" && empty($entries)) {
                $entries[0] = $data['EMAIL'][0][0];
            }

            foreach ((array)$entries as $entry) {
                $attr = '';
                if (is_array($entry)) {
                    $value = array();
                    foreach ($entry as $attrname => $attrvalues) {
                        if (is_int($attrname)) {
                            if (!empty($entry['base64']) || $entry['encoding'] == 'B') {
                                $attrvalues = base64_encode($attrvalues);
                            }
                            $value[] = $attrvalues;
                        }
                        else if (is_bool($attrvalues)) {
                            // true means just a tag, not tag=value, as in PHOTO;BASE64:...
                            if ($attrvalues) {
                                // vCard v3 uses ENCODING=b (#1489183)
                                if ($attrname == 'base64') {
                                    $attr .= ";ENCODING=b";
                                }
                                else {
                                    $attr .= strtoupper(";$attrname");
                                }
                            }
                        }
                        else {
                            foreach ((array)$attrvalues as $attrvalue) {
                                $attr .= strtoupper(";$attrname=") . self::vcard_quote($attrvalue, ',');
                            }
                        }
                    }
                }
                else {
                    $value = $entry;
                }

                // skip empty entries
                if (self::is_empty($value)) {
                    continue;
                }

                $vcard .= self::vcard_quote($type) . $attr . ':' . self::vcard_quote($value) . self::$eol;
            }
        }

        return 'BEGIN:VCARD' . self::$eol . 'VERSION:3.0' . self::$eol . $vcard . 'END:VCARD';
    }