WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/11/2012 12:37:31 AM (7 years ago)
Author:
nacin
Message:

Turn XML-RPC on and remove the option on the Writing Settings page.
props markoheijnen for the initial patch.

Introduces a new filter, xmlrpc_enabled.

Respects any current callbacks registered to the pre_option_enable_xmlrpc
and option_enable_xmlrpc filters, for anyone forcing it off via code.

fixes #21509.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/class-wp-xmlrpc-server.php

    r21765 r21804  
    170170     */
    171171    function login_pass_ok($user_login, $user_pass) {
    172         if ( !get_option( 'enable_xmlrpc' ) ) {
    173             $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site. An admin user can enable them at %s'),  admin_url('options-writing.php') ) );
     172
     173        // Respect any old filters against get_option() for 'enable_xmlrpc'.
     174        $enabled = apply_filters( 'pre_option_enable_xmlrpc', false ); // Deprecated
     175        if ( false === $enabled )
     176            $enabled = apply_filters( 'option_enable_xmlrpc', true ); // Deprecated
     177
     178        // Proper filter for turning off XML-RPC. It is on by default.
     179        $enabled = apply_filters( 'xmlrpc_enabled', $enabled );
     180
     181        if ( ! $enabled ) {
     182            $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site.' ) ) );
    174183            return false;
    175184        }
     
    192201     */
    193202    function login($username, $password) {
    194         if ( !get_option( 'enable_xmlrpc' ) ) {
    195             $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site. An admin user can enable them at %s'),  admin_url('options-writing.php') ) );
     203        // Respect any old filters against get_option() for 'enable_xmlrpc'.
     204        $enabled = apply_filters( 'pre_option_enable_xmlrpc', false ); // Deprecated
     205        if ( false === $enabled )
     206            $enabled = apply_filters( 'option_enable_xmlrpc', true ); // Deprecated
     207
     208        // Proper filter for turning off XML-RPC. It is on by default.
     209        $enabled = apply_filters( 'xmlrpc_enabled', $enabled );
     210
     211        if ( ! $enabled ) {
     212            $this->error = new IXR_Error( 405, sprintf( __( 'XML-RPC services are disabled on this site.' ) ) );
    196213            return false;
    197214        }
Note: See TracChangeset for help on using the changeset viewer.