protected static function getSiteIdFromUrl($url, array $hosts)
	{
		$host = (preg_match('(^https?://([^/]+))', strtolower($url), $m)) ? $m[1] : '';
		while ($host > '')
		{
			if (isset($hosts[$host]))
			{
				return $hosts[$host];
			}
			$host = preg_replace('(^[^.]*.)', '', $host);
		}

		return '';
	}
protected static function getSiteIdFromUrl($url, array $hosts)
	{
		$host = (preg_match('(^https?://([^/]+))', strtolower($url), $m)) ? $m[1] : '';
		while ($host > '')
		{
			if (isset($hosts[$host]))
			{
				return $hosts[$host];
			}
			$host = preg_replace('(^[^.]*.)', '', $host);
		}

		return '';
	}
protected static function getSiteIdFromUrl ( $ url , array $ hosts ) { $ host = ( preg_match ( '(^https?://([^/]+))' , strtolower ( $ url ) , $ m ) ) ? $ m [ 1 ] : '' ; while ( $ host > '' ) { if ( isset ( $ hosts [ $ host ] ) ) { return $ hosts [ $ host ] ; } $ host = preg_replace ( '(^[^.]*.)' , '' , $ host ) ; } return '' ; }
Return the siteId that corresponds to given URL

@param  string  $url   Original URL
@param  array   $hosts Map of [hostname => siteId]
@return string         URL's siteId, or an empty string
Return the siteId that corresponds to given URL