wp2static_options = $options; $this->wp2static_option_key = $option_key; } public function __set( $name, $value ) { $this->wp2static_options[ $name ] = $value; return $this; } public function setOption( $name, $value ) { return $this->__set( $name, $value ); } public function __get( $name ) { $value = array_key_exists( $name, $this->wp2static_options ) ? $this->wp2static_options[ $name ] : null; return $value; } public function getOption( $name ) { return $this->__get( $name ); } public function getAllOptions( $reveal_sensitive_values = false ) { $options_array = array(); foreach ( $this->wp2static_options_keys as $key ) { $value = '*******************'; if ( in_array( $key, $this->whitelisted_keys ) ) { $value = $this->__get( $key ); } elseif ( $reveal_sensitive_values ) { $value = $this->__get( $key ); } $options_array[] = array( 'Option name' => $key, 'Value' => $value, ); } return $options_array; } public function optionExists( $name ) { return in_array( $name, $this->wp2static_options_keys ); } public function save() { return update_option( $this->wp2static_option_key, $this->wp2static_options ); } public function delete() { return delete_option( $this->wp2static_option_key ); } public function saveAllPostData() { foreach ( $this->wp2static_options_keys as $option ) { $this->setOption( $option, filter_input( INPUT_POST, $option ) ); $this->save(); } } }