PluginProbe
MainWP Dashboard: Self-hosted WordPress Management for Agencies / 6.2.2
MainWP Dashboard: Self-hosted WordPress Management for Agencies v6.2.2
6.2.2 6.2.1 6.2 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1 6.0.12 6.0.11 4.6.0.1 5.0 5.0.1 5.0.2 5.0.3 5.0.3.1 5.0.3.2 5.1 5.1.1 5.2 5.2.1 All 155 releases
← All changes | includes/rest-api/controller/version2/class-mainwp-rest-users-controller.php +3 -32 6.1.7 → 6.2.2 View file →
@@ -1767,41 +1767,12 @@
1767 1767 /**
1768 1768 * Get request body.
1769 1769 *
1770 1770 * @param WP_REST_Request $request Full details about the request.
1771 - * @return array|WP_Error
1771 + * @return array|WP_Error Body data, or an empty_body error when nothing usable was sent.
1772 1772 */
1773 - private function get_request_body( $request ) { // phpcs:ignore -- NOSONAR - complex.
1774 - // Get request body filed.
1775 - $body = $request->get_body_params();
1776 - if ( ! empty( $body ) && is_array( $body ) ) {
1777 - return $body;
1778 - }
1779 -
1780 - // Get request body from body.
1781 - $body = $request->get_json_params();
1782 - if ( ! empty( $body ) && is_array( $body ) ) {
1783 - return $body;
1784 - }
1785 -
1786 - // Get request body from raw.
1787 - $body = $request->get_body();
1788 - if ( ! empty( $body ) && is_string( $body ) ) {
1789 - $body = json_decode( $body, true );
1790 - if ( ! is_array( $body ) ) {
1791 - return new WP_Error(
1792 - 'invalid_json',
1793 - __( 'Request body contains invalid JSON.', 'mainwp' ),
1794 - array( 'status' => 400 )
1795 - );
1796 - }
1797 - return $body;
1798 - }
1799 - // Return error.
1800 - return new WP_Error(
1801 - 'empty_body',
1802 - __( 'Request body is empty.', 'mainwp' ),
1803 - );
1773 + private function get_request_body( $request ) {
1774 + return $this->get_request_body_data( $request );
1804 1775 }
1805 1776
1806 1777 /**
1807 1778 * Validate content type.