@@ -76,9 +76,12 @@ |
||
76 | 76 | |
77 | 77 | <?php lsx_paging_nav(); ?> |
78 | 78 | |
79 | - <?php else : ?> |
|
79 | + <?php else { |
|
80 | + : ?> |
|
80 | 81 | |
81 | - <?php get_template_part( 'partials/content', 'none' ); ?> |
|
82 | + <?php get_template_part( 'partials/content', 'none' ); |
|
83 | +} |
|
84 | +?> |
|
82 | 85 | |
83 | 86 | <?php endif; ?> |
84 | 87 |
@@ -30,16 +30,22 @@ |
||
30 | 30 | <?php if ( ! empty( lsx_get_thumbnail( 'lsx-thumbnail-single' ) ) ) : ?> |
31 | 31 | <?php if ( ! isset( $lsx_projects_frontend->options['display'] ) || ! isset( $lsx_projects_frontend->options['display']['team_disable_single'] ) ) : ?> |
32 | 32 | <a href="<?php the_permalink(); ?>"><figure class="lsx-projects-avatar"><?php lsx_thumbnail( 'lsx-thumbnail-single' ); ?></figure></a> |
33 | - <?php else : ?> |
|
34 | - <figure class="lsx-projects-avatar"><?php lsx_thumbnail( 'lsx-thumbnail-single' ); ?></figure> |
|
33 | + <?php else { |
|
34 | + : ?> |
|
35 | + <figure class="lsx-projects-avatar"><?php lsx_thumbnail( 'lsx-thumbnail-single' ); |
|
36 | +} |
|
37 | +?></figure> |
|
35 | 38 | <?php endif; ?> |
36 | 39 | <?php endif; ?> |
37 | 40 | |
38 | 41 | <h5 class="lsx-projects-title"> |
39 | 42 | <?php if ( ! isset( $lsx_projects_frontend->options['display'] ) || ! isset( $lsx_projects_frontend->options['display']['team_disable_single'] ) ) : ?> |
40 | 43 | <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> |
41 | - <?php else : ?> |
|
42 | - <?php the_title(); ?> |
|
44 | + <?php else { |
|
45 | + : ?> |
|
46 | + <?php the_title(); |
|
47 | +} |
|
48 | +?> |
|
43 | 49 | <?php endif; ?> |
44 | 50 | </h5> |
45 | 51 |
@@ -1,12 +1,15 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( ! defined( 'CMB_DEV') ) |
|
2 | +if ( ! defined( 'CMB_DEV') ) { |
|
3 | 3 | define( 'CMB_DEV', false ); |
4 | +} |
|
4 | 5 | |
5 | -if ( ! defined( 'CMB_PATH') ) |
|
6 | +if ( ! defined( 'CMB_PATH') ) { |
|
6 | 7 | define( 'CMB_PATH', plugin_dir_path( __FILE__ ) ); |
8 | +} |
|
7 | 9 | |
8 | -if ( ! defined( 'CMB_URL' ) ) |
|
10 | +if ( ! defined( 'CMB_URL' ) ) { |
|
9 | 11 | define( 'CMB_URL', plugins_url( '', __FILE__ ) ); |
12 | +} |
|
10 | 13 | |
11 | 14 | include_once( CMB_PATH . '/classes.fields.php' ); |
12 | 15 | include_once( CMB_PATH . '/class.cmb-meta-box.php' ); |
@@ -23,8 +26,9 @@ discard block |
||
23 | 26 | */ |
24 | 27 | function cmb_init() { |
25 | 28 | |
26 | - if ( ! is_admin() ) |
|
27 | - return; |
|
29 | + if ( ! is_admin() ) { |
|
30 | + return; |
|
31 | + } |
|
28 | 32 | |
29 | 33 | // Load translations |
30 | 34 | $textdomain = 'cmb'; |
@@ -36,9 +40,10 @@ discard block |
||
36 | 40 | |
37 | 41 | $meta_boxes = apply_filters( 'cmb_meta_boxes', array() ); |
38 | 42 | |
39 | - if ( ! empty( $meta_boxes ) ) |
|
40 | - foreach ( $meta_boxes as $meta_box ) |
|
43 | + if ( ! empty( $meta_boxes ) ) { |
|
44 | + foreach ( $meta_boxes as $meta_box ) |
|
41 | 45 | new CMB_Meta_Box( $meta_box ); |
46 | + } |
|
42 | 47 | |
43 | 48 | } |
44 | 49 | add_action( 'init', 'cmb_init', 50 ); |
@@ -92,8 +97,9 @@ discard block |
||
92 | 97 | |
93 | 98 | $map = _cmb_available_fields(); |
94 | 99 | |
95 | - if ( isset( $map[$type] ) ) |
|
96 | - return $map[$type]; |
|
100 | + if ( isset( $map[$type] ) ) { |
|
101 | + return $map[$type]; |
|
102 | + } |
|
97 | 103 | |
98 | 104 | return false; |
99 | 105 | |
@@ -118,15 +124,17 @@ discard block |
||
118 | 124 | preg_match( $pattern, $query, $matches ) |
119 | 125 | ) { |
120 | 126 | |
121 | - if ( isset( $matches[1] ) && 'user_id' == $matches[1] ) |
|
122 | - $meta_id_column = 'umeta_id'; |
|
123 | - else |
|
124 | - $meta_id_column = 'meta_id'; |
|
127 | + if ( isset( $matches[1] ) && 'user_id' == $matches[1] ) { |
|
128 | + $meta_id_column = 'umeta_id'; |
|
129 | + } else { |
|
130 | + $meta_id_column = 'meta_id'; |
|
131 | + } |
|
125 | 132 | |
126 | 133 | $meta_query_orderby = ' ORDER BY ' . $meta_id_column; |
127 | 134 | |
128 | - if ( false === strpos( $query, $meta_query_orderby ) ) |
|
129 | - $query .= $meta_query_orderby; |
|
135 | + if ( false === strpos( $query, $meta_query_orderby ) ) { |
|
136 | + $query .= $meta_query_orderby; |
|
137 | + } |
|
130 | 138 | |
131 | 139 | } |
132 | 140 | |
@@ -134,5 +142,6 @@ discard block |
||
134 | 142 | |
135 | 143 | } |
136 | 144 | |
137 | -if ( version_compare( get_bloginfo( 'version' ), '3.8', '<' ) ) |
|
138 | - add_filter( 'query', 'cmb_fix_meta_query_order', 1 ); |
|
139 | 145 | \ No newline at end of file |
146 | +if ( version_compare( get_bloginfo( 'version' ), '3.8', '<' ) ) { |
|
147 | + add_filter( 'query', 'cmb_fix_meta_query_order', 1 ); |
|
148 | +} |
@@ -33,10 +33,11 @@ discard block |
||
33 | 33 | } |
34 | 34 | |
35 | 35 | // If the field has a custom value populator callback |
36 | - if ( ! empty( $args['values_callback'] ) ) |
|
37 | - $this->values = call_user_func( $args['values_callback'], get_the_id() ); |
|
38 | - else |
|
39 | - $this->values = $values; |
|
36 | + if ( ! empty( $args['values_callback'] ) ) { |
|
37 | + $this->values = call_user_func( $args['values_callback'], get_the_id() ); |
|
38 | + } else { |
|
39 | + $this->values = $values; |
|
40 | + } |
|
40 | 41 | |
41 | 42 | $this->value = reset( $this->values ); |
42 | 43 | |
@@ -79,8 +80,9 @@ discard block |
||
79 | 80 | */ |
80 | 81 | public function enqueue_scripts() { |
81 | 82 | |
82 | - if ( isset( $this->args['sortable'] ) && $this->args['sortable'] ) |
|
83 | - wp_enqueue_script( 'jquery-ui-sortable' ); |
|
83 | + if ( isset( $this->args['sortable'] ) && $this->args['sortable'] ) { |
|
84 | + wp_enqueue_script( 'jquery-ui-sortable' ); |
|
85 | + } |
|
84 | 86 | |
85 | 87 | } |
86 | 88 | |
@@ -128,8 +130,9 @@ discard block |
||
128 | 130 | |
129 | 131 | $id .= '-cmb-field-' . $this->field_index; |
130 | 132 | |
131 | - if ( ! is_null( $append ) ) |
|
132 | - $id .= '-' . $append; |
|
133 | + if ( ! is_null( $append ) ) { |
|
134 | + $id .= '-' . $append; |
|
135 | + } |
|
133 | 136 | |
134 | 137 | $id = str_replace( array( '[', ']', '--' ), '-', $id ); |
135 | 138 | |
@@ -169,8 +172,9 @@ discard block |
||
169 | 172 | |
170 | 173 | $name .= "[cmb-field-$this->field_index]"; |
171 | 174 | |
172 | - if ( ! is_null( $append ) ) |
|
173 | - $name .= $append; |
|
175 | + if ( ! is_null( $append ) ) { |
|
176 | + $name .= $append; |
|
177 | + } |
|
174 | 178 | |
175 | 179 | return $name; |
176 | 180 | |
@@ -199,16 +203,19 @@ discard block |
||
199 | 203 | |
200 | 204 | public function boolean_attr( $attrs = array() ) { |
201 | 205 | |
202 | - if ( $this->args['readonly'] ) |
|
203 | - $attrs[] = 'readonly'; |
|
206 | + if ( $this->args['readonly'] ) { |
|
207 | + $attrs[] = 'readonly'; |
|
208 | + } |
|
204 | 209 | |
205 | - if ( $this->args['disabled'] ) |
|
206 | - $attrs[] = 'disabled'; |
|
210 | + if ( $this->args['disabled'] ) { |
|
211 | + $attrs[] = 'disabled'; |
|
212 | + } |
|
207 | 213 | |
208 | 214 | $attrs = array_filter( array_unique( $attrs ) ); |
209 | 215 | |
210 | - foreach ( $attrs as $attr ) |
|
211 | - echo esc_html( $attr ) . '="' . esc_attr( $attr ) . '"'; |
|
216 | + foreach ( $attrs as $attr ) { |
|
217 | + echo esc_html( $attr ) . '="' . esc_attr( $attr ) . '"'; |
|
218 | + } |
|
212 | 219 | |
213 | 220 | } |
214 | 221 | |
@@ -228,8 +235,9 @@ discard block |
||
228 | 235 | */ |
229 | 236 | protected function get_delegate_data() { |
230 | 237 | |
231 | - if ( $this->args['data_delegate'] ) |
|
232 | - return call_user_func_array( $this->args['data_delegate'], array( $this ) ); |
|
238 | + if ( $this->args['data_delegate'] ) { |
|
239 | + return call_user_func_array( $this->args['data_delegate'], array( $this ) ); |
|
240 | + } |
|
233 | 241 | |
234 | 242 | return array(); |
235 | 243 | |
@@ -262,8 +270,9 @@ discard block |
||
262 | 270 | public function save( $post_id, $values ) { |
263 | 271 | |
264 | 272 | // Don't save readonly values. |
265 | - if ( $this->args['readonly'] ) |
|
266 | - return; |
|
273 | + if ( $this->args['readonly'] ) { |
|
274 | + return; |
|
275 | + } |
|
267 | 276 | |
268 | 277 | $this->values = $values; |
269 | 278 | $this->parse_save_values(); |
@@ -278,8 +287,9 @@ discard block |
||
278 | 287 | } |
279 | 288 | |
280 | 289 | // If we are not on a post edit screen |
281 | - if ( ! $post_id ) |
|
282 | - return; |
|
290 | + if ( ! $post_id ) { |
|
291 | + return; |
|
292 | + } |
|
283 | 293 | |
284 | 294 | delete_post_meta( $post_id, $this->id ); |
285 | 295 | |
@@ -288,8 +298,9 @@ discard block |
||
288 | 298 | $this->value = $v; |
289 | 299 | $this->parse_save_value(); |
290 | 300 | |
291 | - if ( $this->value || $this->value === '0' ) |
|
292 | - add_post_meta( $post_id, $this->id, $this->value ); |
|
301 | + if ( $this->value || $this->value === '0' ) { |
|
302 | + add_post_meta( $post_id, $this->id, $this->value ); |
|
303 | + } |
|
293 | 304 | |
294 | 305 | } |
295 | 306 | } |
@@ -323,10 +334,11 @@ discard block |
||
323 | 334 | public function display() { |
324 | 335 | |
325 | 336 | // If there are no values and it's not repeateble, we want to do one with empty string |
326 | - if ( ! $this->get_values() && ! $this->args['repeatable'] ) |
|
327 | - $values = array( '' ); |
|
328 | - else |
|
329 | - $values = $this->get_values(); |
|
337 | + if ( ! $this->get_values() && ! $this->args['repeatable'] ) { |
|
338 | + $values = array( '' ); |
|
339 | + } else { |
|
340 | + $values = $this->get_values(); |
|
341 | + } |
|
330 | 342 | |
331 | 343 | $this->title(); |
332 | 344 | |
@@ -468,7 +480,10 @@ discard block |
||
468 | 480 | |
469 | 481 | <?php if ( $this->get_value() ) : ?> |
470 | 482 | |
471 | - <?php if ( isset( $icon_img ) ) echo $icon_img; ?> |
|
483 | + <?php if ( isset( $icon_img ) ) { |
|
484 | + echo $icon_img; |
|
485 | +} |
|
486 | +?> |
|
472 | 487 | |
473 | 488 | <div class="cmb-file-name"> |
474 | 489 | <strong><?php echo esc_html( basename( get_attached_file( $this->get_value() ) ) ); ?></strong> |
@@ -514,8 +529,9 @@ discard block |
||
514 | 529 | |
515 | 530 | public function html() { |
516 | 531 | |
517 | - if ( $this->get_value() ) |
|
518 | - $image = wp_get_attachment_image_src( $this->get_value(), $this->args['size'], true ); |
|
532 | + if ( $this->get_value() ) { |
|
533 | + $image = wp_get_attachment_image_src( $this->get_value(), $this->args['size'], true ); |
|
534 | + } |
|
519 | 535 | |
520 | 536 | // Convert size arg to array of width, height, crop |
521 | 537 | $size = $this->parse_image_size( $this->args['size'] ); |
@@ -594,8 +610,9 @@ discard block |
||
594 | 610 | } |
595 | 611 | |
596 | 612 | // Handle default WP size format. |
597 | - if ( is_array( $size ) && isset( $size[0] ) && isset( $size[1] ) ) |
|
598 | - $size = array( 'width' => $size[0], 'height' => $size[1] ); |
|
613 | + if ( is_array( $size ) && isset( $size[0] ) && isset( $size[1] ) ) { |
|
614 | + $size = array( 'width' => $size[0], 'height' => $size[1] ); |
|
615 | + } |
|
599 | 616 | |
600 | 617 | return wp_parse_args( $size, array( |
601 | 618 | 'width' => get_option( 'thumbnail_size_w' ), |
@@ -612,8 +629,9 @@ discard block |
||
612 | 629 | */ |
613 | 630 | static function request_image_ajax_callback() { |
614 | 631 | |
615 | - if ( ! ( isset( $_POST['nonce'] ) && wp_verify_nonce( $_POST['nonce'], 'cmb-file-upload-nonce' ) ) ) |
|
616 | - return; |
|
632 | + if ( ! ( isset( $_POST['nonce'] ) && wp_verify_nonce( $_POST['nonce'], 'cmb-file-upload-nonce' ) ) ) { |
|
633 | + return; |
|
634 | + } |
|
617 | 635 | |
618 | 636 | $id = intval( $_POST['id'] ); |
619 | 637 | |
@@ -734,8 +752,9 @@ discard block |
||
734 | 752 | |
735 | 753 | public function parse_save_values() { |
736 | 754 | |
737 | - foreach( $this->values as &$value ) |
|
738 | - $value = strtotime( $value ); |
|
755 | + foreach( $this->values as &$value ) { |
|
756 | + $value = strtotime( $value ); |
|
757 | + } |
|
739 | 758 | |
740 | 759 | sort( $this->values ); |
741 | 760 | |
@@ -771,10 +790,11 @@ discard block |
||
771 | 790 | // Convert all [date] and [time] values to a unix timestamp. |
772 | 791 | // If date is empty, assume delete. If time is empty, assume 00:00. |
773 | 792 | foreach( $this->values as $key => &$value ) { |
774 | - if ( empty( $value['date'] ) ) |
|
775 | - unset( $this->values[$key] ); |
|
776 | - else |
|
777 | - $value = strtotime( $value['date'] . ' ' . $value['time'] ); |
|
793 | + if ( empty( $value['date'] ) ) { |
|
794 | + unset( $this->values[$key] ); |
|
795 | + } else { |
|
796 | + $value = strtotime( $value['date'] . ' ' . $value['time'] ); |
|
797 | + } |
|
778 | 798 | } |
779 | 799 | |
780 | 800 | $this->values = array_filter( $this->values ); |
@@ -866,8 +886,10 @@ discard block |
||
866 | 886 | |
867 | 887 | public function html() { |
868 | 888 | |
869 | - if ( $this->has_data_delegate() ) |
|
870 | - $this->args['options'] = $this->get_delegate_data(); ?> |
|
889 | + if ( $this->has_data_delegate() ) { |
|
890 | + $this->args['options'] = $this->get_delegate_data(); |
|
891 | + } |
|
892 | + ?> |
|
871 | 893 | |
872 | 894 | <?php foreach ( $this->args['options'] as $key => $value ): ?> |
873 | 895 | |
@@ -906,8 +928,10 @@ discard block |
||
906 | 928 | |
907 | 929 | public function html() { |
908 | 930 | |
909 | - if ( $this->has_data_delegate() ) |
|
910 | - $this->args['options'] = $this->get_delegate_data(); ?> |
|
931 | + if ( $this->has_data_delegate() ) { |
|
932 | + $this->args['options'] = $this->get_delegate_data(); |
|
933 | + } |
|
934 | + ?> |
|
911 | 935 | |
912 | 936 | <?php foreach ( $this->args['options'] as $key => $value ): ?> |
913 | 937 | <div class="cmb-cell-2"> |
@@ -1039,10 +1063,11 @@ discard block |
||
1039 | 1063 | */ |
1040 | 1064 | public function is_placeholder() { |
1041 | 1065 | |
1042 | - if ( isset( $this->parent ) && ! is_int( $this->parent->field_index ) ) |
|
1043 | - return true; |
|
1044 | - |
|
1045 | - else return ! is_int( $this->field_index ); |
|
1066 | + if ( isset( $this->parent ) && ! is_int( $this->parent->field_index ) ) { |
|
1067 | + return true; |
|
1068 | + } else { |
|
1069 | + return ! is_int( $this->field_index ); |
|
1070 | + } |
|
1046 | 1071 | |
1047 | 1072 | } |
1048 | 1073 | |
@@ -1086,15 +1111,17 @@ discard block |
||
1086 | 1111 | |
1087 | 1112 | public function parse_save_values(){ |
1088 | 1113 | |
1089 | - if ( isset( $this->parent ) && isset( $this->args['multiple'] ) && $this->args['multiple'] ) |
|
1090 | - $this->values = array( $this->values ); |
|
1114 | + if ( isset( $this->parent ) && isset( $this->args['multiple'] ) && $this->args['multiple'] ) { |
|
1115 | + $this->values = array( $this->values ); |
|
1116 | + } |
|
1091 | 1117 | |
1092 | 1118 | } |
1093 | 1119 | |
1094 | 1120 | public function get_options() { |
1095 | 1121 | |
1096 | - if ( $this->has_data_delegate() ) |
|
1097 | - $this->args['options'] = $this->get_delegate_data(); |
|
1122 | + if ( $this->has_data_delegate() ) { |
|
1123 | + $this->args['options'] = $this->get_delegate_data(); |
|
1124 | + } |
|
1098 | 1125 | |
1099 | 1126 | return $this->args['options']; |
1100 | 1127 | } |
@@ -1133,8 +1160,9 @@ discard block |
||
1133 | 1160 | |
1134 | 1161 | public function html() { |
1135 | 1162 | |
1136 | - if ( $this->has_data_delegate() ) |
|
1137 | - $this->args['options'] = $this->get_delegate_data(); |
|
1163 | + if ( $this->has_data_delegate() ) { |
|
1164 | + $this->args['options'] = $this->get_delegate_data(); |
|
1165 | + } |
|
1138 | 1166 | |
1139 | 1167 | $this->output_field(); |
1140 | 1168 | |
@@ -1244,8 +1272,9 @@ discard block |
||
1244 | 1272 | |
1245 | 1273 | $term_options = array(); |
1246 | 1274 | |
1247 | - foreach ( $terms as $term ) |
|
1248 | - $term_options[$term->term_id] = $term->name; |
|
1275 | + foreach ( $terms as $term ) { |
|
1276 | + $term_options[$term->term_id] = $term->name; |
|
1277 | + } |
|
1249 | 1278 | |
1250 | 1279 | return $term_options; |
1251 | 1280 | |
@@ -1304,8 +1333,9 @@ discard block |
||
1304 | 1333 | |
1305 | 1334 | $data = array(); |
1306 | 1335 | |
1307 | - foreach ( $this->get_posts() as $post_id ) |
|
1308 | - $data[$post_id] = get_the_title( $post_id ); |
|
1336 | + foreach ( $this->get_posts() as $post_id ) { |
|
1337 | + $data[$post_id] = get_the_title( $post_id ); |
|
1338 | + } |
|
1309 | 1339 | |
1310 | 1340 | return $data; |
1311 | 1341 | |
@@ -1349,9 +1379,11 @@ discard block |
||
1349 | 1379 | |
1350 | 1380 | <?php |
1351 | 1381 | |
1352 | - else : |
|
1382 | + else { |
|
1383 | + : |
|
1353 | 1384 | |
1354 | 1385 | parent::output_field(); |
1386 | + } |
|
1355 | 1387 | |
1356 | 1388 | endif; |
1357 | 1389 | |
@@ -1391,9 +1423,12 @@ discard block |
||
1391 | 1423 | data.push( <?php echo json_encode( array( 'id' => $post_id, 'text' => html_entity_decode( get_the_title( $post_id ) ) ) ); ?> ); |
1392 | 1424 | <?php endforeach; ?> |
1393 | 1425 | |
1394 | - <?php else : ?> |
|
1426 | + <?php else { |
|
1427 | + : ?> |
|
1395 | 1428 | |
1396 | - data = <?php echo json_encode( array( 'id' => $this->value, 'text' => html_entity_decode( get_the_title( $this->get_value() ) ) ) ); ?>; |
|
1429 | + data = <?php echo json_encode( array( 'id' => $this->value, 'text' => html_entity_decode( get_the_title( $this->get_value() ) ) ) ); |
|
1430 | +} |
|
1431 | +?>; |
|
1397 | 1432 | |
1398 | 1433 | <?php endif; ?> |
1399 | 1434 | |
@@ -1663,8 +1698,9 @@ discard block |
||
1663 | 1698 | |
1664 | 1699 | // if the field is a repeatable field, store the whole array of them, if it's not repeatble, |
1665 | 1700 | // just store the first (and only) one directly |
1666 | - if ( ! $field->args['repeatable'] ) |
|
1667 | - $field_value = reset( $field_value ); |
|
1701 | + if ( ! $field->args['repeatable'] ) { |
|
1702 | + $field_value = reset( $field_value ); |
|
1703 | + } |
|
1668 | 1704 | } |
1669 | 1705 | } |
1670 | 1706 | |
@@ -1775,7 +1811,7 @@ discard block |
||
1775 | 1811 | <select <?php $this->class_attr( 'map-zoom' ); ?>> |
1776 | 1812 | <option value="">Zoom</option> |
1777 | 1813 | <?php foreach(array('1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21') as $zoom_level) { |
1778 | - if($zoom_level === $value['zoom']) { $selected='selected="selected"'; }else{$selected='';} |
|
1814 | + if($zoom_level === $value['zoom']) { $selected='selected="selected"'; } else{$selected='';} |
|
1779 | 1815 | echo '<option '.$selected.' value="'.$zoom_level.'">'.$zoom_level.'</option>'; |
1780 | 1816 | }?> |
1781 | 1817 | </select> |
@@ -12,8 +12,9 @@ discard block |
||
12 | 12 | |
13 | 13 | $this->_meta_box = $meta_box; |
14 | 14 | |
15 | - if ( empty( $this->_meta_box['id'] ) ) |
|
16 | - $this->_meta_box['id'] = sanitize_title( $this->_meta_box['title'] ); |
|
15 | + if ( empty( $this->_meta_box['id'] ) ) { |
|
16 | + $this->_meta_box['id'] = sanitize_title( $this->_meta_box['title'] ); |
|
17 | + } |
|
17 | 18 | |
18 | 19 | add_action( 'add_meta_boxes', array( &$this, 'init_fields_for_post' ) ); |
19 | 20 | add_action( 'cmb_init_fields', array( &$this, 'init_fields' ) ); |
@@ -59,17 +60,17 @@ discard block |
||
59 | 60 | global $post, $temp_ID; |
60 | 61 | |
61 | 62 | // Get the current ID |
62 | - if( isset( $_GET['post'] ) ) |
|
63 | - $post_id = $_GET['post']; |
|
64 | - |
|
65 | - elseif( isset( $_POST['post_ID'] ) ) |
|
66 | - $post_id = $_POST['post_ID']; |
|
67 | - |
|
68 | - elseif ( ! empty( $post->ID ) ) |
|
69 | - $post_id = $post->ID; |
|
63 | + if( isset( $_GET['post'] ) ) { |
|
64 | + $post_id = $_GET['post']; |
|
65 | + } elseif( isset( $_POST['post_ID'] ) ) { |
|
66 | + $post_id = $_POST['post_ID']; |
|
67 | + } elseif ( ! empty( $post->ID ) ) { |
|
68 | + $post_id = $post->ID; |
|
69 | + } |
|
70 | 70 | |
71 | - if ( is_page() || ! isset( $post_id ) ) |
|
72 | - return false; |
|
71 | + if ( is_page() || ! isset( $post_id ) ) { |
|
72 | + return false; |
|
73 | + } |
|
73 | 74 | |
74 | 75 | $this->init_fields( (int) $post_id ); |
75 | 76 | |
@@ -85,8 +86,9 @@ discard block |
||
85 | 86 | ) |
86 | 87 | ) ); |
87 | 88 | |
88 | - foreach ( $this->fields as $field ) |
|
89 | - $field->enqueue_scripts(); |
|
89 | + foreach ( $this->fields as $field ) { |
|
90 | + $field->enqueue_scripts(); |
|
91 | + } |
|
90 | 92 | |
91 | 93 | } |
92 | 94 | |
@@ -94,13 +96,15 @@ discard block |
||
94 | 96 | |
95 | 97 | $suffix = CMB_DEV ? '' : '.min'; |
96 | 98 | |
97 | - if ( version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) |
|
98 | - wp_enqueue_style( 'cmb-styles', trailingslashit( CMB_URL ) . "css/dist/cmb$suffix.css" ); |
|
99 | - else |
|
100 | - wp_enqueue_style( 'cmb-styles', trailingslashit( CMB_URL ) . 'css/legacy.css' ); |
|
99 | + if ( version_compare( get_bloginfo( 'version' ), '3.8', '>=' ) ) { |
|
100 | + wp_enqueue_style( 'cmb-styles', trailingslashit( CMB_URL ) . "css/dist/cmb$suffix.css" ); |
|
101 | + } else { |
|
102 | + wp_enqueue_style( 'cmb-styles', trailingslashit( CMB_URL ) . 'css/legacy.css' ); |
|
103 | + } |
|
101 | 104 | |
102 | - foreach ( $this->fields as $field ) |
|
103 | - $field->enqueue_styles(); |
|
105 | + foreach ( $this->fields as $field ) { |
|
106 | + $field->enqueue_styles(); |
|
107 | + } |
|
104 | 108 | |
105 | 109 | } |
106 | 110 | |
@@ -259,11 +263,13 @@ discard block |
||
259 | 263 | |
260 | 264 | $classes = array( 'field', get_class($field) ); |
261 | 265 | |
262 | - if ( ! empty( $field->args['repeatable'] ) ) |
|
263 | - $classes[] = 'repeatable'; |
|
266 | + if ( ! empty( $field->args['repeatable'] ) ) { |
|
267 | + $classes[] = 'repeatable'; |
|
268 | + } |
|
264 | 269 | |
265 | - if ( ! empty( $field->args['sortable'] ) ) |
|
266 | - $classes[] = 'cmb-sortable'; |
|
270 | + if ( ! empty( $field->args['sortable'] ) ) { |
|
271 | + $classes[] = 'cmb-sortable'; |
|
272 | + } |
|
267 | 273 | |
268 | 274 | $attrs = array( |
269 | 275 | sprintf( 'id="%s"', sanitize_html_class( $field->id ) ), |
@@ -271,8 +277,9 @@ discard block |
||
271 | 277 | ); |
272 | 278 | |
273 | 279 | // Field Repeatable Max. |
274 | - if ( isset( $field->args['repeatable_max'] ) ) |
|
275 | - $attrs[] = sprintf( 'data-rep-max="%s"', intval( $field->args['repeatable_max'] ) ); |
|
280 | + if ( isset( $field->args['repeatable_max'] ) ) { |
|
281 | + $attrs[] = sprintf( 'data-rep-max="%s"', intval( $field->args['repeatable_max'] ) ); |
|
282 | + } |
|
276 | 283 | |
277 | 284 | ?> |
278 | 285 | |
@@ -304,11 +311,11 @@ discard block |
||
304 | 311 | |
305 | 312 | foreach ( $values as $key => $value ) { |
306 | 313 | |
307 | - if ( false !== strpos( $key, 'cmb-group-x' ) || false !== strpos( $key, 'cmb-field-x' ) ) |
|
308 | - unset( $values[$key] ); |
|
309 | - |
|
310 | - elseif ( is_array( $value ) ) |
|
311 | - $values[$key] = $this->strip_repeatable( $value ); |
|
314 | + if ( false !== strpos( $key, 'cmb-group-x' ) || false !== strpos( $key, 'cmb-field-x' ) ) { |
|
315 | + unset( $values[$key] ); |
|
316 | + } elseif ( is_array( $value ) ) { |
|
317 | + $values[$key] = $this->strip_repeatable( $value ); |
|
318 | + } |
|
312 | 319 | |
313 | 320 | } |
314 | 321 | |
@@ -319,19 +326,22 @@ discard block |
||
319 | 326 | function save( $post_id = 0 ) { |
320 | 327 | |
321 | 328 | // Verify nonce |
322 | - if ( ! isset( $_POST['wp_meta_box_nonce'] ) || ! wp_verify_nonce( $_POST['wp_meta_box_nonce'], basename( __FILE__ ) ) ) |
|
323 | - return $post_id; |
|
329 | + if ( ! isset( $_POST['wp_meta_box_nonce'] ) || ! wp_verify_nonce( $_POST['wp_meta_box_nonce'], basename( __FILE__ ) ) ) { |
|
330 | + return $post_id; |
|
331 | + } |
|
324 | 332 | |
325 | 333 | foreach ( $this->_meta_box['fields'] as $field ) { |
326 | 334 | |
327 | 335 | // Verify this meta box was shown on the page |
328 | - if ( ! isset( $_POST['_cmb_present_' . $field['id'] ] ) ) |
|
329 | - continue; |
|
336 | + if ( ! isset( $_POST['_cmb_present_' . $field['id'] ] ) ) { |
|
337 | + continue; |
|
338 | + } |
|
330 | 339 | |
331 | - if ( isset( $_POST[ $field['id'] ] ) ) |
|
332 | - $value = (array) $_POST[ $field['id'] ]; |
|
333 | - else |
|
334 | - $value = array(); |
|
340 | + if ( isset( $_POST[ $field['id'] ] ) ) { |
|
341 | + $value = (array) $_POST[ $field['id'] ]; |
|
342 | + } else { |
|
343 | + $value = array(); |
|
344 | + } |
|
335 | 345 | |
336 | 346 | $value = $this->strip_repeatable( $value ); |
337 | 347 | |
@@ -358,8 +368,9 @@ discard block |
||
358 | 368 | function save_for_post( $post_id ) { |
359 | 369 | |
360 | 370 | // check autosave |
361 | - if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) |
|
362 | - return $post_id; |
|
371 | + if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) { |
|
372 | + return $post_id; |
|
373 | + } |
|
363 | 374 | |
364 | 375 | $this->save( $post_id ); |
365 | 376 |
@@ -35,11 +35,11 @@ discard block |
||
35 | 35 | |
36 | 36 | static $already_sorted = false; |
37 | 37 | |
38 | - if ( empty( $screen ) ) |
|
39 | - $screen = get_current_screen(); |
|
40 | - |
|
41 | - elseif ( is_string( $screen ) ) |
|
42 | - $screen = convert_to_screen( $screen ); |
|
38 | + if ( empty( $screen ) ) { |
|
39 | + $screen = get_current_screen(); |
|
40 | + } elseif ( is_string( $screen ) ) { |
|
41 | + $screen = convert_to_screen( $screen ); |
|
42 | + } |
|
43 | 43 | |
44 | 44 | $page = $screen->id; |
45 | 45 | |
@@ -50,16 +50,18 @@ discard block |
||
50 | 50 | do { |
51 | 51 | // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose |
52 | 52 | |
53 | - if ( ! $already_sorted && $sorted = get_user_option( "meta-box-order_$page" ) ) |
|
54 | - foreach ( $sorted as $box_context => $ids ) |
|
53 | + if ( ! $already_sorted && $sorted = get_user_option( "meta-box-order_$page" ) ) { |
|
54 | + foreach ( $sorted as $box_context => $ids ) |
|
55 | 55 | foreach ( explode(',', $ids ) as $id ) |
56 | 56 | if ( $id && 'dashboard_browser_nag' !== $id ) |
57 | 57 | add_meta_box( $id, null, null, $screen, $box_context, 'sorted' ); |
58 | + } |
|
58 | 59 | |
59 | 60 | $already_sorted = true; |
60 | 61 | |
61 | - if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[$page] ) || ! isset( $wp_meta_boxes[$page][$context] ) ) |
|
62 | - break; |
|
62 | + if ( ! isset( $wp_meta_boxes ) || ! isset( $wp_meta_boxes[$page] ) || ! isset( $wp_meta_boxes[$page][$context] ) ) { |
|
63 | + break; |
|
64 | + } |
|
63 | 65 | |
64 | 66 | foreach ( array( 'high', 'sorted', 'core', 'default', 'low' ) as $priority ) { |
65 | 67 | |
@@ -67,8 +69,9 @@ discard block |
||
67 | 69 | |
68 | 70 | foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) { |
69 | 71 | |
70 | - if ( false == $box || ! $box['title'] ) |
|
71 | - continue; |
|
72 | + if ( false == $box || ! $box['title'] ) { |
|
73 | + continue; |
|
74 | + } |
|
72 | 75 | |
73 | 76 | $i++; |
74 | 77 |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | <?php |
158 | 158 | if( !empty( $uix['template'] ) && file_exists( $uix['template'] ) ){ |
159 | 159 | include $uix['template']; |
160 | - }else{ |
|
160 | + } else{ |
|
161 | 161 | echo esc_html__( 'Template not found: ', $this->plugin_slug ) . $uix['template']; |
162 | 162 | } |
163 | 163 | ?> |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | // include this tabs template |
171 | 171 | if( !empty( $partial ) && file_exists( $partial ) ){ |
172 | 172 | include $partial; |
173 | - }else{ |
|
173 | + } else{ |
|
174 | 174 | echo esc_html__( 'Partial Template not found: ', $this->plugin_slug ) . $partial_id; |
175 | 175 | } |
176 | 176 | ?> |
@@ -188,7 +188,7 @@ discard block |
||
188 | 188 | // include this tabs template |
189 | 189 | if( !empty( $modal ) && file_exists( $modal ) ){ |
190 | 190 | include $modal; |
191 | - }else{ |
|
191 | + } else{ |
|
192 | 192 | echo esc_html__( 'Modal Template not found: ', $this->plugin_slug ) . $modal_id; |
193 | 193 | } |
194 | 194 | ?> |