diff --git a/query-apis.php b/query-apis.php index 6d59b48..4787e3b 100644 --- a/query-apis.php +++ b/query-apis.php @@ -8,66 +8,51 @@ * version: 0.1.0 * License: GPL2 or later. * text-domain: query-apis + * + * @package query_apis */ // If this file is access directly, abort!!! -defined( 'ABSPATH' - -) or die( 'Unauthorized Access' - -); +defined( 'ABSPATH' ) or die( 'Unauthorized Access' ); +/** + * Gets data from API and var_dumps it. + * + * @return void + */ function techiepress_get_send_data() { - $url = 'https://jsonplaceholder.typicode.com/users';$arguments = - array('method' => 'GET'); - $response = wp_remote_get( - - - $url, $arguments + $url = 'https://jsonplaceholder.typicode.com/users'; + $arguments = array( + 'method' => 'GET', ); - if (is_wp_error($response)){ - $error_message = - + $response = wp_remote_get( $url, $arguments ); - - $response->get_error_message();return - - - "Something went wrong: $error_message"; } else { - echo '
'; var_dump( - - wp_remote_retrieve_body( - - - $response ) ); echo ''; - }} + if ( is_wp_error( $response ) ) { + $error_message = $response->get_error_message(); + return "Something went wrong: $error_message"; + } else { + echo '
'; + var_dump( wp_remote_retrieve_body( $response ) ); + echo ''; + } +} /** * Register a custom menu page to view the information queried. */ -function - -techiepress_register_my_custom_menu_page() { +function techiepress_register_my_custom_menu_page() { add_menu_page( - __( - - - 'Query API Test Settings', 'query-apis' ), + __( 'Query API Test Settings', 'query-apis' ), 'Query API Test', 'manage_options', - - - 'api-test.php','techiepress_get_send_data','dashicons-testimonial', + 'api-test.php', + 'techiepress_get_send_data', + 'dashicons-testimonial', 16 ); } -add_action( - 'admin_menu', 'techiepress_register_my_custom_menu_page' - - - -); +add_action( 'admin_menu', 'techiepress_register_my_custom_menu_page' );