Replaced deprecated methods
authorSascha Greuel <sascha@softcreatr.de>
Mon, 26 Aug 2013 12:48:56 +0000 (14:48 +0200)
committerSascha Greuel <sascha@softcreatr.de>
Mon, 26 Aug 2013 12:48:56 +0000 (14:48 +0200)
Replace deprecated methods of StringUtil with their php internal
equivalents. I had to open a new pull request, because i have no idea
how to update the old one :p

85 files changed:
wcfsetup/install/files/lib/acp/form/AbstractCategoryAddForm.class.php
wcfsetup/install/files/lib/acp/form/CronjobAddForm.class.php
wcfsetup/install/files/lib/acp/form/LanguageAddForm.class.php
wcfsetup/install/files/lib/acp/form/LanguageEditForm.class.php
wcfsetup/install/files/lib/acp/form/LanguageExportForm.class.php
wcfsetup/install/files/lib/acp/form/LoginForm.class.php
wcfsetup/install/files/lib/acp/form/MasterPasswordForm.class.php
wcfsetup/install/files/lib/acp/form/MasterPasswordInitForm.class.php
wcfsetup/install/files/lib/acp/form/StyleExportForm.class.php
wcfsetup/install/files/lib/acp/form/TagAddForm.class.php
wcfsetup/install/files/lib/acp/form/UserAddForm.class.php
wcfsetup/install/files/lib/acp/form/UserEditForm.class.php
wcfsetup/install/files/lib/acp/page/AbstractCategoryListPage.class.php
wcfsetup/install/files/lib/acp/page/ExceptionLogViewPage.class.php
wcfsetup/install/files/lib/action/GravatarDownloadAction.class.php
wcfsetup/install/files/lib/data/AbstractDatabaseObjectAction.class.php
wcfsetup/install/files/lib/data/DatabaseObjectList.class.php
wcfsetup/install/files/lib/data/bbcode/media/provider/BBCodeMediaProvider.class.php
wcfsetup/install/files/lib/data/option/Option.class.php
wcfsetup/install/files/lib/data/package/Package.class.php
wcfsetup/install/files/lib/data/package/update/server/PackageUpdateServer.class.php
wcfsetup/install/files/lib/data/style/StyleAction.class.php
wcfsetup/install/files/lib/data/style/StyleEditor.class.php
wcfsetup/install/files/lib/data/template/Template.class.php
wcfsetup/install/files/lib/data/user/UserAction.class.php
wcfsetup/install/files/lib/data/user/UserProfile.class.php
wcfsetup/install/files/lib/data/user/UserProfileAction.class.php
wcfsetup/install/files/lib/data/user/avatar/Gravatar.class.php
wcfsetup/install/files/lib/form/AccountManagementForm.class.php
wcfsetup/install/files/lib/form/LoginForm.class.php
wcfsetup/install/files/lib/form/MessageForm.class.php
wcfsetup/install/files/lib/page/MembersListPage.class.php
wcfsetup/install/files/lib/system/WCF.class.php
wcfsetup/install/files/lib/system/WCFSetup.class.php
wcfsetup/install/files/lib/system/acl/ACLHandler.class.php
wcfsetup/install/files/lib/system/bbcode/BBCodeParser.class.php
wcfsetup/install/files/lib/system/bbcode/CodeBBCode.class.php
wcfsetup/install/files/lib/system/bbcode/KeywordHighlighter.class.php
wcfsetup/install/files/lib/system/bbcode/ListBBCode.class.php
wcfsetup/install/files/lib/system/bbcode/PreParser.class.php
wcfsetup/install/files/lib/system/bbcode/SimpleMessageParser.class.php
wcfsetup/install/files/lib/system/bbcode/highlighter/DiffHighlighter.class.php
wcfsetup/install/files/lib/system/bbcode/highlighter/PhpHighlighter.class.php
wcfsetup/install/files/lib/system/breadcrumb/Breadcrumb.class.php
wcfsetup/install/files/lib/system/cache/CacheHandler.class.php
wcfsetup/install/files/lib/system/cronjob/DailyMailNotificationCronjob.class.php
wcfsetup/install/files/lib/system/cronjob/RefreshSearchRobotsCronjob.class.php
wcfsetup/install/files/lib/system/event/listener/PreParserAtUserListener.class.php
wcfsetup/install/files/lib/system/exception/ValidateActionException.class.php
wcfsetup/install/files/lib/system/form/FormDocument.class.php
wcfsetup/install/files/lib/system/importer/SmileyImporter.class.php
wcfsetup/install/files/lib/system/importer/UserImporter.class.php
wcfsetup/install/files/lib/system/io/ZipWriter.class.php
wcfsetup/install/files/lib/system/message/censorship/Censorship.class.php
wcfsetup/install/files/lib/system/message/quote/MessageQuoteManager.class.php
wcfsetup/install/files/lib/system/option/FileSizeOptionType.class.php
wcfsetup/install/files/lib/system/option/SelectOptionType.class.php
wcfsetup/install/files/lib/system/option/TextOptionType.class.php
wcfsetup/install/files/lib/system/option/user/SelectOptionsUserOptionOutput.class.php
wcfsetup/install/files/lib/system/package/PackageInstallationDispatcher.class.php
wcfsetup/install/files/lib/system/package/PackageInstallationNodeBuilder.class.php
wcfsetup/install/files/lib/system/package/plugin/SQLPackageInstallationPlugin.class.php
wcfsetup/install/files/lib/system/request/LinkHandler.class.php
wcfsetup/install/files/lib/system/request/RequestHandler.class.php
wcfsetup/install/files/lib/system/search/SearchEngine.class.php
wcfsetup/install/files/lib/system/search/SearchResultTextParser.class.php
wcfsetup/install/files/lib/system/setup/Installer.class.php
wcfsetup/install/files/lib/system/tagging/TagEngine.class.php
wcfsetup/install/files/lib/system/template/TemplateEngine.class.php
wcfsetup/install/files/lib/system/template/TemplateScriptingCompiler.class.php
wcfsetup/install/files/lib/system/template/plugin/ImplodeCompilerTemplatePlugin.class.php
wcfsetup/install/files/lib/system/template/plugin/PagesFunctionTemplatePlugin.class.php
wcfsetup/install/files/lib/system/template/plugin/TableWordwrapModifierTemplatePlugin.class.php
wcfsetup/install/files/lib/system/upload/UploadFile.class.php
wcfsetup/install/files/lib/system/user/notification/UserNotificationHandler.class.php
wcfsetup/install/files/lib/system/worker/MailWorker.class.php
wcfsetup/install/files/lib/util/CronjobUtil.class.php
wcfsetup/install/files/lib/util/HeaderUtil.class.php
wcfsetup/install/files/lib/util/OptionUtil.class.php
wcfsetup/install/files/lib/util/PasswordUtil.class.php
wcfsetup/install/files/lib/util/StringStack.class.php
wcfsetup/install/files/lib/util/StringUtil.class.php
wcfsetup/install/files/lib/util/UserRegistrationUtil.class.php
wcfsetup/install/files/lib/util/UserUtil.class.php
wcfsetup/install/files/lib/util/XML.class.php

index c62cd2eac1bac757c8933745106cbb3803ae402b..80c7d613e69f15367b876a361a98a95aa8d85a9c 100644 (file)
@@ -118,13 +118,13 @@ abstract class AbstractCategoryAddForm extends AbstractForm {
                
                // autoset controllers
                if (empty($this->addController)) {
-                       $this->addController = StringUtil::replace(array('AddForm', 'EditForm'), 'Add', $className);
+                       $this->addController = str_replace(array('AddForm', 'EditForm'), 'Add', $className);
                }
                if (empty($this->editController)) {
-                       $this->editController = StringUtil::replace(array('AddForm', 'EditForm'), 'Edit', $className);
+                       $this->editController = str_replace(array('AddForm', 'EditForm'), 'Edit', $className);
                }
                if (empty($this->listController)) {
-                       $this->listController = StringUtil::replace(array('AddForm', 'EditForm'), 'List', $className);
+                       $this->listController = str_replace(array('AddForm', 'EditForm'), 'List', $className);
                }
                
                parent::__run();
index a31f928cd3d866fe85ef673ba7c2c5e5bbfc8705..d70dbca50ca771202a0ee876e45ece6380cc14c4 100755 (executable)
@@ -98,11 +98,11 @@ class CronjobAddForm extends AbstractForm {
                
                if (isset($_POST['className'])) $this->className = StringUtil::trim($_POST['className']);
                if (isset($_POST['description'])) $this->description = StringUtil::trim($_POST['description']);
-               if (isset($_POST['startMinute'])) $this->startMinute = StringUtil::replace(' ', '', $_POST['startMinute']);
-               if (isset($_POST['startHour'])) $this->startHour = StringUtil::replace(' ', '', $_POST['startHour']);
-               if (isset($_POST['startDom'])) $this->startDom = StringUtil::replace(' ', '', $_POST['startDom']);
-               if (isset($_POST['startMonth'])) $this->startMonth = StringUtil::replace(' ', '', $_POST['startMonth']);
-               if (isset($_POST['startDow'])) $this->startDow = StringUtil::replace(' ', '', $_POST['startDow']);
+               if (isset($_POST['startMinute'])) $this->startMinute = str_replace(' ', '', $_POST['startMinute']);
+               if (isset($_POST['startHour'])) $this->startHour = str_replace(' ', '', $_POST['startHour']);
+               if (isset($_POST['startDom'])) $this->startDom = str_replace(' ', '', $_POST['startDom']);
+               if (isset($_POST['startMonth'])) $this->startMonth = str_replace(' ', '', $_POST['startMonth']);
+               if (isset($_POST['startDow'])) $this->startDow = str_replace(' ', '', $_POST['startDow']);
        }
        
        /**
index 71c93d13749785742ac163f2756f0e4634fe0f29..5564836cdd9ce06571daf393ba997367a4695152 100644 (file)
@@ -129,7 +129,7 @@ class LanguageAddForm extends AbstractForm {
                
                $this->language = LanguageEditor::create(array(
                        'languageName' => $this->languageName,
-                       'languageCode' => StringUtil::toLowerCase($this->languageCode)
+                       'languageCode' => mb_strtolower($this->languageCode)
                ));
                $languageEditor = new LanguageEditor($this->sourceLanguage);
                $languageEditor->copy($this->language);
index bc6a13863bed11f7f363ab2bbb4d70925ca105a1..ae1744792c3b7b08ad9dddcce04ab49270b9b468 100644 (file)
@@ -42,7 +42,7 @@ class LanguageEditForm extends LanguageAddForm {
         * @see wcf\acp\form\LanguageAddForm::validateLanguageCode()
         */
        protected function validateLanguageCode() {
-               if ($this->language->languageCode != StringUtil::toLowerCase($this->languageCode)) {
+               if ($this->language->languageCode != mb_strtolower($this->languageCode)) {
                        parent::validateLanguageCode();
                }
        }
@@ -61,7 +61,7 @@ class LanguageEditForm extends LanguageAddForm {
                $editor = new LanguageEditor($this->language);
                $editor->update(array(
                        'languageName' => $this->languageName,
-                       'languageCode' => StringUtil::toLowerCase($this->languageCode)          
+                       'languageCode' => mb_strtolower($this->languageCode)            
                ));
                LanguageFactory::getInstance()->clearCache();
                $this->saved();
index 7a441997e04f0eac6724a1b540fabab4c4395e1c..1beb4b8fc3abc33884c4addfcd9e397eb54b7fa4 100644 (file)
@@ -146,7 +146,7 @@ class LanguageExportForm extends AbstractForm {
                $statement = WCF::getDB()->prepareStatement($sql);
                $statement->execute(array($this->languageID));
                while ($row = $statement->fetchArray()) {
-                       $row['packageNameLength'] = StringUtil::length(WCF::getLanguage()->get($row['packageName']));
+                       $row['packageNameLength'] = mb_strlen(WCF::getLanguage()->get($row['packageName']));
                        $this->packages[] = new Package(null, $row);
                        if ($row['packageNameLength'] > $this->packageNameLength) {
                                $this->packageNameLength = $row['packageNameLength'];   
index b333b9d8ba5231147184481e0c1255fe7f2af746..ffdca16b23b119532b07007ab1b56da246ac5519 100755 (executable)
@@ -136,7 +136,7 @@ class LoginForm extends AbstractForm {
                
                if (!empty($this->url)) {
                        // append session
-                       if (StringUtil::indexOf($this->url, '?') !== false) $this->url .= SID_ARG_2ND_NOT_ENCODED;
+                       if (mb_strpos($this->url, '?') !== false) $this->url .= SID_ARG_2ND_NOT_ENCODED;
                        else $this->url .= SID_ARG_1ST;
                        HeaderUtil::redirect($this->url);
                }
index 06b7a864ced8cbdceb4327bdcc48148a60fac5ad..6051883f0926da33825d02fed3598d426b5c4661 100755 (executable)
@@ -97,7 +97,7 @@ class MasterPasswordForm extends AbstractForm {
        public function readData() {
                parent::readData();
                
-               if (empty($_POST) && StringUtil::indexOf(WCF::getSession()->requestURI, 'MasterPassword') === false) {
+               if (empty($_POST) && mb_strpos(WCF::getSession()->requestURI, 'MasterPassword') === false) {
                        $this->url = WCF::getSession()->requestURI;
                }
        }
index 1b4c377d789b7bd4638a484c9ac94fc1a712d61e..d4eeffb1c71f39ace490497d5e11938950bbab46 100755 (executable)
@@ -62,7 +62,7 @@ class MasterPasswordInitForm extends MasterPasswordForm {
                }
                
                // check password security
-               if (StringUtil::length($this->masterPassword) < 8) {
+               if (mb_strlen($this->masterPassword) < 8) {
                        throw new UserInputException('masterPassword', 'notSecure');
                }
                // digits
index 64c7aba2ecafd9f0f7b2a2e34979d2200a4d946a..d30633edbb1b5265591b9220cedcf356c429c5d4 100644 (file)
@@ -139,7 +139,7 @@ class StyleExportForm extends AbstractForm {
                parent::save();
                
                // get style filename
-               $filename = str_replace(' ', '-', preg_replace('/[^a-z0-9 _-]/', '', StringUtil::toLowerCase($this->style->styleName)));
+               $filename = str_replace(' ', '-', preg_replace('/[^a-z0-9 _-]/', '', mb_strtolower($this->style->styleName)));
                
                // send headers
                header('Content-Type: application/x-gzip; charset=utf-8');
index 7c1bb2d4f6170d89fe93f210c3f49bc79a4ab712..b78d678b56869681235ac319f916bc163e622eb5 100644 (file)
@@ -106,7 +106,7 @@ class TagAddForm extends AbstractForm {
                
                // validate synonyms
                foreach ($this->synonyms as $key => $synonym) {
-                       if (StringUtil::toLowerCase($synonym) == StringUtil::toLowerCase($this->name)) {
+                       if (mb_strtolower($synonym) == mb_strtolower($this->name)) {
                                unset($this->synonyms[$key]);
                        }
                }
index 043cb91ad6416e368706273ac34f5b78a68ae322..250c9c7f63d6965f2e2790491d74a8c8bdf0e63f 100644 (file)
@@ -223,7 +223,7 @@ class UserAddForm extends UserOptionListForm {
                
                // validate user title
                try {
-                       if (StringUtil::length($this->userTitle) > USER_TITLE_MAX_LENGTH) {
+                       if (mb_strlen($this->userTitle) > USER_TITLE_MAX_LENGTH) {
                                throw new UserInputException('userTitle', 'tooLong');
                        }
                        if (!StringUtil::executeWordFilter($this->userTitle, USER_FORBIDDEN_TITLES)) {
@@ -335,7 +335,7 @@ class UserAddForm extends UserOptionListForm {
                }
                
                // check confirm input
-               if (StringUtil::toLowerCase($email) != StringUtil::toLowerCase($confirmEmail)) {
+               if (mb_strtolower($email) != mb_strtolower($confirmEmail)) {
                        throw new UserInputException('confirmEmail', 'notEqual');
                }
        }
index eb4160295da3365e680c352cadcf6effce037f09..3e15815e66043fd894c0da83bee902a4d7a2106a 100755 (executable)
@@ -309,7 +309,7 @@ class UserEditForm extends UserAddForm {
         * @see wcf\acp\form\UserAddForm::validateUsername()
         */
        protected function validateUsername($username) {
-               if (StringUtil::toLowerCase($this->user->username) != StringUtil::toLowerCase($username)) {
+               if (mb_strtolower($this->user->username) != mb_strtolower($username)) {
                        parent::validateUsername($username);
                }
        }
@@ -318,7 +318,7 @@ class UserEditForm extends UserAddForm {
         * @see wcf\acp\form\UserAddForm::validateEmail()
         */
        protected function validateEmail($email, $confirmEmail) {
-               if (StringUtil::toLowerCase($this->user->email) != StringUtil::toLowerCase($email)) {
+               if (mb_strtolower($this->user->email) != mb_strtolower($email)) {
                        parent::validateEmail($email, $this->confirmEmail);
                }
        }
index 58173c1a5d96be93bd168b5b3cd70b3e3058e311..39839fba955c0a5bb7ee259c697cccb79733486b 100644 (file)
@@ -83,10 +83,10 @@ abstract class AbstractCategoryListPage extends AbstractPage {
                
                // autoset controllers
                if (empty($this->addController)) {
-                       $this->addController = StringUtil::replace('ListPage', 'Add', $className);
+                       $this->addController = str_replace('ListPage', 'Add', $className);
                }
                if (empty($this->editController)) {
-                       $this->editController = StringUtil::replace('ListPage', 'Edit', $className);
+                       $this->editController = str_replace('ListPage', 'Edit', $className);
                }
                
                parent::__run();
index 011a4d584e1383ce6024677c1f6e9481d5245a39..b5a3d760ad3581dc298fd69fa9b0c333192c5729 100644 (file)
@@ -83,7 +83,7 @@ class ExceptionLogViewPage extends MultipleLinkPage {
                        foreach ($this->logFiles as $logFile) {
                                $contents = file_get_contents($logFile);
                                
-                               if (StringUtil::indexOf($contents, '<<<<<<<<'.$this->exceptionID.'<<<<') !== false) {
+                               if (mb_strpos($contents, '<<<<<<<<'.$this->exceptionID.'<<<<') !== false) {
                                        $fileNameRegex->match($logFile);
                                        $matches = $fileNameRegex->getMatches();
                                        $this->logFile = $matches[0];
index a7960809b9e5a5415933228de6288e52c8ea9420..0c1ab75df999dece6d05274d80c817e3b13a95db 100644 (file)
@@ -60,7 +60,7 @@ class GravatarDownloadAction extends AbstractAction {
                
                if ($this->user->enableGravatar) {
                        // try to use cached gravatar
-                       $cachedFilename = sprintf(Gravatar::GRAVATAR_CACHE_LOCATION, md5(StringUtil::toLowerCase($this->user->email)), $this->size);
+                       $cachedFilename = sprintf(Gravatar::GRAVATAR_CACHE_LOCATION, md5(mb_strtolower($this->user->email)), $this->size);
                        if (file_exists(WCF_DIR.$cachedFilename) && filemtime(WCF_DIR.$cachedFilename) > (TIME_NOW - (Gravatar::GRAVATAR_CACHE_EXPIRE * 86400))) {
                                @header('Content-Type: image/png');
                                @readfile(WCF_DIR.$cachedFilename);
@@ -68,7 +68,7 @@ class GravatarDownloadAction extends AbstractAction {
                        }
                        
                        // try to download new version
-                       $gravatarURL = sprintf(Gravatar::GRAVATAR_BASE, md5(StringUtil::toLowerCase($this->user->email)), $this->size, '404');
+                       $gravatarURL = sprintf(Gravatar::GRAVATAR_BASE, md5(mb_strtolower($this->user->email)), $this->size, '404');
                        try {
                                $tmpFile = FileUtil::downloadFileFromHttp($gravatarURL, 'gravatar');
                                copy($tmpFile, WCF_DIR.$cachedFilename);
index 3e28be5cebd907ec79f8508440e8e8667cb5c4f6..dfcbe14a73292d7f52e54871888552d746489b01 100644 (file)
@@ -102,8 +102,8 @@ abstract class AbstractDatabaseObjectAction implements IDatabaseObjectAction, ID
                if (empty($this->className)) {
                        $className = get_called_class();
                        
-                       if (StringUtil::substring($className, -6) == 'Action') {
-                               $this->className = StringUtil::substring($className, 0, -6).'Editor';
+                       if (mb_substr($className, -6) == 'Action') {
+                               $this->className = mb_substr($className, 0, -6).'Editor';
                        }
                }
                
index edddd42898c0f618206e908d1671b259e1e9c42d..8f031927c3dd5d33e7ddd14f3c0c8f4072a9c69f 100644 (file)
@@ -115,8 +115,8 @@ abstract class DatabaseObjectList implements \Countable, ITraversableObject {
                if (empty($this->className)) {
                        $className = get_called_class();
                        
-                       if (StringUtil::substring($className, -4) == 'List') {
-                               $this->className = StringUtil::substring($className, 0, -4);
+                       if (mb_substr($className, -4) == 'List') {
+                               $this->className = mb_substr($className, 0, -4);
                        }
                }
                
index fe9bce0ab56576e7262cea5b49d631c84abfa7da..a9f2830ff9f97f289482db2d5d39295d8ab331c5 100644 (file)
@@ -93,7 +93,7 @@ class BBCodeMediaProvider extends DatabaseObject implements IRouteController {
                        
                        $output = $this->html;
                        foreach ($regex->getMatches() as $name => $value) {
-                               $output = StringUtil::replace('{$'.$name.'}', $value, $output);
+                               $output = str_replace('{$'.$name.'}', $value, $output);
                        }
                        return $output;
                }
index a2f2bb3ba4af44d570361125c060c65eb698ab96..1c67cfab6bf53b9e3265026cdcfe793c0b986f1a 100644 (file)
@@ -86,7 +86,7 @@ class Option extends DatabaseObject {
                        foreach ($options as $item) {
                                if ($item{0} == '!') {
                                        if (!empty($disableOptions)) $disableOptions .= ',';
-                                       $disableOptions .= "'".StringUtil::substring($item, 1)."' ";
+                                       $disableOptions .= "'".mb_substr($item, 1)."' ";
                                }
                                else {
                                        if (!empty($enableOptions)) $enableOptions .= ',';
@@ -111,7 +111,7 @@ class Option extends DatabaseObject {
                $options = explode("\n", StringUtil::trim(StringUtil::unifyNewlines($this->selectOptions)));
                foreach ($options as $option) {
                        $key = $value = $option;
-                       if (StringUtil::indexOf($option, ':') !== false) {
+                       if (mb_strpos($option, ':') !== false) {
                                $optionData = explode(':', $option);
                                $key = array_shift($optionData);
                                $value = implode(':', $optionData);
@@ -134,7 +134,7 @@ class Option extends DatabaseObject {
                        $options = explode("\n", StringUtil::trim(StringUtil::unifyNewlines($this->enableOptions)));
                        $key = -1;
                        foreach ($options as $option) {
-                               if (StringUtil::indexOf($option, ':') !== false) {
+                               if (mb_strpos($option, ':') !== false) {
                                        $optionData = explode(':', $option);
                                        $key = array_shift($optionData);
                                        $value = implode(':', $optionData);
index 89ffd0cbfca1ecfb207497556f83579595774006..5d795a3199d989af8160aff509e7b313d99c9674 100644 (file)
@@ -285,10 +285,10 @@ class Package extends DatabaseObject {
         * @return      boolean
         */
        public static function checkFromversion($currentVersion, $fromversion) {
-               if (StringUtil::indexOf($fromversion, '*') !== false) {
+               if (mb_strpos($fromversion, '*') !== false) {
                        // from version with wildcard
                        // use regular expression
-                       $fromversion = StringUtil::replace('\*', '.*', preg_quote($fromversion, '!'));
+                       $fromversion = str_replace('\*', '.*', preg_quote($fromversion, '!'));
                        if (preg_match('!^'.$fromversion.'$!i', $currentVersion)) {
                                return true;
                        }
index 519487a3189770b57efca137b55be00ce903d4da..0d4d3642baf3f14058dc65ac60f2c36212aa59f8 100644 (file)
@@ -134,6 +134,6 @@ class PackageUpdateServer extends DatabaseObject {
         */
        public function getHighlightedURL() {
                $host = parse_url($this->serverURL, PHP_URL_HOST);
-               return StringUtil::replace($host, '<strong>'.$host.'</strong>', $this->serverURL);
+               return str_replace($host, '<strong>'.$host.'</strong>', $this->serverURL);
        }
 }
index 3d1c04f225f116ea010505cca73416715726f486..ea4d0f3b15d44aaaa80bf525b55fe4447e4a0960 100644 (file)
@@ -425,7 +425,7 @@ class StyleAction extends AbstractDatabaseObjectAction implements IToggleAction
                // copy preview image
                if ($this->styleEditor->image) {
                        // get extension
-                       $fileExtension = StringUtil::substring($this->styleEditor->image, StringUtil::lastIndexOf($this->styleEditor->image, '.'));
+                       $fileExtension = mb_substr($this->styleEditor->image, mb_strrpos($this->styleEditor->image, '.'));
                        
                        // copy existing preview image
                        if (@copy(WCF_DIR.'images/'.$this->styleEditor->image, WCF_DIR.'images/stylePreview-'.$newStyle->styleID.$fileExtension)) {
index 0a9e0fdee6fdda7faf94bf1a9c4ee62aad632f91..2498b820c4a7a9c3b79e0f502db39a3b4d83492a 100644 (file)
@@ -311,7 +311,7 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject
                if (!empty($data['templates'])) {
                        $templateGroupName = $originalTemplateGroupName = $data['name'];
                        $templateGroupFolderName = preg_replace('/[^a-z0-9_-]/i', '', $templateGroupName);
-                       if (empty($templateGroupFolderName)) $templateGroupFolderName = 'generic'.StringUtil::substring(StringUtil::getRandomID(), 0, 8);
+                       if (empty($templateGroupFolderName)) $templateGroupFolderName = 'generic'.mb_substr(StringUtil::getRandomID(), 0, 8);
                        $originalTemplateGroupFolderName = $templateGroupFolderName;
                        
                        // get unique template pack name
@@ -436,7 +436,7 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject
                                                        TemplateEditor::create(array(
                                                                'application' => Package::getAbbreviation($package),
                                                                'packageID' => $row['packageID'],
-                                                               'templateName' => StringUtil::replace('.tpl', '', $template['filename']),
+                                                               'templateName' => str_replace('.tpl', '', $template['filename']),
                                                                'templateGroupID' => $styleData['templateGroupID']
                                                        ));
                                                }
@@ -460,7 +460,7 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject
                
                // import preview image
                if (!empty($data['image'])) {
-                       $fileExtension = StringUtil::substring($data['image'], StringUtil::lastIndexOf($data['image'], '.'));
+                       $fileExtension = mb_substr($data['image'], mb_strrpos($data['image'], '.'));
                        $index = $tar->getIndexByFilename($data['image']);
                        if ($index !== false) {
                                $filename = WCF_DIR.'images/stylePreview-'.$style->styleID.$fileExtension;
index 2fbd0158081c27fe6481e9d0dd4562417ba41f73..7ca0a74abb991f32b9b6d066ec79065e820fac8c 100644 (file)
@@ -125,8 +125,8 @@ class Template extends DatabaseObject {
                                // search
                                if ($useRegex) $matches = (intval(preg_match('/'.$search.'/s'.(!$caseSensitive ? 'i' : ''), $template->getSource())) !== 0);
                                else {
-                                       if ($caseSensitive) $matches = (StringUtil::indexOf($template->getSource(), $search) !== false);
-                                       else $matches = (StringUtil::indexOfIgnoreCase($template->getSource(), $search) !== false);
+                                       if ($caseSensitive) $matches = (mb_strpos($template->getSource(), $search) !== false);
+                                       else $matches = (mb_strripos($template->getSource(), $search) !== false);
                                }
                                
                                if (($matches && !$invertSearch) || (!$matches && $invertSearch)) {
@@ -140,7 +140,7 @@ class Template extends DatabaseObject {
                                        $newSource = preg_replace('/'.$search.'/s'.(!$caseSensitive ? 'i' : ''), $replace, $template->getSource(), -1, $matches);
                                }
                                else {
-                                       if ($caseSensitive) $newSource = StringUtil::replace($search, $replace, $template->getSource(), $matches);
+                                       if ($caseSensitive) $newSource = str_replace($search, $replace, $template->getSource(), $matches);
                                        else $newSource = StringUtil::replaceIgnoreCase($search, $replace, $template->getSource(), $matches);
                                }
                                
index e74292d6e999ac1f5c1bc98b54720b01cca70862..d5698d0bebc45588ae19b94dc5e997a944cf7c62 100644 (file)
@@ -365,7 +365,7 @@ class UserAction extends AbstractDatabaseObjectAction implements IClipboardActio
                        foreach ($accessibleGroups as $group) {
                                $groupName = $group->getName();
                                if (!in_array($groupName, $excludedSearchValues)) {
-                                       $pos = StringUtil::indexOfIgnoreCase($groupName, $searchString);
+                                       $pos = mb_strripos($groupName, $searchString);
                                        if ($pos !== false && $pos == 0) {
                                                $list[] = array(
                                                        'label' => $groupName,
index 456758d7f8af25f0bd88f60051957df48f29258b..5346f098ace9a68e20394404b6dbbb23d39bde81 100644 (file)
@@ -404,7 +404,7 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
                // save case sensitive usernames
                $caseSensitiveUsernames = array();
                foreach ($usernames as &$username) {
-                       $tmp = StringUtil::toLowerCase($username);
+                       $tmp = mb_strtolower($username);
                        $caseSensitiveUsernames[$tmp] = $username;
                        $username = $tmp;
                }
@@ -413,7 +413,7 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
                // check cache
                foreach ($usernames as $index => $username) {
                        foreach (self::$userProfiles as $user) {
-                               if (StringUtil::toLowerCase($user->username) === $username) {
+                               if (mb_strtolower($user->username) === $username) {
                                        $users[$username] = $user;
                                        unset($usernames[$index]);
                                }
@@ -426,7 +426,7 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
                        $userList->readObjects();
                        
                        foreach ($userList as $user) {
-                               $users[StringUtil::toLowerCase($user->username)] = $user;
+                               $users[mb_strtolower($user->username)] = $user;
                                self::$userProfiles[$user->userID] = $user;
                        }
                        
@@ -671,7 +671,7 @@ class UserProfile extends DatabaseObjectDecorator implements IBreadcrumbProvider
                        return '';
                }
                
-               return StringUtil::substring($this->authData, 0, StringUtil::indexOf($this->authData, ':'));
+               return mb_substr($this->authData, 0, mb_strpos($this->authData, ':'));
        }
        
        /**
index 9d0bd6bf096fd2e6489defa30731bc2ad920ccbf..46081f541ed9c5a456437c55b0c8d07d76b3375d 100644 (file)
@@ -243,7 +243,7 @@ class UserProfileAction extends UserAction {
                // validate user title
                if ($userTitle !== null) {
                        try {
-                               if (StringUtil::length($userTitle) > USER_TITLE_MAX_LENGTH) {
+                               if (mb_strlen($userTitle) > USER_TITLE_MAX_LENGTH) {
                                        throw new UserInputException('__userTitle', 'tooLong');
                                }
                                if (!StringUtil::executeWordFilter($userTitle, USER_FORBIDDEN_TITLES)) {
index ee2e69b05029bc57536235fde8ab601a7d419211..cebf41a9808e60701bdc38a3cd5e45a39e40792f 100644 (file)
@@ -73,7 +73,7 @@ class Gravatar extends DefaultAvatar {
                
                if (!isset($this->url[$size])) {
                        // try to use cached gravatar
-                       $cachedFilename = sprintf(self::GRAVATAR_CACHE_LOCATION, md5(StringUtil::toLowerCase($this->gravatar)), $size);
+                       $cachedFilename = sprintf(self::GRAVATAR_CACHE_LOCATION, md5(mb_strtolower($this->gravatar)), $size);
                        if (file_exists(WCF_DIR.$cachedFilename) && filemtime(WCF_DIR.$cachedFilename) > (TIME_NOW - (self::GRAVATAR_CACHE_EXPIRE * 86400))) {
                                $this->url[$size] = WCF::getPath().$cachedFilename;
                        }
@@ -94,7 +94,7 @@ class Gravatar extends DefaultAvatar {
         * @return      boolean
         */
        public static function test($email) {
-               $gravatarURL = sprintf(self::GRAVATAR_BASE, md5(StringUtil::toLowerCase($email)), 80, '404');
+               $gravatarURL = sprintf(self::GRAVATAR_BASE, md5(mb_strtolower($email)), 80, '404');
                try {
                        $tmpFile = FileUtil::downloadFileFromHttp($gravatarURL, 'gravatar');
                        @unlink($tmpFile);
index 54d88c90f46487b16873cc287a5f070560a94de9..3455f29f65e1f59acbcbde20195fd54cd223f1d4 100644 (file)
@@ -190,7 +190,7 @@ class AccountManagementForm extends AbstractSecureForm {
                
                // user name
                if (WCF::getSession()->getPermission('user.profile.canRename') && $this->username != WCF::getUser()->username) {
-                       if (StringUtil::toLowerCase($this->username) != StringUtil::toLowerCase(WCF::getUser()->username)) {
+                       if (mb_strtolower($this->username) != mb_strtolower(WCF::getUser()->username)) {
                                if (WCF::getUser()->lastUsernameChange + WCF::getSession()->getPermission('user.profile.renamePeriod') * 86400 > TIME_NOW) {
                                        throw new UserInputException('username', 'alreadyRenamed');
                                }
@@ -235,7 +235,7 @@ class AccountManagementForm extends AbstractSecureForm {
                        }
                        
                        // checks if only letter case has changed
-                       if (StringUtil::toLowerCase($this->email) != StringUtil::toLowerCase(WCF::getUser()->email)) {
+                       if (mb_strtolower($this->email) != mb_strtolower(WCF::getUser()->email)) {
                                // check for valid email (one @ etc.)
                                if (!UserRegistrationUtil::isValidEmail($this->email)) {
                                        throw new UserInputException('email', 'notValid');
@@ -248,7 +248,7 @@ class AccountManagementForm extends AbstractSecureForm {
                        }
                        
                        // checks confirm input
-                       if (StringUtil::toLowerCase($this->email) != StringUtil::toLowerCase($this->confirmEmail)) {
+                       if (mb_strtolower($this->email) != mb_strtolower($this->confirmEmail)) {
                                throw new UserInputException('confirmEmail', 'notEqual');
                        }
                }
@@ -332,7 +332,7 @@ class AccountManagementForm extends AbstractSecureForm {
                
                // user name
                if (WCF::getSession()->getPermission('user.profile.canRename') && $this->username != WCF::getUser()->username) {
-                       if (StringUtil::toLowerCase($this->username) != StringUtil::toLowerCase(WCF::getUser()->username)) {
+                       if (mb_strtolower($this->username) != mb_strtolower(WCF::getUser()->username)) {
                                $updateParameters['lastUsernameChange'] = TIME_NOW;
                                $updateParameters['oldUsername'] = $userEditor->username;
                        }
@@ -342,7 +342,7 @@ class AccountManagementForm extends AbstractSecureForm {
                
                // email
                if (WCF::getSession()->getPermission('user.profile.canChangeEmail') && $this->email != WCF::getUser()->email && $this->email != WCF::getUser()->newEmail) {
-                       if (REGISTER_ACTIVATION_METHOD == 0 || REGISTER_ACTIVATION_METHOD == 2 || StringUtil::toLowerCase($this->email) == StringUtil::toLowerCase(WCF::getUser()->email)) {
+                       if (REGISTER_ACTIVATION_METHOD == 0 || REGISTER_ACTIVATION_METHOD == 2 || mb_strtolower($this->email) == mb_strtolower(WCF::getUser()->email)) {
                                // update email
                                $updateParameters['email'] = $this->email;
                                $success[] = 'wcf.user.changeEmail.success';
index 9432687c80f53f61b725539a4c1898c9743fe6de..510cde6d1d1cfe41a2ef44bf17194483acfec8f0 100644 (file)
@@ -94,12 +94,12 @@ class LoginForm extends \wcf\acp\form\LoginForm {
         * Gets the redirect url.
         */
        protected function checkURL() {
-               if (empty($this->url) || StringUtil::indexOf($this->url, 'index.php/Login/') !== false) {
+               if (empty($this->url) || mb_strpos($this->url, 'index.php/Login/') !== false) {
                        $this->url = LinkHandler::getInstance()->getLink();
                }
                // append missing session id
                else if (SID_ARG_1ST != '' && !preg_match('/(?:&|\?)s=[a-z0-9]{40}/', $this->url)) {
-                       if (StringUtil::indexOf($this->url, '?') !== false) $this->url .= SID_ARG_2ND_NOT_ENCODED;
+                       if (mb_strpos($this->url, '?') !== false) $this->url .= SID_ARG_2ND_NOT_ENCODED;
                        else $this->url .= SID_ARG_1ST;
                }
        }
index 1dfc4dcbd5b8d4f7fc6fbcd5133f68ce2198e78e..4cc0ff81f2c24056bcd44293b83328ba30bab846 100644 (file)
@@ -230,7 +230,7 @@ abstract class MessageForm extends RecaptchaForm {
                        throw new UserInputException('subject');
                }
                
-               if (StringUtil::length($this->subject) > 255) {
+               if (mb_strlen($this->subject) > 255) {
                        throw new UserInputException('subject', 'tooLong');
                }
                
@@ -253,7 +253,7 @@ abstract class MessageForm extends RecaptchaForm {
                }
                
                // check text length
-               if ($this->maxTextLength != 0 && StringUtil::length($this->text) > $this->maxTextLength) {
+               if ($this->maxTextLength != 0 && mb_strlen($this->text) > $this->maxTextLength) {
                        throw new UserInputException('text', 'tooLong');
                }
                
index 61f4c30f8c54fe9dba41161d099f3f10fa8f2b68..bb378ca2a160de95f02088578619a89c48d97334 100644 (file)
@@ -95,7 +95,7 @@ class MembersListPage extends SortablePage {
                parent::readParameters();
                
                // letter
-               if (isset($_REQUEST['letter']) && StringUtil::length($_REQUEST['letter']) == 1 && StringUtil::indexOf(self::$availableLetters, $_REQUEST['letter']) !== false) {
+               if (isset($_REQUEST['letter']) && mb_strlen($_REQUEST['letter']) == 1 && mb_strpos(self::$availableLetters, $_REQUEST['letter']) !== false) {
                        $this->letter = $_REQUEST['letter'];
                }
                
index 466d0046038863a8d79a8c2f6aad8cf58bd68cfb..0a637e84ef72c94881db3c8294db3f616c708012 100644 (file)
@@ -539,7 +539,7 @@ class WCF {
                self::getTPL()->registerPrefilter(array('event', 'hascontent', 'lang'));
                self::getTPL()->assign(array(
                        '__wcf' => $this,
-                       '__wcfVersion' => StringUtil::substring(sha1(WCF_VERSION), 0, 8)
+                       '__wcfVersion' => mb_substr(sha1(WCF_VERSION), 0, 8)
                ));
        }
        
@@ -722,7 +722,7 @@ class WCF {
                $path = FileUtil::removeLeadingSlash($path);
                $baseHref = self::getTPL()->get('baseHref');
                
-               if (!empty($path) && StringUtil::indexOf($path, '?') !== 0) {
+               if (!empty($path) && mb_strpos($path, '?') !== 0) {
                        $baseHref .= 'index.php/';
                }
                
index 2d2e5959bd56d07d32753a53a9266a69152fa34a..b966ce1bb18aa84e8ef3b1f61859efa8d9ea9ef9 100644 (file)
@@ -664,12 +664,12 @@ class WCFSetup extends WCF {
                                        // write configuration to config.inc.php
                                        $file = new File(WCF_DIR.'config.inc.php');
                                        $file->write("<?php\n");
-                                       $file->write("\$dbHost = '".StringUtil::replace("'", "\\'", $dbHost)."';\n");
+                                       $file->write("\$dbHost = '".str_replace("'", "\\'", $dbHost)."';\n");
                                        $file->write("\$dbPort = ".$dbPort.";\n");
-                                       $file->write("\$dbUser = '".StringUtil::replace("'", "\\'", $dbUser)."';\n");
-                                       $file->write("\$dbPassword = '".StringUtil::replace("'", "\\'", $dbPassword)."';\n");
-                                       $file->write("\$dbName = '".StringUtil::replace("'", "\\'", $dbName)."';\n");
-                                       $file->write("\$dbClass = '".StringUtil::replace("'", "\\'", $dbClass)."';\n");
+                                       $file->write("\$dbUser = '".str_replace("'", "\\'", $dbUser)."';\n");
+                                       $file->write("\$dbPassword = '".str_replace("'", "\\'", $dbPassword)."';\n");
+                                       $file->write("\$dbName = '".str_replace("'", "\\'", $dbName)."';\n");
+                                       $file->write("\$dbClass = '".str_replace("'", "\\'", $dbClass)."';\n");
                                        $file->write("if (!defined('WCF_N')) define('WCF_N', $dbNumber);\n?>");
                                        $file->close();
                                        
@@ -712,7 +712,7 @@ class WCFSetup extends WCF {
                $sql = file_get_contents(TMP_DIR.'setup/db/install.sql');
                
                // installation number value 'n' (WCF_N) must be reflected in the executed sql queries
-               $sql = StringUtil::replace('wcf1_', 'wcf'.$dbNumber.'_', $sql);
+               $sql = str_replace('wcf1_', 'wcf'.$dbNumber.'_', $sql);
                
                // get all tablenames which should be created
                preg_match_all("%CREATE\s+TABLE\s+(\w+)%", $sql, $matches);
@@ -753,7 +753,7 @@ class WCFSetup extends WCF {
                $sql = $sqlData[$offset];
                
                // installation number value 'n' (WCF_N) must be reflected in the executed sql queries
-               $sql = StringUtil::replace('wcf1_', 'wcf'.WCF_N.'_', $sql);
+               $sql = str_replace('wcf1_', 'wcf'.WCF_N.'_', $sql);
                
                // execute sql queries
                $parser = new SQLParser($sql);
@@ -821,7 +821,7 @@ class WCFSetup extends WCF {
                        }
                        else {
                                // regular file
-                               $fileInserts[] = StringUtil::replace(WCF_DIR, '', $file);
+                               $fileInserts[] = str_replace(WCF_DIR, '', $file);
                        }
                }
                file_put_contents(WCF_DIR.'__wcfSetupPerformance.log', "\tRead files: " . round(microtime(true) - $start, 3) . "\n", FILE_APPEND);
@@ -1040,7 +1040,7 @@ class WCFSetup extends WCF {
                $otherPackages = array();
                $tar = new Tar(SETUP_FILE);
                foreach ($tar->getContentList() as $file) {
-                       if ($file['type'] != 'folder' && StringUtil::indexOf($file['filename'], 'install/packages/') === 0) {
+                       if ($file['type'] != 'folder' && mb_strpos($file['filename'], 'install/packages/') === 0) {
                                $packageFile = basename($file['filename']);
                                
                                // ignore any files which aren't an archive
@@ -1207,7 +1207,7 @@ class WCFSetup extends WCF {
                // get package name
                $tar = new Tar(SETUP_FILE);
                foreach ($tar->getContentList() as $file) {
-                       if ($file['type'] != 'folder' && StringUtil::indexOf($file['filename'], 'install/packages/') === 0) {
+                       if ($file['type'] != 'folder' && mb_strpos($file['filename'], 'install/packages/') === 0) {
                                $packageFile = basename($file['filename']);
                                $packageName = preg_replace('!\.(tar\.gz|tgz|tar)$!', '', $packageFile);
                                
index 42575cfc8c5e0ebc859ae7ab7da05fb84ac35273..afde775aa03b95ba95fe92b5f87a33ab57e26b33 100644 (file)
@@ -371,7 +371,7 @@ class ACLHandler extends SingletonFactory {
                $optionList = new ACLOptionList();
                if (!empty($categoryName)) {
                        if (StringUtil::endsWith($categoryName, '.*')) {
-                               $categoryName = StringUtil::substring($categoryName, 0, -1) . '%';
+                               $categoryName = mb_substr($categoryName, 0, -1) . '%';
                                $optionList->getConditionBuilder()->add("acl_option.categoryName LIKE ?", array($categoryName));
                        }
                        else {
index a13eee4dfe3f11cac914b2bc8555d892e17fcba2..b89c430bf411b1bc4b0a5185e30c55970389c3c5 100644 (file)
@@ -463,16 +463,16 @@ class BBCodeParser extends SingletonFactory {
        protected function buildTag($string) {
                $tag = array('name' => '', 'closing' => false, 'source' => $string);
                
-               if (StringUtil::substring($string, 1, 1) == '/') {
+               if (mb_substr($string, 1, 1) == '/') {
                        // closing tag
-                       $tag['name'] = StringUtil::toLowerCase(StringUtil::substring($string, 2, StringUtil::length($string) - 3));
+                       $tag['name'] = mb_strtolower(mb_substr($string, 2, mb_strlen($string) - 3));
                        $tag['closing'] = true;
                }
                else {
                        // opening tag
                        // split tag and attributes
                        preg_match("!^\[([a-z0-9]+)=?(.*)]$!si", $string, $match);
-                       $tag['name'] = StringUtil::toLowerCase($match[1]);
+                       $tag['name'] = mb_strtolower($match[1]);
                        
                        // build attributes
                        if (!empty($match[2])) {
@@ -494,11 +494,11 @@ class BBCodeParser extends SingletonFactory {
                
                // remove quotes
                for ($i = 0, $j = count($matches[1]); $i < $j; $i++) {
-                       if (StringUtil::substring($matches[1][$i], 0, 1) == "'" && StringUtil::substring($matches[1][$i], -1) == "'") {
-                               $matches[1][$i] = StringUtil::replace("\'", "'", $matches[1][$i]);
-                               $matches[1][$i] = StringUtil::replace("\\\\", "\\", $matches[1][$i]);
+                       if (mb_substr($matches[1][$i], 0, 1) == "'" && mb_substr($matches[1][$i], -1) == "'") {
+                               $matches[1][$i] = str_replace("\'", "'", $matches[1][$i]);
+                               $matches[1][$i] = str_replace("\\\\", "\\", $matches[1][$i]);
                                
-                               $matches[1][$i] = StringUtil::substring($matches[1][$i], 1, -1);
+                               $matches[1][$i] = mb_substr($matches[1][$i], 1, -1);
                        }
                }
                
index fbeeb5d6a5ed64572ad0d7559bcbf22fea0db6b0..e50da55cff3bb2a6dc3da8da4cd8c7d04c1ab059 100644 (file)
@@ -52,9 +52,9 @@ class CodeBBCode extends AbstractBBCode {
                // fetch highlighter-classname
                $className = '\wcf\system\bbcode\highlighter\PlainHighlighter';
                if ($this->codeType) {
-                       $className = '\wcf\system\bbcode\highlighter\\'.StringUtil::firstCharToUpperCase(StringUtil::toLowerCase($this->codeType)).'Highlighter';
+                       $className = '\wcf\system\bbcode\highlighter\\'.StringUtil::firstCharToUpperCase(mb_strtolower($this->codeType)).'Highlighter';
                        
-                       switch (StringUtil::substring($className, strlen('\wcf\system\bbcode\highlighter\\'))) {
+                       switch (mb_substr($className, strlen('\wcf\system\bbcode\highlighter\\'))) {
                                case 'ShellHighlighter':
                                        $className = '\wcf\system\bbcode\highlighter\BashHighlighter';
                                break;
@@ -74,41 +74,41 @@ class CodeBBCode extends AbstractBBCode {
                }
                else {
                        // try to guess highlighter
-                       if (StringUtil::indexOf($content, '<?php') !== false) {
+                       if (mb_strpos($content, '<?php') !== false) {
                                $className = '\wcf\system\bbcode\highlighter\PhpHighlighter';
                        }
-                       else if (StringUtil::indexOf($content, '<html') !== false) {
+                       else if (mb_strpos($content, '<html') !== false) {
                                $className = '\wcf\system\bbcode\highlighter\HtmlHighlighter';
                        }
-                       else if (StringUtil::indexOf($content, '<?xml') === 0) {
+                       else if (mb_strpos($content, '<?xml') === 0) {
                                $className = '\wcf\system\bbcode\highlighter\XmlHighlighter';
                        }
-                       else if (       StringUtil::indexOf($content, 'SELECT') === 0
-                                       ||      StringUtil::indexOf($content, 'UPDATE') === 0
-                                       ||      StringUtil::indexOf($content, 'INSERT') === 0
-                                       ||      StringUtil::indexOf($content, 'DELETE') === 0) {
+                       else if (       mb_strpos($content, 'SELECT') === 0
+                                       ||      mb_strpos($content, 'UPDATE') === 0
+                                       ||      mb_strpos($content, 'INSERT') === 0
+                                       ||      mb_strpos($content, 'DELETE') === 0) {
                                $className = '\wcf\system\bbcode\highlighter\SqlHighlighter';
                        }
-                       else if (StringUtil::indexOf($content, 'import java.') !== false) {
+                       else if (mb_strpos($content, 'import java.') !== false) {
                                $className = '\wcf\system\bbcode\highlighter\JavaHighlighter';
                        }
-                       else if (       StringUtil::indexOf($content, "---") !== false
-                                       &&      StringUtil::indexOf($content, "\n+++") !== false) {
+                       else if (       mb_strpos($content, "---") !== false
+                                       &&      mb_strpos($content, "\n+++") !== false) {
                                $className = '\wcf\system\bbcode\highlighter\DiffHighlighter';
                        }
-                       else if (StringUtil::indexOf($content, "\n#include ") !== false) {
+                       else if (mb_strpos($content, "\n#include ") !== false) {
                                $className = '\wcf\system\bbcode\highlighter\CHighlighter';
                        }
-                       else if (StringUtil::indexOf($content, '#!/usr/bin/perl') === 0) {
+                       else if (mb_strpos($content, '#!/usr/bin/perl') === 0) {
                                $className = '\wcf\system\bbcode\highlighter\PerlHighlighter';
                        }
-                       else if (StringUtil::indexOf($content, 'def __init__(self') !== false) {
+                       else if (mb_strpos($content, 'def __init__(self') !== false) {
                                $className = '\wcf\system\bbcode\highlighter\PythonHighlighter';
                        }
                        else if (Regex::compile('^#!/bin/(ba|z)?sh')->match($content)) {
                                $className = '\wcf\system\bbcode\highlighter\BashHighlighter';
                        }
-                       else if (StringUtil::indexOf($content, '\\documentclass') !== false) {
+                       else if (mb_strpos($content, '\\documentclass') !== false) {
                                $className = '\wcf\system\bbcode\highlighter\TexHighlighter';
                        }
                        else if (Regex::compile('[-\\+\\.,\\[\\]\\>\\<]{9}')->match($content)) {
@@ -163,7 +163,7 @@ class CodeBBCode extends AbstractBBCode {
                                if (is_numeric($attributes[0])) {
                                        $this->startLineNumber = intval($attributes[0]);
                                }
-                               else if (StringUtil::indexOf($attributes[0], '.') === false) {
+                               else if (mb_strpos($attributes[0], '.') === false) {
                                        $this->codeType = $attributes[0];
                                }
                                else {
@@ -174,7 +174,7 @@ class CodeBBCode extends AbstractBBCode {
                        case 2:
                                if (is_numeric($attributes[0])) {
                                        $this->startLineNumber = intval($attributes[0]);
-                                       if (StringUtil::indexOf($attributes[1], '.') === false) {
+                                       if (mb_strpos($attributes[1], '.') === false) {
                                                $this->codeType = $attributes[1];
                                        }
                                        else {
@@ -214,7 +214,7 @@ class CodeBBCode extends AbstractBBCode {
                $i = -1;
                // find an unused codeID
                do {
-                       $codeID = StringUtil::substring(StringUtil::getHash($code), 0, 6).(++$i ? '_'.$i : '');
+                       $codeID = mb_substr(StringUtil::getHash($code), 0, 6).(++$i ? '_'.$i : '');
                }
                while (isset(self::$codeIDs[$codeID]));
                
index 590d59e71d192e92d4569a8ee57631ece8f26e27..7888fe116b7d03d52afb6e355b4fabebbf7f0ada 100644 (file)
@@ -105,9 +105,9 @@ class KeywordHighlighter extends SingletonFactory {
                // remove search operators
                $keywordString = preg_replace('/[\+\-><()~]+/', '', $keywordString);
                
-               if (StringUtil::substring($keywordString, 0, 1) == '"' && StringUtil::substring($keywordString, -1) == '"') {
+               if (mb_substr($keywordString, 0, 1) == '"' && mb_substr($keywordString, -1) == '"') {
                        // phrases search
-                       $keywordString = StringUtil::trim(StringUtil::substring($keywordString, 1, -1));
+                       $keywordString = StringUtil::trim(mb_substr($keywordString, 1, -1));
                        
                        if (!empty($keywordString)) {
                                $this->keywords = array_merge($this->keywords, array(StringUtil::encodeHTML($keywordString)));
@@ -134,7 +134,7 @@ class KeywordHighlighter extends SingletonFactory {
                if (empty($this->keywords)) return $text;
                
                $keywordPattern = '('.implode('|', $this->keywords).')';
-               $keywordPattern = StringUtil::replace('\*', '\w*', $keywordPattern);
+               $keywordPattern = str_replace('\*', '\w*', $keywordPattern);
                return preg_replace('+(?<!&|&\w{1}|&\w{2}|&\w{3}|&\w{4}|&\w{5}|&\w{6})'.$keywordPattern.'(?![^<]*>)+i', '<span class="highlight">\\1</span>', $text);
        }
 }
index 91f98e8d059ce83d9fe6d3fb837a8bc0df5b7ad3..e48e988ee3e77e190ffc6de101a557cc91d4fe80 100644 (file)
@@ -17,7 +17,7 @@ class ListBBCode extends AbstractBBCode {
         * @see wcf\system\bbcode\IBBCode::getParsedTag()
         */
        public function getParsedTag(array $openingTag, $content, array $closingTag, BBCodeParser $parser) {
-               if (StringUtil::indexOf($content, '[*]') !== false) {
+               if (mb_strpos($content, '[*]') !== false) {
                        // get list elements
                        $listElements = preg_split('/\[\*\]/', StringUtil::trim($content), -1, PREG_SPLIT_NO_EMPTY);
                        
index 6f3a6bc2da2728b2ec16d8a9bc8d38b7500ffbdc..85ed1424202eae822effa73f2520ff9c898be921 100644 (file)
@@ -96,7 +96,7 @@ class PreParser extends SingletonFactory {
         * Handles pre-parsing of email addresses.
         */
        protected function parseEmails() {
-               if (StringUtil::indexOf($this->text, '@') === false) return;
+               if (mb_strpos($this->text, '@') === false) return;
                
                static $emailPattern = null;
                if ($emailPattern === null) {
index 8c7f5abe8dd2c0e6a20bf64988fd6bb816d76f4d..8e7d721729ac7425f74529c1abcf9a6cefdb6a6b 100644 (file)
@@ -137,7 +137,7 @@ class SimpleMessageParser extends SingletonFactory {
                $text = preg_replace_callback($urlPattern, array($this, 'parseURLsCallback'), $text);
                
                // parse emails
-               if (StringUtil::indexOf($text, '@') !== false) {
+               if (mb_strpos($text, '@') !== false) {
                        $text = preg_replace($emailPattern, '<a href="mailto:\\0">\\0</a>', $text);
                }
                
index c6088e22b3e640f9f20add57539765a8de443c5a..73168bd7046e69c672bbdc561124861c6fe0f8d4 100644 (file)
@@ -46,13 +46,13 @@ class DiffHighlighter extends Highlighter {
        public function highlight($data) {
                $lines = explode("\n", $data);
                foreach ($lines as $key => $val) {
-                       if (in_array(StringUtil::substring($val, 0, 1), $this->info) || in_array($val, $this->splitter)) {
+                       if (in_array(mb_substr($val, 0, 1), $this->info) || in_array($val, $this->splitter)) {
                                $lines[$key] = '<span class="hlComments">'.StringUtil::encodeHTML($val).'</span>';
                        }
-                       else if (in_array(StringUtil::substring($val, 0, 1), $this->add)) {
+                       else if (in_array(mb_substr($val, 0, 1), $this->add)) {
                                $lines[$key] = '<span class="hlAdded">'.StringUtil::encodeHTML($val).'</span>';
                        }
-                       else if (in_array(StringUtil::substring($val, 0, 1), $this->delete)) {
+                       else if (in_array(mb_substr($val, 0, 1), $this->delete)) {
                                $lines[$key] = '<span class="hlRemoved">'.StringUtil::encodeHTML($val).'</span>';
                        }
                        else {
index cdedbc40a3e5839ef82a9f28b6a33f9014d9d03e..70274af54bd8d5f7b635c75a91838b7de86d5ff2 100644 (file)
@@ -36,7 +36,7 @@ class PhpHighlighter extends Highlighter {
        public function highlight($code) {
                // add starting php tag
                $phpTagsAdded = false;
-               if (StringUtil::indexOf($code, '<?') === false) {
+               if (mb_strpos($code, '<?') === false) {
                        $phpTagsAdded = true;
                        $code = '<?php '.$code.' ?>';
                }
index e7f2a0310b8f1ceb8a8ad898f527751d306e4193..78327fd82a7b55871a1bf07599fc27908ed361ab 100644 (file)
@@ -55,7 +55,7 @@ class Breadcrumb {
        public function setURL($url, $appendSession = false) {
                // append session id
                if ($appendSession) {
-                       if (StringUtil::indexOf($url, '?') === false) {
+                       if (mb_strpos($url, '?') === false) {
                                $url .= SID_ARG_1ST;
                        }
                        else {
index 5b13f19f52497b01898338c7a9768cee6406ec68..900b6b95743aca27523ad787dfd4fc1d3aad9471 100644 (file)
@@ -102,7 +102,7 @@ class CacheHandler extends SingletonFactory {
        protected function getCacheName(ICacheBuilder $cacheBuilder, array $parameters = array()) {
                $className = explode('\\', get_class($cacheBuilder));
                $application = array_shift($className);
-               $cacheName = StringUtil::replace('CacheBuilder', '', array_pop($className));
+               $cacheName = str_replace('CacheBuilder', '', array_pop($className));
                if (!empty($parameters)) {
                        $cacheName .= '-' . $this->getCacheIndex($parameters);
                }
index b371a92defc1a467f979252f6f135dac1c568878..c5b984526b576458761008e7b81c56796cbad0f2 100644 (file)
@@ -152,7 +152,7 @@ class DailyMailNotificationCronjob extends AbstractCronjob {
                        $token = $user->notificationMailToken;
                        if (!$token) {
                                // generate token if not present
-                               $token = StringUtil::substring(StringUtil::getHash(serialize(array($user->userID, StringUtil::getRandomID()))), 0, 20);
+                               $token = mb_substr(StringUtil::getHash(serialize(array($user->userID, StringUtil::getRandomID()))), 0, 20);
                                $editor = new UserEditor($user);
                                $editor->update(array('notificationMailToken' => $token));
                        }
index e13e0ab8801603c34cd6a943bf387461f017b1d8..60bc94bcf5af70c2f743278a81c1db7a19606b4a 100644 (file)
@@ -39,7 +39,7 @@ class RefreshSearchRobotsCronjob implements ICronjob {
                        
                        $statementParameters = array();
                        foreach ($spiders as $spider) {
-                               $identifier = StringUtil::toLowerCase($spider->getAttribute('ident'));
+                               $identifier = mb_strtolower($spider->getAttribute('ident'));
                                $name = $xpath->query('ns:name', $spider)->item(0);
                                $info = $xpath->query('ns:url', $spider)->item(0);
                                
index 94e6a1ff8ed7b906ce2635cd1eb7803cfca2a576..7a04847163cef04daa938e98da1d6e21c4bb9d4c 100644 (file)
@@ -85,7 +85,7 @@ class PreParserAtUserListener implements IEventListener {
                                $userList->readObjects();
                                $users = array();
                                foreach ($userList as $user) {
-                                       $users[StringUtil::toLowerCase($user->username)] = $user; 
+                                       $users[mb_strtolower($user->username)] = $user; 
                                }
                                
                                $text = $userRegex->replace($text, new Callback(function ($matches) use ($users) {
@@ -115,13 +115,13 @@ class PreParserAtUserListener implements IEventListener {
         */
        public static function getUsername($match) {
                // remove escaped single quotation mark
-               $match = StringUtil::replace("''", "'", $match);
+               $match = str_replace("''", "'", $match);
                
                // remove single quotation marks
                if ($match{0} == "'") {
-                       $match = StringUtil::substring($match, 1, -1);
+                       $match = mb_substr($match, 1, -1);
                }
                
-               return StringUtil::toLowerCase($match);
+               return mb_strtolower($match);
        }
 }
index 0a1b26087bccf9b7a7b0473534c6d17cd277ea2f..9036a5910d648621196e853caca41518260ba345 100644 (file)
@@ -31,7 +31,7 @@ class ValidateActionException extends \Exception {
         */
        public function __construct($fieldName, $errorMessage = 'empty', array $variables = array()) {
                $this->errorMessage = $errorMessage;
-               if (StringUtil::indexOf($this->errorMessage, '.') === false) {
+               if (mb_strpos($this->errorMessage, '.') === false) {
                        $this->errorMessage = WCF::getLanguage()->get('wcf.global.form.error.'.$this->errorMessage);
                }
                else {
index bd1f6d41ae088d1bdba4b2cd748cb419b5256508..b45052ca97880366b18fcff2de40677838a15a47 100644 (file)
@@ -109,8 +109,8 @@ class FormDocument {
                $variables = array();
                
                foreach ($_REQUEST as $key => $value) {
-                       if (StringUtil::indexOf($key, $this->getName().'_') !== false) {
-                               $key = StringUtil::replace($this->getName().'_', '', $key);
+                       if (mb_strpos($key, $this->getName().'_') !== false) {
+                               $key = str_replace($this->getName().'_', '', $key);
                                $variables[$key] = $value;
                        }
                }
index cfd029c02e200723bfaeb2d3b9e800f6535513aa..73da7ada203d4b552307f8e9caa1100df5d71a82 100644 (file)
@@ -44,7 +44,7 @@ class SmileyImporter extends AbstractImporter {
                        $known[] = $row['smileyCode'];
                                
                        foreach ($known as $smileyCode) {
-                               $this->knownCodes[StringUtil::toLowerCase($smileyCode)] = $row['smileyID'];
+                               $this->knownCodes[mb_strtolower($smileyCode)] = $row['smileyID'];
                        }
                }
        }
@@ -58,7 +58,7 @@ class SmileyImporter extends AbstractImporter {
                if (!@copy($additionalData['fileLocation'], WCF_DIR.$data['smileyPath'])) return 0;
                
                // check smileycode
-               if (isset($this->knownCodes[StringUtil::toLowerCase($data['smileyCode'])])) return $this->knownCodes[StringUtil::toLowerCase($data['smileyCode'])];
+               if (isset($this->knownCodes[mb_strtolower($data['smileyCode'])])) return $this->knownCodes[mb_strtolower($data['smileyCode'])];
                
                $data['packageID'] = 1;
                if (!isset($data['aliases'])) $data['aliases'] = '';
@@ -68,7 +68,7 @@ class SmileyImporter extends AbstractImporter {
                if (!empty($data['aliases'])) {
                        $aliases = explode("\n", StringUtil::unifyNewlines($data['aliases']));
                        foreach ($aliases as $key => $alias) {
-                               if (isset($this->knownCodes[StringUtil::toLowerCase($alias)])) unset($aliases[$key]);
+                               if (isset($this->knownCodes[mb_strtolower($alias)])) unset($aliases[$key]);
                        }
                        $data['aliases'] = implode("\n", $aliases);
                }
@@ -77,9 +77,9 @@ class SmileyImporter extends AbstractImporter {
                $smiley = SmileyEditor::create($data);
                
                // add smileyCode + aliases to knownCodes
-               $this->knownCodes[StringUtil::toLowerCase($data['smileyCode'])] = $smiley->smileyID;
+               $this->knownCodes[mb_strtolower($data['smileyCode'])] = $smiley->smileyID;
                foreach ($aliases as $alias) {
-                       $this->knownCodes[StringUtil::toLowerCase($alias)] = $smiley->smileyID;
+                       $this->knownCodes[mb_strtolower($alias)] = $smiley->smileyID;
                }
                
                return $smiley->smileyID;
index 2e623eab6942e4406471b8ffc9a2224b245e45db..714860cb54b159cc1cd7ec1dc10f6374c25e4ab4 100644 (file)
@@ -56,7 +56,7 @@ class UserImporter extends AbstractImporter {
                // resolve duplicates
                $existingUser = User::getUserByUsername($data['username']);
                if ($existingUser->userID) {
-                       if (ImportHandler::getInstance()->getUserMergeMode() == 1 || (ImportHandler::getInstance()->getUserMergeMode() == 3 && StringUtil::toLowerCase($existingUser->email) != StringUtil::toLowerCase($data['email']))) {
+                       if (ImportHandler::getInstance()->getUserMergeMode() == 1 || (ImportHandler::getInstance()->getUserMergeMode() == 3 && mb_strtolower($existingUser->email) != mb_strtolower($data['email']))) {
                                // rename user
                                $data['username'] = self::resolveDuplicate($data['username']);
                        }
index 9234b40b69c3c5fc79bd93460b025ac4aaea8d0a..9cc69da1938c70b2148d741627ff7cf7bbc92662 100644 (file)
@@ -27,7 +27,7 @@ class ZipWriter {
         */
        public function addDir($name, $date = TIME_NOW) {
                // replace backward slashes with forward slashes in the dirname
-               $name = StringUtil::replace("\\", "/", $name);
+               $name = str_replace("\\", "/", $name);
                $name = FileUtil::addTrailingSlash($name);
                
                // construct the general header information for the directory
@@ -87,7 +87,7 @@ class ZipWriter {
         */
        public function addFile($data, $name, $date = TIME_NOW) {               
                // replace backward slashes with forward slashes in the filename
-               $name = StringUtil::replace("\\", "/", $name);
+               $name = str_replace("\\", "/", $name);
                
                // calculate the size of the file being uncompressed
                $sizeUncompressed = strlen($data);
index 1f7ccb4dc3f66c39457e3623322f2c8e87cf696e..3c6e2a6885b7042818c847c294dd7380501ede92 100644 (file)
@@ -44,7 +44,7 @@ class Censorship extends SingletonFactory {
         */
        protected function init() {
                // get words which should be censored
-               $censoredWords = explode("\n", StringUtil::unifyNewlines(StringUtil::toLowerCase(CENSORED_WORDS)));
+               $censoredWords = explode("\n", StringUtil::unifyNewlines(mb_strtolower(CENSORED_WORDS)));
                
                // format censored words
                $this->censoredWords = ArrayUtil::trim($censoredWords);
@@ -61,7 +61,7 @@ class Censorship extends SingletonFactory {
                $this->matches = $this->words = array();
                
                // string to lower case
-               $text = StringUtil::toLowerCase($text);
+               $text = mb_strtolower($text);
                
                // ignore bbcode tags
                $text = preg_replace('~\[/?[a-z]+[^\]]*\]~i', '', $text);
@@ -86,8 +86,8 @@ class Censorship extends SingletonFactory {
                                        continue 2;
                                }
                                // check for asterisk matches ("*badword*" == "FooBadwordBar")
-                               else if (StringUtil::indexOf($censoredWord, '*') !== false) {
-                                       $censoredWord = StringUtil::replace('\*', '.*', preg_quote($censoredWord));
+                               else if (mb_strpos($censoredWord, '*') !== false) {
+                                       $censoredWord = str_replace('\*', '.*', preg_quote($censoredWord));
                                        if (preg_match('!^'.$censoredWord.'$!', $word)) {
                                                // store censored word
                                                if (isset($this->matches[$word])) {
@@ -101,19 +101,19 @@ class Censorship extends SingletonFactory {
                                        }
                                }
                                // check for partial matches ("~badword~" == "bad-word")
-                               else if (StringUtil::indexOf($censoredWord, '~') !== false) {
-                                       $censoredWord = StringUtil::replace('~', '', $censoredWord);
-                                       if (($position = StringUtil::indexOf($censoredWord, $word)) !== false) {
+                               else if (mb_strpos($censoredWord, '~') !== false) {
+                                       $censoredWord = str_replace('~', '', $censoredWord);
+                                       if (($position = mb_strpos($censoredWord, $word)) !== false) {
                                                if ($position > 0) {
                                                        // look behind
-                                                       if (!$this->lookBehind($i - 1, StringUtil::substring($censoredWord, 0, $position))) {
+                                                       if (!$this->lookBehind($i - 1, mb_substr($censoredWord, 0, $position))) {
                                                                continue;
                                                        }
                                                }
                                                
-                                               if ($position + StringUtil::length($word) < StringUtil::length($censoredWord)) {
+                                               if ($position + mb_strlen($word) < mb_strlen($censoredWord)) {
                                                        // look ahead
-                                                       if (($newIndex = $this->lookAhead($i + 1, StringUtil::substring($censoredWord, $position + StringUtil::length($word))))) {
+                                                       if (($newIndex = $this->lookAhead($i + 1, mb_substr($censoredWord, $position + mb_strlen($word))))) {
                                                                $i = $newIndex;
                                                        }
                                                        else {
@@ -154,11 +154,11 @@ class Censorship extends SingletonFactory {
         */
        protected function lookBehind($index, $search) {
                if (isset($this->words[$index])) {
-                       if (StringUtil::indexOf($this->words[$index], $search) === (StringUtil::length($this->words[$index]) - StringUtil::length($search))) {
+                       if (mb_strpos($this->words[$index], $search) === (mb_strlen($this->words[$index]) - mb_strlen($search))) {
                                return true;
                        }
-                       else if (StringUtil::indexOf($search, $this->words[$index]) === (StringUtil::length($search) - StringUtil::length($this->words[$index]))) {
-                               return $this->lookBehind($index - 1, 0, (StringUtil::length($search) - StringUtil::length($this->words[$index])));
+                       else if (mb_strpos($search, $this->words[$index]) === (mb_strlen($search) - mb_strlen($this->words[$index]))) {
+                               return $this->lookBehind($index - 1, 0, (mb_strlen($search) - mb_strlen($this->words[$index])));
                        }
                }
                
@@ -174,11 +174,11 @@ class Censorship extends SingletonFactory {
         */
        protected function lookAhead($index, $search) {
                if (isset($this->words[$index])) {
-                       if (StringUtil::indexOf($this->words[$index], $search) === 0) {
+                       if (mb_strpos($this->words[$index], $search) === 0) {
                                return $index;
                        }
-                       else if (StringUtil::indexOf($search, $this->words[$index]) === 0) {
-                               return $this->lookAhead($index + 1, StringUtil::substring($search, StringUtil::length($this->words[$index])));
+                       else if (mb_strpos($search, $this->words[$index]) === 0) {
+                               return $this->lookAhead($index + 1, mb_substr($search, mb_strlen($this->words[$index])));
                        }
                }
                
index 7b914c100125a7c342336c3a6fdc6c6643457493..3fe265b8e6dac5cecdf00f718790356f07eaca96 100644 (file)
@@ -386,8 +386,8 @@ class MessageQuoteManager extends SingletonFactory {
         * @return      string
         */
        public function renderQuote(IMessage $message, $text) {
-               $escapedUsername = StringUtil::replace(array("\\", "'"), array("\\\\", "\'"), $message->getUsername());
-               $escapedLink = StringUtil::replace(array("\\", "'"), array("\\\\", "\'"), $message->getLink());
+               $escapedUsername = str_replace(array("\\", "'"), array("\\\\", "\'"), $message->getUsername());
+               $escapedLink = str_replace(array("\\", "'"), array("\\\\", "\'"), $message->getLink());
                
                return "[quote='".$escapedUsername."','".$escapedLink."']".$text."[/quote]";
        }
index 6fb1091742dade3ff394d1889e61e36ebf1d8257..955f5203840707ed0cd70b7ef1e07d60093737cb 100644 (file)
@@ -25,14 +25,14 @@ class FileSizeOptionType extends TextOptionType {
         * @see wcf\system\option\IOptionType::getData()
         */
        public function getData(Option $option, $newValue) {
-               $number = StringUtil::replace(WCF::getLanguage()->get('wcf.global.thousandsSeparator'), '', $newValue);
-               $number = StringUtil::replace(WCF::getLanguage()->get('wcf.global.decimalPoint'), '.', $number);
+               $number = str_replace(WCF::getLanguage()->get('wcf.global.thousandsSeparator'), '', $newValue);
+               $number = str_replace(WCF::getLanguage()->get('wcf.global.decimalPoint'), '.', $number);
                
                if (!preg_match('~^(?:\d*)\.?\d+~', $number, $matches)) return 0;
                
                $number = $matches[0];
                if (preg_match('/[kmgt]i?b$/i', $newValue, $multiplier)) {
-                       switch (StringUtil::toLowerCase($multiplier[0])) {
+                       switch (mb_strtolower($multiplier[0])) {
                                case 'tb':
                                        $number *= 1000;
                                case 'gb':
index c032479597d4d5adb3da53742c487eb9c91db006..15831d752f1a1d7a88264752fe1f361276bab7f2 100644 (file)
@@ -57,7 +57,7 @@ class SelectOptionType extends RadioButtonOptionType {
                                foreach ($optionData as $item) {
                                        if ($item{0} == '!') {
                                                if (!empty($disableOptions)) $disableOptions .= ',';
-                                               $disableOptions .= "{ value: '".$key."', option: '".StringUtil::substring($item, 1)."' }";
+                                               $disableOptions .= "{ value: '".$key."', option: '".mb_substr($item, 1)."' }";
                                        }
                                        else {
                                                if (!empty($enableOptions)) $enableOptions .= ',';
index bde1553f63c2003d13128d2a69439fe01c20ba62..bf33f79cd700733a2bfe5186d75c9b5e04b27470 100644 (file)
@@ -66,10 +66,10 @@ class TextOptionType extends AbstractOptionType implements ISearchableUserOption
        public function validate(Option $option, $newValue) {
                $newValue = $this->getContent($option, $newValue);
                
-               if ($option->minlength !== null && $option->minlength > StringUtil::length($newValue)) {
+               if ($option->minlength !== null && $option->minlength > mb_strlen($newValue)) {
                        throw new UserInputException($option->optionName, 'tooShort');
                }
-               if ($option->maxlength !== null && $option->maxlength < StringUtil::length($newValue)) {
+               if ($option->maxlength !== null && $option->maxlength < mb_strlen($newValue)) {
                        throw new UserInputException($option->optionName, 'tooLong');
                }
        }
index f12bacfdf54b267b303b22686c55c00845364cd8..aeb931e1b6e3495b2020f38201981d5d66bdc32a 100644 (file)
@@ -50,7 +50,7 @@ class SelectOptionsUserOptionOutput implements IUserOptionOutput {
                $options = OptionUtil::parseSelectOptions($option->selectOptions);
                
                // multiselect
-               if (StringUtil::indexOf($value, "\n") !== false) {
+               if (mb_strpos($value, "\n") !== false) {
                        $values = explode("\n", $value);
                        $result = array();
                        foreach ($values as $value) {
index 85fda377b1364348ce401cc29c780e4308c69f5b..4fcb2cea52aed01eb8758a241b99ea7bf928010a 100644 (file)
@@ -353,7 +353,7 @@ class PackageInstallationDispatcher {
                        $this->package = null;
                        
                        if ($package->isApplication) {
-                               $host = StringUtil::replace(RouteHandler::getProtocol(), '', RouteHandler::getHost());
+                               $host = str_replace(RouteHandler::getProtocol(), '', RouteHandler::getHost());
                                $path = RouteHandler::getPath(array('acp'));
                                
                                // insert as application
@@ -663,7 +663,7 @@ class PackageInstallationDispatcher {
                        $packageDir->setName('packageDir');
                        $packageDir->setLabel(WCF::getLanguage()->get('wcf.acp.package.packageDir.input'));
                        
-                       $defaultPath = FileUtil::addTrailingSlash(FileUtil::unifyDirSeparator(StringUtil::substring(WCF_DIR, 0, -4)));
+                       $defaultPath = FileUtil::addTrailingSlash(FileUtil::unifyDirSeparator(mb_substr(WCF_DIR, 0, -4)));
                        // check if there is already an application
                        $sql = "SELECT  COUNT(*) AS count
                                FROM    wcf".WCF_N."_package
@@ -960,7 +960,7 @@ class PackageInstallationDispatcher {
                // validate functions
                if (isset($requirements['functions'])) {
                        foreach ($requirements['functions'] as $function) {
-                               $function = StringUtil::toLowerCase($function);
+                               $function = mb_strtolower($function);
                                
                                $passed = self::functionExists($function);
                                if (!$passed) {
@@ -1010,7 +1010,7 @@ class PackageInstallationDispatcher {
                        if (!empty($blacklist)) {
                                $blacklist = explode(',', $blacklist);
                                foreach ($blacklist as $disabledFunction) {
-                                       $disabledFunction = StringUtil::toLowerCase(StringUtil::trim($disabledFunction));
+                                       $disabledFunction = mb_strtolower(StringUtil::trim($disabledFunction));
                                        
                                        if ($function == $disabledFunction) {
                                                return false;
@@ -1033,7 +1033,7 @@ class PackageInstallationDispatcher {
        protected static function compareSetting($setting, $value, $compareValue) {
                if ($compareValue === false) return false;
                
-               $value = StringUtil::toLowerCase($value);
+               $value = mb_strtolower($value);
                $trueValues = array('1', 'on', 'true');
                $falseValues = array('0', 'off', 'false');
                
@@ -1062,7 +1062,7 @@ class PackageInstallationDispatcher {
         */
        protected static function convertShorthandByteValue($value) {
                // convert into bytes
-               $lastCharacter = StringUtil::substring($value, -1);
+               $lastCharacter = mb_substr($value, -1);
                switch ($lastCharacter) {
                        // gigabytes
                        case 'g':
index 544538d11640bfcfc4fa34a4223fa2a4c30f6ed5..3bc44183d99b1c8c1eebc6a3960e34fd8f907b5e 100644 (file)
@@ -669,7 +669,7 @@ class PackageInstallationNodeBuilder {
         * @return      string
         */
        protected function getToken() {
-               return StringUtil::substring(StringUtil::getRandomID(), 0, 8);
+               return mb_substr(StringUtil::getRandomID(), 0, 8);
        }
        
        /**
index 1604cf46fba30afc77ce6a6bc97d0a97dc7ab654..4a992471b533b58a411bbdf88dd15e0fcbd04111 100644 (file)
@@ -45,7 +45,7 @@ class SQLPackageInstallationPlugin extends AbstractPackageInstallationPlugin {
                        foreach ($packageList as $package) {
                                $abbreviation = Package::getAbbreviation($package->package);
                                
-                               $queries = StringUtil::replace($abbreviation.'1_', $abbreviation.WCF_N.'_', $queries);
+                               $queries = str_replace($abbreviation.'1_', $abbreviation.WCF_N.'_', $queries);
                        }
                        
                        // check queries
index f17ada2a45f805d2db285070e3d69d123d082f16..f082e0c75e7bd94975b72dafc0ed8276797b8275 100644 (file)
@@ -138,7 +138,7 @@ class LinkHandler extends SingletonFactory {
                
                // encode certain characters
                if (!empty($url)) {
-                       $url = StringUtil::replace(array('[', ']'), array('%5B', '%5D'), $url);
+                       $url = str_replace(array('[', ']'), array('%5B', '%5D'), $url);
                }
                
                $url = $routeURL . $url;
index a291d68d286745fe9f4e60d0076dc959f607c552..8b02c99c736144044664cd6389d9a6891c431cbc 100644 (file)
@@ -109,7 +109,7 @@ class RequestHandler extends SingletonFactory {
                                if ($landingPage !== null && RouteHandler::getInstance()->isDefaultController()) {
                                        // check if redirect URL matches current URL
                                        $redirectURL = $landingPage->getLink();
-                                       $relativeRoute = StringUtil::replace(RouteHandler::getHost(), '', $redirectURL);
+                                       $relativeRoute = str_replace(RouteHandler::getHost(), '', $redirectURL);
                                        
                                        if ($relativeRoute == preg_replace('~index.php$~i', '', $_SERVER['REQUEST_URI']) || $relativeRoute == preg_replace('~([?&]s=[a-f0-9]{40})~', '', $_SERVER['REQUEST_URI'])) {
                                                $routeData['controller'] = $landingPage->getController();
index 1ac8d7880142f24ed9243cee6aebef3932a443bb..321b60801e8202f997c2426755b6a61db2f74a1b 100644 (file)
@@ -82,7 +82,7 @@ class SearchEngine extends SingletonFactory {
                        $tmp = '';
                        $controlCharacterOrSpace = false;
                        $chars = array('+', '-', '*');
-                       for ($i = 0, $length = StringUtil::length($q); $i < $length; $i++) {
+                       for ($i = 0, $length = mb_strlen($q); $i < $length; $i++) {
                                $char = $q[$i];
                                
                                if ($inQuotes) {
@@ -125,7 +125,7 @@ class SearchEngine extends SingletonFactory {
                                
                                case 'wcf\system\database\PostgreSQLDatabase':
                                        // replace * with :*
-                                       $q = StringUtil::replace('*', ':*', $q);
+                                       $q = str_replace('*', ':*', $q);
                                        
                                        $fulltextCondition->add("fulltextIndex".($subjectOnly ? "SubjectOnly" : '')." @@ to_tsquery(?)", array($q));
                                break;
index 5fe7ea727fab35987d3e58fb4f9a6bbe8756f379..f58acdb68ba4a6364a1f8e581112b57479f2a0f3 100644 (file)
@@ -39,9 +39,9 @@ class SearchResultTextParser extends SingletonFactory {
                        // remove search operators
                        $keywordString = preg_replace('/[\+\-><()~\*]+/', '', $keywordString);
                        
-                       if (StringUtil::substring($keywordString, 0, 1) == '"' && StringUtil::substring($keywordString, -1) == '"') {
+                       if (mb_substr($keywordString, 0, 1) == '"' && mb_substr($keywordString, -1) == '"') {
                                // phrases search
-                               $keywordString = StringUtil::trim(StringUtil::substring($keywordString, 1, -1));
+                               $keywordString = StringUtil::trim(mb_substr($keywordString, 1, -1));
                                
                                if (!empty($keywordString)) {
                                        $this->searchQuery = $keywordString;
@@ -70,14 +70,14 @@ class SearchResultTextParser extends SingletonFactory {
                // replace newlines with spaces
                $text = Regex::compile("\s+")->replace($text, ' ');
                
-               if (StringUtil::length($text) > static::MAX_LENGTH) {
+               if (mb_strlen($text) > static::MAX_LENGTH) {
                        if ($this->searchQuery) {
                                // phrase search
                                if (!is_array($this->searchQuery)) {
-                                       $start = StringUtil::indexOfIgnoreCase($text, $this->searchQuery);
+                                       $start = mb_strripos($text, $this->searchQuery);
                                        if ($start !== false) {
-                                               $end = $start + StringUtil::length($this->searchQuery);
-                                               $shiftStartBy = $shiftEndBy = round((static::MAX_LENGTH - StringUtil::length($this->searchQuery)) / 2);
+                                               $end = $start + mb_strlen($this->searchQuery);
+                                               $shiftStartBy = $shiftEndBy = round((static::MAX_LENGTH - mb_strlen($this->searchQuery)) / 2);
                                                
                                                // shiftStartBy is negative when search query length is over max length
                                                if ($shiftStartBy < 0) {
@@ -95,8 +95,8 @@ class SearchResultTextParser extends SingletonFactory {
                                                }
                                                
                                                // shift abstract end
-                                               if ($end + $shiftEndBy > StringUtil::length($text) - 1) {
-                                                       $shiftStartBy = $end + $shiftEndBy - StringUtil::length($text) - 1;
+                                               if ($end + $shiftEndBy > mb_strlen($text) - 1) {
+                                                       $shiftStartBy = $end + $shiftEndBy - mb_strlen($text) - 1;
                                                        $shiftEndBy = 0;
                                                        if ($shiftStartBy > $start) {
                                                                $start = 0;
@@ -111,8 +111,8 @@ class SearchResultTextParser extends SingletonFactory {
                                                
                                                $newText = '';
                                                if ($start > 0) $newText .= StringUtil::HELLIP;
-                                               $newText .= StringUtil::substring($text, $start, $end - $start);
-                                               if ($end < StringUtil::length($text) - 1) $newText .= StringUtil::HELLIP;
+                                               $newText .= mb_substr($text, $start, $end - $start);
+                                               if ($end < mb_strlen($text) - 1) $newText .= StringUtil::HELLIP;
                                                return $newText;
                                        }
                                }
@@ -121,10 +121,10 @@ class SearchResultTextParser extends SingletonFactory {
                                        $shiftLength = static::MAX_LENGTH;
                                        // find first match of each keyword
                                        foreach ($this->searchQuery as $keyword) {
-                                               $start = StringUtil::indexOfIgnoreCase($text, $keyword);
+                                               $start = mb_strripos($text, $keyword);
                                                if ($start !== false) {
-                                                       $shiftLength -= StringUtil::length($keyword);
-                                                       $matches[$keyword] = array('start' => $start, 'end' => $start + StringUtil::length($keyword));
+                                                       $shiftLength -= mb_strlen($keyword);
+                                                       $matches[$keyword] = array('start' => $start, 'end' => $start + mb_strlen($keyword));
                                                }
                                        }
                                        
@@ -137,7 +137,7 @@ class SearchResultTextParser extends SingletonFactory {
                                        }
                                        
                                        $start = 0;
-                                       $end = StringUtil::length($text) - 1;
+                                       $end = mb_strlen($text) - 1;
                                        $newText = '';
                                        $i = 0;
                                        $length = count($matches);
@@ -161,7 +161,7 @@ class SearchResultTextParser extends SingletonFactory {
                                                }
                                                
                                                if ($position['start'] > $start) $newText .= StringUtil::HELLIP;
-                                               $newText .= StringUtil::substring($text, $position['start'], $position['end'] - $position['start']);
+                                               $newText .= mb_substr($text, $position['start'], $position['end'] - $position['start']);
                                                if ($i == $length - 1 && $position['end'] < $end) $newText .= StringUtil::HELLIP;
                                                
                                                $start = $position['end'];
@@ -173,7 +173,7 @@ class SearchResultTextParser extends SingletonFactory {
                        }
                        
                        // no search query or no matches
-                       return StringUtil::substring($text, 0, static::MAX_LENGTH) . StringUtil::HELLIP;
+                       return mb_substr($text, 0, static::MAX_LENGTH) . StringUtil::HELLIP;
                }
                
                return $text;
index 70ebd36834d4914a9fb68fd10a6ae765cf24a1a6..55face2bcae8a7c49563bb0fbf391337cb27e2c8 100644 (file)
@@ -126,9 +126,9 @@ class Installer {
                $directories = array();
                $files = array();
                foreach ($tar->getContentList() as $index => $file) {
-                       if (empty($this->folder) || StringUtil::indexOf($file['filename'], $this->folder) === 0) {
+                       if (empty($this->folder) || mb_strpos($file['filename'], $this->folder) === 0) {
                                if (!empty($this->folder)) {
-                                       $file['filename'] = StringUtil::replace($this->folder, '', $file['filename']);
+                                       $file['filename'] = str_replace($this->folder, '', $file['filename']);
                                }
                                
                                // remove leading slash
index 21d56d7a1dd6ed71e17aa9e3d82b93a6e82a95d5..ee6a755a1adcb5aaa42fcff8ac00eb149880ce88 100644 (file)
@@ -53,8 +53,8 @@ class TagEngine extends SingletonFactory {
                        if (empty($tag)) continue;
                        
                        // enforce max length
-                       if (StringUtil::length($tag) > TAGGING_MAX_TAG_LENGTH) {
-                               $tag = StringUtil::substring($tag, 0, TAGGING_MAX_TAG_LENGTH);
+                       if (mb_strlen($tag) > TAGGING_MAX_TAG_LENGTH) {
+                               $tag = mb_substr($tag, 0, TAGGING_MAX_TAG_LENGTH);
                        }
                        
                        // find existing tag
index 611125bb86166dbe55cb39dcb975851742580e6e..a0c9353fce9de4da69d147d96252f56a0c4656ba 100755 (executable)
@@ -497,7 +497,7 @@ class TemplateEngine extends SingletonFactory {
         * @return      string
         */
        public function getPluginClassName($type, $tag) {
-               return $this->pluginNamespace.StringUtil::firstCharToUpperCase($tag).StringUtil::firstCharToUpperCase(StringUtil::toLowerCase($type)).'TemplatePlugin';
+               return $this->pluginNamespace.StringUtil::firstCharToUpperCase($tag).StringUtil::firstCharToUpperCase(mb_strtolower($type)).'TemplatePlugin';
        }
        
        /**
index c4dbc5efd9c83327f7c9088a56c87c62272db5f3..4337db01c5d4fd95a6a52e03204085840b1361c8 100644 (file)
@@ -241,9 +241,9 @@ class TemplateScriptingCompiler {
                // compile the template tags into php-code
                $compiledTags = array();
                for ($i = 0, $j = count($templateTags); $i < $j; $i++) {
-                       $this->currentLineNo += StringUtil::countSubstring($textBlocks[$i], "\n");
+                       $this->currentLineNo += mb_substr_count($textBlocks[$i], "\n");
                        $compiledTags[] = $this->compileTag($templateTags[$i], $identifier, $metaData);
-                       $this->currentLineNo += StringUtil::countSubstring($templateTags[$i], "\n");
+                       $this->currentLineNo += mb_substr_count($templateTags[$i], "\n");
                }
                
                // throw error messages for unclosed tags
@@ -319,7 +319,7 @@ class TemplateScriptingCompiler {
                if (preg_match('~^(/?\w+)~', $tag, $match)) {
                        // build in function or plugin
                        $tagCommand = $match[1];
-                       $tagArgs = StringUtil::substring($tag, StringUtil::length($tagCommand));
+                       $tagArgs = mb_substr($tag, mb_strlen($tagCommand));
                        
                        switch ($tagCommand) {
                                case 'if':
@@ -688,10 +688,10 @@ class TemplateScriptingCompiler {
                $phpCode .= "if (count(".$args['from'].") > 0) {\n";
                
                if (isset($args['key'])) {
-                       $phpCode .= "foreach (".$args['from']." as ".(StringUtil::substring($args['key'], 0, 1) != '$' ? "\$this->v[".$args['key']."]" : $args['key'])." => ".(StringUtil::substring($args['item'], 0, 1) != '$' ? "\$this->v[".$args['item']."]" : $args['item']).") {\n";
+                       $phpCode .= "foreach (".$args['from']." as ".(mb_substr($args['key'], 0, 1) != '$' ? "\$this->v[".$args['key']."]" : $args['key'])." => ".(mb_substr($args['item'], 0, 1) != '$' ? "\$this->v[".$args['item']."]" : $args['item']).") {\n";
                }
                else {
-                       $phpCode .= "foreach (".$args['from']." as ".(StringUtil::substring($args['item'], 0, 1) != '$' ? "\$this->v[".$args['item']."]" : $args['item']).") {\n";
+                       $phpCode .= "foreach (".$args['from']." as ".(mb_substr($args['item'], 0, 1) != '$' ? "\$this->v[".$args['item']."]" : $args['item']).") {\n";
                }
                
                if (!empty($foreachProp)) {
@@ -853,13 +853,13 @@ class TemplateScriptingCompiler {
                        
                        // reinserts strings
                        foreach (StringStack::getStack('singleQuote') as $hash => $value) {
-                               if (StringUtil::indexOf($string, $hash) !== false) {
-                                       $string = StringUtil::replace($hash, $value, $string);
+                               if (mb_strpos($string, $hash) !== false) {
+                                       $string = str_replace($hash, $value, $string);
                                }
                        }
                        foreach (StringStack::getStack('doubleQuote') as $hash => $value) {
-                               if (StringUtil::indexOf($string, $hash) !== false) {
-                                       $string = StringUtil::replace($hash, $value, $string);
+                               if (mb_strpos($string, $hash) !== false) {
+                                       $string = str_replace($hash, $value, $string);
                                }
                        }
                        
@@ -934,22 +934,22 @@ class TemplateScriptingCompiler {
                                throw new SystemException($this->formatSyntaxError('syntax error in tag {'.($elseif ? 'elseif' : 'if').'}', $this->currentIdentifier, $this->currentLineNo));
                        }
                        
-                       $leftParenthesis = StringUtil::countSubstring($values[$i], '(');
-                       $rightParenthesis = StringUtil::countSubstring($values[$i], ')');
+                       $leftParenthesis = mb_substr_count($values[$i], '(');
+                       $rightParenthesis = mb_substr_count($values[$i], ')');
                        if ($leftParenthesis > $rightParenthesis) {
                                $leftParentheses += $leftParenthesis - $rightParenthesis;
-                               $value = StringUtil::substring($values[$i], $leftParenthesis - $rightParenthesis);
+                               $value = mb_substr($values[$i], $leftParenthesis - $rightParenthesis);
                                $result .= str_repeat('(', $leftParenthesis - $rightParenthesis);
                                
-                               if (str_replace('(', '', StringUtil::substring($values[$i], 0, $leftParenthesis - $rightParenthesis)) != '') {
+                               if (str_replace('(', '', mb_substr($values[$i], 0, $leftParenthesis - $rightParenthesis)) != '') {
                                        throw new SystemException($this->formatSyntaxError('syntax error in tag {'.($elseif ? 'elseif' : 'if').'}', $this->currentIdentifier, $this->currentLineNo));
                                }
                        }
                        else if ($leftParenthesis < $rightParenthesis) {
                                $leftParentheses += $leftParenthesis - $rightParenthesis;
-                               $value = StringUtil::substring($values[$i], 0, $leftParenthesis - $rightParenthesis);
+                               $value = mb_substr($values[$i], 0, $leftParenthesis - $rightParenthesis);
                                
-                               if ($leftParentheses < 0 || str_replace(')', '', StringUtil::substring($values[$i], $leftParenthesis - $rightParenthesis)) != '') {
+                               if ($leftParentheses < 0 || str_replace(')', '', mb_substr($values[$i], $leftParenthesis - $rightParenthesis)) != '') {
                                        throw new SystemException($this->formatSyntaxError('syntax error in tag {'.($elseif ? 'elseif' : 'if').'}', $this->currentIdentifier, $this->currentLineNo));
                                }
                        }
@@ -1013,10 +1013,10 @@ class TemplateScriptingCompiler {
                $encodeHTML = false;
                $formatNumeric = false;
                if ($tag[0] == '@') {
-                       $tag = StringUtil::substring($tag, 1);
+                       $tag = mb_substr($tag, 1);
                }
                else if ($tag[0] == '#') {
-                       $tag = StringUtil::substring($tag, 1);
+                       $tag = mb_substr($tag, 1);
                        $formatNumeric = true;
                }
                else {
@@ -1570,13 +1570,13 @@ class TemplateScriptingCompiler {
         * @return      string
         */
        public function replacePHPTags($string) {
-               if (StringUtil::indexOf($string, '<?') !== false) {
-                       $string = StringUtil::replace('<?php', '@@PHP_START_TAG@@', $string);
-                       $string = StringUtil::replace('<?', '@@PHP_SHORT_START_TAG@@', $string);
-                       $string = StringUtil::replace('?>', '@@PHP_END_TAG@@', $string);
-                       $string = StringUtil::replace('@@PHP_END_TAG@@', "<?php echo '?>'; ?>\n", $string);
-                       $string = StringUtil::replace('@@PHP_SHORT_START_TAG@@', "<?php echo '<?'; ?>\n", $string);
-                       $string = StringUtil::replace('@@PHP_START_TAG@@', "<?php echo '<?php'; ?>\n", $string);
+               if (mb_strpos($string, '<?') !== false) {
+                       $string = str_replace('<?php', '@@PHP_START_TAG@@', $string);
+                       $string = str_replace('<?', '@@PHP_SHORT_START_TAG@@', $string);
+                       $string = str_replace('?>', '@@PHP_END_TAG@@', $string);
+                       $string = str_replace('@@PHP_END_TAG@@', "<?php echo '?>'; ?>\n", $string);
+                       $string = str_replace('@@PHP_SHORT_START_TAG@@', "<?php echo '<?'; ?>\n", $string);
+                       $string = str_replace('@@PHP_START_TAG@@', "<?php echo '<?php'; ?>\n", $string);
                }
                
                return $string;
index 357ece78b5bc9a573272901758fbd66b0a37a790..b20dd62bfc48595d3a23df2b2dce51de0ddef290 100644 (file)
@@ -44,7 +44,7 @@ class ImplodeCompilerTemplatePlugin implements ICompilerTemplatePlugin {
                $phpCode = "<?php\n";
                $phpCode .= "\$_length".$hash." = count(".$tagArgs['from'].");\n";
                $phpCode .= "\$_i".$hash." = 0;\n";
-               $phpCode .= "foreach (".$tagArgs['from']." as ".(isset($tagArgs['key']) ? (StringUtil::substring($tagArgs['key'], 0, 1) != '$' ? "\$this->v[".$tagArgs['key']."]" : $tagArgs['key'])." => " : '').(StringUtil::substring($tagArgs['item'], 0, 1) != '$' ? "\$this->v[".$tagArgs['item']."]" : $tagArgs['item']).") { ?>";
+               $phpCode .= "foreach (".$tagArgs['from']." as ".(isset($tagArgs['key']) ? (mb_substr($tagArgs['key'], 0, 1) != '$' ? "\$this->v[".$tagArgs['key']."]" : $tagArgs['key'])." => " : '').(mb_substr($tagArgs['item'], 0, 1) != '$' ? "\$this->v[".$tagArgs['item']."]" : $tagArgs['item']).") { ?>";
                return $phpCode;
        }
        
index af0e7423f69d7d94bfb6d2b4156b4a9c32925e6c..1edc0c7ea46b2815175b890732fc10ef892972ef 100644 (file)
@@ -37,8 +37,8 @@ class PagesFunctionTemplatePlugin implements IFunctionTemplatePlugin {
         * @return      string          final link
         */
        protected static function insertPageNumber($link, $pageNo) {
-               $startPos = StringUtil::indexOf($link, '%d');
-               if ($startPos !== null) $link = StringUtil::substring($link, 0, $startPos) . $pageNo . StringUtil::substring($link, $startPos + 2);
+               $startPos = mb_strpos($link, '%d');
+               if ($startPos !== null) $link = mb_substr($link, 0, $startPos) . $pageNo . mb_substr($link, $startPos + 2);
                return $link;
        }
        
index e2599ba520cabe2564b00cb1db0f0fbe6a1b17b3..9d712ae1513253f5ac30c6b873ee0024d7531f4c 100644 (file)
@@ -32,14 +32,14 @@ class TableWordwrapModifierTemplatePlugin implements IModifierTemplatePlugin {
                foreach ($substrings as $substring) {
                        if (!empty($result)) $result .= ' ';
                        
-                       $length = StringUtil::length($substring);
+                       $length = mb_strlen($substring);
                        if ($length > $width) {
                                $j = ceil($length / $width);
                
                                for ($i = 0; $i < $j; $i++) {
                                        if ($i) $result .= $break;
-                                       if ($width * ($i + 1) > $length) $result .= StringUtil::substring($substring, $width * $i);
-                                       else $result .= StringUtil::substring($substring, $width * $i, $width);
+                                       if ($width * ($i + 1) > $length) $result .= mb_substr($substring, $width * $i);
+                                       else $result .= mb_substr($substring, $width * $i, $width);
                                }
                        }
                        else {
index c58d79aff7d79e1a04e9cef9403414b01466b2d8..f6b405a92533ce0e9c22ea48e7e60ec4e0d3df9e 100644 (file)
@@ -81,8 +81,8 @@ class UploadFile {
         * @return      string
         */
        public function getFileExtension() {
-               if (($position = StringUtil::lastIndexOf($this->getFilename(), '.')) !== false) {
-                       return StringUtil::toLowerCase(StringUtil::substring($this->getFilename(), $position + 1));
+               if (($position = mb_strrpos($this->getFilename(), '.')) !== false) {
+                       return mb_strtolower(mb_substr($this->getFilename(), $position + 1));
                }
                
                return '';
index 964c3f46b666615b9e17481980aa2411d4a03442..ee2f3a2576197c36a048a11489aaf15ae8dfafdf 100644 (file)
@@ -414,7 +414,7 @@ class UserNotificationHandler extends SingletonFactory {
                $token = $user->notificationMailToken;
                if (!$token) {
                        // generate token if not present
-                       $token = StringUtil::substring(StringUtil::getHash(serialize(array($user->userID, StringUtil::getRandomID()))), 0, 20);
+                       $token = mb_substr(StringUtil::getHash(serialize(array($user->userID, StringUtil::getRandomID()))), 0, 20);
                        $editor = new UserEditor($user);
                        $editor->update(array('notificationMailToken' => $token));
                }
index 9070a5e33e54644add40d2d86c3f39d26c696bdb..49e6af5317d47ddc6bb89cbc3da752c85371fafb 100644 (file)
@@ -126,7 +126,7 @@ class MailWorker extends AbstractWorker {
         */
        protected function sendMail(User $user) {
                try {
-                       $mail = new Mail(array($user->username => $user->email), $this->mailData['subject'], StringUtil::replace('{$username}', $user->username, $this->mailData['text']), $this->mailData['from']);
+                       $mail = new Mail(array($user->username => $user->email), $this->mailData['subject'], str_replace('{$username}', $user->username, $this->mailData['text']), $this->mailData['from']);
                        if ($this->mailData['enableHTML']) $mail->setContentType('text/html');
                        $mail->setLanguage($user->getLanguage());
                        $mail->send();
index ee92eaeff478c868e0dee4e9fd9e8d49221d74f7..da39548204f87492cdfecaa4c6257b6ccc84a418 100644 (file)
@@ -91,7 +91,7 @@ final class CronjobUtil {
                // calculate values based upon each expression
                $values = array();
                foreach ($fields as $fieldName => $fieldValue) {
-                       $fieldValue = StringUtil::toLowerCase($fieldValue);
+                       $fieldValue = mb_strtolower($fieldValue);
                        
                        // Names can also be used for the "month" and "day of week" fields.
                        // Use the first three letters of the particular day or month (case
@@ -389,7 +389,7 @@ final class CronjobUtil {
                $values = array();
                
                // examinate first char
-               $char = StringUtil::substring($fieldValue, 0, 1);
+               $char = mb_substr($fieldValue, 0, 1);
                
                // could be a single value, range or list
                if (is_numeric($char)) {
@@ -403,7 +403,7 @@ final class CronjobUtil {
                else if ($char == '*') {
                        $step = 1;
                        
-                       if (StringUtil::indexOf($fieldValue, '/') !== false) {
+                       if (mb_strpos($fieldValue, '/') !== false) {
                                $rangeData = explode('/', $fieldValue);
                                $step = $rangeData[1];
                        }
@@ -423,7 +423,7 @@ final class CronjobUtil {
         * @return      array
         */
        protected static function getListItems($fieldValue) {
-               if (StringUtil::indexOf($fieldValue, ',') !== false) {
+               if (mb_strpos($fieldValue, ',') !== false) {
                        return explode(',', $fieldValue);
                }
                
@@ -438,12 +438,12 @@ final class CronjobUtil {
         */
        protected static function getRanges($value) {
                // this is a single value
-               if (StringUtil::indexOf($value, '-') === false) {
+               if (mb_strpos($value, '-') === false) {
                        return array($value);
                }
                
                $step = 1;
-               if (StringUtil::indexOf($value, '/') !== false) {
+               if (mb_strpos($value, '/') !== false) {
                        $data = explode('/', $value);
                        $step = $data[1];
                        $value = $data[0];
@@ -559,8 +559,8 @@ final class CronjobUtil {
                                        if (count($compareSlash) == 2) $compare['1'] = $compareSlash['0'];
                                        
                                        // see if digits or names are being given.
-                                       $left = array_search(StringUtil::toLowerCase($compare['0']), $namesArr);
-                                       $right = array_search(StringUtil::toLowerCase($compare['1']), $namesArr);
+                                       $left = array_search(mb_strtolower($compare['0']), $namesArr);
+                                       $right = array_search(mb_strtolower($compare['1']), $namesArr);
                                        if (!$left) $left = $compare['0'];
                                        if (!$right) $right = $compare['1'];
                                        // now check the values.
index 6391c7e6af57fef75691c2a4620d88365fa28b5e..57b6f0d02735700c97ea4afdc3f54a2e6db0e11d 100644 (file)
@@ -33,7 +33,7 @@ final class HeaderUtil {
         */
        public static function setCookie($name, $value = '', $expire = 0) {
                $application = ApplicationHandler::getInstance()->getActiveApplication();
-               $addDomain = (StringUtil::indexOf($application->cookieDomain, '.') === false || StringUtil::endsWith($application->cookieDomain, '.lan') || StringUtil::endsWith($application->cookieDomain, '.local')) ? false : true;
+               $addDomain = (mb_strpos($application->cookieDomain, '.') === false || StringUtil::endsWith($application->cookieDomain, '.lan') || StringUtil::endsWith($application->cookieDomain, '.local')) ? false : true;
                
                @header('Set-Cookie: '.rawurlencode(COOKIE_PREFIX.$name).'='.rawurlencode($value).($expire ? '; expires='.gmdate('D, d-M-Y H:i:s', $expire).' GMT; max-age='.($expire - TIME_NOW) : '').'; path='.$application->cookiePath.($addDomain ? '; domain='.$application->cookieDomain : '').(RouteHandler::secureConnection() ? '; secure' : '').'; HttpOnly', false);
        }
index f59f873ab9bd8d13d34a40db5fa5dc392bcb9c06..d9d5208ad642997047ac74604df7f28432f49d37 100644 (file)
@@ -23,7 +23,7 @@ final class OptionUtil {
                $options = explode("\n", StringUtil::trim(StringUtil::unifyNewlines($selectOptions)));
                foreach ($options as $option) {
                        $key = $value = $option;
-                       if (StringUtil::indexOf($option, ':') !== false) {
+                       if (mb_strpos($option, ':') !== false) {
                                $optionData = explode(':', $option);
                                $key = array_shift($optionData);
                                $value = implode(':', $optionData);
@@ -47,7 +47,7 @@ final class OptionUtil {
                        $options = explode("\n", StringUtil::trim(StringUtil::unifyNewlines($enableOptions)));
                        $key = -1;
                        foreach ($options as $option) {
-                               if (StringUtil::indexOf($option, ':') !== false) {
+                               if (mb_strpos($option, ':') !== false) {
                                        $optionData = explode(':', $option);
                                        $key = array_shift($optionData);
                                        $value = implode(':', $optionData);
index 8864d747233bd39df92171aa76ca78774f2eb982..0b9bc9422f42cafe684877e26aeef49299f96380 100644 (file)
@@ -268,7 +268,7 @@ final class PasswordUtil {
         * @return      string
         */
        protected static function getSalt($salt) {
-               $salt = StringUtil::substring($salt, 0, 22);
+               $salt = mb_substr($salt, 0, 22);
                
                return '$' . self::BCRYPT_TYPE . '$' . self::BCRYPT_COST . '$' . $salt;
        }
@@ -322,7 +322,7 @@ final class PasswordUtil {
         * @return      boolean
         */
        protected static function phpbb3($username, $password, $salt, $dbHash) {
-               if (StringUtil::length($dbHash) !== 34) {
+               if (mb_strlen($dbHash) !== 34) {
                        return self::secureCompare(md5($password), $dbHash);
                }
                
@@ -409,7 +409,7 @@ final class PasswordUtil {
         * @return      boolean
         */
        protected static function smf1($username, $password, $salt, $dbHash) {
-               return self::secureCompare($dbHash, sha1(StringUtil::toLowerCase($username) . $password));
+               return self::secureCompare($dbHash, sha1(mb_strtolower($username) . $password));
        }
        
        /**
index ab221ac5d29e8c8fd1923433853eceb3d96250ea..cd8f34ce8679f5e22a1612d0ddcf1ad78678b250 100644 (file)
@@ -53,8 +53,8 @@ final class StringStack {
        public static function reinsertStrings($string, $type = 'default') {
                if (isset(self::$stringStack[$type])) {
                        foreach (self::$stringStack[$type] as $hash => $value) {
-                               if (StringUtil::indexOf($string, $hash) !== false) {
-                                       $string = StringUtil::replace($hash, $value, $string);
+                               if (mb_strpos($string, $hash) !== false) {
+                                       $string = str_replace($hash, $value, $string);
                                        unset(self::$stringStack[$type][$hash]);
                                }
                        }
index ddc960892126c3c093ee6266c78eab4de3b7997b..6773b9c256dd8aa9981df434bdc43215030a6e2c 100644 (file)
@@ -101,16 +101,16 @@ final class StringUtil {
                $string = self::unifyNewlines($string);
                
                // escape backslash
-               $string = self::replace("\\", "\\\\", $string);
+               $string = str_replace("\\", "\\\\", $string);
                
                // escape singe quote
-               $string = self::replace("'", "\'", $string);
+               $string = str_replace("'", "\'", $string);
                
                // escape new lines
-               $string = self::replace("\n", '\n', $string);
+               $string = str_replace("\n", '\n', $string);
                
                // escape slashes
-               $string = self::replace("/", '\/', $string);
+               $string = str_replace("/", '\/', $string);
                
                return $string;
        }
@@ -127,7 +127,7 @@ final class StringUtil {
                $string = self::encodeHTML($string);
                
                // single quotes must be encoded as HTML entity
-               $string = self::replace("\'", "&#39;", $string);
+               $string = str_replace("\'", "&#39;", $string);
                
                return $string;
        }
@@ -233,7 +233,7 @@ final class StringUtil {
         * @return      string
         */
        public static function formatNegative($number) {
-               return self::replace('-', self::MINUS, $number);
+               return str_replace('-', self::MINUS, $number);
        }
        
        /**
@@ -325,14 +325,14 @@ final class StringUtil {
         * Alias to php ucfirst() function with multibyte support.
         */
        public static function firstCharToUpperCase($string) {
-               return self::toUpperCase(self::substring($string, 0, 1)).self::substring($string, 1);
+               return mb_strtoupper(mb_substr($string, 0, 1)).mb_substr($string, 1);
        }
        
        /**
         * Alias to php lcfirst() function with multibyte support.
         */
        public static function firstCharToLowerCase($string) {
-               return self::toLowerCase(self::substring($string, 0, 1)).self::substring($string, 1);
+               return mb_strtolower(mb_substr($string, 0, 1)).mb_substr($string, 1);
        }
        
        /**
@@ -358,12 +358,12 @@ final class StringUtil {
         * only ASCII characters, please use str_ireplace() instead.
         */
        public static function replaceIgnoreCase($search, $replace, $subject, &$count = 0) {
-               $startPos = self::indexOf(self::toLowerCase($subject), self::toLowerCase($search));
+               $startPos = mb_strpos(mb_strtolower($subject), mb_strtolower($search));
                if ($startPos === false) return $subject;
                else {
-                       $endPos = $startPos + self::length($search);
+                       $endPos = $startPos + mb_strlen($search);
                        $count++;
-                       return self::substring($subject, 0, $startPos) . $replace . self::replaceIgnoreCase($search, $replace, self::substring($subject, $endPos), $count);
+                       return mb_substr($subject, 0, $startPos) . $replace . self::replaceIgnoreCase($search, $replace, mb_substr($subject, $endPos), $count);
                }
        }
        
@@ -378,11 +378,11 @@ final class StringUtil {
         */
        public static function startsWith($haystack, $needle, $ci = false) {
                if ($ci) {
-                       $haystack = self::toLowerCase($haystack);
-                       $needle = self::toLowerCase($needle);
+                       $haystack = mb_strtolower($haystack);
+                       $needle = mb_strtolower($needle);
                }
                // using substring and === is MUCH faster for long strings then using indexOf.
-               return self::substring($haystack, 0, self::length($needle)) === $needle;
+               return mb_substr($haystack, 0, mb_strlen($needle)) === $needle;
        }
        
        /**
@@ -395,12 +395,12 @@ final class StringUtil {
         */
        public static function endsWith($haystack, $needle, $ci = false) {
                if ($ci) {
-                       $haystack = self::toLowerCase($haystack);
-                       $needle = self::toLowerCase($needle);
+                       $haystack = mb_strtolower($haystack);
+                       $needle = mb_strtolower($needle);
                }
-               $length = self::length($needle);
+               $length = mb_strlen($needle);
                if ($length === 0) return true;
-               return (self::substring($haystack, $length * -1) === $needle);
+               return (mb_substr($haystack, $length * -1) === $needle);
        }
        
        /**
@@ -412,7 +412,7 @@ final class StringUtil {
         */
        public static function unescape($string, $chars = '"') {
                for ($i = 0, $j = strlen($chars); $i < $j; $i++) {
-                       $string = self::replace('\\'.$chars[$i], $chars[$i], $string);
+                       $string = str_replace('\\'.$chars[$i], $chars[$i], $string);
                }
                
                return $string;
@@ -474,8 +474,8 @@ final class StringUtil {
         */
        public static function encodeAllChars($string) {
                $result = '';
-               for ($i = 0, $j = self::length($string); $i < $j; $i++) {
-                       $char = self::substring($string, $i, 1);
+               for ($i = 0, $j = mb_strlen($string); $i < $j; $i++) {
+                       $char = mb_substr($string, $i, 1);
                        $result .= '&#'.self::getCharValue($char).';';
                }
                
@@ -566,13 +566,13 @@ final class StringUtil {
         * @return      boolean
         */
        public static function executeWordFilter($word, $filter) {
-               $word = self::toLowerCase($word);
+               $word = mb_strtolower($word);
                
                if ($filter != '') {
-                       $forbiddenNames = explode("\n", self::toLowerCase(self::unifyNewlines($filter)));
+                       $forbiddenNames = explode("\n", mb_strtolower(self::unifyNewlines($filter)));
                        foreach ($forbiddenNames as $forbiddenName) {
-                               if (self::indexOf($forbiddenName, '*') !== false) {
-                                       $forbiddenName = self::replace('\*', '.*', preg_quote($forbiddenName, '/'));
+                               if (mb_strpos($forbiddenName, '*') !== false) {
+                                       $forbiddenName = str_replace('\*', '.*', preg_quote($forbiddenName, '/'));
                                        if (preg_match('/^'.$forbiddenName.'$/s', $word)) {
                                                return false;
                                        }
@@ -602,14 +602,14 @@ final class StringUtil {
                        return '';
                }
                
-               if (self::length($string) > $length) {
-                       $length -= self::length($etc);
+               if (mb_strlen($string) > $length) {
+                       $length -= mb_strlen($etc);
                        
                        if (!$breakWords) {
-                               $string = preg_replace('/\\s+?(\\S+)?$/', '', self::substring($string, 0, $length + 1));
+                               $string = preg_replace('/\\s+?(\\S+)?$/', '', mb_substr($string, 0, $length + 1));
                        }
                        
-                       return self::substring($string, 0, $length).$etc;
+                       return mb_substr($string, 0, $length).$etc;
                }
                else {
                        return $string;
@@ -626,14 +626,14 @@ final class StringUtil {
         * @return      string                                  truncated string
         */
        public static function truncateHTML($string, $length = 500, $etc = self::HELLIP, $breakWords = false) {
-               if (self::length(self::stripHTML($string)) <= $length) {
+               if (mb_strlen(self::stripHTML($string)) <= $length) {
                        return $string;
                }
                $openTags = array();
                $truncatedString = '';
        
                // initalize length counter with the ending length
-               $totalLength = self::length($etc);
+               $totalLength = mb_strlen($etc);
        
                preg_match_all('/(<\/?([\w+]+)[^>]*>)?([^<>]*)/', $string, $tags, PREG_SET_ORDER);
        
@@ -660,7 +660,7 @@ final class StringUtil {
        
                        // get length of the content without entities. If the content is too long, keep entities intact
                        $decodedContent = self::decodeHTML($tag[3]);
-                       $contentLength = self::length($decodedContent);
+                       $contentLength = mb_strlen($decodedContent);
                        if ($contentLength + $totalLength > $length) {
                                if (!$breakWords) {
                                        if (preg_match('/^(.{1,'.($length - $totalLength).'}) /s', $decodedContent, $match)) {
@@ -676,14 +676,14 @@ final class StringUtil {
                                        foreach ($entities[0] as $entity) {
                                                if ($entity[1] + 1 - $entitiesLength <= $left) {
                                                        $left--;
-                                                       $entitiesLength += self::length($entity[0]);
+                                                       $entitiesLength += mb_strlen($entity[0]);
                                                }
                                                else {
                                                        break;
                                                }
                                        }
                                }
-                               $truncatedString .= self::substring($tag[3], 0, $left + $entitiesLength);
+                               $truncatedString .= mb_substr($tag[3], 0, $left + $entitiesLength);
                                break;
                        }
                        else {
@@ -725,8 +725,8 @@ final class StringUtil {
                        // use URL and remove protocol and www subdomain 
                        $title = preg_replace('~^(?:https?|ftps?)://(?:www\.)?~i', '', $url);
                        
-                       if (self::length($title) > 60) {
-                               $title = self::substring($title, 0, 30) . self::HELLIP . self::substring($title, -25);
+                       if (mb_strlen($title) > 60) {
+                               $title = mb_substr($title, 0, 30) . self::HELLIP . mb_substr($title, -25);
                        }
                        
                        if (!$encodeTitle) $title = self::encodeHTML($title);
@@ -760,14 +760,14 @@ final class StringUtil {
                $substrings = explode($break, $string);
                
                foreach ($substrings as $substring) {
-                       $length = self::length($substring);
+                       $length = mb_strlen($substring);
                        if ($length > $width) {
                                $j = ceil($length / $width);
                                
                                for ($i = 0; $i < $j; $i++) {
                                        if (!empty($result)) $result .= $break;
-                                       if ($width * ($i + 1) > $length) $result .= self::substring($substring, $width * $i);
-                                       else $result .= self::substring($substring, $width * $i, $width);
+                                       if ($width * ($i + 1) > $length) $result .= mb_substr($substring, $width * $i);
+                                       else $result .= mb_substr($substring, $width * $i, $width);
                                }
                        }
                        else {
index 3a84c9d555fa9766a46093ec9f94166af38cd390..109aeea83adc9dd6656b7e93300f847e32e50905 100644 (file)
@@ -26,7 +26,7 @@ final class UserRegistrationUtil {
        public static function isValidUsername($name) {
                if (!UserUtil::isValidUsername($name)) return false;
                
-               $length = StringUtil::length($name);
+               $length = mb_strlen($name);
                if ($length < REGISTER_USERNAME_MIN_LENGTH || $length > REGISTER_USERNAME_MAX_LENGTH) return false;
                
                if (!self::checkForbiddenUsernames($name)) return false;
@@ -74,7 +74,7 @@ final class UserRegistrationUtil {
         */
        public static function isSecurePassword($password) {
                if (REGISTER_ENABLE_PASSWORD_SECURITY_CHECK) {
-                       if (StringUtil::length($password) < REGISTER_PASSWORD_MIN_LENGTH) return false;
+                       if (mb_strlen($password) < REGISTER_PASSWORD_MIN_LENGTH) return false;
                        
                        if (REGISTER_PASSWORD_MUST_CONTAIN_DIGIT && !preg_match('![0-9]+!', $password)) return false;
                        if (REGISTER_PASSWORD_MUST_CONTAIN_LOWER_CASE && !preg_match('![a-z]+!', $password)) return false;
index 1c2892822dcf2e1e61309cac2d4fef4c707eeb7f..34d2da8f47e3fd6411733da1bd3a9d373de96bba 100644 (file)
@@ -21,7 +21,7 @@ final class UserUtil {
         */
        public static function isValidUsername($name) {
                // minimum length is 3 characters, maximum length is 255 characters
-               if (StringUtil::length($name) < 3 || StringUtil::length($name) > 255) {
+               if (mb_strlen($name) < 3 || mb_strlen($name) > 255) {
                        return false;
                }
                
@@ -32,7 +32,7 @@ final class UserUtil {
                // check long words
                $words = preg_split('!\s+!', $name, -1, PREG_SPLIT_NO_EMPTY);
                foreach ($words as $word) {
-                       if (StringUtil::length($word) > 20) {
+                       if (mb_strlen($word) > 20) {
                                return false;
                        }
                }
@@ -231,7 +231,7 @@ final class UserUtil {
                        $REQUEST_URI = StringUtil::convertEncoding('ISO-8859-1', 'UTF-8', $REQUEST_URI);
                }
                
-               return StringUtil::substring(FileUtil::unifyDirSeparator($REQUEST_URI), 0, 255);
+               return mb_substr(FileUtil::unifyDirSeparator($REQUEST_URI), 0, 255);
        }
        
        private function __construct() { }
index 188ea59ea4ef4339dc3ee4aee01d16154332c4ee..86d8b52ab8a6428c0599a34d31fa9a75c2d19b3b 100644 (file)
@@ -119,7 +119,7 @@ class XML {
                
                // build file path upon namespace and filename
                $tmp = explode(' ', $this->schema);
-               $this->schema = WCF_DIR.'xsd/'.StringUtil::substring(sha1($tmp[0]), 0, 8) . '_' . basename($tmp[1]);
+               $this->schema = WCF_DIR.'xsd/'.mb_substr(sha1($tmp[0]), 0, 8) . '_' . basename($tmp[1]);
                
                if (!file_exists($this->schema) || !is_readable($this->schema)) {
                        throw new SystemException("Could not read XML schema definition located at '".$this->schema."'.");