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 / acfe-screen-functions.php
acf-extended / includes Last commit date
admin 3 months ago field-groups 3 months ago fields 1 week ago fields-settings 3 months ago forms 3 months ago locations 3 months ago modules 1 week ago screens 3 months ago acfe-deprecated-functions.php 2 years ago acfe-field-functions.php 3 months ago acfe-field-group-functions.php 3 months ago acfe-file-functions.php 1 year ago acfe-form-functions.php 3 months ago acfe-helper-array-functions.php 3 months ago acfe-helper-functions.php 3 months ago acfe-helper-multi-functions.php 3 months ago acfe-helper-string-functions.php 3 months ago acfe-meta-functions.php 3 months ago acfe-post-functions.php 3 months ago acfe-screen-functions.php 3 months ago acfe-template-functions.php 3 months ago acfe-term-functions.php 3 months ago acfe-user-functions.php 3 months ago acfe-wp-functions.php 3 years ago assets.php 3 months ago compatibility-acf-5.8.php 4 months ago compatibility-acf-5.9.php 3 months ago compatibility-acf-6.5.php 3 months ago compatibility-acf-6.8.6.php 1 week ago compatibility.php 3 months ago field-extend.php 4 months ago field.php 4 months ago hooks.php 3 months ago init.php 3 months ago local-meta.php 3 years ago media.php 3 months ago module-acf.php 3 months ago module-db.php 3 months ago module-l10n.php 3 months ago module-legacy.php 3 years ago module-manager.php 4 months ago module-post.php 3 months ago module-posts.php 4 months ago module-upgrades.php 3 years ago module.php 3 months ago multilang.php 3 months ago revisions.php 4 months ago screen.php 3 months ago settings.php 3 months ago template-tags.php 3 months ago third-party.php 3 years ago upgrades.php 3 months ago
acfe-screen-functions.php
204 lines
1 <?php
2
3 if(!defined('ABSPATH')){
4 exit;
5 }
6
7 /**
8 * acfe_is_admin
9 *
10 * Check if current screen is back-end
11 *
12 * @return bool
13 */
14 function acfe_is_admin(){
15 return !acfe_is_front();
16 }
17
18 /**
19 * acfe_is_front
20 *
21 * Check if current screen is front-end
22 *
23 * @return bool
24 */
25 function acfe_is_front(){
26 return !is_admin() || (is_admin() && wp_doing_ajax() && (acf_maybe_get_POST('_acf_screen') === 'acfe_form' || acf_maybe_get_POST('_acf_screen') === 'acf_form'));
27 }
28
29
30 /**
31 * acfe_get_acf_screen_id
32 *
33 * Check if the current admin screen is ACF Field Group UI, ACF Tools, ACF Updates screens etc...
34 *
35 * @param string $page
36 *
37 * @return string
38 */
39 function acfe_get_acf_screen_id($page = ''){
40
41 $prefix = sanitize_title(__("Custom Fields", 'acf'));
42
43 if(empty($page)){
44 return $prefix;
45 }
46
47 return "{$prefix}_page_{$page}";
48
49 }
50
51 /**
52 * acfe_is_admin_screen
53 *
54 * Check if the current admin screen is ACF Field Group UI, ACF tools, ACF Updates screens etc...
55 *
56 * @param false $modules
57 *
58 * @return bool
59 */
60 function acfe_is_admin_screen($modules = false){
61
62 // global
63 global $field_group;
64
65 // global field group exists
66 if($field_group !== null){
67 return true;
68 }
69
70 // get current_screen
71 if(function_exists('get_current_screen')){
72
73 $screen = get_current_screen();
74
75 if($screen){
76
77 $post_types = array('acf-field-group');
78 $is_category = false;
79
80 // include acfe modules
81 if($modules){
82
83 // reserved post types
84 $post_types = array_merge($post_types, acfe_get_setting('reserved_post_types', array()));
85
86 // field group category
87 $is_category = $screen->post_type === 'post' && $screen->taxonomy === 'acf-field-group-category';
88
89 }
90
91 if(in_array($screen->post_type, $post_types) || $is_category){
92 return true;
93 }
94
95 }
96
97 }
98
99 return false;
100
101 }
102
103 /**
104 * acfe_match_location_rules
105 *
106 * Match screen data against an array of location
107 *
108 * @param $location
109 * @param $screen
110 *
111 * @return bool
112 */
113 function acfe_match_location_rules($location, $screen){
114
115 // Loop through location groups.
116 foreach($location as $group){
117
118 // ignore group if no rules.
119 if(empty($group)){
120 continue;
121 }
122
123 // Loop over rules and determine if all rules match.
124 $match_group = true;
125
126 foreach($group as $rule){
127
128 if(!acf_match_location_rule($rule, $screen, array())){
129 $match_group = false;
130 break;
131 }
132
133 }
134
135 // Show the field group
136 if($match_group){
137 return true;
138 }
139
140 }
141
142 return false;
143
144 }
145
146 /**
147 * acfe_is_dynamic_preview
148 *
149 * Check if currently in ACFE FlexibleContent Preview or ACF Block Type Preview
150 *
151 * @return bool
152 */
153 function acfe_is_dynamic_preview(){
154
155 // vars
156 global $is_preview;
157 $return = false;
158
159 // flexible content
160 if(isset($is_preview) && $is_preview){
161
162 $return = true;
163
164 // block type
165 }elseif(wp_doing_ajax() && acf_maybe_get_POST('query')){
166
167 $query = acf_maybe_get_POST('query');
168
169 if(acfe_get($query, 'preview')){
170 $return = true;
171 }
172
173 }
174
175 return apply_filters('acfe/is_preview', $return);
176
177 }
178
179 /**
180 * acfe_is_block_editor
181 *
182 * An enhanced version of acf_is_block_editor that also check if currently in a block type
183 *
184 * @return bool
185 */
186 function acfe_is_block_editor(){
187
188 // check block editor screen or ajax fetch (block edit mode)
189 return acf_is_block_editor() || acf_maybe_get_POST('action') === 'acf/ajax/fetch-block';
190
191 }
192
193
194 /**
195 * acfe_is_gutenberg
196 *
197 * Check if current screen is block editor
198 *
199 * @return bool
200 * @deprecated
201 */
202 function acfe_is_gutenberg(){
203 return acfe_is_block_editor();
204 }