本文整理汇总了PHP中Mobile_Detect::isIpad方法的典型用法代码示例。如果您正苦于以下问题:PHP Mobile_Detect::isIpad方法的具体用法?PHP Mobile_Detect::isIpad怎么用?PHP Mobile_Detect::isIpad使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mobile_Detect
的用法示例。
在下文中一共展示了Mobile_Detect::isIpad方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: mobileDetect
function mobileDetect()
{
$mobile_theme = Sanitize::getString($this->c->Config, 'mobile_theme');
if ($mobile_theme == '') {
return;
}
if (!Configure::read('System.mobileDetect')) {
if (App::import('Vendor', 'mobile_detect' . DS . 'Mobile_Detect')) {
$detect = new Mobile_Detect();
if ($detect->isMobile() && !$detect->isIpad()) {
// It is mobile
Configure::write('System.isMobile', true);
$this->c->viewTheme = $mobile_theme;
} else {
// Not mobile
Configure::write('System.isMobile', false);
}
Configure::write('System.mobileDetect', true);
}
} elseif (Configure::read('System.isMobile')) {
$this->c->viewTheme = $mobile_theme;
}
}
示例2: set_device
function set_device($user_agent)
{
global $request_settings;
$key = 'di_' . $user_agent;
$cache_result = get_cache($key);
if ($cache_result) {
if (isset($cache_result['device_os'])) {
$request_settings['device_os'] = $cache_result['device_os'];
}
$request_settings['main_device'] = $cache_result['main_device'];
return true;
}
error_reporting(0);
require_once 'modules/devicedetection/Mobile_Detect.php';
$detect = new Mobile_Detect($user_agent);
if ($detect->isIphone()) {
$temp['device_os'] = get_device_osversion(1, $user_agent);
$temp['main_device'] = 'IPHONE';
} else {
if ($detect->isIpad()) {
$temp['device_os'] = get_device_osversion(1, $user_agent);
$temp['main_device'] = 'IPAD';
} else {
if ($detect->isIpod()) {
$temp['device_os'] = get_device_osversion(1, $user_agent);
$temp['main_device'] = 'IPOD';
} else {
if ($detect->isAndroidOS()) {
$temp['device_os'] = get_device_osversion(2, $user_agent);
$temp['main_device'] = 'ANDROID';
} else {
if ($detect->ismobile()) {
$temp['main_device'] = 'OTHER';
} else {
$temp['main_device'] = 'NOMOBILE';
if (!MAD_SERVE_NOMOBILE) {
print_error(1, 'This ad-server does not serve ads to non-mobile devices.', $request_settings['sdk'], 1);
return false;
}
}
}
}
}
}
if (isset($temp['device_os']) && !empty($temp['device_os'])) {
$request_settings['device_os'] = $temp['device_os'];
}
$request_settings['main_device'] = $temp['main_device'];
set_cache($key, $temp, 1500);
}
示例3: _initDesign
protected function _initDesign()
{
if (!$this->_request->isInstalling()) {
$request = $this->_request;
$this->_prepareBlocks();
}
$locale = Zend_Registry::get('Zend_Locale');
$lang = Core_Model_Language::getCurrentLanguage();
$detect = new Mobile_Detect();
$this->getPluginLoader()->addPrefixPath('Siberian_Application_Resource', 'Siberian/Application/Resource');
if (!$this->_request->isInstalling()) {
if ($this->_request->isApplication()) {
$apptype = 'mobile';
} else {
$apptype = 'desktop';
}
if ($detect->isMobile() || $apptype == 'mobile') {
$device_type = 'mobile';
} else {
$device_type = 'desktop';
}
$code = 'siberian';
} else {
$apptype = 'desktop';
$device_type = 'desktop';
$code = "installer";
}
$base_paths = array(APPLICATION_PATH . "/design/email/template/");
define('APPLICATION_TYPE', $apptype);
define('DEVICE_TYPE', $device_type);
define('DEVICE_IS_IPHONE', $detect->isIphone() || $detect->isIpad());
define('IS_APPLICATION', $detect->isApplication() && $this->_request->isApplication());
Core_Model_Directory::setDesignPath("/app/design/{$apptype}/{$code}");
define('DESIGN_CODE', $code);
$resources = array('resources' => array('layout' => array('layoutPath' => APPLICATION_PATH . "/design/{$apptype}/{$code}/template/page")));
$base_paths[] = APPLICATION_PATH . "/design/{$apptype}/{$code}/template/";
$this->setOptions($resources);
$this->bootstrap('View');
$view = $this->getResource('View');
$view->doctype('HTML5');
foreach ($base_paths as $base_path) {
$view->addBasePath($base_path);
}
Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer')->setNeverRender(true);
Core_View_Default::setDevice($detect);
}
示例4: header
<?php
include 'Mobile_Detect.php';
$detect = new Mobile_Detect();
if ($detect->isAndroidtablet() || $detect->isIpad() || $detect->isBlackberrytablet()) {
// mostar versión para tablets
header("Location: http://*.html");
} elseif ($detect->isAndroid()) {
// versión Android
header("Location: http://*.html");
} elseif ($detect->isIphone()) {
// versión iPhone
header("Location: http://*.html");
} elseif ($detect->isMobile()) {
// versión para otros móviles
header("Location: http://*.html");
} else {
// versión "normal"
header("Location: http://*.html");
}
示例5: _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);
}
}
}
示例6:
/**
* Check if you are on a table or not
*
* @return bool
* @since 1.0.0
*/
function yit_is_tablet()
{
$mobile = new Mobile_Detect();
return $mobile->isIpad() || $mobile->isBlackberryTablet() || $mobile->isAndroidTablet();
}
示例7: substr
break;
default:
//do nothing
}
}
if ($detect->isMobile()) {
$is_desktop = false;
$device = 'mobile';
}
if ($detect->isTablet()) {
$is_desktop = false;
$device = 'tablet';
}
$is_ios = $detect->isIphone();
if (!$is_ios) {
$is_ios = $detect->isIpad();
}
//if we're on ipad or iphone check safari version
if ($is_ios) {
$ios_vers = substr($detect->version('iOS'), 0, 1);
$phoneOs = 'ios';
// $ios_vers = $detect->version('iOS');
// $safari_vers = $detect->version('Safari');
if ($ios_vers < 7) {
$ios_vers = "uns-device";
$browser = 'ie8';
}
}
if ($detect->isAndroidOS()) {
$phoneOs = 'android';
}
示例8: while
<?php
require_once "include/Mobile_Detect.php";
$detect = new Mobile_Detect();
$is_mobile = false;
if ($detect->isMobile() && !$detect->isIpad()) {
$is_mobile = ture;
}
?>
<?php
include 'header.php';
if (have_posts()) {
while (have_posts()) {
the_post();
?>
<section class="background">
<ul class="rslides">
<?php
$slides = get_field("slideshow");
if ($slides) {
foreach ($slides as $slide) {
echo '<li><img src="' . $slide['url'] . '" alt=""></li>';
}
}
?>
</ul>
<div class="overlay"></div>
</section>
<div class="viewport">
<?php
示例9: die
<?php
include 'Mobile_Detect.php';
$detect = new Mobile_Detect();
if ($detect->isiOS()) {
echo "iOS has been detected<br>";
if ($detect->isIpad()) {
echo "It's an iPad, running version: " . $detect->version('iPad');
}
if ($detect->isIphone()) {
echo "It's an iPhone, running version: " . $detect->version('iPhone');
}
} else {
die("No iOS detected.");
}
示例10: cached
/**
* Outputs cached dispatch view cache
*
* @param string $url Requested URL
* @access public
*/
function cached($url)
{
App::import('Component', 'config', $this->app);
if (!Configure::read('System.mobileDetect') && App::import('Vendor', 'mobile_detect' . DS . 'Mobile_Detect')) {
$detect = new Mobile_Detect();
if ($detect->isMobile() && !$detect->isIpad()) {
// It is mobile
Configure::write('System.isMobile', true);
$this->here .= '.mob';
} else {
// Not mobile
Configure::write('System.isMobile', false);
}
Configure::write('System.mobileDetect', true);
}
$controller = new stdClass();
if (class_exists('ConfigComponent')) {
$Config = new ConfigComponent();
$Config->startup($controller);
}
$User = cmsFramework::getUser();
if ($User->id === 0 && !Configure::read('Cache.disable') && Configure::read('Cache.view') && !defined('MVC_FRAMEWORK_ADMIN')) {
$path = $this->here;
if ($this->here == '/') {
$path = 'home';
}
$path = Inflector::slug($path);
$filename = CACHE . 'views' . DS . $path . '.php';
if (!file_exists($filename)) {
$filename = CACHE . 'views' . DS . $path . '_index.php';
}
if (file_exists($filename)) {
if (!class_exists('MyView')) {
App::import('Core', 'View', $this->app);
}
$controller = null;
$view = new MyView($controller, false);
// Pass the configuration object to the view and set the theme variable for helpers
$view->name = $this->controller;
$view->action = $this->action;
$view->page = Sanitize::getInt($this->params, 'page');
$view->limit = Sanitize::getInt($this->params, 'limit');
$view->Config = $Config;
$view->viewTheme = $Config->template;
$view->ajaxRequest = $this->isAjax();
$out = $view->renderCache($filename, S2getMicrotime());
return $out;
}
}
return false;
}