mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-29 04:53:21 +00:00
Merge pull request #184 from annando/master
New function for pictures, calculation period of "statistics" changed
This commit is contained in:
commit
ae542a2d5d
9 changed files with 20 additions and 9 deletions
|
@ -288,6 +288,8 @@ function appnetpost_feeditem($pid, $uid) {
|
||||||
$items = q("SELECT `uri`, `plink`, `author-link`, `author-name`, `created`, `edited`, `id`, `title`, `body` from `item` WHERE id=%d", intval($pid));
|
$items = q("SELECT `uri`, `plink`, `author-link`, `author-name`, `created`, `edited`, `id`, `title`, `body` from `item` WHERE id=%d", intval($pid));
|
||||||
foreach ($items AS $item) {
|
foreach ($items AS $item) {
|
||||||
|
|
||||||
|
$item['body'] = bb_CleanPictureLinks($item['body']);
|
||||||
|
|
||||||
// Looking for the first image
|
// Looking for the first image
|
||||||
$image = '';
|
$image = '';
|
||||||
if(preg_match("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/is",$item['body'],$matches))
|
if(preg_match("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/is",$item['body'],$matches))
|
||||||
|
|
|
@ -363,6 +363,8 @@ function fbpost_createmsg($b) {
|
||||||
require_once("include/bbcode.php");
|
require_once("include/bbcode.php");
|
||||||
require_once("include/html2plain.php");
|
require_once("include/html2plain.php");
|
||||||
|
|
||||||
|
$b['body'] = bb_CleanPictureLinks($b['body']);
|
||||||
|
|
||||||
// Looking for the first image
|
// Looking for the first image
|
||||||
$image = '';
|
$image = '';
|
||||||
if(preg_match("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/is",$b['body'],$matches))
|
if(preg_match("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/is",$b['body'],$matches))
|
||||||
|
@ -632,6 +634,7 @@ function fbpost_post_hook(&$a,&$b) {
|
||||||
|
|
||||||
logger('fbpost_post_hook: original msg=' . $msg, LOGGER_DATA);
|
logger('fbpost_post_hook: original msg=' . $msg, LOGGER_DATA);
|
||||||
|
|
||||||
|
// To-Do: if it is a reply, then only do a simple bbcode2plain conversion
|
||||||
$msgarr = fbpost_createmsg($b);
|
$msgarr = fbpost_createmsg($b);
|
||||||
$msg = $msgarr["msg"];
|
$msg = $msgarr["msg"];
|
||||||
$link = $msgarr["link"];
|
$link = $msgarr["link"];
|
||||||
|
@ -768,7 +771,7 @@ function fbpost_post_hook(&$a,&$b) {
|
||||||
|
|
||||||
// If it is a special kind of failure the post was receiced
|
// If it is a special kind of failure the post was receiced
|
||||||
// Although facebook said it wasn't received ...
|
// Although facebook said it wasn't received ...
|
||||||
if (!$likes AND (($retj->error->type != "OAuthException") OR ($retj->error->code != 2))) {
|
if (!$likes AND (($retj->error->type != "OAuthException") OR ($retj->error->code != 2)) AND ($x <> "")) {
|
||||||
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", intval($b['uid']));
|
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", intval($b['uid']));
|
||||||
if (count($r))
|
if (count($r))
|
||||||
$a->contact = $r[0]["id"];
|
$a->contact = $r[0]["id"];
|
||||||
|
@ -920,7 +923,7 @@ function fbpost_queue_hook(&$a,&$b) {
|
||||||
// If it is a special kind of failure the post was receiced
|
// If it is a special kind of failure the post was receiced
|
||||||
// Although facebook said it wasn't received ...
|
// Although facebook said it wasn't received ...
|
||||||
$ret = json_decode($j);
|
$ret = json_decode($j);
|
||||||
if (($ret->error->type != "OAuthException") OR ($ret->error->code != 2))
|
if (($ret->error->type != "OAuthException") OR ($ret->error->code != 2) AND ($j <> ""))
|
||||||
update_queue_time($x['id']);
|
update_queue_time($x['id']);
|
||||||
else
|
else
|
||||||
logger('fbpost_queue_hook: Not requeued, since it seems to be received');
|
logger('fbpost_queue_hook: Not requeued, since it seems to be received');
|
||||||
|
@ -1109,7 +1112,7 @@ function fbpost_fetchwall($a, $uid) {
|
||||||
$_REQUEST["body"] .= "[class=type-".$type."]";
|
$_REQUEST["body"] .= "[class=type-".$type."]";
|
||||||
|
|
||||||
if ($content)
|
if ($content)
|
||||||
$_REQUEST["body"] .= $content;
|
$_REQUEST["body"] .= trim($content);
|
||||||
|
|
||||||
if ($quote)
|
if ($quote)
|
||||||
$_REQUEST["body"] .= "\n[quote]".$quote."[/quote]";
|
$_REQUEST["body"] .= "\n[quote]".$quote."[/quote]";
|
||||||
|
|
|
@ -328,7 +328,7 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr
|
||||||
$postarray["body"] .= "[class=type-".$type."]";
|
$postarray["body"] .= "[class=type-".$type."]";
|
||||||
|
|
||||||
if ($content)
|
if ($content)
|
||||||
$postarray["body"] .= $content;
|
$postarray["body"] .= trim($content);
|
||||||
|
|
||||||
if ($quote)
|
if ($quote)
|
||||||
$postarray["body"] .= "\n[quote]".trim($quote)."[/quote]";
|
$postarray["body"] .= "\n[quote]".trim($quote)."[/quote]";
|
||||||
|
|
|
@ -271,7 +271,7 @@ function fromgplus_handleattachments($item, $displaytext) {
|
||||||
//elseif ($images["full"] != "")
|
//elseif ($images["full"] != "")
|
||||||
// $post .= "\n[img]".$images["full"]."[/img]\n";
|
// $post .= "\n[img]".$images["full"]."[/img]\n";
|
||||||
if ($images["full"] != "")
|
if ($images["full"] != "")
|
||||||
$post .= "\n[img]".$images["full"]."[/img]\n";
|
$post .= "\n[img]".$images["full"]."[/img]";
|
||||||
|
|
||||||
//$post .= "[quote]".trim(fromgplus_html2bbcode($attachment->content))."[/quote]";
|
//$post .= "[quote]".trim(fromgplus_html2bbcode($attachment->content))."[/quote]";
|
||||||
$quote = trim(fromgplus_html2bbcode($attachment->content));
|
$quote = trim(fromgplus_html2bbcode($attachment->content));
|
||||||
|
|
|
@ -284,6 +284,8 @@ function gpluspost_feeditem($pid, $uid) {
|
||||||
$items = q("SELECT `uri`, `plink`, `author-link`, `author-name`, `created`, `edited`, `id`, `title`, `body` from `item` WHERE id=%d", intval($pid));
|
$items = q("SELECT `uri`, `plink`, `author-link`, `author-name`, `created`, `edited`, `id`, `title`, `body` from `item` WHERE id=%d", intval($pid));
|
||||||
foreach ($items AS $item) {
|
foreach ($items AS $item) {
|
||||||
|
|
||||||
|
$item['body'] = bb_CleanPictureLinks($item['body']);
|
||||||
|
|
||||||
// Looking for the first image
|
// Looking for the first image
|
||||||
$image = '';
|
$image = '';
|
||||||
if(preg_match("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/is",$item['body'],$matches))
|
if(preg_match("/\[img\=([0-9]*)x([0-9]*)\](.*?)\[\/img\]/is",$item['body'],$matches))
|
||||||
|
|
|
@ -42,8 +42,8 @@ function statistics_json_cron($a,$b) {
|
||||||
$last = get_config('statistics_json','last_calucation');
|
$last = get_config('statistics_json','last_calucation');
|
||||||
|
|
||||||
if($last) {
|
if($last) {
|
||||||
// Calculate all 6 hours
|
// Calculate every 24 hours
|
||||||
$next = $last + (360 * 60);
|
$next = $last + (24 * 60 * 60);
|
||||||
if($next > time()) {
|
if($next > time()) {
|
||||||
logger('statistics_json_cron: calculation intervall not reached');
|
logger('statistics_json_cron: calculation intervall not reached');
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -452,6 +452,8 @@ function statusnet_shortenmsg($b, $max_char) {
|
||||||
require_once("include/bbcode.php");
|
require_once("include/bbcode.php");
|
||||||
require_once("include/html2plain.php");
|
require_once("include/html2plain.php");
|
||||||
|
|
||||||
|
$b['body'] = bb_CleanPictureLinks($b['body']);
|
||||||
|
|
||||||
// Looking for the first image
|
// Looking for the first image
|
||||||
$cleaned_body = api_clean_plain_items($b['body']);
|
$cleaned_body = api_clean_plain_items($b['body']);
|
||||||
$image = '';
|
$image = '';
|
||||||
|
|
|
@ -378,6 +378,8 @@ function twitter_shortenmsg($b, $shortlink = false) {
|
||||||
|
|
||||||
$max_char = 140;
|
$max_char = 140;
|
||||||
|
|
||||||
|
$b['body'] = bb_CleanPictureLinks($b['body']);
|
||||||
|
|
||||||
// Looking for the first image
|
// Looking for the first image
|
||||||
$cleaned_body = api_clean_plain_items($b['body']);
|
$cleaned_body = api_clean_plain_items($b['body']);
|
||||||
$image = '';
|
$image = '';
|
||||||
|
|
Loading…
Reference in a new issue