monsterinsights_sanitize_radio_field

Sanitize radio fields.

Description

monsterinsights_sanitize_radio_field( $value, $id, $setting, $previous_value ); 

Parameters (4)

0. $value
The value.
1. $id
The id.
2. $setting
The setting.
3. $previous_value
The previous value.

Usage

  1. if ( !function_exists( 'monsterinsights_sanitize_radio_field' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'google-analytics-for-wordpress-by-monsterinsights/includes/admin/settings/settings-api.php'; 
  3.  
  4. // The value. 
  5. $value = null; 
  6.  
  7. // The id. 
  8. $id = null; 
  9.  
  10. // The setting. 
  11. $setting = null; 
  12.  
  13. // The previous value. 
  14. $previous_value = null; 
  15.  
  16. // NOTICE! Understand what this does before running. 
  17. $result = monsterinsights_sanitize_radio_field($value, $id, $setting, $previous_value); 
  18.  

Defined (1)

The function is defined in the following location(s).

/includes/admin/settings/settings-api.php  
  1. function monsterinsights_sanitize_radio_field( $value, $id, $setting, $previous_value ) { 
  2. $save_value = ''; 
  3. if ( ! empty( $value ) ) { 
  4. foreach( $setting['options'] as $key => $option ) { 
  5. if ( $key === $value ) { 
  6. $save_value = $key; 
  7. return $save_value;