Trait PreRouting
Methods summary
protected
boolean
|
#
preRouteMedia( )
Process media site version before request is routed by \MvcCore\Router .
- If there is special media site switching param in request object global
array $_GET and it's value is allowed as media site version:
- Switch media site version in session by given switching param value
and redirect to the same page with new media site version substring
in url or with new media site version query string param.
- If there is no media site version in session or if media site version
from session is not allowed:
- Recognize media site version by \Mobile_Detect third party library
and store recognized version in this context and in session namespace.
- Else set up media site version from session into this context
- Later - if detected media site version is not the same as requested
media site version - redirect to detected version in this context.
Return always TRUE and return FALSE if request is redirected.
Process media site version before request is routed by \MvcCore\Router .
- If there is special media site switching param in request object global array $_GET and it's value is allowed as media site version: - Switch media site version in session by given switching param value and redirect to the same page with new media site version substring in url or with new media site version query string param.
- If there is no media site version in session or if media site version from session is not allowed: - Recognize media site version by \Mobile_Detect third party library and store recognized version in this context and in session namespace.
- Else set up media site version from session into this context
- Later - if detected media site version is not the same as requested media site version - redirect to detected version in this context.
Return always TRUE and return FALSE if request is redirected.
Returns
boolean
|
protected
boolean
|
#
manageMediaSwitchingAndRedirect( )
Store new media site version from url in session namespace, remove
media site version switching param from request object global collection
$_GET and redirect to the same page without switching param.
Store new media site version from url in session namespace, remove
media site version switching param from request object global collection
$_GET and redirect to the same page without switching param.
Returns
boolean
|
protected
|
#
manageMediaDetectionAndStoreInSession( )
Detect media site version by sent user agent string by
third party \Mobile_Detect library and store detected result
in session namespace for next requests.
Detect media site version by sent user agent string by
third party \Mobile_Detect library and store detected result
in session namespace for next requests.
|
protected
boolean
|
#
checkMediaVersionWithUrlAndRedirectIfNecessary( )
If local media site version is the same as requested - do not process
any redirections. If local media site version is different version than
version in requested url (local media site version is completed previously
from session or by \Mobile_Detect library), then - if strict mode by
session is configured as TRUE - redirect to local media site version.
If it's configured as FALSE , redirect to requested media site version.
If local media site version is the same as requested - do not process
any redirections. If local media site version is different version than
version in requested url (local media site version is completed previously
from session or by \Mobile_Detect library), then - if strict mode by
session is configured as TRUE - redirect to local media site version.
If it's configured as FALSE , redirect to requested media site version.
Returns
boolean
|
protected
array
|
#
setUpMediaSiteVersionToContextAndSession( string $targetMediaSiteVersion )
Set up media site version string into current context and into session and return it.
Set up media site version string into current context and into session and return it.
Parameters
Returns
array
|