Twitter: added App name config to admin panel

pull/95/head
Tobias Diekershoff 2013-01-13 12:24:17 +01:00
parent cdb914458b
commit 690b4a175a
4 changed files with 8 additions and 6 deletions

View File

@ -3,17 +3,14 @@ By Tobias Diekershoff
http://diekershoff.homeunix.net/friendika/profile/tobias http://diekershoff.homeunix.net/friendika/profile/tobias
tobias.diekershoff(at)gmx.net tobias.diekershoff(at)gmx.net
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!! This addon is currently under development. If you have any problem !!
!! with it, please contact the Author. !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
With this addon to Friendica you can give your user the possibility to post With this addon to Friendica you can give your user the possibility to post
their *public* messages to Twitter. The messages will be strapped their rich their *public* messages to Twitter. The messages will be strapped their rich
context and shortened to 140 characters length if necessary. If shortening of 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 the message was performed a link will be added to the Tweet pointing to the
original message on your server. original message on your server.
The addon can also mirror a users Tweets into the ~friendica wall.
There is a similar addon for forwarding public messages to There is a similar addon for forwarding public messages to
"StatusNet":http://status.net [[StatusNet Plugin]]. "StatusNet":http://status.net [[StatusNet Plugin]].

View File

@ -543,8 +543,10 @@ function twitter_post_hook(&$a,&$b) {
function twitter_plugin_admin_post(&$a){ function twitter_plugin_admin_post(&$a){
$consumerkey = ((x($_POST,'consumerkey')) ? notags(trim($_POST['consumerkey'])) : ''); $consumerkey = ((x($_POST,'consumerkey')) ? notags(trim($_POST['consumerkey'])) : '');
$consumersecret = ((x($_POST,'consumersecret')) ? notags(trim($_POST['consumersecret'])): ''); $consumersecret = ((x($_POST,'consumersecret')) ? notags(trim($_POST['consumersecret'])): '');
$applicationname = ((x($_POST, 'application-name')) ? notags(trin($_POST['applicationname'])):'');
set_config('twitter','consumerkey',$consumerkey); set_config('twitter','consumerkey',$consumerkey);
set_config('twitter','consumersecret',$consumersecret); set_config('twitter','consumersecret',$consumersecret);
set_config('twitter','application_name',$applicationname);
info( t('Settings updated.'). EOL ); info( t('Settings updated.'). EOL );
} }
function twitter_plugin_admin(&$a, &$o){ function twitter_plugin_admin(&$a, &$o){
@ -554,7 +556,8 @@ function twitter_plugin_admin(&$a, &$o){
'$submit' => t('Submit'), '$submit' => t('Submit'),
// name, label, value, help, [extra values] // name, label, value, help, [extra values]
'$consumerkey' => array('consumerkey', t('Consumer key'), get_config('twitter', 'consumerkey' ), ''), '$consumerkey' => array('consumerkey', t('Consumer key'), get_config('twitter', 'consumerkey' ), ''),
'$consumersecret' => array('consumersecret', t('Consumer secret'), get_config('twitter', 'consumersecret' ), '') '$consumersecret' => array('consumersecret', t('Consumer secret'), get_config('twitter', 'consumersecret' ), ''),
'$applicationname' => array('applicationname', t('Name of the Twitter Application'), get_config('twitter','applicationname'),t('set this to avoid mirroring postings from ~friendica back to ~friendica'))
)); ));
} }

View File

@ -1,3 +1,4 @@
{{ inc field_input.tpl with $field=$consumerkey }}{{ endinc }} {{ inc field_input.tpl with $field=$consumerkey }}{{ endinc }}
{{ inc field_input.tpl with $field=$consumersecret }}{{ endinc }} {{ inc field_input.tpl with $field=$consumersecret }}{{ endinc }}
{{ inc field_input.tpl with $field=$applicationname }}{{ endinc }}
<div class="submit"><input type="submit" name="page_site" value="$submit" /></div> <div class="submit"><input type="submit" name="page_site" value="$submit" /></div>

View File

@ -1,3 +1,4 @@
{{include file="field_input.tpl" field=$consumerkey}} {{include file="field_input.tpl" field=$consumerkey}}
{{include file="field_input.tpl" field=$consumersecret}} {{include file="field_input.tpl" field=$consumersecret}}
{{include file="field_input.tpl" field=$applicationname}}
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div> <div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>