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


PHP Mobile_Detect::isiPhone方法代码示例

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


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

示例1: beforeFilter

 public function beforeFilter()
 {
     parent::beforeFilter();
     if (Configure::read('unloadDebugKit') == true) {
         $this->Components->unload('DebugKit.Toolbar');
     }
     // language initialization
     $language_list = Configure::read('Config.languageList');
     $this->language = $language_list[Configure::read('Config.language')]['code'];
     if (isset($this->params['language'])) {
         foreach ($language_list as $locale => $language) {
             if ($language['active'] && $language['code'] == $this->params['language']) {
                 $this->language = $this->params['language'];
                 Configure::write('Config.language', $locale);
                 break;
             }
         }
     }
     // set language
     $this->set('language', $this->language);
     $this->set('language_list', $language_list);
     $this->Session->write('Config.language', $this->language);
     // Detect device
     $Mobile_Detect = new Mobile_Detect();
     $this->device_info = 'Desktop';
     $this->device_browser = '';
     $this->device_info_type = '';
     if ($Mobile_Detect->isTablet()) {
         $this->device_info = 'Tablet';
         if ($Mobile_Detect->isiPad()) {
             $this->device_info_type = 'Ipad';
         } else {
             if ($Mobile_Detect->isAndroidOS()) {
                 $this->device_info_type = 'Android';
             } else {
                 $this->device_info_type = 'others';
             }
         }
     } else {
         if ($Mobile_Detect->isMobile()) {
             $this->device_info = 'Mobile';
             if ($Mobile_Detect->isiPhone()) {
                 $this->device_info_type = 'Iphone';
             } else {
                 if ($Mobile_Detect->isAndroidOS()) {
                     $this->device_info_type = 'Android';
                 } else {
                     $this->device_info_type = 'others';
                 }
             }
         }
     }
     if ($Mobile_Detect->isChrome() && $Mobile_Detect->isSafari()) {
         $this->device_browser = 'AndroidDefault';
     } else {
         if ($Mobile_Detect->isChrome()) {
             $this->device_browser = 'Chrome';
         } else {
             if ($Mobile_Detect->isSafari()) {
                 $this->device_browser = 'Safari';
             } else {
                 if ($Mobile_Detect->isIE()) {
                     $this->device_browser = 'IE';
                 } else {
                     if ($Mobile_Detect->isFirefox()) {
                         $this->device_browser = 'Firefox';
                     } else {
                         if ($Mobile_Detect->isOpera()) {
                             $this->device_browser = 'Opera';
                         } else {
                             $this->device_browser = 'others';
                         }
                     }
                 }
             }
         }
     }
     $this->set('device_info', $this->device_info);
     $this->set('device_info_type', $this->device_info_type);
     $this->set('device_browser', $this->device_browser);
     //GA account
     $ga_account = Configure::read('ga_account');
     $this->set('ga_account', !empty($ga_account[$this->language]) ? $ga_account[$this->language] : '');
     //FB_appID
     $FB_appID = Configure::read('FB_appID');
     $this->set('FB_appID', $FB_appID);
 }
开发者ID:hongtien510,项目名称:cms_v1,代码行数:87,代码来源:AppController.php

示例2: array

	/**
	 * Loads cookie and sets up theme filters.
	 */
	static function setup_theme() {
		global $wpdb;
		$tablemobility = $wpdb->prefix.'ult25_mobile';
		$browser = new Mobile_Detect;
		if($browser->isMobile()){
			if(isset($_REQUEST['theme'])): // click desktop
				self::set_theme_onclick();
			endif;
			self::load_cookie();
			if ( ! empty( self::$theme ) ) :
			add_filter( 'pre_option_template', array( self::$theme, 'get_template' ) );
			add_filter( 'pre_option_stylesheet', array( self::$theme, 'get_stylesheet' ) );
			add_filter( 'pre_option_stylesheet_root', array( self::$theme, 'get_theme_root' ) );
			
			$parent = self::$theme->parent();
			
			if( empty( $parent ) )
				add_filter( 'pre_option_template_root', array( self::$theme, 'get_theme_root' ) );
			else
				add_filter( 'pre_option_template_root', array( $parent, 'get_theme_root' ) );
			
			add_filter( 'pre_option_current_theme', '__return_false' );
			else:
			/*
			 * isAndroidOS()	bool(false)
			 * isBlackBerryOS()	bool(false)
			 * isPalmOS()	bool(false)
			 * isSymbianOS()	bool(false)
			 * isWindowsMobileOS()	bool(false)
			 * isWindowsPhoneOS()	bool(false)
			 * isiOS()	bool(false)
			 */
			$browsing = false;
			if($browser->isiPad()){
				$browsing = 'iPad';
			} elseif ($browser->isiPhone()){
				$browsing= 'iPhone';
			} elseif ($browser->isAndroidOS()){
				if($browser->isTablet()){
				$browsing = 'AndroidTablet';
				} else {
				$browsing = 'Android';
				}
			} elseif ($browser->isWindowsMobileOS() || $browser->isWindowsPhoneOS()){
				if($browser->isTablet()){
					$browsing = 'WindowsTablet';
				} else {
					$browsing = 'Windows';
				}
			} elseif ($browser->isBlackBerryOS()){
				$browsing = 'BlackBerry';
			}
			if($browsing){
			$mobilethemeq = "SELECT * FROM `".$tablemobility."` WHERE `device`='$browsing'";
			$mfetch=$wpdb->get_row($mobilethemeq);
			if($mfetch){
				$theme = wp_get_theme(  $mfetch->theme );
				
				if (
				$theme->exists()
				&& $theme->get( 'Name' ) != get_option( 'current_theme' )
				&& self::is_allowed( $theme )
				) {
					self::$theme = $theme;
					add_filter( 'pre_option_template', array( self::$theme, 'get_template' ) );
					add_filter( 'pre_option_stylesheet', array( self::$theme, 'get_stylesheet' ) );
					add_filter( 'pre_option_stylesheet_root', array( self::$theme, 'get_theme_root' ) );
					
					$parent = self::$theme->parent();
					
					if( empty( $parent ) )
						add_filter( 'pre_option_template_root', array( self::$theme, 'get_theme_root' ) );
					else
					add_filter( 'pre_option_template_root', array( $parent, 'get_theme_root' ) );
					add_filter( 'pre_option_current_theme', '__return_false' );
					add_action('ultimatum_meta', 'ultimatum_add_noscale_meta');
					add_action('ultimatum_meta', 'ultimatum_web_app_meta');
					if($mfetch->mpush==1){
						//add_action('ultimatum_meta', 'ultimatum_web_app_bubble');
						//add_action('ultimatum_before_body_close','ultimatum_web_app_link_hider');
					}
				}
				
			}
			}
			endif;
		}
		if ( self::can_switch_themes() ) {
			self::load_cookie();

			if ( ! empty( self::$theme ) ) {

				add_filter( 'pre_option_template', array( self::$theme, 'get_template' ) );
				add_filter( 'pre_option_stylesheet', array( self::$theme, 'get_stylesheet' ) );
				add_filter( 'pre_option_stylesheet_root', array( self::$theme, 'get_theme_root' ) );

				$parent = self::$theme->parent();
//.........这里部分代码省略.........
开发者ID:polaris610,项目名称:medicalhound,代码行数:101,代码来源:ult-switcher.php

示例3:

        global $more;
        $more = 0;
        the_content('<div style="padding-top: 15px;"><button class="btn btn-info" style="float: right;" type="button">Read More</button></div>');
        ?>
</div>

				<?php 
    }
    ?>
	
				</div>
		</div>
	</div>
</div>
<?php 
    if ($detect->isMobile() || $detect->isTablet() || $detect->isiPhone() || $detect->isiOS()) {
        if (!get_previous_posts_link() || !get_next_posts_link()) {
            ?>
			
<div id="row-widget-header" class="navigation">
	<div id="sub-container">
		<div class="row" id="widgetrow" style="padding-left: 10px; padding-right: 10px; padding-bottom: 10px;">
			
			<?php 
            add_filter('next_posts_link_attributes', 'posts_link_next_class');
            function posts_link_next_class()
            {
                return 'class="btn btn-default custom btn-outline-inverse pull-right"';
            }
            add_filter('previous_posts_link_attributes', 'posts_link_prev_class');
            function posts_link_prev_class()
开发者ID:jonbrown21,项目名称:JBD-Wordpress-Theme,代码行数:31,代码来源:category.php

示例4: get_device_name

function get_device_name($userAgent)
{
    $detect = new Mobile_Detect();
    $detect->setUserAgent($userAgent);
    $deviceType = $detect->isMobile() ? $detect->isTablet() ? 'tablet' : 'cell' : 'computer';
    if ($deviceType == 'computer') {
        return $deviceType;
    }
    $name = 'unknow';
    do {
        if ($detect->isiPhone()) {
            $name = 'iPhone';
            break;
        }
        if ($detect->isBlackBerry()) {
            $name = 'BlackBerry';
            break;
        }
        if ($detect->isHTC()) {
            $name = 'HTC';
            break;
        }
        if ($detect->isNexus()) {
            $name = 'Nexus';
            break;
        }
        if ($detect->isDell()) {
            $name = 'Dell';
            break;
        }
        if ($detect->isMotorola()) {
            $name = 'Motorola';
            break;
        }
        if ($detect->isSamsung()) {
            $name = 'Samsung';
            break;
        }
        if ($detect->isLG()) {
            $name = 'LG';
            break;
        }
        if ($detect->isSony()) {
            $name = 'Sony';
            break;
        }
        if ($detect->isAsus()) {
            $name = 'Asus';
            break;
        }
        if ($detect->isPalm()) {
            $name = 'Palm';
            break;
        }
        if ($detect->isVertu()) {
            $name = 'Vertu';
            break;
        }
        if ($detect->isPantech()) {
            $name = 'Pantech';
            break;
        }
        if ($detect->isFly()) {
            $name = 'Fly';
            break;
        }
        if ($detect->isSimValley()) {
            $name = 'SimValley';
            break;
        }
        if ($detect->isGenericPhone()) {
            $name = 'Generic';
            break;
        }
        if ($detect->isiPad()) {
            $name = 'iPad';
            break;
        }
        if ($detect->isNexusTablet()) {
            $name = 'Nexus';
            break;
        }
        if ($detect->isSamsungTablet()) {
            $name = 'Samsung';
            break;
        }
        if ($detect->isKindle()) {
            $name = 'Kindle';
            break;
        }
        if ($detect->isSurfaceTablet()) {
            $name = 'Surface';
            break;
        }
        if ($detect->isAsusTablet()) {
            $name = 'Asus';
            break;
        }
        if ($detect->isBlackBerryTablet()) {
            $name = 'BlackBerry';
//.........这里部分代码省略.........
开发者ID:sdgdsffdsfff,项目名称:html-sensor,代码行数:101,代码来源:device_name.php


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