]> git.mxchange.org Git - quix0rs-gnu-social.git/blob - plugins/Irc/extlib/phergie/Phergie/Plugin/Cocktail.php
Merge branch '0.9.x' into 1.0.x
[quix0rs-gnu-social.git] / plugins / Irc / extlib / phergie / Phergie / Plugin / Cocktail.php
1 <?php
2 /**
3  * Phergie
4  *
5  * PHP version 5
6  *
7  * LICENSE
8  *
9  * This source file is subject to the new BSD license that is bundled
10  * with this package in the file LICENSE.
11  * It is also available through the world-wide-web at this URL:
12  * http://phergie.org/license
13  *
14  * @category  Phergie
15  * @package   Phergie_Plugin_Cocktail
16  * @author    Phergie Development Team <team@phergie.org>
17  * @copyright 2008-2010 Phergie Development Team (http://phergie.org)
18  * @license   http://phergie.org/license New BSD License
19  * @link      http://pear.phergie.org/package/Phergie_Plugin_Cocktail
20  */
21
22 /**
23  * Processes requests to serve users cocktail.
24  *
25  * @category Phergie
26  * @package  Phergie_Plugin_Cocktail
27  * @author   Phergie Development Team <team@phergie.org>
28  * @license  http://phergie.org/license New BSD License
29  * @link     http://pear.phergie.org/package/Phergie_Plugin_Cocktail
30  * @uses     Phergie_Plugin_Command pear.phergie.org
31  * @uses     Phergie_Plugin_Serve pear.phergie.org
32  */
33 class Phergie_Plugin_Cocktail extends Phergie_Plugin_Abstract
34 {
35     /**
36      * Checks for dependencies.
37      *
38      * @return void
39      */
40     public function onLoad()
41     {
42         $plugins = $this->plugins;
43         $plugins->getPlugin('Command');
44         $plugins->getPlugin('Serve');
45     }
46
47     /**
48      * Processes requests to serve a user a cocktail.
49      *
50      * @param string $request Request including the target and an optional
51      *        suggestion of what cocktail to serve
52      *
53      * @return void
54      */
55     public function onCommandCocktail($request)
56     {
57         $format = $this->getConfig(
58             'cocktail.format',
59             'throws %target% %article% %item%.'
60         );
61
62         $this->plugins->getPlugin('Serve')->serve(
63             dirname(__FILE__) . '/Cocktail/cocktail.db',
64             'cocktail',
65             $format,
66             $request,
67             true
68         );
69     }
70 }
71