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:
Hypolite Petovan 2018-11-30 09:06:22 -05:00
commit 458981f75c
101 changed files with 896 additions and 914 deletions

View file

@ -15,7 +15,7 @@ use Friendica\Util\Strings;
function wall_attach_post(App $a) {
$r_json = (x($_GET,'response') && $_GET['response']=='json');
$r_json = (!empty($_GET['response']) && $_GET['response']=='json');
if ($a->argc > 1) {
$nick = $a->argv[1];
@ -85,7 +85,7 @@ function wall_attach_post(App $a) {
killme();
}
if (! x($_FILES,'userfile')) {
if (empty($_FILES['userfile'])) {
if ($r_json) {
echo json_encode(['error' => L10n::t('Invalid request.')]);
}
@ -120,7 +120,7 @@ function wall_attach_post(App $a) {
if ($r_json) {
echo json_encode(['error' => $msg]);
} else {
echo $msg . EOL ;
echo $msg . EOL;
}
@unlink($src);
killme();
@ -144,7 +144,7 @@ function wall_attach_post(App $a) {
if ($r_json) {
echo json_encode(['error' => $msg]);
} else {
echo $msg . EOL ;
echo $msg . EOL;
}
killme();
}
@ -160,7 +160,7 @@ function wall_attach_post(App $a) {
if ($r_json) {
echo json_encode(['error' => $msg]);
} else {
echo $msg . EOL ;
echo $msg . EOL;
}
killme();
}