@@ -207,6 +207,9 @@ |
||
207 | 207 | * @return n/a |
208 | 208 | */ |
209 | 209 | |
210 | + /** |
|
211 | + * @param string $user_form |
|
212 | + */ |
|
210 | 213 | function render( $user_id, $user_form, $el = 'tr' ) { |
211 | 214 | |
212 | 215 | // vars |
@@ -382,8 +382,8 @@ |
||
382 | 382 | } |
383 | 383 | |
384 | 384 | |
385 | - // save data |
|
386 | - if( acf_validate_save_post(true) ) { |
|
385 | + // save data |
|
386 | + if( acf_validate_save_post(true) ) { |
|
387 | 387 | |
388 | 388 | acf_save_post( "user_{$user_id}" ); |
389 | 389 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @subpackage Forms |
11 | 11 | */ |
12 | 12 | |
13 | -if( ! class_exists('acf_form_user') ) : |
|
13 | +if ( ! class_exists('acf_form_user')) : |
|
14 | 14 | |
15 | 15 | class acf_form_user { |
16 | 16 | |
@@ -33,20 +33,20 @@ discard block |
||
33 | 33 | function __construct() { |
34 | 34 | |
35 | 35 | // actions |
36 | - add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); |
|
37 | - add_action('login_form_register', array($this, 'admin_enqueue_scripts')); |
|
36 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); |
|
37 | + add_action('login_form_register', array($this, 'admin_enqueue_scripts')); |
|
38 | 38 | |
39 | 39 | // render |
40 | - add_action('show_user_profile', array($this, 'edit_user')); |
|
41 | - add_action('edit_user_profile', array($this, 'edit_user')); |
|
42 | - add_action('user_new_form', array($this, 'user_new_form')); |
|
43 | - add_action('register_form', array($this, 'register_user')); |
|
40 | + add_action('show_user_profile', array($this, 'edit_user')); |
|
41 | + add_action('edit_user_profile', array($this, 'edit_user')); |
|
42 | + add_action('user_new_form', array($this, 'user_new_form')); |
|
43 | + add_action('register_form', array($this, 'register_user')); |
|
44 | 44 | |
45 | 45 | // save |
46 | 46 | //add_action('edit_user_profile_update', array($this, 'save_user')); |
47 | 47 | //add_action('personal_options_update', array($this, 'save_user')); |
48 | - add_action('user_register', array($this, 'save_user')); |
|
49 | - add_action('profile_update', array($this, 'save_user')); |
|
48 | + add_action('user_register', array($this, 'save_user')); |
|
49 | + add_action('profile_update', array($this, 'save_user')); |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | |
72 | 72 | |
73 | 73 | // validate page |
74 | - if( in_array( $pagenow, array('profile.php', 'user-edit.php', 'user-new.php', 'wp-login.php') ) ) { |
|
74 | + if (in_array($pagenow, array('profile.php', 'user-edit.php', 'user-new.php', 'wp-login.php'))) { |
|
75 | 75 | |
76 | 76 | return true; |
77 | 77 | |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | function admin_enqueue_scripts() { |
101 | 101 | |
102 | 102 | // validate page |
103 | - if( ! $this->validate_page() ) { |
|
103 | + if ( ! $this->validate_page()) { |
|
104 | 104 | |
105 | 105 | return; |
106 | 106 | |
@@ -137,7 +137,7 @@ discard block |
||
137 | 137 | |
138 | 138 | |
139 | 139 | // render |
140 | - $this->render( 0, 'register', 'div' ); |
|
140 | + $this->render(0, 'register', 'div'); |
|
141 | 141 | |
142 | 142 | } |
143 | 143 | |
@@ -155,14 +155,14 @@ discard block |
||
155 | 155 | * @return $post_id (int) |
156 | 156 | */ |
157 | 157 | |
158 | - function edit_user( $user ) { |
|
158 | + function edit_user($user) { |
|
159 | 159 | |
160 | 160 | // update vars |
161 | 161 | $this->form = '#your-profile'; |
162 | 162 | |
163 | 163 | |
164 | 164 | // render |
165 | - $this->render( $user->ID, 'edit', 'tr' ); |
|
165 | + $this->render($user->ID, 'edit', 'tr'); |
|
166 | 166 | |
167 | 167 | } |
168 | 168 | |
@@ -187,7 +187,7 @@ discard block |
||
187 | 187 | |
188 | 188 | |
189 | 189 | // render |
190 | - $this->render( 0, 'add', 'tr' ); |
|
190 | + $this->render(0, 'add', 'tr'); |
|
191 | 191 | |
192 | 192 | } |
193 | 193 | |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * @return n/a |
208 | 208 | */ |
209 | 209 | |
210 | - function render( $user_id, $user_form, $el = 'tr' ) { |
|
210 | + function render($user_id, $user_form, $el = 'tr') { |
|
211 | 211 | |
212 | 212 | // vars |
213 | 213 | $post_id = "user_{$user_id}"; |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | |
216 | 216 | |
217 | 217 | // show title |
218 | - if( $user_form == 'register' ) { |
|
218 | + if ($user_form == 'register') { |
|
219 | 219 | |
220 | 220 | $show_title = false; |
221 | 221 | |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | 'user_form' => $user_form |
229 | 229 | ); |
230 | 230 | |
231 | - if( $user_id ) { |
|
231 | + if ($user_id) { |
|
232 | 232 | |
233 | 233 | $args['user_id'] = $user_id; |
234 | 234 | |
@@ -236,34 +236,34 @@ discard block |
||
236 | 236 | |
237 | 237 | |
238 | 238 | // get field groups |
239 | - $field_groups = acf_get_field_groups( $args ); |
|
239 | + $field_groups = acf_get_field_groups($args); |
|
240 | 240 | |
241 | 241 | |
242 | 242 | // render |
243 | - if( !empty($field_groups) ) { |
|
243 | + if ( ! empty($field_groups)) { |
|
244 | 244 | |
245 | 245 | acf_form_data(array( |
246 | 246 | 'post_id' => $post_id, |
247 | 247 | 'nonce' => 'user' |
248 | 248 | )); |
249 | 249 | |
250 | - foreach( $field_groups as $field_group ) { |
|
250 | + foreach ($field_groups as $field_group) { |
|
251 | 251 | |
252 | - $fields = acf_get_fields( $field_group ); |
|
252 | + $fields = acf_get_fields($field_group); |
|
253 | 253 | |
254 | 254 | ?> |
255 | - <?php if( $show_title && $field_group['style'] == 'default' ): ?> |
|
255 | + <?php if ($show_title && $field_group['style'] == 'default'): ?> |
|
256 | 256 | <h3><?php echo $field_group['title']; ?></h3> |
257 | 257 | <?php endif; ?> |
258 | 258 | |
259 | - <?php if( $el == 'tr' ): ?> |
|
259 | + <?php if ($el == 'tr'): ?> |
|
260 | 260 | <table class="form-table"> |
261 | 261 | <tbody> |
262 | 262 | <?php endif; ?> |
263 | 263 | |
264 | - <?php acf_render_fields( $post_id, $fields, $el, 'field' ); ?> |
|
264 | + <?php acf_render_fields($post_id, $fields, $el, 'field'); ?> |
|
265 | 265 | |
266 | - <?php if( $el == 'tr' ): ?> |
|
266 | + <?php if ($el == 'tr'): ?> |
|
267 | 267 | </tbody> |
268 | 268 | </table> |
269 | 269 | <?php endif; ?> |
@@ -294,7 +294,7 @@ discard block |
||
294 | 294 | ?> |
295 | 295 | <style type="text/css"> |
296 | 296 | |
297 | -<?php if( is_admin() ): ?> |
|
297 | +<?php if (is_admin()): ?> |
|
298 | 298 | |
299 | 299 | /* override for user css */ |
300 | 300 | .acf-field input[type="text"], |
@@ -372,10 +372,10 @@ discard block |
||
372 | 372 | * @return $post_id (int) |
373 | 373 | */ |
374 | 374 | |
375 | - function save_user( $user_id ) { |
|
375 | + function save_user($user_id) { |
|
376 | 376 | |
377 | 377 | // verify and remove nonce |
378 | - if( ! acf_verify_nonce('user') ) { |
|
378 | + if ( ! acf_verify_nonce('user')) { |
|
379 | 379 | |
380 | 380 | return $user_id; |
381 | 381 | |
@@ -383,9 +383,9 @@ discard block |
||
383 | 383 | |
384 | 384 | |
385 | 385 | // save data |
386 | - if( acf_validate_save_post(true) ) { |
|
386 | + if (acf_validate_save_post(true)) { |
|
387 | 387 | |
388 | - acf_save_post( "user_{$user_id}" ); |
|
388 | + acf_save_post("user_{$user_id}"); |
|
389 | 389 | |
390 | 390 | } |
391 | 391 |
@@ -324,13 +324,16 @@ |
||
324 | 324 | width: 100%; |
325 | 325 | } |
326 | 326 | |
327 | -<?php else: ?> |
|
327 | +<?php else { |
|
328 | + : ?> |
|
328 | 329 | |
329 | 330 | #registerform p.submit { |
330 | 331 | text-align: right; |
331 | 332 | } |
332 | 333 | |
333 | -<?php endif; ?> |
|
334 | +<?php endif; |
|
335 | +} |
|
336 | +?> |
|
334 | 337 | |
335 | 338 | </style> |
336 | 339 | <script type="text/javascript"> |
@@ -72,6 +72,9 @@ |
||
72 | 72 | * @return $post_id (int) |
73 | 73 | */ |
74 | 74 | |
75 | +/** |
|
76 | + * @return string |
|
77 | + */ |
|
75 | 78 | function acf_pro_get_remote_response( $action = '', $post = array() ) { |
76 | 79 | |
77 | 80 | // vars |
@@ -85,15 +85,15 @@ discard block |
||
85 | 85 | |
86 | 86 | |
87 | 87 | // return body |
88 | - if( !is_wp_error($request) || wp_remote_retrieve_response_code($request) === 200) { |
|
88 | + if( !is_wp_error($request) || wp_remote_retrieve_response_code($request) === 200) { |
|
89 | 89 | |
90 | - return $request['body']; |
|
90 | + return $request['body']; |
|
91 | 91 | |
92 | - } |
|
92 | + } |
|
93 | 93 | |
94 | 94 | |
95 | - // return |
|
96 | - return 0; |
|
95 | + // return |
|
96 | + return 0; |
|
97 | 97 | |
98 | 98 | } |
99 | 99 | |
@@ -126,12 +126,12 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | |
129 | - // return false if the external version is '<=' the current version |
|
129 | + // return false if the external version is '<=' the current version |
|
130 | 130 | if( version_compare($info['version'], $version, '<=') ) { |
131 | 131 | |
132 | - return false; |
|
132 | + return false; |
|
133 | 133 | |
134 | - } |
|
134 | + } |
|
135 | 135 | |
136 | 136 | |
137 | 137 | // return |
@@ -187,20 +187,20 @@ discard block |
||
187 | 187 | $timeout = 12 * HOUR_IN_SECONDS; |
188 | 188 | |
189 | 189 | |
190 | - // decode |
|
191 | - if( !empty($info) ) { |
|
190 | + // decode |
|
191 | + if( !empty($info) ) { |
|
192 | 192 | |
193 | 193 | $info = json_decode($info, true); |
194 | 194 | |
195 | 195 | // fake info version |
196 | - //$info['version'] = '6.0.0'; |
|
196 | + //$info['version'] = '6.0.0'; |
|
197 | 197 | |
198 | - } else { |
|
198 | + } else { |
|
199 | 199 | |
200 | - $info = 0; // allow transient to be returned, but empty to validate |
|
201 | - $timeout = 2 * HOUR_IN_SECONDS; |
|
200 | + $info = 0; // allow transient to be returned, but empty to validate |
|
201 | + $timeout = 2 * HOUR_IN_SECONDS; |
|
202 | 202 | |
203 | - } |
|
203 | + } |
|
204 | 204 | |
205 | 205 | |
206 | 206 | // update transient |
@@ -14,15 +14,15 @@ discard block |
||
14 | 14 | * @return n/a |
15 | 15 | */ |
16 | 16 | |
17 | -function acf_pro_get_view( $view_name = '', $args = array() ) { |
|
17 | +function acf_pro_get_view($view_name = '', $args = array()) { |
|
18 | 18 | |
19 | 19 | // vars |
20 | 20 | $path = acf_get_path("pro/admin/views/{$view_name}.php"); |
21 | 21 | |
22 | 22 | |
23 | - if( file_exists($path) ) { |
|
23 | + if (file_exists($path)) { |
|
24 | 24 | |
25 | - include( $path ); |
|
25 | + include($path); |
|
26 | 26 | |
27 | 27 | } |
28 | 28 | |
@@ -42,7 +42,7 @@ discard block |
||
42 | 42 | * @return $post_id (int) |
43 | 43 | */ |
44 | 44 | |
45 | -function acf_pro_get_remote_url( $action = '', $args = array() ) { |
|
45 | +function acf_pro_get_remote_url($action = '', $args = array()) { |
|
46 | 46 | |
47 | 47 | // defaults |
48 | 48 | $args['a'] = $action; |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | |
51 | 51 | |
52 | 52 | // vars |
53 | - $url = "http://connect.advancedcustomfields.com/index.php?" . build_query($args); |
|
53 | + $url = "http://connect.advancedcustomfields.com/index.php?".build_query($args); |
|
54 | 54 | |
55 | 55 | |
56 | 56 | // return |
@@ -72,20 +72,20 @@ discard block |
||
72 | 72 | * @return $post_id (int) |
73 | 73 | */ |
74 | 74 | |
75 | -function acf_pro_get_remote_response( $action = '', $post = array() ) { |
|
75 | +function acf_pro_get_remote_response($action = '', $post = array()) { |
|
76 | 76 | |
77 | 77 | // vars |
78 | - $url = acf_pro_get_remote_url( $action ); |
|
78 | + $url = acf_pro_get_remote_url($action); |
|
79 | 79 | |
80 | 80 | |
81 | 81 | // connect |
82 | - $request = wp_remote_post( $url, array( |
|
82 | + $request = wp_remote_post($url, array( |
|
83 | 83 | 'body' => $post |
84 | 84 | )); |
85 | 85 | |
86 | 86 | |
87 | 87 | // return body |
88 | - if( !is_wp_error($request) || wp_remote_retrieve_response_code($request) === 200) { |
|
88 | + if ( ! is_wp_error($request) || wp_remote_retrieve_response_code($request) === 200) { |
|
89 | 89 | |
90 | 90 | return $request['body']; |
91 | 91 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | |
120 | 120 | |
121 | 121 | // return false if no info |
122 | - if( empty($info['version']) ) { |
|
122 | + if (empty($info['version'])) { |
|
123 | 123 | |
124 | 124 | return false; |
125 | 125 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | |
128 | 128 | |
129 | 129 | // return false if the external version is '<=' the current version |
130 | - if( version_compare($info['version'], $version, '<=') ) { |
|
130 | + if (version_compare($info['version'], $version, '<=')) { |
|
131 | 131 | |
132 | 132 | return false; |
133 | 133 | |
@@ -156,12 +156,12 @@ discard block |
||
156 | 156 | function acf_pro_get_remote_info() { |
157 | 157 | |
158 | 158 | // clear transient if force check is enabled |
159 | - if( !empty($_GET['force-check']) ) { |
|
159 | + if ( ! empty($_GET['force-check'])) { |
|
160 | 160 | |
161 | 161 | // only allow transient to be deleted once per page load |
162 | - if( empty($_GET['acf-ignore-force-check']) ) { |
|
162 | + if (empty($_GET['acf-ignore-force-check'])) { |
|
163 | 163 | |
164 | - delete_transient( 'acf_pro_get_remote_info' ); |
|
164 | + delete_transient('acf_pro_get_remote_info'); |
|
165 | 165 | |
166 | 166 | } |
167 | 167 | |
@@ -173,9 +173,9 @@ discard block |
||
173 | 173 | |
174 | 174 | |
175 | 175 | // get transient |
176 | - $transient = get_transient( 'acf_pro_get_remote_info' ); |
|
176 | + $transient = get_transient('acf_pro_get_remote_info'); |
|
177 | 177 | |
178 | - if( $transient !== false ) { |
|
178 | + if ($transient !== false) { |
|
179 | 179 | |
180 | 180 | return $transient; |
181 | 181 | |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | |
189 | 189 | |
190 | 190 | // decode |
191 | - if( !empty($info) ) { |
|
191 | + if ( ! empty($info)) { |
|
192 | 192 | |
193 | 193 | $info = json_decode($info, true); |
194 | 194 | |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | |
205 | 205 | |
206 | 206 | // update transient |
207 | - set_transient('acf_pro_get_remote_info', $info, $timeout ); |
|
207 | + set_transient('acf_pro_get_remote_info', $info, $timeout); |
|
208 | 208 | |
209 | 209 | |
210 | 210 | // return |
@@ -215,10 +215,10 @@ discard block |
||
215 | 215 | function acf_pro_is_license_active() { |
216 | 216 | |
217 | 217 | // vars |
218 | - $data = acf_pro_get_license( true ); |
|
218 | + $data = acf_pro_get_license(true); |
|
219 | 219 | $url = home_url(); |
220 | 220 | |
221 | - if( !empty($data['url']) && !empty($data['key']) && $data['url'] == $url ) { |
|
221 | + if ( ! empty($data['url']) && ! empty($data['key']) && $data['url'] == $url) { |
|
222 | 222 | |
223 | 223 | return true; |
224 | 224 | |
@@ -229,7 +229,7 @@ discard block |
||
229 | 229 | |
230 | 230 | } |
231 | 231 | |
232 | -function acf_pro_get_license( $all = false ) { |
|
232 | +function acf_pro_get_license($all = false) { |
|
233 | 233 | |
234 | 234 | // get option |
235 | 235 | $data = get_option('acf_pro_license'); |
@@ -240,12 +240,12 @@ discard block |
||
240 | 240 | |
241 | 241 | |
242 | 242 | // attempt deserialize |
243 | - if( is_serialized( $data ) ) |
|
243 | + if (is_serialized($data)) |
|
244 | 244 | { |
245 | 245 | $data = maybe_unserialize($data); |
246 | 246 | |
247 | 247 | // $all |
248 | - if( !$all ) |
|
248 | + if ( ! $all) |
|
249 | 249 | { |
250 | 250 | $data = $data['key']; |
251 | 251 | } |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | |
261 | 261 | |
262 | 262 | |
263 | -function acf_pro_update_license( $license ) { |
|
263 | +function acf_pro_update_license($license) { |
|
264 | 264 | |
265 | 265 | $save = array( |
266 | 266 | 'key' => $license, |
@@ -7,69 +7,69 @@ discard block |
||
7 | 7 | * @package Lighthouse |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! function_exists( 'lighthouse_posted_on' ) ) : |
|
10 | +if ( ! function_exists('lighthouse_posted_on')) : |
|
11 | 11 | /** |
12 | 12 | * Prints HTML with meta information for the current post-date/time and author. |
13 | 13 | */ |
14 | 14 | function lighthouse_posted_on() { |
15 | 15 | $time_string = '<time class="entry-date published updated" datetime="%1$s">%2$s</time>'; |
16 | - if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { |
|
16 | + if (get_the_time('U') !== get_the_modified_time('U')) { |
|
17 | 17 | $time_string = '<time class="entry-date published" datetime="%1$s">%2$s</time><time class="updated" datetime="%3$s">%4$s</time>'; |
18 | 18 | } |
19 | 19 | |
20 | - $time_string = sprintf( $time_string, |
|
21 | - esc_attr( get_the_date( 'c' ) ), |
|
22 | - esc_html( get_the_date() ), |
|
23 | - esc_attr( get_the_modified_date( 'c' ) ), |
|
24 | - esc_html( get_the_modified_date() ) |
|
20 | + $time_string = sprintf($time_string, |
|
21 | + esc_attr(get_the_date('c')), |
|
22 | + esc_html(get_the_date()), |
|
23 | + esc_attr(get_the_modified_date('c')), |
|
24 | + esc_html(get_the_modified_date()) |
|
25 | 25 | ); |
26 | 26 | |
27 | 27 | $posted_on = sprintf( |
28 | - esc_html_x( 'Posted on %s', 'post date', 'lighthouse' ), |
|
29 | - '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">' . $time_string . '</a>' |
|
28 | + esc_html_x('Posted on %s', 'post date', 'lighthouse'), |
|
29 | + '<a href="'.esc_url(get_permalink()).'" rel="bookmark">'.$time_string.'</a>' |
|
30 | 30 | ); |
31 | 31 | |
32 | 32 | $byline = sprintf( |
33 | - esc_html_x( 'by %s', 'post author', 'lighthouse' ), |
|
34 | - '<span class="author vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ) . '">' . esc_html( get_the_author() ) . '</a></span>' |
|
33 | + esc_html_x('by %s', 'post author', 'lighthouse'), |
|
34 | + '<span class="author vcard"><a class="url fn n" href="'.esc_url(get_author_posts_url(get_the_author_meta('ID'))).'">'.esc_html(get_the_author()).'</a></span>' |
|
35 | 35 | ); |
36 | 36 | |
37 | - echo '<span class="posted-on">' . $posted_on . '</span><span class="byline"> ' . $byline . '</span>'; // WPCS: XSS OK. |
|
37 | + echo '<span class="posted-on">'.$posted_on.'</span><span class="byline"> '.$byline.'</span>'; // WPCS: XSS OK. |
|
38 | 38 | |
39 | 39 | } |
40 | 40 | endif; |
41 | 41 | |
42 | -if ( ! function_exists( 'lighthouse_entry_footer' ) ) : |
|
42 | +if ( ! function_exists('lighthouse_entry_footer')) : |
|
43 | 43 | /** |
44 | 44 | * Prints HTML with meta information for the categories, tags and comments. |
45 | 45 | */ |
46 | 46 | function lighthouse_entry_footer() { |
47 | 47 | // Hide category and tag text for pages. |
48 | - if ( 'post' === get_post_type() ) { |
|
48 | + if ('post' === get_post_type()) { |
|
49 | 49 | /* translators: used between list items, there is a space after the comma */ |
50 | - $categories_list = get_the_category_list( esc_html__( ', ', 'lighthouse' ) ); |
|
51 | - if ( $categories_list && lighthouse_categorized_blog() ) { |
|
52 | - printf( '<span class="cat-links">' . esc_html__( 'Posted in %1$s', 'lighthouse' ) . '</span>', $categories_list ); // WPCS: XSS OK. |
|
50 | + $categories_list = get_the_category_list(esc_html__(', ', 'lighthouse')); |
|
51 | + if ($categories_list && lighthouse_categorized_blog()) { |
|
52 | + printf('<span class="cat-links">'.esc_html__('Posted in %1$s', 'lighthouse').'</span>', $categories_list); // WPCS: XSS OK. |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /* translators: used between list items, there is a space after the comma */ |
56 | - $tags_list = get_the_tag_list( '', esc_html__( ', ', 'lighthouse' ) ); |
|
57 | - if ( $tags_list ) { |
|
58 | - printf( '<span class="tags-links">' . esc_html__( 'Tagged %1$s', 'lighthouse' ) . '</span>', $tags_list ); // WPCS: XSS OK. |
|
56 | + $tags_list = get_the_tag_list('', esc_html__(', ', 'lighthouse')); |
|
57 | + if ($tags_list) { |
|
58 | + printf('<span class="tags-links">'.esc_html__('Tagged %1$s', 'lighthouse').'</span>', $tags_list); // WPCS: XSS OK. |
|
59 | 59 | } |
60 | 60 | } |
61 | 61 | |
62 | - if ( ! is_single() && ! post_password_required() && ( comments_open() || get_comments_number() ) ) { |
|
62 | + if ( ! is_single() && ! post_password_required() && (comments_open() || get_comments_number())) { |
|
63 | 63 | echo '<span class="comments-link">'; |
64 | - comments_popup_link( esc_html__( 'Leave a comment', 'lighthouse' ), esc_html__( '1 Comment', 'lighthouse' ), esc_html__( '% Comments', 'lighthouse' ) ); |
|
64 | + comments_popup_link(esc_html__('Leave a comment', 'lighthouse'), esc_html__('1 Comment', 'lighthouse'), esc_html__('% Comments', 'lighthouse')); |
|
65 | 65 | echo '</span>'; |
66 | 66 | } |
67 | 67 | |
68 | 68 | edit_post_link( |
69 | 69 | sprintf( |
70 | 70 | /* translators: %s: Name of current post */ |
71 | - esc_html__( 'Edit %s', 'lighthouse' ), |
|
72 | - the_title( '<span class="screen-reader-text">"', '"</span>', false ) |
|
71 | + esc_html__('Edit %s', 'lighthouse'), |
|
72 | + the_title('<span class="screen-reader-text">"', '"</span>', false) |
|
73 | 73 | ), |
74 | 74 | '<span class="edit-link">', |
75 | 75 | '</span>' |
@@ -83,22 +83,22 @@ discard block |
||
83 | 83 | * @return bool |
84 | 84 | */ |
85 | 85 | function lighthouse_categorized_blog() { |
86 | - if ( false === ( $all_the_cool_cats = get_transient( 'lighthouse_categories' ) ) ) { |
|
86 | + if (false === ($all_the_cool_cats = get_transient('lighthouse_categories'))) { |
|
87 | 87 | // Create an array of all the categories that are attached to posts. |
88 | - $all_the_cool_cats = get_categories( array( |
|
88 | + $all_the_cool_cats = get_categories(array( |
|
89 | 89 | 'fields' => 'ids', |
90 | 90 | 'hide_empty' => 1, |
91 | 91 | // We only need to know if there is more than one category. |
92 | 92 | 'number' => 2, |
93 | - ) ); |
|
93 | + )); |
|
94 | 94 | |
95 | 95 | // Count the number of categories that are attached to the posts. |
96 | - $all_the_cool_cats = count( $all_the_cool_cats ); |
|
96 | + $all_the_cool_cats = count($all_the_cool_cats); |
|
97 | 97 | |
98 | - set_transient( 'lighthouse_categories', $all_the_cool_cats ); |
|
98 | + set_transient('lighthouse_categories', $all_the_cool_cats); |
|
99 | 99 | } |
100 | 100 | |
101 | - if ( $all_the_cool_cats > 1 ) { |
|
101 | + if ($all_the_cool_cats > 1) { |
|
102 | 102 | // This blog has more than 1 category so lighthouse_categorized_blog should return true. |
103 | 103 | return true; |
104 | 104 | } else { |
@@ -111,11 +111,11 @@ discard block |
||
111 | 111 | * Flush out the transients used in lighthouse_categorized_blog. |
112 | 112 | */ |
113 | 113 | function lighthouse_category_transient_flusher() { |
114 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
114 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
115 | 115 | return; |
116 | 116 | } |
117 | 117 | // Like, beat it. Dig? |
118 | - delete_transient( 'lighthouse_categories' ); |
|
118 | + delete_transient('lighthouse_categories'); |
|
119 | 119 | } |
120 | -add_action( 'edit_category', 'lighthouse_category_transient_flusher' ); |
|
121 | -add_action( 'save_post', 'lighthouse_category_transient_flusher' ); |
|
122 | 120 | \ No newline at end of file |
121 | +add_action('edit_category', 'lighthouse_category_transient_flusher'); |
|
122 | +add_action('save_post', 'lighthouse_category_transient_flusher'); |
|
123 | 123 | \ No newline at end of file |
@@ -8,11 +8,11 @@ discard block |
||
8 | 8 | |
9 | 9 | function my_acf_settings_path( $path ) { |
10 | 10 | |
11 | - // update path |
|
12 | - $path = get_stylesheet_directory() . '/includes/acf/'; |
|
11 | + // update path |
|
12 | + $path = get_stylesheet_directory() . '/includes/acf/'; |
|
13 | 13 | |
14 | - // return |
|
15 | - return $path; |
|
14 | + // return |
|
15 | + return $path; |
|
16 | 16 | } |
17 | 17 | |
18 | 18 | // Customize ACF dir |
@@ -20,11 +20,11 @@ discard block |
||
20 | 20 | |
21 | 21 | function my_acf_settings_dir( $dir ) { |
22 | 22 | |
23 | - // update path |
|
24 | - $dir = get_stylesheet_directory_uri() . '/includes/acf/'; |
|
23 | + // update path |
|
24 | + $dir = get_stylesheet_directory_uri() . '/includes/acf/'; |
|
25 | 25 | |
26 | - // return |
|
27 | - return $dir; |
|
26 | + // return |
|
27 | + return $dir; |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | // Save ACF field as JSON |
@@ -32,11 +32,11 @@ discard block |
||
32 | 32 | |
33 | 33 | function my_acf_json_save_point( $path ) { |
34 | 34 | |
35 | - // update path |
|
36 | - $path = get_stylesheet_directory() . '/includes/acf-json'; |
|
35 | + // update path |
|
36 | + $path = get_stylesheet_directory() . '/includes/acf-json'; |
|
37 | 37 | |
38 | - // return |
|
39 | - return $path; |
|
38 | + // return |
|
39 | + return $path; |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | // Load ACF field from JSON |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | |
45 | 45 | function my_acf_json_load_point( $paths ) { |
46 | 46 | |
47 | - // remove original path (optional) |
|
48 | - unset($paths[0]); |
|
47 | + // remove original path (optional) |
|
48 | + unset($paths[0]); |
|
49 | 49 | |
50 | - // append path |
|
51 | - $paths[] = get_stylesheet_directory() . '/includes/acf-json'; |
|
50 | + // append path |
|
51 | + $paths[] = get_stylesheet_directory() . '/includes/acf-json'; |
|
52 | 52 | |
53 | - // return |
|
54 | - return $paths; |
|
53 | + // return |
|
54 | + return $paths; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 |
@@ -6,10 +6,10 @@ discard block |
||
6 | 6 | // Customize ACF path |
7 | 7 | add_filter('acf/settings/path', 'my_acf_settings_path'); |
8 | 8 | |
9 | -function my_acf_settings_path( $path ) { |
|
9 | +function my_acf_settings_path($path) { |
|
10 | 10 | |
11 | 11 | // update path |
12 | - $path = get_stylesheet_directory() . '/includes/acf/'; |
|
12 | + $path = get_stylesheet_directory().'/includes/acf/'; |
|
13 | 13 | |
14 | 14 | // return |
15 | 15 | return $path; |
@@ -18,10 +18,10 @@ discard block |
||
18 | 18 | // Customize ACF dir |
19 | 19 | add_filter('acf/settings/dir', 'my_acf_settings_dir'); |
20 | 20 | |
21 | -function my_acf_settings_dir( $dir ) { |
|
21 | +function my_acf_settings_dir($dir) { |
|
22 | 22 | |
23 | 23 | // update path |
24 | - $dir = get_stylesheet_directory_uri() . '/includes/acf/'; |
|
24 | + $dir = get_stylesheet_directory_uri().'/includes/acf/'; |
|
25 | 25 | |
26 | 26 | // return |
27 | 27 | return $dir; |
@@ -30,10 +30,10 @@ discard block |
||
30 | 30 | // Save ACF field as JSON |
31 | 31 | add_filter('acf/settings/save_json', 'my_acf_json_save_point'); |
32 | 32 | |
33 | -function my_acf_json_save_point( $path ) { |
|
33 | +function my_acf_json_save_point($path) { |
|
34 | 34 | |
35 | 35 | // update path |
36 | - $path = get_stylesheet_directory() . '/includes/acf-json'; |
|
36 | + $path = get_stylesheet_directory().'/includes/acf-json'; |
|
37 | 37 | |
38 | 38 | // return |
39 | 39 | return $path; |
@@ -42,13 +42,13 @@ discard block |
||
42 | 42 | // Load ACF field from JSON |
43 | 43 | add_filter('acf/settings/load_json', 'my_acf_json_load_point'); |
44 | 44 | |
45 | -function my_acf_json_load_point( $paths ) { |
|
45 | +function my_acf_json_load_point($paths) { |
|
46 | 46 | |
47 | 47 | // remove original path (optional) |
48 | 48 | unset($paths[0]); |
49 | 49 | |
50 | 50 | // append path |
51 | - $paths[] = get_stylesheet_directory() . '/includes/acf-json'; |
|
51 | + $paths[] = get_stylesheet_directory().'/includes/acf-json'; |
|
52 | 52 | |
53 | 53 | // return |
54 | 54 | return $paths; |
@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | /***** |
59 | 59 | Options Page |
60 | 60 | ***************/ |
61 | -if( function_exists('acf_add_options_page') ) { |
|
61 | +if (function_exists('acf_add_options_page')) { |
|
62 | 62 | |
63 | 63 | acf_add_options_page(array( |
64 | 64 | 'page_title' => 'Lighthouse General Settings', |
@@ -263,16 +263,16 @@ discard block |
||
263 | 263 | // register post type 'acf-field-group' |
264 | 264 | register_post_type('acf-field-group', array( |
265 | 265 | 'labels' => array( |
266 | - 'name' => __( 'Field Groups', 'acf' ), |
|
266 | + 'name' => __( 'Field Groups', 'acf' ), |
|
267 | 267 | 'singular_name' => __( 'Field Group', 'acf' ), |
268 | - 'add_new' => __( 'Add New' , 'acf' ), |
|
269 | - 'add_new_item' => __( 'Add New Field Group' , 'acf' ), |
|
270 | - 'edit_item' => __( 'Edit Field Group' , 'acf' ), |
|
271 | - 'new_item' => __( 'New Field Group' , 'acf' ), |
|
272 | - 'view_item' => __( 'View Field Group', 'acf' ), |
|
273 | - 'search_items' => __( 'Search Field Groups', 'acf' ), |
|
274 | - 'not_found' => __( 'No Field Groups found', 'acf' ), |
|
275 | - 'not_found_in_trash' => __( 'No Field Groups found in Trash', 'acf' ), |
|
268 | + 'add_new' => __( 'Add New' , 'acf' ), |
|
269 | + 'add_new_item' => __( 'Add New Field Group' , 'acf' ), |
|
270 | + 'edit_item' => __( 'Edit Field Group' , 'acf' ), |
|
271 | + 'new_item' => __( 'New Field Group' , 'acf' ), |
|
272 | + 'view_item' => __( 'View Field Group', 'acf' ), |
|
273 | + 'search_items' => __( 'Search Field Groups', 'acf' ), |
|
274 | + 'not_found' => __( 'No Field Groups found', 'acf' ), |
|
275 | + 'not_found_in_trash' => __( 'No Field Groups found in Trash', 'acf' ), |
|
276 | 276 | ), |
277 | 277 | 'public' => false, |
278 | 278 | 'show_ui' => true, |
@@ -295,16 +295,16 @@ discard block |
||
295 | 295 | // register post type 'acf-field' |
296 | 296 | register_post_type('acf-field', array( |
297 | 297 | 'labels' => array( |
298 | - 'name' => __( 'Fields', 'acf' ), |
|
298 | + 'name' => __( 'Fields', 'acf' ), |
|
299 | 299 | 'singular_name' => __( 'Field', 'acf' ), |
300 | - 'add_new' => __( 'Add New' , 'acf' ), |
|
301 | - 'add_new_item' => __( 'Add New Field' , 'acf' ), |
|
302 | - 'edit_item' => __( 'Edit Field' , 'acf' ), |
|
303 | - 'new_item' => __( 'New Field' , 'acf' ), |
|
304 | - 'view_item' => __( 'View Field', 'acf' ), |
|
305 | - 'search_items' => __( 'Search Fields', 'acf' ), |
|
306 | - 'not_found' => __( 'No Fields found', 'acf' ), |
|
307 | - 'not_found_in_trash' => __( 'No Fields found in Trash', 'acf' ), |
|
300 | + 'add_new' => __( 'Add New' , 'acf' ), |
|
301 | + 'add_new_item' => __( 'Add New Field' , 'acf' ), |
|
302 | + 'edit_item' => __( 'Edit Field' , 'acf' ), |
|
303 | + 'new_item' => __( 'New Field' , 'acf' ), |
|
304 | + 'view_item' => __( 'View Field', 'acf' ), |
|
305 | + 'search_items' => __( 'Search Fields', 'acf' ), |
|
306 | + 'not_found' => __( 'No Fields found', 'acf' ), |
|
307 | + 'not_found_in_trash' => __( 'No Fields found in Trash', 'acf' ), |
|
308 | 308 | ), |
309 | 309 | 'public' => false, |
310 | 310 | 'show_ui' => false, |
@@ -413,27 +413,27 @@ discard block |
||
413 | 413 | |
414 | 414 | $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $field_key ); |
415 | 415 | |
416 | - } |
|
416 | + } |
|
417 | 417 | |
418 | 418 | |
419 | - // acf_field_name |
|
420 | - if( $field_name = $wp_query->get('acf_field_name') ) { |
|
419 | + // acf_field_name |
|
420 | + if( $field_name = $wp_query->get('acf_field_name') ) { |
|
421 | 421 | |
422 | 422 | $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_excerpt = %s", $field_name ); |
423 | 423 | |
424 | - } |
|
424 | + } |
|
425 | 425 | |
426 | 426 | |
427 | - // acf_group_key |
|
427 | + // acf_group_key |
|
428 | 428 | if( $group_key = $wp_query->get('acf_group_key') ) { |
429 | 429 | |
430 | 430 | $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $group_key ); |
431 | 431 | |
432 | - } |
|
432 | + } |
|
433 | 433 | |
434 | 434 | |
435 | - // return |
|
436 | - return $where; |
|
435 | + // return |
|
436 | + return $where; |
|
437 | 437 | |
438 | 438 | } |
439 | 439 |
@@ -11,9 +11,9 @@ discard block |
||
11 | 11 | Domain Path: /lang |
12 | 12 | */ |
13 | 13 | |
14 | -if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
14 | +if ( ! defined('ABSPATH')) exit; // Exit if accessed directly |
|
15 | 15 | |
16 | -if( ! class_exists('acf') ) : |
|
16 | +if ( ! class_exists('acf')) : |
|
17 | 17 | |
18 | 18 | class acf { |
19 | 19 | |
@@ -64,9 +64,9 @@ discard block |
||
64 | 64 | 'version' => '5.3.3.1', |
65 | 65 | |
66 | 66 | // urls |
67 | - 'basename' => plugin_basename( __FILE__ ), |
|
68 | - 'path' => plugin_dir_path( __FILE__ ), |
|
69 | - 'dir' => plugin_dir_url( __FILE__ ), |
|
67 | + 'basename' => plugin_basename(__FILE__), |
|
68 | + 'path' => plugin_dir_path(__FILE__), |
|
69 | + 'dir' => plugin_dir_url(__FILE__), |
|
70 | 70 | |
71 | 71 | // options |
72 | 72 | 'show_admin' => true, |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | |
124 | 124 | // admin |
125 | - if( is_admin() ) { |
|
125 | + if (is_admin()) { |
|
126 | 126 | |
127 | 127 | acf_include('admin/admin.php'); |
128 | 128 | acf_include('admin/field-group.php'); |
@@ -139,14 +139,14 @@ discard block |
||
139 | 139 | |
140 | 140 | |
141 | 141 | // actions |
142 | - add_action('init', array($this, 'init'), 5); |
|
143 | - add_action('init', array($this, 'register_post_types'), 5); |
|
144 | - add_action('init', array($this, 'register_post_status'), 5); |
|
145 | - add_action('init', array($this, 'register_assets'), 5); |
|
142 | + add_action('init', array($this, 'init'), 5); |
|
143 | + add_action('init', array($this, 'register_post_types'), 5); |
|
144 | + add_action('init', array($this, 'register_post_status'), 5); |
|
145 | + add_action('init', array($this, 'register_assets'), 5); |
|
146 | 146 | |
147 | 147 | |
148 | 148 | // filters |
149 | - add_filter('posts_where', array($this, 'posts_where'), 10, 2 ); |
|
149 | + add_filter('posts_where', array($this, 'posts_where'), 10, 2); |
|
150 | 150 | //add_filter('posts_request', array($this, 'posts_request'), 10, 1 ); |
151 | 151 | |
152 | 152 | } |
@@ -168,11 +168,11 @@ discard block |
||
168 | 168 | function init() { |
169 | 169 | |
170 | 170 | // bail early if a plugin called get_field early |
171 | - if( !did_action('plugins_loaded') ) return; |
|
171 | + if ( ! did_action('plugins_loaded')) return; |
|
172 | 172 | |
173 | 173 | |
174 | 174 | // bail early if already init |
175 | - if( acf_get_setting('init') ) return; |
|
175 | + if (acf_get_setting('init')) return; |
|
176 | 176 | |
177 | 177 | |
178 | 178 | // only run once |
@@ -180,20 +180,20 @@ discard block |
||
180 | 180 | |
181 | 181 | |
182 | 182 | // vars |
183 | - $major = intval( acf_get_setting('version') ); |
|
183 | + $major = intval(acf_get_setting('version')); |
|
184 | 184 | |
185 | 185 | |
186 | 186 | // redeclare dir |
187 | 187 | // - allow another plugin to modify dir (maybe force SSL) |
188 | - acf_update_setting('dir', plugin_dir_url( __FILE__ )); |
|
188 | + acf_update_setting('dir', plugin_dir_url(__FILE__)); |
|
189 | 189 | |
190 | 190 | |
191 | 191 | // set text domain |
192 | - load_textdomain( 'acf', acf_get_path( 'lang/acf-' . get_locale() . '.mo' ) ); |
|
192 | + load_textdomain('acf', acf_get_path('lang/acf-'.get_locale().'.mo')); |
|
193 | 193 | |
194 | 194 | |
195 | 195 | // include wpml support |
196 | - if( defined('ICL_SITEPRESS_VERSION') ) { |
|
196 | + if (defined('ICL_SITEPRESS_VERSION')) { |
|
197 | 197 | |
198 | 198 | acf_include('core/wpml.php'); |
199 | 199 | |
@@ -263,16 +263,16 @@ discard block |
||
263 | 263 | // register post type 'acf-field-group' |
264 | 264 | register_post_type('acf-field-group', array( |
265 | 265 | 'labels' => array( |
266 | - 'name' => __( 'Field Groups', 'acf' ), |
|
267 | - 'singular_name' => __( 'Field Group', 'acf' ), |
|
268 | - 'add_new' => __( 'Add New' , 'acf' ), |
|
269 | - 'add_new_item' => __( 'Add New Field Group' , 'acf' ), |
|
270 | - 'edit_item' => __( 'Edit Field Group' , 'acf' ), |
|
271 | - 'new_item' => __( 'New Field Group' , 'acf' ), |
|
272 | - 'view_item' => __( 'View Field Group', 'acf' ), |
|
273 | - 'search_items' => __( 'Search Field Groups', 'acf' ), |
|
274 | - 'not_found' => __( 'No Field Groups found', 'acf' ), |
|
275 | - 'not_found_in_trash' => __( 'No Field Groups found in Trash', 'acf' ), |
|
266 | + 'name' => __('Field Groups', 'acf'), |
|
267 | + 'singular_name' => __('Field Group', 'acf'), |
|
268 | + 'add_new' => __('Add New', 'acf'), |
|
269 | + 'add_new_item' => __('Add New Field Group', 'acf'), |
|
270 | + 'edit_item' => __('Edit Field Group', 'acf'), |
|
271 | + 'new_item' => __('New Field Group', 'acf'), |
|
272 | + 'view_item' => __('View Field Group', 'acf'), |
|
273 | + 'search_items' => __('Search Field Groups', 'acf'), |
|
274 | + 'not_found' => __('No Field Groups found', 'acf'), |
|
275 | + 'not_found_in_trash' => __('No Field Groups found in Trash', 'acf'), |
|
276 | 276 | ), |
277 | 277 | 'public' => false, |
278 | 278 | 'show_ui' => true, |
@@ -295,16 +295,16 @@ discard block |
||
295 | 295 | // register post type 'acf-field' |
296 | 296 | register_post_type('acf-field', array( |
297 | 297 | 'labels' => array( |
298 | - 'name' => __( 'Fields', 'acf' ), |
|
299 | - 'singular_name' => __( 'Field', 'acf' ), |
|
300 | - 'add_new' => __( 'Add New' , 'acf' ), |
|
301 | - 'add_new_item' => __( 'Add New Field' , 'acf' ), |
|
302 | - 'edit_item' => __( 'Edit Field' , 'acf' ), |
|
303 | - 'new_item' => __( 'New Field' , 'acf' ), |
|
304 | - 'view_item' => __( 'View Field', 'acf' ), |
|
305 | - 'search_items' => __( 'Search Fields', 'acf' ), |
|
306 | - 'not_found' => __( 'No Fields found', 'acf' ), |
|
307 | - 'not_found_in_trash' => __( 'No Fields found in Trash', 'acf' ), |
|
298 | + 'name' => __('Fields', 'acf'), |
|
299 | + 'singular_name' => __('Field', 'acf'), |
|
300 | + 'add_new' => __('Add New', 'acf'), |
|
301 | + 'add_new_item' => __('Add New Field', 'acf'), |
|
302 | + 'edit_item' => __('Edit Field', 'acf'), |
|
303 | + 'new_item' => __('New Field', 'acf'), |
|
304 | + 'view_item' => __('View Field', 'acf'), |
|
305 | + 'search_items' => __('Search Fields', 'acf'), |
|
306 | + 'not_found' => __('No Fields found', 'acf'), |
|
307 | + 'not_found_in_trash' => __('No Fields found in Trash', 'acf'), |
|
308 | 308 | ), |
309 | 309 | 'public' => false, |
310 | 310 | 'show_ui' => false, |
@@ -343,12 +343,12 @@ discard block |
||
343 | 343 | |
344 | 344 | // acf-disabled |
345 | 345 | register_post_status('acf-disabled', array( |
346 | - 'label' => __( 'Disabled', 'acf' ), |
|
346 | + 'label' => __('Disabled', 'acf'), |
|
347 | 347 | 'public' => true, |
348 | 348 | 'exclude_from_search' => false, |
349 | 349 | 'show_in_admin_all_list' => true, |
350 | 350 | 'show_in_admin_status_list' => true, |
351 | - 'label_count' => _n_noop( 'Disabled <span class="count">(%s)</span>', 'Disabled <span class="count">(%s)</span>', 'acf' ), |
|
351 | + 'label_count' => _n_noop('Disabled <span class="count">(%s)</span>', 'Disabled <span class="count">(%s)</span>', 'acf'), |
|
352 | 352 | )); |
353 | 353 | |
354 | 354 | } |
@@ -376,14 +376,14 @@ discard block |
||
376 | 376 | |
377 | 377 | |
378 | 378 | // scripts |
379 | - wp_register_script('acf-input', acf_get_dir("assets/js/acf-input{$min}.js"), array('jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-resizable'), $version ); |
|
380 | - wp_register_script('acf-field-group', acf_get_dir("assets/js/acf-field-group{$min}.js"), array('acf-input'), $version ); |
|
379 | + wp_register_script('acf-input', acf_get_dir("assets/js/acf-input{$min}.js"), array('jquery', 'jquery-ui-core', 'jquery-ui-sortable', 'jquery-ui-resizable'), $version); |
|
380 | + wp_register_script('acf-field-group', acf_get_dir("assets/js/acf-field-group{$min}.js"), array('acf-input'), $version); |
|
381 | 381 | |
382 | 382 | |
383 | 383 | // styles |
384 | - wp_register_style('acf-global', acf_get_dir('assets/css/acf-global.css'), array(), $version ); |
|
385 | - wp_register_style('acf-input', acf_get_dir('assets/css/acf-input.css'), array('acf-global'), $version ); |
|
386 | - wp_register_style('acf-field-group', acf_get_dir('assets/css/acf-field-group.css'), array('acf-input'), $version ); |
|
384 | + wp_register_style('acf-global', acf_get_dir('assets/css/acf-global.css'), array(), $version); |
|
385 | + wp_register_style('acf-input', acf_get_dir('assets/css/acf-input.css'), array('acf-global'), $version); |
|
386 | + wp_register_style('acf-field-group', acf_get_dir('assets/css/acf-field-group.css'), array('acf-input'), $version); |
|
387 | 387 | |
388 | 388 | } |
389 | 389 | |
@@ -402,32 +402,32 @@ discard block |
||
402 | 402 | * @return $where (string) |
403 | 403 | */ |
404 | 404 | |
405 | - function posts_where( $where, $wp_query ) { |
|
405 | + function posts_where($where, $wp_query) { |
|
406 | 406 | |
407 | 407 | // global |
408 | 408 | global $wpdb; |
409 | 409 | |
410 | 410 | |
411 | 411 | // acf_field_key |
412 | - if( $field_key = $wp_query->get('acf_field_key') ) { |
|
412 | + if ($field_key = $wp_query->get('acf_field_key')) { |
|
413 | 413 | |
414 | - $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $field_key ); |
|
414 | + $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $field_key); |
|
415 | 415 | |
416 | 416 | } |
417 | 417 | |
418 | 418 | |
419 | 419 | // acf_field_name |
420 | - if( $field_name = $wp_query->get('acf_field_name') ) { |
|
420 | + if ($field_name = $wp_query->get('acf_field_name')) { |
|
421 | 421 | |
422 | - $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_excerpt = %s", $field_name ); |
|
422 | + $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_excerpt = %s", $field_name); |
|
423 | 423 | |
424 | 424 | } |
425 | 425 | |
426 | 426 | |
427 | 427 | // acf_group_key |
428 | - if( $group_key = $wp_query->get('acf_group_key') ) { |
|
428 | + if ($group_key = $wp_query->get('acf_group_key')) { |
|
429 | 429 | |
430 | - $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $group_key ); |
|
430 | + $where .= $wpdb->prepare(" AND {$wpdb->posts}.post_name = %s", $group_key); |
|
431 | 431 | |
432 | 432 | } |
433 | 433 | |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | |
469 | 469 | global $acf; |
470 | 470 | |
471 | - if( !isset($acf) ) { |
|
471 | + if ( ! isset($acf)) { |
|
472 | 472 | |
473 | 473 | $acf = new acf(); |
474 | 474 |
@@ -11,7 +11,10 @@ discard block |
||
11 | 11 | Domain Path: /lang |
12 | 12 | */ |
13 | 13 | |
14 | -if( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly |
|
14 | +if( ! defined( 'ABSPATH' ) ) { |
|
15 | + exit; |
|
16 | +} |
|
17 | +// Exit if accessed directly |
|
15 | 18 | |
16 | 19 | if( ! class_exists('acf') ) : |
17 | 20 | |
@@ -168,11 +171,15 @@ discard block |
||
168 | 171 | function init() { |
169 | 172 | |
170 | 173 | // bail early if a plugin called get_field early |
171 | - if( !did_action('plugins_loaded') ) return; |
|
174 | + if( !did_action('plugins_loaded') ) { |
|
175 | + return; |
|
176 | + } |
|
172 | 177 | |
173 | 178 | |
174 | 179 | // bail early if already init |
175 | - if( acf_get_setting('init') ) return; |
|
180 | + if( acf_get_setting('init') ) { |
|
181 | + return; |
|
182 | + } |
|
176 | 183 | |
177 | 184 | |
178 | 185 | // only run once |
@@ -18,9 +18,9 @@ discard block |
||
18 | 18 | function __construct() { |
19 | 19 | |
20 | 20 | // actions |
21 | - add_action('admin_menu', array($this, 'admin_menu')); |
|
22 | - add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'), 0); |
|
23 | - add_action('admin_notices', array($this, 'admin_notices')); |
|
21 | + add_action('admin_menu', array($this, 'admin_menu')); |
|
22 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'), 0); |
|
23 | + add_action('admin_notices', array($this, 'admin_notices')); |
|
24 | 24 | |
25 | 25 | } |
26 | 26 | |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | function admin_menu() { |
42 | 42 | |
43 | 43 | // bail early if no show_admin |
44 | - if( !acf_get_setting('show_admin') ) { |
|
44 | + if ( ! acf_get_setting('show_admin')) { |
|
45 | 45 | |
46 | 46 | return; |
47 | 47 | |
@@ -54,12 +54,12 @@ discard block |
||
54 | 54 | |
55 | 55 | |
56 | 56 | // add parent |
57 | - add_menu_page(__("Custom Fields",'acf'), __("Custom Fields",'acf'), $cap, $slug, false, 'dashicons-welcome-widgets-menus', '80.025'); |
|
57 | + add_menu_page(__("Custom Fields", 'acf'), __("Custom Fields", 'acf'), $cap, $slug, false, 'dashicons-welcome-widgets-menus', '80.025'); |
|
58 | 58 | |
59 | 59 | |
60 | 60 | // add children |
61 | - add_submenu_page($slug, __('Field Groups','acf'), __('Field Groups','acf'), $cap, $slug ); |
|
62 | - add_submenu_page($slug, __('Add New','acf'), __('Add New','acf'), $cap, 'post-new.php?post_type=acf-field-group' ); |
|
61 | + add_submenu_page($slug, __('Field Groups', 'acf'), __('Field Groups', 'acf'), $cap, $slug); |
|
62 | + add_submenu_page($slug, __('Add New', 'acf'), __('Add New', 'acf'), $cap, 'post-new.php?post_type=acf-field-group'); |
|
63 | 63 | |
64 | 64 | } |
65 | 65 | |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | |
80 | 80 | function admin_enqueue_scripts() { |
81 | 81 | |
82 | - wp_enqueue_style( 'acf-global' ); |
|
82 | + wp_enqueue_style('acf-global'); |
|
83 | 83 | |
84 | 84 | } |
85 | 85 | |
@@ -104,19 +104,19 @@ discard block |
||
104 | 104 | |
105 | 105 | |
106 | 106 | // bail early if no notices |
107 | - if( empty($admin_notices) ) { |
|
107 | + if (empty($admin_notices)) { |
|
108 | 108 | |
109 | 109 | return; |
110 | 110 | |
111 | 111 | } |
112 | 112 | |
113 | 113 | |
114 | - foreach( $admin_notices as $notice ) { |
|
114 | + foreach ($admin_notices as $notice) { |
|
115 | 115 | |
116 | 116 | $open = ''; |
117 | 117 | $close = ''; |
118 | 118 | |
119 | - if( $notice['wrap'] ) { |
|
119 | + if ($notice['wrap']) { |
|
120 | 120 | |
121 | 121 | $open = "<{$notice['wrap']}>"; |
122 | 122 | $close = "</{$notice['wrap']}>"; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | } |
125 | 125 | |
126 | 126 | ?> |
127 | - <div class="notice is-dismissible <?php echo $notice['class']; ?>"><?php echo $open . $notice['text'] . $close; ?></div> |
|
127 | + <div class="notice is-dismissible <?php echo $notice['class']; ?>"><?php echo $open.$notice['text'].$close; ?></div> |
|
128 | 128 | <?php |
129 | 129 | |
130 | 130 | } |
@@ -282,13 +282,13 @@ discard block |
||
282 | 282 | |
283 | 283 | |
284 | 284 | // append |
285 | - $html .= '<div id="acf-append-show-on-screen" class="acf-hidden">'; |
|
286 | - $html .= '<label for="acf-field-key-hide"><input id="acf-field-key-hide" type="checkbox" value="1" name="show_field_keys" ' . $checked . ' /> ' . __('Field Keys','acf') . '</label>'; |
|
285 | + $html .= '<div id="acf-append-show-on-screen" class="acf-hidden">'; |
|
286 | + $html .= '<label for="acf-field-key-hide"><input id="acf-field-key-hide" type="checkbox" value="1" name="show_field_keys" ' . $checked . ' /> ' . __('Field Keys','acf') . '</label>'; |
|
287 | 287 | $html .= '</div>'; |
288 | 288 | |
289 | 289 | |
290 | - // return |
|
291 | - return $html; |
|
290 | + // return |
|
291 | + return $html; |
|
292 | 292 | |
293 | 293 | } |
294 | 294 | |
@@ -396,9 +396,9 @@ discard block |
||
396 | 396 | // only save once! WordPress save's a revision as well. |
397 | 397 | if( wp_is_post_revision($post_id) ) { |
398 | 398 | |
399 | - return $post_id; |
|
399 | + return $post_id; |
|
400 | 400 | |
401 | - } |
|
401 | + } |
|
402 | 402 | |
403 | 403 | |
404 | 404 | // verify nonce |
@@ -409,11 +409,11 @@ discard block |
||
409 | 409 | } |
410 | 410 | |
411 | 411 | |
412 | - // disable local to avoid conflicts between DB and local |
|
412 | + // disable local to avoid conflicts between DB and local |
|
413 | 413 | acf_disable_local(); |
414 | 414 | |
415 | 415 | |
416 | - // save fields |
|
416 | + // save fields |
|
417 | 417 | unset( $_POST['acf_fields']['acfcloneindex'] ); |
418 | 418 | |
419 | 419 | if( !empty($_POST['acf_fields']) ) { |
@@ -453,10 +453,10 @@ discard block |
||
453 | 453 | |
454 | 454 | |
455 | 455 | // delete fields |
456 | - if( $_POST['_acf_delete_fields'] ) { |
|
456 | + if( $_POST['_acf_delete_fields'] ) { |
|
457 | 457 | |
458 | - $ids = explode('|', $_POST['_acf_delete_fields']); |
|
459 | - $ids = array_map( 'intval', $ids ); |
|
458 | + $ids = explode('|', $_POST['_acf_delete_fields']); |
|
459 | + $ids = array_map( 'intval', $ids ); |
|
460 | 460 | |
461 | 461 | foreach( $ids as $id ) { |
462 | 462 | |
@@ -468,20 +468,20 @@ discard block |
||
468 | 468 | |
469 | 469 | } |
470 | 470 | |
471 | - } |
|
471 | + } |
|
472 | 472 | |
473 | 473 | |
474 | 474 | // add args |
475 | - $_POST['acf_field_group']['ID'] = $post_id; |
|
476 | - $_POST['acf_field_group']['title'] = $_POST['post_title']; |
|
475 | + $_POST['acf_field_group']['ID'] = $post_id; |
|
476 | + $_POST['acf_field_group']['title'] = $_POST['post_title']; |
|
477 | 477 | |
478 | 478 | |
479 | 479 | // save field group |
480 | - acf_update_field_group( $_POST['acf_field_group'] ); |
|
480 | + acf_update_field_group( $_POST['acf_field_group'] ); |
|
481 | 481 | |
482 | 482 | |
483 | - // return |
|
484 | - return $post_id; |
|
483 | + // return |
|
484 | + return $post_id; |
|
485 | 485 | } |
486 | 486 | |
487 | 487 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @subpackage Admin |
11 | 11 | */ |
12 | 12 | |
13 | -if( ! class_exists('acf_admin_field_group') ) : |
|
13 | +if ( ! class_exists('acf_admin_field_group')) : |
|
14 | 14 | |
15 | 15 | class acf_admin_field_group { |
16 | 16 | |
@@ -31,18 +31,18 @@ discard block |
||
31 | 31 | function __construct() { |
32 | 32 | |
33 | 33 | // actions |
34 | - add_action('current_screen', array($this, 'current_screen')); |
|
35 | - add_action('save_post', array($this, 'save_post'), 10, 2); |
|
34 | + add_action('current_screen', array($this, 'current_screen')); |
|
35 | + add_action('save_post', array($this, 'save_post'), 10, 2); |
|
36 | 36 | |
37 | 37 | |
38 | 38 | // ajax |
39 | - add_action('wp_ajax_acf/field_group/render_field_settings', array($this, 'ajax_render_field_settings')); |
|
40 | - add_action('wp_ajax_acf/field_group/render_location_value', array($this, 'ajax_render_location_value')); |
|
41 | - add_action('wp_ajax_acf/field_group/move_field', array($this, 'ajax_move_field')); |
|
39 | + add_action('wp_ajax_acf/field_group/render_field_settings', array($this, 'ajax_render_field_settings')); |
|
40 | + add_action('wp_ajax_acf/field_group/render_location_value', array($this, 'ajax_render_location_value')); |
|
41 | + add_action('wp_ajax_acf/field_group/move_field', array($this, 'ajax_move_field')); |
|
42 | 42 | |
43 | 43 | |
44 | 44 | // filters |
45 | - add_filter('post_updated_messages', array($this, 'post_updated_messages')); |
|
45 | + add_filter('post_updated_messages', array($this, 'post_updated_messages')); |
|
46 | 46 | |
47 | 47 | } |
48 | 48 | |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @return $messages |
61 | 61 | */ |
62 | 62 | |
63 | - function post_updated_messages( $messages ) { |
|
63 | + function post_updated_messages($messages) { |
|
64 | 64 | |
65 | 65 | // append to messages |
66 | 66 | $messages['acf-field-group'] = array( |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | function current_screen() { |
100 | 100 | |
101 | 101 | // validate screen |
102 | - if( !acf_is_screen('acf-field-group') ) { |
|
102 | + if ( ! acf_is_screen('acf-field-group')) { |
|
103 | 103 | |
104 | 104 | return; |
105 | 105 | |
@@ -111,9 +111,9 @@ discard block |
||
111 | 111 | |
112 | 112 | |
113 | 113 | // actions |
114 | - add_action('admin_enqueue_scripts', array($this,'admin_enqueue_scripts'), 20); |
|
115 | - add_action('admin_head', array($this,'admin_head'), 20); |
|
116 | - add_action('admin_footer', array($this,'admin_footer'), 20); |
|
114 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts'), 20); |
|
115 | + add_action('admin_head', array($this, 'admin_head'), 20); |
|
116 | + add_action('admin_footer', array($this, 'admin_footer'), 20); |
|
117 | 117 | |
118 | 118 | } |
119 | 119 | |
@@ -169,22 +169,22 @@ discard block |
||
169 | 169 | |
170 | 170 | |
171 | 171 | // set global var |
172 | - $field_group = acf_get_field_group( $post ); |
|
172 | + $field_group = acf_get_field_group($post); |
|
173 | 173 | |
174 | 174 | |
175 | 175 | // metaboxes |
176 | - add_meta_box('acf-field-group-fields', __("Fields",'acf'), array($this, 'mb_fields'), 'acf-field-group', 'normal', 'high'); |
|
177 | - add_meta_box('acf-field-group-locations', __("Location",'acf'), array($this, 'mb_locations'), 'acf-field-group', 'normal', 'high'); |
|
178 | - add_meta_box('acf-field-group-options', __("Settings",'acf'), array($this, 'mb_options'), 'acf-field-group', 'normal', 'high'); |
|
176 | + add_meta_box('acf-field-group-fields', __("Fields", 'acf'), array($this, 'mb_fields'), 'acf-field-group', 'normal', 'high'); |
|
177 | + add_meta_box('acf-field-group-locations', __("Location", 'acf'), array($this, 'mb_locations'), 'acf-field-group', 'normal', 'high'); |
|
178 | + add_meta_box('acf-field-group-options', __("Settings", 'acf'), array($this, 'mb_options'), 'acf-field-group', 'normal', 'high'); |
|
179 | 179 | |
180 | 180 | |
181 | 181 | // actions |
182 | - add_action('post_submitbox_misc_actions', array($this, 'post_submitbox_misc_actions'), 10, 0); |
|
183 | - add_action('edit_form_after_title', array($this, 'edit_form_after_title'), 10, 0); |
|
182 | + add_action('post_submitbox_misc_actions', array($this, 'post_submitbox_misc_actions'), 10, 0); |
|
183 | + add_action('edit_form_after_title', array($this, 'edit_form_after_title'), 10, 0); |
|
184 | 184 | |
185 | 185 | |
186 | 186 | // filters |
187 | - add_filter('screen_settings', array($this, 'screen_settings'), 10, 1); |
|
187 | + add_filter('screen_settings', array($this, 'screen_settings'), 10, 1); |
|
188 | 188 | |
189 | 189 | |
190 | 190 | // action for 3rd party customisation |
@@ -214,27 +214,27 @@ discard block |
||
214 | 214 | |
215 | 215 | // vars |
216 | 216 | $l10n = apply_filters('acf/field_group/admin_l10n', array( |
217 | - 'move_to_trash' => __("Move to trash. Are you sure?",'acf'), |
|
218 | - 'checked' => __("checked",'acf'), |
|
219 | - 'no_fields' => __("No toggle fields available",'acf'), |
|
220 | - 'title_is_required' => __("Field group title is required",'acf'), |
|
221 | - 'copy' => __("copy",'acf'), |
|
222 | - 'or' => __("or",'acf'), |
|
223 | - 'fields' => __("Fields",'acf'), |
|
224 | - 'parent_fields' => __("Parent fields",'acf'), |
|
225 | - 'sibling_fields' => __("Sibling fields",'acf'), |
|
226 | - 'move_field' => __("Move Custom Field",'acf'), |
|
227 | - 'move_field_warning' => __("This field cannot be moved until its changes have been saved",'acf'), |
|
228 | - 'null' => __("Null",'acf'), |
|
229 | - 'unload' => __('The changes you made will be lost if you navigate away from this page','acf'), |
|
230 | - 'field_name_start' => __('The string "field_" may not be used at the start of a field name','acf'), |
|
217 | + 'move_to_trash' => __("Move to trash. Are you sure?", 'acf'), |
|
218 | + 'checked' => __("checked", 'acf'), |
|
219 | + 'no_fields' => __("No toggle fields available", 'acf'), |
|
220 | + 'title_is_required' => __("Field group title is required", 'acf'), |
|
221 | + 'copy' => __("copy", 'acf'), |
|
222 | + 'or' => __("or", 'acf'), |
|
223 | + 'fields' => __("Fields", 'acf'), |
|
224 | + 'parent_fields' => __("Parent fields", 'acf'), |
|
225 | + 'sibling_fields' => __("Sibling fields", 'acf'), |
|
226 | + 'move_field' => __("Move Custom Field", 'acf'), |
|
227 | + 'move_field_warning' => __("This field cannot be moved until its changes have been saved", 'acf'), |
|
228 | + 'null' => __("Null", 'acf'), |
|
229 | + 'unload' => __('The changes you made will be lost if you navigate away from this page', 'acf'), |
|
230 | + 'field_name_start' => __('The string "field_" may not be used at the start of a field name', 'acf'), |
|
231 | 231 | )); |
232 | 232 | |
233 | 233 | $o = array( |
234 | 234 | 'post_id' => $post->ID, |
235 | - 'nonce' => wp_create_nonce( 'acf_nonce' ), |
|
235 | + 'nonce' => wp_create_nonce('acf_nonce'), |
|
236 | 236 | 'admin_url' => admin_url(), |
237 | - 'ajaxurl' => admin_url( 'admin-ajax.php' ), |
|
237 | + 'ajaxurl' => admin_url('admin-ajax.php'), |
|
238 | 238 | 'validation' => 0, |
239 | 239 | ); |
240 | 240 | |
@@ -275,7 +275,7 @@ discard block |
||
275 | 275 | * @return $current |
276 | 276 | */ |
277 | 277 | |
278 | - function screen_settings( $html ) { |
|
278 | + function screen_settings($html) { |
|
279 | 279 | |
280 | 280 | // vars |
281 | 281 | $checked = acf_get_user_setting('show_field_keys') ? 'checked="checked"' : ''; |
@@ -283,7 +283,7 @@ discard block |
||
283 | 283 | |
284 | 284 | // append |
285 | 285 | $html .= '<div id="acf-append-show-on-screen" class="acf-hidden">'; |
286 | - $html .= '<label for="acf-field-key-hide"><input id="acf-field-key-hide" type="checkbox" value="1" name="show_field_keys" ' . $checked . ' /> ' . __('Field Keys','acf') . '</label>'; |
|
286 | + $html .= '<label for="acf-field-key-hide"><input id="acf-field-key-hide" type="checkbox" value="1" name="show_field_keys" '.$checked.' /> '.__('Field Keys', 'acf').'</label>'; |
|
287 | 287 | $html .= '</div>'; |
288 | 288 | |
289 | 289 | |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | |
314 | 314 | |
315 | 315 | // vars |
316 | - $status = $field_group['active'] ? __("Active",'acf') : __("Disabled",'acf'); |
|
316 | + $status = $field_group['active'] ? __("Active", 'acf') : __("Disabled", 'acf'); |
|
317 | 317 | |
318 | 318 | ?> |
319 | 319 | <script type="text/javascript"> |
@@ -353,7 +353,7 @@ discard block |
||
353 | 353 | |
354 | 354 | ?> |
355 | 355 | <div id="acf-form-data" class="acf-hidden"> |
356 | - <input type="hidden" name="_acfnonce" value="<?php echo wp_create_nonce( 'field_group' ); ?>" /> |
|
356 | + <input type="hidden" name="_acfnonce" value="<?php echo wp_create_nonce('field_group'); ?>" /> |
|
357 | 357 | <input type="hidden" name="_acf_delete_fields" value="0" id="input-delete-fields" /> |
358 | 358 | <?php do_action('acf/field_group/form_data'); ?> |
359 | 359 | </div> |
@@ -375,10 +375,10 @@ discard block |
||
375 | 375 | * @return $post_id (int) |
376 | 376 | */ |
377 | 377 | |
378 | - function save_post( $post_id, $post ) { |
|
378 | + function save_post($post_id, $post) { |
|
379 | 379 | |
380 | 380 | // do not save if this is an auto save routine |
381 | - if( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) { |
|
381 | + if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { |
|
382 | 382 | |
383 | 383 | return $post_id; |
384 | 384 | |
@@ -386,7 +386,7 @@ discard block |
||
386 | 386 | |
387 | 387 | |
388 | 388 | // bail early if not acf-field-group |
389 | - if( $post->post_type !== 'acf-field-group' ) { |
|
389 | + if ($post->post_type !== 'acf-field-group') { |
|
390 | 390 | |
391 | 391 | return $post_id; |
392 | 392 | |
@@ -394,7 +394,7 @@ discard block |
||
394 | 394 | |
395 | 395 | |
396 | 396 | // only save once! WordPress save's a revision as well. |
397 | - if( wp_is_post_revision($post_id) ) { |
|
397 | + if (wp_is_post_revision($post_id)) { |
|
398 | 398 | |
399 | 399 | return $post_id; |
400 | 400 | |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | |
403 | 403 | |
404 | 404 | // verify nonce |
405 | - if( !acf_verify_nonce('field_group') ) { |
|
405 | + if ( ! acf_verify_nonce('field_group')) { |
|
406 | 406 | |
407 | 407 | return $post_id; |
408 | 408 | |
@@ -414,19 +414,19 @@ discard block |
||
414 | 414 | |
415 | 415 | |
416 | 416 | // save fields |
417 | - unset( $_POST['acf_fields']['acfcloneindex'] ); |
|
417 | + unset($_POST['acf_fields']['acfcloneindex']); |
|
418 | 418 | |
419 | - if( !empty($_POST['acf_fields']) ) { |
|
419 | + if ( ! empty($_POST['acf_fields'])) { |
|
420 | 420 | |
421 | - foreach( $_POST['acf_fields'] as $field ) { |
|
421 | + foreach ($_POST['acf_fields'] as $field) { |
|
422 | 422 | |
423 | 423 | // vars |
424 | 424 | $specific = false; |
425 | - $save = acf_extract_var( $field, 'save' ); |
|
425 | + $save = acf_extract_var($field, 'save'); |
|
426 | 426 | |
427 | 427 | |
428 | 428 | // only saved field if has changed |
429 | - if( $save == 'meta' ) { |
|
429 | + if ($save == 'meta') { |
|
430 | 430 | |
431 | 431 | $specific = array( |
432 | 432 | 'menu_order', |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | |
438 | 438 | |
439 | 439 | // set field parent |
440 | - if( empty($field['parent']) ) { |
|
440 | + if (empty($field['parent'])) { |
|
441 | 441 | |
442 | 442 | $field['parent'] = $post_id; |
443 | 443 | |
@@ -445,7 +445,7 @@ discard block |
||
445 | 445 | |
446 | 446 | |
447 | 447 | // save field |
448 | - acf_update_field( $field, $specific ); |
|
448 | + acf_update_field($field, $specific); |
|
449 | 449 | |
450 | 450 | } |
451 | 451 | |
@@ -453,16 +453,16 @@ discard block |
||
453 | 453 | |
454 | 454 | |
455 | 455 | // delete fields |
456 | - if( $_POST['_acf_delete_fields'] ) { |
|
456 | + if ($_POST['_acf_delete_fields']) { |
|
457 | 457 | |
458 | 458 | $ids = explode('|', $_POST['_acf_delete_fields']); |
459 | - $ids = array_map( 'intval', $ids ); |
|
459 | + $ids = array_map('intval', $ids); |
|
460 | 460 | |
461 | - foreach( $ids as $id ) { |
|
461 | + foreach ($ids as $id) { |
|
462 | 462 | |
463 | - if( $id != 0 ) { |
|
463 | + if ($id != 0) { |
|
464 | 464 | |
465 | - acf_delete_field( $id ); |
|
465 | + acf_delete_field($id); |
|
466 | 466 | |
467 | 467 | } |
468 | 468 | |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | |
478 | 478 | |
479 | 479 | // save field group |
480 | - acf_update_field_group( $_POST['acf_field_group'] ); |
|
480 | + acf_update_field_group($_POST['acf_field_group']); |
|
481 | 481 | |
482 | 482 | |
483 | 483 | // return |
@@ -506,7 +506,7 @@ discard block |
||
506 | 506 | |
507 | 507 | // get fields |
508 | 508 | $view = array( |
509 | - 'fields' => acf_get_fields_by_id( $field_group['ID'] ) |
|
509 | + 'fields' => acf_get_fields_by_id($field_group['ID']) |
|
510 | 510 | ); |
511 | 511 | |
512 | 512 | |
@@ -536,7 +536,7 @@ discard block |
||
536 | 536 | |
537 | 537 | |
538 | 538 | // field key (leave in for compatibility) |
539 | - if( !acf_is_field_group_key( $field_group['key']) ) { |
|
539 | + if ( ! acf_is_field_group_key($field_group['key'])) { |
|
540 | 540 | |
541 | 541 | $field_group['key'] = uniqid('group_'); |
542 | 542 | |
@@ -544,7 +544,7 @@ discard block |
||
544 | 544 | |
545 | 545 | |
546 | 546 | // don't use view because we need access to $this context |
547 | - include( acf_get_path('admin/views/field-group-options.php') ); |
|
547 | + include(acf_get_path('admin/views/field-group-options.php')); |
|
548 | 548 | |
549 | 549 | } |
550 | 550 | |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | |
570 | 570 | |
571 | 571 | // UI needs at lease 1 location rule |
572 | - if( empty($field_group['location']) ) { |
|
572 | + if (empty($field_group['location'])) { |
|
573 | 573 | |
574 | 574 | $field_group['location'] = array( |
575 | 575 | |
@@ -589,7 +589,7 @@ discard block |
||
589 | 589 | |
590 | 590 | |
591 | 591 | // don't use view because we need access to $this context |
592 | - include( acf_get_path('admin/views/field-group-locations.php') ); |
|
592 | + include(acf_get_path('admin/views/field-group-locations.php')); |
|
593 | 593 | |
594 | 594 | } |
595 | 595 | |
@@ -607,10 +607,10 @@ discard block |
||
607 | 607 | * @return N/A |
608 | 608 | */ |
609 | 609 | |
610 | - function render_location_value( $options ) { |
|
610 | + function render_location_value($options) { |
|
611 | 611 | |
612 | 612 | // vars |
613 | - $options = wp_parse_args( $options, array( |
|
613 | + $options = wp_parse_args($options, array( |
|
614 | 614 | 'group_id' => 0, |
615 | 615 | 'rule_id' => 0, |
616 | 616 | 'value' => null, |
@@ -623,14 +623,14 @@ discard block |
||
623 | 623 | |
624 | 624 | |
625 | 625 | // some case's have the same outcome |
626 | - if( $options['param'] == "page_parent" ) { |
|
626 | + if ($options['param'] == "page_parent") { |
|
627 | 627 | |
628 | 628 | $options['param'] = "page"; |
629 | 629 | |
630 | 630 | } |
631 | 631 | |
632 | 632 | |
633 | - switch( $options['param'] ) { |
|
633 | + switch ($options['param']) { |
|
634 | 634 | |
635 | 635 | |
636 | 636 | /* |
@@ -641,8 +641,8 @@ discard block |
||
641 | 641 | |
642 | 642 | // all post types except attachment |
643 | 643 | $exclude = array('attachment'); |
644 | - $choices = acf_get_post_types( $exclude ); |
|
645 | - $choices = acf_get_pretty_post_types( $choices ); |
|
644 | + $choices = acf_get_post_types($exclude); |
|
645 | + $choices = acf_get_pretty_post_types($choices); |
|
646 | 646 | |
647 | 647 | break; |
648 | 648 | |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | |
652 | 652 | // get post types |
653 | 653 | $exclude = array('page', 'attachment'); |
654 | - $post_types = acf_get_post_types( $exclude ); |
|
654 | + $post_types = acf_get_post_types($exclude); |
|
655 | 655 | |
656 | 656 | |
657 | 657 | // get posts grouped by post type |
@@ -660,25 +660,25 @@ discard block |
||
660 | 660 | )); |
661 | 661 | |
662 | 662 | |
663 | - if( !empty($groups) ) { |
|
663 | + if ( ! empty($groups)) { |
|
664 | 664 | |
665 | - foreach( array_keys($groups) as $group_title ) { |
|
665 | + foreach (array_keys($groups) as $group_title) { |
|
666 | 666 | |
667 | 667 | // vars |
668 | - $posts = acf_extract_var( $groups, $group_title ); |
|
668 | + $posts = acf_extract_var($groups, $group_title); |
|
669 | 669 | |
670 | 670 | |
671 | 671 | // override post data |
672 | - foreach( array_keys($posts) as $post_id ) { |
|
672 | + foreach (array_keys($posts) as $post_id) { |
|
673 | 673 | |
674 | 674 | // update |
675 | - $posts[ $post_id ] = acf_get_post_title( $posts[ $post_id ] ); |
|
675 | + $posts[$post_id] = acf_get_post_title($posts[$post_id]); |
|
676 | 676 | |
677 | 677 | }; |
678 | 678 | |
679 | 679 | |
680 | 680 | // append to $choices |
681 | - $choices[ $group_title ] = $posts; |
|
681 | + $choices[$group_title] = $posts; |
|
682 | 682 | |
683 | 683 | } |
684 | 684 | |
@@ -689,9 +689,9 @@ discard block |
||
689 | 689 | |
690 | 690 | case "post_category" : |
691 | 691 | |
692 | - $terms = acf_get_taxonomy_terms( 'category' ); |
|
692 | + $terms = acf_get_taxonomy_terms('category'); |
|
693 | 693 | |
694 | - if( !empty($terms) ) { |
|
694 | + if ( ! empty($terms)) { |
|
695 | 695 | |
696 | 696 | $choices = array_pop($terms); |
697 | 697 | |
@@ -711,11 +711,11 @@ discard block |
||
711 | 711 | |
712 | 712 | global $wp_post_statuses; |
713 | 713 | |
714 | - if( !empty($wp_post_statuses) ) { |
|
714 | + if ( ! empty($wp_post_statuses)) { |
|
715 | 715 | |
716 | - foreach( $wp_post_statuses as $status ) { |
|
716 | + foreach ($wp_post_statuses as $status) { |
|
717 | 717 | |
718 | - $choices[ $status->name ] = $status->label; |
|
718 | + $choices[$status->name] = $status->label; |
|
719 | 719 | |
720 | 720 | } |
721 | 721 | |
@@ -729,9 +729,9 @@ discard block |
||
729 | 729 | $choices = acf_get_taxonomy_terms(); |
730 | 730 | |
731 | 731 | // unset post_format |
732 | - if( isset($choices['post_format']) ) { |
|
732 | + if (isset($choices['post_format'])) { |
|
733 | 733 | |
734 | - unset( $choices['post_format']) ; |
|
734 | + unset($choices['post_format']); |
|
735 | 735 | |
736 | 736 | } |
737 | 737 | |
@@ -751,19 +751,19 @@ discard block |
||
751 | 751 | )); |
752 | 752 | |
753 | 753 | |
754 | - if( !empty($groups) ) { |
|
754 | + if ( ! empty($groups)) { |
|
755 | 755 | |
756 | - foreach( array_keys($groups) as $group_title ) { |
|
756 | + foreach (array_keys($groups) as $group_title) { |
|
757 | 757 | |
758 | 758 | // vars |
759 | - $posts = acf_extract_var( $groups, $group_title ); |
|
759 | + $posts = acf_extract_var($groups, $group_title); |
|
760 | 760 | |
761 | 761 | |
762 | 762 | // override post data |
763 | - foreach( array_keys($posts) as $post_id ) { |
|
763 | + foreach (array_keys($posts) as $post_id) { |
|
764 | 764 | |
765 | 765 | // update |
766 | - $posts[ $post_id ] = acf_get_post_title( $posts[ $post_id ] ); |
|
766 | + $posts[$post_id] = acf_get_post_title($posts[$post_id]); |
|
767 | 767 | |
768 | 768 | }; |
769 | 769 | |
@@ -782,11 +782,11 @@ discard block |
||
782 | 782 | case "page_type" : |
783 | 783 | |
784 | 784 | $choices = array( |
785 | - 'front_page' => __("Front Page",'acf'), |
|
786 | - 'posts_page' => __("Posts Page",'acf'), |
|
787 | - 'top_level' => __("Top Level Page (no parent)",'acf'), |
|
788 | - 'parent' => __("Parent Page (has children)",'acf'), |
|
789 | - 'child' => __("Child Page (has parent)",'acf'), |
|
785 | + 'front_page' => __("Front Page", 'acf'), |
|
786 | + 'posts_page' => __("Posts Page", 'acf'), |
|
787 | + 'top_level' => __("Top Level Page (no parent)", 'acf'), |
|
788 | + 'parent' => __("Parent Page (has children)", 'acf'), |
|
789 | + 'child' => __("Child Page (has parent)", 'acf'), |
|
790 | 790 | ); |
791 | 791 | |
792 | 792 | break; |
@@ -802,14 +802,14 @@ discard block |
||
802 | 802 | case "page_template" : |
803 | 803 | |
804 | 804 | $choices = array( |
805 | - 'default' => __("Default Template",'acf'), |
|
805 | + 'default' => __("Default Template", 'acf'), |
|
806 | 806 | ); |
807 | 807 | |
808 | 808 | $templates = get_page_templates(); |
809 | 809 | |
810 | - foreach( $templates as $k => $v ) { |
|
810 | + foreach ($templates as $k => $v) { |
|
811 | 811 | |
812 | - $choices[ $v ] = $k; |
|
812 | + $choices[$v] = $k; |
|
813 | 813 | |
814 | 814 | } |
815 | 815 | |
@@ -842,7 +842,7 @@ discard block |
||
842 | 842 | |
843 | 843 | |
844 | 844 | // multi-site |
845 | - if( is_multisite() ) { |
|
845 | + if (is_multisite()) { |
|
846 | 846 | |
847 | 847 | $choices = array_merge(array( |
848 | 848 | 'super_admin' => __('Super Admin', 'acf') |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | |
857 | 857 | global $wp_roles; |
858 | 858 | |
859 | - $choices = array_merge( array('all' => __('All', 'acf')), $wp_roles->get_names() ); |
|
859 | + $choices = array_merge(array('all' => __('All', 'acf')), $wp_roles->get_names()); |
|
860 | 860 | |
861 | 861 | break; |
862 | 862 | |
@@ -885,13 +885,13 @@ discard block |
||
885 | 885 | |
886 | 886 | case "taxonomy" : |
887 | 887 | |
888 | - $choices = array_merge( array('all' => __('All', 'acf')), acf_get_taxonomies() ); |
|
888 | + $choices = array_merge(array('all' => __('All', 'acf')), acf_get_taxonomies()); |
|
889 | 889 | |
890 | 890 | |
891 | 891 | // unset post_format |
892 | - if( isset($choices['post_format']) ) { |
|
892 | + if (isset($choices['post_format'])) { |
|
893 | 893 | |
894 | - unset( $choices['post_format']); |
|
894 | + unset($choices['post_format']); |
|
895 | 895 | |
896 | 896 | } |
897 | 897 | |
@@ -914,11 +914,11 @@ discard block |
||
914 | 914 | ); |
915 | 915 | |
916 | 916 | |
917 | - if( !empty( $wp_widget_factory->widgets ) ) { |
|
917 | + if ( ! empty($wp_widget_factory->widgets)) { |
|
918 | 918 | |
919 | - foreach( $wp_widget_factory->widgets as $widget ) { |
|
919 | + foreach ($wp_widget_factory->widgets as $widget) { |
|
920 | 920 | |
921 | - $choices[ $widget->id_base ] = $widget->name; |
|
921 | + $choices[$widget->id_base] = $widget->name; |
|
922 | 922 | |
923 | 923 | } |
924 | 924 | |
@@ -929,7 +929,7 @@ discard block |
||
929 | 929 | |
930 | 930 | |
931 | 931 | // allow custom location rules |
932 | - $choices = apply_filters( 'acf/location/rule_values/' . $options['param'], $choices ); |
|
932 | + $choices = apply_filters('acf/location/rule_values/'.$options['param'], $choices); |
|
933 | 933 | |
934 | 934 | |
935 | 935 | // create field |
@@ -960,7 +960,7 @@ discard block |
||
960 | 960 | function ajax_render_location_value() { |
961 | 961 | |
962 | 962 | // validate |
963 | - if( !acf_verify_ajax() ) { |
|
963 | + if ( ! acf_verify_ajax()) { |
|
964 | 964 | |
965 | 965 | die(); |
966 | 966 | |
@@ -968,7 +968,7 @@ discard block |
||
968 | 968 | |
969 | 969 | |
970 | 970 | // call function |
971 | - $this->render_location_value( $_POST ); |
|
971 | + $this->render_location_value($_POST); |
|
972 | 972 | |
973 | 973 | |
974 | 974 | // die |
@@ -1007,7 +1007,7 @@ discard block |
||
1007 | 1007 | |
1008 | 1008 | |
1009 | 1009 | // verify nonce |
1010 | - if( !wp_verify_nonce($options['nonce'], 'acf_nonce') ) { |
|
1010 | + if ( ! wp_verify_nonce($options['nonce'], 'acf_nonce')) { |
|
1011 | 1011 | |
1012 | 1012 | die(0); |
1013 | 1013 | |
@@ -1015,7 +1015,7 @@ discard block |
||
1015 | 1015 | |
1016 | 1016 | |
1017 | 1017 | // required |
1018 | - if( !$options['type'] ) { |
|
1018 | + if ( ! $options['type']) { |
|
1019 | 1019 | |
1020 | 1020 | die(0); |
1021 | 1021 | |
@@ -1068,7 +1068,7 @@ discard block |
||
1068 | 1068 | |
1069 | 1069 | |
1070 | 1070 | // verify nonce |
1071 | - if( ! wp_verify_nonce($args['nonce'], 'acf_nonce') ) { |
|
1071 | + if ( ! wp_verify_nonce($args['nonce'], 'acf_nonce')) { |
|
1072 | 1072 | |
1073 | 1073 | die(); |
1074 | 1074 | |
@@ -1076,7 +1076,7 @@ discard block |
||
1076 | 1076 | |
1077 | 1077 | |
1078 | 1078 | // confirm? |
1079 | - if( $args['field_id'] && $args['field_group_id'] ) { |
|
1079 | + if ($args['field_id'] && $args['field_group_id']) { |
|
1080 | 1080 | |
1081 | 1081 | // vars |
1082 | 1082 | $field = acf_get_field($args['field_id']); |
@@ -1095,12 +1095,12 @@ discard block |
||
1095 | 1095 | acf_update_field($field); |
1096 | 1096 | |
1097 | 1097 | $v1 = $field['label']; |
1098 | - $v2 = '<a href="' . admin_url("post.php?post={$field_group['ID']}&action=edit") . '" target="_blank">' . $field_group['title'] . '</a>'; |
|
1098 | + $v2 = '<a href="'.admin_url("post.php?post={$field_group['ID']}&action=edit").'" target="_blank">'.$field_group['title'].'</a>'; |
|
1099 | 1099 | |
1100 | - echo '<p><strong>' . __('Move Complete.', 'acf') . '</strong></p>'; |
|
1101 | - echo '<p>' . sprintf( __('The %s field can now be found in the %s field group', 'acf'), $v1, $v2 ). '</p>'; |
|
1100 | + echo '<p><strong>'.__('Move Complete.', 'acf').'</strong></p>'; |
|
1101 | + echo '<p>'.sprintf(__('The %s field can now be found in the %s field group', 'acf'), $v1, $v2).'</p>'; |
|
1102 | 1102 | |
1103 | - echo '<a href="#" class="acf-button blue acf-close-popup">' . __("Close Window",'acf') . '</a>'; |
|
1103 | + echo '<a href="#" class="acf-button blue acf-close-popup">'.__("Close Window", 'acf').'</a>'; |
|
1104 | 1104 | |
1105 | 1105 | die(); |
1106 | 1106 | |
@@ -1112,13 +1112,13 @@ discard block |
||
1112 | 1112 | $choices = array(); |
1113 | 1113 | |
1114 | 1114 | |
1115 | - if( !empty($field_groups) ) { |
|
1115 | + if ( ! empty($field_groups)) { |
|
1116 | 1116 | |
1117 | - foreach( $field_groups as $field_group ) { |
|
1117 | + foreach ($field_groups as $field_group) { |
|
1118 | 1118 | |
1119 | - if( $field_group['ID'] ) { |
|
1119 | + if ($field_group['ID']) { |
|
1120 | 1120 | |
1121 | - $choices[ $field_group['ID'] ] = $field_group['title']; |
|
1121 | + $choices[$field_group['ID']] = $field_group['title']; |
|
1122 | 1122 | |
1123 | 1123 | } |
1124 | 1124 | |
@@ -1135,14 +1135,14 @@ discard block |
||
1135 | 1135 | )); |
1136 | 1136 | |
1137 | 1137 | |
1138 | - echo '<p>' . __('Please select the destination for this field', 'acf') . '</p>'; |
|
1138 | + echo '<p>'.__('Please select the destination for this field', 'acf').'</p>'; |
|
1139 | 1139 | |
1140 | 1140 | echo '<form id="acf-move-field-form">'; |
1141 | 1141 | |
1142 | 1142 | // render |
1143 | - acf_render_field_wrap( $field ); |
|
1143 | + acf_render_field_wrap($field); |
|
1144 | 1144 | |
1145 | - echo '<button type="submit" class="acf-button blue">' . __("Move Field",'acf') . '</button>'; |
|
1145 | + echo '<button type="submit" class="acf-button blue">'.__("Move Field", 'acf').'</button>'; |
|
1146 | 1146 | |
1147 | 1147 | echo '</form>'; |
1148 | 1148 |
@@ -568,8 +568,8 @@ discard block |
||
568 | 568 | |
569 | 569 | } |
570 | 570 | |
571 | - // status |
|
572 | - } elseif( $column == 'acf-fg-status' ) { |
|
571 | + // status |
|
572 | + } elseif( $column == 'acf-fg-status' ) { |
|
573 | 573 | |
574 | 574 | if( isset($this->sync[ $field_group['key'] ]) ) { |
575 | 575 | |
@@ -587,12 +587,12 @@ discard block |
||
587 | 587 | |
588 | 588 | } |
589 | 589 | |
590 | - // fields |
|
591 | - } elseif( $column == 'acf-fg-count' ) { |
|
590 | + // fields |
|
591 | + } elseif( $column == 'acf-fg-count' ) { |
|
592 | 592 | |
593 | 593 | echo acf_get_field_count( $field_group ); |
594 | 594 | |
595 | - } |
|
595 | + } |
|
596 | 596 | |
597 | 597 | } |
598 | 598 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @subpackage Admin |
11 | 11 | */ |
12 | 12 | |
13 | -if( ! class_exists('acf_admin_field_groups') ) : |
|
13 | +if ( ! class_exists('acf_admin_field_groups')) : |
|
14 | 14 | |
15 | 15 | class acf_admin_field_groups { |
16 | 16 | |
@@ -35,10 +35,10 @@ discard block |
||
35 | 35 | function __construct() { |
36 | 36 | |
37 | 37 | // actions |
38 | - add_action('current_screen', array($this, 'current_screen')); |
|
39 | - add_action('trashed_post', array($this, 'trashed_post')); |
|
40 | - add_action('untrashed_post', array($this, 'untrashed_post')); |
|
41 | - add_action('deleted_post', array($this, 'deleted_post')); |
|
38 | + add_action('current_screen', array($this, 'current_screen')); |
|
39 | + add_action('trashed_post', array($this, 'trashed_post')); |
|
40 | + add_action('untrashed_post', array($this, 'untrashed_post')); |
|
41 | + add_action('deleted_post', array($this, 'deleted_post')); |
|
42 | 42 | |
43 | 43 | } |
44 | 44 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | function current_screen() { |
60 | 60 | |
61 | 61 | // validate screen |
62 | - if( !acf_is_screen('edit-acf-field-group') ) { |
|
62 | + if ( ! acf_is_screen('edit-acf-field-group')) { |
|
63 | 63 | |
64 | 64 | return; |
65 | 65 | |
@@ -71,11 +71,11 @@ discard block |
||
71 | 71 | |
72 | 72 | |
73 | 73 | // modify publish post status |
74 | - $wp_post_statuses['publish']->label_count = _n_noop( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', 'acf' ); |
|
74 | + $wp_post_statuses['publish']->label_count = _n_noop('Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', 'acf'); |
|
75 | 75 | |
76 | 76 | |
77 | 77 | // reorder trash to end |
78 | - $wp_post_statuses['trash'] = acf_extract_var( $wp_post_statuses, 'trash' ); |
|
78 | + $wp_post_statuses['trash'] = acf_extract_var($wp_post_statuses, 'trash'); |
|
79 | 79 | |
80 | 80 | |
81 | 81 | // check stuff |
@@ -84,13 +84,13 @@ discard block |
||
84 | 84 | |
85 | 85 | |
86 | 86 | // actions |
87 | - add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); |
|
88 | - add_action('admin_footer', array($this, 'admin_footer')); |
|
87 | + add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); |
|
88 | + add_action('admin_footer', array($this, 'admin_footer')); |
|
89 | 89 | |
90 | 90 | |
91 | 91 | // columns |
92 | - add_filter('manage_edit-acf-field-group_columns', array($this, 'field_group_columns'), 10, 1); |
|
93 | - add_action('manage_acf-field-group_posts_custom_column', array($this, 'field_group_columns_html'), 10, 2); |
|
92 | + add_filter('manage_edit-acf-field-group_columns', array($this, 'field_group_columns'), 10, 1); |
|
93 | + add_action('manage_acf-field-group_posts_custom_column', array($this, 'field_group_columns_html'), 10, 2); |
|
94 | 94 | |
95 | 95 | } |
96 | 96 | |
@@ -131,19 +131,19 @@ discard block |
||
131 | 131 | function check_duplicate() { |
132 | 132 | |
133 | 133 | // message |
134 | - if( $ids = acf_maybe_get($_GET, 'acfduplicatecomplete') ) { |
|
134 | + if ($ids = acf_maybe_get($_GET, 'acfduplicatecomplete')) { |
|
135 | 135 | |
136 | 136 | // explode |
137 | 137 | $ids = explode(',', $ids); |
138 | 138 | $total = count($ids); |
139 | 139 | |
140 | - if( $total == 1 ) { |
|
140 | + if ($total == 1) { |
|
141 | 141 | |
142 | - acf_add_admin_notice( sprintf(__('Field group duplicated. %s', 'acf'), '<a href="' . get_edit_post_link($ids[0]) . '">' . get_the_title($ids[0]) . '</a>') ); |
|
142 | + acf_add_admin_notice(sprintf(__('Field group duplicated. %s', 'acf'), '<a href="'.get_edit_post_link($ids[0]).'">'.get_the_title($ids[0]).'</a>')); |
|
143 | 143 | |
144 | 144 | } else { |
145 | 145 | |
146 | - acf_add_admin_notice( sprintf(_n( '%s field group duplicated.', '%s field groups duplicated.', $total, 'acf' ), $total) ); |
|
146 | + acf_add_admin_notice(sprintf(_n('%s field group duplicated.', '%s field groups duplicated.', $total, 'acf'), $total)); |
|
147 | 147 | |
148 | 148 | } |
149 | 149 | |
@@ -151,21 +151,21 @@ discard block |
||
151 | 151 | |
152 | 152 | |
153 | 153 | // import field group |
154 | - if( $id = acf_maybe_get($_GET, 'acfduplicate') ) { |
|
154 | + if ($id = acf_maybe_get($_GET, 'acfduplicate')) { |
|
155 | 155 | |
156 | 156 | // validate |
157 | 157 | check_admin_referer('bulk-posts'); |
158 | 158 | |
159 | 159 | |
160 | 160 | // duplicate |
161 | - $field_group = acf_duplicate_field_group( $id ); |
|
161 | + $field_group = acf_duplicate_field_group($id); |
|
162 | 162 | |
163 | 163 | |
164 | 164 | // redirect |
165 | - wp_redirect( admin_url( $this->url . '&acfduplicatecomplete=' . $field_group['ID'] ) ); |
|
165 | + wp_redirect(admin_url($this->url.'&acfduplicatecomplete='.$field_group['ID'])); |
|
166 | 166 | exit; |
167 | 167 | |
168 | - } elseif( acf_maybe_get($_GET, 'action2') === 'acfduplicate' ) { |
|
168 | + } elseif (acf_maybe_get($_GET, 'action2') === 'acfduplicate') { |
|
169 | 169 | |
170 | 170 | // validate |
171 | 171 | check_admin_referer('bulk-posts'); |
@@ -174,15 +174,15 @@ discard block |
||
174 | 174 | // get ids |
175 | 175 | $ids = acf_maybe_get($_GET, 'post'); |
176 | 176 | |
177 | - if( !empty($ids) ) { |
|
177 | + if ( ! empty($ids)) { |
|
178 | 178 | |
179 | 179 | // vars |
180 | 180 | $new_ids = array(); |
181 | 181 | |
182 | - foreach( $ids as $id ) { |
|
182 | + foreach ($ids as $id) { |
|
183 | 183 | |
184 | 184 | // duplicate |
185 | - $field_group = acf_duplicate_field_group( $id ); |
|
185 | + $field_group = acf_duplicate_field_group($id); |
|
186 | 186 | |
187 | 187 | |
188 | 188 | // increase counter |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | |
193 | 193 | |
194 | 194 | // redirect |
195 | - wp_redirect( admin_url( $this->url . '&acfduplicatecomplete=' . implode(',', $new_ids)) ); |
|
195 | + wp_redirect(admin_url($this->url.'&acfduplicatecomplete='.implode(',', $new_ids))); |
|
196 | 196 | exit; |
197 | 197 | } |
198 | 198 | |
@@ -217,19 +217,19 @@ discard block |
||
217 | 217 | function check_sync() { |
218 | 218 | |
219 | 219 | // message |
220 | - if( $ids = acf_maybe_get($_GET, 'acfsynccomplete') ) { |
|
220 | + if ($ids = acf_maybe_get($_GET, 'acfsynccomplete')) { |
|
221 | 221 | |
222 | 222 | // explode |
223 | 223 | $ids = explode(',', $ids); |
224 | 224 | $total = count($ids); |
225 | 225 | |
226 | - if( $total == 1 ) { |
|
226 | + if ($total == 1) { |
|
227 | 227 | |
228 | - acf_add_admin_notice( sprintf(__('Field group synchronised. %s', 'acf'), '<a href="' . get_edit_post_link($ids[0]) . '">' . get_the_title($ids[0]) . '</a>') ); |
|
228 | + acf_add_admin_notice(sprintf(__('Field group synchronised. %s', 'acf'), '<a href="'.get_edit_post_link($ids[0]).'">'.get_the_title($ids[0]).'</a>')); |
|
229 | 229 | |
230 | 230 | } else { |
231 | 231 | |
232 | - acf_add_admin_notice( sprintf(_n( '%s field group synchronised.', '%s field groups synchronised.', $total, 'acf' ), $total) ); |
|
232 | + acf_add_admin_notice(sprintf(_n('%s field group synchronised.', '%s field groups synchronised.', $total, 'acf'), $total)); |
|
233 | 233 | |
234 | 234 | } |
235 | 235 | |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | |
242 | 242 | |
243 | 243 | // bail early if no field groups |
244 | - if( empty($groups) ) { |
|
244 | + if (empty($groups)) { |
|
245 | 245 | |
246 | 246 | return; |
247 | 247 | |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | |
250 | 250 | |
251 | 251 | // find JSON field groups which have not yet been imported |
252 | - foreach( $groups as $group ) { |
|
252 | + foreach ($groups as $group) { |
|
253 | 253 | |
254 | 254 | // vars |
255 | 255 | $local = acf_maybe_get($group, 'local', false); |
@@ -258,17 +258,17 @@ discard block |
||
258 | 258 | |
259 | 259 | |
260 | 260 | // ignore DB / PHP / private field groups |
261 | - if( $local !== 'json' || $private ) { |
|
261 | + if ($local !== 'json' || $private) { |
|
262 | 262 | |
263 | 263 | // do nothing |
264 | 264 | |
265 | - } elseif( !$group['ID'] ) { |
|
265 | + } elseif ( ! $group['ID']) { |
|
266 | 266 | |
267 | - $this->sync[ $group['key'] ] = $group; |
|
267 | + $this->sync[$group['key']] = $group; |
|
268 | 268 | |
269 | - } elseif( $modified && $modified > get_post_modified_time('U', true, $group['ID'], true) ) { |
|
269 | + } elseif ($modified && $modified > get_post_modified_time('U', true, $group['ID'], true)) { |
|
270 | 270 | |
271 | - $this->sync[ $group['key'] ] = $group; |
|
271 | + $this->sync[$group['key']] = $group; |
|
272 | 272 | |
273 | 273 | } |
274 | 274 | |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | |
277 | 277 | |
278 | 278 | // bail if no sync needed |
279 | - if( empty($this->sync) ) { |
|
279 | + if (empty($this->sync)) { |
|
280 | 280 | |
281 | 281 | return; |
282 | 282 | |
@@ -284,7 +284,7 @@ discard block |
||
284 | 284 | |
285 | 285 | |
286 | 286 | // import field group |
287 | - if( $key = acf_maybe_get($_GET, 'acfsync') ) { |
|
287 | + if ($key = acf_maybe_get($_GET, 'acfsync')) { |
|
288 | 288 | |
289 | 289 | // disable JSON |
290 | 290 | // - this prevents a new JSON file being created and causing a 'change' to theme files - solves git anoyance |
@@ -296,22 +296,22 @@ discard block |
||
296 | 296 | |
297 | 297 | |
298 | 298 | // append fields |
299 | - if( acf_have_local_fields( $key ) ) { |
|
299 | + if (acf_have_local_fields($key)) { |
|
300 | 300 | |
301 | - $this->sync[ $key ]['fields'] = acf_get_local_fields( $key ); |
|
301 | + $this->sync[$key]['fields'] = acf_get_local_fields($key); |
|
302 | 302 | |
303 | 303 | } |
304 | 304 | |
305 | 305 | |
306 | 306 | // import |
307 | - $field_group = acf_import_field_group( $this->sync[ $key ] ); |
|
307 | + $field_group = acf_import_field_group($this->sync[$key]); |
|
308 | 308 | |
309 | 309 | |
310 | 310 | // redirect |
311 | - wp_redirect( admin_url( $this->url . '&acfsynccomplete=' . $field_group['ID'] ) ); |
|
311 | + wp_redirect(admin_url($this->url.'&acfsynccomplete='.$field_group['ID'])); |
|
312 | 312 | exit; |
313 | 313 | |
314 | - } elseif( acf_maybe_get($_GET, 'action2') === 'acfsync' ) { |
|
314 | + } elseif (acf_maybe_get($_GET, 'action2') === 'acfsync') { |
|
315 | 315 | |
316 | 316 | // validate |
317 | 317 | check_admin_referer('bulk-posts'); |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | // get ids |
321 | 321 | $keys = acf_maybe_get($_GET, 'post'); |
322 | 322 | |
323 | - if( !empty($keys) ) { |
|
323 | + if ( ! empty($keys)) { |
|
324 | 324 | |
325 | 325 | // disable JSON |
326 | 326 | // - this prevents a new JSON file being created and causing a 'change' to theme files - solves git anoyance |
@@ -329,18 +329,18 @@ discard block |
||
329 | 329 | // vars |
330 | 330 | $new_ids = array(); |
331 | 331 | |
332 | - foreach( $keys as $key ) { |
|
332 | + foreach ($keys as $key) { |
|
333 | 333 | |
334 | 334 | // append fields |
335 | - if( acf_have_local_fields( $key ) ) { |
|
335 | + if (acf_have_local_fields($key)) { |
|
336 | 336 | |
337 | - $this->sync[ $key ]['fields'] = acf_get_local_fields( $key ); |
|
337 | + $this->sync[$key]['fields'] = acf_get_local_fields($key); |
|
338 | 338 | |
339 | 339 | } |
340 | 340 | |
341 | 341 | |
342 | 342 | // import |
343 | - $field_group = acf_import_field_group( $this->sync[ $key ] ); |
|
343 | + $field_group = acf_import_field_group($this->sync[$key]); |
|
344 | 344 | |
345 | 345 | |
346 | 346 | // append |
@@ -350,7 +350,7 @@ discard block |
||
350 | 350 | |
351 | 351 | |
352 | 352 | // redirect |
353 | - wp_redirect( admin_url( $this->url . '&acfsynccomplete=' . implode(',', $new_ids)) ); |
|
353 | + wp_redirect(admin_url($this->url.'&acfsynccomplete='.implode(',', $new_ids))); |
|
354 | 354 | exit; |
355 | 355 | |
356 | 356 | } |
@@ -377,14 +377,14 @@ discard block |
||
377 | 377 | * @return $views |
378 | 378 | */ |
379 | 379 | |
380 | - function list_table_views( $views ) { |
|
380 | + function list_table_views($views) { |
|
381 | 381 | |
382 | 382 | // vars |
383 | 383 | $class = ''; |
384 | 384 | $total = count($this->sync); |
385 | 385 | |
386 | 386 | // active |
387 | - if( acf_maybe_get($_GET, 'post_status') === 'sync' ) { |
|
387 | + if (acf_maybe_get($_GET, 'post_status') === 'sync') { |
|
388 | 388 | |
389 | 389 | // actions |
390 | 390 | add_action('admin_footer', array($this, 'sync_admin_footer'), 5); |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | |
400 | 400 | |
401 | 401 | // update pagination |
402 | - $wp_list_table->set_pagination_args( array( |
|
402 | + $wp_list_table->set_pagination_args(array( |
|
403 | 403 | 'total_items' => $total, |
404 | 404 | 'total_pages' => 1, |
405 | 405 | 'per_page' => $total |
@@ -409,7 +409,7 @@ discard block |
||
409 | 409 | |
410 | 410 | |
411 | 411 | // add view |
412 | - $views['json'] = '<a' . $class . ' href="' . admin_url($this->url . '&post_status=sync') . '">' . __('Sync available', 'acf') . ' <span class="count">(' . $total . ')</span></a>'; |
|
412 | + $views['json'] = '<a'.$class.' href="'.admin_url($this->url.'&post_status=sync').'">'.__('Sync available', 'acf').' <span class="count">('.$total.')</span></a>'; |
|
413 | 413 | |
414 | 414 | |
415 | 415 | // return |
@@ -431,10 +431,10 @@ discard block |
||
431 | 431 | * @return n/a |
432 | 432 | */ |
433 | 433 | |
434 | - function trashed_post( $post_id ) { |
|
434 | + function trashed_post($post_id) { |
|
435 | 435 | |
436 | 436 | // validate post type |
437 | - if( get_post_type($post_id) != 'acf-field-group' ) { |
|
437 | + if (get_post_type($post_id) != 'acf-field-group') { |
|
438 | 438 | |
439 | 439 | return; |
440 | 440 | |
@@ -442,7 +442,7 @@ discard block |
||
442 | 442 | |
443 | 443 | |
444 | 444 | // trash field group |
445 | - acf_trash_field_group( $post_id ); |
|
445 | + acf_trash_field_group($post_id); |
|
446 | 446 | |
447 | 447 | } |
448 | 448 | |
@@ -460,10 +460,10 @@ discard block |
||
460 | 460 | * @return n/a |
461 | 461 | */ |
462 | 462 | |
463 | - function untrashed_post( $post_id ) { |
|
463 | + function untrashed_post($post_id) { |
|
464 | 464 | |
465 | 465 | // validate post type |
466 | - if( get_post_type($post_id) != 'acf-field-group' ) { |
|
466 | + if (get_post_type($post_id) != 'acf-field-group') { |
|
467 | 467 | |
468 | 468 | return; |
469 | 469 | |
@@ -471,7 +471,7 @@ discard block |
||
471 | 471 | |
472 | 472 | |
473 | 473 | // trash field group |
474 | - acf_untrash_field_group( $post_id ); |
|
474 | + acf_untrash_field_group($post_id); |
|
475 | 475 | |
476 | 476 | } |
477 | 477 | |
@@ -489,10 +489,10 @@ discard block |
||
489 | 489 | * @return n/a |
490 | 490 | */ |
491 | 491 | |
492 | - function deleted_post( $post_id ) { |
|
492 | + function deleted_post($post_id) { |
|
493 | 493 | |
494 | 494 | // validate post type |
495 | - if( get_post_type($post_id) != 'acf-field-group' ) { |
|
495 | + if (get_post_type($post_id) != 'acf-field-group') { |
|
496 | 496 | |
497 | 497 | return; |
498 | 498 | |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | |
501 | 501 | |
502 | 502 | // trash field group |
503 | - acf_delete_field_group( $post_id ); |
|
503 | + acf_delete_field_group($post_id); |
|
504 | 504 | |
505 | 505 | } |
506 | 506 | |
@@ -518,13 +518,13 @@ discard block |
||
518 | 518 | * @return $columns (array) |
519 | 519 | */ |
520 | 520 | |
521 | - function field_group_columns( $columns ) { |
|
521 | + function field_group_columns($columns) { |
|
522 | 522 | |
523 | 523 | return array( |
524 | 524 | 'cb' => '<input type="checkbox" />', |
525 | 525 | 'title' => __('Title', 'acf'), |
526 | 526 | 'acf-fg-description' => __('Description', 'acf'), |
527 | - 'acf-fg-status' => '<i class="acf-icon -dot-3 small acf-js-tooltip" title="' . __('Status', 'acf') . '"></i>', |
|
527 | + 'acf-fg-status' => '<i class="acf-icon -dot-3 small acf-js-tooltip" title="'.__('Status', 'acf').'"></i>', |
|
528 | 528 | 'acf-fg-count' => __('Fields', 'acf'), |
529 | 529 | |
530 | 530 | ); |
@@ -546,51 +546,51 @@ discard block |
||
546 | 546 | * @return n/a |
547 | 547 | */ |
548 | 548 | |
549 | - function field_group_columns_html( $column, $post_id ) { |
|
549 | + function field_group_columns_html($column, $post_id) { |
|
550 | 550 | |
551 | 551 | // vars |
552 | - $field_group = acf_get_field_group( $post_id ); |
|
552 | + $field_group = acf_get_field_group($post_id); |
|
553 | 553 | |
554 | 554 | |
555 | 555 | // render |
556 | - $this->render_column( $column, $field_group ); |
|
556 | + $this->render_column($column, $field_group); |
|
557 | 557 | |
558 | 558 | } |
559 | 559 | |
560 | - function render_column( $column, $field_group ) { |
|
560 | + function render_column($column, $field_group) { |
|
561 | 561 | |
562 | 562 | // description |
563 | - if( $column == 'acf-fg-description' ) { |
|
563 | + if ($column == 'acf-fg-description') { |
|
564 | 564 | |
565 | - if( $field_group['description'] ) { |
|
565 | + if ($field_group['description']) { |
|
566 | 566 | |
567 | - echo '<span class="acf-description">' . $field_group['description'] . '</span>'; |
|
567 | + echo '<span class="acf-description">'.$field_group['description'].'</span>'; |
|
568 | 568 | |
569 | 569 | } |
570 | 570 | |
571 | 571 | // status |
572 | - } elseif( $column == 'acf-fg-status' ) { |
|
572 | + } elseif ($column == 'acf-fg-status') { |
|
573 | 573 | |
574 | - if( isset($this->sync[ $field_group['key'] ]) ) { |
|
574 | + if (isset($this->sync[$field_group['key']])) { |
|
575 | 575 | |
576 | - echo '<i class="acf-icon -sync grey small acf-js-tooltip" title="' . __('Sync available', 'acf') .'"></i> '; |
|
576 | + echo '<i class="acf-icon -sync grey small acf-js-tooltip" title="'.__('Sync available', 'acf').'"></i> '; |
|
577 | 577 | |
578 | 578 | } |
579 | 579 | |
580 | - if( $field_group['active'] ) { |
|
580 | + if ($field_group['active']) { |
|
581 | 581 | |
582 | 582 | //echo '<i class="acf-icon -check small acf-js-tooltip" title="' . __('Active', 'acf') .'"></i> '; |
583 | 583 | |
584 | 584 | } else { |
585 | 585 | |
586 | - echo '<i class="acf-icon -minus yellow small acf-js-tooltip" title="' . __('Disabled', 'acf') . '"></i> '; |
|
586 | + echo '<i class="acf-icon -minus yellow small acf-js-tooltip" title="'.__('Disabled', 'acf').'"></i> '; |
|
587 | 587 | |
588 | 588 | } |
589 | 589 | |
590 | 590 | // fields |
591 | - } elseif( $column == 'acf-fg-count' ) { |
|
591 | + } elseif ($column == 'acf-fg-count') { |
|
592 | 592 | |
593 | - echo acf_get_field_count( $field_group ); |
|
593 | + echo acf_get_field_count($field_group); |
|
594 | 594 | |
595 | 595 | } |
596 | 596 | |
@@ -621,24 +621,24 @@ discard block |
||
621 | 621 | <div class="inner"> |
622 | 622 | <h2><?php echo acf_get_setting('name'); ?> <?php echo acf_get_setting('version'); ?></h2> |
623 | 623 | |
624 | - <h3><?php _e("Changelog",'acf'); ?></h3> |
|
625 | - <p><?php _e("See what's new in",'acf'); ?> <a href="<?php echo admin_url('edit.php?post_type=acf-field-group&page=acf-settings-info&tab=changelog'); ?>"><?php _e("version",'acf'); ?> <?php echo acf_get_setting('version'); ?></a> |
|
624 | + <h3><?php _e("Changelog", 'acf'); ?></h3> |
|
625 | + <p><?php _e("See what's new in", 'acf'); ?> <a href="<?php echo admin_url('edit.php?post_type=acf-field-group&page=acf-settings-info&tab=changelog'); ?>"><?php _e("version", 'acf'); ?> <?php echo acf_get_setting('version'); ?></a> |
|
626 | 626 | |
627 | - <h3><?php _e("Resources",'acf'); ?></h3> |
|
627 | + <h3><?php _e("Resources", 'acf'); ?></h3> |
|
628 | 628 | <ul> |
629 | - <li><a href="<?php echo $www; ?>#getting-started" target="_blank"><?php _e("Getting Started",'acf'); ?></a></li> |
|
630 | - <li><a href="<?php echo $www; ?>#updates" target="_blank"><?php _e("Updates",'acf'); ?></a></li> |
|
631 | - <li><a href="<?php echo $www; ?>#field-types" target="_blank"><?php _e("Field Types",'acf'); ?></a></li> |
|
632 | - <li><a href="<?php echo $www; ?>#functions" target="_blank"><?php _e("Functions",'acf'); ?></a></li> |
|
633 | - <li><a href="<?php echo $www; ?>#actions" target="_blank"><?php _e("Actions",'acf'); ?></a></li> |
|
634 | - <li><a href="<?php echo $www; ?>#filters" target="_blank"><?php _e("Filters",'acf'); ?></a></li> |
|
635 | - <li><a href="<?php echo $www; ?>#how-to" target="_blank"><?php _e("'How to' guides",'acf'); ?></a></li> |
|
636 | - <li><a href="<?php echo $www; ?>#tutorials" target="_blank"><?php _e("Tutorials",'acf'); ?></a></li> |
|
629 | + <li><a href="<?php echo $www; ?>#getting-started" target="_blank"><?php _e("Getting Started", 'acf'); ?></a></li> |
|
630 | + <li><a href="<?php echo $www; ?>#updates" target="_blank"><?php _e("Updates", 'acf'); ?></a></li> |
|
631 | + <li><a href="<?php echo $www; ?>#field-types" target="_blank"><?php _e("Field Types", 'acf'); ?></a></li> |
|
632 | + <li><a href="<?php echo $www; ?>#functions" target="_blank"><?php _e("Functions", 'acf'); ?></a></li> |
|
633 | + <li><a href="<?php echo $www; ?>#actions" target="_blank"><?php _e("Actions", 'acf'); ?></a></li> |
|
634 | + <li><a href="<?php echo $www; ?>#filters" target="_blank"><?php _e("Filters", 'acf'); ?></a></li> |
|
635 | + <li><a href="<?php echo $www; ?>#how-to" target="_blank"><?php _e("'How to' guides", 'acf'); ?></a></li> |
|
636 | + <li><a href="<?php echo $www; ?>#tutorials" target="_blank"><?php _e("Tutorials", 'acf'); ?></a></li> |
|
637 | 637 | </ul> |
638 | 638 | </div> |
639 | 639 | <div class="footer footer-blue"> |
640 | 640 | <ul class="acf-hl"> |
641 | - <li><?php _e("Created by",'acf'); ?> Elliot Condon</li> |
|
641 | + <li><?php _e("Created by", 'acf'); ?> Elliot Condon</li> |
|
642 | 642 | </ul> |
643 | 643 | </div> |
644 | 644 | </div> |
@@ -681,7 +681,7 @@ discard block |
||
681 | 681 | |
682 | 682 | |
683 | 683 | // create el |
684 | - var $span = $('<span class="acf-duplicate-field-group"><a title="<?php _e('Duplicate this item', 'acf'); ?>" href="<?php echo admin_url($this->url . '&acfduplicate='); ?>' + post_id + '&_wpnonce=<?php echo wp_create_nonce('bulk-posts'); ?>"><?php _e('Duplicate', 'acf'); ?></a> | </span>'); |
|
684 | + var $span = $('<span class="acf-duplicate-field-group"><a title="<?php _e('Duplicate this item', 'acf'); ?>" href="<?php echo admin_url($this->url.'&acfduplicate='); ?>' + post_id + '&_wpnonce=<?php echo wp_create_nonce('bulk-posts'); ?>"><?php _e('Duplicate', 'acf'); ?></a> | </span>'); |
|
685 | 685 | |
686 | 686 | |
687 | 687 | // replace |
@@ -697,7 +697,7 @@ discard block |
||
697 | 697 | |
698 | 698 | |
699 | 699 | // modify bulk actions |
700 | - $('#bulk-action-selector-bottom option[value="edit"]').attr('value','acfduplicate').text('<?php _e( 'Duplicate', 'acf' ); ?>'); |
|
700 | + $('#bulk-action-selector-bottom option[value="edit"]').attr('value','acfduplicate').text('<?php _e('Duplicate', 'acf'); ?>'); |
|
701 | 701 | |
702 | 702 | |
703 | 703 | // clean up table |
@@ -740,10 +740,10 @@ discard block |
||
740 | 740 | |
741 | 741 | ?> |
742 | 742 | <script type="text/html" id="tmpl-acf-json-tbody"> |
743 | -<?php foreach( $this->sync as $field_group ): $i++; ?> |
|
744 | - <tr <?php if($i%2 == 0): ?>class="alternate"<?php endif; ?>> |
|
743 | +<?php foreach ($this->sync as $field_group): $i++; ?> |
|
744 | + <tr <?php if ($i % 2 == 0): ?>class="alternate"<?php endif; ?>> |
|
745 | 745 | <th class="check-column" scope="row"> |
746 | - <label for="cb-select-<?php echo $field_group['key']; ?>" class="screen-reader-text"><?php printf( __( 'Select %s', 'acf' ), $field_group['title'] ); ?></label> |
|
746 | + <label for="cb-select-<?php echo $field_group['key']; ?>" class="screen-reader-text"><?php printf(__('Select %s', 'acf'), $field_group['title']); ?></label> |
|
747 | 747 | <input type="checkbox" value="<?php echo $field_group['key']; ?>" name="post[]" id="cb-select-<?php echo $field_group['key']; ?>"> |
748 | 748 | </th> |
749 | 749 | <td class="post-title page-title column-title"> |
@@ -751,11 +751,11 @@ discard block |
||
751 | 751 | <span class="row-title"><?php echo $field_group['title']; ?></span><span class="acf-description"><?php echo $field_group['key']; ?>.json</span> |
752 | 752 | </strong> |
753 | 753 | <div class="row-actions"> |
754 | - <span class="import"><a title="<?php echo esc_attr( __('Synchronise field group', 'acf') ); ?>" href="<?php echo admin_url($this->url . '&post_status=sync&acfsync=' . $field_group['key'] . '&_wpnonce=' . wp_create_nonce('bulk-posts')); ?>"><?php _e( 'Sync', 'acf' ); ?></a></span> |
|
754 | + <span class="import"><a title="<?php echo esc_attr(__('Synchronise field group', 'acf')); ?>" href="<?php echo admin_url($this->url.'&post_status=sync&acfsync='.$field_group['key'].'&_wpnonce='.wp_create_nonce('bulk-posts')); ?>"><?php _e('Sync', 'acf'); ?></a></span> |
|
755 | 755 | </div> |
756 | 756 | </td> |
757 | - <?php foreach( $columns as $column ): ?> |
|
758 | - <td class="column-<?php echo $column; ?>"><?php $this->render_column( $column, $field_group ); ?></td> |
|
757 | + <?php foreach ($columns as $column): ?> |
|
758 | + <td class="column-<?php echo $column; ?>"><?php $this->render_column($column, $field_group); ?></td> |
|
759 | 759 | <?php endforeach; ?> |
760 | 760 | </tr> |
761 | 761 | <?php endforeach; ?> |
@@ -79,17 +79,17 @@ |
||
79 | 79 | |
80 | 80 | |
81 | 81 | // load json |
82 | - $request = wp_remote_post( 'http://assets.advancedcustomfields.com/add-ons/add-ons.json' ); |
|
83 | - |
|
84 | - // validate |
|
85 | - if( is_wp_error($request) || wp_remote_retrieve_response_code($request) != 200) |
|
86 | - { |
|
87 | - acf_add_admin_notice(__('<b>Error</b>. Could not load add-ons list', 'acf'), 'error'); |
|
88 | - } |
|
89 | - else |
|
90 | - { |
|
91 | - $this->view['json'] = json_decode( $request['body'], true ); |
|
92 | - } |
|
82 | + $request = wp_remote_post( 'http://assets.advancedcustomfields.com/add-ons/add-ons.json' ); |
|
83 | + |
|
84 | + // validate |
|
85 | + if( is_wp_error($request) || wp_remote_retrieve_response_code($request) != 200) |
|
86 | + { |
|
87 | + acf_add_admin_notice(__('<b>Error</b>. Could not load add-ons list', 'acf'), 'error'); |
|
88 | + } |
|
89 | + else |
|
90 | + { |
|
91 | + $this->view['json'] = json_decode( $request['body'], true ); |
|
92 | + } |
|
93 | 93 | |
94 | 94 | } |
95 | 95 |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | function __construct() { |
22 | 22 | |
23 | 23 | // actions |
24 | - add_action( 'admin_menu', array( $this, 'admin_menu' ) ); |
|
24 | + add_action('admin_menu', array($this, 'admin_menu')); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
@@ -41,18 +41,18 @@ discard block |
||
41 | 41 | function admin_menu() { |
42 | 42 | |
43 | 43 | // bail early if no show_admin |
44 | - if( !acf_get_setting('show_admin') ) |
|
44 | + if ( ! acf_get_setting('show_admin')) |
|
45 | 45 | { |
46 | 46 | return; |
47 | 47 | } |
48 | 48 | |
49 | 49 | |
50 | 50 | // add page |
51 | - $page = add_submenu_page('edit.php?post_type=acf-field-group', __('Add-ons','acf'), __('Add-ons','acf'), acf_get_setting('capability'),'acf-settings-addons', array($this,'html') ); |
|
51 | + $page = add_submenu_page('edit.php?post_type=acf-field-group', __('Add-ons', 'acf'), __('Add-ons', 'acf'), acf_get_setting('capability'), 'acf-settings-addons', array($this, 'html')); |
|
52 | 52 | |
53 | 53 | |
54 | 54 | // actions |
55 | - add_action('load-' . $page, array($this,'load')); |
|
55 | + add_action('load-'.$page, array($this, 'load')); |
|
56 | 56 | |
57 | 57 | } |
58 | 58 | |
@@ -79,16 +79,16 @@ discard block |
||
79 | 79 | |
80 | 80 | |
81 | 81 | // load json |
82 | - $request = wp_remote_post( 'http://assets.advancedcustomfields.com/add-ons/add-ons.json' ); |
|
82 | + $request = wp_remote_post('http://assets.advancedcustomfields.com/add-ons/add-ons.json'); |
|
83 | 83 | |
84 | 84 | // validate |
85 | - if( is_wp_error($request) || wp_remote_retrieve_response_code($request) != 200) |
|
85 | + if (is_wp_error($request) || wp_remote_retrieve_response_code($request) != 200) |
|
86 | 86 | { |
87 | 87 | acf_add_admin_notice(__('<b>Error</b>. Could not load add-ons list', 'acf'), 'error'); |
88 | 88 | } |
89 | 89 | else |
90 | 90 | { |
91 | - $this->view['json'] = json_decode( $request['body'], true ); |
|
91 | + $this->view['json'] = json_decode($request['body'], true); |
|
92 | 92 | } |
93 | 93 | |
94 | 94 | } |
@@ -85,8 +85,7 @@ |
||
85 | 85 | if( is_wp_error($request) || wp_remote_retrieve_response_code($request) != 200) |
86 | 86 | { |
87 | 87 | acf_add_admin_notice(__('<b>Error</b>. Could not load add-ons list', 'acf'), 'error'); |
88 | - } |
|
89 | - else |
|
88 | + } else |
|
90 | 89 | { |
91 | 90 | $this->view['json'] = json_decode( $request['body'], true ); |
92 | 91 | } |