Skip to content

Commit

Permalink
修正php7字符串函数兼容性
Browse files Browse the repository at this point in the history
  • Loading branch information
jd82k committed Apr 23, 2024
1 parent 87a84fb commit f4d05c3
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions inc/fun/core.php
Original file line number Diff line number Diff line change
Expand Up @@ -909,13 +909,13 @@ function pk_get_ip_region_str($ip)
} catch (Exception $e) {
return '未知';
}
if (str_contains($s['region'], '内网IP')) {
if (strpos($s['region'], '内网IP') !== false) {
return '内网IP';
}
$region = explode('|', $s['region']);
$res = '';
foreach ($region as $item) {
if (str_starts_with($item, '0')) {
if (strpos($item, '0') === 0) {
continue;
}
$res .= $item;
Expand Down
4 changes: 2 additions & 2 deletions inc/init.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ function pk_init_register_assets()
add_filter('style_loader_tag', 'pk_assets_href_handle', 10, 3);
function pk_assets_scr_handle($tag, $handle, $source)
{
if (str_starts_with($handle, 'puock') && strpos($source,'instant=true')===false)
if (strpos($handle, 'puock') === 0 && strpos($source,'instant=true')===false)
{
$tag = str_replace(' src', ' data-no-instant src', $tag);
}
Expand All @@ -233,7 +233,7 @@ function pk_assets_scr_handle($tag, $handle, $source)

function pk_assets_href_handle($tag, $handle, $source)
{
if (str_starts_with($handle, 'puock') && strpos($source,'instant=true')===false) {
if (strpos($handle, 'puock') === 0 && strpos($source,'instant=true')===false) {
$tag = str_replace(' href', ' data-no-instant href', $tag);
}
return $tag;
Expand Down

0 comments on commit f4d05c3

Please sign in to comment.