Merge branch 'testing' of git@gitorious.org:statusnet/mainline into 0.9.x

This commit is contained in:
Brion Vibber
2010-03-10 17:04:51 -08:00
7 changed files with 251 additions and 34 deletions

View File

@@ -929,4 +929,41 @@ class OStatusPlugin extends Plugin
return true;
}
/**
* Utility function to check if the given URL is a canonical group profile
* page, and if so return the ID number.
*
* @param string $url
* @return mixed int or false
*/
public static function localGroupFromUrl($url)
{
$template = common_local_url('groupbyid', array('id' => '31337'));
$template = preg_quote($template, '/');
$template = str_replace('31337', '(\d+)', $template);
if (preg_match("/$template/", $url, $matches)) {
return intval($matches[1]);
}
return false;
}
/**
* Utility function to check if the given URL is a canonical user profile
* page, and if so return the ID number.
*
* @param string $url
* @return mixed int or false
*/
public static function localProfileFromUrl($url)
{
$template = common_local_url('userbyid', array('id' => '31337'));
$template = preg_quote($template, '/');
$template = str_replace('31337', '(\d+)', $template);
if (preg_match("/$template/", $url, $matches)) {
return intval($matches[1]);
}
return false;
}
}