| @@ 28-42 (lines=15) @@ | ||
| 25 | * |
|
| 26 | * @param array $input (optional) Array of field names and values. Defaults to $_POST |
|
| 27 | **/ |
|
| 28 | public function set_value_from_input( $input = null ) { |
|
| 29 | if ( is_null( $input ) ) { |
|
| 30 | $input = $_POST; |
|
| 31 | } |
|
| 32 | ||
| 33 | if ( ! isset( $input[ $this->name ] ) ) { |
|
| 34 | $this->set_value( null ); |
|
| 35 | } else { |
|
| 36 | $value = stripslashes_deep( $input[ $this->name ] ); |
|
| 37 | if ( is_array( $value ) ) { |
|
| 38 | $value = array_values( $value ); |
|
| 39 | } |
|
| 40 | $this->set_value( $value ); |
|
| 41 | } |
|
| 42 | } |
|
| 43 | ||
| 44 | /** |
|
| 45 | * Set the post type of the entries. |
|
| @@ 29-43 (lines=15) @@ | ||
| 26 | * |
|
| 27 | * @param array $input (optional) Array of field names and values. Defaults to $_POST |
|
| 28 | **/ |
|
| 29 | public function set_value_from_input( $input = null ) { |
|
| 30 | if ( is_null( $input ) ) { |
|
| 31 | $input = $_POST; |
|
| 32 | } |
|
| 33 | ||
| 34 | if ( ! isset( $input[ $this->name ] ) ) { |
|
| 35 | $this->set_value( null ); |
|
| 36 | } else { |
|
| 37 | $value = stripslashes_deep( $input[ $this->name ] ); |
|
| 38 | if ( is_array( $value ) ) { |
|
| 39 | $value = array_values( $value ); |
|
| 40 | } |
|
| 41 | $this->set_value( $value ); |
|
| 42 | } |
|
| 43 | } |
|
| 44 | ||
| 45 | /** |
|
| 46 | * Set the number of the options to be displayed at the initial field display. |
|