WordPress.org

Make WordPress Core

Ticket #10330: xmlrpc.php.diff

File xmlrpc.php.diff, 794 bytes (added by josephscott, 5 years ago)
  • xmlrpc.php

     
    5757// Turn off all warnings and errors. 
    5858// error_reporting(0); 
    5959 
     60// Redirect to HTTPS if FORCE_SSL_ADMIN or FORCE_SSL_LOGIN is true 
     61$secure = false; 
     62if ( is_ssl( ) || force_ssl_admin( ) || force_ssl_login( ) ) 
     63        $secure = true; 
     64 
     65if ( $secure && !is_ssl( ) ) { 
     66        if ( 0 === strpos( $_SERVER['REQUEST_URI'], 'http' ) ) { 
     67                wp_redirect( preg_replace( '|^http://|',  'https://', $_SERVER['REQUEST_URI'] ) ); 
     68                exit( ); 
     69        } else { 
     70                wp_redirect( 'https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); 
     71                exit( ); 
     72        } 
     73} 
     74 
    6075/** 
    6176 * Posts submitted via the xmlrpc interface get that title 
    6277 * @name post_default_title