2011-02-08 13:04:39 -05:00
|
|
|
____ Twitter Plugin ____
|
|
|
|
By Tobias Diekershoff
|
|
|
|
tobias.diekershoff(at)gmx.net
|
|
|
|
|
|
|
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
2011-09-02 01:07:03 -04:00
|
|
|
!! This addon is currently under development. If you have any problem !!
|
2011-02-08 13:04:39 -05:00
|
|
|
!! with it, please contact the Author. !!
|
|
|
|
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
|
|
|
|
|
|
|
With this addon to Friendika you can give your user the possibility to post
|
|
|
|
their *public* messages to Twitter. The messages will be strapped their rich
|
|
|
|
context and shortened to 140 characters length if necessary. If shortening of
|
|
|
|
the message was performed a link will be added to the Tweet pointing to the
|
|
|
|
original message on your server.
|
|
|
|
|
|
|
|
There is a similar addon for forwarding public messages to
|
|
|
|
"StatusNet":http://status.net [[StatusNet Plugin]].
|
|
|
|
|
|
|
|
Online version of this document: http://ur1.ca/35mml
|
|
|
|
|
|
|
|
___ Requirements ___
|
|
|
|
|
|
|
|
To use this plugin you have to register your Friendika instance as an
|
|
|
|
_client application_ for Twitter with _read and write_ access, we do not intend
|
|
|
|
to use Twitter for login. The registration can be done at twitter.com/apps
|
|
|
|
and you need to have a Twitter account to do so.
|
|
|
|
|
|
|
|
After you registered the application you get an OAuth consumer key / secret
|
|
|
|
pair that identifies your app, you will need them for configuration.
|
|
|
|
|
|
|
|
The inclusion of a shorturl for the original posting in cases when the
|
2011-09-02 01:07:03 -04:00
|
|
|
message was longer than 140 characters requires it, that you have *PHP5+* and
|
2011-02-08 13:04:39 -05:00
|
|
|
*curl* on your server.
|
|
|
|
|
|
|
|
___ Where to find ___
|
|
|
|
|
|
|
|
In the Friendika git repository /addon/twitter/, this directory contains
|
|
|
|
all required PHP files (including the Twitter OAuth library [1] by Abraham
|
|
|
|
Williams, MIT licensed and the Slinky library [2] by Beau Lebens, BSD license),
|
|
|
|
a CSS file for styling of the user configuration and an image to _Sign in with
|
|
|
|
Twitter_.
|
|
|
|
|
|
|
|
[1] https://github.com/abraham/twitteroauth
|
|
|
|
[2] http://dentedreality.com.au/projects/slinky/
|
|
|
|
|
|
|
|
___ Configuration ___
|
|
|
|
|
|
|
|
__ Global Configuration __
|
|
|
|
|
|
|
|
To activate this addon add @twitter@ to the list of active addons in your
|
|
|
|
.htconfig.php file
|
|
|
|
$a->config['system']['addon'] = "twitter, ..."
|
|
|
|
Afterwards you need to add your OAuth consumer key / secret pair to it by
|
2011-09-02 01:07:03 -04:00
|
|
|
adding the following two lines
|
2011-02-08 13:04:39 -05:00
|
|
|
|
|
|
|
$a->config['twitter']['consumerkey'] = 'your consumer KEY here';
|
|
|
|
$a->config['twitter']['consumersecret'] = 'your consumer SECRET here';
|
|
|
|
|
|
|
|
When this is done your user can now configure their Twitter connection at
|
2011-09-02 01:07:03 -04:00
|
|
|
"Settings -> Plugin Settings" and enable the forwarding of their *public*
|
2011-02-08 13:04:39 -05:00
|
|
|
messages to Twitter.
|
|
|
|
|
|
|
|
__ User Configuration __
|
|
|
|
|
|
|
|
When the OAuth consumer informations are correctly placed into the
|
2011-09-02 01:07:03 -04:00
|
|
|
configuration file and a user visits the "Plugin Settings" page they can now
|
2011-02-08 13:04:39 -05:00
|
|
|
connect to Twitter. To do so one has to follow the _Sign in with Twitter_
|
|
|
|
button (the page will be opened in a new browser window/tab) and get a PIN from
|
|
|
|
Twitter. This PIN has to be entered on the settings page. After submitting the
|
|
|
|
PIN the plugin will get OAuth credentials identifying this user from the
|
|
|
|
Friendika account.
|
|
|
|
|
|
|
|
If this first step was successful the Twitter configuration will be changed
|
2011-09-02 01:07:03 -04:00
|
|
|
on the "Plugin Settings" page displaying two check boxes. One to enable/disable
|
2011-02-08 13:04:39 -05:00
|
|
|
the forwarding of *all public* postings to Twitter and one to clear the
|
|
|
|
personal configuration from the Twitter credentials.
|
|
|
|
|