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