public static function setCookie($strName, $varValue, $intExpires, $strPath=null, $strDomain=null, $blnSecure=false, $blnHttpOnly=false)
	{
		if ($strPath == '')
		{
			$strPath = Environment::get('path') ?: '/'; // see #4390
		}

		$objCookie = new \stdClass();

		$objCookie->strName     = $strName;
		$objCookie->varValue    = $varValue;
		$objCookie->intExpires  = $intExpires;
		$objCookie->strPath     = $strPath;
		$objCookie->strDomain   = $strDomain;
		$objCookie->blnSecure   = $blnSecure;
		$objCookie->blnHttpOnly = $blnHttpOnly;

		// HOOK: allow to add custom logic
		if (isset($GLOBALS['TL_HOOKS']['setCookie']) && \is_array($GLOBALS['TL_HOOKS']['setCookie']))
		{
			foreach ($GLOBALS['TL_HOOKS']['setCookie'] as $callback)
			{
				$objCookie = static::importStatic($callback[0])->{$callback[1]}($objCookie);
			}
		}

		setcookie($objCookie->strName, $objCookie->varValue, $objCookie->intExpires, $objCookie->strPath, $objCookie->strDomain, $objCookie->blnSecure, $objCookie->blnHttpOnly);
	}
public static function setCookie($strName, $varValue, $intExpires, $strPath=null, $strDomain=null, $blnSecure=false, $blnHttpOnly=false)
	{
		if ($strPath == '')
		{
			$strPath = Environment::get('path') ?: '/'; 
		}

		$objCookie = new \stdClass();

		$objCookie->strName     = $strName;
		$objCookie->varValue    = $varValue;
		$objCookie->intExpires  = $intExpires;
		$objCookie->strPath     = $strPath;
		$objCookie->strDomain   = $strDomain;
		$objCookie->blnSecure   = $blnSecure;
		$objCookie->blnHttpOnly = $blnHttpOnly;

		
		if (isset($GLOBALS['TL_HOOKS']['setCookie']) && \is_array($GLOBALS['TL_HOOKS']['setCookie']))
		{
			foreach ($GLOBALS['TL_HOOKS']['setCookie'] as $callback)
			{
				$objCookie = static::importStatic($callback[0])->{$callback[1]}($objCookie);
			}
		}

		setcookie($objCookie->strName, $objCookie->varValue, $objCookie->intExpires, $objCookie->strPath, $objCookie->strDomain, $objCookie->blnSecure, $objCookie->blnHttpOnly);
	}
public static function setCookie ( $ strName , $ varValue , $ intExpires , $ strPath = null , $ strDomain = null , $ blnSecure = false , $ blnHttpOnly = false ) { if ( $ strPath == '' ) { $ strPath = Environment :: get ( 'path' ) ? : '/' ; // see #4390 } $ objCookie = new \ stdClass ( ) ; $ objCookie -> strName = $ strName ; $ objCookie -> varValue = $ varValue ; $ objCookie -> intExpires = $ intExpires ; $ objCookie -> strPath = $ strPath ; $ objCookie -> strDomain = $ strDomain ; $ objCookie -> blnSecure = $ blnSecure ; $ objCookie -> blnHttpOnly = $ blnHttpOnly ; // HOOK: allow to add custom logic if ( isset ( $ GLOBALS [ 'TL_HOOKS' ] [ 'setCookie' ] ) && \ is_array ( $ GLOBALS [ 'TL_HOOKS' ] [ 'setCookie' ] ) ) { foreach ( $ GLOBALS [ 'TL_HOOKS' ] [ 'setCookie' ] as $ callback ) { $ objCookie = static :: importStatic ( $ callback [ 0 ] ) -> { $ callback [ 1 ] } ( $ objCookie ) ; } } setcookie ( $ objCookie -> strName , $ objCookie -> varValue , $ objCookie -> intExpires , $ objCookie -> strPath , $ objCookie -> strDomain , $ objCookie -> blnSecure , $ objCookie -> blnHttpOnly ) ; }
Set a cookie

@param string  $strName     The cookie name
@param mixed   $varValue    The cookie value
@param integer $intExpires  The expiration date
@param string  $strPath     An optional path
@param string  $strDomain   An optional domain name
@param boolean $blnSecure   If true, the secure flag will be set
@param boolean $blnHttpOnly If true, the http-only flag will be set
Set a cookie