This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | /* |
||
4 | * ACF Admin Field Groups Class |
||
5 | * |
||
6 | * All the logic for editing a list of field groups |
||
7 | * |
||
8 | * @class acf_admin_field_groups |
||
9 | * @package ACF |
||
10 | * @subpackage Admin |
||
11 | */ |
||
12 | |||
13 | if( ! class_exists('acf_admin_field_groups') ) : |
||
14 | |||
15 | class acf_admin_field_groups { |
||
16 | |||
17 | // vars |
||
18 | var $url = 'edit.php?post_type=acf-field-group', |
||
19 | $sync = array(); |
||
20 | |||
21 | |||
22 | /* |
||
23 | * __construct |
||
24 | * |
||
25 | * This function will setup the class functionality |
||
26 | * |
||
27 | * @type function |
||
28 | * @date 5/03/2014 |
||
29 | * @since 5.0.0 |
||
30 | * |
||
31 | * @param n/a |
||
32 | * @return n/a |
||
33 | */ |
||
0 ignored issues
–
show
|
|||
34 | |||
35 | function __construct() { |
||
0 ignored issues
–
show
|
|||
36 | |||
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')); |
||
42 | |||
43 | } |
||
44 | |||
45 | |||
46 | /* |
||
47 | * current_screen |
||
48 | * |
||
49 | * This function is fired when loading the admin page before HTML has been rendered. |
||
50 | * |
||
51 | * @type action (current_screen) |
||
52 | * @date 21/07/2014 |
||
53 | * @since 5.0.0 |
||
54 | * |
||
55 | * @param n/a |
||
56 | * @return n/a |
||
57 | */ |
||
0 ignored issues
–
show
The doc-type
n/a could not be parsed: Unknown type name "n/a" at position 0. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
58 | |||
59 | function current_screen() { |
||
0 ignored issues
–
show
|
|||
60 | |||
61 | // validate screen |
||
62 | if( !acf_is_screen('edit-acf-field-group') ) { |
||
63 | |||
64 | return; |
||
65 | |||
66 | } |
||
67 | |||
68 | |||
69 | // customize post_status |
||
70 | global $wp_post_statuses; |
||
71 | |||
72 | |||
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' ); |
||
75 | |||
76 | |||
77 | // reorder trash to end |
||
78 | $wp_post_statuses['trash'] = acf_extract_var( $wp_post_statuses, 'trash' ); |
||
79 | |||
80 | |||
81 | // check stuff |
||
82 | $this->check_duplicate(); |
||
83 | $this->check_sync(); |
||
84 | |||
85 | |||
86 | // actions |
||
87 | add_action('admin_enqueue_scripts', array($this, 'admin_enqueue_scripts')); |
||
88 | add_action('admin_footer', array($this, 'admin_footer')); |
||
89 | |||
90 | |||
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); |
||
94 | |||
95 | } |
||
96 | |||
97 | |||
98 | /* |
||
99 | * admin_enqueue_scripts |
||
100 | * |
||
101 | * This function will add the already registered css |
||
102 | * |
||
103 | * @type function |
||
104 | * @date 28/09/13 |
||
105 | * @since 5.0.0 |
||
106 | * |
||
107 | * @param n/a |
||
108 | * @return n/a |
||
109 | */ |
||
0 ignored issues
–
show
The doc-type
n/a could not be parsed: Unknown type name "n/a" at position 0. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
110 | |||
111 | function admin_enqueue_scripts() { |
||
0 ignored issues
–
show
|
|||
112 | |||
113 | wp_enqueue_script('acf-input'); |
||
114 | |||
115 | } |
||
116 | |||
117 | |||
118 | /* |
||
119 | * check_duplicate |
||
120 | * |
||
121 | * This function will check for any $_GET data to duplicate |
||
122 | * |
||
123 | * @type function |
||
124 | * @date 17/10/13 |
||
125 | * @since 5.0.0 |
||
126 | * |
||
127 | * @param n/a |
||
128 | * @return n/a |
||
129 | */ |
||
0 ignored issues
–
show
The doc-type
n/a could not be parsed: Unknown type name "n/a" at position 0. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
130 | |||
131 | function check_duplicate() { |
||
0 ignored issues
–
show
|
|||
132 | |||
133 | // message |
||
134 | View Code Duplication | if( $ids = acf_maybe_get($_GET, 'acfduplicatecomplete') ) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
135 | |||
136 | // explode |
||
137 | $ids = explode(',', $ids); |
||
138 | $total = count($ids); |
||
139 | |||
140 | if( $total == 1 ) { |
||
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>') ); |
||
143 | |||
144 | } else { |
||
145 | |||
146 | acf_add_admin_notice( sprintf(_n( '%s field group duplicated.', '%s field groups duplicated.', $total, 'acf' ), $total) ); |
||
147 | |||
148 | } |
||
149 | |||
150 | } |
||
151 | |||
152 | |||
153 | // import field group |
||
154 | if( $id = acf_maybe_get($_GET, 'acfduplicate') ) { |
||
155 | |||
156 | // validate |
||
157 | check_admin_referer('bulk-posts'); |
||
158 | |||
159 | |||
160 | // duplicate |
||
161 | $field_group = acf_duplicate_field_group( $id ); |
||
162 | |||
163 | |||
164 | // redirect |
||
165 | wp_redirect( admin_url( $this->url . '&acfduplicatecomplete=' . $field_group['ID'] ) ); |
||
166 | exit; |
||
167 | |||
168 | } elseif( acf_maybe_get($_GET, 'action2') === 'acfduplicate' ) { |
||
169 | |||
170 | // validate |
||
171 | check_admin_referer('bulk-posts'); |
||
172 | |||
173 | |||
174 | // get ids |
||
175 | $ids = acf_maybe_get($_GET, 'post'); |
||
176 | |||
177 | if( !empty($ids) ) { |
||
178 | |||
179 | // vars |
||
180 | $new_ids = array(); |
||
181 | |||
182 | foreach( $ids as $id ) { |
||
183 | |||
184 | // duplicate |
||
185 | $field_group = acf_duplicate_field_group( $id ); |
||
186 | |||
187 | |||
188 | // increase counter |
||
189 | $new_ids[] = $field_group['ID']; |
||
190 | |||
191 | } |
||
192 | |||
193 | |||
194 | // redirect |
||
195 | wp_redirect( admin_url( $this->url . '&acfduplicatecomplete=' . implode(',', $new_ids)) ); |
||
196 | exit; |
||
197 | } |
||
198 | |||
199 | } |
||
200 | |||
201 | } |
||
202 | |||
203 | |||
204 | /* |
||
205 | * check_sync |
||
206 | * |
||
207 | * This function will check for any $_GET data to sync |
||
208 | * |
||
209 | * @type function |
||
210 | * @date 9/12/2014 |
||
211 | * @since 5.1.5 |
||
212 | * |
||
213 | * @param n/a |
||
214 | * @return n/a |
||
215 | */ |
||
0 ignored issues
–
show
The doc-type
n/a could not be parsed: Unknown type name "n/a" at position 0. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
216 | |||
217 | function check_sync() { |
||
0 ignored issues
–
show
|
|||
218 | |||
219 | // message |
||
220 | View Code Duplication | if( $ids = acf_maybe_get($_GET, 'acfsynccomplete') ) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
221 | |||
222 | // explode |
||
223 | $ids = explode(',', $ids); |
||
224 | $total = count($ids); |
||
225 | |||
226 | if( $total == 1 ) { |
||
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>') ); |
||
229 | |||
230 | } else { |
||
231 | |||
232 | acf_add_admin_notice( sprintf(_n( '%s field group synchronised.', '%s field groups synchronised.', $total, 'acf' ), $total) ); |
||
233 | |||
234 | } |
||
235 | |||
236 | } |
||
237 | |||
238 | |||
239 | // vars |
||
240 | $groups = acf_get_field_groups(); |
||
241 | |||
242 | |||
243 | // bail early if no field groups |
||
244 | if( empty($groups) ) { |
||
245 | |||
246 | return; |
||
247 | |||
248 | } |
||
249 | |||
250 | |||
251 | // find JSON field groups which have not yet been imported |
||
252 | foreach( $groups as $group ) { |
||
253 | |||
254 | // vars |
||
255 | $local = acf_maybe_get($group, 'local', false); |
||
256 | $modified = acf_maybe_get($group, 'modified', 0); |
||
257 | $private = acf_maybe_get($group, 'private', false); |
||
258 | |||
259 | |||
260 | // ignore DB / PHP / private field groups |
||
261 | if( $local !== 'json' || $private ) { |
||
262 | |||
263 | // do nothing |
||
264 | |||
265 | } elseif( !$group['ID'] ) { |
||
266 | |||
267 | $this->sync[ $group['key'] ] = $group; |
||
268 | |||
269 | } elseif( $modified && $modified > get_post_modified_time('U', true, $group['ID'], true) ) { |
||
270 | |||
271 | $this->sync[ $group['key'] ] = $group; |
||
272 | |||
273 | } |
||
274 | |||
275 | } |
||
276 | |||
277 | |||
278 | // bail if no sync needed |
||
279 | if( empty($this->sync) ) { |
||
280 | |||
281 | return; |
||
282 | |||
283 | } |
||
284 | |||
285 | |||
286 | // import field group |
||
287 | if( $key = acf_maybe_get($_GET, 'acfsync') ) { |
||
288 | |||
289 | // disable JSON |
||
290 | // - this prevents a new JSON file being created and causing a 'change' to theme files - solves git anoyance |
||
291 | acf_update_setting('json', false); |
||
292 | |||
293 | |||
294 | // validate |
||
295 | check_admin_referer('bulk-posts'); |
||
296 | |||
297 | |||
298 | // append fields |
||
299 | if( acf_have_local_fields( $key ) ) { |
||
300 | |||
301 | $this->sync[ $key ]['fields'] = acf_get_local_fields( $key ); |
||
302 | |||
303 | } |
||
304 | |||
305 | |||
306 | // import |
||
307 | $field_group = acf_import_field_group( $this->sync[ $key ] ); |
||
308 | |||
309 | |||
310 | // redirect |
||
311 | wp_redirect( admin_url( $this->url . '&acfsynccomplete=' . $field_group['ID'] ) ); |
||
312 | exit; |
||
313 | |||
314 | } elseif( acf_maybe_get($_GET, 'action2') === 'acfsync' ) { |
||
315 | |||
316 | // validate |
||
317 | check_admin_referer('bulk-posts'); |
||
318 | |||
319 | |||
320 | // get ids |
||
321 | $keys = acf_maybe_get($_GET, 'post'); |
||
322 | |||
323 | if( !empty($keys) ) { |
||
324 | |||
325 | // disable JSON |
||
326 | // - this prevents a new JSON file being created and causing a 'change' to theme files - solves git anoyance |
||
327 | acf_update_setting('json', false); |
||
328 | |||
329 | // vars |
||
330 | $new_ids = array(); |
||
331 | |||
332 | foreach( $keys as $key ) { |
||
333 | |||
334 | // append fields |
||
335 | if( acf_have_local_fields( $key ) ) { |
||
336 | |||
337 | $this->sync[ $key ]['fields'] = acf_get_local_fields( $key ); |
||
338 | |||
339 | } |
||
340 | |||
341 | |||
342 | // import |
||
343 | $field_group = acf_import_field_group( $this->sync[ $key ] ); |
||
344 | |||
345 | |||
346 | // append |
||
347 | $new_ids[] = $field_group['ID']; |
||
348 | |||
349 | } |
||
350 | |||
351 | |||
352 | // redirect |
||
353 | wp_redirect( admin_url( $this->url . '&acfsynccomplete=' . implode(',', $new_ids)) ); |
||
354 | exit; |
||
355 | |||
356 | } |
||
357 | |||
358 | } |
||
359 | |||
360 | |||
361 | // filters |
||
362 | add_filter('views_edit-acf-field-group', array($this, 'list_table_views')); |
||
363 | |||
364 | } |
||
365 | |||
366 | |||
367 | /* |
||
368 | * list_table_views |
||
369 | * |
||
370 | * This function will add an extra link for JSON in the field group list table |
||
371 | * |
||
372 | * @type function |
||
373 | * @date 3/12/2014 |
||
374 | * @since 5.1.5 |
||
375 | * |
||
376 | * @param $views (array) |
||
377 | * @return $views |
||
378 | */ |
||
0 ignored issues
–
show
The doc-type
$views could not be parsed: Unknown type name "$views" at position 0. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
379 | |||
380 | function list_table_views( $views ) { |
||
0 ignored issues
–
show
|
|||
381 | |||
382 | // vars |
||
383 | $class = ''; |
||
384 | $total = count($this->sync); |
||
385 | |||
386 | // active |
||
387 | if( acf_maybe_get($_GET, 'post_status') === 'sync' ) { |
||
388 | |||
389 | // actions |
||
390 | add_action('admin_footer', array($this, 'sync_admin_footer'), 5); |
||
391 | |||
392 | |||
393 | // set active class |
||
394 | $class = ' class="current"'; |
||
395 | |||
396 | |||
397 | // global |
||
398 | global $wp_list_table; |
||
399 | |||
400 | |||
401 | // update pagination |
||
402 | $wp_list_table->set_pagination_args( array( |
||
403 | 'total_items' => $total, |
||
404 | 'total_pages' => 1, |
||
405 | 'per_page' => $total |
||
406 | )); |
||
407 | |||
408 | } |
||
409 | |||
410 | |||
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>'; |
||
413 | |||
414 | |||
415 | // return |
||
416 | return $views; |
||
417 | |||
418 | } |
||
419 | |||
420 | |||
421 | /* |
||
422 | * trashed_post |
||
423 | * |
||
424 | * This function is run when a post object is sent to the trash |
||
425 | * |
||
426 | * @type action (trashed_post) |
||
427 | * @date 8/01/2014 |
||
428 | * @since 5.0.0 |
||
429 | * |
||
430 | * @param $post_id (int) |
||
431 | * @return n/a |
||
432 | */ |
||
0 ignored issues
–
show
The doc-type
n/a could not be parsed: Unknown type name "n/a" at position 0. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
433 | |||
434 | function trashed_post( $post_id ) { |
||
0 ignored issues
–
show
|
|||
435 | |||
436 | // validate post type |
||
437 | if( get_post_type($post_id) != 'acf-field-group' ) { |
||
438 | |||
439 | return; |
||
440 | |||
441 | } |
||
442 | |||
443 | |||
444 | // trash field group |
||
445 | acf_trash_field_group( $post_id ); |
||
446 | |||
447 | } |
||
448 | |||
449 | |||
450 | /* |
||
451 | * untrashed_post |
||
452 | * |
||
453 | * This function is run when a post object is restored from the trash |
||
454 | * |
||
455 | * @type action (untrashed_post) |
||
456 | * @date 8/01/2014 |
||
457 | * @since 5.0.0 |
||
458 | * |
||
459 | * @param $post_id (int) |
||
460 | * @return n/a |
||
461 | */ |
||
0 ignored issues
–
show
The doc-type
n/a could not be parsed: Unknown type name "n/a" at position 0. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
462 | |||
463 | function untrashed_post( $post_id ) { |
||
0 ignored issues
–
show
|
|||
464 | |||
465 | // validate post type |
||
466 | if( get_post_type($post_id) != 'acf-field-group' ) { |
||
467 | |||
468 | return; |
||
469 | |||
470 | } |
||
471 | |||
472 | |||
473 | // trash field group |
||
474 | acf_untrash_field_group( $post_id ); |
||
475 | |||
476 | } |
||
477 | |||
478 | |||
479 | /* |
||
480 | * deleted_post |
||
481 | * |
||
482 | * This function is run when a post object is deleted from the trash |
||
483 | * |
||
484 | * @type action (deleted_post) |
||
485 | * @date 8/01/2014 |
||
486 | * @since 5.0.0 |
||
487 | * |
||
488 | * @param $post_id (int) |
||
489 | * @return n/a |
||
490 | */ |
||
0 ignored issues
–
show
The doc-type
n/a could not be parsed: Unknown type name "n/a" at position 0. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
491 | |||
492 | function deleted_post( $post_id ) { |
||
0 ignored issues
–
show
|
|||
493 | |||
494 | // validate post type |
||
495 | if( get_post_type($post_id) != 'acf-field-group' ) { |
||
496 | |||
497 | return; |
||
498 | |||
499 | } |
||
500 | |||
501 | |||
502 | // trash field group |
||
503 | acf_delete_field_group( $post_id ); |
||
504 | |||
505 | } |
||
506 | |||
507 | |||
508 | /* |
||
509 | * field_group_columns |
||
510 | * |
||
511 | * This function will customize the columns for the field group table |
||
512 | * |
||
513 | * @type filter (manage_edit-acf-field-group_columns) |
||
514 | * @date 28/09/13 |
||
515 | * @since 5.0.0 |
||
516 | * |
||
517 | * @param $columns (array) |
||
518 | * @return $columns (array) |
||
519 | */ |
||
0 ignored issues
–
show
The doc-type
$columns could not be parsed: Unknown type name "$columns" at position 0. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
520 | |||
521 | function field_group_columns( $columns ) { |
||
0 ignored issues
–
show
|
|||
522 | |||
523 | return array( |
||
524 | 'cb' => '<input type="checkbox" />', |
||
525 | 'title' => __('Title', 'acf'), |
||
526 | 'acf-fg-description' => __('Description', 'acf'), |
||
527 | 'acf-fg-status' => '<i class="acf-icon -dot-3 small acf-js-tooltip" title="' . __('Status', 'acf') . '"></i>', |
||
528 | 'acf-fg-count' => __('Fields', 'acf'), |
||
529 | |||
530 | ); |
||
531 | |||
532 | } |
||
533 | |||
534 | |||
535 | /* |
||
536 | * field_group_columns_html |
||
537 | * |
||
538 | * This function will render the HTML for each table cell |
||
539 | * |
||
540 | * @type action (manage_acf-field-group_posts_custom_column) |
||
541 | * @date 28/09/13 |
||
542 | * @since 5.0.0 |
||
543 | * |
||
544 | * @param $column (string) |
||
545 | * @param $post_id (int) |
||
546 | * @return n/a |
||
547 | */ |
||
0 ignored issues
–
show
The doc-type
n/a could not be parsed: Unknown type name "n/a" at position 0. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
548 | |||
549 | function field_group_columns_html( $column, $post_id ) { |
||
0 ignored issues
–
show
|
|||
550 | |||
551 | // vars |
||
552 | $field_group = acf_get_field_group( $post_id ); |
||
553 | |||
554 | |||
555 | // render |
||
556 | $this->render_column( $column, $field_group ); |
||
557 | |||
558 | } |
||
559 | |||
560 | function render_column( $column, $field_group ) { |
||
0 ignored issues
–
show
|
|||
561 | |||
562 | // description |
||
563 | if( $column == 'acf-fg-description' ) { |
||
564 | |||
565 | if( $field_group['description'] ) { |
||
566 | |||
567 | echo '<span class="acf-description">' . $field_group['description'] . '</span>'; |
||
568 | |||
569 | } |
||
570 | |||
571 | // status |
||
572 | } elseif( $column == 'acf-fg-status' ) { |
||
573 | |||
574 | if( isset($this->sync[ $field_group['key'] ]) ) { |
||
575 | |||
576 | echo '<i class="acf-icon -sync grey small acf-js-tooltip" title="' . __('Sync available', 'acf') .'"></i> '; |
||
577 | |||
578 | } |
||
579 | |||
580 | if( $field_group['active'] ) { |
||
581 | |||
582 | //echo '<i class="acf-icon -check small acf-js-tooltip" title="' . __('Active', 'acf') .'"></i> '; |
||
583 | |||
584 | } else { |
||
585 | |||
586 | echo '<i class="acf-icon -minus yellow small acf-js-tooltip" title="' . __('Disabled', 'acf') . '"></i> '; |
||
587 | |||
588 | } |
||
589 | |||
590 | // fields |
||
591 | } elseif( $column == 'acf-fg-count' ) { |
||
592 | |||
593 | echo acf_get_field_count( $field_group ); |
||
594 | |||
595 | } |
||
596 | |||
597 | } |
||
598 | |||
599 | |||
600 | /* |
||
601 | * admin_footer |
||
602 | * |
||
603 | * This function will render extra HTML onto the page |
||
604 | * |
||
605 | * @type action (admin_footer) |
||
606 | * @date 23/06/12 |
||
607 | * @since 3.1.8 |
||
608 | * |
||
609 | * @param n/a |
||
610 | * @return n/a |
||
611 | */ |
||
0 ignored issues
–
show
The doc-type
n/a could not be parsed: Unknown type name "n/a" at position 0. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
612 | |||
613 | function admin_footer() { |
||
0 ignored issues
–
show
|
|||
614 | |||
615 | // vars |
||
616 | $www = 'http://www.advancedcustomfields.com/resources/'; |
||
617 | |||
618 | ?><script type="text/html" id="tmpl-acf-column-2"> |
||
619 | <div class="acf-column-2"> |
||
620 | <div class="acf-box"> |
||
621 | <div class="inner"> |
||
622 | <h2><?php echo acf_get_setting('name'); ?> <?php echo acf_get_setting('version'); ?></h2> |
||
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> |
||
626 | |||
627 | <h3><?php _e("Resources",'acf'); ?></h3> |
||
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> |
||
637 | </ul> |
||
638 | </div> |
||
639 | <div class="footer footer-blue"> |
||
640 | <ul class="acf-hl"> |
||
641 | <li><?php _e("Created by",'acf'); ?> Elliot Condon</li> |
||
642 | </ul> |
||
643 | </div> |
||
644 | </div> |
||
645 | </div> |
||
646 | <div class="acf-clear"></div> |
||
647 | </script> |
||
648 | <script type="text/javascript"> |
||
649 | (function($){ |
||
650 | |||
651 | // wrap |
||
652 | $('#wpbody .wrap').attr('id', 'acf-field-group-wrap'); |
||
653 | |||
654 | |||
655 | // wrap form |
||
656 | $('#posts-filter').wrap('<div class="acf-columns-2" />'); |
||
657 | |||
658 | |||
659 | // add column main |
||
660 | $('#posts-filter').addClass('acf-column-1'); |
||
661 | |||
662 | |||
663 | // add column side |
||
664 | $('#posts-filter').after( $('#tmpl-acf-column-2').html() ); |
||
665 | |||
666 | |||
667 | // modify row actions |
||
668 | $('#the-list tr').each(function(){ |
||
669 | |||
670 | // vars |
||
671 | var $tr = $(this), |
||
672 | id = $tr.attr('id'), |
||
673 | description = $tr.find('.column-acf-fg-description').html(); |
||
674 | |||
675 | |||
676 | // replace Quick Edit with Duplicate (sync page has no id attribute) |
||
677 | if( id ) { |
||
678 | |||
679 | // vars |
||
680 | var post_id = id.replace('post-', ''); |
||
681 | |||
682 | |||
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>'); |
||
685 | |||
686 | |||
687 | // replace |
||
688 | $tr.find('.column-title .row-actions .inline').replaceWith( $span ); |
||
689 | |||
690 | } |
||
691 | |||
692 | |||
693 | // add description to title |
||
694 | $tr.find('.column-title .row-title').after( description ); |
||
695 | |||
696 | }); |
||
697 | |||
698 | |||
699 | // modify bulk actions |
||
700 | $('#bulk-action-selector-bottom option[value="edit"]').attr('value','acfduplicate').text('<?php _e( 'Duplicate', 'acf' ); ?>'); |
||
701 | |||
702 | |||
703 | // clean up table |
||
704 | $('#adv-settings label[for="acf-fg-description-hide"]').remove(); |
||
705 | |||
706 | |||
707 | // mobile compatibility |
||
708 | var status = $('.acf-icon.-dot-3').first().attr('title'); |
||
709 | $('td.column-acf-fg-status').attr('data-colname', status); |
||
710 | |||
711 | })(jQuery); |
||
712 | </script> |
||
713 | <?php |
||
714 | |||
715 | } |
||
716 | |||
717 | |||
718 | /* |
||
719 | * sync_admin_footer |
||
720 | * |
||
721 | * This function will render extra HTML onto the page |
||
722 | * |
||
723 | * @type action (admin_footer) |
||
724 | * @date 23/06/12 |
||
725 | * @since 3.1.8 |
||
726 | * |
||
727 | * @param n/a |
||
728 | * @return n/a |
||
729 | */ |
||
0 ignored issues
–
show
The doc-type
n/a could not be parsed: Unknown type name "n/a" at position 0. (view supported doc-types)
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types. ![]() |
|||
730 | |||
731 | function sync_admin_footer() { |
||
0 ignored issues
–
show
|
|||
732 | |||
733 | // vars |
||
734 | $i = -1; |
||
735 | $columns = array( |
||
736 | 'acf-fg-description', |
||
737 | 'acf-fg-status', |
||
738 | 'acf-fg-count' |
||
739 | ); |
||
740 | |||
741 | ?> |
||
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; ?>> |
||
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> |
||
747 | <input type="checkbox" value="<?php echo $field_group['key']; ?>" name="post[]" id="cb-select-<?php echo $field_group['key']; ?>"> |
||
748 | </th> |
||
749 | <td class="post-title page-title column-title"> |
||
750 | <strong> |
||
751 | <span class="row-title"><?php echo $field_group['title']; ?></span><span class="acf-description"><?php echo $field_group['key']; ?>.json</span> |
||
752 | </strong> |
||
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> |
||
755 | </div> |
||
756 | </td> |
||
757 | <?php foreach( $columns as $column ): ?> |
||
758 | <td class="column-<?php echo $column; ?>"><?php $this->render_column( $column, $field_group ); ?></td> |
||
759 | <?php endforeach; ?> |
||
760 | </tr> |
||
761 | <?php endforeach; ?> |
||
762 | </script> |
||
763 | <script type="text/javascript"> |
||
764 | (function($){ |
||
765 | |||
766 | // update table HTML |
||
767 | $('#the-list').html( $('#tmpl-acf-json-tbody').html() ); |
||
768 | |||
769 | |||
770 | // modify bulk actions |
||
771 | $('#bulk-action-selector-bottom option[value="edit"]').attr('value','acfsync').text('<?php _e('Sync', 'acf'); ?>'); |
||
772 | $('#bulk-action-selector-bottom option[value="trash"]').remove(); |
||
773 | |||
774 | })(jQuery); |
||
775 | </script> |
||
776 | <?php |
||
777 | |||
778 | } |
||
779 | |||
780 | } |
||
781 | |||
782 | new acf_admin_field_groups(); |
||
783 | |||
784 | endif; |
||
785 | |||
786 | ?> |
||
787 |
This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.