[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 '+'.
This commit is contained in:
logmanoriginal 2017-03-26 16:50:39 +02:00
parent 3276d4e3d5
commit 9acd30a5c5

View file

@ -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