| @@ 451-459 (lines=9) @@ | ||
| 448 | * Initialise Settings for instances. |
|
| 449 | * @since 2.6.0 |
|
| 450 | */ |
|
| 451 | public function init_instance_settings() { |
|
| 452 | $this->instance_settings = get_option( $this->get_instance_option_key(), null ); |
|
| 453 | ||
| 454 | // If there are no settings defined, use defaults. |
|
| 455 | if ( ! is_array( $this->instance_settings ) ) { |
|
| 456 | $form_fields = $this->get_instance_form_fields(); |
|
| 457 | $this->instance_settings = array_merge( array_fill_keys( array_keys( $form_fields ), '' ), wp_list_pluck( $form_fields, 'default' ) ); |
|
| 458 | } |
|
| 459 | } |
|
| 460 | ||
| 461 | /** |
|
| 462 | * Processes and saves options. |
|
| @@ 212-220 (lines=9) @@ | ||
| 209 | * @since 1.0.0 |
|
| 210 | * @uses get_option(), add_option() |
|
| 211 | */ |
|
| 212 | public function init_settings() { |
|
| 213 | $this->settings = get_option( $this->get_option_key(), null ); |
|
| 214 | ||
| 215 | // If there are no settings defined, use defaults. |
|
| 216 | if ( ! is_array( $this->settings ) ) { |
|
| 217 | $form_fields = $this->get_form_fields(); |
|
| 218 | $this->settings = array_merge( array_fill_keys( array_keys( $form_fields ), '' ), wp_list_pluck( $form_fields, 'default' ) ); |
|
| 219 | } |
|
| 220 | } |
|
| 221 | ||
| 222 | /** |
|
| 223 | * get_option function. |
|