me ] = $field_options;
}
}
// Exclude fields that specify a different context than the request context.
$context = $request['context'];
if ( $context ) {
foreach ( $properties as $name => $options ) {
if ( ! empty( $options['context'] ) && ! in_array( $context, $options['context'], true ) ) {
unset( $properties[ $name ] );
}
}
}
$fields = array_keys( $properties );
if ( ! isset( $request['_fields'] ) ) {
$this->_fields = $fields;
return $fields;
}
$requested_fields = wp_parse_list( $request['_fields'] );
if ( 0 === count( $requested_fields ) ) {
$this->_fields = $fields;
return $fields;
}
// Trim off outside whitespace from the comma delimited list.
$requested_fields = array_map( 'trim', $requested_fields );
// Always persist 'id', because it can be needed for add_additional_fields_to_object().
if ( in_array( 'id', $fields, true ) ) {
$requested_fields[] = 'id';
}
// Return the list of all requested fields which appear in the schema.
$this->_fields = array_reduce(
$requested_fields,
function ( $response_fields, $field ) use ( $fields ) {
if ( in_array( $field, $fields, true ) ) {
$response_fields[] = $field;
return $response_fields;
}
// Check for nested fields if $field is not a direct match.
$nested_fields = explode( '.', $field );
// A nested field is included so long as its top-level property
// is present in the schema.
if ( in_array( $nested_fields[0], $fields, true ) ) {
$response_fields[] = $field;
}
return $response_fields;
},
array()
);
return $this->_fields;
}
/**
* Limit the contents of the meta_data property based on certain request parameters.
*
* Note that if both `include_meta` and `exclude_meta` are present in the request,
* `include_meta` will take precedence.
*
* @param \WP_REST_Request $request The request.
* @param array $meta_data All of the meta data for an object.
*
* @return array
*/
protected function get_meta_data_for_response( $request, $meta_data ) {
$fields = $this->get_fields_for_response( $request );
if ( ! in_array( 'meta_data', $fields, true ) ) {
return array();
}
$include = (array) $request['include_meta'];
$exclude = (array) $request['exclude_meta'];
if ( ! empty( $include ) ) {
$meta_data = array_filter(
$meta_data,
function ( WC_Meta_Data $item ) use ( $include ) {
$data = $item->get_data();
return in_array( $data['key'], $include, true );
}
);
} elseif ( ! empty( $exclude ) ) {
$meta_data = array_filter(
$meta_data,
function ( WC_Meta_Data $item ) use ( $exclude ) {
$data = $item->get_data();
return ! in_array( $data['key'], $exclude, true );
}
);
}
// Ensure the array indexes are reset so it doesn't get converted to an object in JSON.
return array_values( $meta_data );
}
}
Fatal error: Uncaught Error: Class "WC_REST_Controller" not found in /home/hexcom/public_html/digikids/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-v2-controller.php:27
Stack trace:
#0 /home/hexcom/public_html/digikids/wp-content/plugins/woocommerce/vendor/jetpack-autoloader/class-php-autoloader.php(102): require()
#1 /home/hexcom/public_html/digikids/wp-content/plugins/woocommerce/includes/rest-api/Server.php(51): Automattic\Jetpack\Autoloader\jp7a6afec806289ea14cef6c4f425151de\al5_0_0\PHP_Autoloader::load_class()
#2 /home/hexcom/public_html/digikids/wp-content/plugins/woocommerce/includes/class-woocommerce.php(691): Automattic\WooCommerce\RestApi\Server->init()
#3 /home/hexcom/public_html/digikids/wp-includes/class-wp-hook.php(353): WooCommerce->load_rest_api()
#4 /home/hexcom/public_html/digikids/wp-includes/class-wp-hook.php(377): WP_Hook->apply_filters()
#5 /home/hexcom/public_html/digikids/wp-includes/plugin.php(523): WP_Hook->do_action()
#6 /home/hexcom/public_html/digikids/wp-settings.php(779): do_action()
#7 /home/hexcom/public_html/digikids/wp-config.php(98): require_once('/home/hexcom/pu...')
#8 /home/hexcom/public_html/digikids/wp-load.php(50): require_once('/home/hexcom/pu...')
#9 /home/hexcom/public_html/digikids/wp-blog-header.php(13): require_once('/home/hexcom/pu...')
#10 /home/hexcom/public_html/digikids/index.php(17): require('/home/hexcom/pu...')
#11 {main}
thrown in /home/hexcom/public_html/digikids/wp-content/plugins/woocommerce/includes/rest-api/Controllers/Version2/class-wc-rest-system-status-v2-controller.php on line 27