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