core-bundle/src/Resources/contao/library/Contao/Controller.php
public static function addToUrl($strRequest, $blnAddRef=true, $arrUnset=array())
	{
		/** @var Query $query */
		$query = new Query(Environment::get('queryString'));

		// Remove the request token and referer ID
		$query = $query->withoutPairs(array_merge(array('rt', 'ref'), $arrUnset));

		// Merge the request string to be added
		$query = $query->merge(str_replace('&amp;', '&', $strRequest));

		// Add the referer ID
		if (isset($_GET['ref']) || ($strRequest != '' && $blnAddRef))
		{
			$query = $query->merge('ref=' . System::getContainer()->get('request_stack')->getCurrentRequest()->attributes->get('_contao_referer_id'));
		}

		$uri = $query->getUriComponent();

		// The query parser automatically converts %2B to +, so re-convert it here
		if (strpos($strRequest, '%2B') !== false)
		{
			$uri = str_replace('+', '%2B', $uri);
		}

		return TL_SCRIPT . ampersand($uri);
	}
public static function addToUrl($strRequest, $blnAddRef=true, $arrUnset=array())
	{
		/** @var Query $query */
		$query = new Query(Environment::get('queryString'));

		// Remove the request token and referer ID
		$query = $query->withoutPairs(array_merge(array('rt', 'ref'), $arrUnset));

		// Merge the request string to be added
		$query = $query->merge(str_replace('&amp;', '&', $strRequest));

		// Add the referer ID
		if (isset($_GET['ref']) || ($strRequest != '' && $blnAddRef))
		{
			$query = $query->merge('ref=' . System::getContainer()->get('request_stack')->getCurrentRequest()->attributes->get('_contao_referer_id'));
		}

		$uri = $query->getUriComponent();

		// The query parser automatically converts %2B to +, so re-convert it here
		if (strpos($strRequest, '%2B') !== false)
		{
			$uri = str_replace('+', '%2B', $uri);
		}

		return TL_SCRIPT . ampersand($uri);
	}
public static function addToUrl ( $ strRequest , $ blnAddRef = true , $ arrUnset = array ( ) ) { /** @var Query $query */ $ query = new Query ( Environment :: get ( 'queryString' ) ) ; // Remove the request token and referer ID $ query = $ query -> withoutPairs ( array_merge ( array ( 'rt' , 'ref' ) , $ arrUnset ) ) ; // Merge the request string to be added $ query = $ query -> merge ( str_replace ( '&amp;' , '&' , $ strRequest ) ) ; // Add the referer ID if ( isset ( $ _GET [ 'ref' ] ) || ( $ strRequest != '' && $ blnAddRef ) ) { $ query = $ query -> merge ( 'ref=' . System :: getContainer ( ) -> get ( 'request_stack' ) -> getCurrentRequest ( ) -> attributes -> get ( '_contao_referer_id' ) ) ; } $ uri = $ query -> getUriComponent ( ) ; // The query parser automatically converts %2B to +, so re-convert it here if ( strpos ( $ strRequest , '%2B' ) !== false ) { $ uri = str_replace ( '+' , '%2B' , $ uri ) ; } return TL_SCRIPT . ampersand ( $ uri ) ; }
Add a request string to the current URL

@param string  $strRequest The string to be added
@param boolean $blnAddRef  Add the referer ID
@param array   $arrUnset   An optional array of keys to unset

@return string The new URL
Add a request string to the current URL