X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=fromgplus%2Ffromgplus.php;h=4c96892c662d94efd9ff9cdee6ee5742bc3c94d9;hb=5fb7ef40fd9861a8011cfb01dc0dbd4d1d6046f6;hp=d3365e710656b81adae10c17c7cec30d6dbd5990;hpb=6d6e73096afb22e95678c651e055337f1bf5405d;p=friendica-addons.git diff --git a/fromgplus/fromgplus.php b/fromgplus/fromgplus.php index d3365e71..4c96892c 100644 --- a/fromgplus/fromgplus.php +++ b/fromgplus/fromgplus.php @@ -10,6 +10,7 @@ define('FROMGPLUS_DEFAULT_POLL_INTERVAL', 30); // given in minutes require_once('mod/share.php'); +require_once('mod/parse_url.php'); function fromgplus_install() { register_hook('connector_settings', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings'); @@ -38,6 +39,7 @@ function fromgplus_addon_settings(&$a,&$s) { return; $enable_checked = (intval(get_pconfig(local_user(),'fromgplus','enable')) ? ' checked="checked"' : ''); + $keywords_checked = (intval(get_pconfig(local_user(), 'fromgplus', 'keywords')) ? ' checked="checked"' : ''); $account = get_pconfig(local_user(),'fromgplus','account'); $s .= ''; @@ -56,6 +58,9 @@ function fromgplus_addon_settings(&$a,&$s) { $s .= ''; $s .= ''; $s .= '
'; + $s .= ''; + $s .= ''; + $s .= '
'; $s .= '
'; @@ -73,6 +78,8 @@ function fromgplus_addon_settings_post(&$a,&$b) { set_pconfig(local_user(),'fromgplus','account',trim($_POST['fromgplus-account'])); $enable = ((x($_POST,'fromgplus-enable')) ? intval($_POST['fromgplus-enable']) : 0); set_pconfig(local_user(),'fromgplus','enable', $enable); + $keywords = ((x($_POST, 'fromgplus-keywords')) ? intval($_POST['fromgplus-keywords']) : 0); + set_pconfig(local_user(),'fromgplus', 'keywords', $keywords); if (!$enable) del_pconfig(local_user(),'fromgplus','lastdate'); @@ -129,7 +136,7 @@ function fromgplus_cron($a,$b) { set_config('fromgplus','last_poll', time()); } -function fromgplus_post($a, $uid, $source, $body, $location, $coord) { +function fromgplus_post($a, $uid, $source, $body, $location, $coord, $id) { //$uid = 2; @@ -157,6 +164,9 @@ function fromgplus_post($a, $uid, $source, $body, $location, $coord) { $_REQUEST['source'] = $source; $_REQUEST['extid'] = NETWORK_GPLUS; + if (isset($id)) + $_REQUEST['message_id'] = NETWORK_GPLUS.":".$id; + // $_REQUEST['verb'] // $_REQUEST['parent'] // $_REQUEST['parent_uri'] @@ -324,6 +334,11 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) { if ($quote != "") $pagedata["text"] = $quote; + // Add Keywords to page link + $data = parseurl_getsiteinfo_cached($pagedata["url"], true); + if (isset($data["keywords"]) AND get_pconfig($uid, 'fromgplus', 'keywords')) { + $pagedata["keywords"] = $data["keywords"]; + } break; case "photo": @@ -446,6 +461,8 @@ function fromgplus_fetch($a, $uid) { if ($lastdate < strtotime($item->published)) $lastdate = strtotime($item->published); + set_pconfig($uid,'fromgplus','lastdate', $lastdate); + if ($first_time) continue; @@ -479,7 +496,7 @@ function fromgplus_fetch($a, $uid) { } elseif (isset($item->address)) $location = $item->address; - fromgplus_post($a, $uid, $item->provider->title, $post, $location, $coord); + fromgplus_post($a, $uid, $item->provider->title, $post, $location, $coord, $item->id); break; @@ -530,7 +547,7 @@ function fromgplus_fetch($a, $uid) { } elseif (isset($item->address)) $location = $item->address; - fromgplus_post($a, $uid, $item->provider->title, $post, $location, $coord); + fromgplus_post($a, $uid, $item->provider->title, $post, $location, $coord, $item->id); break; } }