Replaced strpos() with simplified realization (#1172)

This commit is contained in:
Roman Kelesidis 2023-11-27 20:12:13 +03:00 committed by GitHub
commit 493cd910cf
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 24 additions and 24 deletions

View file

@ -382,7 +382,7 @@ function attachment_sync_topic($topics)
*/
function get_extension($filename)
{
if (false === strpos($filename, '.')) {
if (!str_contains($filename, '.')) {
return '';
}
$extension = strrchr(strtolower($filename), '.');

View file

@ -26,9 +26,9 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
$post_id_array = [];
if (!is_array($attach_id_array)) {
if (false !== strpos($attach_id_array, ', ')) {
if (str_contains($attach_id_array, ', ')) {
$attach_id_array = explode(', ', $attach_id_array);
} elseif (false !== strpos($attach_id_array, ',')) {
} elseif (str_contains($attach_id_array, ',')) {
$attach_id_array = explode(',', $attach_id_array);
} else {
$attach_id = (int)$attach_id_array;
@ -67,9 +67,9 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
return;
}
if (false !== strpos($post_id_array, ', ')) {
if (str_contains($post_id_array, ', ')) {
$post_id_array = explode(', ', $post_id_array);
} elseif (false !== strpos($post_id_array, ',')) {
} elseif (str_contains($post_id_array, ',')) {
$post_id_array = explode(',', $post_id_array);
} else {
$post_id = (int)$post_id_array;
@ -112,9 +112,9 @@ function delete_attachment($post_id_array = 0, $attach_id_array = 0, $page = 0,
}
if (!is_array($attach_id_array)) {
if (false !== strpos($attach_id_array, ', ')) {
if (str_contains($attach_id_array, ', ')) {
$attach_id_array = explode(', ', $attach_id_array);
} elseif (false !== strpos($attach_id_array, ',')) {
} elseif (str_contains($attach_id_array, ',')) {
$attach_id_array = explode(',', $attach_id_array);
} else {
$attach_id = (int)$attach_id_array;