function _simpleads_validate_url in SimpleAds 7
Helper function. Validates redirection URL.
1 call to _simpleads_validate_url()
- _simpleads_redirect in ./
simpleads.module - Menu callback. Redirect Ads. If user is Admin -> redirect to Ad edit page, otherwise redirect to target URL.
File
- includes/
simpleads.helper.inc, line 424 - SimpleAds Helper functions.
Code
function _simpleads_validate_url($url) {
if (!preg_match("~^(?:f|ht)tps?://~i", $url)) {
// Allow internal url if user has access to it.
if (drupal_valid_path(drupal_get_normal_path($url))) {
$url = url($url, array(
'absolute' => TRUE,
));
}
else {
$url = 'http://' . $url;
}
}
else {
$url = url($url, array(
'absolute' => TRUE,
));
}
return $url;
}