return;
$enabled = get_pconfig(local_user(),'gpluspost','post');
-
$checked = (($enabled) ? ' checked="checked" ' : '');
$def_enabled = get_pconfig(local_user(),'gpluspost','post_by_default');
-
$def_checked = (($def_enabled) ? ' checked="checked" ' : '');
+ $noloop_enabled = get_pconfig(local_user(),'gpluspost','no_loop_prevention');
+ $noloop_checked = (($noloop_enabled) ? ' checked="checked" ' : '');
+
$s .= '<div class="settings-block">';
$s .= '<h3>' . t('Google+ Post Settings') . '</h3>';
$s .= '<div id="gpluspost-enable-wrapper">';
$s .= '<input id="gpluspost-bydefault" type="checkbox" name="gpluspost_bydefault" value="1" ' . $def_checked . '/>';
$s .= '</div><div class="clear"></div>';
+ $s .= '<div id="gpluspost-noloopprevention-wrapper">';
+ $s .= '<label id="gpluspost-noloopprevention-label" for="gpluspost-noloopprevention">' . t('Do not prevent posting loops') . '</label>';
+ $s .= '<input id="gpluspost-noloopprevention" type="checkbox" name="gpluspost_noloopprevention" value="1" ' . $noloop_checked . '/>';
+ $s .= '</div><div class="clear"></div>';
+
/* provide a submit button */
$s .= '<div class="settings-submit-wrapper" ><input type="submit" id="gpluspost-submit" name="gpluspost-submit" class="settings-submit" value="' . t('Submit') . '" /></div>';
$s .= 'Register an account at <a href="https://hootsuite.com">Hootsuite</a>, add your G+ page and add the feed-url there.<br />';
- //$s .= 'Feed-url: '.$a->get_baseurl().'/gpluspost/'.$a->user["uid"].'</div>';
$s .= 'Feed-url: '.$a->get_baseurl().'/gpluspost/'.urlencode($a->user["nickname"]).'</div>';
}
if(x($_POST,'gpluspost-submit')) {
set_pconfig(local_user(),'gpluspost','post',intval($_POST['gpluspost']));
set_pconfig(local_user(),'gpluspost','post_by_default',intval($_POST['gpluspost_bydefault']));
+ set_pconfig(local_user(),'gpluspost','no_loop_prevention',intval($_POST['gpluspost_noloopprevention']));
}
}
$enable = (($post && x($_REQUEST,'gpluspost_enable')) ? intval($_REQUEST['gpluspost_enable']) : 0);
- if(intval(get_pconfig(local_user(),'gpluspost','post_by_default')))
+ if($_REQUEST['api_source'] && intval(get_pconfig(local_user(),'gpluspost','post_by_default')))
$enable = 1;
if(!$enable)
function gpluspost_send(&$a,&$b) {
- logger('gpluspost_send: invoked for post '.$b['id']);
+ logger('gpluspost_send: invoked for post '.$b['id']." ".$b['app']);
if($b['deleted'] || $b['private'] || ($b['created'] !== $b['edited']))
return;
return;
// if post comes from Google+ don't send it back
- if($b['app'] == "Google+")
+ if (!get_pconfig($b["uid"],'gpluspost','no_loop_prevention') and ($b['app'] == "Google+"))
return;
$itemlist = get_pconfig($b["uid"],'gpluspost','itemlist');
$uid = (int)$a->argv[1];
if ($uid == 0) {
$contacts = q("SELECT `name`, `id` FROM contact WHERE `nick` = '%s' LIMIT 1", dbesc($a->argv[1]));
- if ($contacts)
+ if ($contacts) {
$uid = $contacts[0]["id"];
- } else
+ $nick = $a->argv[1];
+ }
+ } else {
$contacts = q("SELECT `name` FROM contact WHERE ID=%d LIMIT 1", intval($uid));
+ $nick = $uid;
+ }
}
header("content-type: application/atom+xml");
echo '<?xml version="1.0" encoding="UTF-8"?>'."\n";
echo '<feed xmlns="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">'."\n";
echo "\t".'<title type="html"><![CDATA['.$a->config['sitename'].']]></title>'."\n";
- if ($uid != 0)
+ if ($uid != 0) {
echo "\t".'<subtitle type="html"><![CDATA['.$contacts[0]["name"]."]]></subtitle>\n";
- echo "\t".'<link rel="self" href="'.$a->get_baseurl().'/gpluspost"/>'."\n";
+ echo "\t".'<link rel="self" href="'.$a->get_baseurl().'/gpluspost/'.$nick.'"/>'."\n";
+ } else
+ echo "\t".'<link rel="self" href="'.$a->get_baseurl().'/gpluspost"/>'."\n";
echo "\t<id>".$a->get_baseurl()."/</id>\n";
echo "\t".'<link rel="alternate" type="text/html" href="'.$a->get_baseurl().'"/>'."\n";
echo "\t<updated>".date("c")."</updated>\n"; // To-Do
echo "\t".'<generator uri="'.$a->get_baseurl().'">'.$a->config['sitename'].'</generator>'."\n";
if ($uid != 0) {
- $itemlist = get_pconfig(local_user(),'gpluspost','itemlist');
- //$itemlist = "262568,262567,269154,271508,270121,273721,314735,312616,311570,308771,308247,306100,295372,291096,290390,290389,283242,283060,280465,273725";
+ $itemlist = get_pconfig($uid,'gpluspost','itemlist');
$items = explode(",", $itemlist);
foreach ($items AS $item)
//$text = "<br />".$headline."</strong><blockquote>".$match[2]."</blockquote>";
//$text = "\n\t".$match[2].":\t";
- $text = $author.": ".$match[2];
+ $text = html_entity_decode("♲ ", ENT_QUOTES, 'UTF-8').$author.": ".$match[2];
return($text);
}