Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pk_is_cur_site函数逻辑错误以及修改方法 #435

Closed
CyunZing opened this issue Aug 19, 2024 · 0 comments
Closed

pk_is_cur_site函数逻辑错误以及修改方法 #435

CyunZing opened this issue Aug 19, 2024 · 0 comments
Labels
BUG Something isn't working 已解决

Comments

@CyunZing
Copy link

  • 主题版本号:2.8.5
  • WordPress版本:6.x
  • PHP版本:7.4
  • 问题阐述:
    • inc\fun\opt.phppk_is_cur_site函数返回值存在错误。
    • 出现的问题:
      • 1、无法正确匹配链接是否为本站的。
      • 2、pk_go_linkpk_content_addlink函数检测时,属于本站链接在正文中也会进入跳转界面进行确认,而非直接进行跳转。
    • 出现的原因:
      str_starts_with()函数返回的是布尔值,而不是数值,所以不应该与0进行比较。
      该错误会导致“正文内容链接加跳转”
    • 解决的方法:
    • inc\fun\opt.php中的pk_is_cur_site函数按照如下修改

原函数:

//检测链接是否属于本站
function pk_is_cur_site($url)
{
    if (str_starts_with($url, home_url()) === 0) {
        return true;
    }
    return false;
}

修改后的函数

//检测链接是否属于本站
function pk_is_cur_site($url)
{
    return str_starts_with($url, home_url());
}
@CyunZing CyunZing added the 待确认问题 等待确认是否是已存在的问题 label Aug 19, 2024
@CyunZing CyunZing changed the title pk_is_cur_site函数返回错误已经修改方法 pk_is_cur_site函数返回错误以及修改方法 Aug 19, 2024
@CyunZing CyunZing changed the title pk_is_cur_site函数返回错误以及修改方法 pk_is_cur_site函数编写逻辑错误以及修改方法 Aug 19, 2024
@CyunZing CyunZing changed the title pk_is_cur_site函数编写逻辑错误以及修改方法 pk_is_cur_site函数逻辑错误以及修改方法 Aug 19, 2024
@Licoy Licoy added BUG Something isn't working 已解决 and removed 待确认问题 等待确认是否是已存在的问题 labels Aug 21, 2024
@Licoy Licoy closed this as completed Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BUG Something isn't working 已解决
Projects
None yet
Development

No branches or pull requests

2 participants