PluginProbe ʕ •ᴥ•ʔ
Advanced Custom Fields: Extended / 0.8.8.5
Advanced Custom Fields: Extended v0.8.8.5
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 / settings.php
acf-extended / includes Last commit date
admin 4 years ago field-groups 4 years ago fields 4 years ago fields-settings 4 years ago forms 4 years ago locations 4 years ago modules 4 years ago acfe-field-functions.php 4 years ago acfe-field-group-functions.php 4 years ago acfe-file-functions.php 4 years ago acfe-form-functions.php 4 years ago acfe-helper-functions.php 4 years ago acfe-meta-functions.php 4 years ago acfe-post-functions.php 4 years ago acfe-screen-functions.php 4 years ago acfe-template-functions.php 4 years ago acfe-term-functions.php 4 years ago acfe-user-functions.php 4 years ago acfe-wp-functions.php 4 years ago assets.php 4 years ago compatibility.php 4 years ago hooks.php 4 years ago init.php 4 years ago local-meta.php 4 years ago multilang.php 4 years ago settings.php 4 years ago upgrades.php 4 years ago
settings.php
245 lines
1 <?php
2
3 if(!class_exists('acfe_settings')):
4
5 class acfe_settings{
6
7 public $settings = array();
8
9 /*
10 * Construct
11 */
12 function __construct(){
13
14 $this->settings = get_option('acfe', array());
15
16 }
17
18 function get($selector = null, $default = null){
19
20 return $this->array_get($this->settings, $selector, $default);
21
22 }
23
24 function set($selector = null, $value = null, $append = false){
25
26 if($value === null)
27 return false;
28
29 if($append){
30
31 $this->array_append($this->settings, $selector, $value);
32
33 }else{
34
35 $this->array_set($this->settings, $selector, $value);
36
37 }
38
39 $this->update();
40
41 return $this;
42
43 }
44
45 function clear($selector = null){
46
47 $this->array_clear($this->settings, $selector);
48 $this->update();
49
50 return $this;
51
52 }
53
54 function delete($selector = null){
55
56 // Single
57 if(strpos($selector, '.') === false){
58
59 unset($this->settings[$selector]);
60
61 // Array
62 }else{
63
64 $this->array_remove($this->settings, $selector);
65
66 }
67
68 $this->update();
69
70 return $this;
71
72 }
73
74 function append($selector = null, $value = null){
75
76 if($selector === null && $value === null)
77 return false;
78
79 // Allow simple append without selector
80 if($value === null){
81
82 $value = $selector;
83 $selector = null;
84
85 }
86
87 return $this->set($selector, $value, true);
88
89 }
90
91 function array_get($array, $key, $default = null){
92
93 if(empty($key))
94 return $array;
95
96 if(!is_array($key))
97 $key = explode('.', $key);
98
99 $count = count($key);
100 $i=-1;
101
102 foreach($key as $segment){
103
104 $i++;
105
106 if(!isset($array[$segment]))
107 continue;
108
109 if($i+1 === $count){
110
111 return $array[$segment];
112
113 }
114
115 unset($key[$i]);
116
117 return $this->array_get($array[$segment], $key, $default);
118
119 }
120
121 return $default;
122
123 }
124
125 function array_set(&$array, $key, $value){
126
127 if(empty($key))
128 return $array = $value;
129
130 $keys = explode('.', $key);
131
132 while(count($keys) > 1){
133
134 $key = array_shift($keys);
135
136 if(!isset($array[$key]) || !is_array($array[$key])){
137
138 $array[$key] = array();
139
140 }
141
142 $array =& $array[$key];
143
144 }
145
146 $array[array_shift($keys)] = $value;
147
148 return $array;
149
150 }
151
152 function array_append(&$array, $key, $value){
153
154 $get = $this->array_get($array, $key);
155
156 $old = acf_get_array($get);
157 $value = acf_get_array($value);
158
159 $value = array_merge($old, $value);
160
161 $this->array_set($array, $key, $value);
162
163 return $array;
164
165 }
166
167 function array_clear(&$array, $key){
168
169 $get = $this->array_get($array, $key);
170
171 if($get === null)
172 return $array;
173
174 $value = null;
175
176 if(is_array($get))
177 $value = array();
178
179 $this->array_set($array, $key, $value);
180
181 return $array;
182
183 }
184
185 function array_remove(&$array, $keys){
186
187 $original =& $array;
188
189 foreach((array)$keys as $key){
190
191 $parts = explode('.', $key);
192
193 while(count($parts) > 1){
194
195 $part = array_shift($parts);
196
197 if(isset($array[$part]) && is_array($array[$part])){
198
199 $array =& $array[$part];
200
201 }
202
203 }
204
205 unset($array[array_shift($parts)]);
206
207 // clean up after each pass
208 $array =& $original;
209
210 }
211
212 }
213
214 function update(){
215
216 update_option('acfe', $this->settings, 'true');
217
218 }
219
220 }
221
222 endif;
223
224 function acfe_get_settings($selector = null, $default = null){
225
226 return acf_get_instance('acfe_settings')->get($selector, $default);
227
228 }
229
230 function acfe_update_settings($selector = null, $value = null){
231
232 if($value === null){
233 $value = $selector;
234 $selector = null;
235 }
236
237 return acf_get_instance('acfe_settings')->set($selector, $value);
238
239 }
240
241 function acfe_delete_settings($selector = null){
242
243 return acf_get_instance('acfe_settings')->delete($selector);
244
245 }