mirror of https://github.com/vtrois/kratos
fix: content nofollow (#335)
parent
9994ec7a48
commit
94d8289820
|
@ -3,13 +3,13 @@
|
|||
* 文章相关函数
|
||||
* @author Seaton Jiang <seaton@vtrois.com>
|
||||
* @license MIT License
|
||||
* @version 2021.01.06
|
||||
* @version 2021.02.18
|
||||
*/
|
||||
|
||||
// 文章链接添加 target 和 rel
|
||||
function imgnofollow($content)
|
||||
function content_nofollow($content)
|
||||
{
|
||||
$regexp = "<a\s[^>]*href=(\"??)([^\" >]*?)\\1[^>]*>";
|
||||
$regexp = "<a\s[^>]*href=['\"][^#]([^'\"]*?)\\1[^>]*>";
|
||||
if (preg_match_all("/$regexp/siU", $content, $matches, PREG_SET_ORDER)) {
|
||||
if (!empty($matches)) {
|
||||
$srcUrl = get_option('siteurl');
|
||||
|
@ -42,7 +42,7 @@ function imgnofollow($content)
|
|||
$content = str_replace(']]>', ']]>', $content);
|
||||
return $content;
|
||||
}
|
||||
add_filter('the_content', 'imgnofollow');
|
||||
add_filter('the_content', 'content_nofollow');
|
||||
|
||||
// 文章点赞
|
||||
function love()
|
||||
|
|
Loading…
Reference in New Issue