forked from friendica/friendica-addons
pumpio: Added README
Twitter: Changed the behaviour with the maximum length of posts
This commit is contained in:
parent
f75ef0c59e
commit
dc8b86ae81
2 changed files with 15 additions and 5 deletions
5
pumpio/README
Normal file
5
pumpio/README
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
To let the connector work properly you should define an application name in the .htconfig:
|
||||||
|
|
||||||
|
$a->config['pumpio']['application_name'] = "Name of you site";
|
||||||
|
|
||||||
|
This name appears at pump.io and is mportant for not mirroring back posts that came from friendica.
|
|
@ -286,7 +286,7 @@ function twitter_shortenmsg($b) {
|
||||||
require_once("include/bbcode.php");
|
require_once("include/bbcode.php");
|
||||||
require_once("include/html2plain.php");
|
require_once("include/html2plain.php");
|
||||||
|
|
||||||
$max_char = 130;
|
$max_char = 140;
|
||||||
|
|
||||||
// Looking for the first image
|
// Looking for the first image
|
||||||
$image = '';
|
$image = '';
|
||||||
|
@ -389,15 +389,20 @@ function twitter_shortenmsg($b) {
|
||||||
if (($msglink == "") and strlen($msg) > $max_char)
|
if (($msglink == "") and strlen($msg) > $max_char)
|
||||||
$msglink = $b["plink"];
|
$msglink = $b["plink"];
|
||||||
|
|
||||||
// If the message is short enough then don't modify it. (if the link exists in the original message)
|
// If the message is short enough then don't modify it.
|
||||||
if ((strlen(trim($origmsg)) <= $max_char) AND (strpos($origmsg, $msglink) OR ($msglink == "")))
|
if ((strlen(trim($origmsg)) <= $max_char) AND ($msglink == ""))
|
||||||
|
return(trim($origmsg));
|
||||||
|
|
||||||
|
// If the message is short enough and the link exists in the original message don't modify it as well
|
||||||
|
// -3 because of the bad shortener of twitter
|
||||||
|
if ((strlen(trim($origmsg)) <= ($max_char - 3)) AND strpos($origmsg, $msglink))
|
||||||
return(trim($origmsg));
|
return(trim($origmsg));
|
||||||
|
|
||||||
if (strlen($msglink) > 20)
|
if (strlen($msglink) > 20)
|
||||||
$msglink = short_link($msglink);
|
$msglink = short_link($msglink);
|
||||||
|
|
||||||
if (strlen(trim($msg." ".$msglink)) > $max_char) {
|
if (strlen(trim($msg." ".$msglink)) > ($max_char - 3)) {
|
||||||
$msg = substr($msg, 0, $max_char - (strlen($msglink)));
|
$msg = substr($msg, 0, ($max_char - 3) - (strlen($msglink)));
|
||||||
$lastchar = substr($msg, -1);
|
$lastchar = substr($msg, -1);
|
||||||
$msg = substr($msg, 0, -1);
|
$msg = substr($msg, 0, -1);
|
||||||
$pos = strrpos($msg, "\n");
|
$pos = strrpos($msg, "\n");
|
||||||
|
|
Loading…
Reference in a new issue