mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-25 07:23:41 +00:00
tumblr: Added admin page for API key
This commit is contained in:
parent
c5d37edf53
commit
b21d248104
3 changed files with 25 additions and 5 deletions
|
@ -1,9 +1,7 @@
|
||||||
Define in your .htconfig.php:
|
Register an application at this address:
|
||||||
$a->config['tumblr']['consumer_key'] = "your-consumer-key";
|
|
||||||
$a->config['tumblr']['consumer_secret'] = "your-consumer-secret";
|
|
||||||
|
|
||||||
You can get it here:
|
|
||||||
http://www.tumblr.com/oauth/apps
|
http://www.tumblr.com/oauth/apps
|
||||||
|
|
||||||
|
use (your server name)addon/tumblr/callback.php as callback URL
|
||||||
|
|
||||||
Tumblr-OAuth-Library:
|
Tumblr-OAuth-Library:
|
||||||
https://groups.google.com/d/msg/tumblr-api/g6SeIBWvsnE/gnWqT9jFSlEJ
|
https://groups.google.com/d/msg/tumblr-api/g6SeIBWvsnE/gnWqT9jFSlEJ
|
||||||
|
|
3
tumblr/templates/admin.tpl
Normal file
3
tumblr/templates/admin.tpl
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{{include file="field_input.tpl" field=$consumer_key}}
|
||||||
|
{{include file="field_input.tpl" field=$consumer_secret}}
|
||||||
|
<div class="submit"><input type="submit" name="page_site" value="{{$submit}}" /></div>
|
|
@ -54,6 +54,25 @@ function tumblr_content(&$a) {
|
||||||
return $o;
|
return $o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function tumblr_plugin_admin(&$a, &$o){
|
||||||
|
$t = get_markup_template( "admin.tpl", "addon/tumblr/" );
|
||||||
|
|
||||||
|
$o = replace_macros($t, array(
|
||||||
|
'$submit' => t('Save Settings'),
|
||||||
|
// name, label, value, help, [extra values]
|
||||||
|
'$consumer_key' => array('consumer_key', t('Consumer Key'), get_config('tumblr', 'consumer_key' ), ''),
|
||||||
|
'$consumer_secret' => array('consumer_secret', t('Consumer Secret'), get_config('tumblr', 'consumer_secret' ), ''),
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
function tumblr_plugin_admin_post(&$a){
|
||||||
|
$consumer_key = ((x($_POST,'consumer_key')) ? notags(trim($_POST['consumer_key'])) : '');
|
||||||
|
$consumer_secret = ((x($_POST,'consumer_secret')) ? notags(trim($_POST['consumer_secret'])): '');
|
||||||
|
set_config('tumblr','consumer_key',$consumer_key);
|
||||||
|
set_config('tumblr','consumer_secret',$consumer_secret);
|
||||||
|
info( t('Settings updated.'). EOL );
|
||||||
|
}
|
||||||
|
|
||||||
function tumblr_connect($a) {
|
function tumblr_connect($a) {
|
||||||
// Start a session. This is necessary to hold on to a few keys the callback script will also need
|
// Start a session. This is necessary to hold on to a few keys the callback script will also need
|
||||||
session_start();
|
session_start();
|
||||||
|
|
Loading…
Reference in a new issue