875 | | return apply_filters('use_streams_transport', true, $args); |
| 874 | $scheme = emprty($url) ? 'http' : strtolower( parse_url( $url, PHP_URL_SCHEME ) ); |
| 875 | |
| 876 | $allowed_streams = array('http', 'https'); |
| 877 | |
| 878 | // check if the requested scheme is allowed |
| 879 | $use = in_array( $scheme, $allowed_streams); |
| 880 | |
| 881 | // check if the fopen function exists |
| 882 | if ( $use ) |
| 883 | $use = function_exists('fopen'); |
| 884 | |
| 885 | // check if url fopen is allowed |
| 886 | if ( $use ) |
| 887 | $use = function_exists('ini_get') && ini_get('allow_url_fopen'); |
| 888 | |
| 889 | // check if requested scheme has a stream wrapper |
| 890 | if ( $use ) |
| 891 | $use = in_array( $scheme, stream_get_wrappers() ); |
| 892 | |
| 893 | // check specifically agains openssl extension |
| 894 | if ( $use && $is_ssl ) |
| 895 | $use = extension_loaded( 'openssl' ); |
| 896 | |
| 897 | // check if streams actually support ssl |
| 898 | if ( $use && $is_ssl ) |
| 899 | $use = in_array( 'ssl', stream_get_transports() ); |
| 900 | |
| 901 | return (bool) apply_filters( 'use_streams_transport', $use, $args ); |