Skip to content
This repository has been archived by the owner on Sep 24, 2018. It is now read-only.

Remove IXR references #77

Merged
merged 2 commits into from
Mar 4, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 7 additions & 11 deletions lib/class-wp-json-posts.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -214,18 +214,14 @@ function newPost( $data ) {
unset( $data['ID'] ); unset( $data['ID'] );


$result = $this->insert_post( $data ); $result = $this->insert_post( $data );
if ( is_string( $result ) || is_int( $result ) ) { if ( $result instanceof WP_Error ) {
$response = $this->getPost( $result ); return $result;
$response->set_status( 201 );
$response->header( 'Location', json_url( '/posts/' . $result ) );
return $response;
}
elseif ( $result instanceof IXR_Error ) {
return new WP_Error( 'json_insert_error', $result->message, array( 'status' => $result->code ) );
}
else {
return new WP_Error( 'json_insert_error', __( 'An unknown error occurred while creating the post' ), array( 'status' => 500 ) );
} }

$response = $this->getPost( $result );
$response->set_status( 201 );
$response->header( 'Location', json_url( '/posts/' . $result ) );
return $response;
} }


/** /**
Expand Down
2 changes: 0 additions & 2 deletions lib/wp-json.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@
include('./wp-load.php'); include('./wp-load.php');


include_once(ABSPATH . 'wp-admin/includes/admin.php'); include_once(ABSPATH . 'wp-admin/includes/admin.php');
include_once(ABSPATH . WPINC . '/class-IXR.php');
include_once(ABSPATH . WPINC . '/class-wp-xmlrpc-server.php');
include_once(ABSPATH . WPINC . '/class-wp-json-server.php'); include_once(ABSPATH . WPINC . '/class-wp-json-server.php');


// Allow for a plugin to insert a different class to handle requests. // Allow for a plugin to insert a different class to handle requests.
Expand Down
2 changes: 0 additions & 2 deletions plugin.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ function json_api_loaded() {
if ( empty( $GLOBALS['wp']->query_vars['json_route'] ) ) if ( empty( $GLOBALS['wp']->query_vars['json_route'] ) )
return; return;


include_once( ABSPATH . WPINC . '/class-IXR.php' );
include_once( ABSPATH . WPINC . '/class-wp-xmlrpc-server.php' );
include_once( dirname( __FILE__ ) . '/lib/class-wp-json-server.php' ); include_once( dirname( __FILE__ ) . '/lib/class-wp-json-server.php' );


/** /**
Expand Down
2 changes: 0 additions & 2 deletions tests/test_json_server.php
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ function setUp() {


parent::setUp(); parent::setUp();


include_once( ABSPATH . WPINC . '/class-IXR.php' );
include_once( ABSPATH . WPINC . '/class-wp-xmlrpc-server.php' );
include_once( plugin_dir_path( dirname( __FILE__ ) ) . 'lib/class-wp-json-server.php' ); include_once( plugin_dir_path( dirname( __FILE__ ) ) . 'lib/class-wp-json-server.php' );


// Allow for a plugin to insert a different class to handle requests. // Allow for a plugin to insert a different class to handle requests.
Expand Down