]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/FirePHP/FirePHPPlugin.php
Merge remote-tracking branch 'upstream/master' into social-master
[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  * @category  Plugin
28  * @package MinifyPlugin
29  * @maintainer Craig Andrews <candrews@integralblue.com>
30  * @author    Craig Andrews <candrews@integralblue.com>
31  * @copyright 2009 Free Software Foundation, Inc http://www.fsf.org
32  * @license   http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
33  * @link      http://status.net/
34  */
35
36 if (!defined('STATUSNET') && !defined('LACONICA')) { exit(1); }
37
38 // We bundle the FirePHP library...
39 set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/extlib/FirePHP/lib');
40
41 class FirePHPPlugin extends Plugin
42 {
43     private $firephp;
44
45     function onInitializePlugin()
46     {
47         //Output buffering has to be enabled so FirePHP can send the HTTP headers it needs
48         ob_start();
49         require_once('FirePHPCore/FirePHP.class.php');
50         $this->firephp = FirePHP::getInstance(true);
51     }
52
53     function onStartLog(&$priority, &$msg, &$filename)
54     {
55         static $firephp_priorities = array(FirePHP::ERROR, FirePHP::ERROR, FirePHP::ERROR, FirePHP::ERROR,
56                                       FirePHP::WARN, FirePHP::LOG, FirePHP::LOG, FirePHP::INFO);
57         $fp_priority = $firephp_priorities[$priority];
58         $this->firephp->fb($msg, $fp_priority);
59     }
60
61     function onPluginVersion(array &$versions)
62     {
63         $versions[] = array('name' => 'FirePHP',
64                             'version' => GNUSOCIAL_VERSION,
65                             'author' => 'Craig Andrews',
66                             'homepage' => 'http://status.net/wiki/Plugin:FirePHP',
67                             'rawdescription' =>
68                             // TRANS: Plugin description.
69                             _m('The FirePHP plugin writes StatusNet\'s log output to FirePHP.'));
70         return true;
71     }
72 }