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:
Brion Vibber
2010-03-21 15:18:37 -07:00
parent 0f1f7ab79b
commit 5d3bce49b8
2 changed files with 72 additions and 23 deletions

View File

@@ -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;
}
}