@@ -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 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | function __construct() { |
| 19 | 19 | |
| 20 | 20 | // actions |
| 21 | - add_action('admin_menu', array($this, 'admin_menu')); |
|
| 21 | + add_action('admin_menu', array($this, 'admin_menu')); |
|
| 22 | 22 | |
| 23 | 23 | } |
| 24 | 24 | |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | function admin_menu() { |
| 40 | 40 | |
| 41 | 41 | // bail early if no show_admin |
| 42 | - if( !acf_get_setting('show_admin') ) { |
|
| 42 | + if ( ! acf_get_setting('show_admin')) { |
|
| 43 | 43 | |
| 44 | 44 | return; |
| 45 | 45 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | |
| 48 | 48 | |
| 49 | 49 | // add page |
| 50 | - add_submenu_page('edit.php?post_type=acf-field-group', __('Info','acf'), __('Info','acf'), acf_get_setting('capability'),'acf-settings-info', array($this,'html')); |
|
| 50 | + add_submenu_page('edit.php?post_type=acf-field-group', __('Info', 'acf'), __('Info', 'acf'), acf_get_setting('capability'), 'acf-settings-info', array($this, 'html')); |
|
| 51 | 51 | |
| 52 | 52 | } |
| 53 | 53 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | // set active tab |
| 83 | - if( !empty($_GET['tab']) && array_key_exists($_GET['tab'], $view['tabs']) ) { |
|
| 83 | + if ( ! empty($_GET['tab']) && array_key_exists($_GET['tab'], $view['tabs'])) { |
|
| 84 | 84 | |
| 85 | 85 | $view['active'] = $_GET['tab']; |
| 86 | 86 | |
@@ -222,41 +222,41 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | |
| 224 | 224 | // validate json |
| 225 | - if( empty($json) ) { |
|
| 225 | + if( empty($json) ) { |
|
| 226 | 226 | |
| 227 | - acf_add_admin_notice(__('Import file empty', 'acf'), 'error'); |
|
| 228 | - return; |
|
| 227 | + acf_add_admin_notice(__('Import file empty', 'acf'), 'error'); |
|
| 228 | + return; |
|
| 229 | 229 | |
| 230 | - } |
|
| 230 | + } |
|
| 231 | 231 | |
| 232 | 232 | |
| 233 | - // if importing an auto-json, wrap field group in array |
|
| 234 | - if( isset($json['key']) ) { |
|
| 233 | + // if importing an auto-json, wrap field group in array |
|
| 234 | + if( isset($json['key']) ) { |
|
| 235 | 235 | |
| 236 | - $json = array( $json ); |
|
| 236 | + $json = array( $json ); |
|
| 237 | 237 | |
| 238 | - } |
|
| 238 | + } |
|
| 239 | 239 | |
| 240 | 240 | |
| 241 | - // vars |
|
| 242 | - $added = array(); |
|
| 243 | - $ignored = array(); |
|
| 244 | - $ref = array(); |
|
| 245 | - $order = array(); |
|
| 241 | + // vars |
|
| 242 | + $added = array(); |
|
| 243 | + $ignored = array(); |
|
| 244 | + $ref = array(); |
|
| 245 | + $order = array(); |
|
| 246 | 246 | |
| 247 | - foreach( $json as $field_group ) { |
|
| 247 | + foreach( $json as $field_group ) { |
|
| 248 | 248 | |
| 249 | - // check if field group exists |
|
| 250 | - if( acf_get_field_group($field_group['key'], true) ) { |
|
| 249 | + // check if field group exists |
|
| 250 | + if( acf_get_field_group($field_group['key'], true) ) { |
|
| 251 | 251 | |
| 252 | - // append to ignored |
|
| 253 | - $ignored[] = $field_group['title']; |
|
| 254 | - continue; |
|
| 252 | + // append to ignored |
|
| 253 | + $ignored[] = $field_group['title']; |
|
| 254 | + continue; |
|
| 255 | 255 | |
| 256 | - } |
|
| 256 | + } |
|
| 257 | 257 | |
| 258 | 258 | |
| 259 | - // remove fields |
|
| 259 | + // remove fields |
|
| 260 | 260 | $fields = acf_extract_var($field_group, 'fields'); |
| 261 | 261 | |
| 262 | 262 | |
@@ -314,27 +314,27 @@ discard block |
||
| 314 | 314 | // append to added |
| 315 | 315 | $added[] = '<a href="' . admin_url("post.php?post={$field_group['ID']}&action=edit") . '" target="_blank">' . $field_group['title'] . '</a>'; |
| 316 | 316 | |
| 317 | - } |
|
| 317 | + } |
|
| 318 | 318 | |
| 319 | 319 | |
| 320 | - // messages |
|
| 321 | - if( !empty($added) ) { |
|
| 320 | + // messages |
|
| 321 | + if( !empty($added) ) { |
|
| 322 | 322 | |
| 323 | - $message = __('<b>Success</b>. Import tool added %s field groups: %s', 'acf'); |
|
| 324 | - $message = sprintf( $message, count($added), implode(', ', $added) ); |
|
| 323 | + $message = __('<b>Success</b>. Import tool added %s field groups: %s', 'acf'); |
|
| 324 | + $message = sprintf( $message, count($added), implode(', ', $added) ); |
|
| 325 | 325 | |
| 326 | - acf_add_admin_notice( $message ); |
|
| 326 | + acf_add_admin_notice( $message ); |
|
| 327 | 327 | |
| 328 | - } |
|
| 328 | + } |
|
| 329 | 329 | |
| 330 | - if( !empty($ignored) ) { |
|
| 330 | + if( !empty($ignored) ) { |
|
| 331 | 331 | |
| 332 | - $message = __('<b>Warning</b>. Import tool detected %s field groups already exist and have been ignored: %s', 'acf'); |
|
| 333 | - $message = sprintf( $message, count($ignored), implode(', ', $ignored) ); |
|
| 332 | + $message = __('<b>Warning</b>. Import tool detected %s field groups already exist and have been ignored: %s', 'acf'); |
|
| 333 | + $message = sprintf( $message, count($ignored), implode(', ', $ignored) ); |
|
| 334 | 334 | |
| 335 | - acf_add_admin_notice( $message, 'error' ); |
|
| 335 | + acf_add_admin_notice( $message, 'error' ); |
|
| 336 | 336 | |
| 337 | - } |
|
| 337 | + } |
|
| 338 | 338 | |
| 339 | 339 | |
| 340 | 340 | } |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | function admin_menu() { |
| 44 | 44 | |
| 45 | 45 | // bail early if no show_admin |
| 46 | - if( !acf_get_setting('show_admin') ) { |
|
| 46 | + if ( ! acf_get_setting('show_admin')) { |
|
| 47 | 47 | |
| 48 | 48 | return; |
| 49 | 49 | |
@@ -51,11 +51,11 @@ discard block |
||
| 51 | 51 | |
| 52 | 52 | |
| 53 | 53 | // add page |
| 54 | - $page = add_submenu_page('edit.php?post_type=acf-field-group', __('Tools','acf'), __('Tools','acf'), acf_get_setting('capability'),'acf-settings-tools', array($this,'html') ); |
|
| 54 | + $page = add_submenu_page('edit.php?post_type=acf-field-group', __('Tools', 'acf'), __('Tools', 'acf'), acf_get_setting('capability'), 'acf-settings-tools', array($this, 'html')); |
|
| 55 | 55 | |
| 56 | 56 | |
| 57 | 57 | // actions |
| 58 | - add_action('load-' . $page, array($this,'load')); |
|
| 58 | + add_action('load-'.$page, array($this, 'load')); |
|
| 59 | 59 | |
| 60 | 60 | } |
| 61 | 61 | |
@@ -80,13 +80,13 @@ discard block |
||
| 80 | 80 | |
| 81 | 81 | |
| 82 | 82 | // run import / export |
| 83 | - if( acf_verify_nonce('import') ) { |
|
| 83 | + if (acf_verify_nonce('import')) { |
|
| 84 | 84 | |
| 85 | 85 | $this->import(); |
| 86 | 86 | |
| 87 | - } elseif( acf_verify_nonce('export') ) { |
|
| 87 | + } elseif (acf_verify_nonce('export')) { |
|
| 88 | 88 | |
| 89 | - if( isset($_POST['generate']) ) { |
|
| 89 | + if (isset($_POST['generate'])) { |
|
| 90 | 90 | |
| 91 | 91 | $this->generate(); |
| 92 | 92 | |
@@ -146,22 +146,22 @@ discard block |
||
| 146 | 146 | |
| 147 | 147 | |
| 148 | 148 | // validate |
| 149 | - if( $json === false ) { |
|
| 149 | + if ($json === false) { |
|
| 150 | 150 | |
| 151 | - acf_add_admin_notice( __("No field groups selected", 'acf') , 'error'); |
|
| 151 | + acf_add_admin_notice(__("No field groups selected", 'acf'), 'error'); |
|
| 152 | 152 | return; |
| 153 | 153 | |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | 156 | |
| 157 | 157 | // set headers |
| 158 | - $file_name = 'acf-export-' . date('Y-m-d') . '.json'; |
|
| 158 | + $file_name = 'acf-export-'.date('Y-m-d').'.json'; |
|
| 159 | 159 | |
| 160 | - header( "Content-Description: File Transfer" ); |
|
| 161 | - header( "Content-Disposition: attachment; filename={$file_name}" ); |
|
| 162 | - header( "Content-Type: application/json; charset=utf-8" ); |
|
| 160 | + header("Content-Description: File Transfer"); |
|
| 161 | + header("Content-Disposition: attachment; filename={$file_name}"); |
|
| 162 | + header("Content-Type: application/json; charset=utf-8"); |
|
| 163 | 163 | |
| 164 | - echo acf_json_encode( $json ); |
|
| 164 | + echo acf_json_encode($json); |
|
| 165 | 165 | die; |
| 166 | 166 | |
| 167 | 167 | } |
@@ -183,9 +183,9 @@ discard block |
||
| 183 | 183 | function import() { |
| 184 | 184 | |
| 185 | 185 | // validate |
| 186 | - if( empty($_FILES['acf_import_file']) ) { |
|
| 186 | + if (empty($_FILES['acf_import_file'])) { |
|
| 187 | 187 | |
| 188 | - acf_add_admin_notice( __("No file selected", 'acf') , 'error'); |
|
| 188 | + acf_add_admin_notice(__("No file selected", 'acf'), 'error'); |
|
| 189 | 189 | return; |
| 190 | 190 | |
| 191 | 191 | } |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | |
| 198 | 198 | // validate error |
| 199 | - if( $file['error'] ) { |
|
| 199 | + if ($file['error']) { |
|
| 200 | 200 | |
| 201 | 201 | acf_add_admin_notice(__('Error uploading file. Please try again', 'acf'), 'error'); |
| 202 | 202 | return; |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | |
| 206 | 206 | |
| 207 | 207 | // validate type |
| 208 | - if( pathinfo($file['name'], PATHINFO_EXTENSION) !== 'json' ) { |
|
| 208 | + if (pathinfo($file['name'], PATHINFO_EXTENSION) !== 'json') { |
|
| 209 | 209 | |
| 210 | 210 | acf_add_admin_notice(__('Incorrect file type', 'acf'), 'error'); |
| 211 | 211 | return; |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | |
| 215 | 215 | |
| 216 | 216 | // read file |
| 217 | - $json = file_get_contents( $file['tmp_name'] ); |
|
| 217 | + $json = file_get_contents($file['tmp_name']); |
|
| 218 | 218 | |
| 219 | 219 | |
| 220 | 220 | // decode json |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | |
| 223 | 223 | |
| 224 | 224 | // validate json |
| 225 | - if( empty($json) ) { |
|
| 225 | + if (empty($json)) { |
|
| 226 | 226 | |
| 227 | 227 | acf_add_admin_notice(__('Import file empty', 'acf'), 'error'); |
| 228 | 228 | return; |
@@ -231,9 +231,9 @@ discard block |
||
| 231 | 231 | |
| 232 | 232 | |
| 233 | 233 | // if importing an auto-json, wrap field group in array |
| 234 | - if( isset($json['key']) ) { |
|
| 234 | + if (isset($json['key'])) { |
|
| 235 | 235 | |
| 236 | - $json = array( $json ); |
|
| 236 | + $json = array($json); |
|
| 237 | 237 | |
| 238 | 238 | } |
| 239 | 239 | |
@@ -244,10 +244,10 @@ discard block |
||
| 244 | 244 | $ref = array(); |
| 245 | 245 | $order = array(); |
| 246 | 246 | |
| 247 | - foreach( $json as $field_group ) { |
|
| 247 | + foreach ($json as $field_group) { |
|
| 248 | 248 | |
| 249 | 249 | // check if field group exists |
| 250 | - if( acf_get_field_group($field_group['key'], true) ) { |
|
| 250 | + if (acf_get_field_group($field_group['key'], true)) { |
|
| 251 | 251 | |
| 252 | 252 | // append to ignored |
| 253 | 253 | $ignored[] = $field_group['title']; |
@@ -261,78 +261,78 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | |
| 263 | 263 | // format fields |
| 264 | - $fields = acf_prepare_fields_for_import( $fields ); |
|
| 264 | + $fields = acf_prepare_fields_for_import($fields); |
|
| 265 | 265 | |
| 266 | 266 | |
| 267 | 267 | // save field group |
| 268 | - $field_group = acf_update_field_group( $field_group ); |
|
| 268 | + $field_group = acf_update_field_group($field_group); |
|
| 269 | 269 | |
| 270 | 270 | |
| 271 | 271 | // add to ref |
| 272 | - $ref[ $field_group['key'] ] = $field_group['ID']; |
|
| 272 | + $ref[$field_group['key']] = $field_group['ID']; |
|
| 273 | 273 | |
| 274 | 274 | |
| 275 | 275 | // add to order |
| 276 | - $order[ $field_group['ID'] ] = 0; |
|
| 276 | + $order[$field_group['ID']] = 0; |
|
| 277 | 277 | |
| 278 | 278 | |
| 279 | 279 | // add fields |
| 280 | - foreach( $fields as $field ) { |
|
| 280 | + foreach ($fields as $field) { |
|
| 281 | 281 | |
| 282 | 282 | // add parent |
| 283 | - if( empty($field['parent']) ) { |
|
| 283 | + if (empty($field['parent'])) { |
|
| 284 | 284 | |
| 285 | 285 | $field['parent'] = $field_group['ID']; |
| 286 | 286 | |
| 287 | - } elseif( isset($ref[ $field['parent'] ]) ) { |
|
| 287 | + } elseif (isset($ref[$field['parent']])) { |
|
| 288 | 288 | |
| 289 | - $field['parent'] = $ref[ $field['parent'] ]; |
|
| 289 | + $field['parent'] = $ref[$field['parent']]; |
|
| 290 | 290 | |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | |
| 294 | 294 | // add field menu_order |
| 295 | - if( !isset($order[ $field['parent'] ]) ) { |
|
| 295 | + if ( ! isset($order[$field['parent']])) { |
|
| 296 | 296 | |
| 297 | - $order[ $field['parent'] ] = 0; |
|
| 297 | + $order[$field['parent']] = 0; |
|
| 298 | 298 | |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - $field['menu_order'] = $order[ $field['parent'] ]; |
|
| 302 | - $order[ $field['parent'] ]++; |
|
| 301 | + $field['menu_order'] = $order[$field['parent']]; |
|
| 302 | + $order[$field['parent']]++; |
|
| 303 | 303 | |
| 304 | 304 | |
| 305 | 305 | // save field |
| 306 | - $field = acf_update_field( $field ); |
|
| 306 | + $field = acf_update_field($field); |
|
| 307 | 307 | |
| 308 | 308 | |
| 309 | 309 | // add to ref |
| 310 | - $ref[ $field['key'] ] = $field['ID']; |
|
| 310 | + $ref[$field['key']] = $field['ID']; |
|
| 311 | 311 | |
| 312 | 312 | } |
| 313 | 313 | |
| 314 | 314 | // append to added |
| 315 | - $added[] = '<a href="' . admin_url("post.php?post={$field_group['ID']}&action=edit") . '" target="_blank">' . $field_group['title'] . '</a>'; |
|
| 315 | + $added[] = '<a href="'.admin_url("post.php?post={$field_group['ID']}&action=edit").'" target="_blank">'.$field_group['title'].'</a>'; |
|
| 316 | 316 | |
| 317 | 317 | } |
| 318 | 318 | |
| 319 | 319 | |
| 320 | 320 | // messages |
| 321 | - if( !empty($added) ) { |
|
| 321 | + if ( ! empty($added)) { |
|
| 322 | 322 | |
| 323 | 323 | $message = __('<b>Success</b>. Import tool added %s field groups: %s', 'acf'); |
| 324 | - $message = sprintf( $message, count($added), implode(', ', $added) ); |
|
| 324 | + $message = sprintf($message, count($added), implode(', ', $added)); |
|
| 325 | 325 | |
| 326 | - acf_add_admin_notice( $message ); |
|
| 326 | + acf_add_admin_notice($message); |
|
| 327 | 327 | |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - if( !empty($ignored) ) { |
|
| 330 | + if ( ! empty($ignored)) { |
|
| 331 | 331 | |
| 332 | 332 | $message = __('<b>Warning</b>. Import tool detected %s field groups already exist and have been ignored: %s', 'acf'); |
| 333 | - $message = sprintf( $message, count($ignored), implode(', ', $ignored) ); |
|
| 333 | + $message = sprintf($message, count($ignored), implode(', ', $ignored)); |
|
| 334 | 334 | |
| 335 | - acf_add_admin_notice( $message, 'error' ); |
|
| 335 | + acf_add_admin_notice($message, 'error'); |
|
| 336 | 336 | |
| 337 | 337 | } |
| 338 | 338 | |
@@ -356,15 +356,15 @@ discard block |
||
| 356 | 356 | function generate() { |
| 357 | 357 | |
| 358 | 358 | // translate |
| 359 | - if( acf_get_setting('l10n_textdomain') ) { |
|
| 359 | + if (acf_get_setting('l10n_textdomain')) { |
|
| 360 | 360 | |
| 361 | 361 | // prevent default translation |
| 362 | 362 | acf_update_setting('l10n_var_export', true); |
| 363 | 363 | |
| 364 | 364 | |
| 365 | 365 | // filters |
| 366 | - add_filter('acf/prepare_field_group_for_export', array($this, '_translate_field_group')); |
|
| 367 | - add_filter('acf/prepare_field_for_export', array($this, '_translate_field')); |
|
| 366 | + add_filter('acf/prepare_field_group_for_export', array($this, '_translate_field_group')); |
|
| 367 | + add_filter('acf/prepare_field_for_export', array($this, '_translate_field')); |
|
| 368 | 368 | |
| 369 | 369 | } |
| 370 | 370 | |
@@ -374,9 +374,9 @@ discard block |
||
| 374 | 374 | |
| 375 | 375 | |
| 376 | 376 | // validate |
| 377 | - if( $json === false ) { |
|
| 377 | + if ($json === false) { |
|
| 378 | 378 | |
| 379 | - acf_add_admin_notice( __("No field groups selected", 'acf') , 'error'); |
|
| 379 | + acf_add_admin_notice(__("No field groups selected", 'acf'), 'error'); |
|
| 380 | 380 | return; |
| 381 | 381 | |
| 382 | 382 | } |
@@ -388,13 +388,13 @@ discard block |
||
| 388 | 388 | |
| 389 | 389 | } |
| 390 | 390 | |
| 391 | - function _translate_field( $field ) { |
|
| 391 | + function _translate_field($field) { |
|
| 392 | 392 | |
| 393 | 393 | return acf_translate_keys($field, acf_get_setting('l10n_field')); |
| 394 | 394 | |
| 395 | 395 | } |
| 396 | 396 | |
| 397 | - function _translate_field_group( $field_group ) { |
|
| 397 | + function _translate_field_group($field_group) { |
|
| 398 | 398 | |
| 399 | 399 | return acf_translate_keys($field_group, acf_get_setting('l10n_field_group')); |
| 400 | 400 | |
@@ -417,7 +417,7 @@ discard block |
||
| 417 | 417 | function get_json() { |
| 418 | 418 | |
| 419 | 419 | // validate |
| 420 | - if( empty($_POST['acf_export_keys']) ) { |
|
| 420 | + if (empty($_POST['acf_export_keys'])) { |
|
| 421 | 421 | |
| 422 | 422 | return false; |
| 423 | 423 | |
@@ -429,22 +429,22 @@ discard block |
||
| 429 | 429 | |
| 430 | 430 | |
| 431 | 431 | // construct JSON |
| 432 | - foreach( $_POST['acf_export_keys'] as $key ) { |
|
| 432 | + foreach ($_POST['acf_export_keys'] as $key) { |
|
| 433 | 433 | |
| 434 | 434 | // load field group |
| 435 | - $field_group = acf_get_field_group( $key ); |
|
| 435 | + $field_group = acf_get_field_group($key); |
|
| 436 | 436 | |
| 437 | 437 | |
| 438 | 438 | // validate field group |
| 439 | - if( empty($field_group) ) continue; |
|
| 439 | + if (empty($field_group)) continue; |
|
| 440 | 440 | |
| 441 | 441 | |
| 442 | 442 | // load fields |
| 443 | - $field_group['fields'] = acf_get_fields( $field_group ); |
|
| 443 | + $field_group['fields'] = acf_get_fields($field_group); |
|
| 444 | 444 | |
| 445 | 445 | |
| 446 | 446 | // prepare for export |
| 447 | - $field_group = acf_prepare_field_group_for_export( $field_group ); |
|
| 447 | + $field_group = acf_prepare_field_group_for_export($field_group); |
|
| 448 | 448 | |
| 449 | 449 | |
| 450 | 450 | // add to json array |
@@ -436,7 +436,9 @@ |
||
| 436 | 436 | |
| 437 | 437 | |
| 438 | 438 | // validate field group |
| 439 | - if( empty($field_group) ) continue; |
|
| 439 | + if( empty($field_group) ) { |
|
| 440 | + continue; |
|
| 441 | + } |
|
| 440 | 442 | |
| 441 | 443 | |
| 442 | 444 | // load fields |
@@ -10,7 +10,7 @@ discard block |
||
| 10 | 10 | * @subpackage Admin |
| 11 | 11 | */ |
| 12 | 12 | |
| 13 | -if( ! class_exists('acf_admin_update') ) : |
|
| 13 | +if ( ! class_exists('acf_admin_update')) : |
|
| 14 | 14 | |
| 15 | 15 | class acf_admin_update { |
| 16 | 16 | |
@@ -29,12 +29,12 @@ discard block |
||
| 29 | 29 | function __construct() { |
| 30 | 30 | |
| 31 | 31 | // actions |
| 32 | - add_action('admin_menu', array($this,'admin_menu'), 20); |
|
| 33 | - add_action('network_admin_menu', array($this,'network_admin_menu'), 20); |
|
| 32 | + add_action('admin_menu', array($this, 'admin_menu'), 20); |
|
| 33 | + add_action('network_admin_menu', array($this, 'network_admin_menu'), 20); |
|
| 34 | 34 | |
| 35 | 35 | |
| 36 | 36 | // ajax |
| 37 | - add_action('wp_ajax_acf/admin/data_upgrade', array($this, 'ajax_upgrade')); |
|
| 37 | + add_action('wp_ajax_acf/admin/data_upgrade', array($this, 'ajax_upgrade')); |
|
| 38 | 38 | |
| 39 | 39 | } |
| 40 | 40 | |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | function network_admin_menu() { |
| 56 | 56 | |
| 57 | 57 | // bail early if no show_admin |
| 58 | - if( !acf_get_setting('show_admin') ) { |
|
| 58 | + if ( ! acf_get_setting('show_admin')) { |
|
| 59 | 59 | |
| 60 | 60 | return; |
| 61 | 61 | |
@@ -69,12 +69,12 @@ discard block |
||
| 69 | 69 | // loop through sites and find updates |
| 70 | 70 | $sites = wp_get_sites(); |
| 71 | 71 | |
| 72 | - if( $sites ) { |
|
| 72 | + if ($sites) { |
|
| 73 | 73 | |
| 74 | - foreach( $sites as $site ) { |
|
| 74 | + foreach ($sites as $site) { |
|
| 75 | 75 | |
| 76 | 76 | // switch blog |
| 77 | - switch_to_blog( $site['blog_id'] ); |
|
| 77 | + switch_to_blog($site['blog_id']); |
|
| 78 | 78 | |
| 79 | 79 | |
| 80 | 80 | // get site updates |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | restore_current_blog(); |
| 86 | 86 | |
| 87 | 87 | |
| 88 | - if( $updates ) { |
|
| 88 | + if ($updates) { |
|
| 89 | 89 | |
| 90 | 90 | $prompt = true; |
| 91 | 91 | break; |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | |
| 100 | 100 | // bail if no prompt |
| 101 | - if( !$prompt ) { |
|
| 101 | + if ( ! $prompt) { |
|
| 102 | 102 | |
| 103 | 103 | return; |
| 104 | 104 | |
@@ -110,7 +110,7 @@ discard block |
||
| 110 | 110 | |
| 111 | 111 | |
| 112 | 112 | // add page |
| 113 | - add_submenu_page('update-core.php', __('Upgrade ACF','acf'), __('Upgrade ACF','acf'), acf_get_setting('capability'),'acf-upgrade', array($this,'network_html')); |
|
| 113 | + add_submenu_page('update-core.php', __('Upgrade ACF', 'acf'), __('Upgrade ACF', 'acf'), acf_get_setting('capability'), 'acf-upgrade', array($this, 'network_html')); |
|
| 114 | 114 | |
| 115 | 115 | } |
| 116 | 116 | |
@@ -131,7 +131,7 @@ discard block |
||
| 131 | 131 | function network_admin_notices() { |
| 132 | 132 | |
| 133 | 133 | // bail ealry if already on update page |
| 134 | - if( acf_is_screen('admin_page_acf-upgrade-network') ) { |
|
| 134 | + if (acf_is_screen('admin_page_acf-upgrade-network')) { |
|
| 135 | 135 | |
| 136 | 136 | return; |
| 137 | 137 | |
@@ -174,12 +174,12 @@ discard block |
||
| 174 | 174 | // loop through sites and find updates |
| 175 | 175 | $sites = wp_get_sites(); |
| 176 | 176 | |
| 177 | - if( $sites ) { |
|
| 177 | + if ($sites) { |
|
| 178 | 178 | |
| 179 | - foreach( $sites as $i => $site ) { |
|
| 179 | + foreach ($sites as $i => $site) { |
|
| 180 | 180 | |
| 181 | 181 | // switch blog |
| 182 | - switch_to_blog( $site['blog_id'] ); |
|
| 182 | + switch_to_blog($site['blog_id']); |
|
| 183 | 183 | |
| 184 | 184 | |
| 185 | 185 | // extra info |
@@ -196,7 +196,7 @@ discard block |
||
| 196 | 196 | |
| 197 | 197 | |
| 198 | 198 | // no value equals new instal |
| 199 | - if( !$site['acf_version'] ) { |
|
| 199 | + if ( ! $site['acf_version']) { |
|
| 200 | 200 | |
| 201 | 201 | $site['acf_version'] = $plugin_version; |
| 202 | 202 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | |
| 205 | 205 | |
| 206 | 206 | // update |
| 207 | - $sites[ $i ] = $site; |
|
| 207 | + $sites[$i] = $site; |
|
| 208 | 208 | |
| 209 | 209 | |
| 210 | 210 | // restore |
@@ -253,16 +253,16 @@ discard block |
||
| 253 | 253 | |
| 254 | 254 | |
| 255 | 255 | // bail early if a new install |
| 256 | - if( !$acf_version ) { |
|
| 256 | + if ( ! $acf_version) { |
|
| 257 | 257 | |
| 258 | - update_option('acf_version', $plugin_version ); |
|
| 258 | + update_option('acf_version', $plugin_version); |
|
| 259 | 259 | return; |
| 260 | 260 | |
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | |
| 264 | 264 | // bail early if $acf_version is >= $plugin_version |
| 265 | - if( version_compare( $acf_version, $plugin_version, '>=') ) { |
|
| 265 | + if (version_compare($acf_version, $plugin_version, '>=')) { |
|
| 266 | 266 | |
| 267 | 267 | return; |
| 268 | 268 | |
@@ -274,16 +274,16 @@ discard block |
||
| 274 | 274 | |
| 275 | 275 | |
| 276 | 276 | // bail early if no updates available |
| 277 | - if( empty($updates) ) { |
|
| 277 | + if (empty($updates)) { |
|
| 278 | 278 | |
| 279 | - update_option('acf_version', $plugin_version ); |
|
| 279 | + update_option('acf_version', $plugin_version); |
|
| 280 | 280 | return; |
| 281 | 281 | |
| 282 | 282 | } |
| 283 | 283 | |
| 284 | 284 | |
| 285 | 285 | // bail early if no show_admin |
| 286 | - if( !acf_get_setting('show_admin') ) { |
|
| 286 | + if ( ! acf_get_setting('show_admin')) { |
|
| 287 | 287 | |
| 288 | 288 | return; |
| 289 | 289 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | |
| 296 | 296 | |
| 297 | 297 | // add page |
| 298 | - add_submenu_page('edit.php?post_type=acf-field-group', __('Upgrade','acf'), __('Upgrade','acf'), acf_get_setting('capability'),'acf-upgrade', array($this,'html') ); |
|
| 298 | + add_submenu_page('edit.php?post_type=acf-field-group', __('Upgrade', 'acf'), __('Upgrade', 'acf'), acf_get_setting('capability'), 'acf-upgrade', array($this, 'html')); |
|
| 299 | 299 | |
| 300 | 300 | } |
| 301 | 301 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | function admin_notices() { |
| 317 | 317 | |
| 318 | 318 | // bail ealry if already on update page |
| 319 | - if( acf_is_screen('custom-fields_page_acf-upgrade') ) { |
|
| 319 | + if (acf_is_screen('custom-fields_page_acf-upgrade')) { |
|
| 320 | 320 | |
| 321 | 321 | return; |
| 322 | 322 | |
@@ -384,14 +384,14 @@ discard block |
||
| 384 | 384 | function ajax_upgrade() { |
| 385 | 385 | |
| 386 | 386 | // options |
| 387 | - $options = wp_parse_args( $_POST, array( |
|
| 387 | + $options = wp_parse_args($_POST, array( |
|
| 388 | 388 | 'nonce' => '', |
| 389 | 389 | 'blog_id' => '', |
| 390 | 390 | )); |
| 391 | 391 | |
| 392 | 392 | |
| 393 | 393 | // validate |
| 394 | - if( !wp_verify_nonce($options['nonce'], 'acf_upgrade') ) { |
|
| 394 | + if ( ! wp_verify_nonce($options['nonce'], 'acf_upgrade')) { |
|
| 395 | 395 | |
| 396 | 396 | wp_send_json_error(); |
| 397 | 397 | |
@@ -399,9 +399,9 @@ discard block |
||
| 399 | 399 | |
| 400 | 400 | |
| 401 | 401 | // switch blog |
| 402 | - if( $options['blog_id'] ) { |
|
| 402 | + if ($options['blog_id']) { |
|
| 403 | 403 | |
| 404 | - switch_to_blog( $options['blog_id'] ); |
|
| 404 | + switch_to_blog($options['blog_id']); |
|
| 405 | 405 | |
| 406 | 406 | } |
| 407 | 407 | |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | |
| 413 | 413 | |
| 414 | 414 | // bail early if no updates |
| 415 | - if( empty($updates) ) { |
|
| 415 | + if (empty($updates)) { |
|
| 416 | 416 | |
| 417 | 417 | wp_send_json_error(array( |
| 418 | 418 | 'message' => 'No updates available' |
@@ -422,14 +422,14 @@ discard block |
||
| 422 | 422 | |
| 423 | 423 | |
| 424 | 424 | // install updates |
| 425 | - foreach( $updates as $version ) { |
|
| 425 | + foreach ($updates as $version) { |
|
| 426 | 426 | |
| 427 | 427 | // get path |
| 428 | 428 | $path = acf_get_path("admin/updates/{$version}.php"); |
| 429 | 429 | |
| 430 | 430 | |
| 431 | 431 | // load version |
| 432 | - if( !file_exists($path) ) { |
|
| 432 | + if ( ! file_exists($path)) { |
|
| 433 | 433 | |
| 434 | 434 | wp_send_json_error(array( |
| 435 | 435 | 'message' => 'Error loading update' |
@@ -443,15 +443,15 @@ discard block |
||
| 443 | 443 | |
| 444 | 444 | |
| 445 | 445 | // action for 3rd party |
| 446 | - do_action('acf/upgrade_start/' . $version ); |
|
| 446 | + do_action('acf/upgrade_start/'.$version); |
|
| 447 | 447 | |
| 448 | 448 | |
| 449 | 449 | // include |
| 450 | - include( $path ); |
|
| 450 | + include($path); |
|
| 451 | 451 | |
| 452 | 452 | |
| 453 | 453 | // action for 3rd party |
| 454 | - do_action('acf/upgrade_finish/' . $version ); |
|
| 454 | + do_action('acf/upgrade_finish/'.$version); |
|
| 455 | 455 | |
| 456 | 456 | |
| 457 | 457 | // get feedback |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | |
| 460 | 460 | |
| 461 | 461 | // update successful |
| 462 | - update_option('acf_version', $version ); |
|
| 462 | + update_option('acf_version', $version); |
|
| 463 | 463 | |
| 464 | 464 | } |
| 465 | 465 | |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly |
| 15 | -if( !defined('ABSPATH') ) exit; |
|
| 15 | +if ( ! defined('ABSPATH')) exit; |
|
| 16 | 16 | |
| 17 | 17 | |
| 18 | 18 | // global |
@@ -30,25 +30,25 @@ discard block |
||
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | // populate acfs |
| 33 | -if( $ofgs ){ foreach( $ofgs as $ofg ){ |
|
| 33 | +if ($ofgs) { foreach ($ofgs as $ofg) { |
|
| 34 | 34 | |
| 35 | 35 | // migrate field group |
| 36 | - $nfg = _migrate_field_group_500( $ofg ); |
|
| 36 | + $nfg = _migrate_field_group_500($ofg); |
|
| 37 | 37 | |
| 38 | 38 | |
| 39 | 39 | // get field from postmeta |
| 40 | - $rows = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE post_id = %d AND meta_key LIKE %s", $ofg->ID, 'field_%'), ARRAY_A); |
|
| 40 | + $rows = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE post_id = %d AND meta_key LIKE %s", $ofg->ID, 'field_%'), ARRAY_A); |
|
| 41 | 41 | |
| 42 | 42 | |
| 43 | - if( $rows ) |
|
| 43 | + if ($rows) |
|
| 44 | 44 | { |
| 45 | 45 | $nfg['fields'] = array(); |
| 46 | 46 | |
| 47 | - foreach( $rows as $row ) |
|
| 47 | + foreach ($rows as $row) |
|
| 48 | 48 | { |
| 49 | 49 | $field = $row['meta_value']; |
| 50 | - $field = maybe_unserialize( $field ); |
|
| 51 | - $field = maybe_unserialize( $field ); // run again for WPML |
|
| 50 | + $field = maybe_unserialize($field); |
|
| 51 | + $field = maybe_unserialize($field); // run again for WPML |
|
| 52 | 52 | |
| 53 | 53 | |
| 54 | 54 | // add parent |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | |
| 57 | 57 | |
| 58 | 58 | // migrate field |
| 59 | - $field = _migrate_field_500( $field ); |
|
| 59 | + $field = _migrate_field_500($field); |
|
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | * @return $post_id (int) |
| 77 | 77 | */ |
| 78 | 78 | |
| 79 | -function _migrate_field_group_500( $ofg ) { |
|
| 79 | +function _migrate_field_group_500($ofg) { |
|
| 80 | 80 | |
| 81 | 81 | // global |
| 82 | 82 | global $wpdb; |
@@ -101,11 +101,11 @@ discard block |
||
| 101 | 101 | // get all rules |
| 102 | 102 | $rules = get_post_meta($ofg->ID, 'rule', false); |
| 103 | 103 | |
| 104 | - if( is_array($rules) ) { |
|
| 104 | + if (is_array($rules)) { |
|
| 105 | 105 | |
| 106 | 106 | $group_no = 0; |
| 107 | 107 | |
| 108 | - foreach( $rules as $rule ) { |
|
| 108 | + foreach ($rules as $rule) { |
|
| 109 | 109 | |
| 110 | 110 | // if field group was duplicated, it may now be a serialized string! |
| 111 | 111 | $rule = maybe_unserialize($rule); |
@@ -113,12 +113,12 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | // does this rule have a group? |
| 115 | 115 | // + groups were added in 4.0.4 |
| 116 | - if( !isset($rule['group_no']) ) { |
|
| 116 | + if ( ! isset($rule['group_no'])) { |
|
| 117 | 117 | |
| 118 | 118 | $rule['group_no'] = $group_no; |
| 119 | 119 | |
| 120 | 120 | // sperate groups? |
| 121 | - if( get_post_meta($ofg->ID, 'allorany', true) == 'any' ) { |
|
| 121 | + if (get_post_meta($ofg->ID, 'allorany', true) == 'any') { |
|
| 122 | 122 | |
| 123 | 123 | $group_no++; |
| 124 | 124 | |
@@ -128,40 +128,40 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | |
| 130 | 130 | // extract vars |
| 131 | - $group = acf_extract_var( $rule, 'group_no' ); |
|
| 132 | - $order = acf_extract_var( $rule, 'order_no' ); |
|
| 131 | + $group = acf_extract_var($rule, 'group_no'); |
|
| 132 | + $order = acf_extract_var($rule, 'order_no'); |
|
| 133 | 133 | |
| 134 | 134 | |
| 135 | 135 | // add to group |
| 136 | - $groups[ $group ][ $order ] = $rule; |
|
| 136 | + $groups[$group][$order] = $rule; |
|
| 137 | 137 | |
| 138 | 138 | |
| 139 | 139 | // sort rules |
| 140 | - ksort( $groups[ $group ] ); |
|
| 140 | + ksort($groups[$group]); |
|
| 141 | 141 | |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | // sort groups |
| 145 | - ksort( $groups ); |
|
| 145 | + ksort($groups); |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | $nfg['location'] = $groups; |
| 149 | 149 | |
| 150 | 150 | |
| 151 | 151 | // settings |
| 152 | - if( $position = get_post_meta($ofg->ID, 'position', true) ) { |
|
| 152 | + if ($position = get_post_meta($ofg->ID, 'position', true)) { |
|
| 153 | 153 | |
| 154 | 154 | $nfg['position'] = $position; |
| 155 | 155 | |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | - if( $layout = get_post_meta($ofg->ID, 'layout', true) ) { |
|
| 158 | + if ($layout = get_post_meta($ofg->ID, 'layout', true)) { |
|
| 159 | 159 | |
| 160 | 160 | $nfg['layout'] = $layout; |
| 161 | 161 | |
| 162 | 162 | } |
| 163 | 163 | |
| 164 | - if( $hide_on_screen = get_post_meta($ofg->ID, 'hide_on_screen', true) ) { |
|
| 164 | + if ($hide_on_screen = get_post_meta($ofg->ID, 'hide_on_screen', true)) { |
|
| 165 | 165 | |
| 166 | 166 | $nfg['hide_on_screen'] = maybe_unserialize($hide_on_screen); |
| 167 | 167 | |
@@ -176,13 +176,13 @@ discard block |
||
| 176 | 176 | |
| 177 | 177 | |
| 178 | 178 | // save field group |
| 179 | - $nfg = acf_update_field_group( $nfg ); |
|
| 179 | + $nfg = acf_update_field_group($nfg); |
|
| 180 | 180 | |
| 181 | 181 | |
| 182 | 182 | // trash? |
| 183 | - if( $post_status == 'trash' ) { |
|
| 183 | + if ($post_status == 'trash') { |
|
| 184 | 184 | |
| 185 | - acf_trash_field_group( $nfg['ID'] ); |
|
| 185 | + acf_trash_field_group($nfg['ID']); |
|
| 186 | 186 | |
| 187 | 187 | } |
| 188 | 188 | |
@@ -205,60 +205,60 @@ discard block |
||
| 205 | 205 | * @return $post_id (int) |
| 206 | 206 | */ |
| 207 | 207 | |
| 208 | -function _migrate_field_500( $field ) { |
|
| 208 | +function _migrate_field_500($field) { |
|
| 209 | 209 | |
| 210 | 210 | // orig |
| 211 | 211 | $orig = $field; |
| 212 | 212 | |
| 213 | 213 | |
| 214 | 214 | // order_no is now menu_order |
| 215 | - $field['menu_order'] = acf_extract_var( $field, 'order_no' ); |
|
| 215 | + $field['menu_order'] = acf_extract_var($field, 'order_no'); |
|
| 216 | 216 | |
| 217 | 217 | |
| 218 | 218 | // correct very old field keys |
| 219 | - if( substr($field['key'], 0, 6) !== 'field_' ) { |
|
| 219 | + if (substr($field['key'], 0, 6) !== 'field_') { |
|
| 220 | 220 | |
| 221 | - $field['key'] = 'field_' . str_replace('field', '', $field['key']); |
|
| 221 | + $field['key'] = 'field_'.str_replace('field', '', $field['key']); |
|
| 222 | 222 | |
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | |
| 226 | 226 | // get valid field |
| 227 | - $field = acf_get_valid_field( $field ); |
|
| 227 | + $field = acf_get_valid_field($field); |
|
| 228 | 228 | |
| 229 | 229 | |
| 230 | 230 | // save field |
| 231 | - $field = acf_update_field( $field ); |
|
| 231 | + $field = acf_update_field($field); |
|
| 232 | 232 | |
| 233 | 233 | |
| 234 | 234 | // sub fields |
| 235 | - if( $field['type'] == 'repeater' ) { |
|
| 235 | + if ($field['type'] == 'repeater') { |
|
| 236 | 236 | |
| 237 | 237 | // get sub fields |
| 238 | - $sub_fields = acf_extract_var( $orig, 'sub_fields' ); |
|
| 238 | + $sub_fields = acf_extract_var($orig, 'sub_fields'); |
|
| 239 | 239 | |
| 240 | 240 | |
| 241 | 241 | // save sub fields |
| 242 | - if( !empty($sub_fields) ) { |
|
| 242 | + if ( ! empty($sub_fields)) { |
|
| 243 | 243 | |
| 244 | 244 | $keys = array_keys($sub_fields); |
| 245 | 245 | |
| 246 | - foreach( $keys as $key ) { |
|
| 246 | + foreach ($keys as $key) { |
|
| 247 | 247 | |
| 248 | 248 | $sub_field = acf_extract_var($sub_fields, $key); |
| 249 | 249 | $sub_field['parent'] = $field['ID']; |
| 250 | 250 | |
| 251 | - _migrate_field_500( $sub_field ); |
|
| 251 | + _migrate_field_500($sub_field); |
|
| 252 | 252 | |
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | } |
| 256 | 256 | |
| 257 | 257 | |
| 258 | - } elseif( $field['type'] == 'flexible_content' ) { |
|
| 258 | + } elseif ($field['type'] == 'flexible_content') { |
|
| 259 | 259 | |
| 260 | 260 | // get layouts |
| 261 | - $layouts = acf_extract_var( $orig, 'layouts' ); |
|
| 261 | + $layouts = acf_extract_var($orig, 'layouts'); |
|
| 262 | 262 | |
| 263 | 263 | |
| 264 | 264 | // update layouts |
@@ -266,9 +266,9 @@ discard block |
||
| 266 | 266 | |
| 267 | 267 | |
| 268 | 268 | // save sub fields |
| 269 | - if( !empty($layouts) ) { |
|
| 269 | + if ( ! empty($layouts)) { |
|
| 270 | 270 | |
| 271 | - foreach( $layouts as $layout ) { |
|
| 271 | + foreach ($layouts as $layout) { |
|
| 272 | 272 | |
| 273 | 273 | // vars |
| 274 | 274 | $layout_key = uniqid(); |
@@ -283,17 +283,17 @@ discard block |
||
| 283 | 283 | |
| 284 | 284 | |
| 285 | 285 | // save sub fields |
| 286 | - if( !empty($sub_fields) ) { |
|
| 286 | + if ( ! empty($sub_fields)) { |
|
| 287 | 287 | |
| 288 | 288 | $keys = array_keys($sub_fields); |
| 289 | 289 | |
| 290 | - foreach( $keys as $key ) { |
|
| 290 | + foreach ($keys as $key) { |
|
| 291 | 291 | |
| 292 | 292 | $sub_field = acf_extract_var($sub_fields, $key); |
| 293 | 293 | $sub_field['parent'] = $field['ID']; |
| 294 | 294 | $sub_field['parent_layout'] = $layout_key; |
| 295 | 295 | |
| 296 | - _migrate_field_500( $sub_field ); |
|
| 296 | + _migrate_field_500($sub_field); |
|
| 297 | 297 | |
| 298 | 298 | } |
| 299 | 299 | // foreach |
@@ -313,7 +313,7 @@ discard block |
||
| 313 | 313 | |
| 314 | 314 | |
| 315 | 315 | // save field again with less sub field data |
| 316 | - $field = acf_update_field( $field ); |
|
| 316 | + $field = acf_update_field($field); |
|
| 317 | 317 | |
| 318 | 318 | } |
| 319 | 319 | |
@@ -12,7 +12,9 @@ |
||
| 12 | 12 | */ |
| 13 | 13 | |
| 14 | 14 | // Exit if accessed directly |
| 15 | -if( !defined('ABSPATH') ) exit; |
|
| 15 | +if( !defined('ABSPATH') ) { |
|
| 16 | + exit; |
|
| 17 | +} |
|
| 16 | 18 | |
| 17 | 19 | |
| 18 | 20 | // global |
@@ -1,13 +1,13 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | // vars |
| 4 | -$field = acf_extract_var( $args, 'field'); |
|
| 5 | -$groups = acf_extract_var( $field, 'conditional_logic'); |
|
| 4 | +$field = acf_extract_var($args, 'field'); |
|
| 5 | +$groups = acf_extract_var($field, 'conditional_logic'); |
|
| 6 | 6 | $disabled = empty($groups) ? 1 : 0; |
| 7 | 7 | |
| 8 | 8 | |
| 9 | 9 | // UI needs at least 1 conditional logic rule |
| 10 | -if( empty($groups) ) { |
|
| 10 | +if (empty($groups)) { |
|
| 11 | 11 | |
| 12 | 12 | $groups = array( |
| 13 | 13 | |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | ?> |
| 27 | 27 | <tr data-name="conditional_logic" class="acf-field"> |
| 28 | 28 | <td class="acf-label"> |
| 29 | - <label><?php _e("Conditional Logic",'acf'); ?></label> |
|
| 29 | + <label><?php _e("Conditional Logic", 'acf'); ?></label> |
|
| 30 | 30 | </td> |
| 31 | 31 | <td class="acf-input"> |
| 32 | 32 | <?php |
@@ -37,20 +37,20 @@ discard block |
||
| 37 | 37 | 'prefix' => $field['prefix'], |
| 38 | 38 | 'value' => $disabled ? 0 : 1, |
| 39 | 39 | 'choices' => array( |
| 40 | - 1 => __("Yes",'acf'), |
|
| 41 | - 0 => __("No",'acf'), |
|
| 40 | + 1 => __("Yes", 'acf'), |
|
| 41 | + 0 => __("No", 'acf'), |
|
| 42 | 42 | ), |
| 43 | 43 | 'layout' => 'horizontal', |
| 44 | 44 | 'class' => 'conditional-toggle' |
| 45 | 45 | )); |
| 46 | 46 | |
| 47 | 47 | ?> |
| 48 | - <div class="rule-groups" <?php if($disabled): ?>style="display:none;"<?php endif; ?>> |
|
| 48 | + <div class="rule-groups" <?php if ($disabled): ?>style="display:none;"<?php endif; ?>> |
|
| 49 | 49 | |
| 50 | - <?php foreach( $groups as $group_id => $group ): |
|
| 50 | + <?php foreach ($groups as $group_id => $group): |
|
| 51 | 51 | |
| 52 | 52 | // validate |
| 53 | - if( empty($group) ) { |
|
| 53 | + if (empty($group)) { |
|
| 54 | 54 | |
| 55 | 55 | continue; |
| 56 | 56 | |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | // vars |
| 60 | 60 | // $group_id must be completely different to $rule_id to avoid JS issues |
| 61 | 61 | $group_id = "group_{$group_id}"; |
| 62 | - $h4 = ($group_id == "group_0") ? __("Show this field if",'acf') : __("or",'acf'); |
|
| 62 | + $h4 = ($group_id == "group_0") ? __("Show this field if", 'acf') : __("or", 'acf'); |
|
| 63 | 63 | |
| 64 | 64 | ?> |
| 65 | 65 | <div class="rule-group" data-id="<?php echo $group_id; ?>"> |
@@ -68,10 +68,10 @@ discard block |
||
| 68 | 68 | |
| 69 | 69 | <table class="acf-table -clear"> |
| 70 | 70 | <tbody> |
| 71 | - <?php foreach( $group as $rule_id => $rule ): |
|
| 71 | + <?php foreach ($group as $rule_id => $rule): |
|
| 72 | 72 | |
| 73 | 73 | // valid rule |
| 74 | - $rule = wp_parse_args( $rule, array( |
|
| 74 | + $rule = wp_parse_args($rule, array( |
|
| 75 | 75 | 'field' => '', |
| 76 | 76 | 'operator' => '==', |
| 77 | 77 | 'value' => '', |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | <?php |
| 90 | 90 | |
| 91 | 91 | $choices = array(); |
| 92 | - $choices[ $rule['field'] ] = $rule['field']; |
|
| 92 | + $choices[$rule['field']] = $rule['field']; |
|
| 93 | 93 | |
| 94 | 94 | // create field |
| 95 | 95 | acf_render_field(array( |
@@ -108,8 +108,8 @@ discard block |
||
| 108 | 108 | <?php |
| 109 | 109 | |
| 110 | 110 | $choices = array( |
| 111 | - '==' => __("is equal to",'acf'), |
|
| 112 | - '!=' => __("is not equal to",'acf'), |
|
| 111 | + '==' => __("is equal to", 'acf'), |
|
| 112 | + '!=' => __("is not equal to", 'acf'), |
|
| 113 | 113 | ); |
| 114 | 114 | |
| 115 | 115 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | <?php |
| 131 | 131 | |
| 132 | 132 | $choices = array(); |
| 133 | - $choices[ $rule['value'] ] = $rule['value']; |
|
| 133 | + $choices[$rule['value']] = $rule['value']; |
|
| 134 | 134 | |
| 135 | 135 | // create field |
| 136 | 136 | acf_render_field(array( |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | ?> |
| 147 | 147 | </td> |
| 148 | 148 | <td class="add"> |
| 149 | - <a href="#" class="acf-button add-conditional-rule"><?php _e("and",'acf'); ?></a> |
|
| 149 | + <a href="#" class="acf-button add-conditional-rule"><?php _e("and", 'acf'); ?></a> |
|
| 150 | 150 | </td> |
| 151 | 151 | <td class="remove"> |
| 152 | 152 | <a href="#" class="acf-icon -minus remove-conditional-rule"></a> |
@@ -159,9 +159,9 @@ discard block |
||
| 159 | 159 | </div> |
| 160 | 160 | <?php endforeach; ?> |
| 161 | 161 | |
| 162 | - <h4><?php _e("or",'acf'); ?></h4> |
|
| 162 | + <h4><?php _e("or", 'acf'); ?></h4> |
|
| 163 | 163 | |
| 164 | - <a href="#" class="acf-button add-conditional-group"><?php _e("Add rule group",'acf'); ?></a> |
|
| 164 | + <a href="#" class="acf-button add-conditional-group"><?php _e("Add rule group", 'acf'); ?></a> |
|
| 165 | 165 | |
| 166 | 166 | </div> |
| 167 | 167 | |
@@ -5,7 +5,7 @@ discard block |
||
| 5 | 5 | |
| 6 | 6 | |
| 7 | 7 | // extract args |
| 8 | -extract( $args ); |
|
| 8 | +extract($args); |
|
| 9 | 9 | |
| 10 | 10 | |
| 11 | 11 | // add prefix |
@@ -33,12 +33,12 @@ discard block |
||
| 33 | 33 | $atts['class'] = str_replace('_', '-', $atts['class']); |
| 34 | 34 | |
| 35 | 35 | ?> |
| 36 | -<div <?php echo acf_esc_attr( $atts ); ?>> |
|
| 36 | +<div <?php echo acf_esc_attr($atts); ?>> |
|
| 37 | 37 | |
| 38 | 38 | <div class="meta"> |
| 39 | - <?php foreach( $meta as $k => $v ): |
|
| 39 | + <?php foreach ($meta as $k => $v): |
|
| 40 | 40 | |
| 41 | - acf_hidden_input(array( 'class' => "input-{$k}", 'name' => "{$field['prefix']}[{$k}]", 'value' => $v )); |
|
| 41 | + acf_hidden_input(array('class' => "input-{$k}", 'name' => "{$field['prefix']}[{$k}]", 'value' => $v)); |
|
| 42 | 42 | |
| 43 | 43 | endforeach; ?> |
| 44 | 44 | </div> |
@@ -51,19 +51,19 @@ discard block |
||
| 51 | 51 | </li> |
| 52 | 52 | <li class="li-field-label"> |
| 53 | 53 | <strong> |
| 54 | - <a class="edit-field" title="<?php _e("Edit field",'acf'); ?>" href="#"><?php echo $field['label']; ?></a> |
|
| 55 | - <?php if( $field['required'] ): ?><span class="acf-required">*</span><?php endif; ?> |
|
| 54 | + <a class="edit-field" title="<?php _e("Edit field", 'acf'); ?>" href="#"><?php echo $field['label']; ?></a> |
|
| 55 | + <?php if ($field['required']): ?><span class="acf-required">*</span><?php endif; ?> |
|
| 56 | 56 | </strong> |
| 57 | 57 | <div class="row-options"> |
| 58 | - <a class="edit-field" title="<?php _e("Edit field",'acf'); ?>" href="#"><?php _e("Edit",'acf'); ?></a> |
|
| 59 | - <a class="duplicate-field" title="<?php _e("Duplicate field",'acf'); ?>" href="#"><?php _e("Duplicate",'acf'); ?></a> |
|
| 60 | - <a class="move-field" title="<?php _e("Move field to another group",'acf'); ?>" href="#"><?php _e("Move",'acf'); ?></a> |
|
| 61 | - <a class="delete-field" title="<?php _e("Delete field",'acf'); ?>" href="#"><?php _e("Delete",'acf'); ?></a> |
|
| 58 | + <a class="edit-field" title="<?php _e("Edit field", 'acf'); ?>" href="#"><?php _e("Edit", 'acf'); ?></a> |
|
| 59 | + <a class="duplicate-field" title="<?php _e("Duplicate field", 'acf'); ?>" href="#"><?php _e("Duplicate", 'acf'); ?></a> |
|
| 60 | + <a class="move-field" title="<?php _e("Move field to another group", 'acf'); ?>" href="#"><?php _e("Move", 'acf'); ?></a> |
|
| 61 | + <a class="delete-field" title="<?php _e("Delete field", 'acf'); ?>" href="#"><?php _e("Delete", 'acf'); ?></a> |
|
| 62 | 62 | </div> |
| 63 | 63 | </li> |
| 64 | 64 | <li class="li-field-name"><?php echo $field['name']; ?></li> |
| 65 | 65 | <li class="li-field-type"> |
| 66 | - <?php if( acf_field_type_exists($field['type']) ): ?> |
|
| 66 | + <?php if (acf_field_type_exists($field['type'])): ?> |
|
| 67 | 67 | <?php echo acf_get_field_type_label($field['type']); ?> |
| 68 | 68 | <?php else: ?> |
| 69 | 69 | <b><?php _e('Error', 'acf'); ?></b> <?php _e('Field type does not exist', 'acf'); ?> |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | |
| 80 | 80 | // label |
| 81 | 81 | acf_render_field_wrap(array( |
| 82 | - 'label' => __('Field Label','acf'), |
|
| 83 | - 'instructions' => __('This is the name which will appear on the EDIT page','acf'), |
|
| 82 | + 'label' => __('Field Label', 'acf'), |
|
| 83 | + 'instructions' => __('This is the name which will appear on the EDIT page', 'acf'), |
|
| 84 | 84 | 'required' => 1, |
| 85 | 85 | 'type' => 'text', |
| 86 | 86 | 'name' => 'label', |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | |
| 93 | 93 | // name |
| 94 | 94 | acf_render_field_wrap(array( |
| 95 | - 'label' => __('Field Name','acf'), |
|
| 96 | - 'instructions' => __('Single word, no spaces. Underscores and dashes allowed','acf'), |
|
| 95 | + 'label' => __('Field Name', 'acf'), |
|
| 96 | + 'instructions' => __('Single word, no spaces. Underscores and dashes allowed', 'acf'), |
|
| 97 | 97 | 'required' => 1, |
| 98 | 98 | 'type' => 'text', |
| 99 | 99 | 'name' => 'name', |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | // type |
| 107 | 107 | acf_render_field_wrap(array( |
| 108 | - 'label' => __('Field Type','acf'), |
|
| 108 | + 'label' => __('Field Type', 'acf'), |
|
| 109 | 109 | 'instructions' => '', |
| 110 | 110 | 'required' => 1, |
| 111 | 111 | 'type' => 'select', |
@@ -119,8 +119,8 @@ discard block |
||
| 119 | 119 | |
| 120 | 120 | // instructions |
| 121 | 121 | acf_render_field_wrap(array( |
| 122 | - 'label' => __('Instructions','acf'), |
|
| 123 | - 'instructions' => __('Instructions for authors. Shown when submitting data','acf'), |
|
| 122 | + 'label' => __('Instructions', 'acf'), |
|
| 123 | + 'instructions' => __('Instructions for authors. Shown when submitting data', 'acf'), |
|
| 124 | 124 | 'type' => 'textarea', |
| 125 | 125 | 'name' => 'instructions', |
| 126 | 126 | 'prefix' => $field['prefix'], |
@@ -131,15 +131,15 @@ discard block |
||
| 131 | 131 | |
| 132 | 132 | // required |
| 133 | 133 | acf_render_field_wrap(array( |
| 134 | - 'label' => __('Required?','acf'), |
|
| 134 | + 'label' => __('Required?', 'acf'), |
|
| 135 | 135 | 'instructions' => '', |
| 136 | 136 | 'type' => 'radio', |
| 137 | 137 | 'name' => 'required', |
| 138 | 138 | 'prefix' => $field['prefix'], |
| 139 | 139 | 'value' => $field['required'], |
| 140 | 140 | 'choices' => array( |
| 141 | - 1 => __("Yes",'acf'), |
|
| 142 | - 0 => __("No",'acf'), |
|
| 141 | + 1 => __("Yes", 'acf'), |
|
| 142 | + 0 => __("No", 'acf'), |
|
| 143 | 143 | ), |
| 144 | 144 | 'layout' => 'horizontal', |
| 145 | 145 | 'class' => 'field-required' |
@@ -155,16 +155,16 @@ discard block |
||
| 155 | 155 | |
| 156 | 156 | |
| 157 | 157 | // conditional logic |
| 158 | - acf_get_view('field-group-field-conditional-logic', array( 'field' => $field )); |
|
| 158 | + acf_get_view('field-group-field-conditional-logic', array('field' => $field)); |
|
| 159 | 159 | |
| 160 | 160 | |
| 161 | 161 | // wrapper |
| 162 | 162 | acf_render_field_wrap(array( |
| 163 | - 'label' => __('Wrapper Attributes','acf'), |
|
| 163 | + 'label' => __('Wrapper Attributes', 'acf'), |
|
| 164 | 164 | 'instructions' => '', |
| 165 | 165 | 'type' => 'text', |
| 166 | 166 | 'name' => 'width', |
| 167 | - 'prefix' => $field['prefix'] . '[wrapper]', |
|
| 167 | + 'prefix' => $field['prefix'].'[wrapper]', |
|
| 168 | 168 | 'value' => $field['wrapper']['width'], |
| 169 | 169 | 'prepend' => __('width', 'acf'), |
| 170 | 170 | 'append' => '%', |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | 'instructions' => '', |
| 179 | 179 | 'type' => 'text', |
| 180 | 180 | 'name' => 'class', |
| 181 | - 'prefix' => $field['prefix'] . '[wrapper]', |
|
| 181 | + 'prefix' => $field['prefix'].'[wrapper]', |
|
| 182 | 182 | 'value' => $field['wrapper']['class'], |
| 183 | 183 | 'prepend' => __('class', 'acf'), |
| 184 | 184 | 'wrapper' => array( |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | 'instructions' => '', |
| 192 | 192 | 'type' => 'text', |
| 193 | 193 | 'name' => 'id', |
| 194 | - 'prefix' => $field['prefix'] . '[wrapper]', |
|
| 194 | + 'prefix' => $field['prefix'].'[wrapper]', |
|
| 195 | 195 | 'value' => $field['wrapper']['id'], |
| 196 | 196 | 'prepend' => __('id', 'acf'), |
| 197 | 197 | 'wrapper' => array( |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | <td class="acf-input"> |
| 206 | 206 | <ul class="acf-hl"> |
| 207 | 207 | <li> |
| 208 | - <a class="edit-field acf-button grey" title="<?php _e("Close Field",'acf'); ?>" href="#"><?php _e("Close Field",'acf'); ?></a> |
|
| 208 | + <a class="edit-field acf-button grey" title="<?php _e("Close Field", 'acf'); ?>" href="#"><?php _e("Close Field", 'acf'); ?></a> |
|
| 209 | 209 | </li> |
| 210 | 210 | </ul> |
| 211 | 211 | </td> |
@@ -65,8 +65,11 @@ |
||
| 65 | 65 | <li class="li-field-type"> |
| 66 | 66 | <?php if( acf_field_type_exists($field['type']) ): ?> |
| 67 | 67 | <?php echo acf_get_field_type_label($field['type']); ?> |
| 68 | - <?php else: ?> |
|
| 69 | - <b><?php _e('Error', 'acf'); ?></b> <?php _e('Field type does not exist', 'acf'); ?> |
|
| 68 | + <?php else { |
|
| 69 | + : ?> |
|
| 70 | + <b><?php _e('Error', 'acf'); |
|
| 71 | +} |
|
| 72 | +?></b> <?php _e('Field type does not exist', 'acf'); ?> |
|
| 70 | 73 | <?php endif; ?> |
| 71 | 74 | </li> |
| 72 | 75 | </ul> |
@@ -8,14 +8,14 @@ discard block |
||
| 8 | 8 | |
| 9 | 9 | |
| 10 | 10 | // use fields if passed in |
| 11 | -extract( $args ); |
|
| 11 | +extract($args); |
|
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | // add clone |
| 15 | 15 | $fields[] = acf_get_valid_field(array( |
| 16 | 16 | 'ID' => 'acfcloneindex', |
| 17 | 17 | 'key' => 'acfcloneindex', |
| 18 | - 'label' => __('New Field','acf'), |
|
| 18 | + 'label' => __('New Field', 'acf'), |
|
| 19 | 19 | 'name' => 'new_field', |
| 20 | 20 | 'type' => 'text', |
| 21 | 21 | 'parent' => $parent |
@@ -26,32 +26,32 @@ discard block |
||
| 26 | 26 | <div class="acf-field-list-wrap"> |
| 27 | 27 | |
| 28 | 28 | <ul class="acf-hl acf-thead"> |
| 29 | - <li class="li-field-order"><?php _e('Order','acf'); ?></li> |
|
| 30 | - <li class="li-field-label"><?php _e('Label','acf'); ?></li> |
|
| 31 | - <li class="li-field-name"><?php _e('Name','acf'); ?></li> |
|
| 32 | - <li class="li-field-type"><?php _e('Type','acf'); ?></li> |
|
| 29 | + <li class="li-field-order"><?php _e('Order', 'acf'); ?></li> |
|
| 30 | + <li class="li-field-label"><?php _e('Label', 'acf'); ?></li> |
|
| 31 | + <li class="li-field-name"><?php _e('Name', 'acf'); ?></li> |
|
| 32 | + <li class="li-field-type"><?php _e('Type', 'acf'); ?></li> |
|
| 33 | 33 | </ul> |
| 34 | 34 | |
| 35 | - <div class="acf-field-list<?php if( $layout ){ echo " layout-{$layout}"; } ?>"> |
|
| 35 | + <div class="acf-field-list<?php if ($layout) { echo " layout-{$layout}"; } ?>"> |
|
| 36 | 36 | |
| 37 | - <?php foreach( $fields as $i => $field ): ?> |
|
| 37 | + <?php foreach ($fields as $i => $field): ?> |
|
| 38 | 38 | |
| 39 | - <?php acf_get_view('field-group-field', array( 'field' => $field, 'i' => $i )); ?> |
|
| 39 | + <?php acf_get_view('field-group-field', array('field' => $field, 'i' => $i)); ?> |
|
| 40 | 40 | |
| 41 | 41 | <?php endforeach; ?> |
| 42 | 42 | |
| 43 | - <div class="no-fields-message" <?php if(count($fields) > 1){ echo 'style="display:none;"'; } ?>> |
|
| 44 | - <?php _e("No fields. Click the <strong>+ Add Field</strong> button to create your first field.",'acf'); ?> |
|
| 43 | + <div class="no-fields-message" <?php if (count($fields) > 1) { echo 'style="display:none;"'; } ?>> |
|
| 44 | + <?php _e("No fields. Click the <strong>+ Add Field</strong> button to create your first field.", 'acf'); ?> |
|
| 45 | 45 | </div> |
| 46 | 46 | |
| 47 | 47 | </div> |
| 48 | 48 | |
| 49 | 49 | <ul class="acf-hl acf-tfoot"> |
| 50 | 50 | <li class="comic-sans"> |
| 51 | - <i class="acf-icon -arrow-combo"></i><?php _e('Drag and drop to reorder','acf'); ?> |
|
| 51 | + <i class="acf-icon -arrow-combo"></i><?php _e('Drag and drop to reorder', 'acf'); ?> |
|
| 52 | 52 | </li> |
| 53 | 53 | <li class="acf-fr"> |
| 54 | - <a href="#" class="acf-button blue add-field"><?php _e('+ Add Field','acf'); ?></a> |
|
| 54 | + <a href="#" class="acf-button blue add-field"><?php _e('+ Add Field', 'acf'); ?></a> |
|
| 55 | 55 | </li> |
| 56 | 56 | </ul> |
| 57 | 57 | |