]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/FirePHP/FirePHPPlugin.php
Merge branch 'sessionidparam' into 0.9.x
[quix0rs-gnu-social.git] / plugins / FirePHP / FirePHPPlugin.php
1 <?php
2 /*
3 StatusNet Plugin: 0.9
4 Plugin Name: FirePHP
5 Description: Sends StatusNet log output to FirePHP
6 Version: 0.1
7 Author: Craig Andrews <candrews@integralblue.com>
8 Author URI: http://candrews.integralblue.com/
9 */
10
11 /*
12  * StatusNet - the distributed open-source microblogging tool
13  * Copyright (C) 2009, StatusNet, Inc.
14  *
15  * This program is free software: you can redistribute it and/or modify
16  * it under the terms of the GNU Affero General Public License as published by
17  * the Free Software Foundation, either version 3 of the License, or
18  * (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful,
21  * but WITHOUT ANY WARRANTY; without even the implied warranty of
22  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
23  * GNU Affero General Public License for more details.
24  *
25  * You should have received a copy of the GNU Affero General Public License
26  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
27  */
28
29 /**
30  * @package MinifyPlugin
31  * @maintainer Craig Andrews <candrews@integralblue.com>
32  */
33
34 if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
35
36 // We bundle the FirePHP library...
37 set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/extlib/FirePHP/lib');
38
39 class FirePHPPlugin extends Plugin
40 {
41     private $firephp;
42
43     function onInitializePlugin()
44     {
45         //Output buffering has to be enabled so FirePHP can send the HTTP headers it needs
46         ob_start();
47         require_once('FirePHPCore/FirePHP.class.php');
48         $this->firephp = FirePHP::getInstance(true);
49     }
50
51     function onStartLog(&$priority, &$msg, &$filename)
52     {
53         static $firephp_priorities = array(FirePHP::ERROR, FirePHP::ERROR, FirePHP::ERROR, FirePHP::ERROR,
54                                       FirePHP::WARN, FirePHP::LOG, FirePHP::LOG, FirePHP::INFO);
55         $priority = $firephp_priorities[$priority];
56         $this->firephp->fb($msg, $priority);
57     }
58
59     function onPluginVersion(&$versions)
60     {
61         $versions[] = array('name' => 'FirePHP',
62                             'version' => STATUSNET_VERSION,
63                             'author' => 'Craig Andrews',
64                             'homepage' => 'http://status.net/wiki/Plugin:FirePHP',
65                             'rawdescription' =>
66                             _m('The FirePHP plugin writes StatusNet\'s log output to FirePHP.'));
67         return true;
68     }
69 }
70