public function onStartHostMetaLinks(array &$links) { foreach (Discovery::supportedMimeTypes() as $type) { $links[] = new XML_XRD_Element_Link(Discovery::LRDD_REL, common_local_url('webfinger') . '?resource={uri}', $type, true); // isTemplate } // OAuth connections $links[] = new XML_XRD_Element_link(self::OAUTH_ACCESS_TOKEN_REL, common_local_url('ApiOAuthAccessToken')); $links[] = new XML_XRD_Element_link(self::OAUTH_REQUEST_TOKEN_REL, common_local_url('ApiOAuthRequestToken')); $links[] = new XML_XRD_Element_link(self::OAUTH_AUTHORIZE_REL, common_local_url('ApiOAuthAuthorize')); }
protected function checkAccept() { $type = null; $httpaccept = isset($_SERVER['HTTP_ACCEPT']) ? $_SERVER['HTTP_ACCEPT'] : null; $useragent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : null; if ($httpaccept !== null && $httpaccept != '*/*') { $can_serve = implode(',', Discovery::supportedMimeTypes()); $type = common_negotiate_type(common_accept_to_prefs($httpaccept), common_accept_to_prefs($can_serve)); } else { /* * HACK: for StatusNet to work against us, we must always serve an * XRD to at least versions <1.1.1 (at time of writing) since they * don't send Accept headers (in their 'Discovery::fetchXrd' calls) */ $matches = array(); preg_match('/(StatusNet)\\/(\\d+\\.\\d+(\\.\\d+)?)/', $useragent, $browser); if (count($browser) > 2 && $browser[1] === 'StatusNet' && version_compare($browser[2], '1.1.1') < 1) { return Discovery::XRD_MIMETYPE; } } if (empty($type)) { throw new Exception(_('No specified MIME type in Accept header.')); } return $type; }