Update API

This commit is contained in:
Hoang Huu 2019-10-15 13:48:53 +07:00
parent bafb8ae380
commit 0f2d07c65c
4 changed files with 33 additions and 33 deletions

View File

@ -2,7 +2,7 @@
/** /**
* REST API Authentication * REST API Authentication
* *
* @package WooCommerce/API * @package Opalestate/API
* @since 2.6.0 * @since 2.6.0
*/ */
@ -578,7 +578,7 @@ class Opalestate_REST_Authentication {
*/ */
public function send_unauthorized_headers( $response ) { public function send_unauthorized_headers( $response ) {
if ( is_wp_error( $this->get_error() ) && 'basic_auth' === $this->auth_method ) { if ( is_wp_error( $this->get_error() ) && 'basic_auth' === $this->auth_method ) {
$auth_message = __( 'WooCommerce API. Use a consumer key in the username field and a consumer secret in the password field.', 'opalestate-pro' ); $auth_message = __( 'Opalestate API. Use a consumer key in the username field and a consumer secret in the password field.', 'opalestate-pro' );
$response->header( 'WWW-Authenticate', 'Basic realm="' . $auth_message . '"', true ); $response->header( 'WWW-Authenticate', 'Basic realm="' . $auth_message . '"', true );
} }

View File

@ -59,7 +59,7 @@ class Opalestate_Agency_Api extends Opalestate_Base_API {
[ [
'methods' => WP_REST_Server::READABLE, 'methods' => WP_REST_Server::READABLE,
'callback' => [ $this, 'get_items' ], 'callback' => [ $this, 'get_items' ],
// 'permission_callback' => [ $this, 'get_items_permissions_check' ], 'permission_callback' => [ $this, 'get_items_permissions_check' ],
'args' => $this->get_collection_params(), 'args' => $this->get_collection_params(),
], ],
] ]
@ -78,7 +78,7 @@ class Opalestate_Agency_Api extends Opalestate_Base_API {
[ [
'methods' => WP_REST_Server::READABLE, 'methods' => WP_REST_Server::READABLE,
'callback' => [ $this, 'get_item' ], 'callback' => [ $this, 'get_item' ],
// 'permission_callback' => [ $this, 'get_item_permissions_check' ], 'permission_callback' => [ $this, 'get_item_permissions_check' ],
], ],
// [ // [
// 'methods' => WP_REST_Server::EDITABLE, // 'methods' => WP_REST_Server::EDITABLE,
@ -101,7 +101,7 @@ class Opalestate_Agency_Api extends Opalestate_Base_API {
[ [
'methods' => WP_REST_Server::READABLE, 'methods' => WP_REST_Server::READABLE,
'callback' => [ $this, 'get_listings' ], 'callback' => [ $this, 'get_listings' ],
// 'permission_callback' => [ $this, 'get_item_permissions_check' ], 'permission_callback' => [ $this, 'get_item_permissions_check' ],
], ],
] ]
); );

View File

@ -50,7 +50,7 @@ class Opalestate_Agent_Api extends Opalestate_Base_API {
[ [
'methods' => WP_REST_Server::READABLE, 'methods' => WP_REST_Server::READABLE,
'callback' => [ $this, 'get_items' ], 'callback' => [ $this, 'get_items' ],
// 'permission_callback' => [ $this, 'get_items_permissions_check' ], 'permission_callback' => [ $this, 'get_items_permissions_check' ],
'args' => $this->get_collection_params(), 'args' => $this->get_collection_params(),
], ],
] ]
@ -69,7 +69,7 @@ class Opalestate_Agent_Api extends Opalestate_Base_API {
[ [
'methods' => WP_REST_Server::READABLE, 'methods' => WP_REST_Server::READABLE,
'callback' => [ $this, 'get_item' ], 'callback' => [ $this, 'get_item' ],
// 'permission_callback' => [ $this, 'get_item_permissions_check' ], 'permission_callback' => [ $this, 'get_item_permissions_check' ],
], ],
// [ // [
// 'methods' => WP_REST_Server::EDITABLE, // 'methods' => WP_REST_Server::EDITABLE,
@ -92,7 +92,7 @@ class Opalestate_Agent_Api extends Opalestate_Base_API {
[ [
'methods' => WP_REST_Server::READABLE, 'methods' => WP_REST_Server::READABLE,
'callback' => [ $this, 'get_listings' ], 'callback' => [ $this, 'get_listings' ],
// 'permission_callback' => [ $this, 'get_item_permissions_check' ], 'permission_callback' => [ $this, 'get_item_permissions_check' ],
], ],
] ]
); );

View File

@ -73,7 +73,7 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
[ [
'methods' => WP_REST_Server::READABLE, 'methods' => WP_REST_Server::READABLE,
'callback' => [ $this, 'get_item' ], 'callback' => [ $this, 'get_item' ],
// 'permission_callback' => [ $this, 'get_item_permissions_check' ], 'permission_callback' => [ $this, 'get_item_permissions_check' ],
], ],
// [ // [
// 'methods' => WP_REST_Server::EDITABLE, // 'methods' => WP_REST_Server::EDITABLE,
@ -102,7 +102,7 @@ class Opalestate_Property_Api extends Opalestate_Base_API {
[ [
'methods' => WP_REST_Server::READABLE, 'methods' => WP_REST_Server::READABLE,
'callback' => [ $this, 'get_results' ], 'callback' => [ $this, 'get_results' ],
// 'permission_callback' => [ $this, 'get_items_permissions_check' ], 'permission_callback' => [ $this, 'get_items_permissions_check' ],
'args' => $this->get_search_params(), 'args' => $this->get_search_params(),
], ],
] ]