1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-03 13:17:24 +02:00

Filter social network tracking queries when determining SEF route.

This commit is contained in:
Cameron
2019-01-23 14:21:59 -08:00
parent f387fa149f
commit 9237f254c7

View File

@@ -1028,6 +1028,9 @@ class eRouter
*/ */
public $notFoundUrl = 'system/error/404?type=routeError'; public $notFoundUrl = 'system/error/404?type=routeError';
protected $_trackers = array('fbclid','utm_source','utm_medium','utm_content','utm_campaign');
public function __construct() public function __construct()
{ {
$this->_init(); $this->_init();
@@ -1086,6 +1089,12 @@ class eRouter
return $this->_urlFormat; return $this->_urlFormat;
} }
public function getTrackers()
{
return $this->_trackers;
}
/** /**
* Load config and url rules, if not available - build it on the fly * Load config and url rules, if not available - build it on the fly
* @return eRouter * @return eRouter
@@ -1793,8 +1802,22 @@ class eRouter
//$this->_urlFormat = self::FORMAT_PATH; //$this->_urlFormat = self::FORMAT_PATH;
} }
// Ignore social trackers when determining route.
$get = $_GET;
$trackers = $this->getTrackers();
foreach($trackers as $val)
{
if(isset($get[$val]))
{
unset($get[$val]);
}
}
// Route to front page - index/index/index route // Route to front page - index/index/index route
if(!$rawPathInfo && (!$this->getMainModule() || empty($_GET))) if(!$rawPathInfo && (!$this->getMainModule() || empty($get)))
{ {
// front page settings will be detected and front page will be rendered // front page settings will be detected and front page will be rendered
$request->setRoute('index/index/index'); $request->setRoute('index/index/index');