@@ -46,8 +46,9 @@ |
||
| 46 | 46 | parent::to_json(); |
| 47 | 47 | |
| 48 | 48 | $this->json['choicesLength'] = 0; |
| 49 | - if ( is_array( $this->choices ) && count( $this->choices ) ) |
|
| 50 | - $this->json['choicesLength'] = count( $this->choices ); |
|
| 49 | + if ( is_array( $this->choices ) && count( $this->choices ) ) { |
|
| 50 | + $this->json['choicesLength'] = count( $this->choices ); |
|
| 51 | + } |
|
| 51 | 52 | |
| 52 | 53 | $values = $this->value() == '' ? array_keys( $this->choices ) : $this->value(); |
| 53 | 54 | $filtered_values = array(); |
@@ -80,11 +80,14 @@ |
||
| 80 | 80 | public static function array_flatten( array $array ) { |
| 81 | 81 | $flat = array(); // initialize return array |
| 82 | 82 | $stack = array_values( $array ); |
| 83 | - while ( $stack ) { // process stack until done |
|
| 83 | + while ( $stack ) { |
|
| 84 | +// process stack until done |
|
| 84 | 85 | $value = array_shift( $stack ); |
| 85 | - if ( is_array( $value ) ) { // a value to further process |
|
| 86 | + if ( is_array( $value ) ) { |
|
| 87 | +// a value to further process |
|
| 86 | 88 | $stack = array_merge( array_keys( $value ), $stack ); |
| 87 | - } else { // a value to take |
|
| 89 | + } else { |
|
| 90 | +// a value to take |
|
| 88 | 91 | $flat[] = $value; |
| 89 | 92 | } |
| 90 | 93 | } |