Skip to content

Commit 1b49dab

Browse files
afragenw3guy
andauthored
WPCS fixes (#36)
Co-authored-by: Collins Agbonghama <[email protected]>
1 parent 8380751 commit 1b49dab

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

persist-admin-notices-dismissal.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
<?php
2-
32
/**
43
* Persist Admin notices Dismissal
54
*
@@ -19,8 +18,7 @@
1918
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2019
*
2120
* @package Persist Admin notices Dismissal
22-
* @author Collins Agbonghama
23-
* @author Andy Fragen
21+
* @author Collins Agbonghama, Andy Fragen
2422
* @license http://www.gnu.org/licenses GNU General Public License
2523
*/
2624

@@ -107,11 +105,11 @@ public static function load_script() {
107105
* Uses check_ajax_referer to verify nonce.
108106
*/
109107
public static function dismiss_admin_notice() {
110-
$option_name = sanitize_text_field( $_POST['option_name'] );
111-
$dismissible_length = sanitize_text_field( $_POST['dismissible_length'] );
108+
$option_name = isset( $_POST['option_name'] ) ? sanitize_text_field( wp_unslash( $_POST['option_name'] ) ) : '';
109+
$dismissible_length = isset( $_POST['dismissible_length'] ) ? sanitize_text_field( wp_unslash( $_POST['dismissible_length'] ) ) : 0;
112110

113111
if ( 'forever' !== $dismissible_length ) {
114-
// If $dismissible_length is not an integer default to 1
112+
// If $dismissible_length is not an integer default to 1.
115113
$dismissible_length = ( 0 === absint( $dismissible_length ) ) ? 1 : $dismissible_length;
116114
$dismissible_length = strtotime( absint( $dismissible_length ) . ' days' );
117115
}

0 commit comments

Comments
 (0)