| @@ -25,9 +25,8 @@ | ||
| 25 | 25 | add_action( 'admin_init', [ __CLASS__, 'actions' ] ); |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | public static function actions(): bool { |
| 29 | - // phpcs:ignore WordPress.Security.NonceVerification.Recommended | |
| 30 | 29 | $name = self::check_name( $_REQUEST ); |
| 31 | 30 | if ( ! $name ) { |
| 32 | 31 | return false; |
| 33 | 32 | } |
| @@ -44,10 +43,11 @@ | ||
| 44 | 43 | } elseif ( strpos( $name, '_import_data' ) !== false ) { |
| 45 | 44 | ImporterExporter::import_data(); |
| 46 | 45 | } elseif ( strpos( $name, '_remove_item' ) !== false ) { |
| 47 | 46 | DBManager::remove_item(); |
| 48 | - } | |
| 49 | - elseif ( strpos( $name, '_activate_item' ) !== false ) { | |
| 47 | + } elseif ( strpos( $name, '_settings' ) !== false ) { | |
| 48 | + Settings::save_item(); | |
| 49 | + } elseif ( strpos( $name, '_activate_item' ) !== false ) { | |
| 50 | 50 | Settings::activate_item(); |
| 51 | 51 | } elseif ( strpos( $name, '_deactivate_item' ) !== false ) { |
| 52 | 52 | Settings::deactivate_item(); |
| 53 | 53 | } elseif ( strpos( $name, '_activate_mode' ) !== false ) { |
| @@ -58,13 +58,12 @@ | ||
| 58 | 58 | |
| 59 | 59 | return true; |
| 60 | 60 | } |
| 61 | 61 | |
| 62 | - public static function verify( $name ): bool { | |
| 62 | + private static function verify( $name ): bool { | |
| 63 | 63 | $nonce_action = WOWP_Plugin::PREFIX . '_nonce'; |
| 64 | - $nonce = isset( $_REQUEST[ $name ] ) ? sanitize_text_field( wp_unslash( $_REQUEST[ $name ] ) ) : ''; | |
| 65 | 64 | |
| 66 | - return ( ! empty( $nonce ) && wp_verify_nonce( $nonce, $nonce_action ) && current_user_can( 'manage_options' ) ); | |
| 65 | + return ! ( ! isset( $_REQUEST[ $name ] ) || ! wp_verify_nonce( $_REQUEST[ $name ], $nonce_action ) || ! current_user_can( 'manage_options' ) ); | |
| 67 | 66 | } |
| 68 | 67 | |
| 69 | 68 | private static function check_name( $request ) { |
| 70 | 69 | $names = [ |