]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/LRDD/LRDDPlugin.php
Merge branch 'fixes/private_scope_on_tags' into social-master
[quix0rs-gnu-social.git] / plugins / LRDD / LRDDPlugin.php
1 <?php
2 /*
3  * GNU Social - a federating social network
4  * Copyright (C) 2013, Free Software Foundation, Inc.
5  *
6  * This program is free software: you can redistribute it and/or modify
7  * it under the terms of the GNU Affero General Public License as published by
8  * the Free Software Foundation, either version 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU Affero General Public License for more details.
15  *
16  * You should have received a copy of the GNU Affero General Public License
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
18  */
19
20 /**
21  * Implements Link-based Resource Descriptor Discovery based on RFC6415,
22  * Web Host Metadata, i.e. the predecessor to WebFinger resource discovery.
23  *
24  * @package GNUsocial
25  * @author  Mikael Nordfeldth <mmn@hethane.se>
26  */
27
28 if (!defined('GNUSOCIAL')) { exit(1); }
29
30 set_include_path(get_include_path() . PATH_SEPARATOR . __DIR__ . '/extlib/');
31
32 class LRDDPlugin extends Plugin
33 {
34     public function onAutoload($cls)
35     {
36         switch ($cls) {
37         case 'XML_XRD':
38             require_once __DIR__ . '/extlib/XML/XRD.php';
39             return false;
40         }
41
42         return parent::onAutoload($cls);
43     }
44     public function onStartDiscoveryMethodRegistration(Discovery $disco) {
45         $disco->registerMethod('LRDDMethod_WebFinger');
46     }
47
48     public function onEndDiscoveryMethodRegistration(Discovery $disco) {
49         $disco->registerMethod('LRDDMethod_HostMeta');
50         $disco->registerMethod('LRDDMethod_LinkHeader');
51         $disco->registerMethod('LRDDMethod_LinkHTML');
52     }
53
54     public function onPluginVersion(array &$versions)
55     {
56         $versions[] = array('name' => 'LRDD',
57                             'version' => GNUSOCIAL_VERSION,
58                             'author' => 'Mikael Nordfeldth',
59                             'homepage' => 'http://www.gnu.org/software/social/',
60                             // TRANS: Plugin description.
61                             'rawdescription' => _m('Implements LRDD support for GNU Social.'));
62
63         return true;
64     }
65 }