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()
{
// 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/
*
* @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

View File

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

View File

@ -30,12 +30,9 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
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();
}
}

View File

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