Completed
Pull Request — trunk (#752)
by
unknown
06:03
created
includes/types/CMB2_Type_Multi_Base.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -18,8 +18,8 @@  discard block
 block discarded – undo
18 18
 	 * @return string Generated optgroup element html
19 19
 	 */
20 20
 	public function select_optgroup( $args = array() ) {
21
-		return sprintf( "\t" . '<optgroup label="%s">' . "\n", $args['label']) . 
22
-			$args['options'] .
21
+		return sprintf( "\t" . '<optgroup label="%s">' . "\n", $args[ 'label' ] ) . 
22
+			$args[ 'options' ] .
23 23
 			sprintf( "\n\t</optgroup>\n" );
24 24
 	}
25 25
 	
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 	 * @return string       Generated option element html
31 31
 	 */
32 32
 	public function select_option( $args = array() ) {
33
-		return sprintf( "\t" . '<option value="%s" %s>%s</option>', $args['value'], selected( isset( $args['checked'] ) && $args['checked'], true, false ), $args['label'] ) . "\n";
33
+		return sprintf( "\t" . '<option value="%s" %s>%s</option>', $args[ 'value' ], selected( isset( $args[ 'checked' ] ) && $args[ 'checked' ], true, false ), $args[ 'label' ] ) . "\n";
34 34
 	}
35 35
 
36 36
 	/**
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 			'label' => '',
51 51
 		), $args );
52 52
 
53
-		return sprintf( "\t" . '<li><input%s/> <label for="%s">%s</label></li>' . "\n", $this->concat_attrs( $a, array( 'label' ) ), $a['id'], $a['label'] );
53
+		return sprintf( "\t" . '<li><input%s/> <label for="%s">%s</label></li>' . "\n", $this->concat_attrs( $a, array( 'label' ) ), $a[ 'id' ], $a[ 'label' ] );
54 54
 	}
55 55
 
56 56
 	/**
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
 	 */
63 63
 	public function list_input_checkbox( $args, $i ) {
64 64
 		$saved_value = $this->field->escaped_value();
65
-		if ( is_array( $saved_value ) && in_array( $args['value'], $saved_value ) ) {
66
-			$args['checked'] = 'checked';
65
+		if ( is_array( $saved_value ) && in_array( $args[ 'value' ], $saved_value ) ) {
66
+			$args[ 'checked' ] = 'checked';
67 67
 		}
68
-		$args['type'] = 'checkbox';
68
+		$args[ 'type' ] = 'checkbox';
69 69
 		return $this->list_input( $args, $i );
70 70
 	}
71 71
 
@@ -78,8 +78,8 @@  discard block
 block discarded – undo
78 78
 	public function concat_items( $args = array() ) {
79 79
 		$field = $this->field;
80 80
 
81
-		$method = isset( $args['method'] ) ? $args['method'] : 'select_option';
82
-		unset( $args['method'] );
81
+		$method = isset( $args[ 'method' ] ) ? $args[ 'method' ] : 'select_option';
82
+		unset( $args[ 'method' ] );
83 83
 
84 84
 		$value = null !== $field->escaped_value()
85 85
 			? $field->escaped_value()
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
 			// Clone args & modify for just this item
102 102
 			$a = $args;
103 103
 
104
-			$a['value'] = $opt_value;
105
-			$a['label'] = $opt_label;
104
+			$a[ 'value' ] = $opt_value;
105
+			$a[ 'label' ] = $opt_label;
106 106
 
107 107
 			// Check if this option is the value of the input
108 108
 			if ( $value === $opt_value ) {
109
-				$a['checked'] = 'checked';
109
+				$a[ 'checked' ] = 'checked';
110 110
 			}
111 111
 
112 112
 			$concatenated_items .= $this->$method( $a, $i++ );
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Taxonomy_Select.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
  */
13 13
 class CMB2_Type_Taxonomy_Select extends CMB2_Type_Taxonomy_Base {
14 14
 
15
-	private function render_options( $terms , $saved_term ) {
15
+	private function render_options( $terms, $saved_term ) {
16 16
 		$options = '';
17 17
 		foreach ( $terms as $term ) {
18 18
 			$options .= $this->select_option( array(
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	public function render() {
28 28
 		$names = $this->get_object_terms();
29 29
 
30
-		$saved_term  = is_wp_error( $names ) || empty( $names ) ? $this->field->get_default() : $names[key( $names )]->slug;
30
+		$saved_term  = is_wp_error( $names ) || empty( $names ) ? $this->field->get_default() : $names[ key( $names ) ]->slug;
31 31
 		$terms       = $this->get_terms();
32 32
 		$options     = '';
33 33
 		$option_none = $this->field->args( 'show_option_none' );
@@ -69,22 +69,22 @@  discard block
 block discarded – undo
69 69
 				$groups = array();
70 70
 				foreach ( $terms as $term ) {
71 71
 					if ( $term->parent == 0 ) {
72
-						if ( isset( $groups[$term->term_id] ) ) {
73
-							$groups[$term->term_id]['term'] = $term;
72
+						if ( isset( $groups[ $term->term_id ] ) ) {
73
+							$groups[ $term->term_id ][ 'term' ] = $term;
74 74
 						} else {
75
-							$groups[$term->term_id] = array( 'term' => $term, 'children' => array() );
75
+							$groups[ $term->term_id ] = array( 'term' => $term, 'children' => array() );
76 76
 						}
77 77
 					} else {
78
-						if ( !isset( $groups[$term->parent] ) ) {
79
-							$groups[$term->parent] = array('term' => null, 'children' => array() );
78
+						if ( ! isset( $groups[ $term->parent ] ) ) {
79
+							$groups[ $term->parent ] = array( 'term' => null, 'children' => array() );
80 80
 						}
81
-						$groups[$term->parent]['children'][] = $term;
81
+						$groups[ $term->parent ][ 'children' ][ ] = $term;
82 82
 					}
83 83
 				}
84
-				foreach( $groups as $group ) {
85
-					$options .= $this->select_optgroup( array (
86
-							'label' => $group['term']->name,
87
-							'options' => $this->render_options( $group['children'], $saved_term )
84
+				foreach ( $groups as $group ) {
85
+					$options .= $this->select_optgroup( array(
86
+							'label' => $group[ 'term' ]->name,
87
+							'options' => $this->render_options( $group[ 'children' ], $saved_term )
88 88
 					) );
89 89
 				}
90 90
 			} else {
Please login to merge, or discard this patch.