aboutsummaryrefslogtreecommitdiff
path: root/lib/core-extensions/Google-Groups/extension.php
blob: eb30de5f990bc6c1e04e9711dad127da3e0d9489 (plain)
1
2
3
4
5
6
7
8
9
10
11
<?php
class GoogleGroupsExtension extends Minz_Extension {
	/** @return void */
	public function init() {
		$this->registerHook('check_url_before_add', array('GoogleGroupsExtension', 'findFeed'));
	}

	public static function findFeed(string $url): string {
		return preg_replace('%^(https?://groups.google.com/forum)/#!forum/(.+)$%i', '$1/feed/$2/msgs/rss.xml', $url) ?? '';
	}
}