1
0
mirror of https://github.com/wbbaddons/Tims-Chat.git synced 2024-10-31 14:10:08 +00:00

Remove use of deprecated methods

see WoltLab/WCF@257405df08
This commit is contained in:
Tim Düsterhus 2013-08-19 23:23:26 +02:00
parent 46d86de030
commit 21104e4097
10 changed files with 8 additions and 13 deletions

View File

@ -66,7 +66,7 @@ public function validateSend() {
$this->parameters['enableHTML'] = false;
// validate text
if (\wcf\util\StringUtil::length($this->parameters['text']) > CHAT_MAX_LENGTH) throw new UserInputException('text', 'tooLong');
if (mb_strlen($this->parameters['text']) > CHAT_MAX_LENGTH) throw new UserInputException('text', 'tooLong');
// search for disallowed bbcodes
$disallowedBBCodes = \wcf\system\bbcode\BBCodeParser::getInstance()->validateBBCodes($this->parameters['text'], explode(',', WCF::getSession()->getPermission('user.chat.allowedBBCodes')));

View File

@ -147,7 +147,7 @@ public function readCommands() {
foreach ($files as $file) {
$command = $regex->replace(basename($file), '');
if ($command == 'Plain') continue;
$this->commands[] = \wcf\util\StringUtil::toLowerCase($command);
$this->commands[] = mb_strtolower($command);
}
$this->commands = array_merge($this->commands, array_keys(\chat\system\command\CommandHandler::getAliasMap()));

View File

@ -97,7 +97,7 @@ public function getRoom() {
* @return string
*/
public function getParameters() {
$parts = explode(' ', StringUtil::substring($this->text, StringUtil::length(static::COMMAND_CHAR)), 2);
$parts = explode(' ', mb_substr($this->text, mb_strlen(static::COMMAND_CHAR)), 2);
if (!isset($parts[1])) return '';
return $parts[1];
@ -107,7 +107,7 @@ public function getParameters() {
* Loads the command.
*/
public function loadCommand() {
$parts = explode(' ', StringUtil::substring($this->text, StringUtil::length(static::COMMAND_CHAR)), 2);
$parts = explode(' ', mb_substr($this->text, mb_strlen(static::COMMAND_CHAR)), 2);
$class = '\chat\system\command\commands\\'.ucfirst(strtolower($parts[0])).'Command';
if (!class_exists($class)) {

View File

@ -1,7 +1,6 @@
<?php
namespace chat\system\command\commands;
use \wcf\system\WCF;
use \wcf\util\StringUtil;
/**
* Marks the user as away.

View File

@ -1,6 +1,5 @@
<?php
namespace chat\system\command\commands;
use \wcf\util\StringUtil;
/**
* Changes the color of the username

View File

@ -14,7 +14,7 @@ class FreeCommand extends MeCommand {
public function __construct(\chat\system\command\CommandHandler $commandHandler) {
parent::__construct($commandHandler);
if (\wcf\util\StringUtil::toLowerCase($this->commandHandler->getParameters()) != 'the fish') {
if (mb_strtolower($this->commandHandler->getParameters()) != 'the fish') {
throw new \InvalidArgumentException();
}

View File

@ -4,7 +4,6 @@
use \wcf\data\user\User;
use \wcf\system\WCF;
use \wcf\util\DateUtil;
use \wcf\util\StringUtil;
/**
* Shows information about the specified user.

View File

@ -1,6 +1,5 @@
<?php
namespace chat\system\command\commands;
use \wcf\util\StringUtil;
/**
* Indicates an action. The message is shown without the colon.

View File

@ -1,7 +1,6 @@
<?php
namespace chat\system\command\commands;
use \wcf\system\WCF;
use \wcf\util\StringUtil;
/**
* Creates a temporary room

View File

@ -58,7 +58,7 @@ public static function getPackageID() {
* @return string
*/
public static function gradient($string, $start, $end) {
if (($length = \wcf\util\StringUtil::length($string)) === 0) return '';
if (($length = mb_strlen($string)) === 0) return '';
if ($start === $end) {
return '<span style="color:rgb('.($start >> 16 & 255).','.($start >> 8 & 255).','.($start & 255).')">'.\wcf\util\StringUtil::encodeHTML($string).'</span>';
@ -87,8 +87,8 @@ public static function gradient($string, $start, $end) {
*/
public static function str_split($string, $length = 1) {
$result = array();
for ($i = 0, $max = \wcf\util\StringUtil::length($string); $i < $max; $i += $length) {
$result[] = \wcf\util\StringUtil::substring($string, $i, $length);
for ($i = 0, $max = mb_strlen($string); $i < $max; $i += $length) {
$result[] = mb_substr($string, $i, $length);
}
return $result;
}