crnrstn() ::
The successful instantiation of a crnrstn :: class
object requires passing a user defined serial key for the purposes of serializing
the environmentally specific configuration profile data that is stored by the
CRNRSTN Suite. If there are multiple config files running
within the web application (read as multiple landing pages, micro-sites or web sites within the same hosting
environment/directory structure), this $configSerial parameter needs to be unique
per site in order to prevent resource contention within
CRNRSTN's internal session management policy whilst going
from site to site. Also and optionally, a second parameter...an integer representing the desired
debug profile...can be passed to the constructor.
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
Method definition ::
__construct($configSerial, $debugMode=0)
Method parameter definitions ::
$configSerial (Required)
Serialization parameter for the CRNRSTN Suite configuration
profile. If the hosting environment has multiple CRNRSTN
configuration files, the value for this parameter needs to be unique per each
configuration file to prevent resource contention within
CRNRSTN's internal session management policy.
$debugMode (Optional)
0=OFF,
1=ROLLING APPEND,
2=REAL-TIME ERROR_LOG OUTPUT
Returned value ::
Returns a string 'isMobile' on successful mobile match. 'isTablet' will be returned, however, if $tabletIsMobile is passed in as TRUE and the User-Agent and HTTP headers indicate that the client is a tablet computer. FALSE is returned for non-successful matches.
Example 1 ::
Retrieve a multi data-type response as indication of the existence of conditions which...to a high degree of probability...confirm (or deny) that this is a request originating from a mobile device or tablet 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
<?php
/*
// J5
// Code is Poetry */
require('_crnrstn.root.inc.php');
include_once($CRNRSTN_ROOT . '/_crnrstn.config.inc.php');
//
// PASSING TRUE ALLOWS TABLET COMPUTERS TO BE DETECTED AS MOBILE.
$iAmMobile = $oCRNRSTN_USR->isClientMobile(true);
if($iAmMobile){
//
// MOBILE/TABLET DEVICE EXPERIENCE
echo 'I am mobile!';
}else{
//
// DESKTOP EXPERIENCE
echo 'I am not mobile!';
}
?>
Example 1 Output ::