mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Ensure that we offer https access to atom if it is available. Fixes #5298 props rubys.
git-svn-id: https://develop.svn.wordpress.org/trunk@6339 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -134,6 +134,9 @@ add_filter('comment_flood_filter', 'wp_throttle_comment_flood', 10, 3);
|
||||
add_filter('pre_comment_content', 'wp_rel_nofollow', 15);
|
||||
add_filter('comment_email', 'antispambot');
|
||||
|
||||
//Atom SSL support
|
||||
add_filter('atom_service_url','atom_service_url_filter');
|
||||
|
||||
// Actions
|
||||
add_action('wp_head', 'rsd_link');
|
||||
add_action('wp_head', 'wlwmanifest_link');
|
||||
|
||||
@@ -1484,4 +1484,36 @@ function absint( $maybeint ) {
|
||||
return abs( intval( $maybeint ) );
|
||||
}
|
||||
|
||||
?>
|
||||
/**
|
||||
* Determines if the blog can be accessed over SSL
|
||||
* @return bool whether of not SSL access is available
|
||||
*/
|
||||
function url_is_accessable_via_ssl($url)
|
||||
{
|
||||
if (in_array('curl', get_loaded_extensions())) {
|
||||
$ssl = preg_replace( '/^http:\/\//', 'https://', $url );
|
||||
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $ssl);
|
||||
curl_setopt($ch, CURLOPT_FAILONERROR, true);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||
|
||||
$data = curl_exec ($ch);
|
||||
|
||||
$status = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close ($ch);
|
||||
|
||||
if ($status == 200 || $status == 401) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function atom_service_url_filter($url)
|
||||
{
|
||||
if ( url_is_accessable_via_ssl($url) )
|
||||
return preg_replace( '/^http:\/\//', 'https://', $url );
|
||||
}
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user