[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:
parent
3276d4e3d5
commit
9acd30a5c5
1 changed files with 8 additions and 1 deletions
|
@ -18,8 +18,15 @@ class GooglePlusPostBridge extends BridgeAbstract{
|
||||||
));
|
));
|
||||||
|
|
||||||
public function collectData(){
|
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
|
// 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.');
|
or returnServerError('No results for this query.');
|
||||||
|
|
||||||
// get title, url, ... there is a lot of intresting stuff in meta
|
// get title, url, ... there is a lot of intresting stuff in meta
|
||||||
|
|
Loading…
Reference in a new issue