Skip to content

Commit

Permalink
Use sanitize_hex_color for sanitizing player color value
Browse files Browse the repository at this point in the history
  • Loading branch information
AlecRust committed Jul 25, 2023
1 parent b57844d commit 095871f
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions includes/admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public function migrate_plugin_options()
if (isset($old_option['player_theme_color'])) {
update_option(
'protected_video_player_theme_color',
$old_option['player_theme_color']
sanitize_hex_color($old_option['player_theme_color'])
);
delete_option('protected_video_option_name');
}
Expand Down Expand Up @@ -144,16 +144,16 @@ public function settings_page_init()
register_setting(
'protected_video_option_group', // settings group name
'protected_video_player_theme_color', // option name
[$this, 'sanitize_plugin_text_input'] // callback
[$this, 'sanitize_plugin_color_input'] // callback
);
}

/**
* Sanitize plugin option text input data.
* Sanitize plugin option color input data.
*/
public function sanitize_plugin_text_input($input)
public function sanitize_plugin_color_input($input)
{
return sanitize_text_field($input);
return sanitize_hex_color($input);
}

/**
Expand Down

0 comments on commit 095871f

Please sign in to comment.