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

Drop enableBBCodes

This commit is contained in:
Tim Düsterhus 2013-03-11 15:42:05 +01:00
parent 850ccd65fd
commit a935eb5f8d
7 changed files with 11 additions and 32 deletions

View File

@ -77,25 +77,18 @@ public function getFormattedMessage($outputType = 'text/html') {
$message = $message['message']; $message = $message['message'];
case self::TYPE_NORMAL: case self::TYPE_NORMAL:
case self::TYPE_ME: case self::TYPE_ME:
if ($this->enableBBCodes) {
$messageParser = \wcf\system\bbcode\MessageParser::getInstance(); $messageParser = \wcf\system\bbcode\MessageParser::getInstance();
$messageParser->setOutputType($outputType); $messageParser->setOutputType($outputType);
$message = $messageParser->parse($message, $this->enableSmilies, $this->enableHTML, true, false); $message = $messageParser->parse($message, $this->enableSmilies, $this->enableHTML, true, false);
}
else if (!$this->enableHTML && $outputType == 'text/html') {
$message = \wcf\system\bbcode\SimpleMessageParser::getInstance()->parse($message, true, $this->enableSmilies);
}
break; break;
default: default:
if ($this->enableHTML) { if ($this->enableHTML) {
$message = self::replaceUserLink($message, $outputType); $message = self::replaceUserLink($message, $outputType);
} }
if ($this->enableBBCodes) {
$messageParser = \wcf\system\bbcode\MessageParser::getInstance(); $messageParser = \wcf\system\bbcode\MessageParser::getInstance();
$messageParser->setOutputType($outputType); $messageParser->setOutputType($outputType);
$message = $messageParser->parse($message, $this->enableSmilies, $this->enableHTML, true, false); $message = $messageParser->parse($message, $this->enableSmilies, $this->enableHTML, true, false);
}
break; break;
} }

View File

@ -48,6 +48,7 @@ public function validateSend() {
$this->readString('text'); $this->readString('text');
$this->readBoolean('enableSmilies'); $this->readBoolean('enableSmilies');
$this->parameters['text'] = MessageUtil::stripCrap($this->parameters['text']); $this->parameters['text'] = MessageUtil::stripCrap($this->parameters['text']);
$this->parameters['enableHTML'] = false;
// validate text // validate text
if (strlen($this->parameters['text']) > CHAT_MAX_LENGTH) throw new UserInputException('text', 'tooLong'); if (strlen($this->parameters['text']) > CHAT_MAX_LENGTH) throw new UserInputException('text', 'tooLong');
@ -85,8 +86,7 @@ public function validateSend() {
$command = $commandHandler->loadCommand(); $command = $commandHandler->loadCommand();
if ($command->enableSmilies != \chat\system\command\ICommand::SETTING_USER) $this->parameters['enableSmilies'] = $command->enableSmilies; if ($command->enableSmilies != \chat\system\command\ICommand::SETTING_USER) $this->parameters['enableSmilies'] = $command->enableSmilies;
$this->enableHTML = $command->enableHTML; $this->parameters['enableHTML'] = $command->enableHTML;
if ($command->enableBBCodes != \chat\system\command\ICommand::SETTING_USER) $this->enableBBCodes = $command->enableBBCodes;
$this->parameters['type'] = $command->getType(); $this->parameters['type'] = $command->getType();
$this->parameters['text'] = $command->getMessage(); $this->parameters['text'] = $command->getMessage();
@ -134,9 +134,8 @@ public function send() {
'time' => TIME_NOW, 'time' => TIME_NOW,
'type' => $this->parameters['type'], 'type' => $this->parameters['type'],
'message' => $this->parameters['text'], 'message' => $this->parameters['text'],
//'enableSmilies' => $this->enableSmilies, 'enableSmilies' => $this->parameters['enableSmilies'] ? 1 : 0,
//'enableHTML' => $this->enableHTML, 'enableHTML' => $this->parameters['enableHTML'] ? 1 : 0,
//'enableBBCodes' => $this->enableBBCodes,
'color1' => $this->parameters['userData']['color'][1], 'color1' => $this->parameters['userData']['color'][1],
'color2' => $this->parameters['userData']['color'][2] 'color2' => $this->parameters['userData']['color'][2]
) )

View File

@ -28,16 +28,6 @@ abstract class AbstractCommand implements ICommand {
*/ */
public $enableHTML = ICommand::SETTING_OFF; public $enableHTML = ICommand::SETTING_OFF;
/**
* Should BBCodes be enabled?
*
* @var integer
* @see \chat\system\command\ICommand::SETTING_OFF
* @see \chat\system\command\ICommand::SETTING_ON
* @see \chat\system\command\ICommand::SETTING_USER
*/
public $enableBBCodes = ICommand::SETTING_OFF;
/** /**
* Should smilies be enabled? * Should smilies be enabled?
* *

View File

@ -15,7 +15,6 @@
* @subpackage system.chat.command.commands * @subpackage system.chat.command.commands
*/ */
class InfoCommand extends \chat\system\command\AbstractCommand { class InfoCommand extends \chat\system\command\AbstractCommand {
public $enableBBCodes = self::SETTING_ON;
public $enableHTML = self::SETTING_ON; public $enableHTML = self::SETTING_ON;
public $lines = array(); public $lines = array();
public $user = null; public $user = null;

View File

@ -12,7 +12,6 @@
*/ */
class WhereCommand extends \chat\system\command\AbstractCommand { class WhereCommand extends \chat\system\command\AbstractCommand {
public $enableHTML = self::SETTING_ON; public $enableHTML = self::SETTING_ON;
public $enableBBCodes = self::SETTING_ON;
/** /**
* @see \chat\system\command\ICommand::getType() * @see \chat\system\command\ICommand::getType()

View File

@ -18,7 +18,6 @@ CREATE TABLE chat1_message (
type TINYINT(3) NOT NULL DEFAULT 1, type TINYINT(3) NOT NULL DEFAULT 1,
message MEDIUMTEXT NOT NULL, message MEDIUMTEXT NOT NULL,
enableSmilies TINYINT(1) NOT NULL DEFAULT 1, enableSmilies TINYINT(1) NOT NULL DEFAULT 1,
enableBBCodes TINYINT(1) NOT NULL DEFAULT 0,
enableHTML TINYINT(1) NOT NULL DEFAULT 0, enableHTML TINYINT(1) NOT NULL DEFAULT 0,
color1 INT(10) NOT NULL DEFAULT 0, color1 INT(10) NOT NULL DEFAULT 0,
color2 INT(10) NOT NULL DEFAULT 0, color2 INT(10) NOT NULL DEFAULT 0,

View File

@ -5,7 +5,7 @@
<packagedescription><![CDATA[Chat for WoltLab Community Framework™.]]></packagedescription> <packagedescription><![CDATA[Chat for WoltLab Community Framework™.]]></packagedescription>
<packagedescription language="de"><![CDATA[Chat für WoltLab Community Framework™.]]></packagedescription> <packagedescription language="de"><![CDATA[Chat für WoltLab Community Framework™.]]></packagedescription>
<isapplication>1</isapplication> <isapplication>1</isapplication>
<version>3.0.0 Alpha 19</version><!-- Codename: Codenames are overrated --> <version>3.0.0 Alpha 20</version><!-- Codename: Codenames are overrated -->
<date>2011-11-26</date> <date>2011-11-26</date>
</packageinformation> </packageinformation>