function _drush_google_analytics_et_admin_gaet_add_et_input_validation in Google Analytics Event Tracking 6
Same name and namespace in other branches
- 7 drush_commands/google_analytics_et_admin.drush.inc \_drush_google_analytics_et_admin_gaet_add_et_input_validation()
Validates the user input.
Doesn't do any xss filtering or detection, only checks to see if the input types are correct.
1 call to _drush_google_analytics_et_admin_gaet_add_et_input_validation()
- drush_google_analytics_et_admin_gaet_add_et in drush_commands/
google_analytics_et_admin.drush.inc - Drush command callback for gaet-add-et.
File
- drush_commands/
google_analytics_et_admin.drush.inc, line 142 - Google Analytics Event Tracking Module Drush Admin.
Code
function _drush_google_analytics_et_admin_gaet_add_et_input_validation($selector_array) {
$validattion = FALSE;
foreach ($selector_array as $key => $value) {
switch ($key) {
case 'event':
case 'selector':
case 'category':
case 'action':
case 'label':
if (is_string($value)) {
$validation = TRUE;
}
else {
drush_set_error('NOT_STRING', dt("!key should be a string.", array(
'!key' => $key,
)));
}
break;
case 'value':
if (is_numeric($value)) {
$validation = TRUE;
}
else {
drush_set_error('NOT_NUMBER', dt("!key should be a number.", array(
'!key' => $key,
)));
}
break;
case 'noninteraction':
if (is_bool($value)) {
$validation = TRUE;
}
else {
drush_set_error('NOT_BOOLEAN', dt("!key should be a boolean.", array(
'!key' => $key,
)));
}
break;
}
}
return $validation;
}