Move some last OpenID stuff into the OpenID plugin (XRDS)

This commit is contained in:
Mikael Nordfeldth 2015-06-04 01:08:03 +02:00
parent bdd15cfe63
commit a4739b0107
5 changed files with 13 additions and 29 deletions

View File

@ -28,11 +28,6 @@ class NetworkpublicAction extends SitestreamAction
} }
} }
function extraHead()
{
parent::extraHead();
}
function showSections() function showSections()
{ {
// Show invite button, as long as site isn't closed, and // Show invite button, as long as site isn't closed, and

View File

@ -39,7 +39,6 @@ if (!defined('GNUSOCIAL')) { exit(1); }
* @link http://status.net/ * @link http://status.net/
* *
* @see PublicrssAction * @see PublicrssAction
* @see PublicxrdsAction
*/ */
class PublicAction extends SitestreamAction class PublicAction extends SitestreamAction
{ {
@ -69,13 +68,6 @@ class PublicAction extends SitestreamAction
} }
} }
function extraHead()
{
parent::extraHead();
$this->element('meta', array('http-equiv' => 'X-XRDS-Location',
'content' => common_local_url('publicxrds')));
}
function showSections() function showSections()
{ {
// Show invite button, as long as site isn't closed, and // Show invite button, as long as site isn't closed, and

View File

@ -154,7 +154,7 @@ class OpenIDPlugin extends Plugin
* *
* @return boolean hook return * @return boolean hook return
*/ */
function onEndPublicXRDS($action, &$xrdsOutputter) function onEndPublicXRDS(Action $action, &$xrdsOutputter)
{ {
$xrdsOutputter->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)', $xrdsOutputter->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
'xmlns:simple' => 'http://xrds-simple.net/core/1.0', 'xmlns:simple' => 'http://xrds-simple.net/core/1.0',
@ -184,7 +184,7 @@ class OpenIDPlugin extends Plugin
* *
* @return boolean hook return * @return boolean hook return
*/ */
function onEndUserXRDS($action, &$xrdsOutputter) function onEndUserXRDS(Action $action, &$xrdsOutputter)
{ {
$xrdsOutputter->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)', $xrdsOutputter->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)',
'xml:id' => 'openid', 'xml:id' => 'openid',
@ -415,7 +415,7 @@ class OpenIDPlugin extends Plugin
* *
* @return void * @return void
*/ */
function onEndShowHeadElements($action) function onEndShowHeadElements(Action $action)
{ {
if ($action instanceof ShowstreamAction) { if ($action instanceof ShowstreamAction) {
$action->element('link', array('rel' => 'openid2.provider', $action->element('link', array('rel' => 'openid2.provider',
@ -427,6 +427,11 @@ class OpenIDPlugin extends Plugin
$action->element('link', array('rel' => 'openid.delegate', $action->element('link', array('rel' => 'openid.delegate',
'href' => $action->profile->profileurl)); 'href' => $action->profile->profileurl));
} }
if ($action instanceof SitestreamAction) {
$action->element('meta', array('http-equiv' => 'X-XRDS-Location',
'content' => common_local_url('publicxrds')));
}
return true; return true;
} }

View File

@ -30,12 +30,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
*/ */
if (!defined('STATUSNET') && !defined('LACONICA')) { if (!defined('GNUSOCIAL')) { exit(1); }
exit(1);
}
require_once INSTALLDIR.'/plugins/OpenID/openid.php'; require_once __DIR__.'/../openid.php';
require_once INSTALLDIR.'/lib/xrdsoutputter.php';
/** /**
* Public XRDS * Public XRDS
@ -70,9 +67,9 @@ class PublicxrdsAction extends Action
* *
* @return nothing * @return nothing
*/ */
function handle($args) protected function handle()
{ {
parent::handle($args); parent::handle();
$xrdsOutputter = new XRDSOutputter(); $xrdsOutputter = new XRDSOutputter();
$xrdsOutputter->startXRDS(); $xrdsOutputter->startXRDS();
Event::handle('StartPublicXRDS', array($this,&$xrdsOutputter)); Event::handle('StartPublicXRDS', array($this,&$xrdsOutputter));
@ -80,4 +77,3 @@ class PublicxrdsAction extends Action
$xrdsOutputter->endXRDS(); $xrdsOutputter->endXRDS();
} }
} }

View File

@ -28,11 +28,7 @@
* @link http://status.net/ * @link http://status.net/
*/ */
if (!defined('STATUSNET') && !defined('LACONICA')) { if (!defined('GNUSOCIAL')) { exit(1); }
exit(1);
}
require_once INSTALLDIR.'/lib/xmloutputter.php';
/** /**
* Low-level generator for XRDS XML * Low-level generator for XRDS XML