@@ 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. |
@@ 416-424 (lines=9) @@ | ||
413 | * Initialise Settings for instances. |
|
414 | * @since 2.6.0 |
|
415 | */ |
|
416 | public function init_instance_settings() { |
|
417 | $this->instance_settings = get_option( $this->get_instance_option_key(), null ); |
|
418 | ||
419 | // If there are no settings defined, use defaults. |
|
420 | if ( ! is_array( $this->instance_settings ) ) { |
|
421 | $form_fields = $this->get_instance_form_fields(); |
|
422 | $this->instance_settings = array_merge( array_fill_keys( array_keys( $form_fields ), '' ), wp_list_pluck( $form_fields, 'default' ) ); |
|
423 | } |
|
424 | } |
|
425 | ||
426 | /** |
|
427 | * Processes and saves options. |