-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwp-rest-api-idempotence.php
41 lines (36 loc) · 1.08 KB
/
wp-rest-api-idempotence.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
/*
Plugin Name: WP REST API - Idempotence
Plugin URI: https://timothybjacobs.com/wp-api-idempotence/
Description: Allow API clients to specify an idempotency key for API requests.
Version: 1.0
Author: Timothy B Jacobs
Author URI: https://timothybjacobs.com
License: GPLv2
*/
if ( version_compare( PHP_VERSION, '5.4', '<' ) ) {
/**
* Add notice specifying PHP Version 5.4+ is required.
*
* @since 1.0.0
*/
function ironbound_wp_rest_api_idempotence_php_version_notice() {
?>
<div class="notice notice-error">
<p><?php _e( 'WP REST API - Idempotence requires PHP version 5.4 or greater.', 'wp-rest-api-idempotence' ) ?></p>
</div>
<?php
}
add_action( 'admin_notices', 'ironbound_wp_rest_api_idempotence_php_version_notice' );
} else {
define( 'WP_API_IDEMPOTENCE_FILE', __FILE__ );
/**
* Load the plugin on plugins loaded.
*
* @since 1.0.0
*/
function ironbound_wp_rest_api_idempotence_load_plugin() {
require_once dirname( __FILE__ ) . '/load.php';
}
add_action( 'plugins_loaded', 'ironbound_wp_rest_api_idempotence_load_plugin' );
}