| @@ -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,14 +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>'; | |
| 257 | - $cache_desc = $this->pro_plugin ? '' : 'Available in PRO plugin.'; | |
| 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>'; | |
| 258 | 256 | |
| 259 | 257 | $endpoint_fields = apply_filters( 'wpgetapi_fields_endpoints', array( |
| 260 | 258 | array( |
| 261 | - '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' ), | |
| 262 | 260 | 'id' => 'id', |
| 263 | 261 | 'type' => 'text', |
| 264 | 262 | 'classes' => 'field-id', |
| 265 | 263 | 'attributes' => array( |
| @@ -265,16 +263,15 @@ | ||
| 265 | 263 | 'attributes' => array( |
| 266 | 264 | 'required' => true, |
| 267 | 265 | 'placeholder' => 'new_endpoint', |
| 268 | 266 | ), |
| 269 | - 'desc' => '', | |
| 267 | + 'desc' => __( 'A unique ID for this endpoint. Lowercase letters and underscores only.', 'wpgetapi' ), | |
| 270 | 268 | 'before_row' => "wpgetapi_output_top_of_endpoint", |
| 271 | 269 | 'api_id' => $api_id, |
| 272 | - 'sanitization_cb' => 'wpgetapi_sanitize_unique_id' | |
| 273 | 270 | |
| 274 | 271 | ), |
| 275 | 272 | array( |
| 276 | - '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' ), | |
| 277 | 274 | 'id' => 'endpoint', |
| 278 | 275 | 'type' => 'text', |
| 279 | 276 | 'classes' => 'field-endpoint', |
| 280 | 277 | 'attributes' => array( |
| @@ -280,12 +277,12 @@ | ||
| 280 | 277 | 'attributes' => array( |
| 281 | 278 | 'required' => true, |
| 282 | 279 | 'placeholder' => '/newendpoint', |
| 283 | 280 | ), |
| 284 | - 'desc' => '', | |
| 281 | + 'desc' => __( 'The endpoint that will be appended to the base URL.', 'wpgetapi' ), | |
| 285 | 282 | ), |
| 286 | 283 | array( |
| 287 | - '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' ), | |
| 288 | 285 | 'id' => 'method', |
| 289 | 286 | 'type' => 'select', |
| 290 | 287 | 'classes' => 'field-method', |
| 291 | 288 | 'attributes' => array( |
| @@ -294,22 +291,15 @@ | ||
| 294 | 291 | 'options' => array( |
| 295 | 292 | 'GET' => 'GET', |
| 296 | 293 | 'POST' => 'POST', |
| 297 | 294 | 'PUT' => 'PUT', |
| 298 | - 'PATCH' => 'PATCH', | |
| 299 | 295 | 'DELETE' => 'DELETE', |
| 300 | 296 | ), |
| 301 | - 'desc' => '', | |
| 297 | + 'desc' => __( 'The request method for this endpoint.', 'wpgetapi' ), | |
| 302 | 298 | ), |
| 303 | 299 | |
| 304 | 300 | array( |
| 305 | - 'name' => __( 'Results Format', 'wpgetapi' ) . | |
| 306 | - '<span class="dashicons dashicons-editor-help" data-tip="' . | |
| 307 | - sprintf( | |
| 308 | - __( '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' ), | |
| 309 | - 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>' ) | |
| 310 | - ) . | |
| 311 | - '"></span>', | |
| 301 | + 'name' => __( 'Results Format', 'wpgetapi' ), | |
| 312 | 302 | 'id' => 'results_format', |
| 313 | 303 | 'type' => 'select', |
| 314 | 304 | 'classes' => 'field-results-format', |
| 315 | 305 | 'attributes' => array( |
| @@ -315,120 +305,75 @@ | ||
| 315 | 305 | 'attributes' => array( |
| 316 | 306 | 'required' => true, |
| 317 | 307 | ), |
| 318 | 308 | 'options_cb' => 'wpgetapi_results_format_options', |
| 319 | - '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 | + ) | |
| 320 | 313 | ), |
| 321 | 314 | |
| 322 | 315 | array( |
| 323 | - 'name' => __( 'Cache Time', 'wpgetapi' ) . | |
| 324 | - '<span class="dashicons dashicons-editor-help" data-tip="' . | |
| 325 | - sprintf( | |
| 326 | - __( 'The time in seconds to cache this request for. %1s', 'wpgetapi' ), | |
| 327 | - htmlentities( '<br>' . $cache_url ) | |
| 328 | - ) . | |
| 329 | - '"></span>', | |
| 316 | + 'name' => __( 'Cache Time', 'wpgetapi' ), | |
| 330 | 317 | 'id' => 'cache_time', |
| 331 | 318 | 'type' => 'text', |
| 332 | 319 | 'classes' => 'field-cache-time', |
| 333 | 320 | 'attributes' => array( |
| 334 | - 'placeholder' => '3600', | |
| 321 | + 'placeholder' => '', | |
| 335 | 322 | $cache_disabled => $cache_disabled, |
| 336 | 323 | ), |
| 337 | - 'desc' => $cache_desc | |
| 324 | + 'desc' => sprintf( | |
| 325 | + __( 'The time in seconds to cache this request for. %1s', 'wpgetapi' ), | |
| 326 | + $cache_url | |
| 327 | + ) | |
| 338 | 328 | ), |
| 339 | 329 | |
| 340 | 330 | array( |
| 341 | - 'name' => __( 'Query String', 'wpgetapi' ) . | |
| 342 | - '<span class="dashicons dashicons-editor-help" data-tip="' . | |
| 343 | - sprintf( | |
| 344 | - __( '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' ), | |
| 345 | - 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>' ) | |
| 346 | - ) . | |
| 347 | - '"></span>', | |
| 331 | + 'name' => __( 'Query String', 'wpgetapi' ), | |
| 348 | 332 | 'id' => 'query_parameters', |
| 349 | 333 | 'type' => 'parameter', |
| 350 | 334 | 'classes' => 'field-query-parameters', |
| 351 | 335 | 'repeatable' => true, |
| 352 | - '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 | + ) | |
| 353 | 340 | ), |
| 354 | 341 | array( |
| 355 | - 'name' => __( 'Headers', 'wpgetapi' ) . | |
| 356 | - '<span class="dashicons dashicons-editor-help" data-tip="' . | |
| 357 | - sprintf( | |
| 358 | - __( 'Parameters as name/value pairs, sent in the Headers. %1s', 'wpgetapi' ), | |
| 359 | - 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>' ) | |
| 360 | - ) . | |
| 361 | - '"></span>', | |
| 342 | + 'name' => __( 'Headers', 'wpgetapi' ), | |
| 362 | 343 | 'id' => 'header_parameters', |
| 363 | 344 | 'type' => 'parameter', |
| 364 | 345 | 'classes' => 'field-header-parameters', |
| 365 | 346 | 'repeatable' => true, |
| 366 | - '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 | + ) | |
| 367 | 351 | ), |
| 368 | 352 | array( |
| 369 | - 'name' => __( 'Body POST Fields', 'wpgetapi' ) . | |
| 370 | - '<span class="dashicons dashicons-editor-help" data-tip="' . | |
| 371 | - sprintf( | |
| 372 | - __( 'Parameters as name/value pairs, sent in the Body as POST fields. %1s', 'wpgetapi' ), | |
| 373 | - 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>' ) | |
| 374 | - ) . | |
| 375 | - '"></span>', | |
| 353 | + 'name' => __( 'Body POST Fields', 'wpgetapi' ), | |
| 376 | 354 | 'id' => 'body_parameters', |
| 377 | 355 | 'type' => 'parameter', |
| 378 | 356 | 'classes' => 'field-body-parameters', |
| 379 | 357 | 'repeatable' => true, |
| 380 | - '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 | + ) | |
| 381 | 362 | ), |
| 382 | 363 | array( |
| 383 | - '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' ), | |
| 384 | 365 | 'id' => 'body_json_encode', |
| 385 | 366 | 'type' => 'select', |
| 386 | 367 | 'classes' => 'field-body-json-encode', |
| 387 | 368 | 'options' => array( |
| 388 | - 'false' => __( 'No encoding (raw)', 'wpgetapi' ), | |
| 389 | - 'true' => __( 'JSON encode', 'wpgetapi' ), | |
| 390 | - 'url' => __( 'URL encode (x-www-form-urlencoded)', 'wpgetapi' ), | |
| 391 | - 'base64' => __( 'Base64 encode', 'wpgetapi' ), | |
| 392 | - 'xml' => __( 'XML format (available in PRO)', 'wpgetapi' ), | |
| 393 | - | |
| 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' ), | |
| 394 | 373 | ), |
| 395 | - 'desc' => '', | |
| 374 | + 'desc' => __( 'Encoding of the above Body parameters. ', 'wpgetapi' ), | |
| 396 | 375 | ), |
| 397 | - array( | |
| 398 | - 'name' => __( 'Actions', 'wpgetapi' ) . '<span class="dashicons dashicons-editor-help" data-tip="' . | |
| 399 | - sprintf( | |
| 400 | - __( 'Call this endpoint when your chosen action runs. This feature is available in the PRO plugin. %1s', 'wpgetapi' ), | |
| 401 | - 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>' ) | |
| 402 | - ) . | |
| 403 | - '"></span>', | |
| 404 | - 'id' => 'actions', | |
| 405 | - 'type' => 'select', | |
| 406 | - 'classes' => 'field-actions', | |
| 407 | - 'desc' => __( 'Available in PRO plugin.', 'wpgetapi' ), | |
| 408 | - 'options' => array( | |
| 409 | - '' => __( '-- No Action --', 'wpgetapi-extras' ), | |
| 410 | - 'new_post_published' => __( 'Post/Custom Post - New Post Published', 'wpgetapi-extras' ), | |
| 411 | - 'transition_post_status' => __( 'Post/Custom Post - Status Changed', 'wpgetapi-extras' ), | |
| 412 | - 'delete_post' => __( 'Post/Custom Post - Delete Post', 'wpgetapi-extras' ), | |
| 413 | - | |
| 414 | - 'user_register' => __( 'User - New User Registered', 'wpgetapi-extras' ), | |
| 415 | - 'delete_user' => __( 'User - Delete User', 'wpgetapi-extras' ), | |
| 416 | - 'user_login' => __( 'User - User Logs In', 'wpgetapi-extras' ), | |
| 417 | - 'woocommerce_new_product' => __( 'WooCommerce - New Product Created', 'wpgetapi-extras' ), | |
| 418 | - 'woocommerce_new_order' => __( 'WooCommerce - New Order Created', 'wpgetapi-extras' ), | |
| 419 | - 'woocommerce_order_status_changed' => __( 'WooCommerce - Order Status Changed', 'wpgetapi-extras' ), | |
| 420 | - 'contact_form_7' => __( 'Contact Form 7', 'wpgetapi-extras' ), | |
| 421 | - 'gravity_forms' => __( 'Gravity Forms', 'wpgetapi-extras' ), | |
| 422 | - 'wpforms' => __( 'WPForms', 'wpgetapi-extras' ), | |
| 423 | - 'jetformbuilder' => __( 'JetFormBuilder', 'wpgetapi-extras' ), | |
| 424 | - 'formidable_forms' => __( 'Formidable Forms', 'wpgetapi-extras' ), | |
| 425 | - 'pmp' => __( 'Paid Memberships Pro - After Checkout', 'wpgetapi-extras' ), | |
| 426 | - 'edd' => __( 'Easy Digital Downloads - Complete Purchase', 'wpgetapi-extras' ), | |
| 427 | - ), | |
| 428 | - 'default' => '', | |
| 429 | - ) | |
| 430 | - | |
| 431 | 376 | ) ); |
| 432 | 377 | |
| 433 | 378 | |
| 434 | 379 | $fields[] = array( |
| @@ -487,11 +432,9 @@ | ||
| 487 | 432 | <div class="wrap wpgetapi"> |
| 488 | 433 | |
| 489 | 434 | <div class="main_content_cell"> |
| 490 | 435 | |
| 491 | - <h1 class="wp-heading-inline"> | |
| 492 | - <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> | |
| 493 | - </h1> | |
| 436 | + <h1 class="wp-heading-inline"><?php esc_html_e( $this->title, 'wpgetapi' ) ?></h1> | |
| 494 | 437 | <!-- Options Page Nav Tabs --> |
| 495 | 438 | <h2 class="nav-tab-wrapper"> |
| 496 | 439 | <?php foreach ($option_tabs as $option_tab) : |
| 497 | 440 | |
| @@ -589,9 +532,13 @@ | ||
| 589 | 532 | var output = JSON.parse( response ); |
| 590 | 533 | |
| 591 | 534 | jQuery( '.wpgetapi-test-area[data-endpoint="' + output.endpoint_id + '"] .handle' ).show(); |
| 592 | 535 | |
| 593 | - 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 | + ); | |
| 594 | 541 | |
| 595 | 542 | // enable button |
| 596 | 543 | $( '.wpgetapi-test-area[data-endpoint="' + output.endpoint_id + '"] .test-button' ).attr( 'disabled', false ); |
| 597 | 544 | |
| @@ -624,9 +571,9 @@ | ||
| 624 | 571 | |
| 625 | 572 | ?> |
| 626 | 573 | |
| 627 | 574 | <div class="box"> |
| 628 | - <h4><?php esc_html_e( 'Endpoint Instructions', 'wpgetapi' ); ?></h4> | |
| 575 | + <strong><?php esc_html_e( 'Endpoint Instructions', 'wpgetapi' ); ?></strong> | |
| 629 | 576 | <ol> |
| 630 | 577 | <li><?php _e( 'Give your endpoint a <b>Unique ID</b>', 'wpgetapi' ); ?></li> |
| 631 | 578 | <li><?php _e( 'Add the <b>Endpoint</b> which can be found in your API docs', 'wpgetapi' ); ?></li> |
| 632 | 579 | <li><?php _e( 'Set the <b>Method</b> - GET for getting data & POST for sending data to the API', 'wpgetapi' ); ?></li> |
| @@ -636,10 +583,34 @@ | ||
| 636 | 583 | <li><?php _e( 'Copy the Template Tag or Shortcode & paste into page, post or theme file', 'wpgetapi' ); ?></li> |
| 637 | 584 | </ol> |
| 638 | 585 | </div> |
| 639 | 586 | |
| 640 | - <?php echo $this->help_box(); ?> | |
| 587 | + <hr> | |
| 641 | 588 | |
| 589 | + <div class="box"> | |
| 590 | + <strong><?php esc_html_e( 'Getting Help', 'wpgetapi' ); ?></strong> | |
| 591 | + <ul> | |
| 592 | + <li><?php | |
| 593 | + printf( | |
| 594 | + esc_html__( 'View the %1$s', 'cmb2' ), | |
| 595 | + '<a target="_blank" href="https://wpgetapi.com/docs/quick-start-guide/?utm_campaign=Docs&utm_medium=Admin&utm_source=User">Quick Start Guide</a>' | |
| 596 | + ); | |
| 597 | + ?></li> | |
| 598 | + <li><?php | |
| 599 | + printf( | |
| 600 | + esc_html__( 'View the %1$s', 'cmb2' ), | |
| 601 | + '<a target="_blank" href="https://wpgetapi.com/docs/frequently-asked-questions/?utm_campaign=Docs&utm_medium=Admin&utm_source=User">FAQs</a>' | |
| 602 | + ); | |
| 603 | + ?></li> | |
| 604 | + <li><?php | |
| 605 | + printf( | |
| 606 | + esc_html__( 'Do more with the %1$s', 'cmb2' ), | |
| 607 | + '<a target="_blank" href="https://wpgetapi.com/downloads/pro-plugin/?utm_campaign=Pro&utm_medium=Admin&utm_source=User">PRO Plugin</a>' | |
| 608 | + ); | |
| 609 | + ?></li> | |
| 610 | + </ul> | |
| 611 | + </div> | |
| 612 | + | |
| 642 | 613 | <?php |
| 643 | 614 | $content = ob_get_contents(); |
| 644 | 615 | ob_end_clean(); |
| 645 | 616 | return $content; |
| @@ -656,9 +627,9 @@ | ||
| 656 | 627 | ob_start(); |
| 657 | 628 | ?> |
| 658 | 629 | |
| 659 | 630 | <div class="box"> |
| 660 | - <h4><?php esc_html_e( 'Setup Instructions', 'wpgetapi' ); ?></h4> | |
| 631 | + <strong><?php esc_html_e( 'Setup Instructions', 'wpgetapi' ); ?></strong> | |
| 661 | 632 | <ol> |
| 662 | 633 | <li><?php _e( 'Name your API in the <b>API Name</b> field', 'wpgetapi' ); ?></li> |
| 663 | 634 | <li><?php _e( 'Give your API a <b>Unique ID</b>', 'wpgetapi' ); ?></li> |
| 664 | 635 | <li><?php _e( 'Add the <b>Base URL</b> of your API. This can be found in the docs of your API', 'wpgetapi' ); ?></li> |
| @@ -666,31 +637,12 @@ | ||
| 666 | 637 | <li><?php _e( 'Visit the new tab that will be created', 'wpgetapi' ); ?></li> |
| 667 | 638 | </ol> |
| 668 | 639 | </div> |
| 669 | 640 | |
| 670 | - <?php echo $this->help_box(); ?> | |
| 671 | - | |
| 672 | - <?php | |
| 673 | - $content = ob_get_contents(); | |
| 674 | - ob_end_clean(); | |
| 675 | - return $content; | |
| 676 | - | |
| 677 | - } | |
| 678 | - | |
| 679 | - | |
| 680 | - /** | |
| 681 | - * | |
| 682 | - * @since 1.4.4 | |
| 683 | - */ | |
| 684 | - public function help_box() { | |
| 685 | - | |
| 686 | - ob_start(); | |
| 687 | - ?> | |
| 688 | - | |
| 689 | 641 | <hr> |
| 690 | 642 | |
| 691 | - <div class="box help-box"> | |
| 692 | - <h4><?php esc_html_e( 'Getting Help', 'wpgetapi' ); ?></h4> | |
| 643 | + <div class="box"> | |
| 644 | + <strong><?php esc_html_e( 'Getting Help', 'wpgetapi' ); ?></strong> | |
| 693 | 645 | <ul> |
| 694 | 646 | <li><?php |
| 695 | 647 | printf( |
| 696 | 648 | esc_html__( 'View the %1$s', 'cmb2' ), |
| @@ -702,12 +654,14 @@ | ||
| 702 | 654 | esc_html__( 'View the %1$s', 'cmb2' ), |
| 703 | 655 | '<a target="_blank" href="https://wpgetapi.com/docs/frequently-asked-questions/?utm_campaign=Docs&utm_medium=Admin&utm_source=User">FAQs</a>' |
| 704 | 656 | ); |
| 705 | 657 | ?></li> |
| 706 | - | |
| 707 | - <?php if( ! $this->pro_plugin ) { ?> | |
| 708 | - <a class="button" target="_blank" href="https://wpgetapi.com/downloads/pro-plugin/?utm_campaign=Pro&utm_medium=Admin&utm_source=User"><?php esc_html_e( 'Do more with the PRO Plugin', 'cmb2' ); ?></a> | |
| 709 | - <?php } ?> | |
| 658 | + <li><?php | |
| 659 | + printf( | |
| 660 | + esc_html__( 'Do more with the %1$s', 'cmb2' ), | |
| 661 | + '<a target="_blank" href="https://wpgetapi.com/downloads/pro-plugin/?utm_campaign=Pro&utm_medium=Admin&utm_source=User">PRO Plugin</a>' | |
| 662 | + ); | |
| 663 | + ?></li> | |
| 710 | 664 | </ul> |
| 711 | 665 | </div> |
| 712 | 666 | |
| 713 | 667 | <?php |
| @@ -723,9 +677,9 @@ | ||
| 723 | 677 | * @since 0.1.0 |
| 724 | 678 | */ |
| 725 | 679 | public function redirect( $object_id, $updated ) { |
| 726 | 680 | |
| 727 | - if( strpos( $object_id, 'wpgetapi_' ) !== false && strpos( $object_id, 'wpgetapi_api_importer' ) == false ) { | |
| 681 | + if( $object_id == 'wpgetapi_setup' ) { | |
| 728 | 682 | |
| 729 | 683 | add_settings_error( 'wpgetapi-notices', '', 'Saved, reloading page...', 'updated' ); |
| 730 | 684 | settings_errors( 'wpgetapi-notices' ); |
| 731 | 685 | ?> |
| @@ -732,13 +686,19 @@ | ||
| 732 | 686 | |
| 733 | 687 | <script> |
| 734 | 688 | setTimeout(function() { |
| 735 | 689 | location.reload(); |
| 736 | - }, 200); | |
| 690 | + }, 1000); | |
| 737 | 691 | </script> |
| 738 | 692 | <?php |
| 739 | 693 | |
| 740 | - } | |
| 694 | + } else if ( strpos( $object_id, 'wpgetapi_' ) !== false ) { | |
| 695 | + | |
| 696 | + $text = apply_filters( 'wpgetapi_admin_notice_text', __( 'Saved.', 'wpgetapi' ), $object_id ); | |
| 697 | + add_settings_error( 'wpgetapi-notices', '', $text, 'updated' ); | |
| 698 | + settings_errors( 'wpgetapi-notices' ); | |
| 699 | + | |
| 700 | + } | |
| 741 | 701 | |
| 742 | 702 | } |
| 743 | 703 | |
| 744 | 704 | |