Skip to content
Snippets Groups Projects
Commit 949391c5 authored by Erick Hitter's avatar Erick Hitter
Browse files

Basic sanitization

parent a042603a
No related branches found
No related tags found
1 merge request!1WIP: Initial release
...@@ -160,7 +160,25 @@ class ETH_AMP_Analytics_WP { ...@@ -160,7 +160,25 @@ class ETH_AMP_Analytics_WP {
* *
*/ */
public function sanitize_options( $options ) { public function sanitize_options( $options ) {
return $options; $sanitized_options = $this->plugin_option_defaults;
foreach ( $options as $key => $value ) {
switch( $key ) {
case 'property_id' :
$value = trim( $value );
if ( preg_match( '#^UA-([\d]+)-([\d]+)$#i', $value ) ) {
$sanitized_options[ $key ] = $value;
}
break;
default :
// Do nothing, this is unexpected. :)
break;
}
}
return $sanitized_options;
} }
/** /**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment