mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-16 15:34:00 +00:00
Merge pull request #2 from tobiasd/master
altered debug informations logged by the twitter addon
This commit is contained in:
commit
17fa04f25a
1 changed files with 4 additions and 2 deletions
|
@ -221,6 +221,7 @@ function twitter_post_hook(&$a,&$b) {
|
||||||
$osecret = get_pconfig(local_user(), 'twitter', 'oauthsecret' );
|
$osecret = get_pconfig(local_user(), 'twitter', 'oauthsecret' );
|
||||||
|
|
||||||
if($ckey && $csecret && $otoken && $osecret) {
|
if($ckey && $csecret && $otoken && $osecret) {
|
||||||
|
logger('twitter: we have customer key and oauth stuff, going to send.', LOGGER_DEBUG);
|
||||||
|
|
||||||
$twitter_post = intval(get_pconfig(local_user(),'twitter','post'));
|
$twitter_post = intval(get_pconfig(local_user(),'twitter','post'));
|
||||||
$twitter_enable = (($twitter_post && x($_POST,'twitter_enable')) ? intval($_POST['twitter_enable']) : 0);
|
$twitter_enable = (($twitter_post && x($_POST,'twitter_enable')) ? intval($_POST['twitter_enable']) : 0);
|
||||||
|
@ -237,6 +238,7 @@ function twitter_post_hook(&$a,&$b) {
|
||||||
$max_char = 140; // max. length for a tweet
|
$max_char = 140; // max. length for a tweet
|
||||||
$msg = strip_tags(bbcode($b['body']));
|
$msg = strip_tags(bbcode($b['body']));
|
||||||
if ( strlen($msg) > $max_char) {
|
if ( strlen($msg) > $max_char) {
|
||||||
|
logger('Twitter: have to shorten the message to fit 140 chars', LOGGER_DEBUG)
|
||||||
$shortlink = "";
|
$shortlink = "";
|
||||||
require_once('library/slinky.php');
|
require_once('library/slinky.php');
|
||||||
// post url = base url + /display/ + owner + post id
|
// post url = base url + /display/ + owner + post id
|
||||||
|
@ -259,7 +261,7 @@ function twitter_post_hook(&$a,&$b) {
|
||||||
// and now tweet it :-)
|
// and now tweet it :-)
|
||||||
if(strlen($msg)) {
|
if(strlen($msg)) {
|
||||||
$result = $tweet->post('statuses/update', array('status' => $msg));
|
$result = $tweet->post('statuses/update', array('status' => $msg));
|
||||||
logger('twitter_post returns: ' . $result);
|
logger('twitter_post send', LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue