fix: exception error caused by null siteurl value (#508)

pull/568/head
Seaton Jiang 2022-11-27 19:11:21 +08:00
parent 23af2fcf2f
commit e61b84b96c
No known key found for this signature in database
GPG Key ID: B79682F6FE8D30E3
1 changed files with 2 additions and 2 deletions

View File

@ -4,7 +4,7 @@
* 文章相关函数
* @author Seaton Jiang <hi@seatonjiang.com>
* @license GPL-3.0 License
* @version 2022.05.01
* @version 2022.11.27
*/
// 文章链接添加 target 和 rel
@ -12,7 +12,7 @@ function content_nofollow($content)
{
$regexp = "<a\s[^>]*href=['\"][^#]([^'\"]*?)\\1[^>]*>";
if (preg_match_all("/$regexp/siU", $content, $matches, PREG_SET_ORDER)) {
if (!empty($matches)) {
if (!empty($matches) && !empty(get_option('siteurl'))) {
$srcUrl = get_option('siteurl');
for ($i = 0; $i < count($matches); $i++) {
$tag = $matches[$i][0];