本文整理匯總了PHP中Mobile_Detect::isNative方法的典型用法代碼示例。如果您正苦於以下問題:PHP Mobile_Detect::isNative方法的具體用法?PHP Mobile_Detect::isNative怎麽用?PHP Mobile_Detect::isNative使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Mobile_Detect
的用法示例。
在下文中一共展示了Mobile_Detect::isNative方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setPathInfo
public function setPathInfo($pathInfo = null)
{
parent::setPathInfo($pathInfo);
$path = $this->_pathInfo;
$paths = explode('/', trim($path, '/'));
$language = !empty($paths[0]) ? $paths[0] : '';
if (in_array($language, Core_Model_Language::getLanguageCodes())) {
$this->_language_code = $language;
unset($paths[0]);
$paths = array_values($paths);
}
if (!$this->isInstalling()) {
$paths = $this->_initApplication($paths);
if (!$this->isApplication()) {
$this->_initWhiteLabelEditor();
}
}
// $paths = array_diff($paths, Core_Model_Language::getLanguageCodes());
$paths = array_values($paths);
$this->_pathInfo = '/' . implode('/', $paths);
$detector = new Mobile_Detect();
$this->_is_native = $detector->isNative();
return $this;
}
示例2: _initDesign
protected function _initDesign()
{
$detect = new Mobile_Detect();
$design_codes = array("desktop" => "siberian", "mobile" => "angular");
Zend_Registry::set("design_codes", $design_codes);
if (!$this->getRequest()->isInstalling()) {
if ($this->getRequest()->isApplication()) {
$apptype = 'mobile';
} else {
$apptype = 'desktop';
}
if ($detect->isMobile() || $apptype == 'mobile') {
$device_type = 'mobile';
} else {
$device_type = 'desktop';
}
if ($this->getRequest()->isApplication()) {
$code = $design_codes["mobile"];
} else {
if ($this->_isInstanceOfBackoffice()) {
$code = 'backoffice';
} else {
$code = $design_codes["desktop"];
}
}
} else {
$apptype = 'desktop';
$device_type = 'desktop';
$code = "installer";
}
$base_paths = array(APPLICATION_PATH . "/design/email/template/");
if (!defined("APPLICATION_TYPE")) {
define("APPLICATION_TYPE", $apptype);
}
if (!defined("DEVICE_TYPE")) {
define("DEVICE_TYPE", $device_type);
}
if (!defined("DEVICE_IS_IPHONE")) {
define("DEVICE_IS_IPHONE", $detect->isIphone() || $detect->isIpad());
}
if (!defined("IS_APPLICATION")) {
define("IS_APPLICATION", $detect->isNative() && $this->getRequest()->isApplication());
}
if (!defined("DESIGN_CODE")) {
define("DESIGN_CODE", $code);
}
Core_Model_Directory::setDesignPath("/app/design/{$apptype}/{$code}");
$resources = array('resources' => array('layout' => array('layoutPath' => APPLICATION_PATH . "/design/{$apptype}/{$code}/template/page")));
$base_paths[] = APPLICATION_PATH . "/design/{$apptype}/{$code}/template/";
$bootstrap = Zend_Controller_Front::getInstance()->getParam("bootstrap");
$bootstrap->setOptions($resources);
$bootstrap->bootstrap('View');
$view = $bootstrap->getResource('View');
$view->doctype('HTML5');
foreach ($base_paths as $base_path) {
$view->addBasePath($base_path);
}
Core_View_Default::setDevice($detect);
Application_Controller_Mobile_Default::setDevice($detect);
if (!$this->getRequest()->isInstalling()) {
$blocks = array();
if ($this->getRequest()->isApplication()) {
$blocks = $this->getRequest()->getApplication()->getBlocks();
} else {
if (!$this->_isInstanceOfBackoffice()) {
$blocks = $this->getRequest()->getWhiteLabelEditor()->getBlocks();
if ($block = $this->getRequest()->getWhiteLabelEditor()->getBlock("area")) {
$icon_color = $block->getColor();
Application_Model_Option_Value::setEditorIconColor($icon_color);
}
}
}
if (!empty($blocks)) {
Core_View_Default::setBlocks($blocks);
}
}
}