Áp dụng cho XenForo v1.1.2, các phiên khác cũng tương tự. Bạn vào đây: XenForo
v1.1.2/forum/library/XenForo/Helper
File làm việc: String.php ( XenForo v1.1.2/forum/library/XenForo/Helper/ String.php) tìm đoạn sau:
public static function getLinkClassTarget(url) { target = '_blank';
class = 'externalLink'; type = 'external';
urlInfo = @parse_url(url);
if (urlInfo) { $host = $urlInfo['host'] . (!empty($urlInfo['port']) ? ":$urlInfo[port]" : ''); if ($host == XenForo_Application::$host) { $target = ''; $class = 'internalLink'; $type = 'internal'; } } return array(class, target, type);
}
Và thay thế bằng đoạn sau:
public static function getLinkClassTarget(url) { target = '_blank';
$class = 'externalLink" rel="nofollow '; # Thêm vào rel="nofollow", lưu ý không có dấu " ở cuối cùng.
type = 'external'; urlInfo = @parse_url(url); if (urlInfo)
{
host = urlInfo['host'] . (!empty(urlInfo['port']) ? ":urlInfo[port]" : '');
if (host == XenForo_Application::host) # Đây là check tên miền đang sử dụng, không cần thay đổi.
{
target = ''; class = 'internalLink';
$type = 'internal';
}
# Đây là tùy biến, nếu bạn muốn cho phép 1 tên miền nào đó được Google theo link, và thêm target="_blank" để mở 1 cửa số mới.
$class = 'externalLink" rel="nofollow '; # Thêm vào rel="nofollow", lưu ý không có dấu " ở cuối cùng.
type = 'external'; urlInfo = @parse_url(url); if (urlInfo)
{
host = urlInfo['host'] . (!empty(urlInfo['port']) ? ":urlInfo[port]" : '');
if (host == XenForo_Application::host) # Đây là check tên miền đang sử dụng, không cần thay đổi.
{
target = ''; class = 'internalLink';
$type = 'internal';
}
# Đây là tùy biến, nếu bạn muốn cho phép 1 tên miền nào đó được Google theo link, và thêm target="_blank" để mở 1 cửa số mới.
if (host == "kenhdaihoc.com") { target = '_blank ';
class = 'internalLink'; type = 'internal';
}
}
return array(class, target, $type);
}
class = 'internalLink'; type = 'internal';
}
}
return array(class, target, $type);
}
Với các mã nguồn có phiên bản khác, bạn cũng tìm đoạn public static function getLinkClassTarget($url) và tiến hành giống như vậy.
Chúc bạn thành công.
Sưu tầm
0 nhận xét