PluginProbe ʕ •ᴥ•ʔ
Secure Custom Fields / 6.9.1
Secure Custom Fields v6.9.1
6.9.1 6.9.0 6.8.9 6.8.7 6.8.8 6.8.6 6.8.4 6.8.5 trunk 6.4.0-beta1 6.4.0-beta2 6.4.1 6.4.1-beta3 6.4.1-beta4 6.4.1-beta5 6.4.1-beta6 6.4.1-beta7 6.4.2 6.5.0 6.5.1 6.5.2 6.5.3 6.5.4 6.5.5 6.5.6 6.5.7 6.6.0 6.7.0 6.7.1 6.8.0 6.8.1 6.8.2 6.8.3
secure-custom-fields / includes / locations / abstract-acf-location.php
secure-custom-fields / includes / locations Last commit date
abstract-acf-legacy-location.php 1 year ago abstract-acf-location.php 1 year ago class-acf-location-attachment.php 1 year ago class-acf-location-block.php 1 year ago class-acf-location-comment.php 1 year ago class-acf-location-current-user-role.php 1 year ago class-acf-location-current-user.php 1 year ago class-acf-location-nav-menu-item.php 1 year ago class-acf-location-nav-menu.php 1 year 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 1 year ago class-acf-location-page-type.php 1 year 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 1 year ago class-acf-location-post-template.php 1 year ago class-acf-location-post-type.php 1 year ago class-acf-location-post.php 1 year ago class-acf-location-taxonomy.php 1 year ago class-acf-location-user-form.php 1 year ago class-acf-location-user-role.php 1 year ago class-acf-location-widget.php 1 year ago index.php 1 year ago
abstract-acf-location.php
188 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit; // Exit if accessed directly
5 }
6
7 if ( ! class_exists( 'ACF_Location' ) ) :
8 abstract class ACF_Location extends ACF_Legacy_Location {
9
10 /**
11 * The location rule name.
12 *
13 * @since ACF 5.9.0
14 * @var string
15 */
16 public $name = '';
17
18 /**
19 * The location rule label.
20 *
21 * @since ACF 5.9.0
22 * @var string
23 */
24 public $label = '';
25
26 /**
27 * The location rule category.
28 *
29 * Accepts "post", "page", "user", "forms" or a custom label.
30 *
31 * @since ACF 5.9.0
32 * @var string
33 */
34 public $category = 'post';
35
36 /**
37 * Whether or not the location rule is publicly accessible.
38 *
39 * @since ACF 5.0.0
40 * @var boolean
41 */
42 public $public = true;
43
44 /**
45 * The object type related to this location rule.
46 *
47 * Accepts an object type discoverable by `acf_get_object_type()`.
48 *
49 * @since ACF 5.9.0
50 * @var string
51 */
52 public $object_type = '';
53
54 /**
55 * The object subtype related to this location rule.
56 *
57 * Accepts a custom post type or custom taxonomy.
58 *
59 * @since ACF 5.9.0
60 * @var string
61 */
62 public $object_subtype = '';
63
64 /**
65 * Constructor.
66 *
67 * @date 8/4/20
68 * @since ACF 5.9.0
69 *
70 * @return void
71 */
72 public function __construct() {
73 $this->initialize();
74
75 // Call legacy constructor.
76 parent::__construct();
77 }
78
79 /**
80 * Initializes props.
81 *
82 * @date 5/03/2014
83 * @since ACF 5.0.0
84 *
85 * @return void
86 */
87 public function initialize() {
88 // Set props here.
89 }
90
91 /**
92 * Returns an array of operators for this location.
93 *
94 * @date 9/4/20
95 * @since ACF 5.9.0
96 *
97 * @param array $rule A location rule.
98 * @return array
99 */
100 public static function get_operators( $rule ) {
101 return array(
102 '==' => __( 'is equal to', 'secure-custom-fields' ),
103 '!=' => __( 'is not equal to', 'secure-custom-fields' ),
104 );
105 }
106
107 /**
108 * Returns an array of possible values for this location.
109 *
110 * @date 9/4/20
111 * @since ACF 5.9.0
112 *
113 * @param array $rule A location rule.
114 * @return array
115 */
116 public function get_values( $rule ) {
117 return array();
118 }
119
120 /**
121 * Returns the object_type connected to this location.
122 *
123 * @date 1/4/20
124 * @since ACF 5.9.0
125 *
126 * @param array $rule A location rule.
127 * @return string
128 */
129 public function get_object_type( $rule ) {
130 return $this->object_type;
131 }
132
133 /**
134 * Returns the object_subtype connected to this location.
135 *
136 * @date 1/4/20
137 * @since ACF 5.9.0
138 *
139 * @param array $rule A location rule.
140 * @return string|array
141 */
142 public function get_object_subtype( $rule ) {
143 return $this->object_subtype;
144 }
145
146 /**
147 * Matches the provided rule against the screen args returning a bool result.
148 *
149 * @date 9/4/20
150 * @since ACF 5.9.0
151 *
152 * @param array $rule The location rule.
153 * @param array $screen The screen args.
154 * @param array $field_group The field group settings.
155 * @return boolean
156 */
157 public function match( $rule, $screen, $field_group ) {
158 return false;
159 }
160
161 /**
162 * Compares the given value and rule params returning true when they match.
163 *
164 * @date 17/9/19
165 * @since ACF 5.8.1
166 *
167 * @param array $rule The location rule data.
168 * @param mixed $value The value to compare against.
169 * @return boolean
170 */
171 public function compare_to_rule( $value, $rule ) {
172 $result = ( $value == $rule['value'] );
173
174 // Allow "all" to match any value.
175 if ( $rule['value'] === 'all' ) {
176 $result = true;
177 }
178
179 // Reverse result for "!=" operator.
180 if ( $rule['operator'] === '!=' ) {
181 return ! $result;
182 }
183 return $result;
184 }
185 }
186
187 endif; // class_exists check
188