From bd92ac02e15b27b16d1be7a52729a6f4e07bf38f Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sat, 25 May 2013 00:22:08 +0200 Subject: [PATCH] gpluspost: There is a new option to suppress posts without links. --- gpluspost/gpluspost.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/gpluspost/gpluspost.php b/gpluspost/gpluspost.php index db240aa3..35278495 100644 --- a/gpluspost/gpluspost.php +++ b/gpluspost/gpluspost.php @@ -51,6 +51,9 @@ function gpluspost_settings(&$a,&$s) { $noloop_enabled = get_pconfig(local_user(),'gpluspost','no_loop_prevention'); $noloop_checked = (($noloop_enabled) ? ' checked="checked" ' : ''); + $skip_enabled = get_pconfig(local_user(),'gpluspost','skip_without_link'); + $skip_checked = (($skip_enabled) ? ' checked="checked" ' : ''); + $s .= '
'; $s .= '

' . t('Google+ Post Settings') . '

'; $s .= '
'; @@ -68,6 +71,11 @@ function gpluspost_settings(&$a,&$s) { $s .= ''; $s .= '
'; + $s .= '
'; + /* provide a submit button */ $s .= '
'; @@ -81,6 +89,7 @@ function gpluspost_settings_post(&$a,&$b) { 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'])); + set_pconfig(local_user(),'gpluspost','skip_without_link',intval($_POST['gpluspost_skipwithoutlink'])); } } @@ -286,7 +295,7 @@ function gpluspost_feeditem($pid, $uid) { require_once('include/bbcode.php'); require_once("include/html2plain.php"); - $max_char = 140; + $skipwithoutlink = get_pconfig($uid,'gpluspost','skip_without_link'); $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) { @@ -349,7 +358,9 @@ function gpluspost_feeditem($pid, $uid) { else if ($image != "") $msglink = $image; - if ($msglink == "") + if (($msglink == "") AND $skipwithoutlink) + continue; + else if ($msglink == "") $msglink = $item["plink"]; // Fetching the title - or the first line