From b5e0e85f5d325664bd1b3d6d1bd17efa50017644 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sun, 21 Apr 2024 00:28:16 -0700 Subject: feat: Add options to include noreferrer and noopener in links - ‘noreferrer’ prevents the Referer header from being sent to the server the link points at when the link is clicked on. - ‘noopener’ prevents the ‘window.opener’ property from being set when the link is clicked on. --- data/config.default.php | 13 +++++++++++++ data/templates/sscuttlizr/bookmarks.tpl.php | 12 ++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/data/config.default.php b/data/config.default.php index bb9eddb..4679196 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -363,6 +363,19 @@ $longdate = 'j F Y'; */ $nofollow = true; +/** + * Include rel="noreferer" attribute on bookmark links to prevent them from + * specifying your site as the one that referred to the page. + */ +$noreferrer = true; + +/** + * Include rel="noopener" attribute on bookmark links to prevent them from + * giving the opening page access to your site through the window.opener + * property. + */ +$noopener = true; + /** * Default number of bookmarks per page. * -1 means no limit. diff --git a/data/templates/sscuttlizr/bookmarks.tpl.php b/data/templates/sscuttlizr/bookmarks.tpl.php index 1510d44..41b5975 100644 --- a/data/templates/sscuttlizr/bookmarks.tpl.php +++ b/data/templates/sscuttlizr/bookmarks.tpl.php @@ -415,8 +415,14 @@ if ($currenttag!= '') { // Nofollow option $rel = ''; if ($GLOBALS['nofollow']) { - $rel = ' rel="nofollow"'; + $rel .= ' nofollow '; } + if ($GLOBALS['noreferrer']) { + $rel .= ' noreferrer '; + } + if ($GLOBALS['noopener']) { + $rel .= ' noopener '; + } $address = $row['bAddress']; $oaddress = $address; @@ -465,7 +471,9 @@ if ($currenttag!= '') { echo ' ' . "\n"; echo ' \n"; if ($row['bDescription'] == '') { -- cgit v1.2.3-54-g00ecf From 11a00b0acca4b2bde45e7ed406a89e0e16e5663a Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Sun, 21 Apr 2024 00:28:51 -0700 Subject: feat: Add option to make all links open in a new window --- data/config.default.php | 5 +++++ data/templates/sscuttlizr/bookmarks.tpl.php | 1 + 2 files changed, 6 insertions(+) diff --git a/data/config.default.php b/data/config.default.php index 4679196..791eb7a 100644 --- a/data/config.default.php +++ b/data/config.default.php @@ -376,6 +376,11 @@ $noreferrer = true; */ $noopener = true; +/** + * Include target="_blank" to open links in a new window or tab. + */ +$openLinksInNewWindow = false; + /** * Default number of bookmarks per page. * -1 means no limit. diff --git a/data/templates/sscuttlizr/bookmarks.tpl.php b/data/templates/sscuttlizr/bookmarks.tpl.php index 41b5975..217043c 100644 --- a/data/templates/sscuttlizr/bookmarks.tpl.php +++ b/data/templates/sscuttlizr/bookmarks.tpl.php @@ -473,6 +473,7 @@ if ($currenttag!= '') { echo ' \n"; -- cgit v1.2.3-54-g00ecf