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-admin-options.php +52 -94 2.0.11.8.9 View file →
@@ -203,9 +203,9 @@
203 203 'sortable' => true, // beta
204 204 ),
205 205 'fields' => array(
206 206 array(
207 - 'name' => __( 'API Name', 'wpgetapi' ) . '<span class="dashicons dashicons-editor-help" data-tip="' . __( 'The name of this API. Call it whatever you like.', 'wpgetapi' ) . '"></span>',
207 + 'name' => __( 'API Name', 'wpgetapi' ),
208 208 'id' => 'name',
209 209 'type' => 'text',
210 210 'attributes' => array(
211 211 'required' => true,
@@ -210,12 +210,12 @@
210 210 'attributes' => array(
211 211 'required' => true,
212 212 'placeholder' => 'Google Maps',
213 213 ),
214 - 'desc' => '',
214 + 'desc' => __( 'The name of the API you are connecting to.', 'wpgetapi' ),
215 215 ),
216 216 array(
217 - 'name' => __( 'Unique ID', 'wpgetapi' ) . '<span class="dashicons dashicons-editor-help" data-tip="' . __( 'Choose your own unique ID for this API. Use lowercase letters and underscores only!', 'wpgetapi' ) . '"></span>',
217 + 'name' => __( 'Unique ID', 'wpgetapi' ),
218 218 'id' => 'id',
219 219 'type' => 'text',
220 220 'attributes' => array(
221 221 'required' => true,
@@ -220,13 +220,12 @@
220 220 'attributes' => array(
221 221 'required' => true,
222 222 'placeholder' => 'google_maps',
223 223 ),
224 - 'desc' => '',
225 - 'sanitization_cb' => 'wpgetapi_sanitize_unique_id'
224 + 'desc' => __( 'A unique ID for your API. Lowercase letters and underscores only.', 'wpgetapi' ),
226 225 ),
227 226 array(
228 - 'name' => __( 'Base URL', 'wpgetapi' ) . '<span class="dashicons dashicons-editor-help" data-tip="' . __( 'The base URL of the API you are connecting to.', 'wpgetapi' ) . '"></span>',
227 + 'name' => __( 'Base URL', 'wpgetapi' ),
229 228 'id' => 'base_url',
230 229 'type' => 'text',
231 230 'attributes' => array(
232 231 'required' => true,
@@ -231,9 +230,9 @@
231 230 'attributes' => array(
232 231 'required' => true,
233 232 'placeholder' => 'https://maps.googleapis.com/maps/api',
234 233 ),
235 - 'desc' => '',
234 + 'desc' => __( 'The base URL of the API you are connecting to.', 'wpgetapi' ),
236 235 ),
237 236
238 237 )
239 238 );
@@ -252,13 +251,13 @@
252 251
253 252 $fields = array();
254 253
255 254 $cache_disabled = $this->pro_plugin ? '' : 'disabled';
256 - $cache_url = $this->pro_plugin ? '<a target="_blank" href="https://wpgetapi.com/docs/caching-api-calls/">Caching Help</a>' : '<a target="_blank" href="https://wpgetapi.com/downloads/pro-plugin/?utm_campaign=Pro&utm_medium=Admin&utm_source=Cache">View PRO Plugin</a>';
255 + $cache_url = $this->pro_plugin ? '<a target="_blank" href="https://wpgetapi.com/docs/caching-api-calls/">Help <span class="dashicons dashicons-external"></span></a>' : '<a target="_blank" href="https://wpgetapi.com/downloads/pro-plugin/?utm_campaign=Cache Pro Plugin&utm_medium=Admin&utm_source=User">PRO Plugin<span class="dashicons dashicons-external"></span></a>';
257 256
258 257 $endpoint_fields = apply_filters( 'wpgetapi_fields_endpoints', array(
259 258 array(
260 - 'name' => __( 'Unique ID', 'wpgetapi' ) . '<span class="dashicons dashicons-editor-help" data-tip="' . __( 'Choose your own unique ID for this endpoint. Use lowercase letters and underscores only!', 'wpgetapi' ) . '"></span>',
259 + 'name' => __( 'Unique ID', 'wpgetapi' ),
261 260 'id' => 'id',
262 261 'type' => 'text',
263 262 'classes' => 'field-id',
264 263 'attributes' => array(
@@ -264,16 +263,15 @@
264 263 'attributes' => array(
265 264 'required' => true,
266 265 'placeholder' => 'new_endpoint',
267 266 ),
268 - 'desc' => '',
267 + 'desc' => __( 'A unique ID for this endpoint. Lowercase letters and underscores only.', 'wpgetapi' ),
269 268 'before_row' => "wpgetapi_output_top_of_endpoint",
270 269 'api_id' => $api_id,
271 - 'sanitization_cb' => 'wpgetapi_sanitize_unique_id'
272 270
273 271 ),
274 272 array(
275 - 'name' => __( 'Endpoint', 'wpgetapi' ) . '<span class="dashicons dashicons-editor-help" data-tip="' . __( 'This Endpoint will be appended to the Base URL to create the full URL that will be called.', 'wpgetapi' ) . '"></span>',
273 + 'name' => __( 'Endpoint', 'wpgetapi' ),
276 274 'id' => 'endpoint',
277 275 'type' => 'text',
278 276 'classes' => 'field-endpoint',
279 277 'attributes' => array(
@@ -279,12 +277,12 @@
279 277 'attributes' => array(
280 278 'required' => true,
281 279 'placeholder' => '/newendpoint',
282 280 ),
283 - 'desc' => '',
281 + 'desc' => __( 'The endpoint that will be appended to the base URL.', 'wpgetapi' ),
284 282 ),
285 283 array(
286 - 'name' => __( 'Method', 'wpgetapi' ) . '<span class="dashicons dashicons-editor-help" data-tip="' . __( 'The Request Method for this endpoint. If you are displaying data from the API, it will usually be GET. If you are sending to the API, it will usually be POST.', 'wpgetapi' ) . '"></span>',
284 + 'name' => __( 'Method', 'wpgetapi' ),
287 285 'id' => 'method',
288 286 'type' => 'select',
289 287 'classes' => 'field-method',
290 288 'attributes' => array(
@@ -293,22 +291,15 @@
293 291 'options' => array(
294 292 'GET' => 'GET',
295 293 'POST' => 'POST',
296 294 'PUT' => 'PUT',
297 - 'PATCH' => 'PATCH',
298 295 'DELETE' => 'DELETE',
299 296 ),
300 - 'desc' => '',
297 + 'desc' => __( 'The request method for this endpoint.', 'wpgetapi' ),
301 298 ),
302 299
303 300 array(
304 - 'name' => __( 'Results Format', 'wpgetapi' ) .
305 - '<span class="dashicons dashicons-editor-help" data-tip="' .
306 - sprintf(
307 - __( 'The format that the API data will be returned in. To format the data as HTML, click the link below to learn how. %1s', 'wpgetapi' ),
308 - htmlentities( '<br><a target="_blank" href="https://wpgetapi.com/docs/formatting-json-data/?utm_campaign=Shortcode JSON&utm_medium=Admin&utm_source=User">Format as HTML</a>' )
309 - ) .
310 - '"></span>',
301 + 'name' => __( 'Results Format', 'wpgetapi' ),
311 302 'id' => 'results_format',
312 303 'type' => 'select',
313 304 'classes' => 'field-results-format',
314 305 'attributes' => array(
@@ -314,110 +305,75 @@
314 305 'attributes' => array(
315 306 'required' => true,
316 307 ),
317 308 'options_cb' => 'wpgetapi_results_format_options',
318 - 'desc' => ''
309 + 'desc' => sprintf(
310 + __( 'The format of the results. %1s', 'wpgetapi' ),
311 + '<a target="_blank" href="https://wpgetapi.com/docs/format-api-data-as-html/?utm_campaign=Shortcode JSON&utm_medium=Admin&utm_source=User">More options <span class="dashicons dashicons-external"></span></a>'
312 + )
319 313 ),
320 314
321 315 array(
322 - 'name' => __( 'Cache Time', 'wpgetapi' ) .
323 - '<span class="dashicons dashicons-editor-help" data-tip="' .
324 - sprintf(
325 - __( 'The time in seconds to cache this request for. %1s', 'wpgetapi' ),
326 - htmlentities( '<br>' . $cache_url )
327 - ) .
328 - '"></span>',
316 + 'name' => __( 'Cache Time', 'wpgetapi' ),
329 317 'id' => 'cache_time',
330 318 'type' => 'text',
331 319 'classes' => 'field-cache-time',
332 320 'attributes' => array(
333 - 'placeholder' => '3600',
321 + 'placeholder' => '',
334 322 $cache_disabled => $cache_disabled,
335 323 ),
336 - 'desc' => 'Available in PRO plugin.'
324 + 'desc' => sprintf(
325 + __( 'The time in seconds to cache this request for. %1s', 'wpgetapi' ),
326 + $cache_url
327 + )
337 328 ),
338 329
339 330 array(
340 - 'name' => __( 'Query String', 'wpgetapi' ) .
341 - '<span class="dashicons dashicons-editor-help" data-tip="' .
342 - sprintf(
343 - __( 'Parameters as name/value pairs that will be appended to the URL. The query string is the part of the URL after the question mark, like so: https://yoururl.com<b>?key=value&key3=value3</b> %1s', 'wpgetapi' ),
344 - htmlentities( '<br><a target="_blank" href="https://wpgetapi.com/docs/adding-query-string-parameters/?utm_campaign=Query String&utm_medium=Admin&utm_source=User">More Info</a>' )
345 - ) .
346 - '"></span>',
331 + 'name' => __( 'Query String', 'wpgetapi' ),
347 332 'id' => 'query_parameters',
348 333 'type' => 'parameter',
349 334 'classes' => 'field-query-parameters',
350 335 'repeatable' => true,
351 - 'desc' => ''
336 + 'desc' => sprintf(
337 + __( 'Parameters as name/value pairs that will be appended to the URL. %1s', 'wpgetapi' ),
338 + '<a target="_blank" href="https://wpgetapi.com/docs/adding-query-string-parameters/?utm_campaign=Query String&utm_medium=Admin&utm_source=User">Help <span class="dashicons dashicons-external"></span></a>'
339 + )
352 340 ),
353 341 array(
354 - 'name' => __( 'Headers', 'wpgetapi' ) .
355 - '<span class="dashicons dashicons-editor-help" data-tip="' .
356 - sprintf(
357 - __( 'Parameters as name/value pairs, sent in the Headers. %1s', 'wpgetapi' ),
358 - htmlentities( '<br><a target="_blank" href="https://wpgetapi.com/docs/sending-headers-in-request/?utm_campaign=Headers&utm_medium=Admin&utm_source=User">More Info</a>' )
359 - ) .
360 - '"></span>',
342 + 'name' => __( 'Headers', 'wpgetapi' ),
361 343 'id' => 'header_parameters',
362 344 'type' => 'parameter',
363 345 'classes' => 'field-header-parameters',
364 346 'repeatable' => true,
365 - 'desc' => ''
347 + 'desc' => sprintf(
348 + __( 'Parameters as name/value pairs, sent in the headers. %1s', 'wpgetapi' ),
349 + '<a target="_blank" href="https://wpgetapi.com/docs/sending-headers-in-request/?utm_campaign=Headers&utm_medium=Admin&utm_source=User">Help <span class="dashicons dashicons-external"></span></a>'
350 + )
366 351 ),
367 352 array(
368 - 'name' => __( 'Body POST Fields', 'wpgetapi' ) .
369 - '<span class="dashicons dashicons-editor-help" data-tip="' .
370 - sprintf(
371 - __( 'Parameters as name/value pairs, sent in the Body as POST fields. %1s', 'wpgetapi' ),
372 - htmlentities( '<br><a target="_blank" href="https://wpgetapi.com/docs/sending-post-fields-in-request/?utm_campaign=Body&utm_medium=Admin&utm_source=User">More Info</a>' )
373 - ) .
374 - '"></span>',
353 + 'name' => __( 'Body POST Fields', 'wpgetapi' ),
375 354 'id' => 'body_parameters',
376 355 'type' => 'parameter',
377 356 'classes' => 'field-body-parameters',
378 357 'repeatable' => true,
379 - 'desc' => ''
358 + 'desc' => sprintf(
359 + __( 'Parameters as name/value pairs, sent in the body as POST fields. %1s', 'wpgetapi' ),
360 + '<a target="_blank" href="https://wpgetapi.com/docs/sending-post-fields-in-request/?utm_campaign=Body&utm_medium=Admin&utm_source=User">Help <span class="dashicons dashicons-external"></span></a>'
361 + )
380 362 ),
381 363 array(
382 - 'name' => __( 'Encode Body', 'wpgetapi' ) . '<span class="dashicons dashicons-editor-help" data-tip="' . __( 'Encoding of the above Body parameters.', 'wpgetapi' ) . '"></span>',
364 + 'name' => __( 'Encode Body', 'wpgetapi' ),
383 365 'id' => 'body_json_encode',
384 366 'type' => 'select',
385 367 'classes' => 'field-body-json-encode',
386 368 'options' => array(
387 - 'false' => __( 'No encoding (raw)', 'wpgetapi' ),
388 - 'true' => __( 'JSON encode', 'wpgetapi' ),
389 - 'url' => __( 'URL encode (x-www-form-urlencoded)', 'wpgetapi' ),
390 - 'base64' => __( 'Base64 encode', 'wpgetapi' ),
391 - 'xml' => __( 'XML format (available in PRO)', 'wpgetapi' ),
392 -
369 + 'false' => __( 'No encoding (raw)', 'wpgetapi' ),
370 + 'true' => __( 'JSON encode', 'wpgetapi' ),
371 + 'url' => __( 'URL encode (x-www-form-urlencoded)', 'wpgetapi' ),
372 + 'xml' => __( 'XML format (available in PRO only)', 'wpgetapi' ),
393 373 ),
394 - 'desc' => '',
374 + 'desc' => __( 'Encoding of the above Body parameters. ', 'wpgetapi' ),
395 375 ),
396 - array(
397 - 'name' => __( 'Actions', 'wpgetapi' ) . '<span class="dashicons dashicons-editor-help" data-tip="' .
398 - sprintf(
399 - __( 'Call this endpoint when your chosen action runs. This feature is available in the PRO plugin. %1s', 'wpgetapi' ),
400 - htmlentities( '<br><a target="_blank" href="https://wpgetapi.com/downloads/pro-plugin/?utm_campaign=Pro&utm_medium=Admin&utm_source=Actions">View PRO Plugin</a>' )
401 - ) .
402 - '"></span>',
403 - 'id' => 'actions',
404 - 'type' => 'select',
405 - 'classes' => 'field-actions',
406 - 'desc' => __( 'Available in PRO plugin.', 'wpgetapi' ),
407 - 'options' => array(
408 - '' => __( '-- No Action --', 'wpgetapi-extras' ),
409 - 'new_post_published' => __( 'Post/Custom Post - New Post Published', 'wpgetapi-extras' ),
410 - 'transition_post_status' => __( 'Post/Custom Post - Status Changed', 'wpgetapi-extras' ),
411 - 'delete_post' => __( 'Post/Custom Post - Delete Post', 'wpgetapi-extras' ),
412 -
413 - 'user_register' => __( 'User - New User Registered', 'wpgetapi-extras' ),
414 - 'delete_user' => __( 'User - Delete User', 'wpgetapi-extras' ),
415 - 'user_login' => __( 'User - User Logs In', 'wpgetapi-extras' ),
416 - ),
417 - 'default' => '',
418 - )
419 -
420 376 ) );
421 377
422 378
423 379 $fields[] = array(
@@ -476,11 +432,9 @@
476 432 <div class="wrap wpgetapi">
477 433
478 434 <div class="main_content_cell">
479 435
480 - <h1 class="wp-heading-inline">
481 - <img width="24" height="22" src="<?php echo esc_url( WPGETAPIURL . 'assets/img/wpgetapi-icon.png' ); ?>" /> <?php esc_html_e( $this->title, 'wpgetapi' ) ?> <span class="vnum"><?php echo WPGETAPIVERSION; ?></span>
482 - </h1>
436 + <h1 class="wp-heading-inline"><?php esc_html_e( $this->title, 'wpgetapi' ) ?></h1>
483 437 <!-- Options Page Nav Tabs -->
484 438 <h2 class="nav-tab-wrapper">
485 439 <?php foreach ($option_tabs as $option_tab) :
486 440
@@ -578,9 +532,13 @@
578 532 var output = JSON.parse( response );
579 533
580 534 jQuery( '.wpgetapi-test-area[data-endpoint="' + output.endpoint_id + '"] .handle' ).show();
581 535
582 - jQuery( '.wpgetapi-test-area[data-endpoint="' + output.endpoint_id + '"] .wpgetapi-result' ).html( output.data);
536 + jQuery( '.wpgetapi-test-area[data-endpoint="' + output.endpoint_id + '"] .wpgetapi-result' ).html(
537 + '<div class="side-notice"><p>These results contain the raw output of your API call as well as extra debugging information for testing purposes. <br>' +
538 + 'Using the shortcode or the template tag on the front end will display the Data Output section as shown below. The data can be formatted any way you like, depending on your requirements.</p></div>' +
539 + output.data
540 + );
583 541
584 542 // enable button
585 543 $( '.wpgetapi-test-area[data-endpoint="' + output.endpoint_id + '"] .test-button' ).attr( 'disabled', false );
586 544
@@ -728,9 +686,9 @@
728 686
729 687 <script>
730 688 setTimeout(function() {
731 689 location.reload();
732 - }, 500);
690 + }, 1000);
733 691 </script>
734 692 <?php
735 693
736 694 } else if ( strpos( $object_id, 'wpgetapi_' ) !== false ) {