[TelegramBridge] Add detectParameters() (#1998)
This commit is contained in:
parent
a5f2175531
commit
c294a652a3
1 changed files with 12 additions and 0 deletions
|
@ -21,6 +21,18 @@ class TelegramBridge extends BridgeAbstract {
|
|||
private $itemTitle = '';
|
||||
|
||||
private $backgroundImageRegex = "/background-image:url\('(.*)'\)/";
|
||||
private $detectParamsRegex = '/^https?:\/\/t.me\/(?:s\/)?([\w]+)$/';
|
||||
|
||||
public function detectParameters($url) {
|
||||
$params = array();
|
||||
|
||||
if(preg_match($this->detectParamsRegex, $url, $matches) > 0) {
|
||||
$params['username'] = $matches[1];
|
||||
return $params;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public function collectData() {
|
||||
|
||||
|
|
Loading…
Reference in a new issue