本文整理汇总了PHP中Mobile_Detect::isFirefox方法的典型用法代码示例。如果您正苦于以下问题:PHP Mobile_Detect::isFirefox方法的具体用法?PHP Mobile_Detect::isFirefox怎么用?PHP Mobile_Detect::isFirefox使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mobile_Detect
的用法示例。
在下文中一共展示了Mobile_Detect::isFirefox方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
$device .= "Smartphone";
}
// Any tablet device.
if ($detect->isTablet()) {
$device .= "Tablet";
}
if (!$detect->isTablet() && !$detect->isMobile()) {
$device .= "Laptop/Computer";
}
// Check for a specific platform with the help of the magic methods:
if ($detect->isiOS()) {
$device .= " running Apple's iOS";
}
if ($detect->isAndroidOS()) {
$device .= " running Android";
}
if ($detect->isChrome()) {
$device .= " with the Browser 'Chrome'";
}
if ($detect->isOpera()) {
$device .= " with the Browser 'Opera'";
}
if ($detect->isIE()) {
$device .= " with the Browser 'Internet Explorer'";
}
if ($detect->isFirefox()) {
$device .= " with the Browser 'Firefox'";
}
if ($detect->isSafari()) {
$device .= " with the Browser 'Safari'";
}
示例2: beforeFilter
public function beforeFilter()
{
parent::beforeFilter();
if (Configure::read('unloadDebugKit') == true) {
$this->Components->unload('DebugKit.Toolbar');
}
// language initialization
$language_list = Configure::read('Config.languageList');
$this->language = $language_list[Configure::read('Config.language')]['code'];
if (isset($this->params['language'])) {
foreach ($language_list as $locale => $language) {
if ($language['active'] && $language['code'] == $this->params['language']) {
$this->language = $this->params['language'];
Configure::write('Config.language', $locale);
break;
}
}
}
// set language
$this->set('language', $this->language);
$this->set('language_list', $language_list);
$this->Session->write('Config.language', $this->language);
// Detect device
$Mobile_Detect = new Mobile_Detect();
$this->device_info = 'Desktop';
$this->device_browser = '';
$this->device_info_type = '';
if ($Mobile_Detect->isTablet()) {
$this->device_info = 'Tablet';
if ($Mobile_Detect->isiPad()) {
$this->device_info_type = 'Ipad';
} else {
if ($Mobile_Detect->isAndroidOS()) {
$this->device_info_type = 'Android';
} else {
$this->device_info_type = 'others';
}
}
} else {
if ($Mobile_Detect->isMobile()) {
$this->device_info = 'Mobile';
if ($Mobile_Detect->isiPhone()) {
$this->device_info_type = 'Iphone';
} else {
if ($Mobile_Detect->isAndroidOS()) {
$this->device_info_type = 'Android';
} else {
$this->device_info_type = 'others';
}
}
}
}
if ($Mobile_Detect->isChrome() && $Mobile_Detect->isSafari()) {
$this->device_browser = 'AndroidDefault';
} else {
if ($Mobile_Detect->isChrome()) {
$this->device_browser = 'Chrome';
} else {
if ($Mobile_Detect->isSafari()) {
$this->device_browser = 'Safari';
} else {
if ($Mobile_Detect->isIE()) {
$this->device_browser = 'IE';
} else {
if ($Mobile_Detect->isFirefox()) {
$this->device_browser = 'Firefox';
} else {
if ($Mobile_Detect->isOpera()) {
$this->device_browser = 'Opera';
} else {
$this->device_browser = 'others';
}
}
}
}
}
}
$this->set('device_info', $this->device_info);
$this->set('device_info_type', $this->device_info_type);
$this->set('device_browser', $this->device_browser);
//GA account
$ga_account = Configure::read('ga_account');
$this->set('ga_account', !empty($ga_account[$this->language]) ? $ga_account[$this->language] : '');
//FB_appID
$FB_appID = Configure::read('FB_appID');
$this->set('FB_appID', $FB_appID);
}