Skip to content
This repository was archived by the owner on Apr 16, 2023. It is now read-only.

Commit 5667185

Browse files
committed
Merge branch 'develop'
2 parents 7f8d03b + 189739b commit 5667185

10 files changed

+185
-131
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
77

88
## [Unreleased]
99

10+
## [1.13.0] - 2020-05-28
11+
### Added
12+
* Added options for links relationship.
13+
1014
## [1.12.0] - 2020-05-27
1115
### Changed
1216
* Updated protocols from http to https
@@ -135,6 +139,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
135139
* First release of the plugin.
136140

137141
[Unreleased]: https://github.com/aldolat/pinboard-bookmarks/commits/develop
142+
[1.13.0]: https://github.com/aldolat/pinboard-bookmarks/compare/1.12.0...1.13.0
138143
[1.12.0]: https://github.com/aldolat/pinboard-bookmarks/compare/1.11.0...1.12.0
139144
[1.11.0]: https://github.com/aldolat/pinboard-bookmarks/compare/1.10.0...1.11.0
140145
[1.10.0]: https://github.com/aldolat/pinboard-bookmarks/compare/1.9.0...1.10.0

README.md

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,13 @@
22

33
![banner](https://ps.w.org/pinboard-bookmarks/assets/banner-772x250.png)
44

5-
[![version][version-badge]][CHANGELOG]
6-
[![requires][requires-badge]][README]
7-
[![tested][tested-badge]][README]
8-
[![requiresphp][requires-php]][README]
9-
[![license][license-badge]][LICENSE]
10-
115
**Contributors:** aldolat
126
**Donate link:** <http://dev.aldolat.it/projects/pinboard-bookmarks/>
137
**Tags:** pinboard, bookmarks, sidebar, widget, shortcode
148
**Requires at least:** 3.0
159
**Tested up to:** 5.4
1610
**Requires PHP:** 5.3
17-
**Stable tag:** 1.12.0
11+
**Stable tag:** 1.13.0
1812
**License:** GPLv3 or later
1913
**License URI:** <http://www.gnu.org/licenses/gpl-3.0.html>
2014

@@ -197,12 +191,3 @@ This section describes how to install the plugin and get it working.
197191
## Upgrade Notice ##
198192

199193
No upgrade notice.
200-
201-
[CHANGELOG]: ./CHANGELOG.md
202-
[LICENSE]: ./gpl-3.0.txt
203-
[README]: ./README.md
204-
[version-badge]: https://img.shields.io/badge/Version-1.10.0-blue.svg
205-
[requires-badge]: https://img.shields.io/badge/Requires_WordPress-3.0.0-green.svg
206-
[tested-badge]: https://img.shields.io/badge/Tested_up_to_WordPress-5.3.0-green.svg
207-
[requires-php]: https://img.shields.io/badge/Requires_PHP-5.3-purple.svg
208-
[license-badge]: https://img.shields.io/badge/License-GPLv3-ff69b4.svg

changelog.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
== Changelog ==
22

3+
= 1.13.0 =
4+
5+
* Added options for links relationship.
6+
37
= 1.12.0 =
48

59
* Updated protocols from http to https

inc/class-pinboard-bookmarks-widget.php

Lines changed: 46 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ public function update( $new_instance, $old_instance ) {
156156
$instance['display_arch_arr'] = isset( $new_instance['display_arch_arr'] ) ? true : false;
157157
$instance['new_tab'] = isset( $new_instance['new_tab'] ) ? true : false;
158158
$instance['nofollow'] = isset( $new_instance['nofollow'] ) ? true : false;
159+
$instance['noreferrer'] = isset( $new_instance['noreferrer'] ) ? true : false;
159160
$instance['items_order'] = pinboard_bookmarks_check_items( $new_instance['items_order'] );
160161
$instance['admin_only'] = isset( $new_instance['admin_only'] ) ? true : false;
161162
$instance['debug_options'] = isset( $new_instance['debug_options'] ) ? true : false;
@@ -267,7 +268,7 @@ public function form( $instance ) {
267268
'value' => 'instapaper',
268269
'desc' => esc_html__( 'Instapaper', 'pinboard-bookmarks' ),
269270
),
270-
'pinboard' => array(
271+
'pinboard' => array(
271272
'value' => 'pinboard',
272273
'desc' => esc_html__( 'Pinboard', 'pinboard-bookmarks' ),
273274
),
@@ -422,6 +423,7 @@ public function form( $instance ) {
422423
$instance['display_source']
423424
);
424425
?>
426+
425427
<h4><?php esc_html_e( 'Display site URL', 'pinboard-bookmarks' ); ?></h4>
426428

427429
<?php
@@ -501,6 +503,49 @@ public function form( $instance ) {
501503
);
502504
?>
503505

506+
<h4><?php esc_html_e( 'Links relationship', 'pinboard-bookmarks' ); ?></h4>
507+
508+
<?php
509+
// Open links in new tab.
510+
pinboard_bookmarks_form_checkbox(
511+
esc_html__( 'Open links in a new browser tab', 'pinboard-bookmarks' ),
512+
$this->get_field_id( 'new_tab' ),
513+
$this->get_field_name( 'new_tab' ),
514+
$instance['new_tab'],
515+
sprintf(
516+
// translators: the placeholder is the "noopener rel attribute.
517+
esc_html__( 'If activated, the rel attribute %s will be added.', 'pinboard-bookmarks' ),
518+
'<code>noopener</code>'
519+
)
520+
);
521+
522+
// No follow.
523+
pinboard_bookmarks_form_checkbox(
524+
// translators: %s is a rel attribute for links.
525+
sprintf( esc_html__( 'Add %s to links', 'pinboard-bookmarks' ), '<code>nofollow</code>' ),
526+
$this->get_field_id( 'nofollow' ),
527+
$this->get_field_name( 'nofollow' ),
528+
$instance['nofollow'],
529+
esc_html__( 'It will be added to all external links.', 'pinboard-bookmarks' )
530+
);
531+
532+
// No referrer.
533+
pinboard_bookmarks_form_checkbox(
534+
// translators: %s is a rel attribute for links.
535+
sprintf( esc_html__( 'Add %s to links', 'pinboard-bookmarks' ), '<code>noreferrer</code>' ),
536+
$this->get_field_id( 'noreferrer' ),
537+
$this->get_field_name( 'noreferrer' ),
538+
$instance['noreferrer'],
539+
esc_html__( 'It will be added to all external links.', 'pinboard-bookmarks' )
540+
);
541+
542+
printf(
543+
// translators: the placeholder is a link.
544+
esc_html__( 'For more information about links attributes, please visit %s.', 'pinbard-bookmarks' ),
545+
'<a rel="external noopener noreferrer nofollow" href="https://www.w3schools.com/tags/att_a_rel.asp" target="_blank">w3schools.com</a>'
546+
);
547+
?>
548+
504549
<h4><?php esc_html_e( 'Other options', 'pinboard-bookmarks' ); ?></h4>
505550

506551
<?php
@@ -530,24 +575,6 @@ public function form( $instance ) {
530575
$this->get_field_name( 'display_arrow' ),
531576
$instance['display_arrow']
532577
);
533-
534-
// Open links in new tab.
535-
pinboard_bookmarks_form_checkbox(
536-
esc_html__( 'Open links in a new browser tab', 'pinboard-bookmarks' ),
537-
$this->get_field_id( 'new_tab' ),
538-
$this->get_field_name( 'new_tab' ),
539-
$instance['new_tab']
540-
);
541-
542-
// No follow.
543-
pinboard_bookmarks_form_checkbox(
544-
// translators: %s is the nofollow.
545-
sprintf( esc_html__( 'Add %s to links', 'pinboard-bookmarks' ), '<code>nofollow</code>' ),
546-
$this->get_field_id( 'nofollow' ),
547-
$this->get_field_name( 'nofollow' ),
548-
$instance['nofollow'],
549-
esc_html__( 'It will be added to all external links.', 'pinboard-bookmarks' )
550-
);
551578
?>
552579

553580
<h4><?php esc_html_e( 'Displaying order', 'pinboard-bookmarks' ); ?></h4>

inc/pinboard-bookmarks-core.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ function get_pinboard_bookmarks_fetch_feed( $args ) {
8686
$display_arch_arr = $args['display_arch_arr'];
8787
$new_tab = $args['new_tab'];
8888
$nofollow = $args['nofollow'];
89+
$noreferrer = $args['noreferrer'];
8990
$items_order = $args['items_order'];
9091
$admin_only = $args['admin_only'];
9192
$debug_options = $args['debug_options'];
@@ -103,7 +104,7 @@ function get_pinboard_bookmarks_fetch_feed( $args ) {
103104
// Set up some variables.
104105
$display_arrow ? $arrow = '&nbsp;<span class="pinboard-bookmarks-arrow">&rarr;</span>' : $arrow = '';
105106
$new_tab ? $new_tab_link = ' target="_blank"' : $new_tab_link = '';
106-
$nofollow ? $rel_txt = ' rel="bookmark nofollow"' : $rel_txt = ' rel="bookmark"';
107+
$rel_txt = pinboard_bookmarks_get_rel_link( $new_tab, $nofollow, $noreferrer );
107108
if ( 400 < $quantity ) {
108109
$quantity = 400;
109110
}
@@ -273,7 +274,7 @@ function() use ( $time ) {
273274
// Original site URL.
274275
$site_part = '';
275276
if ( $display_site_url ) {
276-
$params = array(
277+
$params = array(
277278
'url' => $item->get_permalink(),
278279
'leave_domain' => $leave_domain,
279280
'site_url_text' => $site_url_text,

inc/pinboard-bookmarks-functions-init.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ function pinboard_bookmarks_get_defaults() {
8989
'display_arch_arr' => true,
9090
'new_tab' => false,
9191
'nofollow' => true,
92+
'noreferrer' => true,
9293
'items_order' => 'title site description date tags',
9394
'admin_only' => true,
9495
'debug_options' => false,

inc/pinboard-bookmarks-functions-items.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -635,3 +635,23 @@ function pinboard_bookmarks_get_site( $args ) {
635635

636636
return $output;
637637
}
638+
639+
/**
640+
* Get the rel HTML attribute for links.
641+
*
642+
* @param bool $new_tab Whether to open links in a new browser tab.
643+
* @param bool $nofollow Whether to use nofollow in rel attribute.
644+
* @param bool $noreferrer Whether to use noreferrer in rel attribute.
645+
* @return string $output The HTML rel attribute.
646+
*
647+
* @since 1.13.0
648+
*/
649+
function pinboard_bookmarks_get_rel_link( $new_tab, $nofollow, $noreferrer ) {
650+
$new_tab ? $noopener_attr = ' noopener' : $noopener_attr = '';
651+
$nofollow ? $nofollow_attr = ' nofollow' : $nofollow_attr = '';
652+
$noreferrer ? $noreferrer_attr = ' noreferrer' : $noreferrer_attr = '';
653+
654+
$output = ' rel="bookmark external' . $noopener_attr . $nofollow_attr . $noreferrer_attr . '"';
655+
656+
return $output;
657+
}

0 commit comments

Comments
 (0)