This commit is contained in:
parent
d9ef295d74
commit
c0e2d73467
|
@ -28,6 +28,20 @@ abstract class AbstractTermsContoller extends AbstractController {
|
|||
*/
|
||||
protected $taxonomy = '';
|
||||
|
||||
/**
|
||||
* Store total terms.
|
||||
*
|
||||
* @var integer
|
||||
*/
|
||||
protected $total_terms = 0;
|
||||
|
||||
/**
|
||||
* Store sort column.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $sort_column = '';
|
||||
|
||||
/**
|
||||
* Register the routes for terms.
|
||||
*/
|
||||
|
@ -669,8 +683,8 @@ abstract class AbstractTermsContoller extends AbstractController {
|
|||
*
|
||||
* Uses `$this->sort_column` to determine field to sort by.
|
||||
*
|
||||
* @param stdClass $left Term object.
|
||||
* @param stdClass $right Term object.
|
||||
* @param \stdClass $left Term object.
|
||||
* @param \stdClass $right Term object.
|
||||
* @return int <0 if left is higher "priority" than right, 0 if equal, >0 if right is higher "priority" than left.
|
||||
*/
|
||||
protected function compare_terms( $left, $right ) {
|
||||
|
|
|
@ -553,7 +553,7 @@ class Coupons extends AbstractObjectsController {
|
|||
* Get a collection of posts and add the code search option to \WP_Query.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_items( $request ) {
|
||||
add_filter( 'posts_where', array( $this, 'add_wp_query_search_code_filter' ), 10, 2 );
|
||||
|
|
|
@ -91,7 +91,7 @@ class CustomerDownloads extends AbstractController {
|
|||
/**
|
||||
* Prepare a single download output for response.
|
||||
*
|
||||
* @param stdClass $download Download object.
|
||||
* @param \stdClass $download Download object.
|
||||
* @param \WP_REST_Request $request Request object.
|
||||
* @return \WP_REST_Response $response Response data.
|
||||
*/
|
||||
|
@ -123,7 +123,7 @@ class CustomerDownloads extends AbstractController {
|
|||
* Filter customer download data returned from the REST API.
|
||||
*
|
||||
* @param \WP_REST_Response $response The response object.
|
||||
* @param stdClass $download Download object used to create response.
|
||||
* @param \stdClass $download Download object used to create response.
|
||||
* @param \WP_REST_Request $request Request object.
|
||||
*/
|
||||
return apply_filters( 'woocommerce_rest_prepare_customer_download', $response, $download, $request );
|
||||
|
@ -132,7 +132,7 @@ class CustomerDownloads extends AbstractController {
|
|||
/**
|
||||
* Prepare links for the request.
|
||||
*
|
||||
* @param stdClass $download Download object.
|
||||
* @param \stdClass $download Download object.
|
||||
* @param \WP_REST_Request $request Request object.
|
||||
* @return array Links for the given customer download.
|
||||
*/
|
||||
|
|
|
@ -268,7 +268,7 @@ class Customers extends AbstractController {
|
|||
* Get all customers.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_items( $request ) {
|
||||
$prepared_args = array();
|
||||
|
@ -366,7 +366,7 @@ class Customers extends AbstractController {
|
|||
*
|
||||
* @throws \WC_REST_Exception On invalid params.
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function create_item( $request ) {
|
||||
try {
|
||||
|
@ -420,7 +420,7 @@ class Customers extends AbstractController {
|
|||
* Get a single customer.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_item( $request ) {
|
||||
$id = (int) $request['id'];
|
||||
|
@ -442,7 +442,7 @@ class Customers extends AbstractController {
|
|||
* @throws \WC_REST_Exception On invalid params.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function update_item( $request ) {
|
||||
try {
|
||||
|
@ -503,7 +503,7 @@ class Customers extends AbstractController {
|
|||
* Delete a single customer.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function delete_item( $request ) {
|
||||
$id = (int) $request['id'];
|
||||
|
|
|
@ -77,7 +77,7 @@ class Data extends AbstractController {
|
|||
*
|
||||
* @since 3.5.0
|
||||
* @param \WP_REST_Request $request Request data.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_items( $request ) {
|
||||
$data = array();
|
||||
|
@ -111,7 +111,7 @@ class Data extends AbstractController {
|
|||
/**
|
||||
* Prepare a data resource object for serialization.
|
||||
*
|
||||
* @param stdClass $resource Resource data.
|
||||
* @param \stdClass $resource Resource data.
|
||||
* @param \WP_REST_Request $request Request object.
|
||||
* @return \WP_REST_Response $response Response data.
|
||||
*/
|
||||
|
|
|
@ -155,7 +155,7 @@ class Continents extends DataController {
|
|||
*
|
||||
* @since 3.5.0
|
||||
* @param \WP_REST_Request $request Request data.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_items( $request ) {
|
||||
$continents = WC()->countries->get_continents();
|
||||
|
|
|
@ -102,7 +102,7 @@ class Countries extends DataController {
|
|||
*
|
||||
* @since 3.5.0
|
||||
* @param \WP_REST_Request $request Request data.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_items( $request ) {
|
||||
$countries = WC()->countries->get_countries();
|
||||
|
@ -122,7 +122,7 @@ class Countries extends DataController {
|
|||
*
|
||||
* @since 3.5.0
|
||||
* @param \WP_REST_Request $request Request data.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_item( $request ) {
|
||||
$data = $this->get_country( strtoupper( $request['location'] ), $request );
|
||||
|
|
|
@ -101,7 +101,7 @@ class Currencies extends DataController {
|
|||
* Return the list of currencies.
|
||||
*
|
||||
* @param \WP_REST_Request $request Request data.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_items( $request ) {
|
||||
$currencies = get_woocommerce_currencies();
|
||||
|
@ -118,7 +118,7 @@ class Currencies extends DataController {
|
|||
* Return information for a specific currency.
|
||||
*
|
||||
* @param \WP_REST_Request $request Request data.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_item( $request ) {
|
||||
$data = $this->get_currency( strtoupper( $request['currency'] ), $request );
|
||||
|
@ -132,7 +132,7 @@ class Currencies extends DataController {
|
|||
* Return information for the current site currency.
|
||||
*
|
||||
* @param \WP_REST_Request $request Request data.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_current_item( $request ) {
|
||||
$currency = get_option( 'woocommerce_currency' );
|
||||
|
|
|
@ -50,7 +50,7 @@ class DownloadIPs extends DataController {
|
|||
*
|
||||
* @since 3.5.0
|
||||
* @param \WP_REST_Request $request Request data.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_items( $request ) {
|
||||
global $wpdb;
|
||||
|
|
|
@ -207,7 +207,7 @@ class OrderNotes extends AbstractController {
|
|||
);
|
||||
}
|
||||
|
||||
remove_filter( 'comments_clauses', array( 'WC_Comments', 'exclude_order_comments' ), 10, 1 );
|
||||
remove_filter( 'comments_clauses', array( 'WC_Comments', 'exclude_order_comments' ), 10 );
|
||||
|
||||
$notes = get_comments( $args );
|
||||
|
||||
|
@ -227,7 +227,7 @@ class OrderNotes extends AbstractController {
|
|||
* Create a single order note.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function create_item( $request ) {
|
||||
if ( ! empty( $request['id'] ) ) {
|
||||
|
@ -273,7 +273,7 @@ class OrderNotes extends AbstractController {
|
|||
* Get a single order note.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_item( $request ) {
|
||||
$id = (int) $request['id'];
|
||||
|
|
|
@ -114,7 +114,7 @@ class PaymentGateways extends AbstractController {
|
|||
* Get payment gateways.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_items( $request ) {
|
||||
$payment_gateways = WC()->payment_gateways->payment_gateways();
|
||||
|
|
|
@ -1213,7 +1213,7 @@ class ProductVariations extends Products {
|
|||
* Get a collection of posts and add the post title filter option to \WP_Query.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_items( $request ) {
|
||||
add_filter( 'posts_where', array( __CLASS__, 'add_wp_query_filter' ), 10, 2 );
|
||||
|
|
|
@ -597,7 +597,7 @@ class Products extends AbstractObjectsController {
|
|||
* Get a collection of posts and add the post title filter option to \WP_Query.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_items( $request ) {
|
||||
add_filter( 'posts_where', array( __CLASS__, 'add_wp_query_filter' ), 10, 2 );
|
||||
|
|
|
@ -75,7 +75,7 @@ class Settings extends AbstractController {
|
|||
* Update a setting.
|
||||
*
|
||||
* @param \WP_REST_Request $request Request data.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function update_item( $request ) {
|
||||
$options_controller = new \WC_REST_Setting_Options_Controller();
|
||||
|
@ -89,7 +89,7 @@ class Settings extends AbstractController {
|
|||
*
|
||||
* @since 3.0.0
|
||||
* @param \WP_REST_Request $request Request data.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_items( $request ) {
|
||||
$groups = apply_filters( 'woocommerce_settings_groups', array() );
|
||||
|
|
|
@ -106,7 +106,7 @@ class SettingsOptions extends AbstractController {
|
|||
*
|
||||
* @since 3.0.0
|
||||
* @param \WP_REST_Request $request Request data.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_item( $request ) {
|
||||
$setting = $this->get_setting( $request['group_id'], $request['id'] );
|
||||
|
@ -125,7 +125,7 @@ class SettingsOptions extends AbstractController {
|
|||
*
|
||||
* @since 3.0.0
|
||||
* @param \WP_REST_Request $request Request data.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_items( $request ) {
|
||||
$settings = $this->get_group_settings( $request['group_id'] );
|
||||
|
@ -214,7 +214,7 @@ class SettingsOptions extends AbstractController {
|
|||
*/
|
||||
private function get_countries_and_states() {
|
||||
$countries = WC()->countries->get_countries();
|
||||
if ( ! $countries ) {
|
||||
if ( empty( $countries ) ) {
|
||||
return array();
|
||||
}
|
||||
$output = array();
|
||||
|
@ -304,7 +304,7 @@ class SettingsOptions extends AbstractController {
|
|||
*
|
||||
* @since 3.0.0
|
||||
* @param \WP_REST_Request $request Request data.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function update_item( $request ) {
|
||||
$setting = $this->get_setting( $request['group_id'], $request['id'] );
|
||||
|
|
|
@ -95,7 +95,7 @@ class ShippingMethods extends AbstractController {
|
|||
* Get shipping methods.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_items( $request ) {
|
||||
$wc_shipping = \WC_Shipping::instance();
|
||||
|
|
|
@ -23,6 +23,13 @@ class SystemStatus extends AbstractController {
|
|||
*/
|
||||
protected $rest_base = 'system_status';
|
||||
|
||||
/**
|
||||
* Store available updates.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $available_updates = array();
|
||||
|
||||
/**
|
||||
* Register the route for /system_status
|
||||
*/
|
||||
|
@ -60,7 +67,7 @@ class SystemStatus extends AbstractController {
|
|||
* Get a system status info, by section.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_items( $request ) {
|
||||
$schema = $this->get_item_schema();
|
||||
|
|
|
@ -206,7 +206,7 @@ class SystemStatusTools extends AbstractController {
|
|||
* Get a list of system status tools.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_items( $request ) {
|
||||
$tools = array();
|
||||
|
@ -232,7 +232,7 @@ class SystemStatusTools extends AbstractController {
|
|||
* Return a single tool.
|
||||
*
|
||||
* @param \WP_REST_Request $request Request data.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_item( $request ) {
|
||||
$tools = $this->get_tools();
|
||||
|
@ -257,7 +257,7 @@ class SystemStatusTools extends AbstractController {
|
|||
* Update (execute) a tool.
|
||||
*
|
||||
* @param \WP_REST_Request $request Request data.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function update_item( $request ) {
|
||||
$tools = $this->get_tools();
|
||||
|
@ -416,7 +416,7 @@ class SystemStatusTools extends AbstractController {
|
|||
|
||||
$attribute_taxonomies = wc_get_attribute_taxonomies();
|
||||
|
||||
if ( $attribute_taxonomies ) {
|
||||
if ( ! empty( $attribute_taxonomies ) ) {
|
||||
foreach ( $attribute_taxonomies as $attribute ) {
|
||||
delete_transient( 'wc_layered_nav_counts_pa_' . $attribute->attribute_name );
|
||||
}
|
||||
|
|
|
@ -158,7 +158,7 @@ class TaxClasses extends AbstractController {
|
|||
* Create a single tax.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function create_item( $request ) {
|
||||
$exists = false;
|
||||
|
@ -191,7 +191,7 @@ class TaxClasses extends AbstractController {
|
|||
/**
|
||||
* Fires after a tax class is created or updated via the REST API.
|
||||
*
|
||||
* @param stdClass $tax_class Data used to create the tax class.
|
||||
* @param \stdClass $tax_class Data used to create the tax class.
|
||||
* @param \WP_REST_Request $request Request object.
|
||||
* @param boolean $creating True when creating tax class, false when updating tax class.
|
||||
*/
|
||||
|
@ -210,7 +210,7 @@ class TaxClasses extends AbstractController {
|
|||
* Delete a single tax class.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function delete_item( $request ) {
|
||||
global $wpdb;
|
||||
|
@ -276,7 +276,7 @@ class TaxClasses extends AbstractController {
|
|||
/**
|
||||
* Fires after a tax class is deleted via the REST API.
|
||||
*
|
||||
* @param stdClass $tax_class The tax data.
|
||||
* @param \stdClass $tax_class The tax data.
|
||||
* @param \WP_REST_Response $response The response returned from the API.
|
||||
* @param \WP_REST_Request $request The request sent to the API.
|
||||
*/
|
||||
|
@ -308,7 +308,7 @@ class TaxClasses extends AbstractController {
|
|||
* Filter tax object returned from the REST API.
|
||||
*
|
||||
* @param \WP_REST_Response $response The response object.
|
||||
* @param stdClass $tax_class Tax object used to create response.
|
||||
* @param \stdClass $tax_class Tax object used to create response.
|
||||
* @param \WP_REST_Request $request Request object.
|
||||
*/
|
||||
return apply_filters( 'woocommerce_rest_prepare_tax', $response, (object) $tax_class, $request );
|
||||
|
|
|
@ -197,7 +197,7 @@ class Taxes extends AbstractController {
|
|||
* Get all taxes and allow filtering by tax code.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_items( $request ) {
|
||||
global $wpdb;
|
||||
|
@ -306,7 +306,7 @@ class Taxes extends AbstractController {
|
|||
* Take tax data from the request and return the updated or newly created rate.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @param stdClass|null $current Existing tax object.
|
||||
* @param \stdClass|null $current Existing tax object.
|
||||
* @return object
|
||||
*/
|
||||
protected function create_or_update_tax( $request, $current = null ) {
|
||||
|
@ -376,7 +376,7 @@ class Taxes extends AbstractController {
|
|||
* Create a single tax.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function create_item( $request ) {
|
||||
if ( ! empty( $request['id'] ) ) {
|
||||
|
@ -390,7 +390,7 @@ class Taxes extends AbstractController {
|
|||
/**
|
||||
* Fires after a tax is created or updated via the REST API.
|
||||
*
|
||||
* @param stdClass $tax Data used to create the tax.
|
||||
* @param \stdClass $tax Data used to create the tax.
|
||||
* @param \WP_REST_Request $request Request object.
|
||||
* @param boolean $creating True when creating tax, false when updating tax.
|
||||
*/
|
||||
|
@ -409,7 +409,7 @@ class Taxes extends AbstractController {
|
|||
* Get a single tax.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_item( $request ) {
|
||||
$id = (int) $request['id'];
|
||||
|
@ -429,7 +429,7 @@ class Taxes extends AbstractController {
|
|||
* Update a single tax.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function update_item( $request ) {
|
||||
$id = (int) $request['id'];
|
||||
|
@ -446,7 +446,7 @@ class Taxes extends AbstractController {
|
|||
/**
|
||||
* Fires after a tax is created or updated via the REST API.
|
||||
*
|
||||
* @param stdClass $tax Data used to create the tax.
|
||||
* @param \stdClass $tax Data used to create the tax.
|
||||
* @param \WP_REST_Request $request Request object.
|
||||
* @param boolean $creating True when creating tax, false when updating tax.
|
||||
*/
|
||||
|
@ -463,7 +463,7 @@ class Taxes extends AbstractController {
|
|||
* Delete a single tax.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function delete_item( $request ) {
|
||||
global $wpdb;
|
||||
|
@ -494,7 +494,7 @@ class Taxes extends AbstractController {
|
|||
/**
|
||||
* Fires after a tax is deleted via the REST API.
|
||||
*
|
||||
* @param stdClass $tax The tax data.
|
||||
* @param \stdClass $tax The tax data.
|
||||
* @param \WP_REST_Response $response The response returned from the API.
|
||||
* @param \WP_REST_Request $request The request sent to the API.
|
||||
*/
|
||||
|
@ -506,7 +506,7 @@ class Taxes extends AbstractController {
|
|||
/**
|
||||
* Prepare a single tax output for response.
|
||||
*
|
||||
* @param stdClass $tax Tax object.
|
||||
* @param \stdClass $tax Tax object.
|
||||
* @param \WP_REST_Request $request Request object.
|
||||
* @return \WP_REST_Response $response Response data.
|
||||
*/
|
||||
|
@ -560,7 +560,7 @@ class Taxes extends AbstractController {
|
|||
* Filter tax object returned from the REST API.
|
||||
*
|
||||
* @param \WP_REST_Response $response The response object.
|
||||
* @param stdClass $tax Tax object used to create response.
|
||||
* @param \stdClass $tax Tax object used to create response.
|
||||
* @param \WP_REST_Request $request Request object.
|
||||
*/
|
||||
return apply_filters( 'woocommerce_rest_prepare_tax', $response, $tax, $request );
|
||||
|
@ -569,7 +569,7 @@ class Taxes extends AbstractController {
|
|||
/**
|
||||
* Prepare links for the request.
|
||||
*
|
||||
* @param stdClass $tax Tax object.
|
||||
* @param \stdClass $tax Tax object.
|
||||
* @return array Links for the given tax.
|
||||
*/
|
||||
protected function prepare_links( $tax ) {
|
||||
|
|
|
@ -228,7 +228,7 @@ class Webhooks extends AbstractController {
|
|||
* Get all webhooks.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_items( $request ) {
|
||||
$args = array();
|
||||
|
@ -298,7 +298,7 @@ class Webhooks extends AbstractController {
|
|||
* Get a single item.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function get_item( $request ) {
|
||||
$id = (int) $request['id'];
|
||||
|
@ -317,7 +317,7 @@ class Webhooks extends AbstractController {
|
|||
* Create a single webhook.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function create_item( $request ) {
|
||||
if ( ! empty( $request['id'] ) ) {
|
||||
|
@ -377,7 +377,7 @@ class Webhooks extends AbstractController {
|
|||
* Update a single webhook.
|
||||
*
|
||||
* @param \WP_REST_Request $request Full details about the request.
|
||||
* @return \WP_Error\WP_REST_Response
|
||||
* @return \WP_Error|\WP_REST_Response
|
||||
*/
|
||||
public function update_item( $request ) {
|
||||
$id = (int) $request['id'];
|
||||
|
@ -541,7 +541,7 @@ class Webhooks extends AbstractController {
|
|||
* The dynamic portion of the hook name, $this->post_type, refers to post_type of the post being
|
||||
* prepared for insertion.
|
||||
*
|
||||
* @param stdClass $data An object representing a single item prepared
|
||||
* @param \stdClass $data An object representing a single item prepared
|
||||
* for inserting or updating the database.
|
||||
* @param \WP_REST_Request $request Request object.
|
||||
*/
|
||||
|
@ -584,7 +584,7 @@ class Webhooks extends AbstractController {
|
|||
// Wrap the data in a response object.
|
||||
$response = rest_ensure_response( $data );
|
||||
|
||||
$response->add_links( $this->prepare_links( $webhook->get_id(), $request ) );
|
||||
$response->add_links( $this->prepare_links( $webhook->get_id() ) );
|
||||
|
||||
/**
|
||||
* Filter webhook object returned from the REST API.
|
||||
|
|
Loading…
Reference in New Issue