legacy-locations.php 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. if ( ! defined( 'ABSPATH' ) ) {
  3. exit; // Exit if accessed directly
  4. }
  5. if ( ! class_exists( 'ACF_Legacy_Locations' ) ) :
  6. class ACF_Legacy_Locations {
  7. /**
  8. * Magic __isset method for backwards compatibility.
  9. *
  10. * @date 10/4/20
  11. * @since 5.9.0
  12. *
  13. * @param string $key Key name.
  14. * @return bool
  15. */
  16. public function __isset( $key ) {
  17. // _doing_it_wrong( __FUNCTION__, __( 'The ACF_Locations class should not be accessed directly.', 'acf' ), '5.9.0' );
  18. return (
  19. $key === 'locations'
  20. );
  21. }
  22. /**
  23. * Magic __get method for backwards compatibility.
  24. *
  25. * @date 10/4/20
  26. * @since 5.9.0
  27. *
  28. * @param string $key Key name.
  29. * @return mixed
  30. */
  31. public function __get( $key ) {
  32. // _doing_it_wrong( __FUNCTION__, __( 'The ACF_Locations class should not be accessed directly.', 'acf' ), '5.9.0' );
  33. switch ( $key ) {
  34. case 'locations':
  35. return call_user_func( 'acf_get_location_types' );
  36. }
  37. return null;
  38. }
  39. /**
  40. * Magic __call method for backwards compatibility.
  41. *
  42. * @date 10/4/20
  43. * @since 5.9.0
  44. *
  45. * @param string $name The method name.
  46. * @param array $arguments The array of arguments.
  47. * @return mixed
  48. */
  49. public function __call( $name, $arguments ) {
  50. // _doing_it_wrong( __FUNCTION__, __( 'The ACF_Locations class should not be accessed directly.', 'acf' ), '5.9.0' );
  51. switch ( $name ) {
  52. case 'register_location':
  53. return call_user_func_array( 'acf_register_location_type', $arguments );
  54. case 'get_location':
  55. return call_user_func_array( 'acf_get_location_type', $arguments );
  56. case 'get_locations':
  57. return call_user_func_array( 'acf_get_location_rule_types', $arguments );
  58. }
  59. }
  60. }
  61. endif; // class_exists check