Projet

Général

Profil

Paste
Télécharger (1,31 ko) Statistiques
| Branche: | Révision:

root / htmltest / sites / all / modules / piwik / piwik.variable.inc @ a5572547

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
function piwik_validate_piwik_site_id($variable) {
45
  if (!preg_match('/^\d{1,}$/', $variable['value'])) {
46
    return t('A valid Piwik site ID is an integer only.');
47
  }
48
}