setClientMobileCustom() ::
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 a 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! Enter stage left, setClientMobileCustom(). This method forcefully pushes a custom device profile indicator to the CRNRSTN managed session of said user, so that...regardless of their device or activity within the application...the user may receive the experience that is desired for them without them needing to provide any cursing and frustration along the way. Hooray!!
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 ::
setClientMobileCustom($target_device=NULL)
Method parameter definitions ::
$target_device (Required)
A string value representing a particular algorithm to be used to look for a specific mobile device or tablet computer platform. For a list of supported algorithms, you can check out the Mobile Detect Demo. While there, please feel free to help them improve the mobile detection algorithms by choosing an appropriate answer from the small user experience feedback form on that demo page. This will help to make future releases of Mobile Detect more robust and accurate for everyone...and the CRNRSTN Suite :: They are listed here as well. As of Mobile Detect v2.8.34, the custom detection methods are listed as:
isiPhone(), isBlackBerry(), isHTC(), isNexus(), isDell(), isMotorola(), isSamsung(), isLG(), isSony(), isAsus(), isNokiaLumia(), isMicromax(), isPalm(), isVertu(), isPantech(), isFly(), isWiko(), isiMobile(), isSimValley(), isWolfgang(), isAlcatel(), isNintendo(), isAmoi(), isINQ(), isOnePlus(), isGenericPhone(), isiPad(), isNexusTablet(), isGoogleTablet(), isSamsungTablet(), isKindle(), isSurfaceTablet(), isHPTablet(), isAsusTablet(), isBlackBerryTablet(), isHTCtablet(), isMotorolaTablet(), isNookTablet(), isAcerTablet(), isToshibaTablet(), isLGTablet(), isFujitsuTablet(), isPrestigioTablet(), isLenovoTablet(), isDellTablet(), isYarvikTablet(), isMedionTablet(), isArnovaTablet(), isIntensoTablet(), isIRUTablet(), isMegafonTablet(), isEbodaTablet(), isAllViewTablet(), isArchosTablet(), isAinolTablet(), isNokiaLumiaTablet(), isSonyTablet(), isPhilipsTablet(), isCubeTablet(), isCobyTablet(), isMIDTablet(), isMSITablet(), isSMiTTablet(), isRockChipTablet(), isFlyTablet(), isbqTablet(), isHuaweiTablet(), isNecTablet(), isPantechTablet(), isBronchoTablet(), isVersusTablet(), isZyncTablet(), isPositivoTablet(), isNabiTablet(), isKoboTablet(), isDanewTablet(), isTexetTablet(), isPlaystationTablet(), isTrekstorTablet(), isPyleAudioTablet(), isAdvanTablet(), isDanyTechTablet(), isGalapadTablet(), isMicromaxTablet(), isKarbonnTablet(), isAllFineTablet(), isPROSCANTablet(), isYONESTablet(), isChangJiaTablet(), isGUTablet(), isPointOfViewTablet(), isOvermaxTablet(), isHCLTablet(), isDPSTablet(), isVistureTablet(), isCrestaTablet(), isMediatekTablet(), isConcordeTablet(), isGoCleverTablet(), isModecomTablet(), isVoninoTablet(), isECSTablet(), isStorexTablet(), isVodafoneTablet(), isEssentielBTablet(), isRossMoorTablet(), isiMobileTablet(), isTolinoTablet(), isAudioSonicTablet(), isAMPETablet(), isSkkTablet(), isTecnoTablet(), isJXDTablet(), isiJoyTablet(), isFX2Tablet(), isXoroTablet(), isViewsonicTablet(), isVerizonTablet(), isOdysTablet(), isCaptivaTablet(), isIconbitTablet(), isTeclastTablet(), isOndaTablet(), isJaytechTablet(), isBlaupunktTablet(), isDigmaTablet(), isEvolioTablet(), isLavaTablet(), isAocTablet(), isMpmanTablet(), isCelkonTablet(), isWolderTablet(), isMediacomTablet(), isMiTablet(), isNibiruTablet(), isNexoTablet(), isLeaderTablet(), isUbislateTablet(), isPocketBookTablet(), isKocasoTablet(), isHisenseTablet(), isHudl(), isTelstraTablet(), isGenericTablet(), isAndroidOS(), isBlackBerryOS(), isPalmOS(), isSymbianOS(), isWindowsMobileOS(), isWindowsPhoneOS(), isiOS(), isiPadOS(), isMeeGoOS(), isMaemoOS(), isJavaOS(), iswebOS(), isbadaOS(), isBREWOS(), isChrome(), isDolfin(), isOpera(), isSkyfire(), isEdge(), isIE(), isFirefox(), isBolt(), isTeaShark(), isBlazer(), isSafari(), isWeChat(), isUCBrowser(), isbaiduboxapp(), isbaidubrowser(), isDiigoBrowser(), isMercury(), isObigoBrowser(), isNetFront(), isGenericBrowser(), and isPaleMoon().
Returned value ::
TRUE
Example 1 ::
Set the client's sesson profile in the CRNRSTN Suite :: to indicate that they are a very specific kind of device/computer.
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
45
<?php
/*
// J5
// Code is Poetry */
require('_crnrstn.root.inc.php');
include_once($CRNRSTN_ROOT . '/_crnrstn.config.inc.php');
//
// FORCE WINDOWS MOBILE OS PROFILE TO SESSION
$tmp = $oCRNRSTN_USR->setClientMobileCustom('isWindowsMobileOS()');
//
// LET'S CHECK TO SEE IF THE USER IS WINDOWS MOBILE OS.
// YES, WE FORCED THIS WITH setClientMobileCustom() ON
// LINE 10 ABOVE.
$iAmWindowsMobileOS = $oCRNRSTN_USR->isClientMobileCustom('isWindowsMobileOS()');
//
// 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/TABLET DEVICES ON THIS DOCUMENTATION
// WEB SITE...GENUINELY. AGAIN, IF I DON'T CALL THE FOLLOWING
// METHOD, THEN MOBILE/TABLET DEVICES WILL BE FORCED TO GET
// DESKTOP 100% OF THE TIME ON THIS DOCUMENTATION PAGE.
// SERIOUSLY!
$tmp = $oCRNRSTN_USR->isClientTablet(true);
if($iAmWindowsMobileOS){
//
// TABLET DEVICE EXPERIENCE
echo 'Hey, I am now permanently Windows Mobile OS...and will be so until resetDeviceDetect() is called!';
}else{
//
// DESKTOP EXPERIENCE. THIS WILL NEVER RUN,YO.
// WE BRUTE FORCED WINDOWS MOBILE OS PROFILE
// ON LINE 10 ABOVE. YOU WILL BE WINDOWS! ;)
echo 'I am not Windows Mobile OS! :(';
}
?>
Example 1 Output ::
Hey, I am now permanently Windows Mobile OS...and will be so until resetDeviceDetect() is called!