abstract-acf-legacy-location.php
1 year ago
abstract-acf-location.php
4 weeks ago
class-acf-location-attachment.php
4 weeks ago
class-acf-location-block.php
1 year ago
class-acf-location-comment.php
1 year ago
class-acf-location-current-user-role.php
4 weeks ago
class-acf-location-current-user.php
4 weeks ago
class-acf-location-nav-menu-item.php
1 year ago
class-acf-location-nav-menu.php
4 weeks ago
class-acf-location-options-page.php
1 year ago
class-acf-location-page-parent.php
1 year ago
class-acf-location-page-template.php
4 weeks ago
class-acf-location-page-type.php
4 weeks ago
class-acf-location-page.php
1 year ago
class-acf-location-post-category.php
1 year ago
class-acf-location-post-format.php
1 year ago
class-acf-location-post-status.php
1 year ago
class-acf-location-post-taxonomy.php
4 weeks ago
class-acf-location-post-template.php
4 weeks ago
class-acf-location-post-type.php
4 weeks ago
class-acf-location-post.php
1 year ago
class-acf-location-taxonomy.php
4 weeks ago
class-acf-location-user-form.php
4 weeks ago
class-acf-location-user-role.php
4 weeks ago
class-acf-location-widget.php
1 year ago
index.php
1 year ago
abstract-acf-legacy-location.php
69 lines
| 1 | <?php |
| 2 | |
| 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | exit; // Exit if accessed directly |
| 5 | } |
| 6 | |
| 7 | if ( ! class_exists( 'ACF_Legacy_Location' ) ) : |
| 8 | abstract class ACF_Legacy_Location { |
| 9 | |
| 10 | /** |
| 11 | * Legacy location name. |
| 12 | * |
| 13 | * @var string $name |
| 14 | */ |
| 15 | public $name = ''; |
| 16 | /** |
| 17 | * Constructor. |
| 18 | * |
| 19 | * @date 5/03/2014 |
| 20 | * @since ACF 5.0.0 |
| 21 | * |
| 22 | * @return void |
| 23 | */ |
| 24 | public function __construct() { |
| 25 | |
| 26 | // Add legacy method filters. |
| 27 | if ( method_exists( $this, 'rule_match' ) ) { |
| 28 | add_filter( "acf/location/rule_match/{$this->name}", array( $this, 'rule_match' ), 5, 3 ); |
| 29 | } |
| 30 | if ( method_exists( $this, 'rule_operators' ) ) { |
| 31 | add_filter( "acf/location/rule_operators/{$this->name}", array( $this, 'rule_operators' ), 5, 2 ); |
| 32 | } |
| 33 | if ( method_exists( $this, 'rule_values' ) ) { |
| 34 | add_filter( "acf/location/rule_values/{$this->name}", array( $this, 'rule_values' ), 5, 2 ); |
| 35 | } |
| 36 | } |
| 37 | |
| 38 | /** |
| 39 | * Magic __call method for backwards compatibility. |
| 40 | * |
| 41 | * @date 10/4/20 |
| 42 | * @since ACF 5.9.0 |
| 43 | * |
| 44 | * @param string $name The method name. |
| 45 | * @param array $arguments The array of arguments. |
| 46 | * @return mixed |
| 47 | */ |
| 48 | public function __call( $name, $arguments ) { |
| 49 | |
| 50 | // Add backwards compatibility for legacy methods. |
| 51 | // - Combine 3x legacy filters cases together (remove first args). |
| 52 | switch ( $name ) { |
| 53 | case 'rule_match': |
| 54 | $method = isset( $method ) ? $method : 'match'; |
| 55 | $arguments[3] = isset( $arguments[3] ) ? $arguments[3] : false; // Add $field_group param. |
| 56 | case 'rule_operators': |
| 57 | $method = isset( $method ) ? $method : 'get_operators'; |
| 58 | case 'rule_values': |
| 59 | $method = isset( $method ) ? $method : 'get_values'; |
| 60 | array_shift( $arguments ); |
| 61 | return call_user_func_array( array( $this, $method ), $arguments ); |
| 62 | case 'compare': |
| 63 | return call_user_func_array( array( $this, 'compare_to_rule' ), $arguments ); |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | endif; // class_exists check |
| 69 |