| @@ 160-168 (lines=9) @@ | ||
| 157 | * @since 1.0.0 |
|
| 158 | * @uses get_option(), add_option() |
|
| 159 | */ |
|
| 160 | public function init_settings() { |
|
| 161 | $this->settings = get_option( $this->get_option_key(), null ); |
|
| 162 | ||
| 163 | // If there are no settings defined, use defaults. |
|
| 164 | if ( ! is_array( $this->settings ) ) { |
|
| 165 | $form_fields = $this->get_form_fields(); |
|
| 166 | $this->settings = array_merge( array_fill_keys( array_keys( $form_fields ), '' ), wp_list_pluck( $form_fields, 'default' ) ); |
|
| 167 | } |
|
| 168 | } |
|
| 169 | ||
| 170 | /** |
|
| 171 | * get_option function. |
|
| @@ 432-440 (lines=9) @@ | ||
| 429 | * Initialise Settings for instances. |
|
| 430 | * @since 2.6.0 |
|
| 431 | */ |
|
| 432 | public function init_instance_settings() { |
|
| 433 | $this->instance_settings = get_option( $this->get_instance_option_key(), null ); |
|
| 434 | ||
| 435 | // If there are no settings defined, use defaults. |
|
| 436 | if ( ! is_array( $this->instance_settings ) ) { |
|
| 437 | $form_fields = $this->get_instance_form_fields(); |
|
| 438 | $this->instance_settings = array_merge( array_fill_keys( array_keys( $form_fields ), '' ), wp_list_pluck( $form_fields, 'default' ) ); |
|
| 439 | } |
|
| 440 | } |
|
| 441 | ||
| 442 | /** |
|
| 443 | * Processes and saves options. |
|