PluginProbe ʕ •ᴥ•ʔ
Advanced Custom Fields: Extended / 0.9.2.7
Advanced Custom Fields: Extended v0.9.2.7
0.9.2.7 0.9.2.6 0.9.2.5 0.8.6 0.8.6.1 0.8.6.3 0.8.6.5 0.8.6.6 0.8.6.7 0.8.6.8 0.8.6.9 0.8.7 0.8.7.1 0.8.7.2 0.8.7.3 0.8.7.4 0.8.7.5 0.8.7.6 0.8.8 0.8.8.1 0.8.8.10 0.8.8.11 0.8.8.2 0.8.8.3 0.8.8.4 0.8.8.5 0.8.8.6 0.8.8.7 0.8.8.8 0.8.8.9 0.8.9 0.8.9.1 0.8.9.2 0.8.9.3 0.8.9.4 0.8.9.5 0.9 0.9.0.1 0.9.0.2 0.9.0.3 0.9.0.4 0.9.0.5 0.9.0.6 0.9.0.7 0.9.0.8 0.9.0.9 0.9.1 0.9.1.1 0.9.2 0.9.2.1 0.9.2.2 0.9.2.3 0.9.2.4 trunk 0.5 0.5.1 0.5.2 0.5.2.1 0.5.2.3 0.5.5 0.5.5.1 0.5.8 0.5.8.1 0.6 0.6.0.1 0.6.0.2 0.6.1 0.6.3 0.6.5 0.6.7 0.6.7.2 0.7 0.7.0.3 0.7.5 0.7.5.5 0.7.8 0.7.9 0.7.9.3 0.7.9.4 0.7.9.9.8 0.7.9.9.9 0.8 0.8.1 0.8.2 0.8.3 0.8.3.1 0.8.4 0.8.4.1 0.8.4.5 0.8.4.6 0.8.5 0.8.5.5
acf-extended / includes / locations / location.php
acf-extended / includes / locations Last commit date
location-post-type-all.php 3 months ago location-post-type-archive.php 3 months ago location-post-type-list.php 3 months ago location-taxonomy-list.php 3 months ago location.php 3 months ago
location.php
163 lines
1 <?php
2
3 if(!defined('ABSPATH')){
4 exit;
5 }
6
7 /**
8 * acfe_location
9 */
10 if(!class_exists('acfe_location')):
11
12 class acfe_location extends acf_location{
13
14 // vars
15 public $after = '';
16
17 }
18
19 endif;
20
21
22 /**
23 * acfe_location_rules
24 */
25 if(!class_exists('acfe_location_rules')):
26
27 class acfe_location_rules{
28
29 /**
30 * construct
31 */
32 function __construct(){
33
34 add_filter('acf/location/rule_types', array($this, 'location_rules_types'));
35
36 }
37
38
39 /**
40 * location_rules_types
41 *
42 * @param $groups
43 *
44 * @return mixed
45 */
46 function location_rules_types($groups){
47
48 // loop groups
49 foreach($groups as $group => $locations){
50
51 // loop locations
52 foreach($locations as $location_name => $location_label){
53
54 // get location type
55 $location_type = acf_get_location_type($location_name);
56
57 // validate location type and move using "after" prop
58 if(!empty($location_type) && !empty($location_type->after) && isset($groups[ $group ][ $location_type->after ])){
59 $groups[ $group ] = acfe_after($groups[ $group ], $location_type->after, array($location_name => $location_label));
60 }
61
62 }
63
64
65 }
66
67 // return
68 return $groups;
69
70 }
71
72 }
73
74 new acfe_location_rules();
75
76 endif;
77
78
79 /**
80 * acfe_compare_location_rule
81 *
82 * @param $value
83 * @param $rule
84 * @param $all_as_wildcard
85 *
86 * @return bool|int
87 */
88 function acfe_compare_location_rule($value, $rule, $all_as_wildcard = true){
89
90 if($rule['operator'] === '=='){
91
92 if($rule['value'] === 'all' && $all_as_wildcard){
93 return true;
94 }
95
96 return $value == $rule['value'];
97
98 }elseif($rule['operator'] === '!='){
99
100 if($rule['value'] === 'all' && $all_as_wildcard){
101 return false;
102 }
103
104 return $value != $rule['value'];
105
106 }elseif($rule['operator'] === '<'){
107 return $value < $rule['value'];
108
109 }elseif($rule['operator'] === '<='){
110 return $value <= $rule['value'];
111
112 }elseif($rule['operator'] === '>'){
113 return $value > $rule['value'];
114
115 }elseif($rule['operator'] === '>='){
116 return $value >= $rule['value'];
117
118 }elseif($rule['operator'] === 'contains'){
119 return stripos($value, $rule['value']) !== false;
120
121 }elseif($rule['operator'] === '!contains'){
122 return stripos($value, $rule['value']) === false;
123
124 }elseif($rule['operator'] === 'starts'){
125 return stripos($value, $rule['value']) === 0;
126
127 }elseif($rule['operator'] === '!starts'){
128 return stripos($value, $rule['value']) !== 0;
129
130 }elseif($rule['operator'] === 'ends'){
131 return acfe_ends_with($value, $rule['value']);
132
133 }elseif($rule['operator'] === '!ends'){
134 return !acfe_ends_with($value, $rule['value']);
135
136 }elseif($rule['operator'] === 'regex'){
137 return preg_match('/' . $rule['value'] . '/', $value);
138
139 }elseif($rule['operator'] === '!regex'){
140 return !preg_match('/' . $rule['value'] . '/', $value);
141
142 }elseif($rule['operator'] === '=count'){
143 return count($value) == $rule['value'];
144
145 }elseif($rule['operator'] === '!=count'){
146 return count($value) != $rule['value'];
147
148 }elseif($rule['operator'] === '>count'){
149 return count($value) > $rule['value'];
150
151 }elseif($rule['operator'] === '>=count'){
152 return count($value) >= $rule['value'];
153
154 }elseif($rule['operator'] === '<count'){
155 return count($value) < $rule['value'];
156
157 }elseif($rule['operator'] === '<=count'){
158 return count($value) <= $rule['value'];
159 }
160
161 return false;
162
163 }