commiting uncommited changes on live site
[weblabels.fsf.org.git] / crm.fsf.org / 20131203 / files / sites / all / modules-old / piwik / piwik.variable.inc
1 <?php
2
3 /**
4 * @file
5 * Definition of variables for Variable API module.
6 */
7
8 /**
9 * Implements hook_variable_info().
10 */
11 function piwik_variable_info($options) {
12 $variables['piwik_site_id'] = array(
13 'type' => 'string',
14 'title' => t('Piwik site ID', array(), $options),
15 'default' => '',
16 '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.'),
17 'required' => TRUE,
18 'group' => 'piwik',
19 'localize' => TRUE,
20 'multidomain' => TRUE,
21 'validate callback' => 'piwik_validate_piwik_site_id',
22 );
23
24 return $variables;
25 }
26
27 /**
28 * Implements hook_variable_group_info().
29 */
30 function piwik_variable_group_info() {
31 $groups['piwik'] = array(
32 'title' => t('Piwik'),
33 'description' => t('Configure tracking behavior to get insights into your website traffic and marketing effectiveness.'),
34 'access' => 'administer piwik',
35 'path' => array('admin/config/system/piwik'),
36 );
37
38 return $groups;
39 }
40
41 /**
42 * Validate Piwik site ID variable.
43 *
44 * @param array $variable
45 *
46 * @return string
47 */
48 function piwik_validate_piwik_site_id($variable) {
49 if (!preg_match('/^\d{1,}$/', $variable['value'])) {
50 return t('A valid Piwik site ID is an integer only.');
51 }
52 }