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
|
@ -36,7 +36,7 @@ class Emailer
|
|||
Addon::callHooks('emailer_send_prepare', $params);
|
||||
|
||||
$email_textonly = false;
|
||||
if (x($params, "uid")) {
|
||||
if (!empty($params['uid'])) {
|
||||
$email_textonly = PConfig::get($params['uid'], "system", "email_textonly");
|
||||
}
|
||||
|
||||
|
|
|
@ -121,7 +121,7 @@ class Network
|
|||
|
||||
@curl_setopt($ch, CURLOPT_HEADER, true);
|
||||
|
||||
if (x($opts, "cookiejar")) {
|
||||
if (!empty($opts['cookiejar'])) {
|
||||
curl_setopt($ch, CURLOPT_COOKIEJAR, $opts["cookiejar"]);
|
||||
curl_setopt($ch, CURLOPT_COOKIEFILE, $opts["cookiejar"]);
|
||||
}
|
||||
|
@ -130,7 +130,7 @@ class Network
|
|||
// @curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||
// @curl_setopt($ch, CURLOPT_MAXREDIRS, 5);
|
||||
|
||||
if (x($opts, 'accept_content')) {
|
||||
if (!empty($opts['accept_content'])) {
|
||||
curl_setopt(
|
||||
$ch,
|
||||
CURLOPT_HTTPHEADER,
|
||||
|
@ -156,15 +156,15 @@ class Network
|
|||
/// @todo We could possibly set this value to "gzip" or something similar
|
||||
curl_setopt($ch, CURLOPT_ENCODING, '');
|
||||
|
||||
if (x($opts, 'headers')) {
|
||||
if (!empty($opts['headers'])) {
|
||||
@curl_setopt($ch, CURLOPT_HTTPHEADER, $opts['headers']);
|
||||
}
|
||||
|
||||
if (x($opts, 'nobody')) {
|
||||
if (!empty($opts['nobody'])) {
|
||||
@curl_setopt($ch, CURLOPT_NOBODY, $opts['nobody']);
|
||||
}
|
||||
|
||||
if (x($opts, 'timeout')) {
|
||||
if (!empty($opts['timeout'])) {
|
||||
@curl_setopt($ch, CURLOPT_TIMEOUT, $opts['timeout']);
|
||||
} else {
|
||||
$curl_time = Config::get('system', 'curl_timeout', 60);
|
||||
|
@ -489,7 +489,7 @@ class Network
|
|||
}
|
||||
|
||||
$str_allowed = Config::get('system', 'allowed_email', '');
|
||||
if (!x($str_allowed)) {
|
||||
if (empty($str_allowed)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -481,7 +481,7 @@ class Temporal
|
|||
$o .= "<td $today>";
|
||||
$day = str_replace(' ', ' ', sprintf('%2.2d', $d));
|
||||
if ($started) {
|
||||
if (x($links, $d) !== false) {
|
||||
if (isset($links[$d])) {
|
||||
$o .= "<a href=\"{$links[$d]}\">$day</a>";
|
||||
} else {
|
||||
$o .= $day;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue