-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake-reservations-api.php
80 lines (50 loc) · 1.65 KB
/
make-reservations-api.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
/**
* Plugin Name: Make Santa Fe Reservations API
* Plugin URI:https://mind.sh/are
* Description: A plugin that adds endpoints to support a reservations app
* Version: 0.0.1
* Author: Mindshare Labs, Inc
* Author URI: https://mind.sh/are
*/
class makeReservations {
private $userID = '';
public function __construct() {
if ( !defined( 'MAKERES_PLUGIN_FILE' ) ) {
define( 'MAKERES_PLUGIN_FILE', __FILE__ );
}
//Define all the constants
$this->define( 'MAKERES_ABSPATH', dirname( MAKERES_PLUGIN_FILE ) . '/' );
$this->define( 'MAKERES_URL', plugin_dir_url( __FILE__ ));
$this->define( 'MAKERES_PLUGIN_VERSION', '1.4.0');
$this->define( 'PLUGIN_DIR', plugin_dir_url( __FILE__ ));
$reservations_options = get_option( 'make_reservation_option' );
$this->define( 'CLIENT_ID', $reservations_options['client_id'] );
$this->includes();
}
public static function get_instance() {
if ( null === self::$instance ) {
self::$instance = new self;
}
return self::$instance;
}
private function define( $name, $value ) {
if ( ! defined( $name ) ) {
define( $name, $value );
}
}
private function includes() {
include MAKERES_ABSPATH . 'inc/api-endpoints.php';
include MAKERES_ABSPATH . 'inc/options.php';
include MAKERES_ABSPATH . 'inc/utilities.php';
}
}//end of class
new makeReservations();
register_activation_hook( __FILE__, function() {
//TODO: Create userkey for all users
return null;
});
register_deactivation_hook( __FILE__, function() {
//TODO: Delete userkey for all users
return null;
});