*
* @see http://groups.google.com/group/webfinger/browse_thread/thread/9f3d93a479e91bbf
*/
-
class Discovery
{
const LRDD_REL = 'lrdd';
/**
* Register a discovery class
- *
+ *
* @param string $class Class name
*
* @return void
*/
-
public function registerMethod($class)
{
$this->methods[] = $class;
*
* @return string normalized acct: or http(s)?: URI
*/
-
public static function normalize($user_id)
{
if (substr($user_id, 0, 5) == 'http:' ||
*
* @return boolean true if $user_id is a Webfinger, else false
*/
-
public static function isWebfinger($user_id)
{
$uri = Discovery::normalize($user_id);
*
* @return XRD XRD object for the user
*/
-
public function lookup($id)
{
// Normalize the incoming $id to make sure we have a uri
}
}
- // TRANS: Exception.
+ // TRANS: Exception. %s is an ID.
throw new Exception(sprintf(_('Unable to find services for %s.'), $id));
}
*
* @return array $link assoc array representing the link
*/
-
public static function getService($links, $service)
{
if (!is_array($links)) {
*
* @return string replaced values
*/
-
public static function applyTemplate($template, $id)
{
$template = str_replace('{uri}', urlencode($id), $template);
* Fetch an XRD file and parse
*
* @param string $url URL of the XRD
- *
+ *
* @return XRD object representing the XRD file
*/
-
public static function fetchXrd($url)
{
try {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
interface Discovery_LRDD
{
/**
*
* @return array Links in the XRD file
*/
-
public function discover($uri);
}
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
class Discovery_LRDD_Host_Meta implements Discovery_LRDD
{
/**
*
* @return array Links in the XRD file
*/
-
public function discover($uri)
{
if (Discovery::isWebfinger($uri)) {
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
class Discovery_LRDD_Link_Header implements Discovery_LRDD
{
/**
*
* @return array Links in the XRD file
*
- * @todo fail out of Webfinger URIs faster
+ * @todo fail out of Webfinger URIs faster
*/
-
public function discover($uri)
{
try {
* Given a string or array of headers, returns XRD-like assoc array
*
* @param string|array $header string or array of strings for headers
- *
+ *
* @return array Link header in XRD-like format
*/
-
protected static function parseHeader($header)
{
$lh = new LinkHeader($header);
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
* @link http://status.net/
*/
-
class Discovery_LRDD_Link_HTML implements Discovery_LRDD
{
/**
*
* @return array Links in XRD-ish assoc array
*
- * @todo fail out of Webfinger URIs faster
+ * @todo fail out of Webfinger URIs faster
*/
-
public function discover($uri)
{
try {
*
* @return array array of associative arrays in XRD-ish format
*/
-
public function parse($html)
{
$links = array();