1 | <?php |
---|
2 | /* |
---|
3 | Plugin Name: List HTTP Transports |
---|
4 | Plugin URI: http://wordpress.org/# |
---|
5 | Description: List available HTTP and HTTPS transports for both GET and POST |
---|
6 | Author: Ryan Boren, Matt Martz |
---|
7 | Version: 1.1 |
---|
8 | Author URI: http://boren.nu/, http://sivel.net/ |
---|
9 | */ |
---|
10 | |
---|
11 | function list_transports() { |
---|
12 | |
---|
13 | $types = array('get', 'getssl', 'post', 'postssl'); |
---|
14 | |
---|
15 | foreach ( $types as $type ) { |
---|
16 | switch ($type) { |
---|
17 | case 'get': |
---|
18 | case 'post': |
---|
19 | $r = array('ssl' => false); |
---|
20 | break; |
---|
21 | case 'getssl': |
---|
22 | case 'postssl': |
---|
23 | $r = array('sslverify' => apply_filters('https_local_ssl_verify', true), 'ssl' => true, 'local' => true); |
---|
24 | break; |
---|
25 | } |
---|
26 | $$type = ''; |
---|
27 | if ( true === WP_Http_ExtHttp::test($r) ) |
---|
28 | $$type .= 'ExtHttp'; |
---|
29 | if ( true === WP_Http_Curl::test($r) ) |
---|
30 | $$type .= ' Curl'; |
---|
31 | if ( true === WP_Http_Streams::test($r) ) |
---|
32 | $$type .= ' Streams'; |
---|
33 | if ( true === WP_Http_Fopen::test($r) && !strstr($type, 'post') ) |
---|
34 | $$type .= ' Fopen'; |
---|
35 | if ( true === WP_Http_Fsockopen::test($r) ) |
---|
36 | $$type .= ' Fsockopen'; |
---|
37 | } |
---|
38 | |
---|
39 | echo "<span style='font-family: monospace;'>"; |
---|
40 | echo "Available HTTP GET transports: $get<br />\n"; |
---|
41 | echo "Available HTTPS GET transports: $getssl<br />\n"; |
---|
42 | echo "Available HTTP POST transports: $post<br />\n"; |
---|
43 | echo "Available HTTPS POST transports: $postssl<br />\n"; |
---|
44 | echo "</span>"; |
---|
45 | } |
---|
46 | |
---|
47 | function return_false() { return false; } |
---|
48 | |
---|
49 | add_action('admin_footer', 'list_transports'); |
---|
50 | |
---|
51 | //add_action('use_http_extension_transport', 'return_false'); |
---|
52 | //add_action('use_curl_transport', 'return_false'); |
---|
53 | //add_action('use_streams_transport', 'return_false'); |
---|
54 | //add_action('use_fopen_transport', 'return_false'); |
---|
55 | //add_action('use_fsockopen_transport', 'return_false'); |
---|
56 | |
---|
57 | //add_action('https_local_ssl_verify', 'return_false'); |
---|
58 | ?> |
---|