mirror of
https://github.com/friendica/friendica
synced 2025-04-27 06:30:12 +00:00
Replace x() by isset(), !empty() or defaults()
- Remove extraneous parentheses around empty() calls - Remove duplicate calls to intval(), count() or strlen() after empty() - Replace ternary operators outputting binary value with empty() return value - Rewrite defaults() without x()
This commit is contained in:
parent
ea4e772b1e
commit
458981f75c
101 changed files with 896 additions and 914 deletions
|
@ -1061,7 +1061,7 @@ class Contact extends BaseObject
|
|||
$update_contact = ($contact['avatar-date'] < DateTimeFormat::utc('now -7 days'));
|
||||
|
||||
// We force the update if the avatar is empty
|
||||
if (!x($contact, 'avatar')) {
|
||||
if (empty($contact['avatar'])) {
|
||||
$update_contact = true;
|
||||
}
|
||||
if (!$update_contact || $no_update) {
|
||||
|
@ -1618,7 +1618,7 @@ class Contact extends BaseObject
|
|||
return $result;
|
||||
}
|
||||
|
||||
if (x($arr['contact'], 'name')) {
|
||||
if (!empty($arr['contact']['name'])) {
|
||||
$ret = $arr['contact'];
|
||||
} else {
|
||||
$ret = Probe::uri($url, $network, $uid, false);
|
||||
|
@ -1664,16 +1664,15 @@ class Contact extends BaseObject
|
|||
}
|
||||
|
||||
// do we have enough information?
|
||||
|
||||
if (!((x($ret, 'name')) && (x($ret, 'poll')) && ((x($ret, 'url')) || (x($ret, 'addr'))))) {
|
||||
if (empty($ret['name']) || empty($ret['poll']) || (empty($ret['url']) && empty($ret['addr']))) {
|
||||
$result['message'] .= L10n::t('The profile address specified does not provide adequate information.') . EOL;
|
||||
if (!x($ret, 'poll')) {
|
||||
if (empty($ret['poll'])) {
|
||||
$result['message'] .= L10n::t('No compatible communication protocols or feeds were discovered.') . EOL;
|
||||
}
|
||||
if (!x($ret, 'name')) {
|
||||
if (empty($ret['name'])) {
|
||||
$result['message'] .= L10n::t('An author or name was not found.') . EOL;
|
||||
}
|
||||
if (!x($ret, 'url')) {
|
||||
if (empty($ret['url'])) {
|
||||
$result['message'] .= L10n::t('No browser URL could be matched to this address.') . EOL;
|
||||
}
|
||||
if (strpos($url, '@') !== false) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue