Last active
July 14, 2020 21:45
-
-
Save thomasbennett/39b6ab734e0111a81fd7a6be7e0fc67f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// put the code from this section into the if/else below around line 615 | |
// if ( in_array( $request_method, array( 'GET', 'DELETE' ) ) && ! empty( $request_data ) ) { | |
// this garbage code will make their API work | |
if ( $request_method === 'GET' && 'json' === $feed['meta']['requestFormat'] ) { | |
// Add content type header. | |
$request_headers['Content-Type'] = 'application/json'; | |
// Encode request data. | |
$request_data = urlencode(json_encode( $request_data )); | |
file_put_contents(__DIR__ . '/log.log', $request_url . $request_data); | |
$request_url = $request_url . $request_data; | |
// otherwise do what the plugin is supposed to do | |
} else { | |
// If this is a GET or DELETE request, add request data to request URL. | |
if ( in_array( $request_method, array( 'GET', 'DELETE' ) ) && ! empty( $request_data ) ) { | |
$request_url = add_query_arg( $request_data, $request_url ); | |
} | |
// If this is a PUT or POST request, format request data. | |
if ( in_array( $request_method, array( 'POST', 'PUT' ) ) && 'json' === $feed['meta']['requestFormat'] ) { | |
// Add content type header. | |
$request_headers['Content-Type'] = 'application/json'; | |
// Encode request data. | |
$request_data = json_encode( $request_data ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment