From 9acd30a5c57999707f50616c1626cf61ac75046c Mon Sep 17 00:00:00 2001 From: logmanoriginal Date: Sun, 26 Mar 2017 16:50:39 +0200 Subject: [PATCH] [GooglePlusPostBridge] Autofix user names User names can either be an ID (series of numbers), or an actual name, where the name always starts with a '+'. This commit adds a check for automatically fixing provided user names which are missing the '+'. --- bridges/GooglePlusPostBridge.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/bridges/GooglePlusPostBridge.php b/bridges/GooglePlusPostBridge.php index 4dcf801d..69b6a0c0 100644 --- a/bridges/GooglePlusPostBridge.php +++ b/bridges/GooglePlusPostBridge.php @@ -18,8 +18,15 @@ class GooglePlusPostBridge extends BridgeAbstract{ )); public function collectData(){ + $username = $this->getInput('username'); + + // Usernames start with a + if it's not an ID + if(!is_numeric($username) && substr($username, 0, 1) !== '+'){ + $username = '+' . $username; + } + // get content parsed - $html = getSimpleHTMLDOMCached(self::URI . urlencode($this->getInput('username')) . '/posts') + $html = getSimpleHTMLDOMCached(self::URI . urlencode($username) . '/posts') or returnServerError('No results for this query.'); // get title, url, ... there is a lot of intresting stuff in meta