Skip to content

Commit

Permalink
🐛 修复密码可见短代码生成空白p标签
Browse files Browse the repository at this point in the history
  • Loading branch information
Licoy committed Jan 9, 2023
1 parent 8bbb382 commit 70c5b36
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions inc/fun/short-code.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,21 +280,14 @@ function pk_password_read($attr, $content = null)
$error = sc_tips_danger(null, "<i class='fa-regular fa-eye'></i>&nbsp;密码输入错误,请重新输入!");
}
}
if (trim($desc) == "") {
if (empty(trim($desc))) {
$desc = "此处含有隐藏内容,需要正确输入密码后可见!";
}
$out .= '<div class="p-block pk-sc-password-red">' . sc_tips_primary(null, "<i class='fa-regular fa-eye'></i>&nbsp;{$desc}") . '
' . $error . '<form action="' . get_permalink() . '" method="post">
<div class="row">
<div class="col-8 col-md-10">
<input type="password" placeholder="请输入密码" required class="form-control form-control-sm" name="pass"/>
</div>
<div class="col-4 col-md-2 pl-0">
<button class="btn btn-sm btn-primary w-100">立即查看</button>
</div>
</div>
</form>
</div>';
$out .= "<div class=\"p-block pk-sc-password-red\">".sc_tips_primary(null, "<i class='fa-regular fa-eye'></i>&nbsp;{$desc}")
."$error<form action=\"".get_permalink()."\" method=\"post\"><div class=\"row\"><div class=\"col-8 col-md-10\">"
."<input type=\"password\" placeholder=\"请输入密码\" required class=\"form-control form-control-sm\" name=\"pass\"/>"
."</div><div class=\"col-4 col-md-2 pl-0\"><button class=\"btn btn-sm btn-primary w-100\">立即查看</button></div></div></form>"
."</div>";
return $out;
}

Expand Down

0 comments on commit 70c5b36

Please sign in to comment.