PluginProbe
WPGet API – Connect to any external REST API / 1.8.9
WPGet API – Connect to any external REST API v1.8.9
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 +35 -262 2.1.41.8.9 View file →
@@ -28,9 +28,8 @@
28 28 public $header_parameters = ''; // the header paramaters
29 29 public $body_parameters = ''; // the body paramaters
30 30 public $body_json_encode = ''; // body_json_encode body
31 31 public $body_url_encode = ''; // urlencode body
32 - public $body_base64_encode = ''; // base64 encode body
33 32 public $body_xml_format = ''; // xml format body
34 33 public $xml_root_node = 'root'; // root node for xml
35 34
36 35 public $response = ''; // the returned response
@@ -39,15 +38,11 @@
39 38 public $final_request_args = array(); // final request_args
40 39
41 40 public $results_format = 'json_string'; // results format
42 41
43 - public $response_code = ''; // the response code from the call
44 -
45 42 public $timeout = 10; // the timeout
46 - public $sslverify = 1; // ssl verify
43 + public $sslverify = 1; // the paramaters
47 44 public $debug = false;
48 -
49 - public $pro_plugin = false;
50 45
51 46
52 47 /**
53 48 * Main constructor
@@ -65,10 +60,8 @@
65 60 $this->endpoint_id = sanitize_text_field( $endpoint_id );
66 61 $this->keys = $keys;
67 62 $this->args = $args;
68 63
69 - $this->pro_plugin = is_plugin_active( 'wpgetapi-extras/wpgetapi-extras.php' ) ? true : false;
70 -
71 64 add_filter( 'wpgetapi_raw_data', array( $this, 'maybe_add_debug_info' ), 99, 2 );
72 65
73 66 }
74 67
@@ -79,9 +72,9 @@
79 72 public function init() {
80 73
81 74 // if we are doing importer plugin,
82 75 // we need to intercept and modify most of our methods values
83 - if( $this->api_id === 'wpgetapi_importer' ) {
76 + if( $this->api_id == 'wpgetapi_importer' ) {
84 77
85 78 $data = apply_filters( 'wpgetapi_api_importer_init', $this );
86 79
87 80 if( $data ) {
@@ -129,38 +122,20 @@
129 122 $this->header_parameters = isset( $endpoint['header_parameters'] ) && ! empty( $endpoint['header_parameters'] ) ? $this->do_parameters( $endpoint['header_parameters'] ) : array();
130 123
131 124 $this->body_parameters = isset( $endpoint['body_parameters'] ) && ! empty( $endpoint['body_parameters'] ) ? $this->do_parameters( $endpoint['body_parameters'] ) : array();
132 125
133 - // how to encode the body
134 126 $this->body_json_encode = isset( $endpoint['body_json_encode'] ) && $endpoint['body_json_encode'] == 'true' ? true : false;
135 127 $this->body_url_encode = isset( $endpoint['body_json_encode'] ) && $endpoint['body_json_encode'] == 'url' ? true : false;
136 - $this->body_base64_encode = isset( $endpoint['body_json_encode'] ) && $endpoint['body_json_encode'] == 'base64' ? true : false;
137 128 $this->body_xml_format = isset( $endpoint['body_json_encode'] ) && $endpoint['body_json_encode'] == 'xml' ? true : false;
138 -
139 129 $this->xml_root_node = isset( $endpoint['xml_root'] ) && ! empty( $endpoint['xml_root'] ) ? $endpoint['xml_root'] : $this->xml_root_node;
140 130
141 131 $this->results_format = isset( $endpoint['results_format'] ) ? sanitize_text_field( $endpoint['results_format'] ) : $this->results_format;
142 132
143 -
144 - if(
145 - // set the format to php array data if html format is set
146 - ( isset( $this->args['format'] ) && $this->args['format'] == 'html' && $this->results_format != 'xml_array' ) ||
147 - // set the format to php array data if it is set in the args (coming from the importer)
148 - ( isset( $this->args['results_format'] ) && $this->args['results_format'] == 'json_decoded' )
149 - ) {
133 + // set the format to php array data if html format is set
134 + if( isset( $this->args['format'] ) && $this->args['format'] == 'html' ) {
150 135 $this->results_format = 'json_decoded';
151 136 }
152 137
153 - // set the format to JSON string if it is set in the args (coming from the wpdatatables integration)
154 - if( isset( $this->args['results_format'] ) && $this->args['results_format'] == 'json_string' ) {
155 - $this->results_format = 'json_string';
156 - }
157 -
158 - // set the format to JSON string if it is set in the args (coming from the wpdatatables integration)
159 - if( isset( $this->args['results_format'] ) && $this->args['results_format'] == 'json_decoded' ) {
160 - $this->results_format = 'json_decoded';
161 - }
162 -
163 138 }
164 139
165 140 }
166 141
@@ -195,9 +170,9 @@
195 170 $this->final_url = apply_filters( 'wpgetapi_final_url', $this->build_url(), $this );
196 171
197 172 // build the request args
198 173 $this->final_request_args = apply_filters( 'wpgetapi_final_request_args', $this->build_request_args(), $this );
199 -
174 +
200 175 /**
201 176 * Check if we should stop or not. Setting $on to true, will stop us calling the api.
202 177 * @param bool $on Whether on is set or not.
203 178 */
@@ -213,12 +188,8 @@
213 188 // PUT request
214 189 if( $this->method == 'PUT' )
215 190 $this->response = $this->PUT_request();
216 191
217 - // PATCH request
218 - if( $this->method == 'PATCH' )
219 - $this->response = $this->PATCH_request();
220 -
221 192 // GET request
222 193 if( $this->method == 'GET' )
223 194 $this->response = $this->GET_request();
224 195
@@ -231,17 +202,17 @@
231 202 return apply_filters( 'wpgetapi_raw_error_data', json_encode( $this->response ), $this );
232 203 }
233 204
234 205 // get response_code
235 - $this->response_code = wp_remote_retrieve_response_code( $this->response );
206 + $response_code = wp_remote_retrieve_response_code( $this->response );
236 207
237 208 // action to intercept call depending on response_code
238 - $this->response = apply_filters( 'wpgetapi_before_retrieve_body', $this->response, $this->response_code, $this );
209 + $this->response = apply_filters( 'wpgetapi_before_retrieve_body', $this->response, $response_code, $this );
239 210
240 211 // get body
241 212 // modified in version 1.6.1 to allow for OAuth 2.0 plugin returning body already
242 213 $data = isset( $this->response['body'] ) ? $this->response['body'] : $this->response;
243 -
214 +
244 215 // returning in JSON format
245 216 if( $this->results_format == 'json_string' || $this->results_format == 'json_decoded' )
246 217 $data = $this->return_data( $data );
247 218
@@ -261,14 +232,8 @@
261 232 // first make sure our endpoint starts with a slash
262 233 if ( substr( $this->endpoint, 0, 1 ) != '/' )
263 234 $this->endpoint = '/' . $this->endpoint;
264 235
265 - // if we have item_key from api to posts plugin
266 - // replace our keyword with the actual item_key value
267 - if ( isset( $this->args['item_key'] ) && strpos( $this->endpoint, '(importer:item_key)' ) !== false ) {
268 - $this->endpoint = str_replace( '(importer:item_key)', $this->args['item_key'], $this->endpoint );
269 - }
270 -
271 236 $this->endpoint = apply_filters( 'wpgetapi_endpoint', $this->endpoint, $this );
272 237
273 238 $url = untrailingslashit( $this->base_url ) . $this->endpoint;
274 239
@@ -282,12 +247,10 @@
282 247
283 248 // add empty array - was getting errors if it was just null or false
284 249 $params = empty( $params ) ? array(''=>'') : $params;
285 250
286 - $result = add_query_arg( $params, $url );
251 + return add_query_arg( $params, $url );
287 252
288 - return $result;
289 -
290 253 }
291 254
292 255
293 256 /**
@@ -301,13 +264,12 @@
301 264 ), $this );
302 265
303 266
304 267 // if doing POST request, include body paramters
305 - if( $this->method == 'POST' || $this->method == 'PUT' || $this->method == 'DELETE' || $this->method == 'PATCH' ) {
268 + if( $this->method == 'POST' || $this->method == 'PUT' || $this->method == 'DELETE' ) {
306 269
307 - // tokens are sent through here
308 270 $this->body_parameters = apply_filters( 'wpgetapi_body_parameters', $this->body_parameters, $this );
309 -
271 +
310 272 // do we json_encode the entire body
311 273 if( $this->body_json_encode == true ) {
312 274 $this->body_parameters = json_encode( $this->body_parameters );
313 275 }
@@ -312,30 +274,23 @@
312 274 $this->body_parameters = json_encode( $this->body_parameters );
313 275 }
314 276
315 277 // do we urlencode the entire body
316 - if( $this->body_parameters && $this->body_url_encode == true ) {
278 + if( $this->body_url_encode == true ) {
317 279
318 280 // checking if the parameters have a json string (raw)
319 - if (
320 - ( ! is_array( $this->body_parameters ) ) &&
321 - ( substr( $this->body_parameters, 0, 1 ) === '{' || substr( $this->body_parameters, 0, 1 ) === '[' )
322 - ) {
281 + if ( substr( $this->body_parameters, 0, 1 ) === '{' || substr( $this->body_parameters, 0, 1 ) === '[' ) {
323 282 $this->body_parameters = json_decode( $this->body_parameters, true );
324 283 }
325 -
326 - $this->body_parameters = http_build_query( $this->body_parameters, '', '&' );
327 284
285 + $this->body_parameters = http_build_query( $this->body_parameters );
286 +
328 287 }
329 288
330 289 // do we xml the entire body
331 - if( $this->body_parameters && $this->body_xml_format == true ) {
332 -
333 - $root_node = $this->xml_root_node != '' ? '<' . $this->xml_root_node . '/>' : '';
290 + if( $this->body_xml_format == true ) {
334 291
335 - $xml_element = apply_filters( 'wpgetapi_xml_element', '<?xml version="1.0" encoding="UTF-8"?>' . $root_node );
336 -
337 - $xml = new SimpleXmlElement( $xml_element );
292 + $xml = new SimpleXmlElement( '<' . $this->xml_root_node . '/>' );
338 293
339 294 foreach( $this->body_parameters as $key => $value) {
340 295 $xml->addChild( $key, $value );
341 296 }
@@ -343,18 +298,8 @@
343 298 $this->body_parameters = $xml->asXML();
344 299
345 300 }
346 301
347 - // do we base64 encode the entire body
348 - if( $this->body_parameters && $this->body_base64_encode == true ) {
349 -
350 - $this->body_parameters = is_array( $this->body_parameters ) ? json_encode( $this->body_parameters ) : $this->body_parameters;
351 - $this->body_parameters = base64_encode( $this->body_parameters );
352 -
353 - }
354 -
355 - $this->body_parameters = apply_filters( 'wpgetapi_modify_formatted_body_parameters', $this->body_parameters, $this );
356 -
357 302 // add our body parameters
358 303 if( $this->body_parameters && ! empty( $this->body_parameters ) )
359 304 $headers['body'] = $this->body_parameters;
360 305
@@ -359,12 +304,8 @@
359 304 $headers['body'] = $this->body_parameters;
360 305
361 306 }
362 307
363 - // get our body paramters as they are formatted
364 - // this won't change anything, it just allows us to get the parameters
365 - $this->body_parameters = apply_filters( 'wpgetapi_final_body_parameters', $this->body_parameters, $this );
366 -
367 308 // add headers to our final request args
368 309 $this->final_request_args = wp_parse_args( $headers, $this->final_request_args );
369 310
370 311 // build the args taht are sent to the request
@@ -380,15 +321,12 @@
380 321
381 322 }
382 323
383 324
384 -
385 -
386 325 /**
387 326 * Do a GET request
388 327 */
389 328 public function GET_request() {
390 -
391 329 $response = '';
392 330 // so we can so something before the remote_get (caching)
393 331 $response = apply_filters( 'wpgetapi_before_get_request', $response, $this );
394 332
@@ -393,11 +331,9 @@
393 331 $response = apply_filters( 'wpgetapi_before_get_request', $response, $this );
394 332
395 333 if( empty( $response ) )
396 334 $response = wp_remote_get( $this->final_url, $this->final_request_args );
397 -
398 335 return $response;
399 -
400 336 }
401 337
402 338 /**
403 339 * Do a POST request
@@ -402,18 +338,10 @@
402 338 /**
403 339 * Do a POST request
404 340 */
405 341 public function POST_request() {
406 -
407 - $response = '';
408 - // so we can so something before the remote_post (caching)
409 - $response = apply_filters( 'wpgetapi_before_post_request', $response, $this );
410 -
411 - //$this->final_request_args['method'] = 'POST';
412 -
413 - if( empty( $response ) )
414 - $response = wp_remote_post( $this->final_url, $this->final_request_args );
415 -
342 + $this->final_request_args['method'] = 'POST';
343 + $response = wp_remote_post( $this->final_url, $this->final_request_args );
416 344 return $response;
417 345 }
418 346
419 347 /**
@@ -425,17 +353,8 @@
425 353 return $response;
426 354 }
427 355
428 356 /**
429 - * Do a PATCH request
430 - */
431 - public function PATCH_request() {
432 - $this->final_request_args['method'] = 'PATCH';
433 - $response = wp_remote_request( $this->final_url, $this->final_request_args );
434 - return $response;
435 - }
436 -
437 - /**
438 357 * Do a DELETE request
439 358 */
440 359 public function DELETE_request() {
441 360 $this->final_request_args['method'] = 'DELETE';
@@ -449,9 +368,9 @@
449 368 */
450 369 public function return_data( $data ) {
451 370
452 371 $data = apply_filters( 'wpgetapi_json_response_body_before_decode', $data, $this->keys );
453 -
372 +
454 373 // converts all data to arrays, removing objects
455 374 if( is_string( $data ) ) {
456 375 $decode = json_decode( $data, true );
457 376 if( json_last_error() ) {
@@ -459,13 +378,13 @@
459 378 } else {
460 379 $data = $decode;
461 380 }
462 381 }
463 -
382 +
464 383 $data = apply_filters( 'wpgetapi_json_response_body', $data, $this->keys );
465 384
466 385 if( $this->results_format == 'json_string' )
467 - return trim( json_encode( $data, JSON_PRETTY_PRINT ),'"');
386 + return trim( json_encode( $data ),'"');
468 387
469 388 if( $this->results_format == 'json_decoded' )
470 389 return $data;
471 390
@@ -474,9 +393,9 @@
474 393 /**
475 394 * Sort out the parameters if they exist
476 395 */
477 396 public function do_parameters( $parameters ) {
478 -
397 +
479 398 $new_array = array();
480 399 $raw = '';
481 400 $parameters = $this->decrypt( $parameters );
482 401
@@ -492,14 +411,8 @@
492 411 unset( $parameters[ $key ] );
493 412 continue;
494 413 }
495 414
496 - // if we have item_key from api to posts plugin
497 - // replace our keyword with the actual item_key value
498 - if ( isset( $this->args['item_key'] ) && strpos( $parameter['value'], '(importer:item_key)' ) !== false ) {
499 - $parameter['value'] = str_replace( '(importer:item_key)', $this->args['item_key'], $parameter['value'] );
500 - }
501 -
502 415 $new_array[ sanitize_text_field( $parameter['name'] ) ] = $parameter['value'];
503 416
504 417 // if we are sending raw body
505 418 } else if( empty( $parameter['name'] ) && ! empty( $parameter['value'] ) ) {
@@ -510,20 +423,17 @@
510 423
511 424 }
512 425 }
513 426
514 - // now look for array or json string and sort these out - for using such things in shortcode
427 + // look for array or json string and sort these out - for using such things in shortcode
515 428 if( ! empty( $new_array ) ) {
516 429
517 430 foreach ( $new_array as $key => $value ) {
518 431
519 432 // checking if the parameters have a json string
520 - if ( strpos( $value, '{"' ) !== false && strpos( $value, '}' ) !== false ) {
521 -
522 - $tmp_val = $value;
523 - $tmp_val = json_decode( $tmp_val, true );
524 - $new_array[ $key ] = $tmp_val ? $tmp_val : $value;
525 -
433 + if ( strpos( $value, '{' ) !== false && strpos( $value, '}' ) !== false ) {
434 + //if ( substr( $value, 0, 1 ) === '{' && substr( $value, -1 ) === '}' ) {
435 + $new_array[ $key ] = json_decode( $value, true );
526 436 } else
527 437
528 438 // checking if the parameters have an array within the string
529 439 // if they do, create them as an actual array
@@ -533,38 +443,17 @@
533 443 }
534 444
535 445 // set value as integer
536 446 if ( strpos( $value, 'integer(' ) !== false && substr( $value, -1 ) === ')' ) {
537 -
538 447 preg_match("/\(([^\)]*)\)/", $value, $match );
539 - $result = trim( $match[1] );
540 -
541 - // checking if we have additional token within
542 - // and we need to send this directly to PRO plugin from here
543 - if( strpos( $value, '(' ) !== false && strpos( $value, ':' ) !== false && $this->pro_plugin ) {
544 - $result = $this->replace_tokens( $result );
545 - } else {
546 - $result = $result;
547 - }
548 -
448 + $result = $match[1];
549 449 $new_array[ $key ] = absint( $result );
550 -
551 450 }
552 451
553 452 // set value as float
554 453 if ( strpos( $value, 'float(' ) !== false && substr( $value, -1 ) === ')' ) {
555 -
556 454 preg_match("/\(([^\)]*)\)/", $value, $match );
557 - $result = trim( $match[1] );
558 - if ( substr( $result, 0, 1 ) === '"' && substr( $result, -1 ) === '"' )
559 - $result = trim( $result,'""' );
560 -
561 - // checking if we have additional token within
562 - // and we need to send this directly to PRO plugin from here
563 - if( strpos( $value, '(' ) !== false && strpos( $value, ':' ) !== false && $this->pro_plugin ) {
564 - $result = $this->replace_tokens( $result );
565 - }
566 -
455 + $result = $match[1];
567 456 $new_array[ $key ] = (float) $result;
568 457
569 458 }
570 459
@@ -571,19 +460,9 @@
571 460 // set value as boolean
572 461 if ( strpos( $value, 'boolean(' ) !== false && substr( $value, -1 ) === ')' ) {
573 462 preg_match("/\(([^\)]*)\)/", $value, $match );
574 463 $result = $match[1];
575 -
576 - // checking if we have additional token within
577 - // and we need to send this directly to PRO plugin from here
578 - if( strpos( $value, '(' ) !== false && strpos( $value, ':' ) !== false && $this->pro_plugin ) {
579 - $result = $this->replace_tokens( $result );
580 - } else {
581 - $result = $result;
582 - }
583 -
584 464 $result = filter_var( $result, FILTER_VALIDATE_BOOLEAN );
585 -
586 465 $new_array[ $key ] = $result;
587 466
588 467 }
589 468
@@ -596,20 +475,8 @@
596 475 }
597 476
598 477
599 478 /**
600 - * Do a direct token replacement if PRO plugin installed and is required.
601 - */
602 - public function replace_tokens( $value ) {
603 - $tokens = new WpGetApi_Extras_Tokens();
604 - $action_args = isset( $this->args['action_args'] ) ? $this->args['action_args'] : null;
605 - $value = ( substr( $value, -1 ) !== ')' ? $value . ')' : $value );
606 - $result = $tokens->replace_tokens( $value, $action_args );
607 - return $result;
608 - }
609 -
610 -
611 - /**
612 479 * decrypt our parameters from the DB
613 480 */
614 481 public function decrypt( $array_or_string ) {
615 482
@@ -643,69 +510,10 @@
643 510 ) {
644 511
645 512 $this->debug = true;
646 513
647 - // admin test endpoint button
648 514 $testing = isset( $this->args['test_endpoint'] ) && ( $this->args['test_endpoint'] === true ) ? true : false;
649 515
650 - // get api status from response code
651 - $status = array(
652 - 'title' => 'Error in API response.',
653 - 'desc' => 'Check all details within your endpoint. Something is misconfigured.',
654 - 'type' => '<span class="dashicons dashicons-dismiss"></span>'
655 - );
656 -
657 - if( $this->response_code >= 200 && $this->response_code <= 299 ) {
658 - $status = array(
659 - 'title' => 'Success!',
660 - 'desc' => 'Your API is returning a success message and is returning the data as shown in the Data Output section below. You can modify this by changing the Results Format option or see <a href="https://wpgetapi.com/docs/format-api-data-as-html/">here</a> for info on formatting this data.',
661 - 'type' => '<span class="dashicons dashicons-yes-alt"></span>'
662 - );
663 - }
664 - if( $this->response_code >= 400 && $this->response_code <= 499 ) {
665 - $status = array(
666 - 'title' => 'Bad Request',
667 - 'desc' => 'This could indicate that the URL you are calling is incorrect or that some other data is missing or incorrect. Please check your Base URL and Endpoint are correct as well as the Request Method.',
668 - 'type' => '<span class="dashicons dashicons-dismiss"></span>'
669 - );
670 - }
671 - if( $this->response_code == 401 ) {
672 - $status = array(
673 - 'title' => 'Unauthorised',
674 - 'desc' => 'You are successfully connecting to your API. But your API key, login or API credentials are incorrect. See <a href="https://wpgetapi.com/docs/authentication-authorization/">here</a> for info on correctly authorizing your API requests.',
675 - 'type' => '<span class="dashicons dashicons-warning"></span>'
676 - );
677 - }
678 - if( $this->response_code == 403 ) {
679 - $status = array(
680 - 'title' => 'Forbidden',
681 - 'desc' => 'This could indicate that you may need to get your IP address whitelisted with your API provider or that you do not have access to this API.',
682 - 'type' => '<span class="dashicons dashicons-dismiss"></span>'
683 - );
684 - }
685 - if( $this->response_code == 405 ) {
686 - $status = array(
687 - 'title' => 'Method Not Allowed',
688 - 'desc' => 'Try changing the Request Method within the endpoint settings.',
689 - 'type' => '<span class="dashicons dashicons-dismiss"></span>'
690 - );
691 - }
692 - if( $this->response_code == 415 ) {
693 - $status = array(
694 - 'title' => 'Unsupported Media Type',
695 - 'desc' => 'Try adding "Content-type" to the Headers with the Value of "json/application" as shown <a href="https://wpgetapi.com/docs/troubleshooting/">here</a>.',
696 - 'type' => '<span class="dashicons dashicons-dismiss"></span>'
697 - );
698 - }
699 - if( $this->response_code >= 500 && $this->response_code <= 599 ) {
700 - $status = array(
701 - 'title' => 'Internal Server Error',
702 - 'desc' => 'This indicates an issue with the API server. Contact your API provider.',
703 - 'type' => '<span class="dashicons dashicons-dismiss"></span>'
704 - );
705 - }
706 -
707 -
708 516 ob_start(); ?>
709 517
710 518 <style>
711 519
@@ -742,11 +550,10 @@
742 550 background: #fff;
743 551 padding: 15px 20px;
744 552 display: inline-block !important;
745 553 width: 100% !important;
746 - box-shadow: 0 4px 4px -2px rgb(0 0 0 / 9%);
747 - border: 1px solid #eee;
748 - margin-bottom: 20px !important;
554 + box-shadow: 3px 3px 0 rgb(0 0 0 / 8%);
555 + border: 1px solid #efefef;
749 556 }
750 557 .wpgetapi-debug .debug-item h6 {
751 558 font-weight: bold;
752 559 font-size: 14px;
@@ -758,14 +565,15 @@
758 565 font-family: monospace !important;
759 566 font-size: 13px !important;
760 567 margin: 0 !important;
761 568 padding: 8px 12px;
762 - background: #f4f7f9;
569 + background: #f8f8f8;
763 570 }
764 571 .wpgetapi-debug .debug-item .debug-result pre {
765 572 border: none;
766 573 padding: 5px
767 574 }
575 +
768 576 .wpgetapi-debug.testing {
769 577 background: transparent;
770 578 padding: 0;
771 579 box-shadow: none;
@@ -772,32 +580,8 @@
772 580 }
773 581 .wpgetapi-debug.testing .debug-item {
774 582 margin: 5px 0;
775 583 }
776 -.wpgetapi-debug.testing .debug-item.status {
777 - border: none;
778 - box-shadow: none;
779 - margin-bottom: 15px;
780 -}
781 -.wpgetapi-debug .debug-item.status h5 {
782 - font-size: 15px;
783 -}
784 -.wpgetapi-debug .status .dashicons {
785 - margin: 0 5px 3px 0;
786 -}
787 -.wpgetapi-debug .status .dashicons-yes-alt {
788 - color: #5e9929;
789 -}
790 -.wpgetapi-debug .status .dashicons-dismiss {
791 - color: #cc4646;
792 -}
793 -.wpgetapi-debug .status .dashicons-warning {
794 - color: #dfa12e;
795 -}
796 -.wpgetapi-debug .status .desc {
797 - font-size: 14px;
798 - font-weight: 400 !important;
799 -}
800 584 </style>
801 585
802 586 <div class="wpgetapi-debug <?php echo $testing ? 'testing' : ''; ?>">
803 587
@@ -802,15 +586,9 @@
802 586 <div class="wpgetapi-debug <?php echo $testing ? 'testing' : ''; ?>">
803 587
804 588 <?php if( $testing ) { ?>
805 589
806 - <div class="debug-item status">
807 - <div class="">
808 - <h5><?php _e( $status['type'] ); ?> <?php esc_html_e( $status['title'] ); ?></h5>
809 - <span class="desc"><?php _e( $status['desc'] ); ?></span>
810 - </div>
811 - </div>
812 - <div class="debug-item">
590 + <div class="debug-item">
813 591 <h6><?php esc_html_e( 'Full URL', 'wpgetapi' ); ?></h6>
814 592 <p class="small"><?php esc_html_e( 'The full URL that is being called.', 'wpgetapi' ); ?></p>
815 593 <div class="debug-result"><?php esc_html_e( $this->final_url ); ?></div>
816 594 </div>
@@ -817,15 +595,10 @@
817 595
818 596 <div class="debug-item">
819 597 <h6><?php esc_html_e( 'Data Output', 'wpgetapi' ); ?></h6>
820 598 <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>
599 + <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>
821 600 <div class="debug-result"><?php wpgetapi_pp( $data ); ?></div>
822 - </div>
823 -
824 - <div class="debug-item">
825 - <h6><?php esc_html_e( 'Final Request Arguments', 'wpgetapi' ); ?></h6>
826 - <p class="small"><?php esc_html_e( 'The final request arguments sent in the API request. Includes headers and body arguments.', 'wpgetapi' ); ?></p>
827 - <div class="debug-result"><?php wpgetapi_pp( $this->final_request_args ); ?></div>
828 601 </div>
829 602
830 603 <div class="debug-item">
831 604 <h6><?php esc_html_e( 'Response', 'wpgetapi' ); ?></h6>