function _analytics_piwik_validate_url in Analytics 7
1 string reference to '_analytics_piwik_validate_url'
- PiwikAnalyticsService::buildConfigurationForm in analytics_piwik/
src/ PiwikAnalyticsService.php - Form constructor.
File
- analytics_piwik/
analytics_piwik.module, line 41
Code
function _analytics_piwik_validate_url($element, &$form_state) {
$value = $element['#value'];
if ($value != '') {
// Make sure the URL is normalized.
$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)) {
//form_error($element, t('Error validating Piwki URL %url (@reason).', array('%url' => $value, '@reason' => $request->error)));
}
}
}
}