resetDeviceDetect() ::
Due to the fact that the CRNRSTN Suite :: was engineered to sit so "low level" in the grand scheme of an application...sitting directly on top of the running $_SERVER environment and hooking into it at run time, it is necessary to provide functionality that will support the manual/brute force "straight lining" or persisting of the client's mobile device identity for the duration of their session (or until resetDeviceDetect() is appropriately called). Otherwise...for example, a mobile device or tablet user (maybe coming to the site from a link in an email) who clicks another link within the LAMP application to view the "desktop version" will still be met with whatever mobile device experience has been prepared in the application...with no way to change their stars. SO SAD! It stands to be said, therefore, that there was no choice but to create resetDeviceDetect() as a reversion enabling component for the device detection functionality within the CRNRSTN Suite :: wherein mobile device/tablet computer profile data...which has been pushed to the session for persistence with the user's experience...can thereupon be reset, and the user's experience in the application can return to "zero" to re-open opportunity for the persistence of other (read as "desktop") use-case scenarios.
Technical specifications ::
- Currently tested on an Ubuntu Server 18.04 running PHP 7.0.22/MySQLi 5.0.12 and CentOS 7 Linux (a 100% compatible rebuild of the Red Hat Enterprise Linux) running PHP 5.6.32/MySQLi 5.5.58.
- It is recommended that you upgrade to the latest official release of PHP to take advantage of gains in security and processing efficiency together with the latest features and functionality.
Invoking class ::
crnrstn_user
Method definition ::
resetDeviceDetect()
Returned value ::
TRUE
Example 1 ::
Set the client's sesson profile in the CRNRSTN Suite :: to indicate that they are a mobile device. We then use resetDeviceDetect() on Line 20 to return to "zero" so that the user can still access the desktop version (literally,...in this case) of the CRNRSTN Suite :: documentation site.
resetDeviceDetect() needs only to be called if setClientMobile(), setClientTablet(), or setClientMobileCustom() are called, and there is the desire to reset the user's session in order to reopen opportunity for desktop experiences within the application in the same user session.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<?php
/*
// J5
// Code is Poetry */
require('_crnrstn.root.inc.php');
include_once($CRNRSTN_ROOT . '/_crnrstn.config.inc.php');
//
// FORCE MOBILE DEVICE PROFILE TO SESSION
$tmp = $oCRNRSTN_USR->setClientMobile();
//
// LET'S CHECK TO SEE IF THE USER IS MOBILE. YES, WE
// FORCED THIS WITH setClientMobile() ON LINE 10 ABOVE.
$iAmMobile = $oCRNRSTN_USR->isClientMobile();
//
// MUST CALL resetDeviceDetect() RIGHT NOW...OR YA'LL
// WILL NEVER SEE THE DESKTOP VERSION OF THIS PAGE! SERIOUSLY!
$oCRNRSTN_USR->resetDeviceDetect();
//
// NOW TO SUPPORT MOBILE DEVICES ON THIS DOCUMENTATION WEB
// SITE...GENUINELY. AGAIN, IF I DON'T CALL THE FOLLOWING
// METHOD, THEN MOBILE DEVICES WILL BE FORCED TO GET
// DESKTOP 100% OF THE TIME ON THIS MOBILE DEVICE COMPATIBLE
// DOCUMENTATION PAGE. SERIOUSLY!
$tmp = $oCRNRSTN_USR->isClientMobile(true);
if($iAmMobile){
//
// MOBILE DEVICE EXPERIENCE
echo 'Hey, I am now permanently mobile...and will be so until resetDeviceDetect() is called!';
}else{
//
// DESKTOP EXPERIENCE. THIS WILL NEVER RUN,YO.
// WE BRUTE FORCED MOBILE PROFILE ON LINE 10 ABOVE.
// YOU WILL BE MOBILE! ;)
echo 'I am not mobile!';
}
?>
Example 1 Output ::
Hey, I am now permanently mobile...and will be so until resetDeviceDetect() is called!