| @@ -27,9 +27,8 @@ | ||
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | public static function admin_notice(): bool { |
| 30 | 30 | |
| 31 | - // phpcs:disable WordPress.Security.NonceVerification.Recommended -- Nonce verification is handled elsewhere. | |
| 32 | 31 | if ( ! isset( $_GET['page'] ) ) { |
| 33 | 32 | return false; |
| 34 | 33 | } |
| 35 | 34 | |
| @@ -36,14 +35,11 @@ | ||
| 36 | 35 | if ( $_GET['page'] !== WOWP_Plugin::SLUG ) { |
| 37 | 36 | return false; |
| 38 | 37 | } |
| 39 | 38 | |
| 40 | - $notice = isset( $_GET['notice'] ) ? sanitize_text_field( wp_unslash( $_GET['notice'] ) ) : ''; | |
| 41 | - // phpcs:enable | |
| 42 | - | |
| 43 | - if ( ! empty( $notice ) && $notice === 'save_item' ) { | |
| 39 | + if ( ! empty( $_GET['notice'] ) && $_GET['notice'] === 'save_item' ) { | |
| 44 | 40 | self::save_item(); |
| 45 | - } elseif ( ! empty( $notice ) && $notice === 'remove_item' ) { | |
| 41 | + } elseif ( ! empty( $_GET['notice'] ) && $_GET['notice'] === 'remove_item' ) { | |
| 46 | 42 | self::remove_item(); |
| 47 | 43 | } |
| 48 | 44 | |
| 49 | 45 | return true; |
| @@ -49,17 +45,16 @@ | ||
| 49 | 45 | return true; |
| 50 | 46 | } |
| 51 | 47 | |
| 52 | 48 | public static function save_item(): void { |
| 53 | - if ( isset( $_REQUEST['nonce'] ) ) { | |
| 54 | - $nonce = sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ); | |
| 49 | + $nonce = isset( $_REQUEST['nonce'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['nonce'] ) ) : ''; | |
| 55 | 50 | |
| 56 | - if ( wp_verify_nonce( $nonce, 'save-item' ) ) { | |
| 57 | - $text = __( 'Item Saved', 'float-menu' ); | |
| 58 | - echo '<div class="wpie-notice notice notice-success is-dismissible">' . esc_html( $text ) . '</div>'; | |
| 59 | - } | |
| 51 | + if ( ! empty( $nonce ) && wp_verify_nonce( $nonce, 'save-item' ) ) { | |
| 52 | + $text = __( 'Item Saved', 'float-menu' ); | |
| 53 | + echo '<div class="wpie-notice notice notice-success is-dismissible">' . esc_html( $text ) . '</div>'; | |
| 60 | 54 | } |
| 61 | 55 | } |
| 56 | + | |
| 62 | 57 | public static function remove_item(): void { |
| 63 | 58 | $text = __( 'Item Remove', 'float-menu' ); |
| 64 | 59 | echo '<div class="wpie-notice notice notice-warning is-dismissible">' . esc_html( $text ) . '</div>'; |
| 65 | 60 | } |