当前位置: 首页>>代码示例>>PHP>>正文


PHP Mobile_Detect::isIpad方法代码示例

本文整理汇总了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;
     }
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:23,代码来源:theming.php

示例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);
}
开发者ID:aiurlano,项目名称:mAdserve-Fork,代码行数:50,代码来源:r_f.php

示例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);
 }
开发者ID:BeamlabsTigre,项目名称:Webapp,代码行数:46,代码来源:Bootstrap.php

示例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");
}
开发者ID:bykike,项目名称:MobileDetect,代码行数:20,代码来源:index.php

示例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);
         }
     }
 }
开发者ID:bklein01,项目名称:siberian_cms_2,代码行数:77,代码来源:Default.php

示例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();
 }
开发者ID:jayeshnair,项目名称:ctp,代码行数:11,代码来源:Mobile.php

示例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';
}
开发者ID:rabenmedia,项目名称:uk,代码行数:31,代码来源:header_init.php

示例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 
开发者ID:sachoco,项目名称:iiinitiative,代码行数:31,代码来源:front-page.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.");
}
开发者ID:CrazyDev,项目名称:minewriter,代码行数:15,代码来源:iosTest.php

示例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;
 }
开发者ID:atikahmed,项目名称:joomla-probid,代码行数:57,代码来源:dispatcher.php


注:本文中的Mobile_Detect::isIpad方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。