PluginProbe
WPGet API – Connect to any external REST API / 1.9.0
WPGet API – Connect to any external REST API v1.9.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-admin-options.php +46 -58 1.9.61.9.0 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,12 +220,12 @@
220 220 'attributes' => array(
221 221 'required' => true,
222 222 'placeholder' => 'google_maps',
223 223 ),
224 - 'desc' => '',
224 + 'desc' => __( 'A unique ID for your API. Lowercase letters and underscores only.', 'wpgetapi' ),
225 225 ),
226 226 array(
227 - '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' ),
228 228 'id' => 'base_url',
229 229 'type' => 'text',
230 230 'attributes' => array(
231 231 'required' => true,
@@ -230,9 +230,9 @@
230 230 'attributes' => array(
231 231 'required' => true,
232 232 'placeholder' => 'https://maps.googleapis.com/maps/api',
233 233 ),
234 - 'desc' => '',
234 + 'desc' => __( 'The base URL of the API you are connecting to.', 'wpgetapi' ),
235 235 ),
236 236
237 237 )
238 238 );
@@ -251,13 +251,13 @@
251 251
252 252 $fields = array();
253 253
254 254 $cache_disabled = $this->pro_plugin ? '' : 'disabled';
255 - $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=Cache Pro Plugin&utm_medium=Admin&utm_source=User">PRO Feature<span class="dashicons dashicons-external"></span></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>';
256 256
257 257 $endpoint_fields = apply_filters( 'wpgetapi_fields_endpoints', array(
258 258 array(
259 - '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' ),
260 260 'id' => 'id',
261 261 'type' => 'text',
262 262 'classes' => 'field-id',
263 263 'attributes' => array(
@@ -263,15 +263,15 @@
263 263 'attributes' => array(
264 264 'required' => true,
265 265 'placeholder' => 'new_endpoint',
266 266 ),
267 - 'desc' => '',
267 + 'desc' => __( 'A unique ID for this endpoint. Lowercase letters and underscores only.', 'wpgetapi' ),
268 268 'before_row' => "wpgetapi_output_top_of_endpoint",
269 269 'api_id' => $api_id,
270 270
271 271 ),
272 272 array(
273 - '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' ),
274 274 'id' => 'endpoint',
275 275 'type' => 'text',
276 276 'classes' => 'field-endpoint',
277 277 'attributes' => array(
@@ -277,12 +277,12 @@
277 277 'attributes' => array(
278 278 'required' => true,
279 279 'placeholder' => '/newendpoint',
280 280 ),
281 - 'desc' => '',
281 + 'desc' => __( 'The endpoint that will be appended to the base URL.', 'wpgetapi' ),
282 282 ),
283 283 array(
284 - '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' ),
285 285 'id' => 'method',
286 286 'type' => 'select',
287 287 'classes' => 'field-method',
288 288 'attributes' => array(
@@ -291,22 +291,15 @@
291 291 'options' => array(
292 292 'GET' => 'GET',
293 293 'POST' => 'POST',
294 294 'PUT' => 'PUT',
295 - 'PATCH' => 'PATCH',
296 295 'DELETE' => 'DELETE',
297 296 ),
298 - 'desc' => '',
297 + 'desc' => __( 'The request method for this endpoint.', 'wpgetapi' ),
299 298 ),
300 299
301 300 array(
302 - 'name' => __( 'Results Format', 'wpgetapi' ) .
303 - '<span class="dashicons dashicons-editor-help" data-tip="' .
304 - sprintf(
305 - __( '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' ),
306 - 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>' )
307 - ) .
308 - '"></span>',
301 + 'name' => __( 'Results Format', 'wpgetapi' ),
309 302 'id' => 'results_format',
310 303 'type' => 'select',
311 304 'classes' => 'field-results-format',
312 305 'attributes' => array(
@@ -312,73 +305,64 @@
312 305 'attributes' => array(
313 306 'required' => true,
314 307 ),
315 308 'options_cb' => 'wpgetapi_results_format_options',
316 - '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 + )
317 313 ),
318 314
319 315 array(
320 - 'name' => __( 'Cache Time', 'wpgetapi' ) .
321 - '<span class="dashicons dashicons-editor-help" data-tip="' .
322 - sprintf(
323 - __( 'The time in seconds to cache this request for. %1s', 'wpgetapi' ),
324 - htmlentities( '<br>' . $cache_url )
325 - ) .
326 - '"></span>',
316 + 'name' => __( 'Cache Time', 'wpgetapi' ),
327 317 'id' => 'cache_time',
328 318 'type' => 'text',
329 319 'classes' => 'field-cache-time',
330 320 'attributes' => array(
331 - 'placeholder' => '3600',
321 + 'placeholder' => '',
332 322 $cache_disabled => $cache_disabled,
333 323 ),
334 - 'desc' => ''
324 + 'desc' => sprintf(
325 + __( 'The time in seconds to cache this request for. %1s', 'wpgetapi' ),
326 + $cache_url
327 + )
335 328 ),
336 329
337 330 array(
338 - 'name' => __( 'Query String', 'wpgetapi' ) .
339 - '<span class="dashicons dashicons-editor-help" data-tip="' .
340 - sprintf(
341 - __( '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' ),
342 - 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>' )
343 - ) .
344 - '"></span>',
331 + 'name' => __( 'Query String', 'wpgetapi' ),
345 332 'id' => 'query_parameters',
346 333 'type' => 'parameter',
347 334 'classes' => 'field-query-parameters',
348 335 'repeatable' => true,
349 - '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 + )
350 340 ),
351 341 array(
352 - 'name' => __( 'Headers', 'wpgetapi' ) .
353 - '<span class="dashicons dashicons-editor-help" data-tip="' .
354 - sprintf(
355 - __( 'Parameters as name/value pairs, sent in the Headers. %1s', 'wpgetapi' ),
356 - 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>' )
357 - ) .
358 - '"></span>',
342 + 'name' => __( 'Headers', 'wpgetapi' ),
359 343 'id' => 'header_parameters',
360 344 'type' => 'parameter',
361 345 'classes' => 'field-header-parameters',
362 346 'repeatable' => true,
363 - '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 + )
364 351 ),
365 352 array(
366 - 'name' => __( 'Body POST Fields', 'wpgetapi' ) .
367 - '<span class="dashicons dashicons-editor-help" data-tip="' .
368 - sprintf(
369 - __( 'Parameters as name/value pairs, sent in the Body as POST fields. %1s', 'wpgetapi' ),
370 - 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>' )
371 - ) .
372 - '"></span>',
353 + 'name' => __( 'Body POST Fields', 'wpgetapi' ),
373 354 'id' => 'body_parameters',
374 355 'type' => 'parameter',
375 356 'classes' => 'field-body-parameters',
376 357 'repeatable' => true,
377 - '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 + )
378 362 ),
379 363 array(
380 - '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' ),
381 365 'id' => 'body_json_encode',
382 366 'type' => 'select',
383 367 'classes' => 'field-body-json-encode',
384 368 'options' => array(
@@ -386,9 +370,9 @@
386 370 'true' => __( 'JSON encode', 'wpgetapi' ),
387 371 'url' => __( 'URL encode (x-www-form-urlencoded)', 'wpgetapi' ),
388 372 'xml' => __( 'XML format (available in PRO only)', 'wpgetapi' ),
389 373 ),
390 - 'desc' => '',
374 + 'desc' => __( 'Encoding of the above Body parameters. ', 'wpgetapi' ),
391 375 ),
392 376 ) );
393 377
394 378
@@ -550,9 +534,13 @@
550 534 var output = JSON.parse( response );
551 535
552 536 jQuery( '.wpgetapi-test-area[data-endpoint="' + output.endpoint_id + '"] .handle' ).show();
553 537
554 - jQuery( '.wpgetapi-test-area[data-endpoint="' + output.endpoint_id + '"] .wpgetapi-result' ).html( output.data);
538 + jQuery( '.wpgetapi-test-area[data-endpoint="' + output.endpoint_id + '"] .wpgetapi-result' ).html(
539 + '<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>' +
540 + '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>' +
541 + output.data
542 + );
555 543
556 544 // enable button
557 545 $( '.wpgetapi-test-area[data-endpoint="' + output.endpoint_id + '"] .test-button' ).attr( 'disabled', false );
558 546