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


PHP Mobile_Detect::isMobile方法代码示例

本文整理汇总了PHP中Mobile_Detect::isMobile方法的典型用法代码示例。如果您正苦于以下问题:PHP Mobile_Detect::isMobile方法的具体用法?PHP Mobile_Detect::isMobile怎么用?PHP Mobile_Detect::isMobile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mobile_Detect的用法示例。


在下文中一共展示了Mobile_Detect::isMobile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: is_mobile_lib_mobile_detect

 /**
  * @return bool
  */
 private function is_mobile_lib_mobile_detect()
 {
     if (!class_exists('Mobile_Detect')) {
         require_once dirname(__FILE__) . '/Mobile/lib/Mobile-Detect-2.8.13/Mobile_Detect.php';
     }
     $detector = new Mobile_Detect();
     return $detector->isMobile();
 }
开发者ID:firatkarakusoglu,项目名称:feedback-cat,代码行数:11,代码来源:Mobile.php

示例2: pow_off

function pow_off()
{
    if (false == POW_OFF) {
        pow_actions();
        return;
    }
    if (!class_exists('Mobile_Detect')) {
        include dirname(__FILE__) . '/lib/Mobile_Detect.php';
    }
    $detect = new Mobile_Detect();
    switch (POW_OFF) {
        case "phone":
            if ($detect->isMobile() && !$detect->isTablet()) {
                return;
            }
            break;
        case "tablet":
            if ($detect->isTablet()) {
                return;
            }
            break;
        case "mobile":
            if ($detect->isMobile()) {
                return;
            }
            break;
    }
    pow_actions();
}
开发者ID:puppy09,项目名称:madC,代码行数:29,代码来源:pullouts.php

示例3: currentMobile

 /**
  * Whether current page was accessed from a mobile phone
  *
  * @return bool true for phones, else false
  */
 private function currentMobile()
 {
     if (empty($this->MobileDetect) || !$this->MobileDetect instanceof \Mobile_Detect) {
         return false;
     }
     //for phones only, not tablets
     //create your own Strategy if needed, and change this functionality
     if ($this->MobileDetect->isMobile() && !$this->MobileDetect->isTablet()) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:mmamedov,项目名称:page-cache,代码行数:18,代码来源:MobileStrategy.php

示例4: executeIndex

 public function executeIndex(HTTPRequest $request)
 {
     $detect = new Mobile_Detect();
     $device = "Your device is a ";
     if ($detect->isMobile() && !$detect->isTablet()) {
         $device .= "mobile";
     } else {
         if ($detect->isMobile()) {
             $device .= "tablet";
         } else {
             $device .= "computer";
         }
     }
     $this->page->addVar('device', $device);
 }
开发者ID:ArtusVuatrin,项目名称:formation_dce,代码行数:15,代码来源:MobileDetectController.php

示例5: createStore

 public function createStore()
 {
     $this->load->dbforge();
     $this->load->helper('file_helper');
     $this->load->helper('Mobile_Detect_helper');
     $this->load->helper('create_db_helper');
     $detect = new Mobile_Detect();
     $deviceName = "";
     if ($detect->isMobile()) {
         $deviceName = "mobile";
     } else {
         if ($detect->isTablet()) {
             $deviceName = "tablet";
         } else {
             $deviceName = "pc";
         }
     }
     $post = $this->input->post();
     $clientInfo = $post["clientInfo"];
     $userId = $this->session->userdata("userid");
     $databaseObj = $this->template->getTemplateName($post["key"]);
     $resultObj = $databaseObj->result()[0];
     $projectName = $resultObj->TemplateProjectName;
     $projectImage = $resultObj->TemplateImage;
     recursive_copy("assets/template/" . $projectName, "../" . $post["domainName"]);
     copy("assets/images/screen-shot/" . $projectImage, "assets/images/screen-shot/" . $post["domainName"] . ".jpg");
     $databaseObj->next_result();
     $databaseObj = $this->template->createStore($post["storeName"], $post["domainName"], $userId, $post["key"], $clientInfo["appCodeName"], $clientInfo["appVersion"], $this->input->ip_address(), $deviceName, $clientInfo["platform"]);
     $newStore = $databaseObj->result()[0];
     $databaseObj->next_result();
     execSql($newStore->TemplateType, $post["domainName"], get_instance());
 }
开发者ID:silvranz,项目名称:ovs,代码行数:32,代码来源:Template.php

示例6: enableNativeMobile

	public function enableNativeMobile() {
		Loader::library('3rdparty/mobile_detect');
		$md = new Mobile_Detect();
		if ($md->isMobile()) {
			$this->addHeaderItem('<meta name="viewport" content="width=device-width,initial-scale=1"></meta>');
		}
	}
开发者ID:nveid,项目名称:concrete5,代码行数:7,代码来源:base.php

示例7: ts_theme_setup

function ts_theme_setup()
{
    /* Add editor-style.css file*/
    add_editor_style();
    /* Add Theme Support */
    add_theme_support('post-formats', array('audio', 'gallery', 'quote', 'video'));
    add_theme_support('post-thumbnails');
    add_theme_support('automatic-feed-links');
    add_theme_support('title-tag');
    $defaults = array('default-color' => '', 'default-image' => '');
    add_theme_support('custom-background', $defaults);
    add_theme_support('woocommerce');
    if (!isset($content_width)) {
        $content_width = 1200;
    }
    /* Translation */
    load_theme_textdomain('gon', get_template_directory() . '/languages');
    $locale = get_locale();
    $locale_file = get_template_directory() . "/languages/{$locale}.php";
    if (is_readable($locale_file)) {
        require_once $locale_file;
    }
    /* Register Menu Location */
    register_nav_menus(array('primary' => esc_html__('Primary Navigation', 'gon')));
    register_nav_menus(array('vertical' => esc_html__('Vertical Navigation', 'gon')));
    register_nav_menus(array('mobile' => esc_html__('Mobile Navigation', 'gon')));
    /* Mobile Detect */
    if (class_exists('Mobile_Detect')) {
        $detect = new Mobile_Detect();
        $_is_tablet = $detect->isTablet();
        $_is_mobile = $detect->isMobile() && !$_is_tablet;
        define('TS_IS_MOBILE', $_is_mobile);
        define('TS_IS_TABLET', $_is_tablet);
    }
}
开发者ID:ericsoncardosoweb,项目名称:dallia,代码行数:35,代码来源:theme_functions.php

示例8: parse_carousel

function parse_carousel($atts, $content, $id)
{
    wp_enqueue_style('ui-custom-theme');
    wp_enqueue_script('jquery-ui-accordion');
    $id = rand();
    $output = '';
    if (class_exists('Mobile_Detect')) {
        $detect = new Mobile_Detect();
        $_device_ = $detect->isMobile() ? $detect->isTablet() ? 'tablet' : 'mobile' : 'pc';
        if (isset($atts['animation'])) {
            $animation_class = $atts['animation'] && $_device_ == 'pc' ? 'wpb_' . $atts['animation'] . ' wpb_animate_when_almost_visible' : '';
        }
    } else {
        if (isset($atts['animation'])) {
            $animation_class = $atts['animation'] ? 'wpb_' . $atts['animation'] . ' wpb_animate_when_almost_visible' : '';
        }
    }
    str_replace("[Carousel_item", "", $content, $i);
    $output .= "\n\t" . '<div class="is-carousel simple-carousel testimonial car-style" id="post-gallery' . $id . '">';
    $output .= "\n\t\t" . '<div class="simple-carousel-content carousel-content">';
    $output .= do_shortcode(str_replace('<br class="nc" />', '', $content));
    $output .= "\n\t\t" . '</div>';
    $output .= "\n\t\t" . '<div class="carousel-pagination"></div>';
    $output .= "\n\t" . '</div>';
    return $output;
}
开发者ID:aljeicks,项目名称:streamtube,代码行数:26,代码来源:carousel.php

示例9: beforeExecuteRoute

 public function beforeExecuteRoute($event)
 {
     $dispatcher = $event->getSource();
     $config = $dispatcher->getDI()->getConfig();
     if (!$config->wscn->mobileRedirect) {
         return true;
     }
     $cookie = $dispatcher->getDI()->getCookies();
     //Disabled redirect from cookie
     if ($cookie->has($config->wscn->mobileRedirectCookieName)) {
         return true;
     }
     $detect = new \Mobile_Detect();
     if ($detect->isMobile()) {
         $controller = $dispatcher->getActiveController();
         $controllerClass = get_class($controller);
         $mobileControllerClass = str_replace('Wscn', 'WscnMobile', $controllerClass);
         $path = $dispatcher->getDI()->getRequest()->getURI();
         if (!class_exists($mobileControllerClass)) {
             $path = '/';
         }
         $mobileDomain = $config->wscn->mobileDomain;
         $redirectTo = "http://{$mobileDomain}{$path}";
         return $dispatcher->getDI()->getResponse()->redirect($redirectTo);
     }
 }
开发者ID:skybird,项目名称:phalcon,代码行数:26,代码来源:DispatchListener.php

示例10: enableNativeMobile

 public function enableNativeMobile()
 {
     $md = new \Mobile_Detect();
     if ($md->isMobile()) {
         $this->addHeaderItem('<meta name="viewport" content="width=device-width,initial-scale=1"/>');
     }
 }
开发者ID:meixelsberger,项目名称:concrete5-5.7.0,代码行数:7,代码来源:DashboardPageController.php

示例11:

 function set_device($switch = false)
 {
     if ($switch) {
         if (defined('APP_LAYOUT')) {
             if (in_array($switch, $DICT = explode(',', APP_LAYOUT))) {
                 $this->set('DEVICE', $device = $switch);
             } else {
                 $device = $this->set_device(false);
             }
         } else {
             $device = $this->set_device(false);
         }
     } else {
         if ($P = $this->is_set('DEVICE')) {
             $device = $P;
         } else {
             require_once D_CLASS . 'MOBILE_DETECT.php';
             $detect = new Mobile_Detect();
             $isMobile = $detect->isMobile();
             $isTablet = $detect->isTablet();
             $this->set('DEVICE', $device = $isMobile ? $isTablet ? 'TABLET' : 'MOBILE' : 'DESKTOP');
         }
     }
     return $this->device = $device;
 }
开发者ID:Waper-IT,项目名称:PHP-BOOTSTRAP,代码行数:25,代码来源:SESSION_.php

示例12: __construct

 public function __construct($session, $view, $request)
 {
     require_once APPLICATION_PATH . '/../vendor/Mobile_Detect.php';
     $detect = new \Mobile_Detect();
     $mobile = $request->getQuery('mobile');
     if ($mobile == 'false') {
         $session->set('device_detect', 'normal');
     }
     if ($mobile == 'true') {
         $session->set('device_detect', 'mobile');
     }
     $isMobile = false;
     $device_detect = $session->get('device_detect');
     if (!empty($device_detect)) {
         $isMobile = $device_detect == 'mobile' ? true : false;
     } else {
         if ($detect->isMobile() && !$detect->isTablet()) {
             $isMobile = true;
             $session->set('device_detect', 'mobile');
         } else {
             $session->set('device_detect', 'normal');
         }
     }
     define('MOBILE_DEVICE', $isMobile ? true : false);
     if (MOBILE_DEVICE) {
         $view->setMainView(MAIN_VIEW_PATH . 'mobile');
     }
 }
开发者ID:nandaabiz,项目名称:yona-cms,代码行数:28,代码来源:MobileDetect.php

示例13: isSmartphone

 /**
  * スマートフォンかどうかを判別する。
  * $_SESSION['pc_disp'] = true の場合はPC表示。
  *
  * @return boolean
  */
 public function isSmartphone()
 {
     $detect = new \Mobile_Detect();
     // SPでかつPC表示OFFの場合
     // TabletはPC扱い
     return $detect->isMobile() && !$detect->isTablet() && !static::getSmartphonePcFlag();
 }
开发者ID:ChigusaYasoda,项目名称:ec-cube,代码行数:13,代码来源:SmartphoneUserAgent.php

示例14: executeIndex

 public function executeIndex(HTTPRequest $request)
 {
     $detect = new \Mobile_Detect();
     $deviceType = $detect->isMobile() ? $detect->isTablet() ? 'tablet' : 'phone' : 'computer';
     $ua = $detect->getUserAgents();
     $this->page->addVar('deviceType', $deviceType);
 }
开发者ID:eneel87,项目名称:formation,代码行数:7,代码来源:DeviceController.php

示例15: actu

 function actu($id_actu)
 {
     $this->load->helper('url');
     $detect = new Mobile_Detect();
     $this->load->model('Menus');
     $this->load->model('Actualites');
     $data['menu'] = $this->Menus->pages_menu();
     $data['content'] = $this->Actualites->affiche_actu($id_actu);
     $data['cat'] = $this->Actualites->get_cat($data['content'][0]->id_cat);
     $data['cat'] = $data['cat'][0]->categorie;
     $data['path_img'] = 'actus';
     $data['footer'] = $this->Menus->menu_footer();
     // Liens du pied de page
     $data['dlfooter'] = $this->Menus->dl_footer();
     // Liens de téléchargement du pied de page
     $this->load->view('header', $data);
     //        $this->load->view('breadcrumb');
     if ($detect->isMobile()) {
         $this->load->view('m_actualite', $data);
     } else {
         $this->load->view('actualite', $data);
         $this->load->view('social');
     }
     $this->load->view('footer', $data);
 }
开发者ID:fsingler,项目名称:pdc,代码行数:25,代码来源:actus.php


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