- Notifications
You must be signed in to change notification settings - Fork4
Phergie plugin for displaying information about URLs
License
phergie/phergie-irc-plugin-react-url
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
This repo is being kept for posterity and will be archived in a readonly state.If you're interested it can be forked under a new Composer namespace/GitHub organization.
Phergie plugin for Display URL information about links.
To install viaComposer, use the command below, it will automatically detect the latest version and bind it with~.
composer require phergie/phergie-irc-plugin-react-urlSee Phergie documentation for more information oninstalling and enabling plugins.
returnarray('plugins' =>array(// dependenciesnew \Phergie\Plugin\Dns\Plugin,// Handles DNS lookups for the HTTP pluginnew \Phergie\Plugin\Http\Plugin,// Handles the HTTP requests for this plugin// configurationnew \Phergie\Irc\Plugin\React\Url\Plugin(array(// All configuration is optional'hostUrlEmitsOnly' =>false,// url.host.(all|<host>) emits only, no further URL handling / shortening// or'handler' =>new \Phergie\Irc\Plugin\React\Url\DefaultUrlHandler(),// URL handler that creates a formatted message based on the URL// or'shortenTimeout' =>15// If after this amount of seconds no url shortener has come up with a short URL the normal URL will be used. (Not in effect when there are no shorteners listening.)// or'filter' => null// Any valid filter implementing Phergie\Irc\Plugin\React\EventFilter\FilterInterface to filter which messages should be handled )), ));
This plugin emits the following generic, do what ever you want with it, events.
url.host.HOSTNAMEFor exampleurl.host.twitter.com(www.is stripped from the hostname).url.host.allFor all hostnames.
This plugins also emits two events for url shortening. Only called when there are listeners registered. Each event emit is passed aUrlshorteningEvent, if a shortener resolved short url it calls theresolve method on the promise.
url.shorten.HOSTNAMEFor exampleurl.shorten.twitter.com(www.is stripped from the hostname).url.shorten.allFor all hostnames.
The following placeholders can be used to compose a message that is passed as the first argument forDefaultUrlHandler to create custom messages:
%url%- Full URL%url-short%- Shortened URL%http-status-code%- HTTP status code%timing%- Time in seconds it took for th request to complete%timing2%- Time in seconds it took for th request to complete rounded off to a maximum of two decimals%response-time%- Time in seconds it took for th request to complete%response-time2%- Time in seconds it took for th request to complete rounded off to a maximum of two decimals%title%- Page title%composed-title%- Page title
Selection of response headers from:en.wikipedia.org/wiki/List_of_HTTP_header_fields#Response_Headers
%header-age%%header-content-type%%header-content-length%%header-content-language%%header-date%%header-etag%%header-expires%%header-last-modified%%header-server%%header-x-powered-by%
This plugin comes with theUrlSectionFilter that lets you filter on the different key value pairs coming out ofparse_url. The following example filter allowswww.phergie.org,www2.phergie.org, andphergie.org:
newOrFilter([newUrlSectionFilter('host','*.phergie.org'),newUrlSectionFilter('host','phergie.org'),])
The filter comes with a thirdstrict parameter where instead of declaring out of scope on missing an URL part it returnfalse.
To run the unit test suite:
curl -s https://getcomposer.org/installer | phpphp composer.phar install./vendor/bin/phpunitReleased under the MIT License. SeeLICENSE.
About
Phergie plugin for displaying information about URLs
Resources
License
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors10
Uh oh!
There was an error while loading.Please reload this page.
