From 0f2d07c65cd175035674224db794c7590a15e9b0 Mon Sep 17 00:00:00 2001 From: Hoang Huu Date: Tue, 15 Oct 2019 13:48:53 +0700 Subject: [PATCH] Update API --- .../class-opalestate-rest-authentication.php | 4 ++-- inc/api/v1/agency.php | 20 ++++++++--------- inc/api/v1/agent.php | 20 ++++++++--------- inc/api/v1/property.php | 22 +++++++++---------- 4 files changed, 33 insertions(+), 33 deletions(-) diff --git a/inc/api/class-opalestate-rest-authentication.php b/inc/api/class-opalestate-rest-authentication.php index 5045988d..71b99068 100644 --- a/inc/api/class-opalestate-rest-authentication.php +++ b/inc/api/class-opalestate-rest-authentication.php @@ -2,7 +2,7 @@ /** * REST API Authentication * - * @package WooCommerce/API + * @package Opalestate/API * @since 2.6.0 */ @@ -578,7 +578,7 @@ class Opalestate_REST_Authentication { */ public function send_unauthorized_headers( $response ) { 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 ); } diff --git a/inc/api/v1/agency.php b/inc/api/v1/agency.php index 0e4e6cc0..1a19c94e 100755 --- a/inc/api/v1/agency.php +++ b/inc/api/v1/agency.php @@ -57,10 +57,10 @@ class Opalestate_Agency_Api extends Opalestate_Base_API { '/' . $this->base, [ [ - 'methods' => WP_REST_Server::READABLE, - 'callback' => [ $this, 'get_items' ], - // 'permission_callback' => [ $this, 'get_items_permissions_check' ], - 'args' => $this->get_collection_params(), + 'methods' => WP_REST_Server::READABLE, + 'callback' => [ $this, 'get_items' ], + 'permission_callback' => [ $this, 'get_items_permissions_check' ], + 'args' => $this->get_collection_params(), ], ] ); @@ -76,9 +76,9 @@ class Opalestate_Agency_Api extends Opalestate_Base_API { ], ], [ - 'methods' => WP_REST_Server::READABLE, - 'callback' => [ $this, 'get_item' ], - // 'permission_callback' => [ $this, 'get_item_permissions_check' ], + 'methods' => WP_REST_Server::READABLE, + 'callback' => [ $this, 'get_item' ], + 'permission_callback' => [ $this, 'get_item_permissions_check' ], ], // [ // 'methods' => WP_REST_Server::EDITABLE, @@ -99,9 +99,9 @@ class Opalestate_Agency_Api extends Opalestate_Base_API { ], ], [ - 'methods' => WP_REST_Server::READABLE, - 'callback' => [ $this, 'get_listings' ], - // 'permission_callback' => [ $this, 'get_item_permissions_check' ], + 'methods' => WP_REST_Server::READABLE, + 'callback' => [ $this, 'get_listings' ], + 'permission_callback' => [ $this, 'get_item_permissions_check' ], ], ] ); diff --git a/inc/api/v1/agent.php b/inc/api/v1/agent.php index 4dd28160..b4d69b42 100755 --- a/inc/api/v1/agent.php +++ b/inc/api/v1/agent.php @@ -48,10 +48,10 @@ class Opalestate_Agent_Api extends Opalestate_Base_API { '/' . $this->base, [ [ - 'methods' => WP_REST_Server::READABLE, - 'callback' => [ $this, 'get_items' ], - // 'permission_callback' => [ $this, 'get_items_permissions_check' ], - 'args' => $this->get_collection_params(), + 'methods' => WP_REST_Server::READABLE, + 'callback' => [ $this, 'get_items' ], + 'permission_callback' => [ $this, 'get_items_permissions_check' ], + 'args' => $this->get_collection_params(), ], ] ); @@ -67,9 +67,9 @@ class Opalestate_Agent_Api extends Opalestate_Base_API { ], ], [ - 'methods' => WP_REST_Server::READABLE, - 'callback' => [ $this, 'get_item' ], - // 'permission_callback' => [ $this, 'get_item_permissions_check' ], + 'methods' => WP_REST_Server::READABLE, + 'callback' => [ $this, 'get_item' ], + 'permission_callback' => [ $this, 'get_item_permissions_check' ], ], // [ // 'methods' => WP_REST_Server::EDITABLE, @@ -90,9 +90,9 @@ class Opalestate_Agent_Api extends Opalestate_Base_API { ], ], [ - 'methods' => WP_REST_Server::READABLE, - 'callback' => [ $this, 'get_listings' ], - // 'permission_callback' => [ $this, 'get_item_permissions_check' ], + 'methods' => WP_REST_Server::READABLE, + 'callback' => [ $this, 'get_listings' ], + 'permission_callback' => [ $this, 'get_item_permissions_check' ], ], ] ); diff --git a/inc/api/v1/property.php b/inc/api/v1/property.php index 38ab6f1b..a44ca910 100644 --- a/inc/api/v1/property.php +++ b/inc/api/v1/property.php @@ -47,10 +47,10 @@ class Opalestate_Property_Api extends Opalestate_Base_API { '/' . $this->base, [ [ - 'methods' => WP_REST_Server::READABLE, - 'callback' => [ $this, 'get_items' ], + 'methods' => WP_REST_Server::READABLE, + 'callback' => [ $this, 'get_items' ], 'permission_callback' => [ $this, 'get_items_permissions_check' ], - 'args' => $this->get_collection_params(), + 'args' => $this->get_collection_params(), ], // [ // 'methods' => WP_REST_Server::CREATABLE, @@ -71,9 +71,9 @@ class Opalestate_Property_Api extends Opalestate_Base_API { ], ], [ - 'methods' => WP_REST_Server::READABLE, - 'callback' => [ $this, 'get_item' ], - // 'permission_callback' => [ $this, 'get_item_permissions_check' ], + 'methods' => WP_REST_Server::READABLE, + 'callback' => [ $this, 'get_item' ], + 'permission_callback' => [ $this, 'get_item_permissions_check' ], ], // [ // 'methods' => WP_REST_Server::EDITABLE, @@ -100,10 +100,10 @@ class Opalestate_Property_Api extends Opalestate_Base_API { '/' . $this->base . '/search', [ [ - 'methods' => WP_REST_Server::READABLE, - 'callback' => [ $this, 'get_results' ], - // 'permission_callback' => [ $this, 'get_items_permissions_check' ], - 'args' => $this->get_search_params(), + 'methods' => WP_REST_Server::READABLE, + 'callback' => [ $this, 'get_results' ], + 'permission_callback' => [ $this, 'get_items_permissions_check' ], + 'args' => $this->get_search_params(), ], ] ); @@ -191,7 +191,7 @@ class Opalestate_Property_Api extends Opalestate_Base_API { } public function get_results( $request ) { - $properties = []; + $properties = []; $property_list = $this->get_search_results_query( $request ); if ( $property_list ) {