Download the PHP package indieweb/original-post-discovery without Composer
On this page you can find all versions of the php package indieweb/original-post-discovery. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download indieweb/original-post-discovery
More information about indieweb/original-post-discovery
Files in indieweb/original-post-discovery
Package original-post-discovery
Short Description Functions for doing original post discovery in PHP
License MIT
Informations about the package original-post-discovery
php-original-post-discovery
A set of PHP functions for determining the canonical URL for a post, given a POSSEd copy. A partial implementation of the algorithm outlined at original-post-discovery.
A demo can be found on waterpigs.co.uk/services/original-post.
Usage
Install using Composer ./composer.phar require indieweb/original-post-discovery:dev-master
.
Other functions
string $str = cleanString($str)
cleans up a bunch of weird encoding and character issues which can occur, specifically converting non-breaking space codepoints into normal spaces to handle some Twitter.com bugsstring|null $url = originalPostUrlFromTwitter($html)
is a pure function for parsing HTML from Twitter.com and looking in it for trailing URLsstring $str = stripHashtags($str)
removes hashtags from a stringstring|null $url = getTrailingUrl($str)
finds parenthesised (text text. (http://example.com)
) or ellipsis (text text… http://example.com
) trailing URLs in a stringstring|null $str = getUrlFromPermashortid($str)
looks for a trailing permashortid ((cctld.me id)
) and converts it into a URL (assumes HTTP)
Testing
A small PHPUnit test suite is provided — if making contributions please at least ensure that all the existing tests pass before/after your changes are made. If you could add new tests to cover the code you added that would be great too.
Version History
0.1.0 2014-01-20
- Initial extraction from Taproot, readme and basic test suite
All versions of original-post-discovery with dependencies
mf2/shim Version ~0.2
barnabywalters/mf-cleaner Version *
tantek/cassis Version *
guzzle/guzzle Version *