@@ -139,19 +139,19 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public function __construct( $config, $object_id = 0 ) { |
| 141 | 141 | |
| 142 | - if ( empty( $config['id'] ) ) { |
|
| 142 | + if ( empty( $config[ 'id' ] ) ) { |
|
| 143 | 143 | wp_die( esc_html__( 'Metabox configuration is required to have an ID parameter.', 'cmb2' ) ); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | $this->meta_box = wp_parse_args( $config, $this->mb_defaults ); |
| 147 | - $this->meta_box['fields'] = array(); |
|
| 147 | + $this->meta_box[ 'fields' ] = array(); |
|
| 148 | 148 | |
| 149 | 149 | $this->object_id( $object_id ); |
| 150 | 150 | $this->mb_object_type(); |
| 151 | - $this->cmb_id = $config['id']; |
|
| 151 | + $this->cmb_id = $config[ 'id' ]; |
|
| 152 | 152 | |
| 153 | - if ( ! empty( $config['fields'] ) && is_array( $config['fields'] ) ) { |
|
| 154 | - $this->add_fields( $config['fields'] ); |
|
| 153 | + if ( ! empty( $config[ 'fields' ] ) && is_array( $config[ 'fields' ] ) ) { |
|
| 154 | + $this->add_fields( $config[ 'fields' ] ); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | CMB2_Boxes::add( $this ); |
@@ -261,17 +261,17 @@ discard block |
||
| 261 | 261 | |
| 262 | 262 | // Include custom class if requesting no title. |
| 263 | 263 | if ( ! $this->prop( 'title' ) && ! $this->prop( 'remove_box_wrap' ) ) { |
| 264 | - $context[] = 'cmb2-context-wrap-no-title'; |
|
| 264 | + $context[ ] = 'cmb2-context-wrap-no-title'; |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | // Include a generic context wrapper. |
| 268 | - $context[] = 'cmb2-context-wrap'; |
|
| 268 | + $context[ ] = 'cmb2-context-wrap'; |
|
| 269 | 269 | |
| 270 | 270 | // Include a context-type based context wrapper. |
| 271 | - $context[] = 'cmb2-context-wrap-' . $this->prop( 'context' ); |
|
| 271 | + $context[ ] = 'cmb2-context-wrap-' . $this->prop( 'context' ); |
|
| 272 | 272 | |
| 273 | 273 | // Include an ID based context wrapper as well. |
| 274 | - $context[] = 'cmb2-context-wrap-' . $this->prop( 'id' ); |
|
| 274 | + $context[ ] = 'cmb2-context-wrap-' . $this->prop( 'id' ); |
|
| 275 | 275 | |
| 276 | 276 | // And merge all the classes back into the array. |
| 277 | 277 | $classes = array_merge( $classes, $context ); |
@@ -352,22 +352,22 @@ discard block |
||
| 352 | 352 | * @return mixed CMB2_Field object if successful. |
| 353 | 353 | */ |
| 354 | 354 | public function render_field( $field_args ) { |
| 355 | - $field_args['context'] = $this->prop( 'context' ); |
|
| 355 | + $field_args[ 'context' ] = $this->prop( 'context' ); |
|
| 356 | 356 | |
| 357 | - if ( 'group' === $field_args['type'] ) { |
|
| 357 | + if ( 'group' === $field_args[ 'type' ] ) { |
|
| 358 | 358 | |
| 359 | - if ( ! isset( $field_args['show_names'] ) ) { |
|
| 360 | - $field_args['show_names'] = $this->prop( 'show_names' ); |
|
| 359 | + if ( ! isset( $field_args[ 'show_names' ] ) ) { |
|
| 360 | + $field_args[ 'show_names' ] = $this->prop( 'show_names' ); |
|
| 361 | 361 | } |
| 362 | 362 | $field = $this->render_group( $field_args ); |
| 363 | 363 | |
| 364 | - } elseif ( 'hidden' === $field_args['type'] && $this->get_field( $field_args )->should_show() ) { |
|
| 364 | + } elseif ( 'hidden' === $field_args[ 'type' ] && $this->get_field( $field_args )->should_show() ) { |
|
| 365 | 365 | // Save rendering for after the metabox. |
| 366 | 366 | $field = $this->add_hidden_field( $field_args ); |
| 367 | 367 | |
| 368 | 368 | } else { |
| 369 | 369 | |
| 370 | - $field_args['show_names'] = $this->prop( 'show_names' ); |
|
| 370 | + $field_args[ 'show_names' ] = $this->prop( 'show_names' ); |
|
| 371 | 371 | |
| 372 | 372 | // Render default fields. |
| 373 | 373 | $field = $this->get_field( $field_args )->render_field(); |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | */ |
| 385 | 385 | public function render_group( $args ) { |
| 386 | 386 | |
| 387 | - if ( ! isset( $args['id'], $args['fields'] ) || ! is_array( $args['fields'] ) ) { |
|
| 387 | + if ( ! isset( $args[ 'id' ], $args[ 'fields' ] ) || ! is_array( $args[ 'fields' ] ) ) { |
|
| 388 | 388 | return; |
| 389 | 389 | } |
| 390 | 390 | |
@@ -496,15 +496,15 @@ discard block |
||
| 496 | 496 | <div class="inside cmb-td cmb-nested cmb-field-list">'; |
| 497 | 497 | // Loop and render repeatable group fields. |
| 498 | 498 | foreach ( array_values( $field_group->args( 'fields' ) ) as $field_args ) { |
| 499 | - if ( 'hidden' === $field_args['type'] ) { |
|
| 499 | + if ( 'hidden' === $field_args[ 'type' ] ) { |
|
| 500 | 500 | |
| 501 | 501 | // Save rendering for after the metabox. |
| 502 | 502 | $this->add_hidden_field( $field_args, $field_group ); |
| 503 | 503 | |
| 504 | 504 | } else { |
| 505 | 505 | |
| 506 | - $field_args['show_names'] = $field_group->args( 'show_names' ); |
|
| 507 | - $field_args['context'] = $field_group->args( 'context' ); |
|
| 506 | + $field_args[ 'show_names' ] = $field_group->args( 'show_names' ); |
|
| 507 | + $field_args[ 'context' ] = $field_group->args( 'context' ); |
|
| 508 | 508 | |
| 509 | 509 | $field = $this->get_field( $field_args, $field_group )->render_field(); |
| 510 | 510 | } |
@@ -534,7 +534,7 @@ discard block |
||
| 534 | 534 | * @param CMB2_Field|null $field_group CMB2_Field group field object. |
| 535 | 535 | */ |
| 536 | 536 | public function add_hidden_field( $field_args, $field_group = null ) { |
| 537 | - if ( isset( $field_args['field_args'] ) ) { |
|
| 537 | + if ( isset( $field_args[ 'field_args' ] ) ) { |
|
| 538 | 538 | // For back-compatibility. |
| 539 | 539 | $field = new CMB2_Field( $field_args ); |
| 540 | 540 | } else { |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | $types->iterator = $field_group->index; |
| 548 | 548 | } |
| 549 | 549 | |
| 550 | - $this->hidden_fields[] = $types; |
|
| 550 | + $this->hidden_fields[ ] = $types; |
|
| 551 | 551 | |
| 552 | 552 | return $field; |
| 553 | 553 | } |
@@ -655,11 +655,11 @@ discard block |
||
| 655 | 655 | */ |
| 656 | 656 | public function process_field( $field_args ) { |
| 657 | 657 | |
| 658 | - switch ( $field_args['type'] ) { |
|
| 658 | + switch ( $field_args[ 'type' ] ) { |
|
| 659 | 659 | |
| 660 | 660 | case 'group': |
| 661 | 661 | if ( $this->save_group( $field_args ) ) { |
| 662 | - $this->updated[] = $field_args['id']; |
|
| 662 | + $this->updated[ ] = $field_args[ 'id' ]; |
|
| 663 | 663 | } |
| 664 | 664 | |
| 665 | 665 | break; |
@@ -673,7 +673,7 @@ discard block |
||
| 673 | 673 | $field = $this->get_new_field( $field_args ); |
| 674 | 674 | |
| 675 | 675 | if ( $field->save_field_from_data( $this->data_to_save ) ) { |
| 676 | - $this->updated[] = $field->id(); |
|
| 676 | + $this->updated[ ] = $field->id(); |
|
| 677 | 677 | } |
| 678 | 678 | |
| 679 | 679 | break; |
@@ -756,7 +756,7 @@ discard block |
||
| 756 | 756 | * @return mixed Return of CMB2_Field::update_data(). |
| 757 | 757 | */ |
| 758 | 758 | public function save_group( $args ) { |
| 759 | - if ( ! isset( $args['id'], $args['fields'] ) || ! is_array( $args['fields'] ) ) { |
|
| 759 | + if ( ! isset( $args[ 'id' ], $args[ 'fields' ] ) || ! is_array( $args[ 'fields' ] ) ) { |
|
| 760 | 760 | return; |
| 761 | 761 | } |
| 762 | 762 | |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | $field_group->data_to_save = $this->data_to_save; |
| 787 | 787 | |
| 788 | 788 | foreach ( array_values( $field_group->fields() ) as $field_args ) { |
| 789 | - if ( 'title' === $field_args['type'] ) { |
|
| 789 | + if ( 'title' === $field_args[ 'type' ] ) { |
|
| 790 | 790 | // Don't process title fields. |
| 791 | 791 | continue; |
| 792 | 792 | } |
@@ -809,16 +809,16 @@ discard block |
||
| 809 | 809 | $_new_val = array(); |
| 810 | 810 | foreach ( $new_val as $group_index => $grouped_data ) { |
| 811 | 811 | // Add the supporting data to the $saved array stack. |
| 812 | - $saved[ $field_group->index ][ $grouped_data['supporting_field_id'] ][] = $grouped_data['supporting_field_value']; |
|
| 812 | + $saved[ $field_group->index ][ $grouped_data[ 'supporting_field_id' ] ][ ] = $grouped_data[ 'supporting_field_value' ]; |
|
| 813 | 813 | // Reset var to the actual value. |
| 814 | - $_new_val[ $group_index ] = $grouped_data['value']; |
|
| 814 | + $_new_val[ $group_index ] = $grouped_data[ 'value' ]; |
|
| 815 | 815 | } |
| 816 | 816 | $new_val = $_new_val; |
| 817 | 817 | } else { |
| 818 | 818 | // Add the supporting data to the $saved array stack. |
| 819 | - $saved[ $field_group->index ][ $new_val['supporting_field_id'] ] = $new_val['supporting_field_value']; |
|
| 819 | + $saved[ $field_group->index ][ $new_val[ 'supporting_field_id' ] ] = $new_val[ 'supporting_field_value' ]; |
|
| 820 | 820 | // Reset var to the actual value. |
| 821 | - $new_val = $new_val['value']; |
|
| 821 | + $new_val = $new_val[ 'value' ]; |
|
| 822 | 822 | } |
| 823 | 823 | } |
| 824 | 824 | |
@@ -832,7 +832,7 @@ discard block |
||
| 832 | 832 | |
| 833 | 833 | // Compare values and add to `$updated` array. |
| 834 | 834 | if ( $is_updated || $is_removed ) { |
| 835 | - $this->updated[] = $base_id . '::' . $field_group->index . '::' . $sub_id; |
|
| 835 | + $this->updated[ ] = $base_id . '::' . $field_group->index . '::' . $sub_id; |
|
| 836 | 836 | } |
| 837 | 837 | |
| 838 | 838 | // Add to `$saved` array. |
@@ -870,22 +870,22 @@ discard block |
||
| 870 | 870 | // Try to get our object ID from the global space. |
| 871 | 871 | switch ( $this->object_type() ) { |
| 872 | 872 | case 'user': |
| 873 | - $object_id = isset( $_REQUEST['user_id'] ) ? wp_unslash( $_REQUEST['user_id'] ) : $object_id; |
|
| 874 | - $object_id = ! $object_id && 'user-new.php' !== $pagenow && isset( $GLOBALS['user_ID'] ) ? $GLOBALS['user_ID'] : $object_id; |
|
| 873 | + $object_id = isset( $_REQUEST[ 'user_id' ] ) ? wp_unslash( $_REQUEST[ 'user_id' ] ) : $object_id; |
|
| 874 | + $object_id = ! $object_id && 'user-new.php' !== $pagenow && isset( $GLOBALS[ 'user_ID' ] ) ? $GLOBALS[ 'user_ID' ] : $object_id; |
|
| 875 | 875 | break; |
| 876 | 876 | |
| 877 | 877 | case 'comment': |
| 878 | - $object_id = isset( $_REQUEST['c'] ) ? wp_unslash( $_REQUEST['c'] ) : $object_id; |
|
| 879 | - $object_id = ! $object_id && isset( $GLOBALS['comments']->comment_ID ) ? $GLOBALS['comments']->comment_ID : $object_id; |
|
| 878 | + $object_id = isset( $_REQUEST[ 'c' ] ) ? wp_unslash( $_REQUEST[ 'c' ] ) : $object_id; |
|
| 879 | + $object_id = ! $object_id && isset( $GLOBALS[ 'comments' ]->comment_ID ) ? $GLOBALS[ 'comments' ]->comment_ID : $object_id; |
|
| 880 | 880 | break; |
| 881 | 881 | |
| 882 | 882 | case 'term': |
| 883 | - $object_id = isset( $_REQUEST['tag_ID'] ) ? wp_unslash( $_REQUEST['tag_ID'] ) : $object_id; |
|
| 883 | + $object_id = isset( $_REQUEST[ 'tag_ID' ] ) ? wp_unslash( $_REQUEST[ 'tag_ID' ] ) : $object_id; |
|
| 884 | 884 | break; |
| 885 | 885 | |
| 886 | 886 | default: |
| 887 | - $object_id = isset( $GLOBALS['post']->ID ) ? $GLOBALS['post']->ID : $object_id; |
|
| 888 | - $object_id = isset( $_REQUEST['post'] ) ? wp_unslash( $_REQUEST['post'] ) : $object_id; |
|
| 887 | + $object_id = isset( $GLOBALS[ 'post' ]->ID ) ? $GLOBALS[ 'post' ]->ID : $object_id; |
|
| 888 | + $object_id = isset( $_REQUEST[ 'post' ] ) ? wp_unslash( $_REQUEST[ 'post' ] ) : $object_id; |
|
| 889 | 889 | break; |
| 890 | 890 | } |
| 891 | 891 | |
@@ -959,7 +959,7 @@ discard block |
||
| 959 | 959 | * @return boolean True/False. |
| 960 | 960 | */ |
| 961 | 961 | public function is_options_page_mb() { |
| 962 | - return ( isset( $this->meta_box['show_on']['key'] ) && 'options-page' === $this->meta_box['show_on']['key'] || array_key_exists( 'options-page', $this->meta_box['show_on'] ) ); |
|
| 962 | + return ( isset( $this->meta_box[ 'show_on' ][ 'key' ] ) && 'options-page' === $this->meta_box[ 'show_on' ][ 'key' ] || array_key_exists( 'options-page', $this->meta_box[ 'show_on' ] ) ); |
|
| 963 | 963 | } |
| 964 | 964 | |
| 965 | 965 | /** |
@@ -1006,7 +1006,7 @@ discard block |
||
| 1006 | 1006 | $type = 'term'; |
| 1007 | 1007 | } |
| 1008 | 1008 | |
| 1009 | - if ( defined( 'DOING_AJAX' ) && isset( $_POST['action'] ) && 'add-tag' === $_POST['action'] ) { |
|
| 1009 | + if ( defined( 'DOING_AJAX' ) && isset( $_POST[ 'action' ] ) && 'add-tag' === $_POST[ 'action' ] ) { |
|
| 1010 | 1010 | $type = 'term'; |
| 1011 | 1011 | } |
| 1012 | 1012 | |
@@ -1056,7 +1056,7 @@ discard block |
||
| 1056 | 1056 | return $field; |
| 1057 | 1057 | } |
| 1058 | 1058 | |
| 1059 | - $field_id = is_string( $field ) ? $field : $field['id']; |
|
| 1059 | + $field_id = is_string( $field ) ? $field : $field[ 'id' ]; |
|
| 1060 | 1060 | |
| 1061 | 1061 | $parent_field_id = ! empty( $field_group ) ? $field_group->id() : ''; |
| 1062 | 1062 | $ids = $this->get_field_ids( $field_id, $parent_field_id ); |
@@ -1093,16 +1093,16 @@ discard block |
||
| 1093 | 1093 | if ( $field_group && ( $sub_field_id || 0 === $sub_field_id ) ) { |
| 1094 | 1094 | |
| 1095 | 1095 | // Update the fields array w/ any modified properties inherited from the group field. |
| 1096 | - $this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ] = $field_args; |
|
| 1096 | + $this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ] = $field_args; |
|
| 1097 | 1097 | |
| 1098 | 1098 | return $this->get_default_args( $field_args, $field_group ); |
| 1099 | 1099 | } |
| 1100 | 1100 | |
| 1101 | 1101 | if ( is_array( $field_args ) ) { |
| 1102 | - $this->meta_box['fields'][ $field_id ] = array_merge( $field_args, $this->meta_box['fields'][ $field_id ] ); |
|
| 1102 | + $this->meta_box[ 'fields' ][ $field_id ] = array_merge( $field_args, $this->meta_box[ 'fields' ][ $field_id ] ); |
|
| 1103 | 1103 | } |
| 1104 | 1104 | |
| 1105 | - return $this->get_default_args( $this->meta_box['fields'][ $field_id ] ); |
|
| 1105 | + return $this->get_default_args( $this->meta_box[ 'fields' ][ $field_id ] ); |
|
| 1106 | 1106 | } |
| 1107 | 1107 | |
| 1108 | 1108 | /** |
@@ -1155,8 +1155,8 @@ discard block |
||
| 1155 | 1155 | |
| 1156 | 1156 | $sub_fields = false; |
| 1157 | 1157 | if ( array_key_exists( 'fields', $field ) ) { |
| 1158 | - $sub_fields = $field['fields']; |
|
| 1159 | - unset( $field['fields'] ); |
|
| 1158 | + $sub_fields = $field[ 'fields' ]; |
|
| 1159 | + unset( $field[ 'fields' ] ); |
|
| 1160 | 1160 | } |
| 1161 | 1161 | |
| 1162 | 1162 | $field_id = $parent_field_id |
@@ -1183,7 +1183,7 @@ discard block |
||
| 1183 | 1183 | } |
| 1184 | 1184 | |
| 1185 | 1185 | // Perform some field-type-specific initiation actions. |
| 1186 | - switch ( $field['type'] ) { |
|
| 1186 | + switch ( $field[ 'type' ] ) { |
|
| 1187 | 1187 | case 'file': |
| 1188 | 1188 | case 'file_list': |
| 1189 | 1189 | |
@@ -1198,21 +1198,21 @@ discard block |
||
| 1198 | 1198 | break; |
| 1199 | 1199 | } |
| 1200 | 1200 | |
| 1201 | - if ( isset( $field['column'] ) && false !== $field['column'] ) { |
|
| 1201 | + if ( isset( $field[ 'column' ] ) && false !== $field[ 'column' ] ) { |
|
| 1202 | 1202 | $field = $this->define_field_column( $field ); |
| 1203 | 1203 | } |
| 1204 | 1204 | |
| 1205 | - if ( isset( $field['taxonomy'] ) && ! empty( $field['remove_default'] ) ) { |
|
| 1206 | - $this->tax_metaboxes_to_remove[ $field['taxonomy'] ] = $field['taxonomy']; |
|
| 1205 | + if ( isset( $field[ 'taxonomy' ] ) && ! empty( $field[ 'remove_default' ] ) ) { |
|
| 1206 | + $this->tax_metaboxes_to_remove[ $field[ 'taxonomy' ] ] = $field[ 'taxonomy' ]; |
|
| 1207 | 1207 | } |
| 1208 | 1208 | |
| 1209 | 1209 | $this->_add_field_to_array( |
| 1210 | 1210 | $field, |
| 1211 | - $this->meta_box['fields'], |
|
| 1211 | + $this->meta_box[ 'fields' ], |
|
| 1212 | 1212 | $position |
| 1213 | 1213 | ); |
| 1214 | 1214 | |
| 1215 | - return $field['id']; |
|
| 1215 | + return $field[ 'id' ]; |
|
| 1216 | 1216 | } |
| 1217 | 1217 | |
| 1218 | 1218 | /** |
@@ -1225,10 +1225,10 @@ discard block |
||
| 1225 | 1225 | protected function define_field_column( array $field ) { |
| 1226 | 1226 | $this->has_columns = true; |
| 1227 | 1227 | |
| 1228 | - $column = is_array( $field['column'] ) ? $field['column'] : array(); |
|
| 1228 | + $column = is_array( $field[ 'column' ] ) ? $field[ 'column' ] : array(); |
|
| 1229 | 1229 | |
| 1230 | - $field['column'] = wp_parse_args( $column, array( |
|
| 1231 | - 'name' => isset( $field['name'] ) ? $field['name'] : '', |
|
| 1230 | + $field[ 'column' ] = wp_parse_args( $column, array( |
|
| 1231 | + 'name' => isset( $field[ 'name' ] ) ? $field[ 'name' ] : '', |
|
| 1232 | 1232 | 'position' => false, |
| 1233 | 1233 | ) ); |
| 1234 | 1234 | |
@@ -1245,27 +1245,27 @@ discard block |
||
| 1245 | 1245 | * @return mixed Array of parent/field ids or false. |
| 1246 | 1246 | */ |
| 1247 | 1247 | public function add_group_field( $parent_field_id, array $field, $position = 0 ) { |
| 1248 | - if ( ! array_key_exists( $parent_field_id, $this->meta_box['fields'] ) ) { |
|
| 1248 | + if ( ! array_key_exists( $parent_field_id, $this->meta_box[ 'fields' ] ) ) { |
|
| 1249 | 1249 | return false; |
| 1250 | 1250 | } |
| 1251 | 1251 | |
| 1252 | - $parent_field = $this->meta_box['fields'][ $parent_field_id ]; |
|
| 1252 | + $parent_field = $this->meta_box[ 'fields' ][ $parent_field_id ]; |
|
| 1253 | 1253 | |
| 1254 | - if ( 'group' !== $parent_field['type'] ) { |
|
| 1254 | + if ( 'group' !== $parent_field[ 'type' ] ) { |
|
| 1255 | 1255 | return false; |
| 1256 | 1256 | } |
| 1257 | 1257 | |
| 1258 | - if ( ! isset( $parent_field['fields'] ) ) { |
|
| 1259 | - $this->meta_box['fields'][ $parent_field_id ]['fields'] = array(); |
|
| 1258 | + if ( ! isset( $parent_field[ 'fields' ] ) ) { |
|
| 1259 | + $this->meta_box[ 'fields' ][ $parent_field_id ][ 'fields' ] = array(); |
|
| 1260 | 1260 | } |
| 1261 | 1261 | |
| 1262 | 1262 | $this->_add_field_to_array( |
| 1263 | 1263 | $field, |
| 1264 | - $this->meta_box['fields'][ $parent_field_id ]['fields'], |
|
| 1264 | + $this->meta_box[ 'fields' ][ $parent_field_id ][ 'fields' ], |
|
| 1265 | 1265 | $position |
| 1266 | 1266 | ); |
| 1267 | 1267 | |
| 1268 | - return array( $parent_field_id, $field['id'] ); |
|
| 1268 | + return array( $parent_field_id, $field[ 'id' ] ); |
|
| 1269 | 1269 | } |
| 1270 | 1270 | |
| 1271 | 1271 | /** |
@@ -1278,9 +1278,9 @@ discard block |
||
| 1278 | 1278 | */ |
| 1279 | 1279 | protected function _add_field_to_array( $field, &$fields, $position = 0 ) { |
| 1280 | 1280 | if ( $position ) { |
| 1281 | - CMB2_Utils::array_insert( $fields, array( $field['id'] => $field ), $position ); |
|
| 1281 | + CMB2_Utils::array_insert( $fields, array( $field[ 'id' ] => $field ), $position ); |
|
| 1282 | 1282 | } else { |
| 1283 | - $fields[ $field['id'] ] = $field; |
|
| 1283 | + $fields[ $field[ 'id' ] ] = $field; |
|
| 1284 | 1284 | } |
| 1285 | 1285 | } |
| 1286 | 1286 | |
@@ -1304,15 +1304,15 @@ discard block |
||
| 1304 | 1304 | unset( $this->fields[ implode( '', $ids ) ] ); |
| 1305 | 1305 | |
| 1306 | 1306 | if ( ! $sub_field_id ) { |
| 1307 | - unset( $this->meta_box['fields'][ $field_id ] ); |
|
| 1307 | + unset( $this->meta_box[ 'fields' ][ $field_id ] ); |
|
| 1308 | 1308 | return true; |
| 1309 | 1309 | } |
| 1310 | 1310 | |
| 1311 | - if ( isset( $this->fields[ $field_id ]->args['fields'][ $sub_field_id ] ) ) { |
|
| 1312 | - unset( $this->fields[ $field_id ]->args['fields'][ $sub_field_id ] ); |
|
| 1311 | + if ( isset( $this->fields[ $field_id ]->args[ 'fields' ][ $sub_field_id ] ) ) { |
|
| 1312 | + unset( $this->fields[ $field_id ]->args[ 'fields' ][ $sub_field_id ] ); |
|
| 1313 | 1313 | } |
| 1314 | - if ( isset( $this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ] ) ) { |
|
| 1315 | - unset( $this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ] ); |
|
| 1314 | + if ( isset( $this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ] ) ) { |
|
| 1315 | + unset( $this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ] ); |
|
| 1316 | 1316 | } |
| 1317 | 1317 | return true; |
| 1318 | 1318 | } |
@@ -1337,11 +1337,11 @@ discard block |
||
| 1337 | 1337 | list( $field_id, $sub_field_id ) = $ids; |
| 1338 | 1338 | |
| 1339 | 1339 | if ( ! $sub_field_id ) { |
| 1340 | - $this->meta_box['fields'][ $field_id ][ $property ] = $value; |
|
| 1340 | + $this->meta_box[ 'fields' ][ $field_id ][ $property ] = $value; |
|
| 1341 | 1341 | return $field_id; |
| 1342 | 1342 | } |
| 1343 | 1343 | |
| 1344 | - $this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ][ $property ] = $value; |
|
| 1344 | + $this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ][ $property ] = $value; |
|
| 1345 | 1345 | return $field_id; |
| 1346 | 1346 | } |
| 1347 | 1347 | |
@@ -1356,7 +1356,7 @@ discard block |
||
| 1356 | 1356 | public function get_field_ids( $field_id, $parent_field_id = '' ) { |
| 1357 | 1357 | $sub_field_id = $parent_field_id ? $field_id : ''; |
| 1358 | 1358 | $field_id = $parent_field_id ? $parent_field_id : $field_id; |
| 1359 | - $fields =& $this->meta_box['fields']; |
|
| 1359 | + $fields = & $this->meta_box[ 'fields' ]; |
|
| 1360 | 1360 | |
| 1361 | 1361 | if ( ! array_key_exists( $field_id, $fields ) ) { |
| 1362 | 1362 | $field_id = $this->search_old_school_array( $field_id, $fields ); |
@@ -1370,12 +1370,12 @@ discard block |
||
| 1370 | 1370 | return array( $field_id, $sub_field_id ); |
| 1371 | 1371 | } |
| 1372 | 1372 | |
| 1373 | - if ( 'group' !== $fields[ $field_id ]['type'] ) { |
|
| 1373 | + if ( 'group' !== $fields[ $field_id ][ 'type' ] ) { |
|
| 1374 | 1374 | return false; |
| 1375 | 1375 | } |
| 1376 | 1376 | |
| 1377 | - if ( ! array_key_exists( $sub_field_id, $fields[ $field_id ]['fields'] ) ) { |
|
| 1378 | - $sub_field_id = $this->search_old_school_array( $sub_field_id, $fields[ $field_id ]['fields'] ); |
|
| 1377 | + if ( ! array_key_exists( $sub_field_id, $fields[ $field_id ][ 'fields' ] ) ) { |
|
| 1378 | + $sub_field_id = $this->search_old_school_array( $sub_field_id, $fields[ $field_id ][ 'fields' ] ); |
|
| 1379 | 1379 | } |
| 1380 | 1380 | |
| 1381 | 1381 | return false === $sub_field_id ? false : array( $field_id, $sub_field_id ); |