@@ -112,21 +112,21 @@ discard block |
||
112 | 112 | */ |
113 | 113 | public function __construct( $args ) { |
114 | 114 | |
115 | - if ( ! empty( $args['group_field'] ) ) { |
|
116 | - $this->group = $args['group_field']; |
|
115 | + if ( ! empty( $args[ 'group_field' ] ) ) { |
|
116 | + $this->group = $args[ 'group_field' ]; |
|
117 | 117 | $this->object_id = $this->group->object_id; |
118 | 118 | $this->object_type = $this->group->object_type; |
119 | 119 | $this->cmb_id = $this->group->cmb_id; |
120 | 120 | } else { |
121 | - $this->object_id = isset( $args['object_id'] ) && '_' !== $args['object_id'] ? $args['object_id'] : 0; |
|
122 | - $this->object_type = isset( $args['object_type'] ) ? $args['object_type'] : 'post'; |
|
121 | + $this->object_id = isset( $args[ 'object_id' ] ) && '_' !== $args[ 'object_id' ] ? $args[ 'object_id' ] : 0; |
|
122 | + $this->object_type = isset( $args[ 'object_type' ] ) ? $args[ 'object_type' ] : 'post'; |
|
123 | 123 | |
124 | - if ( isset( $args['cmb_id'] ) ) { |
|
125 | - $this->cmb_id = $args['cmb_id']; |
|
124 | + if ( isset( $args[ 'cmb_id' ] ) ) { |
|
125 | + $this->cmb_id = $args[ 'cmb_id' ]; |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | - $this->args = $this->_set_field_defaults( $args['field_args'], $args ); |
|
129 | + $this->args = $this->_set_field_defaults( $args[ 'field_args' ], $args ); |
|
130 | 130 | |
131 | 131 | if ( $this->object_id ) { |
132 | 132 | $this->value = $this->get_data(); |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | return call_user_func_array( array( $this, 'get_string' ), $arguments ); |
146 | 146 | } |
147 | 147 | |
148 | - $key = isset( $arguments[0] ) ? $arguments[0] : false; |
|
148 | + $key = isset( $arguments[ 0 ] ) ? $arguments[ 0 ] : false; |
|
149 | 149 | return $this->args( $name, $key ); |
150 | 150 | } |
151 | 151 | |
@@ -216,9 +216,9 @@ discard block |
||
216 | 216 | */ |
217 | 217 | public function get_data( $field_id = '', $args = array() ) { |
218 | 218 | if ( $field_id ) { |
219 | - $args['field_id'] = $field_id; |
|
219 | + $args[ 'field_id' ] = $field_id; |
|
220 | 220 | } else if ( $this->group ) { |
221 | - $args['field_id'] = $this->group->id(); |
|
221 | + $args[ 'field_id' ] = $this->group->id(); |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | $a = $this->data_args( $args ); |
@@ -259,13 +259,13 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @since 2.0.0 |
261 | 261 | */ |
262 | - $data = apply_filters( "cmb2_override_{$a['field_id']}_meta_value", $data, $this->object_id, $a, $this ); |
|
262 | + $data = apply_filters( "cmb2_override_{$a[ 'field_id' ]}_meta_value", $data, $this->object_id, $a, $this ); |
|
263 | 263 | |
264 | 264 | // If no override, get value normally |
265 | 265 | if ( 'cmb2_field_no_override_val' === $data ) { |
266 | - $data = 'options-page' === $a['type'] |
|
267 | - ? cmb2_options( $a['id'] )->get( $a['field_id'] ) |
|
268 | - : get_metadata( $a['type'], $a['id'], $a['field_id'], ( $a['single'] || $a['repeat'] ) ); |
|
266 | + $data = 'options-page' === $a[ 'type' ] |
|
267 | + ? cmb2_options( $a[ 'id' ] )->get( $a[ 'field_id' ] ) |
|
268 | + : get_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], ( $a[ 'single' ] || $a[ 'repeat' ] ) ); |
|
269 | 269 | } |
270 | 270 | |
271 | 271 | if ( $this->group ) { |
@@ -287,7 +287,7 @@ discard block |
||
287 | 287 | public function update_data( $new_value, $single = true ) { |
288 | 288 | $a = $this->data_args( array( 'single' => $single ) ); |
289 | 289 | |
290 | - $a['value'] = $a['repeat'] ? array_values( $new_value ) : $new_value; |
|
290 | + $a[ 'value' ] = $a[ 'repeat' ] ? array_values( $new_value ) : $new_value; |
|
291 | 291 | |
292 | 292 | /** |
293 | 293 | * Filter whether to override saving of meta value. |
@@ -323,7 +323,7 @@ discard block |
||
323 | 323 | * |
324 | 324 | * @since 2.0.0 |
325 | 325 | */ |
326 | - $override = apply_filters( "cmb2_override_{$a['field_id']}_meta_save", $override, $a, $this->args(), $this ); |
|
326 | + $override = apply_filters( "cmb2_override_{$a[ 'field_id' ]}_meta_save", $override, $a, $this->args(), $this ); |
|
327 | 327 | |
328 | 328 | // If override, return that |
329 | 329 | if ( null !== $override ) { |
@@ -331,22 +331,22 @@ discard block |
||
331 | 331 | } |
332 | 332 | |
333 | 333 | // Options page handling (or temp data store) |
334 | - if ( 'options-page' === $a['type'] || empty( $a['id'] ) ) { |
|
335 | - return cmb2_options( $a['id'] )->update( $a['field_id'], $a['value'], false, $a['single'] ); |
|
334 | + if ( 'options-page' === $a[ 'type' ] || empty( $a[ 'id' ] ) ) { |
|
335 | + return cmb2_options( $a[ 'id' ] )->update( $a[ 'field_id' ], $a[ 'value' ], false, $a[ 'single' ] ); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | // Add metadata if not single |
339 | - if ( ! $a['single'] ) { |
|
340 | - return add_metadata( $a['type'], $a['id'], $a['field_id'], $a['value'], false ); |
|
339 | + if ( ! $a[ 'single' ] ) { |
|
340 | + return add_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $a[ 'value' ], false ); |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | // Delete meta if we have an empty array |
344 | - if ( is_array( $a['value'] ) && empty( $a['value'] ) ) { |
|
345 | - return delete_metadata( $a['type'], $a['id'], $a['field_id'], $this->value ); |
|
344 | + if ( is_array( $a[ 'value' ] ) && empty( $a[ 'value' ] ) ) { |
|
345 | + return delete_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $this->value ); |
|
346 | 346 | } |
347 | 347 | |
348 | 348 | // Update metadata |
349 | - return update_metadata( $a['type'], $a['id'], $a['field_id'], $a['value'] ); |
|
349 | + return update_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $a[ 'value' ] ); |
|
350 | 350 | } |
351 | 351 | |
352 | 352 | /** |
@@ -396,19 +396,19 @@ discard block |
||
396 | 396 | * @param array $field_args All field arguments |
397 | 397 | * @param CMB2_Field object $field This field object |
398 | 398 | */ |
399 | - $override = apply_filters( "cmb2_override_{$a['field_id']}_meta_remove", $override, $a, $this->args(), $this ); |
|
399 | + $override = apply_filters( "cmb2_override_{$a[ 'field_id' ]}_meta_remove", $override, $a, $this->args(), $this ); |
|
400 | 400 | |
401 | 401 | // If no override, remove as usual |
402 | 402 | if ( null !== $override ) { |
403 | 403 | return $override; |
404 | 404 | } |
405 | 405 | // Option page handling |
406 | - elseif ( 'options-page' === $a['type'] || empty( $a['id'] ) ) { |
|
407 | - return cmb2_options( $a['id'] )->remove( $a['field_id'] ); |
|
406 | + elseif ( 'options-page' === $a[ 'type' ] || empty( $a[ 'id' ] ) ) { |
|
407 | + return cmb2_options( $a[ 'id' ] )->remove( $a[ 'field_id' ] ); |
|
408 | 408 | } |
409 | 409 | |
410 | 410 | // Remove metadata |
411 | - return delete_metadata( $a['type'], $a['id'], $a['field_id'], $old ); |
|
411 | + return delete_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $old ); |
|
412 | 412 | } |
413 | 413 | |
414 | 414 | /** |
@@ -859,7 +859,7 @@ discard block |
||
859 | 859 | |
860 | 860 | foreach ( $conditional_classes as $class => $condition ) { |
861 | 861 | if ( $condition ) { |
862 | - $classes[] = $class; |
|
862 | + $classes[ ] = $class; |
|
863 | 863 | } |
864 | 864 | } |
865 | 865 | |
@@ -870,7 +870,7 @@ discard block |
||
870 | 870 | } |
871 | 871 | |
872 | 872 | if ( $added_classes ) { |
873 | - $classes[] = esc_attr( $added_classes ); |
|
873 | + $classes[ ] = esc_attr( $added_classes ); |
|
874 | 874 | } |
875 | 875 | |
876 | 876 | /** |
@@ -970,10 +970,10 @@ discard block |
||
970 | 970 | public function get_string( $text_key, $fallback ) { |
971 | 971 | // If null, populate with our field strings values. |
972 | 972 | if ( null === $this->strings ) { |
973 | - $this->strings = (array) $this->args['text']; |
|
973 | + $this->strings = (array) $this->args[ 'text' ]; |
|
974 | 974 | |
975 | - if ( is_callable( $this->args['text_cb'] ) ) { |
|
976 | - $strings = call_user_func( $this->args['text_cb'], $this ); |
|
975 | + if ( is_callable( $this->args[ 'text_cb' ] ) ) { |
|
976 | + $strings = call_user_func( $this->args[ 'text_cb' ], $this ); |
|
977 | 977 | |
978 | 978 | if ( $strings && is_array( $strings ) ) { |
979 | 979 | $this->strings += $strings; |
@@ -1007,10 +1007,10 @@ discard block |
||
1007 | 1007 | return $this->field_options; |
1008 | 1008 | } |
1009 | 1009 | |
1010 | - $this->field_options = (array) $this->args['options']; |
|
1010 | + $this->field_options = (array) $this->args[ 'options' ]; |
|
1011 | 1011 | |
1012 | - if ( is_callable( $this->args['options_cb'] ) ) { |
|
1013 | - $options = call_user_func( $this->args['options_cb'], $this ); |
|
1012 | + if ( is_callable( $this->args[ 'options_cb' ] ) ) { |
|
1013 | + $options = call_user_func( $this->args[ 'options_cb' ], $this ); |
|
1014 | 1014 | |
1015 | 1015 | if ( $options && is_array( $options ) ) { |
1016 | 1016 | $this->field_options = $options + $this->field_options; |
@@ -1031,7 +1031,7 @@ discard block |
||
1031 | 1031 | */ |
1032 | 1032 | public function add_js_dependencies( $dependencies = array() ) { |
1033 | 1033 | foreach ( (array) $dependencies as $dependency ) { |
1034 | - $this->args['js_dependencies'][ $dependency ] = $dependency; |
|
1034 | + $this->args[ 'js_dependencies' ][ $dependency ] = $dependency; |
|
1035 | 1035 | } |
1036 | 1036 | |
1037 | 1037 | CMB2_JS::add_dependencies( $dependencies ); |
@@ -1045,17 +1045,17 @@ discard block |
||
1045 | 1045 | * @return mixed Default field value |
1046 | 1046 | */ |
1047 | 1047 | public function get_default() { |
1048 | - if ( null !== $this->args['default'] ) { |
|
1049 | - return $this->args['default']; |
|
1048 | + if ( null !== $this->args[ 'default' ] ) { |
|
1049 | + return $this->args[ 'default' ]; |
|
1050 | 1050 | } |
1051 | 1051 | |
1052 | - $param = is_callable( $this->args['default_cb'] ) ? 'default_cb' : 'default'; |
|
1052 | + $param = is_callable( $this->args[ 'default_cb' ] ) ? 'default_cb' : 'default'; |
|
1053 | 1053 | $default = $this->get_param_callback_result( $param ); |
1054 | 1054 | |
1055 | 1055 | // Allow a filter override of the default value |
1056 | - $this->args['default'] = apply_filters( 'cmb2_default_filter', $default, $this ); |
|
1056 | + $this->args[ 'default' ] = apply_filters( 'cmb2_default_filter', $default, $this ); |
|
1057 | 1057 | |
1058 | - return $this->args['default']; |
|
1058 | + return $this->args[ 'default' ]; |
|
1059 | 1059 | } |
1060 | 1060 | |
1061 | 1061 | /** |
@@ -1085,18 +1085,18 @@ discard block |
||
1085 | 1085 | 'classes_cb' => '', |
1086 | 1086 | 'select_all_button' => true, |
1087 | 1087 | 'multiple' => false, |
1088 | - 'repeatable' => isset( $args['type'] ) && 'group' == $args['type'], |
|
1088 | + 'repeatable' => isset( $args[ 'type' ] ) && 'group' == $args[ 'type' ], |
|
1089 | 1089 | 'inline' => false, |
1090 | 1090 | 'on_front' => true, |
1091 | 1091 | 'show_names' => true, |
1092 | 1092 | 'save_field' => true, // Will not save if false |
1093 | 1093 | 'date_format' => 'm\/d\/Y', |
1094 | 1094 | 'time_format' => 'h:i A', |
1095 | - 'description' => isset( $args['desc'] ) ? $args['desc'] : '', |
|
1096 | - 'preview_size' => 'file' == $args['type'] ? array( 350, 350 ) : array( 50, 50 ), |
|
1095 | + 'description' => isset( $args[ 'desc' ] ) ? $args[ 'desc' ] : '', |
|
1096 | + 'preview_size' => 'file' == $args[ 'type' ] ? array( 350, 350 ) : array( 50, 50 ), |
|
1097 | 1097 | 'render_row_cb' => array( $this, 'render_field_callback' ), |
1098 | 1098 | 'display_cb' => array( $this, 'display_value_callback' ), |
1099 | - 'label_cb' => 'title' != $args['type'] ? array( $this, 'label' ) : '', |
|
1099 | + 'label_cb' => 'title' != $args[ 'type' ] ? array( $this, 'label' ) : '', |
|
1100 | 1100 | 'column' => false, |
1101 | 1101 | 'js_dependencies' => array(), |
1102 | 1102 | 'show_in_rest' => null, |
@@ -1111,44 +1111,44 @@ discard block |
||
1111 | 1111 | */ |
1112 | 1112 | $args = $this->convert_deprecated_params( $args ); |
1113 | 1113 | |
1114 | - $args['repeatable'] = $args['repeatable'] && ! $this->repeatable_exception( $args['type'] ); |
|
1115 | - $args['inline'] = $args['inline'] || false !== stripos( $args['type'], '_inline' ); |
|
1114 | + $args[ 'repeatable' ] = $args[ 'repeatable' ] && ! $this->repeatable_exception( $args[ 'type' ] ); |
|
1115 | + $args[ 'inline' ] = $args[ 'inline' ] || false !== stripos( $args[ 'type' ], '_inline' ); |
|
1116 | 1116 | |
1117 | - $args['options'] = 'group' == $args['type'] ? wp_parse_args( $args['options'], array( |
|
1117 | + $args[ 'options' ] = 'group' == $args[ 'type' ] ? wp_parse_args( $args[ 'options' ], array( |
|
1118 | 1118 | 'add_button' => esc_html__( 'Add Group', 'cmb2' ), |
1119 | 1119 | 'remove_button' => esc_html__( 'Remove Group', 'cmb2' ), |
1120 | - ) ) : $args['options']; |
|
1120 | + ) ) : $args[ 'options' ]; |
|
1121 | 1121 | |
1122 | - $args['_id'] = $args['id']; |
|
1123 | - $args['_name'] = $args['id']; |
|
1122 | + $args[ '_id' ] = $args[ 'id' ]; |
|
1123 | + $args[ '_name' ] = $args[ 'id' ]; |
|
1124 | 1124 | |
1125 | 1125 | if ( $this->group ) { |
1126 | 1126 | |
1127 | - $args['id'] = $this->group->args( 'id' ) . '_' . $this->group->index . '_' . $args['id']; |
|
1128 | - $args['_name'] = $this->group->args( 'id' ) . '[' . $this->group->index . '][' . $args['_name'] . ']'; |
|
1127 | + $args[ 'id' ] = $this->group->args( 'id' ) . '_' . $this->group->index . '_' . $args[ 'id' ]; |
|
1128 | + $args[ '_name' ] = $this->group->args( 'id' ) . '[' . $this->group->index . '][' . $args[ '_name' ] . ']'; |
|
1129 | 1129 | } |
1130 | 1130 | |
1131 | - if ( 'wysiwyg' == $args['type'] ) { |
|
1132 | - $args['id'] = strtolower( str_ireplace( '-', '_', $args['id'] ) ); |
|
1133 | - $args['options']['textarea_name'] = $args['_name']; |
|
1131 | + if ( 'wysiwyg' == $args[ 'type' ] ) { |
|
1132 | + $args[ 'id' ] = strtolower( str_ireplace( '-', '_', $args[ 'id' ] ) ); |
|
1133 | + $args[ 'options' ][ 'textarea_name' ] = $args[ '_name' ]; |
|
1134 | 1134 | } |
1135 | 1135 | |
1136 | 1136 | $option_types = apply_filters( 'cmb2_all_or_nothing_types', array( 'select', 'radio', 'radio_inline', 'taxonomy_select', 'taxonomy_radio', 'taxonomy_radio_inline' ), $this ); |
1137 | 1137 | |
1138 | - if ( in_array( $args['type'], $option_types, true ) ) { |
|
1138 | + if ( in_array( $args[ 'type' ], $option_types, true ) ) { |
|
1139 | 1139 | |
1140 | - $args['show_option_none'] = isset( $args['show_option_none'] ) ? $args['show_option_none'] : null; |
|
1141 | - $args['show_option_none'] = true === $args['show_option_none'] ? esc_html__( 'None', 'cmb2' ) : $args['show_option_none']; |
|
1140 | + $args[ 'show_option_none' ] = isset( $args[ 'show_option_none' ] ) ? $args[ 'show_option_none' ] : null; |
|
1141 | + $args[ 'show_option_none' ] = true === $args[ 'show_option_none' ] ? esc_html__( 'None', 'cmb2' ) : $args[ 'show_option_none' ]; |
|
1142 | 1142 | |
1143 | - if ( null === $args['show_option_none'] ) { |
|
1144 | - $off_by_default = in_array( $args['type'], array( 'select', 'radio', 'radio_inline' ), true ); |
|
1145 | - $args['show_option_none'] = $off_by_default ? false : esc_html__( 'None', 'cmb2' ); |
|
1143 | + if ( null === $args[ 'show_option_none' ] ) { |
|
1144 | + $off_by_default = in_array( $args[ 'type' ], array( 'select', 'radio', 'radio_inline' ), true ); |
|
1145 | + $args[ 'show_option_none' ] = $off_by_default ? false : esc_html__( 'None', 'cmb2' ); |
|
1146 | 1146 | } |
1147 | 1147 | |
1148 | 1148 | } |
1149 | 1149 | |
1150 | - $args['has_supporting_data'] = in_array( |
|
1151 | - $args['type'], |
|
1150 | + $args[ 'has_supporting_data' ] = in_array( |
|
1151 | + $args[ 'type' ], |
|
1152 | 1152 | array( |
1153 | 1153 | // CMB2_Sanitize::_save_file_id_value()/CMB2_Sanitize::_get_group_file_value_array() |
1154 | 1154 | 'file', |
@@ -1171,10 +1171,10 @@ discard block |
||
1171 | 1171 | protected function get_default_args( $field_args, $field_group = null ) { |
1172 | 1172 | $args = parent::get_default_args( array(), $this->group ); |
1173 | 1173 | |
1174 | - if ( isset( $field_args['field_args'] ) ) { |
|
1174 | + if ( isset( $field_args[ 'field_args' ] ) ) { |
|
1175 | 1175 | $args = wp_parse_args( $field_args, $args ); |
1176 | 1176 | } else { |
1177 | - $args['field_args'] = wp_parse_args( $field_args, $this->args ); |
|
1177 | + $args[ 'field_args' ] = wp_parse_args( $field_args, $this->args ); |
|
1178 | 1178 | } |
1179 | 1179 | |
1180 | 1180 | return $args; |
@@ -1217,43 +1217,43 @@ discard block |
||
1217 | 1217 | */ |
1218 | 1218 | protected function convert_deprecated_params( $args ) { |
1219 | 1219 | |
1220 | - if ( isset( $args['row_classes'] ) ) { |
|
1220 | + if ( isset( $args[ 'row_classes' ] ) ) { |
|
1221 | 1221 | |
1222 | 1222 | // We'll let this one be. |
1223 | 1223 | // $this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_PARAM, 'row_classes', 'classes' ); |
1224 | 1224 | |
1225 | 1225 | // row_classes param could be a callback. This is definitely deprecated. |
1226 | - if ( is_callable( $args['row_classes'] ) ) { |
|
1226 | + if ( is_callable( $args[ 'row_classes' ] ) ) { |
|
1227 | 1227 | |
1228 | 1228 | $this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_CB_PARAM, 'row_classes', 'classes_cb' ); |
1229 | 1229 | |
1230 | - $args['classes_cb'] = $args['row_classes']; |
|
1231 | - $args['classes'] = null; |
|
1230 | + $args[ 'classes_cb' ] = $args[ 'row_classes' ]; |
|
1231 | + $args[ 'classes' ] = null; |
|
1232 | 1232 | } else { |
1233 | 1233 | |
1234 | - $args['classes'] = $args['row_classes']; |
|
1234 | + $args[ 'classes' ] = $args[ 'row_classes' ]; |
|
1235 | 1235 | } |
1236 | 1236 | |
1237 | - unset( $args['row_classes'] ); |
|
1237 | + unset( $args[ 'row_classes' ] ); |
|
1238 | 1238 | } |
1239 | 1239 | |
1240 | 1240 | |
1241 | 1241 | // default param can be passed a callback as well |
1242 | - if ( is_callable( $args['default'] ) ) { |
|
1242 | + if ( is_callable( $args[ 'default' ] ) ) { |
|
1243 | 1243 | |
1244 | 1244 | $this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_CB_PARAM, 'default', 'default_cb' ); |
1245 | 1245 | |
1246 | - $args['default_cb'] = $args['default']; |
|
1247 | - $args['default'] = null; |
|
1246 | + $args[ 'default_cb' ] = $args[ 'default' ]; |
|
1247 | + $args[ 'default' ] = null; |
|
1248 | 1248 | } |
1249 | 1249 | |
1250 | 1250 | // options param can be passed a callback as well |
1251 | - if ( is_callable( $args['options'] ) ) { |
|
1251 | + if ( is_callable( $args[ 'options' ] ) ) { |
|
1252 | 1252 | |
1253 | 1253 | $this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_CB_PARAM, 'options', 'options_cb' ); |
1254 | 1254 | |
1255 | - $args['options_cb'] = $args['options']; |
|
1256 | - $args['options'] = array(); |
|
1255 | + $args[ 'options_cb' ] = $args[ 'options' ]; |
|
1256 | + $args[ 'options' ] = array(); |
|
1257 | 1257 | } |
1258 | 1258 | |
1259 | 1259 | return $args; |
@@ -33,7 +33,7 @@ |
||
33 | 33 | 'data-objecttype' => $field->object_type, |
34 | 34 | ) ) |
35 | 35 | . '<p class="cmb-spinner spinner"></p>' |
36 | - . '<div id="'. $this->_id( '-status' ). '" class="cmb2-media-status ui-helper-clearfix embed_wrap">' . $oembed . '</div>'; |
|
36 | + . '<div id="' . $this->_id( '-status' ) . '" class="cmb2-media-status ui-helper-clearfix embed_wrap">' . $oembed . '</div>'; |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | } |
@@ -14,7 +14,7 @@ |
||
14 | 14 | |
15 | 15 | public function render() { |
16 | 16 | |
17 | - $this->field->args['default'] = $this->field->get_default() |
|
17 | + $this->field->args[ 'default' ] = $this->field->get_default() |
|
18 | 18 | ? $this->field->get_default() |
19 | 19 | : CMB2_Utils::timezone_string(); |
20 | 20 |
@@ -36,7 +36,7 @@ |
||
36 | 36 | ); |
37 | 37 | |
38 | 38 | if ( is_array( $saved_terms ) && in_array( $term->slug, $saved_terms ) ) { |
39 | - $args['checked'] = 'checked'; |
|
39 | + $args[ 'checked' ] = 'checked'; |
|
40 | 40 | } |
41 | 41 | $options .= $this->list_input( $args, $i ); |
42 | 42 | $i++; |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @return string Generated option element html |
20 | 20 | */ |
21 | 21 | public function select_option( $args = array() ) { |
22 | - return sprintf( "\t" . '<option value="%s" %s>%s</option>', $args['value'], selected( isset( $args['checked'] ) && $args['checked'], true, false ), $args['label'] ) . "\n"; |
|
22 | + return sprintf( "\t" . '<option value="%s" %s>%s</option>', $args[ 'value' ], selected( isset( $args[ 'checked' ] ) && $args[ 'checked' ], true, false ), $args[ 'label' ] ) . "\n"; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | 'label' => '', |
40 | 40 | ), $args ); |
41 | 41 | |
42 | - return sprintf( "\t" . '<li><input%s/> <label for="%s">%s</label></li>' . "\n", $this->concat_attrs( $a, array( 'label' ) ), $a['id'], $a['label'] ); |
|
42 | + return sprintf( "\t" . '<li><input%s/> <label for="%s">%s</label></li>' . "\n", $this->concat_attrs( $a, array( 'label' ) ), $a[ 'id' ], $a[ 'label' ] ); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -51,10 +51,10 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function list_input_checkbox( $args, $i ) { |
53 | 53 | $saved_value = $this->field->escaped_value(); |
54 | - if ( is_array( $saved_value ) && in_array( $args['value'], $saved_value ) ) { |
|
55 | - $args['checked'] = 'checked'; |
|
54 | + if ( is_array( $saved_value ) && in_array( $args[ 'value' ], $saved_value ) ) { |
|
55 | + $args[ 'checked' ] = 'checked'; |
|
56 | 56 | } |
57 | - $args['type'] = 'checkbox'; |
|
57 | + $args[ 'type' ] = 'checkbox'; |
|
58 | 58 | return $this->list_input( $args, $i ); |
59 | 59 | } |
60 | 60 | |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | public function concat_items( $args = array() ) { |
68 | 68 | $field = $this->field; |
69 | 69 | |
70 | - $method = isset( $args['method'] ) ? $args['method'] : 'select_option'; |
|
71 | - unset( $args['method'] ); |
|
70 | + $method = isset( $args[ 'method' ] ) ? $args[ 'method' ] : 'select_option'; |
|
71 | + unset( $args[ 'method' ] ); |
|
72 | 72 | |
73 | 73 | $value = null !== $field->escaped_value() |
74 | 74 | ? $field->escaped_value() |
@@ -90,12 +90,12 @@ discard block |
||
90 | 90 | // Clone args & modify for just this item |
91 | 91 | $a = $args; |
92 | 92 | |
93 | - $a['value'] = $opt_value; |
|
94 | - $a['label'] = $opt_label; |
|
93 | + $a[ 'value' ] = $opt_value; |
|
94 | + $a[ 'label' ] = $opt_label; |
|
95 | 95 | |
96 | 96 | // Check if this option is the value of the input |
97 | 97 | if ( $value === $opt_value ) { |
98 | - $a['checked'] = 'checked'; |
|
98 | + $a[ 'checked' ] = 'checked'; |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | $concatenated_items .= $this->$method( $a, $i++ ); |
@@ -123,19 +123,19 @@ discard block |
||
123 | 123 | */ |
124 | 124 | public function __construct( $config, $object_id = 0 ) { |
125 | 125 | |
126 | - if ( empty( $config['id'] ) ) { |
|
126 | + if ( empty( $config[ 'id' ] ) ) { |
|
127 | 127 | wp_die( esc_html__( 'Metabox configuration is required to have an ID parameter.', 'cmb2' ) ); |
128 | 128 | } |
129 | 129 | |
130 | 130 | $this->meta_box = wp_parse_args( $config, $this->mb_defaults ); |
131 | - $this->meta_box['fields'] = array(); |
|
131 | + $this->meta_box[ 'fields' ] = array(); |
|
132 | 132 | |
133 | 133 | $this->object_id( $object_id ); |
134 | 134 | $this->mb_object_type(); |
135 | - $this->cmb_id = $config['id']; |
|
135 | + $this->cmb_id = $config[ 'id' ]; |
|
136 | 136 | |
137 | - if ( ! empty( $config['fields'] ) && is_array( $config['fields'] ) ) { |
|
138 | - $this->add_fields( $config['fields'] ); |
|
137 | + if ( ! empty( $config[ 'fields' ] ) && is_array( $config[ 'fields' ] ) ) { |
|
138 | + $this->add_fields( $config[ 'fields' ] ); |
|
139 | 139 | } |
140 | 140 | |
141 | 141 | CMB2_Boxes::add( $this ); |
@@ -243,17 +243,17 @@ discard block |
||
243 | 243 | |
244 | 244 | // Include custom class if requesting no title. |
245 | 245 | if ( ! $this->prop( 'title' ) && ! $this->prop( 'remove_box_wrap' ) ) { |
246 | - $context[] = 'cmb2-context-wrap-no-title'; |
|
246 | + $context[ ] = 'cmb2-context-wrap-no-title'; |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | // Include a generic context wrapper. |
250 | - $context[] = 'cmb2-context-wrap'; |
|
250 | + $context[ ] = 'cmb2-context-wrap'; |
|
251 | 251 | |
252 | 252 | // Include a context-type based context wrapper. |
253 | - $context[] = 'cmb2-context-wrap-' . $this->prop( 'context' ); |
|
253 | + $context[ ] = 'cmb2-context-wrap-' . $this->prop( 'context' ); |
|
254 | 254 | |
255 | 255 | // Include an ID based context wrapper as well. |
256 | - $context[] = 'cmb2-context-wrap-' . $this->prop( 'id' ); |
|
256 | + $context[ ] = 'cmb2-context-wrap-' . $this->prop( 'id' ); |
|
257 | 257 | |
258 | 258 | // And merge all the classes back into the array. |
259 | 259 | $classes = array_merge( $classes, $context ); |
@@ -332,22 +332,22 @@ discard block |
||
332 | 332 | * @return mixed CMB2_Field object if successful. |
333 | 333 | */ |
334 | 334 | public function render_field( $field_args ) { |
335 | - $field_args['context'] = $this->prop( 'context' ); |
|
335 | + $field_args[ 'context' ] = $this->prop( 'context' ); |
|
336 | 336 | |
337 | - if ( 'group' == $field_args['type'] ) { |
|
337 | + if ( 'group' == $field_args[ 'type' ] ) { |
|
338 | 338 | |
339 | - if ( ! isset( $field_args['show_names'] ) ) { |
|
340 | - $field_args['show_names'] = $this->prop( 'show_names' ); |
|
339 | + if ( ! isset( $field_args[ 'show_names' ] ) ) { |
|
340 | + $field_args[ 'show_names' ] = $this->prop( 'show_names' ); |
|
341 | 341 | } |
342 | 342 | $field = $this->render_group( $field_args ); |
343 | 343 | |
344 | - } elseif ( 'hidden' == $field_args['type'] && $this->get_field( $field_args )->should_show() ) { |
|
344 | + } elseif ( 'hidden' == $field_args[ 'type' ] && $this->get_field( $field_args )->should_show() ) { |
|
345 | 345 | // Save rendering for after the metabox |
346 | 346 | $field = $this->add_hidden_field( $field_args ); |
347 | 347 | |
348 | 348 | } else { |
349 | 349 | |
350 | - $field_args['show_names'] = $this->prop( 'show_names' ); |
|
350 | + $field_args[ 'show_names' ] = $this->prop( 'show_names' ); |
|
351 | 351 | |
352 | 352 | // Render default fields |
353 | 353 | $field = $this->get_field( $field_args )->render_field(); |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | */ |
364 | 364 | public function render_group( $args ) { |
365 | 365 | |
366 | - if ( ! isset( $args['id'], $args['fields'] ) || ! is_array( $args['fields'] ) ) { |
|
366 | + if ( ! isset( $args[ 'id' ], $args[ 'fields' ] ) || ! is_array( $args[ 'fields' ] ) ) { |
|
367 | 367 | return; |
368 | 368 | } |
369 | 369 | |
@@ -473,15 +473,15 @@ discard block |
||
473 | 473 | <div class="inside cmb-td cmb-nested cmb-field-list">'; |
474 | 474 | // Loop and render repeatable group fields |
475 | 475 | foreach ( array_values( $field_group->args( 'fields' ) ) as $field_args ) { |
476 | - if ( 'hidden' == $field_args['type'] ) { |
|
476 | + if ( 'hidden' == $field_args[ 'type' ] ) { |
|
477 | 477 | |
478 | 478 | // Save rendering for after the metabox |
479 | 479 | $this->add_hidden_field( $field_args, $field_group ); |
480 | 480 | |
481 | 481 | } else { |
482 | 482 | |
483 | - $field_args['show_names'] = $field_group->args( 'show_names' ); |
|
484 | - $field_args['context'] = $field_group->args( 'context' ); |
|
483 | + $field_args[ 'show_names' ] = $field_group->args( 'show_names' ); |
|
484 | + $field_args[ 'context' ] = $field_group->args( 'context' ); |
|
485 | 485 | |
486 | 486 | $field = $this->get_field( $field_args, $field_group )->render_field(); |
487 | 487 | } |
@@ -510,7 +510,7 @@ discard block |
||
510 | 510 | * @param CMB2_Field|null $field_group CMB2_Field group field object |
511 | 511 | */ |
512 | 512 | public function add_hidden_field( $field_args, $field_group = null ) { |
513 | - if ( isset( $field_args['field_args'] ) ) { |
|
513 | + if ( isset( $field_args[ 'field_args' ] ) ) { |
|
514 | 514 | // For back-compatibility. |
515 | 515 | $field = new CMB2_Field( $field_args ); |
516 | 516 | } else { |
@@ -523,7 +523,7 @@ discard block |
||
523 | 523 | $types->iterator = $field_group->index; |
524 | 524 | } |
525 | 525 | |
526 | - $this->hidden_fields[] = $types; |
|
526 | + $this->hidden_fields[ ] = $types; |
|
527 | 527 | |
528 | 528 | return $field; |
529 | 529 | } |
@@ -626,11 +626,11 @@ discard block |
||
626 | 626 | */ |
627 | 627 | public function process_field( $field_args ) { |
628 | 628 | |
629 | - switch ( $field_args['type'] ) { |
|
629 | + switch ( $field_args[ 'type' ] ) { |
|
630 | 630 | |
631 | 631 | case 'group': |
632 | 632 | if ( $this->save_group( $field_args ) ) { |
633 | - $this->updated[] = $field_args['id']; |
|
633 | + $this->updated[ ] = $field_args[ 'id' ]; |
|
634 | 634 | } |
635 | 635 | |
636 | 636 | break; |
@@ -644,7 +644,7 @@ discard block |
||
644 | 644 | $field = $this->get_new_field( $field_args ); |
645 | 645 | |
646 | 646 | if ( $field->save_field_from_data( $this->data_to_save ) ) { |
647 | - $this->updated[] = $field->id(); |
|
647 | + $this->updated[ ] = $field->id(); |
|
648 | 648 | } |
649 | 649 | |
650 | 650 | break; |
@@ -711,7 +711,7 @@ discard block |
||
711 | 711 | * @return mixed Return of CMB2_Field::update_data() |
712 | 712 | */ |
713 | 713 | public function save_group( $args ) { |
714 | - if ( ! isset( $args['id'], $args['fields'] ) || ! is_array( $args['fields'] ) ) { |
|
714 | + if ( ! isset( $args[ 'id' ], $args[ 'fields' ] ) || ! is_array( $args[ 'fields' ] ) ) { |
|
715 | 715 | return; |
716 | 716 | } |
717 | 717 | |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | $field_group->data_to_save = $this->data_to_save; |
741 | 741 | |
742 | 742 | foreach ( array_values( $field_group->fields() ) as $field_args ) { |
743 | - if ( 'title' === $field_args['type'] ) { |
|
743 | + if ( 'title' === $field_args[ 'type' ] ) { |
|
744 | 744 | // Don't process title fields |
745 | 745 | continue; |
746 | 746 | } |
@@ -763,16 +763,16 @@ discard block |
||
763 | 763 | $_new_val = array(); |
764 | 764 | foreach ( $new_val as $group_index => $grouped_data ) { |
765 | 765 | // Add the supporting data to the $saved array stack |
766 | - $saved[ $field_group->index ][ $grouped_data['supporting_field_id'] ][] = $grouped_data['supporting_field_value']; |
|
766 | + $saved[ $field_group->index ][ $grouped_data[ 'supporting_field_id' ] ][ ] = $grouped_data[ 'supporting_field_value' ]; |
|
767 | 767 | // Reset var to the actual value |
768 | - $_new_val[ $group_index ] = $grouped_data['value']; |
|
768 | + $_new_val[ $group_index ] = $grouped_data[ 'value' ]; |
|
769 | 769 | } |
770 | 770 | $new_val = $_new_val; |
771 | 771 | } else { |
772 | 772 | // Add the supporting data to the $saved array stack |
773 | - $saved[ $field_group->index ][ $new_val['supporting_field_id'] ] = $new_val['supporting_field_value']; |
|
773 | + $saved[ $field_group->index ][ $new_val[ 'supporting_field_id' ] ] = $new_val[ 'supporting_field_value' ]; |
|
774 | 774 | // Reset var to the actual value |
775 | - $new_val = $new_val['value']; |
|
775 | + $new_val = $new_val[ 'value' ]; |
|
776 | 776 | } |
777 | 777 | } |
778 | 778 | |
@@ -786,7 +786,7 @@ discard block |
||
786 | 786 | |
787 | 787 | // Compare values and add to `$updated` array |
788 | 788 | if ( $is_updated || $is_removed ) { |
789 | - $this->updated[] = $base_id . '::' . $field_group->index . '::' . $sub_id; |
|
789 | + $this->updated[ ] = $base_id . '::' . $field_group->index . '::' . $sub_id; |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | // Add to `$saved` array |
@@ -823,22 +823,22 @@ discard block |
||
823 | 823 | // Try to get our object ID from the global space |
824 | 824 | switch ( $this->object_type() ) { |
825 | 825 | case 'user': |
826 | - $object_id = isset( $_REQUEST['user_id'] ) ? $_REQUEST['user_id'] : $object_id; |
|
827 | - $object_id = ! $object_id && 'user-new.php' != $pagenow && isset( $GLOBALS['user_ID'] ) ? $GLOBALS['user_ID'] : $object_id; |
|
826 | + $object_id = isset( $_REQUEST[ 'user_id' ] ) ? $_REQUEST[ 'user_id' ] : $object_id; |
|
827 | + $object_id = ! $object_id && 'user-new.php' != $pagenow && isset( $GLOBALS[ 'user_ID' ] ) ? $GLOBALS[ 'user_ID' ] : $object_id; |
|
828 | 828 | break; |
829 | 829 | |
830 | 830 | case 'comment': |
831 | - $object_id = isset( $_REQUEST['c'] ) ? $_REQUEST['c'] : $object_id; |
|
832 | - $object_id = ! $object_id && isset( $GLOBALS['comments']->comment_ID ) ? $GLOBALS['comments']->comment_ID : $object_id; |
|
831 | + $object_id = isset( $_REQUEST[ 'c' ] ) ? $_REQUEST[ 'c' ] : $object_id; |
|
832 | + $object_id = ! $object_id && isset( $GLOBALS[ 'comments' ]->comment_ID ) ? $GLOBALS[ 'comments' ]->comment_ID : $object_id; |
|
833 | 833 | break; |
834 | 834 | |
835 | 835 | case 'term': |
836 | - $object_id = isset( $_REQUEST['tag_ID'] ) ? $_REQUEST['tag_ID'] : $object_id; |
|
836 | + $object_id = isset( $_REQUEST[ 'tag_ID' ] ) ? $_REQUEST[ 'tag_ID' ] : $object_id; |
|
837 | 837 | break; |
838 | 838 | |
839 | 839 | default: |
840 | - $object_id = isset( $GLOBALS['post']->ID ) ? $GLOBALS['post']->ID : $object_id; |
|
841 | - $object_id = isset( $_REQUEST['post'] ) ? $_REQUEST['post'] : $object_id; |
|
840 | + $object_id = isset( $GLOBALS[ 'post' ]->ID ) ? $GLOBALS[ 'post' ]->ID : $object_id; |
|
841 | + $object_id = isset( $_REQUEST[ 'post' ] ) ? $_REQUEST[ 'post' ] : $object_id; |
|
842 | 842 | break; |
843 | 843 | } |
844 | 844 | |
@@ -909,7 +909,7 @@ discard block |
||
909 | 909 | * @return boolean True/False |
910 | 910 | */ |
911 | 911 | public function is_options_page_mb() { |
912 | - 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'] ) ); |
|
912 | + 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' ] ) ); |
|
913 | 913 | } |
914 | 914 | |
915 | 915 | /** |
@@ -953,7 +953,7 @@ discard block |
||
953 | 953 | $type = 'term'; |
954 | 954 | } |
955 | 955 | |
956 | - if ( defined( 'DOING_AJAX' ) && isset( $_POST['action'] ) && 'add-tag' === $_POST['action'] ) { |
|
956 | + if ( defined( 'DOING_AJAX' ) && isset( $_POST[ 'action' ] ) && 'add-tag' === $_POST[ 'action' ] ) { |
|
957 | 957 | $type = 'term'; |
958 | 958 | } |
959 | 959 | |
@@ -1000,7 +1000,7 @@ discard block |
||
1000 | 1000 | return $field; |
1001 | 1001 | } |
1002 | 1002 | |
1003 | - $field_id = is_string( $field ) ? $field : $field['id']; |
|
1003 | + $field_id = is_string( $field ) ? $field : $field[ 'id' ]; |
|
1004 | 1004 | |
1005 | 1005 | $parent_field_id = ! empty( $field_group ) ? $field_group->id() : ''; |
1006 | 1006 | $ids = $this->get_field_ids( $field_id, $parent_field_id ); |
@@ -1036,16 +1036,16 @@ discard block |
||
1036 | 1036 | if ( $field_group && ( $sub_field_id || 0 === $sub_field_id ) ) { |
1037 | 1037 | |
1038 | 1038 | // Update the fields array w/ any modified properties inherited from the group field |
1039 | - $this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ] = $field_args; |
|
1039 | + $this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ] = $field_args; |
|
1040 | 1040 | |
1041 | 1041 | return $this->get_default_args( $field_args, $field_group ); |
1042 | 1042 | } |
1043 | 1043 | |
1044 | 1044 | if ( is_array( $field_args ) ) { |
1045 | - $this->meta_box['fields'][ $field_id ] = array_merge( $field_args, $this->meta_box['fields'][ $field_id ] ); |
|
1045 | + $this->meta_box[ 'fields' ][ $field_id ] = array_merge( $field_args, $this->meta_box[ 'fields' ][ $field_id ] ); |
|
1046 | 1046 | } |
1047 | 1047 | |
1048 | - return $this->get_default_args( $this->meta_box['fields'][ $field_id ] ); |
|
1048 | + return $this->get_default_args( $this->meta_box[ 'fields' ][ $field_id ] ); |
|
1049 | 1049 | } |
1050 | 1050 | |
1051 | 1051 | /** |
@@ -1095,8 +1095,8 @@ discard block |
||
1095 | 1095 | |
1096 | 1096 | $sub_fields = false; |
1097 | 1097 | if ( array_key_exists( 'fields', $field ) ) { |
1098 | - $sub_fields = $field['fields']; |
|
1099 | - unset( $field['fields'] ); |
|
1098 | + $sub_fields = $field[ 'fields' ]; |
|
1099 | + unset( $field[ 'fields' ] ); |
|
1100 | 1100 | } |
1101 | 1101 | |
1102 | 1102 | $field_id = $parent_field_id |
@@ -1122,7 +1122,7 @@ discard block |
||
1122 | 1122 | } |
1123 | 1123 | |
1124 | 1124 | // Perform some field-type-specific initiation actions. |
1125 | - switch ( $field['type'] ) { |
|
1125 | + switch ( $field[ 'type' ] ) { |
|
1126 | 1126 | case 'file': |
1127 | 1127 | case 'file_list': |
1128 | 1128 | |
@@ -1137,21 +1137,21 @@ discard block |
||
1137 | 1137 | break; |
1138 | 1138 | } |
1139 | 1139 | |
1140 | - if ( isset( $field['column'] ) && false !== $field['column'] ) { |
|
1140 | + if ( isset( $field[ 'column' ] ) && false !== $field[ 'column' ] ) { |
|
1141 | 1141 | $field = $this->define_field_column( $field ); |
1142 | 1142 | } |
1143 | 1143 | |
1144 | - if ( isset( $field['taxonomy'] ) && ! empty( $field['remove_default'] ) ) { |
|
1145 | - $this->tax_metaboxes_to_remove[ $field['taxonomy'] ] = $field['taxonomy']; |
|
1144 | + if ( isset( $field[ 'taxonomy' ] ) && ! empty( $field[ 'remove_default' ] ) ) { |
|
1145 | + $this->tax_metaboxes_to_remove[ $field[ 'taxonomy' ] ] = $field[ 'taxonomy' ]; |
|
1146 | 1146 | } |
1147 | 1147 | |
1148 | 1148 | $this->_add_field_to_array( |
1149 | 1149 | $field, |
1150 | - $this->meta_box['fields'], |
|
1150 | + $this->meta_box[ 'fields' ], |
|
1151 | 1151 | $position |
1152 | 1152 | ); |
1153 | 1153 | |
1154 | - return $field['id']; |
|
1154 | + return $field[ 'id' ]; |
|
1155 | 1155 | } |
1156 | 1156 | |
1157 | 1157 | /** |
@@ -1163,10 +1163,10 @@ discard block |
||
1163 | 1163 | protected function define_field_column( array $field ) { |
1164 | 1164 | $this->has_columns = true; |
1165 | 1165 | |
1166 | - $column = is_array( $field['column'] ) ? $field['column'] : array(); |
|
1166 | + $column = is_array( $field[ 'column' ] ) ? $field[ 'column' ] : array(); |
|
1167 | 1167 | |
1168 | - $field['column'] = wp_parse_args( $column, array( |
|
1169 | - 'name' => isset( $field['name'] ) ? $field['name'] : '', |
|
1168 | + $field[ 'column' ] = wp_parse_args( $column, array( |
|
1169 | + 'name' => isset( $field[ 'name' ] ) ? $field[ 'name' ] : '', |
|
1170 | 1170 | 'position' => false, |
1171 | 1171 | ) ); |
1172 | 1172 | |
@@ -1182,27 +1182,27 @@ discard block |
||
1182 | 1182 | * @return mixed Array of parent/field ids or false |
1183 | 1183 | */ |
1184 | 1184 | public function add_group_field( $parent_field_id, array $field, $position = 0 ) { |
1185 | - if ( ! array_key_exists( $parent_field_id, $this->meta_box['fields'] ) ) { |
|
1185 | + if ( ! array_key_exists( $parent_field_id, $this->meta_box[ 'fields' ] ) ) { |
|
1186 | 1186 | return false; |
1187 | 1187 | } |
1188 | 1188 | |
1189 | - $parent_field = $this->meta_box['fields'][ $parent_field_id ]; |
|
1189 | + $parent_field = $this->meta_box[ 'fields' ][ $parent_field_id ]; |
|
1190 | 1190 | |
1191 | - if ( 'group' !== $parent_field['type'] ) { |
|
1191 | + if ( 'group' !== $parent_field[ 'type' ] ) { |
|
1192 | 1192 | return false; |
1193 | 1193 | } |
1194 | 1194 | |
1195 | - if ( ! isset( $parent_field['fields'] ) ) { |
|
1196 | - $this->meta_box['fields'][ $parent_field_id ]['fields'] = array(); |
|
1195 | + if ( ! isset( $parent_field[ 'fields' ] ) ) { |
|
1196 | + $this->meta_box[ 'fields' ][ $parent_field_id ][ 'fields' ] = array(); |
|
1197 | 1197 | } |
1198 | 1198 | |
1199 | 1199 | $this->_add_field_to_array( |
1200 | 1200 | $field, |
1201 | - $this->meta_box['fields'][ $parent_field_id ]['fields'], |
|
1201 | + $this->meta_box[ 'fields' ][ $parent_field_id ][ 'fields' ], |
|
1202 | 1202 | $position |
1203 | 1203 | ); |
1204 | 1204 | |
1205 | - return array( $parent_field_id, $field['id'] ); |
|
1205 | + return array( $parent_field_id, $field[ 'id' ] ); |
|
1206 | 1206 | } |
1207 | 1207 | |
1208 | 1208 | /** |
@@ -1214,9 +1214,9 @@ discard block |
||
1214 | 1214 | */ |
1215 | 1215 | protected function _add_field_to_array( $field, &$fields, $position = 0 ) { |
1216 | 1216 | if ( $position ) { |
1217 | - CMB2_Utils::array_insert( $fields, array( $field['id'] => $field ), $position ); |
|
1217 | + CMB2_Utils::array_insert( $fields, array( $field[ 'id' ] => $field ), $position ); |
|
1218 | 1218 | } else { |
1219 | - $fields[ $field['id'] ] = $field; |
|
1219 | + $fields[ $field[ 'id' ] ] = $field; |
|
1220 | 1220 | } |
1221 | 1221 | } |
1222 | 1222 | |
@@ -1239,15 +1239,15 @@ discard block |
||
1239 | 1239 | unset( $this->fields[ implode( '', $ids ) ] ); |
1240 | 1240 | |
1241 | 1241 | if ( ! $sub_field_id ) { |
1242 | - unset( $this->meta_box['fields'][ $field_id ] ); |
|
1242 | + unset( $this->meta_box[ 'fields' ][ $field_id ] ); |
|
1243 | 1243 | return true; |
1244 | 1244 | } |
1245 | 1245 | |
1246 | - if ( isset( $this->fields[ $field_id ]->args['fields'][ $sub_field_id ] ) ) { |
|
1247 | - unset( $this->fields[ $field_id ]->args['fields'][ $sub_field_id ] ); |
|
1246 | + if ( isset( $this->fields[ $field_id ]->args[ 'fields' ][ $sub_field_id ] ) ) { |
|
1247 | + unset( $this->fields[ $field_id ]->args[ 'fields' ][ $sub_field_id ] ); |
|
1248 | 1248 | } |
1249 | - if ( isset( $this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ] ) ) { |
|
1250 | - unset( $this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ] ); |
|
1249 | + if ( isset( $this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ] ) ) { |
|
1250 | + unset( $this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ] ); |
|
1251 | 1251 | } |
1252 | 1252 | return true; |
1253 | 1253 | } |
@@ -1271,11 +1271,11 @@ discard block |
||
1271 | 1271 | list( $field_id, $sub_field_id ) = $ids; |
1272 | 1272 | |
1273 | 1273 | if ( ! $sub_field_id ) { |
1274 | - $this->meta_box['fields'][ $field_id ][ $property ] = $value; |
|
1274 | + $this->meta_box[ 'fields' ][ $field_id ][ $property ] = $value; |
|
1275 | 1275 | return $field_id; |
1276 | 1276 | } |
1277 | 1277 | |
1278 | - $this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ][ $property ] = $value; |
|
1278 | + $this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ][ $property ] = $value; |
|
1279 | 1279 | return $field_id; |
1280 | 1280 | } |
1281 | 1281 | |
@@ -1289,7 +1289,7 @@ discard block |
||
1289 | 1289 | public function get_field_ids( $field_id, $parent_field_id = '' ) { |
1290 | 1290 | $sub_field_id = $parent_field_id ? $field_id : ''; |
1291 | 1291 | $field_id = $parent_field_id ? $parent_field_id : $field_id; |
1292 | - $fields =& $this->meta_box['fields']; |
|
1292 | + $fields = & $this->meta_box[ 'fields' ]; |
|
1293 | 1293 | |
1294 | 1294 | if ( ! array_key_exists( $field_id, $fields ) ) { |
1295 | 1295 | $field_id = $this->search_old_school_array( $field_id, $fields ); |
@@ -1303,12 +1303,12 @@ discard block |
||
1303 | 1303 | return array( $field_id, $sub_field_id ); |
1304 | 1304 | } |
1305 | 1305 | |
1306 | - if ( 'group' !== $fields[ $field_id ]['type'] ) { |
|
1306 | + if ( 'group' !== $fields[ $field_id ][ 'type' ] ) { |
|
1307 | 1307 | return false; |
1308 | 1308 | } |
1309 | 1309 | |
1310 | - if ( ! array_key_exists( $sub_field_id, $fields[ $field_id ]['fields'] ) ) { |
|
1311 | - $sub_field_id = $this->search_old_school_array( $sub_field_id, $fields[ $field_id ]['fields'] ); |
|
1310 | + if ( ! array_key_exists( $sub_field_id, $fields[ $field_id ][ 'fields' ] ) ) { |
|
1311 | + $sub_field_id = $this->search_old_school_array( $sub_field_id, $fields[ $field_id ][ 'fields' ] ); |
|
1312 | 1312 | } |
1313 | 1313 | |
1314 | 1314 | return false === $sub_field_id ? false : array( $field_id, $sub_field_id ); |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $dir = wp_upload_dir(); |
38 | 38 | |
39 | 39 | // Is URL in uploads directory? |
40 | - if ( false === strpos( $img_url, $dir['baseurl'] . '/' ) ) { |
|
40 | + if ( false === strpos( $img_url, $dir[ 'baseurl' ] . '/' ) ) { |
|
41 | 41 | return false; |
42 | 42 | } |
43 | 43 | |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | |
63 | 63 | foreach ( $query->posts as $post_id ) { |
64 | 64 | $meta = wp_get_attachment_metadata( $post_id ); |
65 | - $original_file = basename( $meta['file'] ); |
|
66 | - $cropped_image_files = isset( $meta['sizes'] ) ? wp_list_pluck( $meta['sizes'], 'file' ) : array(); |
|
65 | + $original_file = basename( $meta[ 'file' ] ); |
|
66 | + $cropped_image_files = isset( $meta[ 'sizes' ] ) ? wp_list_pluck( $meta[ 'sizes' ], 'file' ) : array(); |
|
67 | 67 | if ( $original_file === $file || in_array( $file, $cropped_image_files ) ) { |
68 | 68 | $attachment_id = $post_id; |
69 | 69 | break; |
@@ -125,31 +125,31 @@ discard block |
||
125 | 125 | foreach ( $image_sizes as $_size => $data ) { |
126 | 126 | |
127 | 127 | // If there's an exact match to an existing image size, short circuit. |
128 | - if ( $data['width'] == $size[0] && $data['height'] == $size[1] ) { |
|
129 | - $candidates[ $data['width'] * $data['height'] ] = array( $_size, $data ); |
|
128 | + if ( $data[ 'width' ] == $size[ 0 ] && $data[ 'height' ] == $size[ 1 ] ) { |
|
129 | + $candidates[ $data[ 'width' ] * $data[ 'height' ] ] = array( $_size, $data ); |
|
130 | 130 | break; |
131 | 131 | } |
132 | 132 | |
133 | 133 | // If it's not an exact match, consider larger sizes with the same aspect ratio. |
134 | - if ( $data['width'] >= $size[0] && $data['height'] >= $size[1] ) { |
|
134 | + if ( $data[ 'width' ] >= $size[ 0 ] && $data[ 'height' ] >= $size[ 1 ] ) { |
|
135 | 135 | |
136 | 136 | /* |
137 | 137 | * To test for varying crops, we constrain the dimensions of the larger image |
138 | 138 | * to the dimensions of the smaller image and see if they match. |
139 | 139 | */ |
140 | - if ( $data['width'] > $size[0] ) { |
|
141 | - $constrained_size = wp_constrain_dimensions( $data['width'], $data['height'], $size[0] ); |
|
142 | - $expected_size = array( $size[0], $size[1] ); |
|
140 | + if ( $data[ 'width' ] > $size[ 0 ] ) { |
|
141 | + $constrained_size = wp_constrain_dimensions( $data[ 'width' ], $data[ 'height' ], $size[ 0 ] ); |
|
142 | + $expected_size = array( $size[ 0 ], $size[ 1 ] ); |
|
143 | 143 | } else { |
144 | - $constrained_size = wp_constrain_dimensions( $size[0], $size[1], $data['width'] ); |
|
145 | - $expected_size = array( $data['width'], $data['height'] ); |
|
144 | + $constrained_size = wp_constrain_dimensions( $size[ 0 ], $size[ 1 ], $data[ 'width' ] ); |
|
145 | + $expected_size = array( $data[ 'width' ], $data[ 'height' ] ); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | // If the image dimensions are within 1px of the expected size, we consider it a match. |
149 | - $matched = ( abs( $constrained_size[0] - $expected_size[0] ) <= 1 && abs( $constrained_size[1] - $expected_size[1] ) <= 1 ); |
|
149 | + $matched = ( abs( $constrained_size[ 0 ] - $expected_size[ 0 ] ) <= 1 && abs( $constrained_size[ 1 ] - $expected_size[ 1 ] ) <= 1 ); |
|
150 | 150 | |
151 | 151 | if ( $matched ) { |
152 | - $candidates[ $data['width'] * $data['height'] ] = array( $_size, $data ); |
|
152 | + $candidates[ $data[ 'width' ] * $data[ 'height' ] ] = array( $_size, $data ); |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | } |
@@ -161,13 +161,13 @@ discard block |
||
161 | 161 | } |
162 | 162 | |
163 | 163 | $data = array_shift( $candidates ); |
164 | - $data = $data[0]; |
|
164 | + $data = $data[ 0 ]; |
|
165 | 165 | } |
166 | 166 | /* |
167 | 167 | * When the size requested is smaller than the thumbnail dimensions, we |
168 | 168 | * fall back to the thumbnail size. |
169 | 169 | */ |
170 | - elseif ( ! empty( $image_sizes['thumbnail'] ) && $image_sizes['thumbnail']['width'] >= $size[0] && $image_sizes['thumbnail']['width'] >= $size[1] ) { |
|
170 | + elseif ( ! empty( $image_sizes[ 'thumbnail' ] ) && $image_sizes[ 'thumbnail' ][ 'width' ] >= $size[ 0 ] && $image_sizes[ 'thumbnail' ][ 'width' ] >= $size[ 1 ] ) { |
|
171 | 171 | $data = 'thumbnail'; |
172 | 172 | } else { |
173 | 173 | return false; |
@@ -257,8 +257,7 @@ discard block |
||
257 | 257 | } |
258 | 258 | |
259 | 259 | return self::is_valid_time_stamp( $string ) |
260 | - ? (int) $string : |
|
261 | - strtotime( (string) $string ); |
|
260 | + ? (int) $string : strtotime( (string) $string ); |
|
262 | 261 | } |
263 | 262 | |
264 | 263 | /** |
@@ -289,7 +288,7 @@ discard block |
||
289 | 288 | * @param mixed $value Value to check |
290 | 289 | * @return bool True or false |
291 | 290 | */ |
292 | - public static function notempty( $value ){ |
|
291 | + public static function notempty( $value ) { |
|
293 | 292 | return null !== $value && '' !== $value && false !== $value && array() !== $value; |
294 | 293 | } |
295 | 294 | |
@@ -447,24 +446,24 @@ discard block |
||
447 | 446 | |
448 | 447 | // order is relevant here, since the replacement will be done sequentially. |
449 | 448 | $supported_options = array( |
450 | - 'd' => 'dd', // Day, leading 0 |
|
451 | - 'j' => 'd', // Day, no 0 |
|
452 | - 'z' => 'o', // Day of the year, no leading zeroes, |
|
449 | + 'd' => 'dd', // Day, leading 0 |
|
450 | + 'j' => 'd', // Day, no 0 |
|
451 | + 'z' => 'o', // Day of the year, no leading zeroes, |
|
453 | 452 | // 'D' => 'D', // Day name short, not sure how it'll work with translations |
454 | 453 | // 'l' => 'DD', // Day name full, idem before |
455 | - 'm' => 'mm', // Month of the year, leading 0 |
|
456 | - 'n' => 'm', // Month of the year, no leading 0 |
|
454 | + 'm' => 'mm', // Month of the year, leading 0 |
|
455 | + 'n' => 'm', // Month of the year, no leading 0 |
|
457 | 456 | // 'M' => 'M', // Month, Short name |
458 | 457 | // 'F' => 'MM', // Month, full name, |
459 | - 'y' => 'y', // Year, two digit |
|
460 | - 'Y' => 'yy', // Year, full |
|
461 | - 'H' => 'HH', // Hour with leading 0 (24 hour) |
|
462 | - 'G' => 'H', // Hour with no leading 0 (24 hour) |
|
463 | - 'h' => 'hh', // Hour with leading 0 (12 hour) |
|
464 | - 'g' => 'h', // Hour with no leading 0 (12 hour), |
|
465 | - 'i' => 'mm', // Minute with leading 0, |
|
466 | - 's' => 'ss', // Second with leading 0, |
|
467 | - 'a' => 'tt', // am/pm |
|
458 | + 'y' => 'y', // Year, two digit |
|
459 | + 'Y' => 'yy', // Year, full |
|
460 | + 'H' => 'HH', // Hour with leading 0 (24 hour) |
|
461 | + 'G' => 'H', // Hour with no leading 0 (24 hour) |
|
462 | + 'h' => 'hh', // Hour with leading 0 (12 hour) |
|
463 | + 'g' => 'h', // Hour with no leading 0 (12 hour), |
|
464 | + 'i' => 'mm', // Minute with leading 0, |
|
465 | + 's' => 'ss', // Second with leading 0, |
|
466 | + 'a' => 'tt', // am/pm |
|
468 | 467 | 'A' => 'TT' // AM/PM |
469 | 468 | ); |
470 | 469 | |
@@ -485,7 +484,7 @@ discard block |
||
485 | 484 | * @return string Modified value |
486 | 485 | */ |
487 | 486 | public static function wrap_escaped_chars( $value ) { |
488 | - return "'" . str_replace( '\\', '', $value[0] ) . "'"; |
|
487 | + return "'" . str_replace( '\\', '', $value[ 0 ] ) . "'"; |
|
489 | 488 | } |
490 | 489 | |
491 | 490 | /** |
@@ -544,7 +543,7 @@ discard block |
||
544 | 543 | * @return string String of attributes for form element. |
545 | 544 | */ |
546 | 545 | public static function concat_attrs( $attrs, $attr_exclude = array() ) { |
547 | - $attr_exclude[] = 'rendered'; |
|
546 | + $attr_exclude[ ] = 'rendered'; |
|
548 | 547 | $attributes = ''; |
549 | 548 | foreach ( $attrs as $attr => $val ) { |
550 | 549 | $excluded = in_array( $attr, (array) $attr_exclude, true ); |
@@ -24,15 +24,15 @@ discard block |
||
24 | 24 | $img_size_data = parent::get_image_size_data( $img_size, 'large' ); |
25 | 25 | |
26 | 26 | // if options array and 'url' => false, then hide the url field |
27 | - $input_type = array_key_exists( 'url', $options ) && false === $options['url'] ? 'hidden' : 'text'; |
|
27 | + $input_type = array_key_exists( 'url', $options ) && false === $options[ 'url' ] ? 'hidden' : 'text'; |
|
28 | 28 | |
29 | 29 | $output .= parent::render( array( |
30 | 30 | 'type' => $input_type, |
31 | 31 | 'class' => 'cmb2-upload-file regular-text', |
32 | 32 | 'size' => 45, |
33 | 33 | 'desc' => '', |
34 | - 'data-previewsize' => sprintf( '[%d,%d]', $img_size_data['width'], $img_size_data['height'] ), |
|
35 | - 'data-sizename' => $img_size_data['name'], |
|
34 | + 'data-previewsize' => sprintf( '[%d,%d]', $img_size_data[ 'width' ], $img_size_data[ 'height' ] ), |
|
35 | + 'data-sizename' => $img_size_data[ 'name' ], |
|
36 | 36 | 'data-queryargs' => ! empty( $query_args ) ? json_encode( $query_args ) : '', |
37 | 37 | 'js_dependencies' => 'media-editor', |
38 | 38 | ) ); |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | if ( $_id_value ) { |
81 | 81 | $image = wp_get_attachment_image( $_id_value, $img_size, null, array( 'class' => 'cmb-file-field-image' ) ); |
82 | 82 | } else { |
83 | - $image = '<img style="max-width: ' . absint( $img_size_data['width'] ) . 'px; width: 100%;" src="' . $meta_value . '" class="cmb-file-field-image" alt="" />'; |
|
83 | + $image = '<img style="max-width: ' . absint( $img_size_data[ 'width' ] ) . 'px; width: 100%;" src="' . $meta_value . '" class="cmb-file-field-image" alt="" />'; |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | $output .= $this->img_status_output( array( |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | */ |
56 | 56 | public function img_status_output( $args ) { |
57 | 57 | return sprintf( '<%1$s class="img-status cmb2-media-item">%2$s<p class="cmb2-remove-wrapper"><a href="#" class="cmb2-remove-file-button"%3$s>%4$s</a></p>%5$s</%1$s>', |
58 | - $args['tag'], |
|
59 | - $args['image'], |
|
60 | - isset( $args['cached_id'] ) ? ' rel="' . $args['cached_id'] . '"' : '', |
|
58 | + $args[ 'tag' ], |
|
59 | + $args[ 'image' ], |
|
60 | + isset( $args[ 'cached_id' ] ) ? ' rel="' . $args[ 'cached_id' ] . '"' : '', |
|
61 | 61 | esc_html( $this->_text( 'remove_image_text', esc_html__( 'Remove Image', 'cmb2' ) ) ), |
62 | - isset( $args['id_input'] ) ? $args['id_input'] : '' |
|
62 | + isset( $args[ 'id_input' ] ) ? $args[ 'id_input' ] : '' |
|
63 | 63 | ); |
64 | 64 | } |
65 | 65 | |
@@ -71,14 +71,14 @@ discard block |
||
71 | 71 | */ |
72 | 72 | public function file_status_output( $args ) { |
73 | 73 | return sprintf( '<%1$s class="file-status cmb2-media-item"><span>%2$s <strong>%3$s</strong></span> (<a href="%4$s" target="_blank" rel="external">%5$s</a> / <a href="#" class="cmb2-remove-file-button"%6$s>%7$s</a>)%8$s</%1$s>', |
74 | - $args['tag'], |
|
74 | + $args[ 'tag' ], |
|
75 | 75 | esc_html( $this->_text( 'file_text', esc_html__( 'File:', 'cmb2' ) ) ), |
76 | - CMB2_Utils::get_file_name_from_path( $args['value'] ), |
|
77 | - $args['value'], |
|
76 | + CMB2_Utils::get_file_name_from_path( $args[ 'value' ] ), |
|
77 | + $args[ 'value' ], |
|
78 | 78 | esc_html( $this->_text( 'file_download_text', esc_html__( 'Download', 'cmb2' ) ) ), |
79 | - isset( $args['cached_id'] ) ? ' rel="' . $args['cached_id'] . '"' : '', |
|
79 | + isset( $args[ 'cached_id' ] ) ? ' rel="' . $args[ 'cached_id' ] . '"' : '', |
|
80 | 80 | esc_html( $this->_text( 'remove_text', esc_html__( 'Remove', 'cmb2' ) ) ), |
81 | - isset( $args['id_input'] ) ? $args['id_input'] : '' |
|
81 | + isset( $args[ 'id_input' ] ) ? $args[ 'id_input' ] : '' |
|
82 | 82 | ); |
83 | 83 | } |
84 | 84 | |
@@ -103,13 +103,13 @@ discard block |
||
103 | 103 | $data = array(); |
104 | 104 | |
105 | 105 | if ( is_array( $img_size ) ) { |
106 | - $data['width'] = intval( $img_size[0] ); |
|
107 | - $data['height'] = intval( $img_size[1] ); |
|
108 | - $data['name'] = ''; |
|
106 | + $data[ 'width' ] = intval( $img_size[ 0 ] ); |
|
107 | + $data[ 'height' ] = intval( $img_size[ 1 ] ); |
|
108 | + $data[ 'name' ] = ''; |
|
109 | 109 | |
110 | 110 | // Try and get the closest named size from our array of dimensions |
111 | 111 | if ( $named_size = CMB2_Utils::get_named_size( $img_size ) ) { |
112 | - $data['name'] = $named_size; |
|
112 | + $data[ 'name' ] = $named_size; |
|
113 | 113 | } |
114 | 114 | } else { |
115 | 115 | |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | } |
127 | 127 | |
128 | 128 | // Get image dimensions from named sizes |
129 | - $data['width'] = intval( $image_sizes[ $img_size ]['width'] ); |
|
130 | - $data['height'] = intval( $image_sizes[ $img_size ]['height'] ); |
|
131 | - $data['name'] = $img_size; |
|
129 | + $data[ 'width' ] = intval( $image_sizes[ $img_size ][ 'width' ] ); |
|
130 | + $data[ 'height' ] = intval( $image_sizes[ $img_size ][ 'height' ] ); |
|
131 | + $data[ 'name' ] = $img_size; |
|
132 | 132 | } |
133 | 133 | |
134 | 134 | return $data; |
@@ -150,17 +150,17 @@ discard block |
||
150 | 150 | foreach ( CMB2_Utils::get_available_image_sizes() as $size => $info ) { |
151 | 151 | |
152 | 152 | // registered image size exists for this attachment |
153 | - if ( isset( $meta['sizes'][ $size ] ) ) { |
|
153 | + if ( isset( $meta[ 'sizes' ][ $size ] ) ) { |
|
154 | 154 | |
155 | 155 | $attachment_url = wp_get_attachment_url( $attachment->ID ); |
156 | 156 | $base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url ); |
157 | - $size_meta = $meta['sizes'][ $size ]; |
|
157 | + $size_meta = $meta[ 'sizes' ][ $size ]; |
|
158 | 158 | |
159 | - $response['sizes'][ $size ] = array( |
|
160 | - 'url' => $base_url . $size_meta['file'], |
|
161 | - 'height' => $size_meta['height'], |
|
162 | - 'width' => $size_meta['width'], |
|
163 | - 'orientation' => $size_meta['height'] > $size_meta['width'] ? 'portrait' : 'landscape', |
|
159 | + $response[ 'sizes' ][ $size ] = array( |
|
160 | + 'url' => $base_url . $size_meta[ 'file' ], |
|
161 | + 'height' => $size_meta[ 'height' ], |
|
162 | + 'width' => $size_meta[ 'width' ], |
|
163 | + 'orientation' => $size_meta[ 'height' ] > $size_meta[ 'width' ] ? 'portrait' : 'landscape', |
|
164 | 164 | ); |
165 | 165 | } |
166 | 166 | } |