CustomPages.php 1.5 KB

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