Added function to set a list of features the mobile device supports
and output accordingly e.g., if device is not known to have an open file system or unable to make use of input type="file" don't output that feature
This commit is contained in:
parent
7af1c83f4e
commit
44a5cd2805
@ -51,6 +51,7 @@ class MobileProfilePlugin extends WAP20Plugin
|
|||||||
{
|
{
|
||||||
public $DTD = null;
|
public $DTD = null;
|
||||||
public $serveMobile = false;
|
public $serveMobile = false;
|
||||||
|
public $mobileFeatures = array();
|
||||||
|
|
||||||
function __construct($DTD='http://www.wapforum.org/DTD/xhtml-mobile10.dtd')
|
function __construct($DTD='http://www.wapforum.org/DTD/xhtml-mobile10.dtd')
|
||||||
{
|
{
|
||||||
@ -106,8 +107,7 @@ class MobileProfilePlugin extends WAP20Plugin
|
|||||||
// Or, detect the mobile devices based on their support for
|
// Or, detect the mobile devices based on their support for
|
||||||
// MP 1.0, 1.1, or 1.2 may be ideal. Possible?
|
// MP 1.0, 1.1, or 1.2 may be ideal. Possible?
|
||||||
|
|
||||||
$this->mobiledevices =
|
$this->mobiledevices = array(
|
||||||
array(
|
|
||||||
'alcatel',
|
'alcatel',
|
||||||
'android',
|
'android',
|
||||||
'audiovox',
|
'audiovox',
|
||||||
@ -160,6 +160,8 @@ class MobileProfilePlugin extends WAP20Plugin
|
|||||||
|
|
||||||
foreach($this->mobiledevices as $md) {
|
foreach($this->mobiledevices as $md) {
|
||||||
if (strstr($httpuseragent, $md) !== false) {
|
if (strstr($httpuseragent, $md) !== false) {
|
||||||
|
setMobileFeatures($httpuseragent);
|
||||||
|
|
||||||
$this->serveMobile = true;
|
$this->serveMobile = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -200,6 +202,24 @@ class MobileProfilePlugin extends WAP20Plugin
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function setMobileFeatures($useragent)
|
||||||
|
{
|
||||||
|
/* List of devices that support input type="file" */
|
||||||
|
$mobiledeviceInputFileType = array(
|
||||||
|
'nokia'
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->mobileFeatures['inputfiletype'] = false;
|
||||||
|
|
||||||
|
foreach($mobiledeviceInputFileType as $md) {
|
||||||
|
if (strstr($useragent, $md) !== false) {
|
||||||
|
$this->mobileFeatures['inputfiletype'] = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function onStartShowHeadElements($action)
|
function onStartShowHeadElements($action)
|
||||||
{
|
{
|
||||||
if (!$action->serveMobile) {
|
if (!$action->serveMobile) {
|
||||||
|
Loading…
Reference in New Issue
Block a user