$apcontact['pubkey'] = null;
if (!empty($compacted['w3id:publicKey'])) {
- $apcontact['pubkey'] = trim(JsonLD::fetchElement($compacted['w3id:publicKey'], 'w3id:publicKeyPem', '@value'));
- if (strstr($apcontact['pubkey'], 'RSA ')) {
+ $apcontact['pubkey'] = trim(JsonLD::fetchElement($compacted['w3id:publicKey'], 'w3id:publicKeyPem', '@value') ?? '');
+ if (strpos($apcontact['pubkey'], 'RSA ') !== false) {
$apcontact['pubkey'] = Crypto::rsaToPem($apcontact['pubkey']);
}
}
XML::addElement($doc, $author, 'poco:utcOffset', DateTimeFormat::timezoneNow($profile['timezone'], 'P'));
- if (trim($profile['homepage']) != '') {
+ if (trim($profile['homepage'])) {
$urls = $doc->createElement('poco:urls');
XML::addElement($doc, $urls, 'poco:type', 'homepage');
XML::addElement($doc, $urls, 'poco:value', $profile['homepage']);
$author->appendChild($urls);
}
- if (trim($profile['pub_keywords']) != '') {
+ if (trim($profile['pub_keywords'] ?? '')) {
$keywords = explode(',', $profile['pub_keywords']);
foreach ($keywords as $keyword) {
}
}
- if (trim($profile['xmpp']) != '') {
+ if (trim($profile['xmpp'])) {
$ims = $doc->createElement('poco:ims');
XML::addElement($doc, $ims, 'poco:type', 'xmpp');
XML::addElement($doc, $ims, 'poco:value', $profile['xmpp']);
$author->appendChild($ims);
}
- if (trim($profile['locality'] . $profile['region'] . $profile['country-name']) != '') {
+ if (trim($profile['locality'] . $profile['region'] . $profile['country-name'])) {
$element = $doc->createElement('poco:address');
XML::addElement($doc, $element, 'poco:formatted', Profile::formatLocation($profile));