|
1
|
|
|
<?php namespace EventEspresso\core\libraries\rest_api\changes; |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* The checkin and checkout endpoints were added in 4.8.33, |
|
5
|
|
|
* so remove them from any requests for 4.8.29 etc. |
|
6
|
|
|
*/ |
|
7
|
|
|
class ChangesIn40833 extends ChangesInBase |
|
8
|
|
|
{ |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Adds hooks so requests to 4.8.29 don't have the checkin endpoints |
|
12
|
|
|
*/ |
|
13
|
|
|
public function setHooks() |
|
14
|
|
|
{ |
|
15
|
|
|
//set a hook to remove the checkout/checkout endpoints if the request |
|
16
|
|
|
//is for lower than 4.8.33 |
|
17
|
|
|
add_filter( |
|
18
|
|
|
'FHEE__EED_Core_Rest_Api___register_rpc_routes__this_versions_routes', |
|
19
|
|
|
array($this, 'removeCheckinRoutesEarlierThan4833'), |
|
20
|
|
|
10, |
|
21
|
|
|
2 |
|
22
|
|
|
); |
|
23
|
|
|
add_filter( |
|
24
|
|
|
'FHEE__EventEspresso\core\libraries\rest_api\controllers\Base___get_headers_from_ee_notices__return', |
|
25
|
|
|
array($this, 'dontAddHeadersFromEeNotices'), |
|
26
|
|
|
10, |
|
27
|
|
|
2 |
|
28
|
|
|
); |
|
29
|
|
|
} |
|
30
|
|
|
|
|
31
|
|
|
|
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* Removes the checkin and checkout endpoints from the index for requests |
|
35
|
|
|
* to api versions lowers than 4.8.33 |
|
36
|
|
|
* |
|
37
|
|
|
* @param array $routes_on_this_version |
|
38
|
|
|
* @param string $version |
|
39
|
|
|
* @return array like $routes_on_this_version |
|
40
|
|
|
*/ |
|
41
|
|
|
public function removeCheckinRoutesEarlierThan4833($routes_on_this_version, $version) |
|
42
|
|
|
{ |
|
43
|
|
|
if ($this->appliesToVersion($version)) { |
|
44
|
|
|
unset($routes_on_this_version['registrations/(?P<REG_ID>\d+)/toggle_checkin_for_datetime/(?P<DTT_ID>\d+)']); |
|
45
|
|
|
} |
|
46
|
|
|
return $routes_on_this_version; |
|
47
|
|
|
} |
|
48
|
|
|
|
|
49
|
|
|
|
|
50
|
|
|
|
|
51
|
|
|
/** |
|
52
|
|
|
* We just added headers for notices in this version |
|
53
|
|
|
* |
|
54
|
|
|
* @param array $headers_from_ee_notices |
|
55
|
|
|
* @param string $requested_version |
|
56
|
|
|
* @return array |
|
57
|
|
|
*/ |
|
58
|
|
|
public function dontAddHeadersFromEeNotices($headers_from_ee_notices, $requested_version) |
|
59
|
|
|
{ |
|
60
|
|
|
if ($this->appliesToVersion($requested_version)) { |
|
61
|
|
|
return array(); |
|
62
|
|
|
} |
|
63
|
|
|
return $headers_from_ee_notices; |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
|