forked from GNUsocial/gnu-social
OStatus profile setup cleanup
* drop OStatusPlugin::localProfileFromUrl(), we can just look up on user.uri * clean up a few edge cases that returned null through Ostatus_profile::ensure* code paths, now throws clear exception when we can't find a feed from the given profile url * add some doc comments on the ensure* methods
This commit is contained in:
@@ -947,23 +947,4 @@ class OStatusPlugin extends Plugin
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user