From a4739b010795fc9a7f32cf1e85366453aa379206 Mon Sep 17 00:00:00 2001 From: Mikael Nordfeldth Date: Thu, 4 Jun 2015 01:08:03 +0200 Subject: [PATCH] Move some last OpenID stuff into the OpenID plugin (XRDS) --- actions/networkpublic.php | 5 ----- actions/public.php | 8 -------- plugins/OpenID/OpenIDPlugin.php | 11 ++++++++--- {actions => plugins/OpenID/actions}/publicxrds.php | 12 ++++-------- {lib => plugins/OpenID/lib}/xrdsoutputter.php | 6 +----- 5 files changed, 13 insertions(+), 29 deletions(-) rename {actions => plugins/OpenID/actions}/publicxrds.php (90%) rename {lib => plugins/OpenID/lib}/xrdsoutputter.php (96%) diff --git a/actions/networkpublic.php b/actions/networkpublic.php index 6f1124a9d8..41c4e37e3c 100644 --- a/actions/networkpublic.php +++ b/actions/networkpublic.php @@ -28,11 +28,6 @@ class NetworkpublicAction extends SitestreamAction } } - function extraHead() - { - parent::extraHead(); - } - function showSections() { // Show invite button, as long as site isn't closed, and diff --git a/actions/public.php b/actions/public.php index 175e0f1e70..000f82cb93 100644 --- a/actions/public.php +++ b/actions/public.php @@ -39,7 +39,6 @@ if (!defined('GNUSOCIAL')) { exit(1); } * @link http://status.net/ * * @see PublicrssAction - * @see PublicxrdsAction */ 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() { // Show invite button, as long as site isn't closed, and diff --git a/plugins/OpenID/OpenIDPlugin.php b/plugins/OpenID/OpenIDPlugin.php index 0d093f2868..cf820c3ab6 100644 --- a/plugins/OpenID/OpenIDPlugin.php +++ b/plugins/OpenID/OpenIDPlugin.php @@ -154,7 +154,7 @@ class OpenIDPlugin extends Plugin * * @return boolean hook return */ - function onEndPublicXRDS($action, &$xrdsOutputter) + function onEndPublicXRDS(Action $action, &$xrdsOutputter) { $xrdsOutputter->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)', 'xmlns:simple' => 'http://xrds-simple.net/core/1.0', @@ -184,7 +184,7 @@ class OpenIDPlugin extends Plugin * * @return boolean hook return */ - function onEndUserXRDS($action, &$xrdsOutputter) + function onEndUserXRDS(Action $action, &$xrdsOutputter) { $xrdsOutputter->elementStart('XRD', array('xmlns' => 'xri://$xrd*($v*2.0)', 'xml:id' => 'openid', @@ -415,7 +415,7 @@ class OpenIDPlugin extends Plugin * * @return void */ - function onEndShowHeadElements($action) + function onEndShowHeadElements(Action $action) { if ($action instanceof ShowstreamAction) { $action->element('link', array('rel' => 'openid2.provider', @@ -427,6 +427,11 @@ class OpenIDPlugin extends Plugin $action->element('link', array('rel' => 'openid.delegate', 'href' => $action->profile->profileurl)); } + + if ($action instanceof SitestreamAction) { + $action->element('meta', array('http-equiv' => 'X-XRDS-Location', + 'content' => common_local_url('publicxrds'))); + } return true; } diff --git a/actions/publicxrds.php b/plugins/OpenID/actions/publicxrds.php similarity index 90% rename from actions/publicxrds.php rename to plugins/OpenID/actions/publicxrds.php index aac6f423cf..5b099872f4 100644 --- a/actions/publicxrds.php +++ b/plugins/OpenID/actions/publicxrds.php @@ -30,12 +30,9 @@ * along with this program. If not, see . */ -if (!defined('STATUSNET') && !defined('LACONICA')) { - exit(1); -} +if (!defined('GNUSOCIAL')) { exit(1); } -require_once INSTALLDIR.'/plugins/OpenID/openid.php'; -require_once INSTALLDIR.'/lib/xrdsoutputter.php'; +require_once __DIR__.'/../openid.php'; /** * Public XRDS @@ -70,9 +67,9 @@ class PublicxrdsAction extends Action * * @return nothing */ - function handle($args) + protected function handle() { - parent::handle($args); + parent::handle(); $xrdsOutputter = new XRDSOutputter(); $xrdsOutputter->startXRDS(); Event::handle('StartPublicXRDS', array($this,&$xrdsOutputter)); @@ -80,4 +77,3 @@ class PublicxrdsAction extends Action $xrdsOutputter->endXRDS(); } } - diff --git a/lib/xrdsoutputter.php b/plugins/OpenID/lib/xrdsoutputter.php similarity index 96% rename from lib/xrdsoutputter.php rename to plugins/OpenID/lib/xrdsoutputter.php index 95dc73300a..9841d9e871 100644 --- a/lib/xrdsoutputter.php +++ b/plugins/OpenID/lib/xrdsoutputter.php @@ -28,11 +28,7 @@ * @link http://status.net/ */ -if (!defined('STATUSNET') && !defined('LACONICA')) { - exit(1); -} - -require_once INSTALLDIR.'/lib/xmloutputter.php'; +if (!defined('GNUSOCIAL')) { exit(1); } /** * Low-level generator for XRDS XML -- 2.39.5