本文整理汇总了PHP中waRequest::isMobile方法的典型用法代码示例。如果您正苦于以下问题:PHP waRequest::isMobile方法的具体用法?PHP waRequest::isMobile怎么用?PHP waRequest::isMobile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类waRequest
的用法示例。
在下文中一共展示了waRequest::isMobile方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$this->view->assign('title', $this->getTitle());
$this->view->assign('title_style', $this->getTitleStyle());
$this->view->setOptions(array('left_delimiter' => '{', 'right_delimiter' => '}'));
if ($this->template === null) {
if (waRequest::isMobile()) {
$this->setLayout(null);
$this->template = 'LoginMobile.html';
} else {
$this->template = 'Login.html';
}
$template_file = wa()->getDataPath('templates/' . $this->template, false, 'webasyst');
if (file_exists($template_file)) {
$this->template = 'file:' . $template_file;
} else {
$this->template = wa()->getAppPath('templates/actions/login/', 'webasyst') . $this->template;
}
}
$this->view->assign('login', waRequest::post('login', $this->getStorage()->read('auth_login')));
parent::execute();
if ($this->layout) {
$this->layout->assign('error', $this->view->getVars('error'));
}
$ref = waRequest::server('HTTP_REFERER');
if (waRequest::get('back_to') && $ref) {
$this->getStorage()->write('login_back_on_cancel', $ref);
} else {
if (!$ref) {
$this->getStorage()->remove('login_back_on_cancel');
}
}
$this->view->assign('back_on_cancel', wa()->getStorage()->read('login_back_on_cancel'));
}
示例2: frontendHead
public function frontendHead($param)
{
$domain_settings = shopOnestep::getDomainSettings();
if (!(waRequest::isMobile() && !empty($domain_settings['desktop_only'])) && $this->getSettings('status') && $domain_settings['status'] && wa()->getRouting()->getCurrentUrl() != 'checkout/success/' && wa()->getRouting()->getCurrentUrl() != 'checkout/error/' && (wa()->getRouting()->getCurrentUrl() == 'cart/' || preg_match('@^checkout/@i', wa()->getRouting()->getCurrentUrl()))) {
$onestep_url = wa()->getRouteUrl('shop/frontend/onestep');
wa()->getResponse()->redirect($onestep_url);
}
}
示例3: _getTemplate
public function _getTemplate()
{
$template = parent::getTemplate();
if (($id = waRequest::isMobile()) || true) {
$this->view->assign('mobile_id', $id);
$template = str_replace('templates/actions/', 'templates/actions-mobile/', $template);
}
return $template;
}
示例4: getTemplate
protected function getTemplate()
{
if (!$this->template) {
$this->template = 'ApiAuth';
}
if (waRequest::isMobile()) {
$this->template .= 'Mobile';
}
return parent::getTemplate();
}
示例5: afterAuth
protected function afterAuth()
{
$this->getStorage()->remove('auth_login');
$redirect = $this->getConfig()->getCurrentUrl();
$backend_url = $this->getConfig()->getBackendUrl(true);
if (waRequest::isMobile()) {
$this->redirect(array('url' => $backend_url));
}
if (!$redirect || $redirect === $backend_url) {
$redirect = $this->getUser()->getLastPage();
}
if (!$redirect || substr($redirect, 0, strlen($backend_url) + 1) == $backend_url . '?') {
$redirect = $backend_url;
}
$this->redirect(array('url' => $redirect));
}
示例6: execute
public function execute()
{
if (waRequest::isMobile()) {
$this->executeAction(new shopOrdersMobileAction());
} else {
if (wa()->getUser()->getRights('shop', 'orders')) {
$this->executeAction(new shopBackendOrdersAction());
} elseif ($this->getUser()->isAdmin('shop') || wa()->getUser()->getRights('shop', 'type.%')) {
$this->executeAction(new shopBackendProductsAction());
} elseif ($this->getRights('pages') || $this->getRights('design')) {
$this->executeAction(new shopBackendStorefrontsAction());
} elseif ($this->getRights('reports')) {
$this->executeAction(new shopBackendReportsAction());
} elseif (wa()->getUser()->getRights('shop', 'settings')) {
$this->executeAction(new shopBackendSettingsAction());
} else {
$this->setLayout(new shopBackendLayout());
}
}
}
示例7: userAgent
public function userAgent($type = null)
{
$user_agent = waRequest::server('HTTP_USER_AGENT');
if (!$type) {
return $user_agent;
} elseif ($type == 'isMobile') {
return waRequest::isMobile(false);
} elseif ($type == 'platform' || $type == 'os') {
$patterns = array('android' => 'android', 'blackberry' => 'blackberry', 'linux' => 'Linux', 'ios' => '(ipad|iphone|ipod)', 'mac' => '(Macintosh|Mac\\sOS)', 'windows' => 'Windows');
} elseif ($type == 'device') {
$patterns = array('ipad' => 'ipad', 'ipod' => 'ipod', 'iphone' => 'iphone', 'android' => 'android');
}
foreach ($patterns as $id => $pattern) {
if (preg_match('/' . $pattern . '/i', $user_agent)) {
return $id;
}
}
return '';
}