function shurly_path_available in ShURLy 6
Same name and namespace in other branches
- 8 shurly.module \shurly_path_available()
- 7 shurly.module \shurly_path_available()
Checks to see if there's a menu handler, path alias, or language prefix for a given path
Return value
TRUE if there are no conflicts
4 calls to shurly_path_available()
- shurly_create_form_validate in ./
shurly.module - shurly_generate_random in ./
shurly.module - Generate a random short URL Pretty much unused at this point this method could take a LOOOONG time on a site with lots of URLs
- shurly_next_url in ./
shurly.module - Return next available short URL
- shurly_shorten in ./
shurly.module - API function to shorten a URL @arg $long_url - the long URL to shorten @arg $custom - optional custom short URL, user_access('enter custom URLs') should be checked prior to calling shurly_shorten()
File
- ./
shurly.module, line 781 - description http://www.youtube.com/watch?v=Qo7qoonzTCE
Code
function shurly_path_available($path) {
// check to see if path represents an enabled language
$languages = language_list();
if (array_key_exists($path, $languages)) {
return FALSE;
}
$return = TRUE;
// see if $path is an alias
$source = drupal_lookup_path('source', $path);
if ($source) {
// if so, set alias source to $path
$path = $source;
}
// check to see if $path has a menu callback
if (menu_get_item($path)) {
$return = FALSE;
}
return $return;
}