From 34862e54397c5cf5697f6204520a227c4fae90ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20W=C3=BCnsch?= Date: Wed, 22 Oct 2025 10:45:16 +0200 Subject: [PATCH] Use `str_starts_with()` instead of `strpos()` and `substr()`. --- modules/GetSiteBy/patches/40180.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/GetSiteBy/patches/40180.php b/modules/GetSiteBy/patches/40180.php index ab77003..a646444 100644 --- a/modules/GetSiteBy/patches/40180.php +++ b/modules/GetSiteBy/patches/40180.php @@ -53,7 +53,7 @@ function get_site_by( $field, $value, $network_id = null ) { } break; case 'url': - if ( 0 !== strpos( $value, 'http://' ) && 0 !== strpos( $value, 'https://' ) ) { + if ( ! str_starts_with( $value, 'http://' ) && ! str_starts_with( $value, 'https://' ) ) { $value = 'http://' . $value; } @@ -90,7 +90,7 @@ function get_site_by( $field, $value, $network_id = null ) { $args['number'] = 1; - if ( isset( $args['domain'] ) && substr( $args['domain'], 0, 4 ) === 'www.' ) { + if ( isset( $args['domain'] ) && str_starts_with( $args['domain'], 'www.' ) ) { $bare = substr( $args['domain'], 4 ); $args['domain__in'] = array( $bare, $args['domain'] );