Replace use of `StringUtil::endsWith()` by `\str_ends_with()`
authorTim Düsterhus <duesterhus@woltlab.com>
Wed, 22 Sep 2021 09:56:37 +0000 (11:56 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Wed, 22 Sep 2021 10:24:58 +0000 (12:24 +0200)
wcfsetup/install/files/lib/acp/form/ApplicationEditForm.class.php
wcfsetup/install/files/lib/acp/form/ApplicationManagementForm.class.php
wcfsetup/install/files/lib/acp/form/PackageUpdateServerAddForm.class.php
wcfsetup/install/files/lib/data/application/ApplicationAction.class.php
wcfsetup/install/files/lib/data/attachment/Attachment.class.php
wcfsetup/install/files/lib/data/style/StyleEditor.class.php
wcfsetup/install/files/lib/system/acl/ACLHandler.class.php
wcfsetup/install/files/lib/util/HeaderUtil.class.php
wcfsetup/install/files/lib/util/Url.class.php

index 5de2feb987bd2268075a66655311bd946d33a6d6..1e761a9ce6426c8a7d4bb6ecce3c57ab58798d59 100644 (file)
@@ -171,7 +171,7 @@ class ApplicationEditForm extends AbstractForm
             $this->cookieDomain = $regex->replace($this->cookieDomain, '');
 
             // check if cookie domain shares the same domain (may exclude subdomains)
-            if (!StringUtil::endsWith($regex->replace($this->domainName, ''), $this->cookieDomain)) {
+            if (!\str_ends_with($regex->replace($this->domainName, ''), $this->cookieDomain)) {
                 throw new UserInputException('cookieDomain', 'invalid');
             }
         }
index a3ca319be2d031e2a79e5a8ecd63f7a64d958d6f..edb6fdeda522d596e9cd497a24508ea51c9af5d6 100644 (file)
@@ -125,7 +125,7 @@ final class ApplicationManagementForm extends AbstractForm
             $this->cookieDomain = $regex->replace($this->cookieDomain, '');
 
             // check if cookie domain shares the same domain (may exclude subdomains)
-            if (!StringUtil::endsWith($regex->replace($this->domainName, ''), $this->cookieDomain)) {
+            if (!\str_ends_with($regex->replace($this->domainName, ''), $this->cookieDomain)) {
                 throw new UserInputException('cookieDomain', 'invalid');
             }
         }
index 30d54df781d5068d33783c87bbad61dd45163cdd..bdc2f6c6863e7551af46f268f16b27cb2fcccfb8 100755 (executable)
@@ -93,7 +93,7 @@ class PackageUpdateServerAddForm extends AbstractForm
             throw new UserInputException('serverURL', 'invalid');
         }
 
-        if (StringUtil::endsWith(Url::parse($this->serverURL)['host'], '.woltlab.com', true)) {
+        if (\str_ends_with(Url::parse($this->serverURL)['host'], '.woltlab.com', true)) {
             throw new UserInputException('serverURL', 'woltlab');
         }
 
index e8dbdf179e6e0e5d092a340b3089b3aa0686febd..21fcdd5e37a6a314f8a1ea19db5766bc0d3539ce 100644 (file)
@@ -7,7 +7,6 @@ use wcf\system\cache\builder\ApplicationCacheBuilder;
 use wcf\system\language\LanguageFactory;
 use wcf\system\Regex;
 use wcf\system\WCF;
-use wcf\util\StringUtil;
 
 /**
  * Executes application-related actions.
@@ -53,7 +52,7 @@ class ApplicationAction extends AbstractDatabaseObjectAction
         WCF::getDB()->beginTransaction();
         foreach ($this->getObjects() as $application) {
             $domainName = $application->domainName;
-            if (StringUtil::endsWith($regex->replace($domainName, ''), $application->cookieDomain)) {
+            if (\str_ends_with($regex->replace($domainName, ''), $application->cookieDomain)) {
                 $domainName = $application->cookieDomain;
             }
 
index 7be261a006af07e1b65efe71132bfa3f5a3552cd..6d8559bf1ee4844829e8b674d879e9bff023823f 100644 (file)
@@ -10,7 +10,6 @@ use wcf\system\request\IRouteController;
 use wcf\system\request\LinkHandler;
 use wcf\system\WCF;
 use wcf\util\FileUtil;
-use wcf\util\StringUtil;
 
 /**
  * Represents an attachment.
@@ -199,7 +198,7 @@ class Attachment extends DatabaseObject implements ILinkableObject, IRouteContro
                 $this->getThumbnailLocation('tiny'),
             ] as $location
         ) {
-            if (!StringUtil::endsWith($location, '.bin')) {
+            if (!\str_ends_with($location, '.bin')) {
                 \rename($location, $location . '.bin');
             }
         }
index 045f2fec16e46a7dd582bc69667c7bb7dee25b0e..10d34b866010da73af971f15edc29d3eacdaab76 100644 (file)
@@ -545,7 +545,7 @@ class StyleEditor extends DatabaseObjectEditor implements IEditableCachedObject
 
                         // copy templates
                         foreach ($templates as $template) {
-                            if (!StringUtil::endsWith($template['filename'], '.tpl')) {
+                            if (!\str_ends_with($template['filename'], '.tpl')) {
                                 continue;
                             }
 
index 07b5a4df9f0f07cc04226fe344b65f170357bb94..92e0aef46fb23549aafa15ff3610eac7f209c189 100644 (file)
@@ -14,7 +14,6 @@ use wcf\system\database\util\PreparedStatementConditionBuilder;
 use wcf\system\exception\SystemException;
 use wcf\system\SingletonFactory;
 use wcf\system\WCF;
-use wcf\util\StringUtil;
 
 /**
  * Handles ACL permissions.
@@ -446,7 +445,7 @@ class ACLHandler extends SingletonFactory
     {
         $optionList = new ACLOptionList();
         if (!empty($categoryName)) {
-            if (StringUtil::endsWith($categoryName, '.*')) {
+            if (\str_ends_with($categoryName, '.*')) {
                 $categoryName = \mb_substr($categoryName, 0, -1) . '%';
                 $optionList->getConditionBuilder()->add("acl_option.categoryName LIKE ?", [$categoryName]);
             } else {
index 5eca0e76fda90c360520d88f10985b5a27dfa3a0..effb548e33c88573bd7d85ee3217a267a11e8391 100644 (file)
@@ -65,10 +65,10 @@ final class HeaderUtil
         $addDomain = (\mb_strpos(
             $application->cookieDomain,
             '.'
-        ) === false || StringUtil::endsWith(
+        ) === false || \str_ends_with(
             $application->cookieDomain,
             '.lan'
-        ) || StringUtil::endsWith($application->cookieDomain, '.local')) ? false : true;
+        ) || \str_ends_with($application->cookieDomain, '.local')) ? false : true;
 
         if (!$addDomain) {
             return null;
index 4a0b0aec8d92a3244cf0829120f98266bae39def..e24ed95fba21de08bc1320d05d3c87c9aa15be6f 100644 (file)
@@ -208,7 +208,7 @@ final class Url implements \ArrayAccess
                     if ($isWildcard && \mb_strpos($hostname, $host) !== false) {
                         // the prepended dot will ensure that `example.com` matches only
                         // on domains like `foo.example.com` but not on `bar-example.com`
-                        if (StringUtil::endsWith($hostname, '.' . $host)) {
+                        if (\str_ends_with($hostname, '.' . $host)) {
                             $validHosts[$hostname] = $hostname;
 
                             return true;