PluginProbe
WPGet API – Connect to any external REST API / 1.4.0
WPGet API – Connect to any external REST API v1.4.0
1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.1.0 2.1.1 2.1.3 2.1.4 2.1.5 2.2.0 2.2.1 2.2.10 2.2.2 2.2.3 All 97 releases
← All changes | includes/class-api.php +99 -333 1.9.21.4.0 View file →
@@ -26,12 +26,9 @@
26 26 public $endpoint = ''; // the endpoint that we will get
27 27 public $query_parameters = ''; // the query paramaters appended to url
28 28 public $header_parameters = ''; // the header paramaters
29 29 public $body_parameters = ''; // the body paramaters
30 - public $body_json_encode = ''; // body_json_encode body
31 - public $body_url_encode = ''; // urlencode body
32 - public $body_xml_format = ''; // xml format body
33 - public $xml_root_node = 'root'; // root node for xml
30 + public $body_json_encode = ''; // the body_json_encode
34 31
35 32 public $response = ''; // the returned response
36 33
37 34 public $final_url = ''; // final URL
@@ -36,13 +33,12 @@
36 33
37 34 public $final_url = ''; // final URL
38 35 public $final_request_args = array(); // final request_args
39 36
40 - public $results_format = 'json_string'; // results format
37 + public $results_format = 'json_string'; // reseults format
41 38
42 39 public $timeout = 10; // the timeout
43 40 public $sslverify = 1; // the paramaters
44 - public $debug = false;
45 41
46 42
47 43 /**
48 44 * Main constructor
@@ -60,9 +56,9 @@
60 56 $this->endpoint_id = sanitize_text_field( $endpoint_id );
61 57 $this->keys = $keys;
62 58 $this->args = $args;
63 59
64 - add_filter( 'wpgetapi_raw_data', array( $this, 'maybe_add_debug_info' ), 99, 2 );
60 + add_filter( 'wpgetapi_raw_data', array( $this, 'maybe_add_debug_info' ), 5, 2 );
65 61
66 62 }
67 63
68 64
@@ -70,29 +66,8 @@
70 66 * Init our api data
71 67 */
72 68 public function init() {
73 69
74 - // if we are doing importer plugin,
75 - // we need to intercept and modify most of our methods values
76 - if( $this->api_id == 'wpgetapi_importer' ) {
77 -
78 - $data = apply_filters( 'wpgetapi_api_importer_init', $this );
79 -
80 - if( $data ) {
81 -
82 - foreach ($data as $key => $value) {
83 - $this->{$key} = $value;
84 - }
85 -
86 - $this->query_parameters = ! empty( $this->query_parameters ) ? $this->do_parameters( $this->query_parameters ) : array();
87 - $this->header_parameters = ! empty( $this->header_parameters ) ? $this->do_parameters( $this->header_parameters ) : array();
88 - $this->body_parameters = ! empty( $this->body_parameters ) ? $this->do_parameters( $this->body_parameters ) : array();
89 - return;
90 -
91 - }
92 -
93 - }
94 -
95 70 // do some checks
96 71 if( empty( $this->setup ) || ! isset( $this->setup['apis'] ) || empty( $this->setup['apis'] ) )
97 72 return 'No API found.';
98 73
@@ -111,9 +86,9 @@
111 86 // loop through endpoints
112 87 foreach ( $this->api['endpoints'] as $index => $endpoint ) {
113 88
114 89 if( $this->endpoint_id == $endpoint['id'] ) {
115 -
90 +
116 91 $this->method = isset( $endpoint['method'] ) && $endpoint['method'] != '' ? sanitize_text_field( $endpoint['method'] ) : 'GET';
117 92 $this->cache_time = isset( $endpoint['cache_time'] ) && ! empty( $endpoint['cache_time'] ) ? absint( $endpoint['cache_time'] ) : '';
118 93 $this->endpoint = isset( $endpoint['endpoint'] ) && ! empty( $endpoint['endpoint'] ) ? sanitize_text_field( $endpoint['endpoint'] ) : '';
119 94
@@ -122,29 +97,11 @@
122 97 $this->header_parameters = isset( $endpoint['header_parameters'] ) && ! empty( $endpoint['header_parameters'] ) ? $this->do_parameters( $endpoint['header_parameters'] ) : array();
123 98
124 99 $this->body_parameters = isset( $endpoint['body_parameters'] ) && ! empty( $endpoint['body_parameters'] ) ? $this->do_parameters( $endpoint['body_parameters'] ) : array();
125 100
126 - // how to encode the body
127 - $this->body_json_encode = isset( $endpoint['body_json_encode'] ) && $endpoint['body_json_encode'] == 'true' ? true : false;
128 - $this->body_url_encode = isset( $endpoint['body_json_encode'] ) && $endpoint['body_json_encode'] == 'url' ? true : false;
129 - $this->body_xml_format = isset( $endpoint['body_json_encode'] ) && $endpoint['body_json_encode'] == 'xml' ? true : false;
130 -
131 - $this->xml_root_node = isset( $endpoint['xml_root'] ) && ! empty( $endpoint['xml_root'] ) ? $endpoint['xml_root'] : $this->xml_root_node;
132 -
101 + $this->body_json_encode = isset( $endpoint['body_json_encode'] ) && ! empty( $endpoint['body_json_encode'] ) ? sanitize_text_field( $endpoint['body_json_encode'] ) : true;
133 102 $this->results_format = isset( $endpoint['results_format'] ) ? sanitize_text_field( $endpoint['results_format'] ) : $this->results_format;
134 -
135 -
136 - if(
137 - // set the format to php array data if html format is set
138 - ( isset( $this->args['format'] ) && $this->args['format'] == 'html' && $this->results_format != 'xml_array' ) ||
139 - // set the format to php array data if it is set in the args (coming from the importer)
140 - ( isset( $this->args['results_format'] ) && $this->args['results_format'] == 'json_decoded' )
141 - ) {
142 - $this->results_format = 'json_decoded';
143 - }
144 -
145 103 }
146 -
147 104 }
148 105
149 106 $this->timeout = isset( $this->api['timeout'] ) && ! empty( $this->api['timeout'] ) ? $this->api['timeout'] : $this->timeout;
150 107 $this->sslverify = isset( $this->api['sslverify'] ) ? absint( $this->api['sslverify'] ) : $this->sslverify;
@@ -157,21 +114,58 @@
157 114 *
158 115 * @param string $field Field to retrieve
159 116 */
160 117 public function endpoint_output() {
118 + return $this->do_the_call();
119 + }
161 120
162 - do_action( 'wpgetapi_before_do_the_call', $this );
163 121
164 - return $this->do_the_call();
122 + /**
123 + * Sort out the parameters if they exist
124 + */
125 + public function do_parameters( $parameters ) {
126 +
127 + $new_array = array();
128 + $parameters = $this->decrypt($parameters);
165 129
130 + if( is_array( $parameters ) ) {
131 + foreach ( $parameters as $key => $parameter ) {
132 + if( ! empty( $parameter['name'] ) && ! empty( $parameter['value'] ) ) {
133 + $parameter['value'] = stripslashes( $parameter['value'] );
134 + $new_array[ sanitize_text_field( $parameter['name'] ) ] = $parameter['value'];
135 + }
136 + }
137 + }
138 +
139 + // look for array or json string and sort these out - for using such things in shortcode
140 + if( is_array( $new_array ) ) {
141 +
142 + foreach ( $new_array as $key => $value ) {
143 +
144 + // checking if the parameters have a json string
145 + if ( substr( $value, 0, 1 ) === '{' && substr( $value, -1 ) === '}' ) {
146 + $new_array[ $key ] = json_decode( $value, true);
147 + }
148 +
149 + // checking if the parameters have an array within the string
150 + // if they do, create them as an actual array
151 + if ( substr( $value, 0, 1 ) === '[' && substr( $value, -1 ) === ']' ) {
152 + $new_array[ $key ] = array( $value );
153 + }
154 +
155 + }
156 +
157 + }
158 +
159 + return $new_array;
160 +
166 161 }
167 162
168 -
169 163 /**
170 164 * Send the request and return our data
171 165 */
172 166 public function do_the_call() {
173 -
167 +
174 168 $this->init();
175 169
176 170 // build the URL
177 171 $this->final_url = apply_filters( 'wpgetapi_final_url', $this->build_url(), $this );
@@ -177,56 +171,28 @@
177 171 $this->final_url = apply_filters( 'wpgetapi_final_url', $this->build_url(), $this );
178 172
179 173 // build the request args
180 174 $this->final_request_args = apply_filters( 'wpgetapi_final_request_args', $this->build_request_args(), $this );
181 -
182 - /**
183 - * Check if we should stop or not. Setting $on to true, will stop us calling the api.
184 - * @param bool $on Whether on is set or not.
185 - */
186 175
187 - if ( apply_filters( 'wpgetapi_should_we_stop', false, $this ) ) {
188 - return;
189 - }
190 -
191 176 // POST request
192 177 if( $this->method == 'POST' )
193 178 $this->response = $this->POST_request();
194 179
195 - // PUT request
196 - if( $this->method == 'PUT' )
197 - $this->response = $this->PUT_request();
198 -
199 180 // GET request
200 181 if( $this->method == 'GET' )
201 182 $this->response = $this->GET_request();
202 183
203 - // DELETE request
204 - if( $this->method == 'DELETE' )
205 - $this->response = $this->DELETE_request();
206 -
207 184 // wp error
208 185 if( is_wp_error( $this->response ) ) {
209 - return apply_filters( 'wpgetapi_raw_error_data', json_encode( $this->response ), $this );
186 + return apply_filters( 'wpgetapi_raw_data', json_encode( $this->response ), $this );
210 187 }
211 188
212 - // get response_code
213 - $response_code = wp_remote_retrieve_response_code( $this->response );
189 + $data = wp_remote_retrieve_body( $this->response );
214 190
215 - // action to intercept call depending on response_code
216 - $this->response = apply_filters( 'wpgetapi_before_retrieve_body', $this->response, $response_code, $this );
217 -
218 - // get body
219 - // modified in version 1.6.1 to allow for OAuth 2.0 plugin returning body already
220 - $data = isset( $this->response['body'] ) ? $this->response['body'] : $this->response;
221 -
222 191 // returning in JSON format
223 192 if( $this->results_format == 'json_string' || $this->results_format == 'json_decoded' )
224 - $data = $this->return_data( $data );
193 + $data = $this->output_json( $data );
225 194
226 - if( $data === 'null' )
227 - $data = 'Result is null. Check that all endpoint settings are correct.';
228 -
229 195 return apply_filters( 'wpgetapi_raw_data', $data, $this );
230 196
231 197 }
232 198
@@ -239,22 +205,12 @@
239 205 // first make sure our endpoint starts with a slash
240 206 if ( substr( $this->endpoint, 0, 1 ) != '/' )
241 207 $this->endpoint = '/' . $this->endpoint;
242 208
243 - $this->endpoint = apply_filters( 'wpgetapi_endpoint', $this->endpoint, $this );
244 -
245 209 $url = untrailingslashit( $this->base_url ) . $this->endpoint;
246 210
247 - // if we have a URL pagination event from the import plugin
248 - // we need to modify the URL here
249 - if( isset( $this->args['paginate_url'] ) )
250 - $url = $this->args['paginate_url'];
251 -
252 - // filter our params - added for use in Oauth 2.0 plugin
253 - $params = apply_filters( 'wpgetapi_query_parameters', $this->query_parameters, $this );
254 -
255 211 // add empty array - was getting errors if it was just null or false
256 - $params = empty( $params ) ? array(''=>'') : $params;
212 + $params = empty( $this->query_parameters ) ? array(''=>'') : $this->query_parameters;
257 213
258 214 return add_query_arg( $params, $url );
259 215
260 216 }
@@ -271,50 +227,19 @@
271 227 ), $this );
272 228
273 229
274 230 // if doing POST request, include body paramters
275 - if( $this->method == 'POST' || $this->method == 'PUT' || $this->method == 'DELETE' ) {
276 -
277 - // tokens are sent through here
231 + if( $this->method == 'POST' ) {
232 +
278 233 $this->body_parameters = apply_filters( 'wpgetapi_body_parameters', $this->body_parameters, $this );
279 234
280 - // do we json_encode the entire body
281 - if( $this->body_json_encode == true ) {
235 + // do we json_encode the entire body as a string
236 + if( $this->body_json_encode === true || $this->body_json_encode === 'true' )
282 237 $this->body_parameters = json_encode( $this->body_parameters );
283 - }
284 238
285 - // do we urlencode the entire body
286 - if( $this->body_url_encode == true ) {
287 -
288 - // checking if the parameters have a json string (raw)
289 - if (
290 - ( ! is_array( $this->body_parameters ) ) &&
291 - ( substr( $this->body_parameters, 0, 1 ) === '{' || substr( $this->body_parameters, 0, 1 ) === '[' )
292 - ) {
293 - $this->body_parameters = json_decode( $this->body_parameters, true );
294 - }
295 -
296 - $this->body_parameters = http_build_query( $this->body_parameters, '', '&' );
239 + // add our body parameters
240 + $headers['headers']['body'] = $this->body_parameters;
297 241
298 - }
299 -
300 - // do we xml the entire body
301 - if( $this->body_xml_format == true ) {
302 -
303 - $xml = new SimpleXmlElement( '<' . $this->xml_root_node . '/>' );
304 -
305 - foreach( $this->body_parameters as $key => $value) {
306 - $xml->addChild( $key, $value );
307 - }
308 -
309 - $this->body_parameters = $xml->asXML();
310 -
311 - }
312 -
313 - // add our body parameters
314 - if( $this->body_parameters && ! empty( $this->body_parameters ) )
315 - $headers['body'] = $this->body_parameters;
316 -
317 242 }
318 243
319 244 // add headers to our final request args
320 245 $this->final_request_args = wp_parse_args( $headers, $this->final_request_args );
@@ -332,10 +257,8 @@
332 257
333 258 }
334 259
335 260
336 -
337 -
338 261 /**
339 262 * Do a GET request
340 263 */
341 264 public function GET_request() {
@@ -341,154 +264,42 @@
341 264 public function GET_request() {
342 265 $response = '';
343 266 // so we can so something before the remote_get (caching)
344 267 $response = apply_filters( 'wpgetapi_before_get_request', $response, $this );
345 -
346 268 if( empty( $response ) )
347 269 $response = wp_remote_get( $this->final_url, $this->final_request_args );
270 +
348 271 return $response;
349 272 }
350 273
274 +
351 275 /**
352 276 * Do a POST request
353 277 */
354 278 public function POST_request() {
355 - $this->final_request_args['method'] = 'POST';
356 279 $response = wp_remote_post( $this->final_url, $this->final_request_args );
357 280 return $response;
358 281 }
359 282
360 - /**
361 - * Do a PUT request
362 - */
363 - public function PUT_request() {
364 - $this->final_request_args['method'] = 'PUT';
365 - $response = wp_remote_request( $this->final_url, $this->final_request_args );
366 - return $response;
367 - }
368 283
369 284 /**
370 - * Do a DELETE request
285 + * return JSON data
371 286 */
372 - public function DELETE_request() {
373 - $this->final_request_args['method'] = 'DELETE';
374 - $response = wp_remote_request( $this->final_url, $this->final_request_args );
375 - return $response;
376 - }
287 + public function output_json( $data ) {
377 288
378 -
379 - /**
380 - * return data
381 - */
382 - public function return_data( $data ) {
383 -
384 - $data = apply_filters( 'wpgetapi_json_response_body_before_decode', $data, $this->keys );
385 -
386 289 // converts all data to arrays, removing objects
387 - if( is_string( $data ) ) {
388 - $decode = json_decode( $data, true );
389 - if( json_last_error() ) {
390 - return esc_html( $data );
391 - } else {
392 - $data = $decode;
393 - }
394 - }
395 -
290 + $data = json_decode( $data, true );
396 291 $data = apply_filters( 'wpgetapi_json_response_body', $data, $this->keys );
397 -
292 +
398 293 if( $this->results_format == 'json_string' )
399 294 return trim( json_encode( $data ),'"');
400 -
295 +
401 296 if( $this->results_format == 'json_decoded' )
402 297 return $data;
403 298
404 299 }
405 300
406 - /**
407 - * Sort out the parameters if they exist
408 - */
409 - public function do_parameters( $parameters ) {
410 -
411 - $new_array = array();
412 - $raw = '';
413 - $parameters = $this->decrypt( $parameters );
414 301
415 - if( is_array( $parameters ) ) {
416 - foreach ( $parameters as $key => $parameter ) {
417 -
418 - if( ! empty( $parameter['name'] ) && ! empty( $parameter['value'] ) ) {
419 -
420 - $parameter['value'] = stripslashes( $parameter['value'] );
421 -
422 - // if we have wpgetapi_on, delete it so we don't send to api
423 - if( $parameter['name'] == 'wpgetapi_on' ) {
424 - unset( $parameters[ $key ] );
425 - continue;
426 - }
427 -
428 - $new_array[ sanitize_text_field( $parameter['name'] ) ] = $parameter['value'];
429 -
430 - // if we are sending raw body
431 - } else if( empty( $parameter['name'] ) && ! empty( $parameter['value'] ) ) {
432 -
433 - $raw = stripslashes( $parameter['value'] );
434 -
435 - }
436 -
437 - }
438 - }
439 -
440 - // look for array or json string and sort these out - for using such things in shortcode
441 - if( ! empty( $new_array ) ) {
442 -
443 - foreach ( $new_array as $key => $value ) {
444 -
445 - // checking if the parameters have a json string
446 - if ( strpos( $value, '{' ) !== false && strpos( $value, '}' ) !== false ) {
447 - //if ( substr( $value, 0, 1 ) === '{' && substr( $value, -1 ) === '}' ) {
448 - $new_array[ $key ] = json_decode( $value, true );
449 - } else
450 -
451 - // checking if the parameters have an array within the string
452 - // if they do, create them as an actual array
453 - if ( substr( $value, 0, 1 ) === '[' && substr( $value, -1 ) === ']' ) {
454 - $value = trim( $value,"[]" );
455 - $new_array[ $key ] = array( $value );
456 - }
457 -
458 - // set value as integer
459 - if ( strpos( $value, 'integer(' ) !== false && substr( $value, -1 ) === ')' ) {
460 - preg_match("/\(([^\)]*)\)/", $value, $match );
461 - $result = $match[1];
462 - $new_array[ $key ] = absint( $result );
463 - }
464 -
465 - // set value as float
466 - if ( strpos( $value, 'float(' ) !== false && substr( $value, -1 ) === ')' ) {
467 - preg_match("/\(([^\)]*)\)/", $value, $match );
468 - $result = $match[1];
469 - $new_array[ $key ] = (float) $result;
470 -
471 - }
472 -
473 - // set value as boolean
474 - if ( strpos( $value, 'boolean(' ) !== false && substr( $value, -1 ) === ')' ) {
475 - preg_match("/\(([^\)]*)\)/", $value, $match );
476 - $result = $match[1];
477 - $result = filter_var( $result, FILTER_VALIDATE_BOOLEAN );
478 - $new_array[ $key ] = $result;
479 -
480 - }
481 -
482 - }
483 -
484 - }
485 -
486 - return $raw ? $raw : $new_array;
487 -
488 - }
489 -
490 -
491 302 /**
492 303 * decrypt our parameters from the DB
493 304 */
494 305 public function decrypt( $array_or_string ) {
@@ -514,27 +325,20 @@
514 325
515 326 /**
516 327 * debug
517 328 */
518 - public function maybe_add_debug_info( $data, $wpgetapi ) {
329 + public function maybe_add_debug_info( $data, $this_data ) {
519 330
520 - if(
521 - ( isset( $this->args['debug'] ) && ( $this->args['debug'] === true || $this->args['debug'] === 'true' ) ) ||
522 - ( isset( $this->args['test_endpoint'] ) && ( $this->args['test_endpoint'] === true ) )
523 - ) {
331 + if( isset( $this->args['debug'] ) && ( $this->args['debug'] === true || $this->args['debug'] === 'true' ) ) {
524 332
525 - $this->debug = true;
526 -
527 - $testing = isset( $this->args['test_endpoint'] ) && ( $this->args['test_endpoint'] === true ) ? true : false;
528 -
529 333 ob_start(); ?>
530 334
531 335 <style>
532 336
533 337 .wpgetapi-debug {
534 - background: #fff;
338 + background: #f4f4f4;
535 339 padding: 20px;
536 - box-shadow: 0 0 1px #aaa;
340 + border: 1px solid #ccc;
537 341 margin: 20px;
538 342 font-size: 15px;
539 343 }
540 344 .wpgetapi-debug
@@ -549,9 +353,9 @@
549 353 }
550 354 .wpgetapi-debug p.small {
551 355 font-size: 85%;
552 356 color: #999;
553 - margin: 0 0 12px !important;
357 + margin-bottom: 15px !important
554 358 }
555 359 .wpgetapi-debug h5 {
556 360 font-weight: bold;
557 361 font-size: 18px;
@@ -561,25 +365,24 @@
561 365 .wpgetapi-debug .debug-item {
562 366 margin: 10px 0;
563 367 background: #fff;
564 368 padding: 15px 20px;
565 - display: inline-block !important;
369 + display: inline-block !important;;
566 370 width: 100% !important;
567 - box-shadow: 3px 3px 0 rgb(0 0 0 / 8%);
568 - border: 1px solid #efefef;
371 + box-shadow: 0 0 5px rgba(0,0,0,0.1)
569 372 }
570 373 .wpgetapi-debug .debug-item h6 {
571 374 font-weight: bold;
572 - font-size: 14px;
573 - margin: 0;
375 + font-size: 16px;
376 + margin: 0 0 3px;
574 377 text-transform: none !important;
575 378 }
576 379 .wpgetapi-debug .debug-item .debug-result,
577 380 .wpgetapi-debug .debug-item .debug-result pre {
578 381 font-family: monospace !important;
579 - font-size: 13px !important;
382 + font-size: 15px !important;
580 383 margin: 0 !important;
581 - padding: 8px 12px;
384 + padding: 10px 12px;
582 385 background: #f8f8f8;
583 386 }
584 387 .wpgetapi-debug .debug-item .debug-result pre {
585 388 border: none;
@@ -585,102 +388,63 @@
585 388 border: none;
586 389 padding: 5px
587 390 }
588 391
589 -.wpgetapi-debug.testing {
590 - background: transparent;
591 - padding: 0;
592 - box-shadow: none;
593 -}
594 -.wpgetapi-debug.testing .debug-item {
595 - margin: 5px 0;
596 -}
597 392 </style>
598 393
599 - <div class="wpgetapi-debug <?php echo $testing ? 'testing' : ''; ?>">
394 + <div class="wpgetapi-debug">
600 395
601 - <?php if( $testing ) { ?>
396 + <h5><strong>WPGetAPI, Debug Mode - Plugin Version <?php esc_html_e( WpGetApi()->version ); ?></strong></h5>
397 + <p class="small">Below you will find debug info for the current API call. To turn this off, set debug to false in your shortcode or template tag.<br>Connecting to API's can be tricky - if you require help, please see the <a target="_blank" href="https://wpgetapi.com/docs/">Documentation</a> and if you can't find the answer then please use the contact form on our <a target="_blank" title="Connect WordPress with external API" href="https://wpgetapi.com/">website</a> to get assistance.</p>
602 398
603 - <div class="debug-item">
604 - <h6><?php esc_html_e( 'Full URL', 'wpgetapi' ); ?></h6>
605 - <p class="small"><?php esc_html_e( 'The full URL that is being called.', 'wpgetapi' ); ?></p>
606 - <div class="debug-result"><?php esc_html_e( $this->final_url ); ?></div>
607 - </div>
608 -
609 - <div class="debug-item">
610 - <h6><?php esc_html_e( 'Data Output', 'wpgetapi' ); ?></h6>
611 - <p class="small"><?php esc_html_e( 'The output that has been returned from the API. This is what the shortcode or template tag will display and can be formatted however you like.', 'wpgetapi' ); ?></p>
612 - <p class="small"><?php esc_html_e( 'See the ', 'wpgetapi' ); ?> <a target="_blank" href="https://wpgetapi.com/docs/?utm_campaign=Test Endpoint&utm_medium=Admin&utm_source=User"><?php esc_html_e( 'documentation', 'wpgetapi' ); ?></a> <?php esc_html_e( ' for help in formatting.', 'wpgetapi' ); ?></p>
613 - <div class="debug-result"><?php wpgetapi_pp( $data ); ?></div>
614 - </div>
615 -
616 - <div class="debug-item">
617 - <h6><?php esc_html_e( 'Final Request Arguments', 'wpgetapi' ); ?></h6>
618 - <p class="small"><?php esc_html_e( 'The final request arguments sent in the API request. Includes headers and body arguments.', 'wpgetapi' ); ?></p>
619 - <div class="debug-result"><?php wpgetapi_pp( $this->final_request_args ); ?></div>
620 - </div>
621 -
622 - <div class="debug-item">
623 - <h6><?php esc_html_e( 'Response', 'wpgetapi' ); ?></h6>
624 - <p class="small"><?php esc_html_e( 'The full response from the API request.', 'wpgetapi' ); ?></p>
625 - <div class="debug-result"><?php wpgetapi_pp( $this->response); ?></div>
626 - </div>
627 -
628 - <?php } else { ?>
629 -
630 - <h5><strong><?php esc_html_e( 'WPGetAPI, Debug Mode - Plugin Version', 'wpgetapi' ); ?> <?php esc_html_e( WpGetApi()->version ); ?></strong></h5>
631 - <p class="small"><?php esc_html_e( 'Below you will find debug info for the current API call. To turn this off, set debug to false in your shortcode or template tag.', 'wpgetapi' ); ?><br><?php esc_html_e( 'Connecting to API\'s can be tricky - if you require help, please see the', 'wpgetapi' ); ?> <a target="_blank" href="https://wpgetapi.com/docs/"><?php esc_html_e( 'Documentation', 'wpgetapi' ); ?></a>.</p>
632 -
633 399 <div class="debug-item">
634 - <h6><?php esc_html_e( 'Full URL', 'wpgetapi' ); ?></h6>
635 - <p class="small"><?php esc_html_e( 'The full URL that is being called.', 'wpgetapi' ); ?></p>
400 + <h6>Full URL</h6>
401 + <p class="small">The full URL that is being called.</p>
636 402 <div class="debug-result"><?php esc_html_e( $this->final_url ); ?></div>
637 403 </div>
638 404
639 405 <div class="debug-item">
640 - <h6><?php esc_html_e( 'Data Output', 'wpgetapi' ); ?></h6>
641 - <p class="small"><?php esc_html_e( 'The resulting output that has been returned from the API.', 'wpgetapi' ); ?></p>
406 + <h6>Data Output</h6>
407 + <p class="small">The resulting output that has been returned from the API.</p>
642 408 <div class="debug-result"><?php wpgetapi_pp( $data ); ?></div>
643 409 </div>
644 410
645 411 <div class="debug-item">
646 - <h6><?php esc_html_e( 'Query String', 'wpgetapi' ); ?></h6>
647 - <p class="small"><?php esc_html_e( 'The query string parameters (if any) that you have set within the endpoint settings.', 'wpgetapi' ); ?></p>
412 + <h6>Arguments</h6>
413 + <p class="small">The arguments set within your shortcode or template tag.</p>
414 + <div class="debug-result"><?php wpgetapi_pp( $this->args ); ?></div>
415 + </div>
416 +
417 + <div class="debug-item">
418 + <h6>Query String</h6>
419 + <p class="small">The query string parameters (if any) that you have set within the endpoint settings.</p>
648 420 <div class="debug-result"><?php wpgetapi_pp( $this->query_parameters ); ?></div>
649 421 </div>
650 422
651 423 <div class="debug-item">
652 - <h6><?php esc_html_e( 'Headers', 'wpgetapi' ); ?></h6>
653 - <p class="small"><?php esc_html_e( 'The header parameters (if any) that you have set within the endpoint settings.', 'wpgetapi' ); ?></p>
424 + <h6>Headers</h6>
425 + <p class="small">The headers parameters (if any) that you have set within the endpoint settings.</p>
654 426 <div class="debug-result"><?php wpgetapi_pp( $this->header_parameters ); ?></div>
655 427 </div>
656 428
657 429 <div class="debug-item">
658 - <h6><?php esc_html_e( 'Body', 'wpgetapi' ); ?></h6>
659 - <p class="small"><?php esc_html_e( 'The body parameters (if any) that you have set within the endpoint settings.', 'wpgetapi' ); ?></p>
430 + <h6>Body</h6>
431 + <p class="small">The body parameters (if any) that you have set within the endpoint settings.</p>
660 432 <div class="debug-result"><?php wpgetapi_pp( $this->body_parameters ); ?></div>
661 433 </div>
662 434
663 435 <div class="debug-item">
664 - <h6><?php esc_html_e( 'Final Request Arguments', 'wpgetapi' ); ?></h6>
665 - <p class="small"><?php esc_html_e( 'The final request arguments sent in the API request. Includes headers and body arguments.', 'wpgetapi' ); ?></p>
436 + <h6>Final Request Arguments</h6>
437 + <p class="small">The final request arguments sent in the API request. Includes headers and body arguments.</p>
666 438 <div class="debug-result"><?php wpgetapi_pp( $this->final_request_args ); ?></div>
667 439 </div>
668 440
669 441 <div class="debug-item">
670 - <h6><?php esc_html_e( 'Arguments', 'wpgetapi' ); ?></h6>
671 - <p class="small"><?php esc_html_e( 'The arguments set within your shortcode or template tag.', 'wpgetapi' ); ?></p>
672 - <div class="debug-result"><?php wpgetapi_pp( $this->args ); ?></div>
673 - </div>
674 -
675 - <div class="debug-item">
676 - <h6><?php esc_html_e( 'Response', 'wpgetapi' ); ?></h6>
677 - <p class="small"><?php esc_html_e( 'The full response from the API request.', 'wpgetapi' ); ?></p>
442 + <h6>Response</h6>
443 + <p class="small">The full response from the API request.</p>
678 444 <div class="debug-result"><?php wpgetapi_pp( $this->response); ?></div>
679 445 </div>
680 446
681 - <?php } ?>
682 -
683 447 </div>
684 448
685 449 <?php
686 450
@@ -690,9 +454,11 @@
690 454
691 455 return $data;
692 456
693 457 }
458 +
459 +
694 460
695 461 }
696 462
697 463
698 464 }