analytics_piwik.module in Analytics 7
File
analytics_piwik/analytics_piwik.module
View source
<?php
function analytics_piwik_hook_info() {
$info['analytics_piwik_universal_actions'] = array(
'group' => 'analytics',
);
$info['analytics_piwik_universal_actions_alter'] = array(
'group' => 'analytics',
);
return $info;
}
function analytics_piwik_theme() {
$info['analytics_piwik_js'] = array(
'variables' => array(
'url' => NULL,
'actions' => array(),
'service' => NULL,
),
'file' => 'analytics_piwik.theme.inc',
);
return $info;
}
function analytics_piwik_analytics_service_info() {
$info['piwik'] = array(
'label' => t('Piwik'),
'class' => 'PiwikAnalyticsService',
);
return $info;
}
function _analytics_piwik_validate_url($element, &$form_state) {
$value = $element['#value'];
if ($value != '') {
$value = rtrim($value, '/') . '/';
form_set_value($element, $value, $form_state);
if (!valid_url($value, TRUE)) {
form_error($element, t('%name is not a valid URL.', array(
'%name' => $element['#title'],
)));
}
else {
$request = drupal_http_request($value . '/piwik.js');
if (!empty($request->error)) {
}
}
}
}