### Eclipse Workspace Patch 1.0
#P wordpress-trunk
|
|
|
868 | 868 | * |
869 | 869 | * @return boolean False means this class can not be used, true means it can. |
870 | 870 | */ |
871 | | function test($args = array()) { |
| 871 | function test( $args = array(), $url = '' ) { |
872 | 872 | if ( ! function_exists('fopen') || (function_exists('ini_get') && true != ini_get('allow_url_fopen')) ) |
873 | 873 | return false; |
874 | 874 | |
875 | | return apply_filters('use_streams_transport', true, $args); |
| 875 | $scheme = empty( $url ) ? 'http' : parse_url( $url, PHP_URL_SCHEME ); |
| 876 | $scheme = empty( $scheme ) ? '' : strtolower( $scheme ); |
| 877 | |
| 878 | $use = empty( $scheme ) ? false : in_array( $scheme, stream_get_wrappers() ); |
| 879 | |
| 880 | if ( $use && isset( $args['ssl'] ) && $args['ssl'] ) { |
| 881 | $use = in_array( 'ssl', stream_get_transports() ); |
| 882 | } |
| 883 | |
| 884 | return (bool) apply_filters( 'use_streams_transport', $use, $args ); |
876 | 885 | } |
877 | 886 | } |
878 | 887 | |