@@ -215,7 +215,6 @@ |
||
| 215 | 215 | * |
| 216 | 216 | * @since 1.3.0 |
| 217 | 217 | * @param string $meta_key Postmeta's key |
| 218 | - * @param mixed $meta_value (Optional) value of the postmeta to be saved |
|
| 219 | 218 | */ |
| 220 | 219 | protected function cache_action( $meta_key ) { |
| 221 | 220 | $func_args = func_get_args(); |
@@ -53,12 +53,12 @@ discard block |
||
| 53 | 53 | public function oembed_handler() { |
| 54 | 54 | |
| 55 | 55 | // Verify our nonce |
| 56 | - if ( ! ( isset( $_REQUEST['cmb2_ajax_nonce'], $_REQUEST['oembed_url'] ) && wp_verify_nonce( $_REQUEST['cmb2_ajax_nonce'], 'ajax_nonce' ) ) ) { |
|
| 56 | + if ( ! ( isset( $_REQUEST[ 'cmb2_ajax_nonce' ], $_REQUEST[ 'oembed_url' ] ) && wp_verify_nonce( $_REQUEST[ 'cmb2_ajax_nonce' ], 'ajax_nonce' ) ) ) { |
|
| 57 | 57 | die(); |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | // Sanitize our search string |
| 61 | - $oembed_string = sanitize_text_field( $_REQUEST['oembed_url'] ); |
|
| 61 | + $oembed_string = sanitize_text_field( $_REQUEST[ 'oembed_url' ] ); |
|
| 62 | 62 | |
| 63 | 63 | // Send back error if empty |
| 64 | 64 | if ( empty( $oembed_string ) ) { |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | // Set width of embed |
| 69 | - $embed_width = isset( $_REQUEST['oembed_width'] ) && intval( $_REQUEST['oembed_width'] ) < 640 ? intval( $_REQUEST['oembed_width'] ) : '640'; |
|
| 69 | + $embed_width = isset( $_REQUEST[ 'oembed_width' ] ) && intval( $_REQUEST[ 'oembed_width' ] ) < 640 ? intval( $_REQUEST[ 'oembed_width' ] ) : '640'; |
|
| 70 | 70 | |
| 71 | 71 | // Set url |
| 72 | 72 | $oembed_url = esc_url( $oembed_string ); |
@@ -79,10 +79,10 @@ discard block |
||
| 79 | 79 | // Get embed code (or fallback link) |
| 80 | 80 | $html = $this->get_oembed( array( |
| 81 | 81 | 'url' => $oembed_url, |
| 82 | - 'object_id' => $_REQUEST['object_id'], |
|
| 83 | - 'object_type' => isset( $_REQUEST['object_type'] ) ? $_REQUEST['object_type'] : 'post', |
|
| 82 | + 'object_id' => $_REQUEST[ 'object_id' ], |
|
| 83 | + 'object_type' => isset( $_REQUEST[ 'object_type' ] ) ? $_REQUEST[ 'object_type' ] : 'post', |
|
| 84 | 84 | 'oembed_args' => $embed_args, |
| 85 | - 'field_id' => $_REQUEST['field_id'], |
|
| 85 | + 'field_id' => $_REQUEST[ 'field_id' ], |
|
| 86 | 86 | ) ); |
| 87 | 87 | |
| 88 | 88 | wp_send_json_success( $html ); |
@@ -98,10 +98,10 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | global $wp_embed; |
| 100 | 100 | |
| 101 | - $oembed_url = esc_url( $args['url'] ); |
|
| 101 | + $oembed_url = esc_url( $args[ 'url' ] ); |
|
| 102 | 102 | |
| 103 | 103 | // Sanitize object_id |
| 104 | - $this->object_id = is_numeric( $args['object_id'] ) ? absint( $args['object_id'] ) : sanitize_text_field( $args['object_id'] ); |
|
| 104 | + $this->object_id = is_numeric( $args[ 'object_id' ] ) ? absint( $args[ 'object_id' ] ) : sanitize_text_field( $args[ 'object_id' ] ); |
|
| 105 | 105 | |
| 106 | 106 | $args = wp_parse_args( $args, array( |
| 107 | 107 | 'object_type' => 'post', |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | 'field_id' => false, |
| 110 | 110 | ) ); |
| 111 | 111 | |
| 112 | - $this->embed_args =& $args; |
|
| 112 | + $this->embed_args = & $args; |
|
| 113 | 113 | |
| 114 | 114 | /** |
| 115 | 115 | * Set the post_ID so oEmbed won't fail |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | $wp_embed->post_ID = $this->object_id; |
| 119 | 119 | |
| 120 | 120 | // Special scenario if NOT a post object |
| 121 | - if ( isset( $args['object_type'] ) && 'post' != $args['object_type'] ) { |
|
| 121 | + if ( isset( $args[ 'object_type' ] ) && 'post' != $args[ 'object_type' ] ) { |
|
| 122 | 122 | |
| 123 | - if ( 'options-page' == $args['object_type'] ) { |
|
| 123 | + if ( 'options-page' == $args[ 'object_type' ] ) { |
|
| 124 | 124 | |
| 125 | 125 | // Bogus id to pass some numeric checks. Issue with a VERY large WP install? |
| 126 | 126 | $wp_embed->post_ID = 1987645321; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | // Ok, we need to hijack the oembed cache system |
| 130 | 130 | $this->hijack = true; |
| 131 | - $this->object_type = $args['object_type']; |
|
| 131 | + $this->object_type = $args[ 'object_type' ]; |
|
| 132 | 132 | |
| 133 | 133 | // Gets ombed cache from our object's meta (vs postmeta) |
| 134 | 134 | add_filter( 'get_post_metadata', array( $this, 'hijack_oembed_cache_get' ), 10, 3 ); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | $embed_args = ''; |
| 142 | 142 | |
| 143 | - foreach ( $args['oembed_args'] as $key => $val ) { |
|
| 143 | + foreach ( $args[ 'oembed_args' ] as $key => $val ) { |
|
| 144 | 144 | $embed_args .= " $key=\"$val\""; |
| 145 | 145 | } |
| 146 | 146 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | |
| 153 | 153 | // Send back our embed |
| 154 | 154 | if ( $check_embed && $check_embed != $fallback ) { |
| 155 | - return '<div class="embed-status">' . $check_embed . '<p class="cmb2-remove-wrapper"><a href="#" class="cmb2-remove-file-button" rel="' . $args['field_id'] . '">' . __( 'Remove Embed', 'cmb2' ) . '</a></p></div>'; |
|
| 155 | + return '<div class="embed-status">' . $check_embed . '<p class="cmb2-remove-wrapper"><a href="#" class="cmb2-remove-file-button" rel="' . $args[ 'field_id' ] . '">' . __( 'Remove Embed', 'cmb2' ) . '</a></p></div>'; |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // Otherwise, send back error info that no oEmbeds were found |
@@ -219,15 +219,15 @@ discard block |
||
| 219 | 219 | */ |
| 220 | 220 | protected function cache_action( $meta_key ) { |
| 221 | 221 | $func_args = func_get_args(); |
| 222 | - $action = isset( $func_args[1] ) ? 'update' : 'get'; |
|
| 222 | + $action = isset( $func_args[ 1 ] ) ? 'update' : 'get'; |
|
| 223 | 223 | |
| 224 | 224 | if ( 'options-page' === $this->object_type ) { |
| 225 | 225 | |
| 226 | 226 | $args = array( $meta_key ); |
| 227 | 227 | |
| 228 | 228 | if ( 'update' === $action ) { |
| 229 | - $args[] = $func_args[1]; |
|
| 230 | - $args[] = true; |
|
| 229 | + $args[ ] = $func_args[ 1 ]; |
|
| 230 | + $args[ ] = true; |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | // Cache the result to our options |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | } else { |
| 236 | 236 | |
| 237 | 237 | $args = array( $this->object_type, $this->object_id, $meta_key ); |
| 238 | - $args[] = 'update' === $action ? $func_args : true; |
|
| 238 | + $args[ ] = 'update' === $action ? $func_args : true; |
|
| 239 | 239 | |
| 240 | 240 | // Cache the result to our metadata |
| 241 | 241 | $status = call_user_func_array( $action . '_metadata', $args ); |
@@ -93,16 +93,16 @@ discard block |
||
| 93 | 93 | */ |
| 94 | 94 | public function __construct( $args ) { |
| 95 | 95 | |
| 96 | - if ( ! empty( $args['group_field'] ) ) { |
|
| 97 | - $this->group = $args['group_field']; |
|
| 96 | + if ( ! empty( $args[ 'group_field' ] ) ) { |
|
| 97 | + $this->group = $args[ 'group_field' ]; |
|
| 98 | 98 | $this->object_id = $this->group->object_id; |
| 99 | 99 | $this->object_type = $this->group->object_type; |
| 100 | 100 | } else { |
| 101 | - $this->object_id = isset( $args['object_id'] ) && '_' !== $args['object_id'] ? $args['object_id'] : 0; |
|
| 102 | - $this->object_type = isset( $args['object_type'] ) ? $args['object_type'] : 'post'; |
|
| 101 | + $this->object_id = isset( $args[ 'object_id' ] ) && '_' !== $args[ 'object_id' ] ? $args[ 'object_id' ] : 0; |
|
| 102 | + $this->object_type = isset( $args[ 'object_type' ] ) ? $args[ 'object_type' ] : 'post'; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | - $this->args = $this->_set_field_defaults( $args['field_args'] ); |
|
| 105 | + $this->args = $this->_set_field_defaults( $args[ 'field_args' ] ); |
|
| 106 | 106 | |
| 107 | 107 | if ( $this->object_id ) { |
| 108 | 108 | $this->value = $this->get_data(); |
@@ -117,7 +117,7 @@ discard block |
||
| 117 | 117 | * @return mixed Value of field argument |
| 118 | 118 | */ |
| 119 | 119 | public function __call( $name, $arguments ) { |
| 120 | - $key = isset( $arguments[0] ) ? $arguments[0] : false; |
|
| 120 | + $key = isset( $arguments[ 0 ] ) ? $arguments[ 0 ] : false; |
|
| 121 | 121 | return $this->args( $name, $key ); |
| 122 | 122 | } |
| 123 | 123 | |
@@ -188,9 +188,9 @@ discard block |
||
| 188 | 188 | */ |
| 189 | 189 | public function get_data( $field_id = '', $args = array() ) { |
| 190 | 190 | if ( $field_id ) { |
| 191 | - $args['field_id'] = $field_id; |
|
| 191 | + $args[ 'field_id' ] = $field_id; |
|
| 192 | 192 | } else if ( $this->group ) { |
| 193 | - $args['field_id'] = $this->group->id(); |
|
| 193 | + $args[ 'field_id' ] = $this->group->id(); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | $a = $this->data_args( $args ); |
@@ -231,13 +231,13 @@ discard block |
||
| 231 | 231 | * |
| 232 | 232 | * @since 2.0.0 |
| 233 | 233 | */ |
| 234 | - $data = apply_filters( "cmb2_override_{$a['field_id']}_meta_value", $data, $this->object_id, $a, $this ); |
|
| 234 | + $data = apply_filters( "cmb2_override_{$a[ 'field_id' ]}_meta_value", $data, $this->object_id, $a, $this ); |
|
| 235 | 235 | |
| 236 | 236 | // If no override, get value normally |
| 237 | 237 | if ( 'cmb2_field_no_override_val' === $data ) { |
| 238 | - $data = 'options-page' === $a['type'] |
|
| 239 | - ? cmb2_options( $a['id'] )->get( $a['field_id'] ) |
|
| 240 | - : get_metadata( $a['type'], $a['id'], $a['field_id'], ( $a['single'] || $a['repeat'] ) ); |
|
| 238 | + $data = 'options-page' === $a[ 'type' ] |
|
| 239 | + ? cmb2_options( $a[ 'id' ] )->get( $a[ 'field_id' ] ) |
|
| 240 | + : get_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], ( $a[ 'single' ] || $a[ 'repeat' ] ) ); |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | if ( $this->group ) { |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | public function update_data( $new_value, $single = true ) { |
| 260 | 260 | $a = $this->data_args( array( 'single' => $single ) ); |
| 261 | 261 | |
| 262 | - $a['value'] = $a['repeat'] ? array_values( $new_value ) : $new_value; |
|
| 262 | + $a[ 'value' ] = $a[ 'repeat' ] ? array_values( $new_value ) : $new_value; |
|
| 263 | 263 | |
| 264 | 264 | /** |
| 265 | 265 | * Filter whether to override saving of meta value. |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | * |
| 296 | 296 | * @since 2.0.0 |
| 297 | 297 | */ |
| 298 | - $override = apply_filters( "cmb2_override_{$a['field_id']}_meta_save", $override, $a, $this->args(), $this ); |
|
| 298 | + $override = apply_filters( "cmb2_override_{$a[ 'field_id' ]}_meta_save", $override, $a, $this->args(), $this ); |
|
| 299 | 299 | |
| 300 | 300 | // If override, return that |
| 301 | 301 | if ( null !== $override ) { |
@@ -303,22 +303,22 @@ discard block |
||
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | // Options page handling (or temp data store) |
| 306 | - if ( 'options-page' === $a['type'] || empty( $a['id'] ) ) { |
|
| 307 | - return cmb2_options( $a['id'] )->update( $a['field_id'], $a['value'], false, $a['single'] ); |
|
| 306 | + if ( 'options-page' === $a[ 'type' ] || empty( $a[ 'id' ] ) ) { |
|
| 307 | + return cmb2_options( $a[ 'id' ] )->update( $a[ 'field_id' ], $a[ 'value' ], false, $a[ 'single' ] ); |
|
| 308 | 308 | } |
| 309 | 309 | |
| 310 | 310 | // Add metadata if not single |
| 311 | - if ( ! $a['single'] ) { |
|
| 312 | - return add_metadata( $a['type'], $a['id'], $a['field_id'], $a['value'], false ); |
|
| 311 | + if ( ! $a[ 'single' ] ) { |
|
| 312 | + return add_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $a[ 'value' ], false ); |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | // Delete meta if we have an empty array |
| 316 | - if ( is_array( $a['value'] ) && empty( $a['value'] ) ) { |
|
| 317 | - return delete_metadata( $a['type'], $a['id'], $a['field_id'], $this->value ); |
|
| 316 | + if ( is_array( $a[ 'value' ] ) && empty( $a[ 'value' ] ) ) { |
|
| 317 | + return delete_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $this->value ); |
|
| 318 | 318 | } |
| 319 | 319 | |
| 320 | 320 | // Update metadata |
| 321 | - return update_metadata( $a['type'], $a['id'], $a['field_id'], $a['value'] ); |
|
| 321 | + return update_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $a[ 'value' ] ); |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | /** |
@@ -368,19 +368,19 @@ discard block |
||
| 368 | 368 | * @param array $field_args All field arguments |
| 369 | 369 | * @param CMB2_Field object $field This field object |
| 370 | 370 | */ |
| 371 | - $override = apply_filters( "cmb2_override_{$a['field_id']}_meta_remove", $override, $a, $this->args(), $this ); |
|
| 371 | + $override = apply_filters( "cmb2_override_{$a[ 'field_id' ]}_meta_remove", $override, $a, $this->args(), $this ); |
|
| 372 | 372 | |
| 373 | 373 | // If no override, remove as usual |
| 374 | 374 | if ( null !== $override ) { |
| 375 | 375 | return $override; |
| 376 | 376 | } |
| 377 | 377 | // Option page handling |
| 378 | - elseif ( 'options-page' === $a['type'] || empty( $a['id'] ) ) { |
|
| 379 | - return cmb2_options( $a['id'] )->remove( $a['field_id'] ); |
|
| 378 | + elseif ( 'options-page' === $a[ 'type' ] || empty( $a[ 'id' ] ) ) { |
|
| 379 | + return cmb2_options( $a[ 'id' ] )->remove( $a[ 'field_id' ] ); |
|
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | // Remove metadata |
| 383 | - return delete_metadata( $a['type'], $a['id'], $a['field_id'], $old ); |
|
| 383 | + return delete_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $old ); |
|
| 384 | 384 | } |
| 385 | 385 | |
| 386 | 386 | /** |
@@ -851,7 +851,7 @@ discard block |
||
| 851 | 851 | |
| 852 | 852 | foreach ( $conditional_classes as $class => $condition ) { |
| 853 | 853 | if ( $condition ) { |
| 854 | - $classes[] = $class; |
|
| 854 | + $classes[ ] = $class; |
|
| 855 | 855 | } |
| 856 | 856 | } |
| 857 | 857 | |
@@ -860,7 +860,7 @@ discard block |
||
| 860 | 860 | } |
| 861 | 861 | |
| 862 | 862 | if ( $added_classes ) { |
| 863 | - $classes[] = esc_attr( $added_classes ); |
|
| 863 | + $classes[ ] = esc_attr( $added_classes ); |
|
| 864 | 864 | } |
| 865 | 865 | |
| 866 | 866 | /** |
@@ -965,10 +965,10 @@ discard block |
||
| 965 | 965 | return $this->field_options; |
| 966 | 966 | } |
| 967 | 967 | |
| 968 | - $this->field_options = (array) $this->args['options']; |
|
| 968 | + $this->field_options = (array) $this->args[ 'options' ]; |
|
| 969 | 969 | |
| 970 | - if ( is_callable( $this->args['options_cb'] ) ) { |
|
| 971 | - $options = call_user_func( $this->args['options_cb'], $this ); |
|
| 970 | + if ( is_callable( $this->args[ 'options_cb' ] ) ) { |
|
| 971 | + $options = call_user_func( $this->args[ 'options_cb' ], $this ); |
|
| 972 | 972 | |
| 973 | 973 | if ( $options && is_array( $options ) ) { |
| 974 | 974 | $this->field_options += $options; |
@@ -1011,17 +1011,17 @@ discard block |
||
| 1011 | 1011 | 'default' => null, |
| 1012 | 1012 | 'select_all_button' => true, |
| 1013 | 1013 | 'multiple' => false, |
| 1014 | - 'repeatable' => isset( $args['type'] ) && 'group' == $args['type'], |
|
| 1014 | + 'repeatable' => isset( $args[ 'type' ] ) && 'group' == $args[ 'type' ], |
|
| 1015 | 1015 | 'inline' => false, |
| 1016 | 1016 | 'on_front' => true, |
| 1017 | 1017 | 'show_names' => true, |
| 1018 | 1018 | 'date_format' => 'm\/d\/Y', |
| 1019 | 1019 | 'time_format' => 'h:i A', |
| 1020 | - 'description' => isset( $args['desc'] ) ? $args['desc'] : '', |
|
| 1021 | - 'preview_size' => 'file' == $args['type'] ? array( 350, 350 ) : array( 50, 50 ), |
|
| 1020 | + 'description' => isset( $args[ 'desc' ] ) ? $args[ 'desc' ] : '', |
|
| 1021 | + 'preview_size' => 'file' == $args[ 'type' ] ? array( 350, 350 ) : array( 50, 50 ), |
|
| 1022 | 1022 | 'render_row_cb' => array( $this, 'render_field_callback' ), |
| 1023 | - 'label_cb' => 'title' != $args['type'] ? array( $this, 'label' ) : '', |
|
| 1024 | - ), $args['id'], $args['type'], $this ); |
|
| 1023 | + 'label_cb' => 'title' != $args[ 'type' ] ? array( $this, 'label' ) : '', |
|
| 1024 | + ), $args[ 'id' ], $args[ 'type' ], $this ); |
|
| 1025 | 1025 | |
| 1026 | 1026 | // Set up blank or default values for empty ones |
| 1027 | 1027 | $args = wp_parse_args( $args, $defaults ); |
@@ -1036,51 +1036,51 @@ discard block |
||
| 1036 | 1036 | $args = apply_filters( 'cmb2_field_arguments_raw', $args, $this ); |
| 1037 | 1037 | |
| 1038 | 1038 | // Allow a filter override of the default value |
| 1039 | - $args['default'] = apply_filters( 'cmb2_default_filter', $args['default'], $this ); |
|
| 1040 | - $args['repeatable'] = $args['repeatable'] && ! $this->repeatable_exception( $args['type'] ); |
|
| 1041 | - $args['inline'] = $args['inline'] || false !== stripos( $args['type'], '_inline' ); |
|
| 1039 | + $args[ 'default' ] = apply_filters( 'cmb2_default_filter', $args[ 'default' ], $this ); |
|
| 1040 | + $args[ 'repeatable' ] = $args[ 'repeatable' ] && ! $this->repeatable_exception( $args[ 'type' ] ); |
|
| 1041 | + $args[ 'inline' ] = $args[ 'inline' ] || false !== stripos( $args[ 'type' ], '_inline' ); |
|
| 1042 | 1042 | |
| 1043 | 1043 | // options param can be passed a callback as well |
| 1044 | - if ( is_callable( $args['options'] ) ) { |
|
| 1045 | - $args['options_cb'] = $args['options']; |
|
| 1046 | - $args['options'] = array(); |
|
| 1044 | + if ( is_callable( $args[ 'options' ] ) ) { |
|
| 1045 | + $args[ 'options_cb' ] = $args[ 'options' ]; |
|
| 1046 | + $args[ 'options' ] = array(); |
|
| 1047 | 1047 | } |
| 1048 | 1048 | |
| 1049 | - $args['options'] = 'group' == $args['type'] ? wp_parse_args( $args['options'], array( |
|
| 1049 | + $args[ 'options' ] = 'group' == $args[ 'type' ] ? wp_parse_args( $args[ 'options' ], array( |
|
| 1050 | 1050 | 'add_button' => __( 'Add Group', 'cmb2' ), |
| 1051 | 1051 | 'remove_button' => __( 'Remove Group', 'cmb2' ), |
| 1052 | - ) ) : $args['options']; |
|
| 1052 | + ) ) : $args[ 'options' ]; |
|
| 1053 | 1053 | |
| 1054 | - $args['_id'] = $args['id']; |
|
| 1055 | - $args['_name'] = $args['id']; |
|
| 1054 | + $args[ '_id' ] = $args[ 'id' ]; |
|
| 1055 | + $args[ '_name' ] = $args[ 'id' ]; |
|
| 1056 | 1056 | |
| 1057 | 1057 | if ( $this->group ) { |
| 1058 | 1058 | |
| 1059 | - $args['id'] = $this->group->args( 'id' ) . '_' . $this->group->index . '_' . $args['id']; |
|
| 1060 | - $args['_name'] = $this->group->args( 'id' ) . '[' . $this->group->index . '][' . $args['_name'] . ']'; |
|
| 1059 | + $args[ 'id' ] = $this->group->args( 'id' ) . '_' . $this->group->index . '_' . $args[ 'id' ]; |
|
| 1060 | + $args[ '_name' ] = $this->group->args( 'id' ) . '[' . $this->group->index . '][' . $args[ '_name' ] . ']'; |
|
| 1061 | 1061 | } |
| 1062 | 1062 | |
| 1063 | - if ( 'wysiwyg' == $args['type'] ) { |
|
| 1064 | - $args['id'] = strtolower( str_ireplace( '-', '_', $args['id'] ) ); |
|
| 1065 | - $args['options']['textarea_name'] = $args['_name']; |
|
| 1063 | + if ( 'wysiwyg' == $args[ 'type' ] ) { |
|
| 1064 | + $args[ 'id' ] = strtolower( str_ireplace( '-', '_', $args[ 'id' ] ) ); |
|
| 1065 | + $args[ 'options' ][ 'textarea_name' ] = $args[ '_name' ]; |
|
| 1066 | 1066 | } |
| 1067 | 1067 | |
| 1068 | 1068 | $option_types = apply_filters( 'cmb2_all_or_nothing_types', array( 'select', 'radio', 'radio_inline', 'taxonomy_select', 'taxonomy_radio', 'taxonomy_radio_inline' ), $this ); |
| 1069 | 1069 | |
| 1070 | - if ( in_array( $args['type'], $option_types, true ) ) { |
|
| 1070 | + if ( in_array( $args[ 'type' ], $option_types, true ) ) { |
|
| 1071 | 1071 | |
| 1072 | - $args['show_option_none'] = isset( $args['show_option_none'] ) ? $args['show_option_none'] : null; |
|
| 1073 | - $args['show_option_none'] = true === $args['show_option_none'] ? __( 'None', 'cmb2' ) : $args['show_option_none']; |
|
| 1072 | + $args[ 'show_option_none' ] = isset( $args[ 'show_option_none' ] ) ? $args[ 'show_option_none' ] : null; |
|
| 1073 | + $args[ 'show_option_none' ] = true === $args[ 'show_option_none' ] ? __( 'None', 'cmb2' ) : $args[ 'show_option_none' ]; |
|
| 1074 | 1074 | |
| 1075 | - if ( null === $args['show_option_none'] ) { |
|
| 1076 | - $off_by_default = in_array( $args['type'], array( 'select', 'radio', 'radio_inline' ), true ); |
|
| 1077 | - $args['show_option_none'] = $off_by_default ? false : __( 'None', 'cmb2' ); |
|
| 1075 | + if ( null === $args[ 'show_option_none' ] ) { |
|
| 1076 | + $off_by_default = in_array( $args[ 'type' ], array( 'select', 'radio', 'radio_inline' ), true ); |
|
| 1077 | + $args[ 'show_option_none' ] = $off_by_default ? false : __( 'None', 'cmb2' ); |
|
| 1078 | 1078 | } |
| 1079 | 1079 | |
| 1080 | 1080 | } |
| 1081 | 1081 | |
| 1082 | - $args['has_supporting_data'] = in_array( |
|
| 1083 | - $args['type'], |
|
| 1082 | + $args[ 'has_supporting_data' ] = in_array( |
|
| 1083 | + $args[ 'type' ], |
|
| 1084 | 1084 | array( |
| 1085 | 1085 | // CMB2_Sanitize::_save_file_id_value()/CMB2_Sanitize::_get_group_file_value_array() |
| 1086 | 1086 | 'file', |
@@ -1106,7 +1106,7 @@ discard block |
||
| 1106 | 1106 | * @param array $attrs Array of attributes to update |
| 1107 | 1107 | */ |
| 1108 | 1108 | public function maybe_set_attributes( $attrs = array() ) { |
| 1109 | - return wp_parse_args( $this->args['attributes'], $attrs ); |
|
| 1109 | + return wp_parse_args( $this->args[ 'attributes' ], $attrs ); |
|
| 1110 | 1110 | } |
| 1111 | 1111 | |
| 1112 | 1112 | } |