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

Commit 01f0acd

Browse files
authored
Merge pull request #199 from dshanske/follow
Follow
2 parents 1e79d9e + ed8aa46 commit 01f0acd

10 files changed

+130
-23
lines changed

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
**Requires at least:** 4.8.2
66
**Requires PHP:** 5.4
77
**Tested up to:** 4.9.7
8-
**Stable tag:** 3.8.0
8+
**Stable tag:** 3.8.1
99
**License:** MIT
1010
**License URI:** http://opensource.org/licenses/MIT
1111

@@ -46,6 +46,7 @@ The IndieWeb community defines several types of feedback:
4646
* Listen: <http://indieweb.org/listen>
4747
* Watch: <http://indieweb.org/watch>
4848
* Read: <http://indieweb.org/read>
49+
* Follow: <http://indieweb.org/follow>
4950
* Classic "Mentions": <http://indieweb.org/mentions>
5051

5152
### How do I extend this plugin? ###
@@ -85,6 +86,12 @@ The plugin uses a locally cached version of the mystery icon normally provided b
8586

8687
Project actively developed on Github at [pfefferle/wordpress-semantic-linkbacks](https://github.com/pfefferle/wordpress-semantic-linkbacks). Please file support issues there.
8788

89+
### 3.8.1 ###
90+
* Add follow post as type
91+
* Add warning to settings page if php-mbstring not installed
92+
* Return false in Emoji function if php-mbstring not installed
93+
* Add approve link to emails sent
94+
8895
### 3.8.0 ###
8996

9097
* Add locally hosted copy of the mystery man icon and serve it if there is no gravatar

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"require": {
1616
"php": ">=5.3.0",
1717
"composer/installers": "~1.0",
18-
"mf2/mf2": "^0.4.2",
18+
"mf2/mf2": "^0.4.3",
1919
"p3k/emoji-detector": "^0.2.0"
2020
},
2121
"require-dev": {

composer.lock

Lines changed: 68 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

includes/class-linkbacks-handler.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,9 @@ public static function get_comment_type_excerpts() {
299299
'watch' => __( '%1$s <strong>watched</strong> %2$s (via <a href="%3$s">%4$s</a>).', 'semantic-linkbacks' ),
300300
// translators: Name verb on domain
301301
'read' => __( '%1$s <strong>read</strong> %2$s (via <a href="%3$s">%4$s</a>).', 'semantic-linkbacks' ),
302+
// translators: Name verb on domain
303+
'follow' => __( '%1$s <strong>followed</strong> %2$s (via <a href="%3$s">%4$s</a>).', 'semantic-linkbacks' ),
304+
302305
);
303306

304307
return $strings;
@@ -329,6 +332,7 @@ public static function get_comment_type_strings( $type = null ) {
329332
'listen' => __( 'Listen', 'semantic-linkbacks' ),
330333
'watch' => __( 'Watch', 'semantic-linkbacks' ),
331334
'read' => __( 'Read', 'semantic-linkbacks' ),
335+
'follow' => __( 'Follow', 'semantic-linkbacks' ),
332336
'reacji' => __( 'Reacji', 'semantic-linkbacks' )
333337
);
334338
if ( ! $type ) {
@@ -653,6 +657,7 @@ public static function comment_class( $classes, $class, $comment_id, $post_id )
653657
'listen' => array( 'u-listen' ),
654658
'read' => array( 'u-read' ),
655659
'watch' => array( 'u-watch' ),
660+
'follow' => array( 'u-follow' ),
656661
);
657662

658663
$semantic_linkbacks_type = self::get_type( $comment );

includes/class-linkbacks-mf2-handler.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,13 @@ public static function get_class_mapper() {
9898
$class_mapper['watch-of'] = 'watch';
9999
$class_mapper['watch'] = 'watch';
100100

101+
/*
102+
* follow
103+
* @link http://indieweb.org/follow
104+
*/
105+
$class_mapper['follow-of'] = 'follow';
106+
107+
101108
return apply_filters( 'semantic_linkbacks_microformats_class_mapper', $class_mapper );
102109
}
103110

includes/class-linkbacks-notifications.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public static function init() {
2323
if ( WP_DEBUG ) {
2424
// For testing outgoing comment email
2525
add_filter( 'bulk_actions-edit-comments', array( 'Linkbacks_Notifications', 'register_bulk_send' ) );
26-
add_filter( 'handle_bulk_actions-edit-comments', array( 'Linkbacks_Notifications', 'bulk_send_Notifications' ), 10, 3 );
26+
add_filter( 'handle_bulk_actions-edit-comments', array( 'Linkbacks_Notifications', 'bulk_send_notifications' ), 10, 3 );
2727
}
2828
}
2929

@@ -45,7 +45,7 @@ public static function register_bulk_send( $bulk_actions ) {
4545
/**
4646
* Handle Bulk Send Outgoing EMail
4747
*/
48-
public static function bulk_send_Notifications( $redirect_to, $doaction, $comment_ids ) {
48+
public static function bulk_send_notifications( $redirect_to, $doaction, $comment_ids ) {
4949
if ( ! in_array( $doaction, array( 'resend_notification_email', 'resend_moderation_email', 'send_pushover_text' ), true ) ) {
5050
return $redirect_to;
5151
}
@@ -77,6 +77,7 @@ public static function bulk_send_Notifications( $redirect_to, $doaction, $commen
7777
*/
7878
public static function comment_notification_text( $notify_message, $comment_id ) {
7979
$comment = get_comment( $comment_id );
80+
$post = get_post( $comment->comment_post_ID );
8081
if ( ! Linkbacks_Handler::get_type( $comment ) ) {
8182
return $notify_message;
8283
}
@@ -88,7 +89,7 @@ public static function comment_notification_text( $notify_message, $comment_id )
8889
return $notify_message;
8990

9091
}
91-
92+
9293
/**
9394
* Generate the moderation text
9495
*
@@ -97,9 +98,11 @@ public static function comment_notification_text( $notify_message, $comment_id )
9798
*/
9899
public static function moderate_text( $comment ) {
99100
$comment = get_comment( $comment );
101+
/* translators: Comment moderation. 1: Comment action URL */
102+
$message = sprintf( __( 'Approve it: %s', 'semantic-linkbacks' ), admin_url( "comment.php?action=approve&c={$comment_id}#wpbody-content" ) ) . "\r\n";
100103
if ( EMPTY_TRASH_DAYS ) {
101104
/* translators: Trash it URL */
102-
$message = sprintf( __( 'Trash it: %s', 'semantic-linkbacks' ), admin_url( "comment.php?action=trash&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";
105+
$message .= sprintf( __( 'Trash it: %s', 'semantic-linkbacks' ), admin_url( "comment.php?action=trash&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";
103106
} else {
104107
/* translators: Delete it URL */
105108
$message .= sprintf( __( 'Delete it: %s', 'semantic-linkbacks' ), admin_url( "comment.php?action=delete&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";
@@ -108,7 +111,7 @@ public static function moderate_text( $comment ) {
108111
$message .= sprintf( __( 'Spam it: %s', 'semantic-linkbacks' ), admin_url( "comment.php?action=spam&c={$comment->comment_ID}#wpbody-content" ) ) . "\r\n";
109112
return $message;
110113
}
111-
114+
112115
/**
113116
* Filter the comment notification subject
114117
*

includes/class-linkbacks-walker-comment.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ protected static function get_comment_author_link( $comment_id = 0 ) {
5353
}
5454

5555
protected static function is_reaction( $comment ) {
56+
// If this library is not installed then emoji detection will not work
57+
if ( ! function_exists( 'mb_internal_encoding' ) ) {
58+
return false;
59+
}
5660
return Emoji\is_single_emoji( trim( wp_strip_all_tags( $comment->comment_content ) ) ) && empty( $comment->comment_parent );
5761
}
5862

readme.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Tags: webmention, pingback, trackback, linkback, microformats, comments, indiewe
55
Requires at least: 4.8.2
66
Requires PHP: 5.4
77
Tested up to: 4.9.7
8-
Stable tag: 3.8.0
8+
Stable tag: 3.8.1
99
License: MIT
1010
License URI: http://opensource.org/licenses/MIT
1111

@@ -46,6 +46,7 @@ The IndieWeb community defines several types of feedback:
4646
* Listen: <http://indieweb.org/listen>
4747
* Watch: <http://indieweb.org/watch>
4848
* Read: <http://indieweb.org/read>
49+
* Follow: <http://indieweb.org/follow>
4950
* Classic "Mentions": <http://indieweb.org/mentions>
5051

5152
= How do I extend this plugin? =
@@ -85,6 +86,12 @@ The plugin uses a locally cached version of the mystery icon normally provided b
8586

8687
Project actively developed on Github at [pfefferle/wordpress-semantic-linkbacks](https://github.com/pfefferle/wordpress-semantic-linkbacks). Please file support issues there.
8788

89+
= 3.8.1 =
90+
* Add follow post as type
91+
* Add warning to settings page if php-mbstring not installed
92+
* Return false in Emoji function if php-mbstring not installed
93+
* Add approve link to emails sent
94+
8895
= 3.8.0 =
8996

9097
* Add locally hosted copy of the mystery man icon and serve it if there is no gravatar

semantic-linkbacks.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* Description: Semantic Linkbacks for WebMentions, Trackbacks and Pingbacks
66
* Author: Matthias Pfefferle
77
* Author URI: https://notiz.blog/
8-
* Version: 3.8.0
8+
* Version: 3.8.1
99
* License: MIT
1010
* License URI: http://opensource.org/licenses/MIT
1111
* Text Domain: semantic-linkbacks
@@ -23,7 +23,7 @@
2323
* @author Matthias Pfefferle
2424
*/
2525
class Semantic_Linkbacks_Plugin {
26-
public static $version = '3.8.0';
26+
public static $version = '3.8.1';
2727
/**
2828
* Initialize the plugin, registering WordPress hooks.
2929
*/
@@ -132,6 +132,12 @@ public static function plugin_textdomain() {
132132
*/
133133
public static function settings() {
134134
_e( 'For webmentions that do not have avatars you can pick from several locally served default avatars in the Discussion Settings', 'semantic-linkbacks' );
135+
136+
if ( ! function_exists( 'mb_internal_encoding' ) ) {
137+
?>
138+
<p class="notice notice-warning"><?php _e( 'This server does not have the php-mbstring package installed and Emoji reactions have been disabled.', 'semantic-linkbacks' ); ?></p>
139+
<?php
140+
}
135141
}
136142

137143
/**

templates/linkbacks.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,19 @@
116116
</div>
117117
<?php endif; ?>
118118

119-
119+
<?php if ( in_array( 'follow', $facepiles, true ) && has_linkbacks( 'follow' ) ) : ?>
120+
<div class="follows">
121+
<h3><?php echo __( 'Following', 'semantic-linkbacks' ); ?></h3>
122+
<?php
123+
list_linkbacks(
124+
array(
125+
'type' => 'follow',
126+
),
127+
get_linkbacks( 'follow' )
128+
);
129+
?>
130+
</div>
131+
<?php endif; ?>
120132

121133
<?php if ( in_array( 'watch', $facepiles, true ) && has_linkbacks( 'watch' ) ) : ?>
122134
<div class="watches">

0 commit comments

Comments
 (0)