|
27 | 27 | echo 'PASS'.PHP_EOL.PHP_EOL;
|
28 | 28 | } else {
|
29 | 29 | echo 'FAIL'.PHP_EOL.PHP_EOL;
|
30 |
| - echo get_limited_func_str(true).PHP_EOL; |
| 30 | + echo get_limited_func_str('installed'); |
31 | 31 | exit;
|
32 | 32 | }
|
33 | 33 |
|
34 |
| -echo 'Checking for the existence of the curl_init() function...'; |
35 |
| -if (function_exists('curl_init')) { |
| 34 | +echo 'Checking for the existence of all required cURL functions...'; |
| 35 | +$funcs = array( |
| 36 | + 'curl_init', |
| 37 | + 'curl_setopt_array', |
| 38 | + 'curl_exec', |
| 39 | + 'curl_getinfo', |
| 40 | + 'curl_multi_init', |
| 41 | + 'curl_multi_add_handle', |
| 42 | + 'curl_multi_exec', |
| 43 | + 'curl_multi_select', |
| 44 | + 'curl_multi_getcontent', |
| 45 | + 'curl_multi_remove_handle', |
| 46 | + 'curl_close', |
| 47 | +); |
| 48 | +$funcs_exist = array(); |
| 49 | +$funcs_not_exist = array(); |
| 50 | +foreach ($funcs as $func) { |
| 51 | + if (function_exists($func)) { |
| 52 | + $funcs_exist[] = $func; |
| 53 | + } else $funcs_not_exist[] = $func; |
| 54 | +} |
| 55 | +if (!$funcs_not_exist) { |
36 | 56 | echo 'PASS'.PHP_EOL.PHP_EOL;
|
37 | 57 | } else {
|
38 | 58 | echo 'FAIL'.PHP_EOL.PHP_EOL;
|
39 |
| - echo get_limited_func_str(true).PHP_EOL; |
| 59 | + echo 'Link Tools functionality will be limited because not all of the required functions from the Client URL Library (cURL) are available.'.PHP_EOL.PHP_EOL; |
| 60 | + if ($funcs_exist) { |
| 61 | + echo 'The following cURL functions are available: '.implode('(), ', $funcs_exist).'().'.PHP_EOL.PHP_EOL; |
| 62 | + } |
| 63 | + echo 'The following cURL functions are not available: '.implode('(), ', $funcs_not_exist).'().'.PHP_EOL.PHP_EOL; |
| 64 | + echo 'Probably, these unavailable functions have been disabled by your host, in which case, you could contact your host to have them enabled if possible.'.PHP_EOL.PHP_EOL; |
| 65 | + echo 'For more details on the cURL library, please see here: <https://www.php.net/manual/en/book.curl.php>.'; |
40 | 66 | exit;
|
41 | 67 | }
|
42 | 68 |
|
@@ -208,6 +234,6 @@ function do_failure($ch, $err_msgs) {
|
208 | 234 | echo 'The curl_error() function reports: '.curl_error($ch).PHP_EOL.PHP_EOL;
|
209 | 235 | }
|
210 | 236 |
|
211 |
| -function get_limited_func_str($for_not_installed = false) { |
212 |
| - return 'Link Tools functionality will be limited because the Client URL Library (cURL) does not appear to be '.($for_not_installed ? 'installed' : 'functioning correctly').'. For more details on this library, please see here: <https://www.php.net/manual/en/book.curl.php>.'.PHP_EOL; |
| 237 | +function get_limited_func_str($error_wording = 'functioning correctly') { |
| 238 | + return 'Link Tools functionality will be limited because the Client URL Library (cURL) does not appear to be '.$error_wording.'. For more details on this library, please see here: <https://www.php.net/manual/en/book.curl.php>.'.PHP_EOL; |
213 | 239 | }
|
0 commit comments