function googleanalytics_validate_googleanalytics_account in Google Analytics 7
Same name and namespace in other branches
- 7.2 googleanalytics.variable.inc \googleanalytics_validate_googleanalytics_account()
Validate Web Property ID variable.
1 string reference to 'googleanalytics_validate_googleanalytics_account'
- googleanalytics_variable_info in ./
googleanalytics.variable.inc - Implements hook_variable_info().
File
- ./
googleanalytics.variable.inc, line 44 - Definition of variables for Variable API module.
Code
function googleanalytics_validate_googleanalytics_account($variable) {
// Replace all type of dashes (n-dash, m-dash, minus) with the normal dashes.
$variable['value'] = str_replace(array(
'–',
'—',
'−',
), '-', $variable['value']);
if (!preg_match('/^UA-\\d{4,}-\\d+$/', $variable['value'])) {
return t('A valid Google Analytics Web Property ID is case sensitive and formatted like UA-xxxxxxx-yy.');
}
}