| @@ 105-120 (lines=16) @@ | ||
| 102 | * @return void |
|
| 103 | * @action pollux/{static::ID}/init |
|
| 104 | */ |
|
| 105 | public function resetPage() |
|
| 106 | { |
|
| 107 | if( filter_input( INPUT_GET, 'page' ) !== $this->app->id |
|
| 108 | || filter_input( INPUT_GET, 'action' ) !== 'reset' |
|
| 109 | )return; |
|
| 110 | if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), static::id() )) { |
|
| 111 | delete_option( static::id() ); |
|
| 112 | add_settings_error( static::id(), 'reset', __( 'Reset successful.', 'pollux' ), 'updated' ); |
|
| 113 | } |
|
| 114 | else { |
|
| 115 | add_settings_error( static::id(), 'failed', __( 'Failed to reset. Please try again.', 'pollux' )); |
|
| 116 | } |
|
| 117 | set_transient( 'settings_errors', get_settings_errors(), 30 ); |
|
| 118 | wp_safe_redirect( add_query_arg( 'settings-updated', 'true', wp_get_referer() )); |
|
| 119 | exit; |
|
| 120 | } |
|
| 121 | } |
|
| 122 | ||
| @@ 216-231 (lines=16) @@ | ||
| 213 | * @return void |
|
| 214 | * @action pollux/{static::ID}/init |
|
| 215 | */ |
|
| 216 | public function resetPage() |
|
| 217 | { |
|
| 218 | if( filter_input( INPUT_GET, 'page' ) !== static::id() |
|
| 219 | || filter_input( INPUT_GET, 'action' ) !== 'reset' |
|
| 220 | )return; |
|
| 221 | if( wp_verify_nonce( filter_input( INPUT_GET, '_wpnonce' ), $this->hook )) { |
|
| 222 | update_option( static::id(), $this->getDefaults() ); |
|
| 223 | add_settings_error( static::id(), 'reset', __( 'Reset successful.', 'pollux' ), 'updated' ); |
|
| 224 | } |
|
| 225 | else { |
|
| 226 | add_settings_error( static::id(), 'failed', __( 'Failed to reset. Please try again.', 'pollux' )); |
|
| 227 | } |
|
| 228 | set_transient( 'settings_errors', get_settings_errors(), 30 ); |
|
| 229 | wp_safe_redirect( add_query_arg( 'settings-updated', 'true', wp_get_referer() )); |
|
| 230 | exit; |
|
| 231 | } |
|
| 232 | ||
| 233 | /** |
|
| 234 | * @param string $key |
|