Skip to content

Commit 1201063

Browse files
committed
Sanitize checkboxes
1 parent 7cab342 commit 1201063

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

includes/customizer/class-alnp-customizer.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,18 +302,21 @@ public function alnp_get_customizer_settings() {
302302
),
303303
'auto_load_next_post_remove_comments' => array(
304304
'capability' => 'edit_theme_options',
305+
'sanitize_callback' => array( $this, 'sanitize_checkbox' ),
305306
'default' => 'yes',
306307
'transport' => 'refresh',
307308
'type' => 'option',
308309
),
309310
'auto_load_next_post_google_analytics' => array(
310311
'capability' => 'edit_theme_options',
312+
'sanitize_callback' => array( $this, 'sanitize_checkbox' ),
311313
'default' => 'no',
312314
'transport' => 'refresh',
313315
'type' => 'option',
314316
),
315317
'auto_load_next_post_load_js_in_footer' => array(
316318
'capability' => 'edit_theme_options',
319+
'sanitize_callback' => array( $this, 'sanitize_checkbox' ),
317320
'default' => 'no',
318321
'transport' => 'refresh',
319322
'type' => 'option',
@@ -521,6 +524,18 @@ public function is_page_alnp_ready() {
521524
return true;
522525
} // END is_page_alnp_ready()
523526

527+
/**
528+
* Sanitize the checkbox options.
529+
*
530+
* @access public
531+
* @since 1.6.0
532+
* @param bool $input
533+
* @return string
534+
*/
535+
public function sanitize_checkbox( $input ) {
536+
return ( $input === true ) ? 'yes' : 'no';
537+
} // END sansitize_checkbox()
538+
524539
} // END Class
525540

526541
} // END if class

0 commit comments

Comments
 (0)