From: Tim Düsterhus Date: Wed, 22 Sep 2021 09:54:14 +0000 (+0200) Subject: Replace use of `StringUtil::startsWith()` by `\str_starts_with()` X-Git-Tag: 5.5.0_Alpha_1~415^2~1 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2d826248ee9430547ab5d455412a399114d2b8fe;p=GitHub%2FWoltLab%2FWCF.git Replace use of `StringUtil::startsWith()` by `\str_starts_with()` --- diff --git a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.5_starttls.php b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.5_starttls.php index 35400298e2..09d3731d52 100644 --- a/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.5_starttls.php +++ b/wcfsetup/install/files/acp/update_com.woltlab.wcf_5.5_starttls.php @@ -13,14 +13,13 @@ use wcf\data\option\OptionAction; use wcf\system\email\Email; use wcf\system\email\transport\exception\TransientFailure; use wcf\system\io\RemoteFile; -use wcf\util\StringUtil; if (MAIL_SMTP_STARTTLS != 'may') { return; } $value = 'encrypt'; -if (StringUtil::startsWith(MAIL_SMTP_HOST, 'ssl://')) { +if (\str_starts_with(MAIL_SMTP_HOST, 'ssl://')) { // Anything using proper SSL can't use STARTTLS. $value = 'none'; } elseif (MAIL_SMTP_PORT == 465) { diff --git a/wcfsetup/install/files/lib/action/ImageProxyAction.class.php b/wcfsetup/install/files/lib/action/ImageProxyAction.class.php index 8033f6af27..6dbdfb8773 100644 --- a/wcfsetup/install/files/lib/action/ImageProxyAction.class.php +++ b/wcfsetup/install/files/lib/action/ImageProxyAction.class.php @@ -117,7 +117,7 @@ class ImageProxyAction extends AbstractAction // rewrite schemaless URLs to https $scheme = Url::parse($url)['scheme']; if (!$scheme) { - if (StringUtil::startsWith($url, '//')) { + if (\str_starts_with($url, '//')) { $url = 'https:' . $url; } else { throw new \DomainException("Refusing to proxy a schemaless URL that does not start with //"); diff --git a/wcfsetup/install/files/lib/data/user/UserProfile.class.php b/wcfsetup/install/files/lib/data/user/UserProfile.class.php index 95db5a1b49..bc802246f2 100644 --- a/wcfsetup/install/files/lib/data/user/UserProfile.class.php +++ b/wcfsetup/install/files/lib/data/user/UserProfile.class.php @@ -1015,7 +1015,7 @@ class UserProfile extends DatabaseObjectDecorator implements ITitledLinkObject */ public function isConnectedWithFacebook() { - return StringUtil::startsWith($this->authData, 'facebook:'); + return \str_starts_with($this->authData, 'facebook:'); } /** @@ -1023,7 +1023,7 @@ class UserProfile extends DatabaseObjectDecorator implements ITitledLinkObject */ public function isConnectedWithGithub() { - return StringUtil::startsWith($this->authData, 'github:'); + return \str_starts_with($this->authData, 'github:'); } /** @@ -1031,7 +1031,7 @@ class UserProfile extends DatabaseObjectDecorator implements ITitledLinkObject */ public function isConnectedWithGoogle() { - return StringUtil::startsWith($this->authData, 'google:'); + return \str_starts_with($this->authData, 'google:'); } /** @@ -1039,7 +1039,7 @@ class UserProfile extends DatabaseObjectDecorator implements ITitledLinkObject */ public function isConnectedWithTwitter() { - return StringUtil::startsWith($this->authData, 'twitter:'); + return \str_starts_with($this->authData, 'twitter:'); } /** diff --git a/wcfsetup/install/files/lib/form/AccountManagementForm.class.php b/wcfsetup/install/files/lib/form/AccountManagementForm.class.php index 0589c0fe84..584ebcb135 100644 --- a/wcfsetup/install/files/lib/form/AccountManagementForm.class.php +++ b/wcfsetup/install/files/lib/form/AccountManagementForm.class.php @@ -438,7 +438,7 @@ class AccountManagementForm extends AbstractForm WCF::getSession()->unregister('__oauthUser'); } } - if ($this->githubDisconnect && StringUtil::startsWith(WCF::getUser()->authData, 'github:')) { + if ($this->githubDisconnect && \str_starts_with(WCF::getUser()->authData, 'github:')) { $updateParameters['authData'] = ''; $success[] = 'wcf.user.3rdparty.github.disconnect.success'; } @@ -456,7 +456,7 @@ class AccountManagementForm extends AbstractForm WCF::getSession()->unregister('__oauthUser'); } } - if ($this->twitterDisconnect && StringUtil::startsWith(WCF::getUser()->authData, 'twitter:')) { + if ($this->twitterDisconnect && \str_starts_with(WCF::getUser()->authData, 'twitter:')) { $updateParameters['authData'] = ''; $success[] = 'wcf.user.3rdparty.twitter.disconnect.success'; } @@ -474,7 +474,7 @@ class AccountManagementForm extends AbstractForm WCF::getSession()->unregister('__oauthUser'); } } - if ($this->facebookDisconnect && StringUtil::startsWith(WCF::getUser()->authData, 'facebook:')) { + if ($this->facebookDisconnect && \str_starts_with(WCF::getUser()->authData, 'facebook:')) { $updateParameters['authData'] = ''; $success[] = 'wcf.user.3rdparty.facebook.disconnect.success'; } @@ -492,7 +492,7 @@ class AccountManagementForm extends AbstractForm WCF::getSession()->unregister('__oauthUser'); } } - if ($this->googleDisconnect && StringUtil::startsWith(WCF::getUser()->authData, 'google:')) { + if ($this->googleDisconnect && \str_starts_with(WCF::getUser()->authData, 'google:')) { $updateParameters['authData'] = ''; $success[] = 'wcf.user.3rdparty.google.disconnect.success'; } diff --git a/wcfsetup/install/files/lib/system/email/Email.class.php b/wcfsetup/install/files/lib/system/email/Email.class.php index 689438e444..ac782d62c2 100644 --- a/wcfsetup/install/files/lib/system/email/Email.class.php +++ b/wcfsetup/install/files/lib/system/email/Email.class.php @@ -483,7 +483,7 @@ class Email public function addHeader($header, $value) { $header = \mb_strtolower($header); - if (!StringUtil::startsWith($header, 'x-')) { + if (!\str_starts_with($header, 'x-')) { throw new \DomainException( "The header '{$header}' may not be set. You may only set user defined headers (starting with 'X-')." ); diff --git a/wcfsetup/install/files/lib/system/email/mime/AbstractMultipartMimePart.class.php b/wcfsetup/install/files/lib/system/email/mime/AbstractMultipartMimePart.class.php index 087208d688..09252aace8 100644 --- a/wcfsetup/install/files/lib/system/email/mime/AbstractMultipartMimePart.class.php +++ b/wcfsetup/install/files/lib/system/email/mime/AbstractMultipartMimePart.class.php @@ -139,7 +139,10 @@ abstract class AbstractMultipartMimePart extends AbstractMimePart implements IRe ); } - if (!StringUtil::startsWith($header[0], 'x-') && !StringUtil::startsWith($header[0], 'content-')) { + if ( + !\str_starts_with($header[0], 'x-') + && !\str_starts_with($header[0], 'content-') + ) { throw new \DomainException("The header '" . $header[0] . "' may not be set. You may only set headers starting with 'X-' or 'Content-'."); } } diff --git a/wcfsetup/install/files/lib/system/email/transport/SmtpEmailTransport.class.php b/wcfsetup/install/files/lib/system/email/transport/SmtpEmailTransport.class.php index e40ded158b..649e5745f6 100644 --- a/wcfsetup/install/files/lib/system/email/transport/SmtpEmailTransport.class.php +++ b/wcfsetup/install/files/lib/system/email/transport/SmtpEmailTransport.class.php @@ -442,7 +442,7 @@ class SmtpEmailTransport implements IStatusReportingEmailTransport // o Before sending a line of mail text, the SMTP client checks the // first character of the line. If it is a period, one additional // period is inserted at the beginning of the line. - if (StringUtil::startsWith($item, '.')) { + if (\str_starts_with($item, '.')) { return '.' . $item; } diff --git a/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php b/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php index b56983e559..017c2369d4 100644 --- a/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php +++ b/wcfsetup/install/files/lib/system/style/StyleCompiler.class.php @@ -586,7 +586,7 @@ EOT; protected function compileStylesheet(string $scss, array $variables): string { foreach ($variables as &$value) { - if (StringUtil::startsWith($value, '../')) { + if (\str_starts_with($value, '../')) { $value = '"' . $value . '"'; } }