/**
  * スニッフィング
  * 
  * @see wp-includes/template-loader.php
  */
 function sniffing($template)
 {
     $ua =& wp_attache_mobile_controller::boot('ua');
     if ($ua->_isMobile === true) {
         $theme = get_template();
         $themeRoots = get_theme_roots();
         $uaTemplate = str_replace('.php', ".{$ua->_ua}.php", $template);
         $mobileTemplate = str_replace('.php', ".{$ua->_agents['MOBILE']}.php", $template);
         if (file_exists($uaTemplate)) {
             $template = $uaTemplate;
         } elseif (file_exists($mobileTemplate)) {
             $template = $mobileTemplate;
         }
     }
     return $template;
 }
Exemplo n.º 2
0
 /**
  * UA (とモバイルフラッグ)の判定
  */
 function set_ua()
 {
     $this->_agentMobile =& wp_attache_mobile_controller::boot('Net_UserAgent_Mobile', 'pear');
     if ($this->_agentMobile->isNonMobile()) {
         if (strpos($_SERVER['HTTP_USER_AGENT'], 'iPhone') !== false) {
             $this->_ua = $this->_agents['IPHONE'];
         } else {
             if (strpos($_SERVER['HTTP_USER_AGENT'], 'Android') !== false) {
                 $this->_ua = $this->_agents['ANDROID'];
             } else {
                 $this->_ua = $this->_agents['DEFAULT'];
             }
         }
     } else {
         $this->_ua = strtolower($this->_agentMobile->getCarrierLongName());
         $this->_isMobile = true;
     }
 }
 /**
  * 初期処理
  */
 function init()
 {
     load_plugin_textdomain('wp_attache_mobile', false, 'wp_attache_mobile/languages');
     wp_attache_mobile_controller::boot();
 }