Giter Club home page Giter Club logo

wordpress-semantic-linkbacks's Introduction

project status: inactive

The plugin was merged into the Webmention plugin.


Semantic-Linkbacks

Contributors: pfefferle, dshanske, edent
Donate link: https://notiz.blog/donate/
Tags: webmention, pingback, trackback, linkback, microformats, comments, indieweb
Requires at least: 4.9
Requires PHP: 5.6
Tested up to: 6.1
Stable tag: 3.11.3
License: MIT
License URI: http://opensource.org/licenses/MIT

Richer Comments and Linkbacks for WordPress!

Description

Generates richer WordPress comments from linkbacks such as Webmention or classic linkback protocols like Trackback or Pingback.

The limited display for trackbacks and linkbacks is replaced by a clean full sentence, such as "Bob mentioned this article on bob.com." If Bob's site uses markup that the plugin can interpret, it may add his profile picture or other parts of his page to display as a full comment. It will optionally show collections of profile pictures, known as Facepiles, instead of the full setences.

Semantic Linkbacks uses Microformats 2 to get information about the linked post and it is highly extensible to also add support for other forms of markup.

Privacy and Data Collection

This plugin collects data from sites that send webmentions for the purpose of displaying richer comments on a site. This data is under the control of the site owner. It is the personal responsibility of that individual or individuals to remove any information at the request of the original content creator. Over time, we will add additional tools to assist in doing so.

Frequently Asked Questions

Do I need to mark up my site?

Most modern WordPress themes support the older Microformats standard, which means the plugin should be able to get basic information from to enhance linkbacks. The plugin is most useful with the WordPress Webmention plugin and sites/themes that support Microformats 2.

Why Webmentions?

Webmention is a modern reimplementation of Pingback and is now a W3C Recommendation.

What about the semantic "comment" types?

The IndieWeb community defines several types of feedback:

How do I extend this plugin?

See Extensions

How do I add this into my plugin?

The plugin will automatically enhance webmentions, trackbacks, and pingbacks with an avatar and additional context. It will also automatically add a facepile instead of individual comments, but this feature can either be turned off by an aware theme or under Discussion in your Settings.

Why do some emoji reactions not show up?

Some emoji characters in webmentions you might receive, e.g. Facebook reactions from Bridgy, take more than two bytes to encode. (In technical terms, these Unicode characters are above the Basic Multilingual Plane.) To handle them, you need MySQL 5.5.3 or higher, and your database and tables need to use the utf8mb4 charset. Usually WordPress does this automatically, but not always.

First, follow these instructions to switch your MySQL database to utf8mb4. Then, make sure DB_CHARSET and DB_COLLATE in your wp-config.php are either unset, set to the blank string, or set to these values:

define('DB_CHARSET', 'utf8mb4');
define('DB_COLLATE', 'utf8mb4_general_ci');

Who made the logos?

The Webmention and Pingback logos are made by Aaron Parecki and the Microformats logo is made by Dan Cederholm.

Why are you providing avatars?

The plugin attempts to store the URL to an actual profile image on the source site. The default avatar set by WordPress is only used if there is no such image found.

Even the WordPress default avatars are served by querying Gravatar.com which serves the file. Gravatar works by you providing an email address which it uses to match the image. The majority of linkbacks enhanced by this plugin do not have email addresses therefore we know that gravatar will not have anything on file.

If there is no email address it will serve the local avatar. If there is an email, it will go out to gravatar.com and see if they have a gravatar on file. If there is it will store the gravatar URL, otherwise it will store the URL for the local avatar if set.

The plugin uses a locally cached version of the mystery icon normally provided by WordPress and Gravatar.

Changelog

Project actively developed on Github at pfefferle/wordpress-semantic-linkbacks. Please file support issues there.

3.11.3

  • Deactivate itself if Webmention Version is 5.0.0 or above

3.11.2

  • Fix array access issue
  • Fix coding standards

3.11.1

  • Fix HTML issue

3.11.0

3.10.4

  • Whitelist vendor folder

3.10.3

3.10.2

  • Fix default value of semantic_linkbacks_facepiles (props @prtksxna)

3.10.1

  • Fix load issues with Webmention vs Semantic Linkbacks

3.10.0

  • Use Webmentions avatar-handler if available

3.9.3

3.9.2

  • Only load MF2 parser inside parsing function to ensure bundled version is loaded
  • Update development dependencies

3.9.1

  • Quick fix facepile problem id comments are closed

3.9.0

  • Support rel-alternate (mf2-json)
  • New php-mf2 version

3.8.1

  • Add follow post as type
  • Add warning to settings page if php-mbstring not installed
  • Return false in Emoji function if php-mbstring not installed
  • Add approve link to emails sent

3.8.0

  • Add locally hosted copy of the mystery man icon and serve it if there is no gravatar
  • Redo settings and settings page
  • Settings page to merge with Webmentions page if webmentions loaded

3.7.7

  • Add read type
  • Capture read-status if available
  • Change string as previous tense was off

3.7.6

  • Update Parser to version 0.4.3
  • Introduce watch and listen properties

3.7.5

  • fixed Reacji UI ((#154)[#154])

3.7.4

  • Replace rsvp-invite property which is not in use with invite property and add unit tests
  • Enhance post type returns to include post, page, and sitename
  • Add basic person tagging support

3.7.3

  • Replace tracking with interested property as noted on https://indieweb.org/rsvp
  • Remove h-as properties
  • Remove hard-coded microformats2 properties from facepile and move them to being generated from comment_class
  • Remove unused properties
  • Introduce type argument in list_linkbacks to generate unique ideas for each list of linkbacks without having to specify them using style and li-class
  • Whitelist property swarm-coins, used by OwnYourSwarm and display it if using built-in comment handler.

3.7.2

  • Bugfix: "Normal comments" hidden in comment-section (#140)

3.7.1

  • Fixed reacjis and facepiles

3.7.0

  • Add settings to enable each type independently in the Facepile
  • Optionally render mentions as normal comments again
  • Support Reacji...aka single-emoji reactions
  • Bump minimum PHP to 5.4 due emoji detector library dependency issues
  • Overlay emoji on individual avatars in reactions facepile
  • Offer mf2 compatible template for comments
  • Fix semantic_linkbacks_cite filter as was previously filtering the entire comment text
  • Switch semantic_links_cite filter to filtering the format for the citation instead of the prepared citation
  • Count correct text length for unicode characters
  • Facepile Template improvements
  • Allow new comment template to be overridden by filter or theme declaring microformats2 support
  • Code standards compliance changes
  • Improved testing for PHP versions 5.4 and up to ensure compatibility
  • Remove direct calls to comment meta in favor of helper functions to ensure future proofing

3.6.0

  • Only show the first 8 avatars in a facepile by default. If there are more, include a clickable ellipsis to show the rest. Customizable via the FACEPILE_FOLD_LIMIT constant.
  • Link facepile avatars to user profile/home page, not response post
  • Always show avatar images with correct aspect ratio

3.5.1

  • Bugfix release

3.5.0

  • Add Facepile code
  • Add setting to disable automatic facepile include
  • Add filter to allow themes to disable the setting and the feature if they facepile themselves
  • Add PHP requirement to readme file

3.4.1

  • Abstract out linkback retrieval functions to allow for easier changes in future
  • Fix retrieval issue
  • Remove merge and compatibility function creating double slashing due update in 4.7.1
  • Replace blacklist for properties with whitelist for select properties
  • Update avatar function to not override if user_id is set on assumption local overrides remote

3.4.0

  • Fix Tests and Error in Authorship
  • Update Parser
  • Switch to looser restrictions if WP_DEBUG is enabled and stricter ones otherwise
  • Enhance Author Properties to allow for retrieving remote h-card
  • Store mf2 properties
  • Store location in WordPress Geodata
  • Use rel-syndication if not u-syndication
  • Support new webmention source meta key

3.3.1

3.3.0

  • Due to changes in WordPress 4.4 through 4.7 and version 3.0.0 of the Webmentions plugin this plugin can act on the retrieved remote source rather than rerequesting this information.
  • Major enhancement work is done in preprocessing now rather than post-processing
  • Refactoring
  • Render full mention content if short enough. Introduce MAX_INLINE_MENTION_LENGTH which defaults to 300 characters to implement same.
  • Fix text domain

3.2.1

  • updated hooks/filters

3.2.0

  • changed hook from <linkback>_post to comment_post (thanks to @dshanske)
  • used the WordPress Coding Standard
  • small code improvements

3.1.0

  • I18n support
  • German translation
  • some small changes and bugfixes

3.0.5

  • quick fix to prevent crash if Mf2 lib is used by a second plugin

3.0.4

  • added counter functions for comments by type (props to David Shanske)
  • some bugfixes

3.0.3

  • some small tweaks
  • added custom comment classes based on the linkback-type (props to David Shanske for the idea)

3.0.2

  • added support for threaded comments

3.0.1

  • fixed bug in comments section

3.0.0

  • nicer integration with trackbacks, linkbacks and webmentions
  • cleanup

2.0.1

  • "via" links for indieweb "reply"s (thanks to @snarfed for the idea)
  • simplified output for all other indieweb "comment" types
  • better parser (thanks to voxpelly for his test-pinger)
  • now ready to use in a bundle

2.0.0

  • initial release

Thanks to

Installation

  1. Upload the semantic-linkbacks-folder to the /wp-content/plugins/ directory
  2. Activate the plugin through the Plugins menu in WordPress
  3. ...and that's it :)

wordpress-semantic-linkbacks's People

Contributors

acegiak avatar chrisbergr avatar colin-walker avatar dependabot[bot] avatar dshanske avatar edent avatar florianbrinkmann avatar greatestview avatar jackysee avatar lostfocus avatar milindmore22 avatar pfefferle avatar prtksxna avatar raamdev avatar snarfed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wordpress-semantic-linkbacks's Issues

Use site icon if no hcard image

Especially now that WordPress has implemented them, what about adding the site icon as an avatar if no hcard/uphoto can be found?

Deduplication

Find a way to identify and merge the original reply and its POSSE copy. Check for duplicate text for comments on the same post, check for u-syndication....

Rerun on Update

Linkback Fix should be rerun on update comment by being added to the edit comment hook.

Update to Latest Version of Parser

The commit log shows the parser version dates from 2013. The commits on php-mf2 show there have been a lot of enhancements since then.

Comment Notification Presentation

WordPress has a series of filters off its wp_notify_postauthor function to customize that presentation.

https://developer.wordpress.org/reference/functions/wp_notify_postauthor/#source-code

When I receive a notification of a comment generated through a combination of Bridgy and Semantic Linkbacks, it looks something like this...

Author: Bridgy Response (IP: 107.178.195.220, 220.195.178.107.gae.googleusercontent.com)
E-mail:
URL: https://brid-gy.appspot.com/like/facebook/100002356503167/858841630871046/10154036849115445
Whois: http://whois.arin.net/rest/ip/107.178.195.220
Comment:
This Article was mentioned on brid-gy.appspot.com

It should be trivial to use the same presentation logic to make the notification readable.

Notification mails messed up since last release

Since the last release, the notification mails sent by Wordpress are compelete messed up. As the blog admin, I get empty mails like this:

Ein neuer Kommentar zum Beitrag „“ wartet auf deine Freigabe

Autor: (IP: , )
E-Mail:
URL:
Kommentar:

while the post author gets mails that contain the entire article in the "Comment:" field ("Kommentar" in the above quote). With the previous version, notifications worked fine.

Identify mystery man

Some people do not have a Twitter, Facebook, etc icon. Is there a way to identify this and remove the image entirely?

brid.gy "likes" end up as type="mention" in wp_commentmeta semantic_linkbacks_type

(maybe related to #54)

Hi,

I'd love to get a hint on where to look for the right place where the plugin's code decides which semantic_linkbacks_type is stored in wp_commentmeta table. It seems that in my install it'll fallback to the generic "mention" when it recives a webmention from brid.gy.
Here's a log from brid.gy:

2016-05-26 10:07:08.268750 D Params: NestedMultiDict([('response_key', u'aglzfmJy...')])
2016-05-26 10:07:08.523300 I Source: webrocker (Twitter) webrocker, http://brid-gy.appspot.com/twitter/webrocker
2016-05-26 10:07:08.523920 I Created by this poll: http://brid-gy.appspot.com/log?start_time=1464257167&key=aglzfmJyaWQtZ3lyFgsSB1R3aXR0ZXIiCXdlYnJvY2tlcgw
2016-05-26 10:07:08.524730 I Starting Response like tag:twitter.com,2013:735747260508602368_favorited_by_205651658 https://twitter.com/webrocker/status/735747260508602368#favorited-by-205651658
2016-05-26 10:07:08.556630 I Webmention from https://brid-gy.appspot.com/like/twitter/webrocker/735747260508602368/205651658 to https://www.webrocker.de/?p=24638
2016-05-26 10:07:08.616720 I Using cached webmention endpoint u'W https webrocker.de': https://www.webrocker.de/blog/?webmention=endpoint
2016-05-26 10:07:08.617180 I Sending...
2016-05-26 10:07:11.340670 I Sent! {'body': u'array(19) {\n ["comment_ID"]=>\n string(4) "7788"\n ["comment_post_ID"]=>\n string(5) "24638"\n ["comment_author"]=>\n string(13) "Holger Bartel"\n ["comment_author_email"]=>\n string(0) ""\n ["comment_author_url"]=>\n string(79) "https://brid-gy.appspot.com/like/twitter/webrocker/735747260508602368/205651658"\n ["comment_author_IP"]=>\n string(15) "107.178.195.139"\n ["comment_date"]=>\n string(19) "2016-05-26 12:07:10"\n ["comment_date_gmt"]=>\n string(19) "2016-05-26 10:07:10"\n ["comment_content"]=>\n string(158) "This Article was mentioned on <a href="https://brid-gy.appspot.com/like/twitter/webrocker/735747260508602368/205651658" rel="nofollow">brid-gy.appspot.com</a>"\n ["comment_karma"]=>\n string(1) "0"\n ["comment_approved"]=>\n string(1) "0"\n ["comment_agent"]=>\n string(102) "Bridgy (https://brid.gy/about) AppEngine-Google; (+http://code.google.com/appengine; appid: s~brid-gy)"\n ["comment_type"]=>\n string(10) "webmention"\n ["comment_parent"]=>\n string(1) "0"\n ["user_id"]=>\n string(1) "0"\n ["children"]=>\n NULL\n ["populated_children"]=>\n bool(false)\n ["post_fields"]=>\n array(21) {\n [0]=>\n string(11) "post_author"\n [1]=>\n string(9) "post_date"\n [2]=>\n string(13) "post_date_gmt"\n [3]=>\n string(12) "post_content"\n [4]=>\n string(10) "post_title"\n [5]=>\n string(12) "post_excerpt"\n [6]=>\n string(11) "post_status"\n [7]=>\n string(14) "comment_status"\n [8]=>\n string(11) "ping_status"\n [9]=>\n string(9) "post_name"\n [10]=>\n string(7) "to_ping"\n [11]=>\n string(6) "pinged"\n [12]=>\n string(13) "post_modified"\n [13]=>\n string(17) "post_modified_gmt"\n [14]=>\n string(21) "post_content_filtered"\n [15]=>\n string(11) "post_parent"\n [16]=>\n string(4) "guid"\n [17]=>\n string(10) "menu_order"\n [18]=>\n string(9) "post_type"\n [19]=>\n string(14) "post_mime_type"\n [20]=>\n string(13) "comment_count"\n }\n ["comment_subscribe"]=>\n string(1) "N"\n}\nhttps://twitter.com/webrocker/status/735747260508602368#favorited-by-205651658', 'request': u'POST https://www.webrocker.de/blog/?webmention=endpoint (with source=https://brid-gy.appspot.com/like/twitter/webrocker/735747260508602368/205651658, target=https://www.webrocker.de/?p=24638)', 'http_status': 200}
2016-05-26 10:07:11.434250 I Setting last_webmention_sent

The way I see this, there are two possible indicators that this is a "like":
The webmention source contains /like/ in the URL, or the fragment-Identifier "#favorited-by-205651658"

I'm looking through the sematic-linkbacks.php source, but I don't see/understand where the comment meta data for semantic_linkbacks_type first gets set - all I see are the instances where checks run against this meta data (and a fallback to "mention" inside the comment_text_excerpt function).

When I receive the mention from the log above, it gets stored as "mention". When I change this manually in the database to "like", the display is fine. But somehow the Twitter "likes" via brid.gy end up as "mention".

Last comment stored and displayes as 'mention':
bridgy1sl
Last comment stored and displayes as 'like', manually changed in db:
bridgy2sl

Is the semantic_linkbacks_commentdatafilter (line 141) the right place to hook into for that?
I'm also wondering where the commentdata['_type'] (line 149) is set, if any ?

So first and foremost thanks for the plugin and then thanks in advance for any hints :-)
Tom

Use url_to_postid instead of text comparison for in-reply-to

Instead of checking that the in-reply-to links link to the exact permalink of the post the comment is on, I propose instead checking if the post_ID we get from url_to_postid on the in-reply-to link matches the local post_ID -- this would allow for more flexibility for the format of the link on the remote (eg, both ?p= and rewrite forms would work).

Support for bookmark linkback type

Tangentially related to #75, but it appears that "mention", "like", and "reply" are supported natively, but not "bookmark"?

So for example, the comment display will default to X "mentioned" post or Y "liked" post on service z, But would/could it say X "bookmarked" this post, particularly if the originating post had u-bookmark-of? I would presume that it would potentially have semantic_linkbacks_type be "bookmark" rather than "mention" or "reply" perhaps? And then that this could potentially be edited if the sending post wasn't carrying the correct mf2 class?

Example: http://boffosocko.com/2017/01/27/my-reply-to-micro-blog-project-surges-past-65k-on-kickstarter-gains-backing-from-dreamhost-wordpress-tavern/#comment-33624 which is a bookmark of the post technically rather than a simple mention, so it would be nice if it output "X bookmarked this post" in the comments in a parallel way as mentions and likes.

Include Test File

Proposing we include a WordPress import file that will add a post with the various types to add to the database to test styling.

Parse Elements of Source URL and save as Comment Meta

I wanted to open the topic of storing additional data from the source URL as comment meta.

Things such as a summary, site name, language(it's in the pingback spec), featured image(if we can find one)... not sure what else might be relevant.

for mentions, show full content text if it's small enough

currently, mentions are rendered as:

X mentioned this post on [domain].

...which is fine, but if the mention post is a note and/or its content text is short enough - say, < 140 chars :P - it'd be nice to show the content text inline.

motivated by snarfed/bridgy#456, which now searches twitter and google+ for other people's posts that link to your site and sending them as mentions.

salmentions!

@acegiak has done awesome work implementing the salmention prototype in the upstream repo. it sounds like it might not be polished enough to merge in here, but i'd love to see that happen eventually. pretty please with sugar on top!

Excerpt Uses Post Format

The excerpt uses Post Format. Which means if you don't use Post Format, all excerpts will use "Article"

I would want to use Post Kinds, but there is no easy way to change just the format.

Only Support Updates for Webmentions

The pingback and trackback specifications do not allow for updates. The code specifically returns an error on duplicate pings.

The enhancement code should therefore only be run on the creation of a new comment or the updating of a webmention type only.

Thoughts?

Change Avatar Behavior

The changes to the get_avatar function in 4.1-4.2 allow for a better way to override the behavior of get_avatar with new filters/hooks.

I'm going to see about submitting a pull request to alter this to keep up with same.

Filter classes

Thinking of writing this, but wanted some thoughts on it. What about adding to the comment_class filter to add css classes to the displayed comments regardless of theme?

Does this make sense?

Preprocess Comment

I just noticed this changed in 4.4.

https://developer.wordpress.org/reference/functions/wp_insert_comment/

If comment meta is provided in an array to wp_insert_comment, it will store it. I had asked for something like this during the 4.4 cycle. Not sure how it slipped past me.

But this means we might be able to fix the problem discussed in #39 by splitting the work to be done. Opening this issue, though I might explore this myself.

unhappy with unicode content (e.g. reacji)

unicode chars in content like reacji have worked for me before, e.g. https://snarfed.org/2016-08-27_18491#comment-2600432 , but they're now rendered as This Article was mentioned on brid-gy.appspot.com, e.g. https://snarfed.org/2016-11-09_22762#comment-2601735 .

i've tried a few different versions, including current stable release and git head here.

i've tracked it down to this wp_update_comment call. $commentdata['comment_content'] has the right unicode content, e.g. 😢, but the wp_update_comment call returns 0 instead of 1, which the docs say means it failed.

i can post comments manually with that same character, and they render ok, so i don't think it's wordpress's or mysql's fault. i've reproduced on wordpress 4.6.1 on both freebsd (mysql 14.14 5.6.23) and mac os x (mysql 14.14 5.7.14).

thanks in advance!

Reacji

https://indieweb.org/reacji#How_to

Bridgy is now displaying Facebook Reactions. Since they are coded as in-reply-to, the plugin displays them as a reply, which means comment form. I'd rather have them remain as webmention types, and allow them to be grouped together.

when source contains both semantic link and mention, prioritize semantic link

i recently ran into this when all of the bridgy webmentions on a post of mine showed up as plain mentions instead of favorites, retweets, etc: https://snarfed.org/2015-03-07_huffduff-video

in this specific case, the bridgy source mf2 for each response has both a mention link and a like/repost/etc link, e.g. https://brid-gy.appspot.com/repost/twitter/schnarfed/574460993398427649/574962900458205184 :

<div class="e-content">
RT <a href="https://twitter.com/schnarfed">@schnarfed</a>: huffduff-video lets you send @Huffduffer the audio from videos on YouTube, Vimeo, and more! snarfed.org/2015-03-07_huf… huffduff-video.snarfed.org
<a class="u-mention" href="https://snarfed.org/2015-03-07_huffduff-video"></a>
</div>
<a class="u-repost u-repost-of" href="https://twitter.com/schnarfed/status/574460993398427649"></a>

when the plugin handles this mf2, it sees the u-mention link first, so it stores semantic_linkbacks_type = mention in wp_commentmeta and the wordpress comment gets rendered as a mention. if i remove the mention link and resend the webmention, it sees the u-repost-of link and correctly stores semantic_linkbacks_type = repost.

it should probably instead look at all of the links to target in the mf2, and if any of them are semantic, those should be prioritized over mention, right?

thanks in advance! cc @dshanske

Like are being classified as mentions

Example: http://david.shanske.com/notes/2014/06/03/view/

The Mentions are this were sent as Facebook likes.

However, on this previous post, a Facebook like was classified correctly

http://david.shanske.com/notes/2014/05/29/going-somewhere-scenic/

The only difference I see is the comment text. On the 5/29 post, it was Liked this Aside. On 6/03, it was mentioned this image.

Here is one of the falsely classified from Bridgy
https://brid-gy.appspot.com/like/facebook/100002356503167/650586338363244/504759760

Avatar Markup

The get_avatar function returns class photo, it should also return class u-photo for mf2 compliance.

Functions to Support Semantics

Plugin needs some standard functions to be called by other plugins, themes. For example....

get_webmention_type_count($post_id, $type) - Return the count for a type of webmention for the current or specific post

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.