1: <?php
2:
3: namespace Cloudflare\Zone;
4:
5: use Cloudflare\Api;
6: use Cloudflare\Zone;
7:
8: /**
9: * CloudFlare API wrapper
10: *
11: * Custom Pages for a Zone
12: *
13: * @author James Bell <[email protected]>
14: *
15: * @version 1
16: */
17: class CustomPages extends Api
18: {
19: /**
20: * Default permissions level
21: *
22: * @var array
23: */
24: protected $permission_level = ['read' => '#zone_settings:read', 'edit' => '#zone_settings:edit'];
25:
26: /**
27: * Available Custom Pages (permission needed: #zone_settings:read)
28: *
29: * @param string $zone_identifier API item identifier tag
30: */
31: public function custom_pages($zone_identifier)
32: {
33: return $this->get('zones/'.$zone_identifier.'/custom_pages');
34: }
35:
36: /**
37: * Custom Page details (permission needed: #zone_settings:read)
38: * Details about a specific Custom page details
39: *
40: * @param string $zone_identifier API item identifier tag
41: * @param string $identifier
42: */
43: public function details($zone_identifier, $identifier)
44: {
45: return $this->get('zones/'.$zone_identifier.'/custom_pages/'.$identifier);
46: }
47:
48: /**
49: * Update Custom page URL (permission needed: #zone_settings:edit)
50: * Update Custom page URL
51: *
52: * @param string $zone_identifier API item identifier tag
53: * @param string $identifier
54: * @param string $url A URL that is associated with the Custom Page.
55: * @param string $state The Custom Page state
56: */
57: public function update($zone_identifier, $identifier, $url, $state)
58: {
59: $data = [
60: 'url' => $url,
61: 'state' => $state,
62: ];
63:
64: return $this->patch('zones/'.$zone_identifier.'/custom_pages/'.$identifier, $data);
65: }
66: }
67: