GithubHelp home page GithubHelp logo

elgg-webmention's Introduction

Elgg WebMentions

This is an Elgg 1.8 plugin that provides a framework to add #indieweb webmention support to Elgg.

Plugin was created by Marcus Povey http://www.marcus-povey.co.uk

What are webmentions

Webmentions are a simpler and more up to date alternative to Pingback using standard web technologies.

Go here for more details: http://webmention.org/

Usage

Install and activate the plugin in the usual way.

Once activated the plugin will provide the following functionality:

  • It will listen to the create events of objects and, if the object's ->description contains URLs, it will attempt to send a webmention to it.
  • It exposes a webmention endpoint on http://yoursite.url/webmention/ (setting the appropriate header values).

In order for the webmention endpoint to be useful, plugin authors have to do a little bit more work:

  1. They must implement a listener for the getbyurl/object plugin hook. This hook is passed a permalink, and the plugin author should parse it, and return the appropriate object if a match is found:

e.g.

elgg_register_plugin_hook_handler('getbyurl', 'object', function($hook, $type, $return, $params) {
    
    global $CONFIG;

    if (preg_match("/".str_replace('/','\/', $CONFIG->wwwroot)."blog\/([0-9]*)/", $params['url'], $match))
        return get_entity((int)$match[1]);

});
  1. They must implement a handler for webmention/object hook. This hook is passed, among other things, the created object. The author must return true if the plugin handles that kind of object, e.g
elgg_register_plugin_hook_handler('webmention', 'object', function($hook, $type, $return, $params) {
    $source_url = $params['source'];
    $target_url = $params['target'];
    $object = $params['entity'];
    $title = $params['source_title'];
    $extract = $params['source_extract'];
    $content_raw = $params['source_content_raw']; 
    $microformat_data = $params['source_content_parsed'];

    if (elgg_instance_of($object, 'object', 'blog'))
    {
        ...
        
        // Handle web mention, perhaps as a blog comment using author info got from the microformat data, or if microformats say this was a "like" perhaps do something with that

        ...

        return true;
    }
});

Todo

  • Endpoint to parse source URL for microformats, and handle them accordingly.
  • CRUD events - update on dupe, delete on HTTP DELETE
  • Only send webmentions to first rel="in-reply-to" link (?)

See

elgg-webmention's People

Contributors

mapkyca avatar

Watchers

 avatar  avatar

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.