]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/YammerImport/YammerImportPlugin.php
02923493fbbeb0395e26bb340440983739826826
[quix0rs-gnu-social.git] / plugins / YammerImport / YammerImportPlugin.php
1 <?php
2 /*
3  * StatusNet - the distributed open-source microblogging tool
4  * Copyright (C) 2010, StatusNet, 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  * @package YammerImportPlugin
22  * @maintainer Brion Vibber <brion@status.net>
23  */
24
25 if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
26
27 set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/extlib/');
28
29 class YammerImportPlugin extends Plugin
30 {
31     /**
32      * Hook for RouterInitialized event.
33      *
34      * @param Net_URL_Mapper $m path-to-action mapper
35      * @return boolean hook return
36      */
37     function onRouterInitialized($m)
38     {
39         $m->connect('admin/import/yammer',
40                     array('action' => 'importyammer'));
41         return true;
42     }
43
44     /**
45      * Set up queue handlers for import processing
46      * @param QueueManager $qm
47      * @return boolean hook return
48      */
49     function onEndInitializeQueueManager(QueueManager $qm)
50     {
51         $qm->connect('importym', 'ImportYmQueueHandler');
52
53         return true;
54     }
55
56     /**
57      * Automatically load the actions and libraries used by the plugin
58      *
59      * @param Class $cls the class
60      *
61      * @return boolean hook return
62      *
63      */
64     function onAutoload($cls)
65     {
66         $base = dirname(__FILE__);
67         $lower = strtolower($cls);
68         switch ($cls) {
69         case 'yammerimqueuehandler':
70         case 'importyammeraction':
71             require_once $base . $lower . '.php';
72             return false;
73         default:
74             return true;
75         }
76     }
77 }