mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-09-02 05:36:36 +00:00
Remove some uses of function_exists() where no longer necessary
This commit is contained in:
@@ -115,20 +115,12 @@ function get_png()
|
||||
return $tmp_filename;
|
||||
}
|
||||
|
||||
if (function_exists('finfo_open')) {
|
||||
function mime_type($file_path)
|
||||
{
|
||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
$mime_type = finfo_file($finfo, $file_path);
|
||||
finfo_close($finfo);
|
||||
return $mime_type;
|
||||
}
|
||||
} else {
|
||||
function mime_type($file_path)
|
||||
{
|
||||
$mime_type = mime_content_type($file_path);
|
||||
return $mime_type;
|
||||
}
|
||||
function mime_type($file_path)
|
||||
{
|
||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||
$mime_type = finfo_file($finfo, $file_path);
|
||||
finfo_close($finfo);
|
||||
return $mime_type;
|
||||
}
|
||||
|
||||
function upload_file_to_server($upload_file_path) {
|
||||
|
||||
@@ -312,11 +312,8 @@ if ($test === 'http_basic_auth') {
|
||||
echo '}' . "\n";
|
||||
exit;
|
||||
} elseif ($test === 'error_message') {
|
||||
if (function_exists('http_response_code')) {
|
||||
http_response_code(401);
|
||||
} else {
|
||||
header('HTTP/1.1 401 Unauthorized');
|
||||
}
|
||||
// 401 Unauthorized.
|
||||
http_response_code(401);
|
||||
exit;
|
||||
} elseif ($test === 'redirect') {
|
||||
if (!isset($_GET['redirect'])) {
|
||||
@@ -342,11 +339,8 @@ if ($test === 'http_basic_auth') {
|
||||
echo 'Redirected: ' . $request_method;
|
||||
} else {
|
||||
if ($request_method === 'POST') {
|
||||
if (function_exists('http_response_code')) {
|
||||
http_response_code(303);
|
||||
} else {
|
||||
header('HTTP/1.1 303 See Other');
|
||||
}
|
||||
// 303 See Other.
|
||||
http_response_code(303);
|
||||
|
||||
header('Location: ?redirect');
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user