$stamp1 = microtime(true);
- $a = get_app();
+ $a = \get_app();
$parts = parse_url($url);
$path_parts = explode('/', defaults($parts, 'path', ''));
@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"]);
}
// @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,
/// @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);
return CurlResult::createErrorCurl($url);
}
- $a = get_app();
+ $a = \get_app();
$ch = curl_init($url);
if (($redirects > 8) || (!$ch)) {
/// @TODO Really suppress function outcomes? Why not find them + debug them?
$h = @parse_url($url);
- if ((is_array($h)) && (@dns_get_record($h['host'], DNS_A + DNS_CNAME) || filter_var($h['host'], FILTER_VALIDATE_IP) )) {
+ if (!empty($h['host']) && (@dns_get_record($h['host'], DNS_A + DNS_CNAME) || filter_var($h['host'], FILTER_VALIDATE_IP) )) {
return $url;
}
}
$str_allowed = Config::get('system', 'allowed_email', '');
- if (!x($str_allowed)) {
+ if (empty($str_allowed)) {
return true;
}
*/
public static function finalUrl($url, $depth = 1, $fetchbody = false)
{
- $a = get_app();
+ $a = \get_app();
$url = self::stripTrackingQueryParams($url);