2011-12-27 13:58:28 +01:00
|
|
|
<?php
|
2013-01-26 22:46:54 +01:00
|
|
|
namespace chat\system\command;
|
2011-12-27 13:58:28 +01:00
|
|
|
use \wcf\system\event\EventHandler;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Default implementation for commands.
|
|
|
|
*
|
|
|
|
* @author Tim Düsterhus
|
2013-01-19 20:36:40 +01:00
|
|
|
* @copyright 2010-2013 Tim Düsterhus
|
2011-12-27 13:58:28 +01:00
|
|
|
* @license Creative Commons Attribution-NonCommercial-ShareAlike <http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode>
|
2013-01-19 20:36:40 +01:00
|
|
|
* @package be.bastelstu.chat
|
2012-03-24 22:37:47 +01:00
|
|
|
* @subpackage system.chat.command
|
2011-12-27 13:58:28 +01:00
|
|
|
*/
|
|
|
|
abstract class AbstractCommand implements ICommand {
|
2012-06-04 21:22:14 +02:00
|
|
|
/**
|
|
|
|
* Instance of the CommandHandler
|
|
|
|
*
|
2013-01-26 22:46:54 +01:00
|
|
|
* @var \chat\system\command\CommandHandler
|
2012-06-04 21:22:14 +02:00
|
|
|
*/
|
2011-12-27 13:58:28 +01:00
|
|
|
public $commandHandler = null;
|
2012-06-04 21:22:14 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Should HTML be enabled?
|
|
|
|
*
|
|
|
|
* @var integer
|
2013-01-26 22:46:54 +01:00
|
|
|
* @see \chat\system\command\ICommand::SETTING_OFF
|
|
|
|
* @see \chat\system\command\ICommand::SETTING_ON
|
2012-06-04 21:22:14 +02:00
|
|
|
*/
|
2013-01-09 21:34:30 +01:00
|
|
|
public $enableHTML = ICommand::SETTING_OFF;
|
|
|
|
|
2012-06-04 21:22:14 +02:00
|
|
|
/**
|
|
|
|
* Should smilies be enabled?
|
|
|
|
*
|
|
|
|
* @var integer
|
2013-01-26 22:46:54 +01:00
|
|
|
* @see \chat\system\command\ICommand::SETTING_OFF
|
|
|
|
* @see \chat\system\command\ICommand::SETTING_ON
|
|
|
|
* @see \chat\system\command\ICommand::SETTING_USER
|
2012-06-04 21:22:14 +02:00
|
|
|
*/
|
2013-01-09 21:34:30 +01:00
|
|
|
public $enableSmilies = ICommand::SETTING_OFF;
|
2012-06-04 21:22:14 +02:00
|
|
|
|
2011-12-27 13:58:28 +01:00
|
|
|
public function __construct(CommandHandler $commandHandler) {
|
|
|
|
EventHandler::getInstance()->fireAction($this, 'shouldInit');
|
|
|
|
$this->commandHandler = $commandHandler;
|
2012-03-24 22:29:07 +01:00
|
|
|
}
|
|
|
|
|
2012-06-04 21:22:14 +02:00
|
|
|
/**
|
|
|
|
* Fires the didInit-event.
|
|
|
|
* You should call this when everything is properly inserted.
|
|
|
|
*/
|
2012-03-24 22:29:07 +01:00
|
|
|
public function didInit() {
|
2011-12-27 13:58:28 +01:00
|
|
|
EventHandler::getInstance()->fireAction($this, 'didInit');
|
|
|
|
}
|
2011-12-27 14:34:42 +01:00
|
|
|
|
2012-06-04 21:22:14 +02:00
|
|
|
/**
|
|
|
|
* Default-Receiver: Everyone
|
|
|
|
*
|
2013-01-26 22:46:54 +01:00
|
|
|
* @see \chat\system\command\ICommand::getReceiver()
|
2012-06-04 21:22:14 +02:00
|
|
|
*/
|
2011-12-27 14:34:42 +01:00
|
|
|
public function getReceiver() {
|
|
|
|
return null;
|
|
|
|
}
|
2013-05-28 23:39:19 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* No additionaldata by default.
|
|
|
|
*/
|
|
|
|
public function getAdditionalData() {
|
|
|
|
return null;
|
|
|
|
}
|
2011-12-27 13:58:28 +01:00
|
|
|
}
|