1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-12-22 21:40:08 +00:00

Use classmember instead of constant for smiley activation

This commit is contained in:
Tim Düsterhus 2012-02-04 12:25:09 +01:00
parent 1ffd7c7828
commit 64fb4bec06
5 changed files with 6 additions and 5 deletions

View File

@ -51,6 +51,7 @@ public function readFormParameters() {
*/
public function validate() {
parent::validate();
if ($this->message === '') {
throw new UserInputException('text');
}
@ -67,7 +68,7 @@ public function save() {
try {
$command = $commandHandler->loadCommand();
if ($command::ENABLE_SMILIES != \wcf\system\chat\commands\ICommand::SMILEY_USER) $this->enableSmilies = $command::ENABLE_SMILIES;
if ($command->enableSmilies != \wcf\system\chat\commands\ICommand::SMILEY_USER) $this->enableSmilies = $command->enableSmilies;
$type = $command->getType();
$this->message = $command->getMessage();
$receiver = $command->getReceiver();

View File

@ -50,7 +50,7 @@ public function loadCommand() {
$parts = explode(' ', StringUtil::substring($this->text, StringUtil::length(static::COMMAND_CHAR)), 2);
if ($this->isCommand($parts[0])) {
return new \wcf\system\chat\commands\PlainCommand();
return new commands\commands\PlainCommand($this);
}
$class = '\wcf\system\chat\commands\commands\\'.ucfirst($parts[0]);

View File

@ -12,7 +12,7 @@
* @subpackage system.chat.commands.commands
*/
class Color extends \wcf\system\chat\commands\AbstractCommand {
const ENABLE_SMILIES = \wcf\system\chat\commands\ICommand::SMILEY_OFF;
public $enableSmilies = \wcf\system\chat\commands\ICommand::SMILEY_OFF;
public static $colors = array(
'red' => 0xFF0000,
'blue' => 0x0000FF,

View File

@ -11,7 +11,7 @@
* @subpackage system.chat.commands.commands
*/
class Free extends Me {
const ENABLE_SMILIES = \wcf\system\chat\commands\ICommand::SMILEY_OFF;
public $enableSmilies = \wcf\system\chat\commands\ICommand::SMILEY_OFF;
/**
* @see \wcf\system\chat\commands\ICommand::getMessage()

View File

@ -12,7 +12,7 @@
* @subpackage system.chat.commands.commands
*/
class Me extends \wcf\system\chat\commands\AbstractCommand {
const ENABLE_SMILIES = \wcf\system\chat\commands\ICommand::SMILEY_USER;
public $enableSmilies = \wcf\system\chat\commands\ICommand::SMILEY_USER;
/**
* @see \wcf\system\chat\commands\ICommand::getType()