summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--googleanalytics.admin.inc11
1 files changed, 6 insertions, 5 deletions
diff --git a/googleanalytics.admin.inc b/googleanalytics.admin.inc
index 93accad..c37cb06 100644
--- a/googleanalytics.admin.inc
+++ b/googleanalytics.admin.inc
@@ -260,6 +260,12 @@ function googleanalytics_admin_settings_form(&$form_state) {
}
function googleanalytics_admin_settings_form_validate($form, &$form_state) {
+ // Trim some text values.
+ $form_state['values']['googleanalytics_account'] = trim($form_state['values']['googleanalytics_account']);
+ $form_state['values']['googleanalytics_pages'] = trim($form_state['values']['googleanalytics_pages']);
+ $form_state['values']['googleanalytics_codesnippet_before'] = trim($form_state['values']['googleanalytics_codesnippet_before']);
+ $form_state['values']['googleanalytics_codesnippet_after'] = trim($form_state['values']['googleanalytics_codesnippet_after']);
+
if (!preg_match('/^UA-\d{4,}-\d+$/', $form_state['values']['googleanalytics_account'])) {
form_set_error('googleanalytics_account', t('A valid Google Analytics account number is case sensitive and formatted like UA-xxxxxx-x.'));
}
@@ -277,9 +283,4 @@ function googleanalytics_admin_settings_form_validate($form, &$form_state) {
if (preg_match('/(.*)<\/?script(.*)>(.*)/i', $form_state['values']['googleanalytics_codesnippet_after'])) {
form_set_error('googleanalytics_codesnippet_after', t('Do not include the &lt;script&gt; tags in the javascript code snippets.'));
}
-
- // Trim some text area values.
- $form_state['values']['googleanalytics_pages'] = trim($form_state['values']['googleanalytics_pages']);
- $form_state['values']['googleanalytics_codesnippet_before'] = trim($form_state['values']['googleanalytics_codesnippet_before']);
- $form_state['values']['googleanalytics_codesnippet_after'] = trim($form_state['values']['googleanalytics_codesnippet_after']);
}