summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.18/sites/all/modules/piwik/piwik.variable.inc
diff options
context:
space:
mode:
Diffstat (limited to 'kolab.org/www/drupal-7.18/sites/all/modules/piwik/piwik.variable.inc')
-rw-r--r--kolab.org/www/drupal-7.18/sites/all/modules/piwik/piwik.variable.inc48
1 files changed, 48 insertions, 0 deletions
diff --git a/kolab.org/www/drupal-7.18/sites/all/modules/piwik/piwik.variable.inc b/kolab.org/www/drupal-7.18/sites/all/modules/piwik/piwik.variable.inc
new file mode 100644
index 0000000..3dbbfe5
--- /dev/null
+++ b/kolab.org/www/drupal-7.18/sites/all/modules/piwik/piwik.variable.inc
@@ -0,0 +1,48 @@
+<?php
+
+/**
+ * @file
+ * Definition of variables for Variable API module.
+ */
+
+/**
+ * Implements hook_variable_info().
+ */
+function piwik_variable_info($options) {
+ $variables['piwik_site_id'] = array(
+ 'type' => 'string',
+ 'title' => t('Piwik site ID', array(), $options),
+ 'default' => '',
+ 'description' => t('The user account number is unique to the websites domain. Click the <strong>Settings</strong> link in your Piwik account, then the <strong>Websites</strong> tab and enter the appropriate site <strong>ID</strong> into this field.'),
+ 'required' => TRUE,
+ 'group' => 'piwik',
+ 'localize' => TRUE,
+ 'multidomain' => TRUE,
+ 'validate callback' => 'piwik_validate_piwik_site_id',
+ );
+
+ return $variables;
+}
+
+/**
+ * Implements hook_variable_group_info().
+ */
+function piwik_variable_group_info() {
+ $groups['piwik'] = array(
+ 'title' => t('Piwik'),
+ 'description' => t('Configure tracking behavior to get insights into your website traffic and marketing effectiveness.'),
+ 'access' => 'administer piwik',
+ 'path' => array('admin/config/system/piwik'),
+ );
+
+ return $groups;
+}
+
+/**
+ * Validate Piwik site ID variable.
+ */
+function piwik_validate_piwik_site_id($variable) {
+ if (!preg_match('/^\d{1,}$/', $variable['value'])) {
+ return t('A valid Piwik site ID is an integer only.');
+ }
+}