コード例 #1
0
ファイル: pullouts.php プロジェクト: puppy09/madC
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();
}
コード例 #2
0
ファイル: Device.php プロジェクト: Webiny/WebsiteAnalytics
 /**
  * Returns the stat handler value.
  *
  * @return string
  */
 public function getValue()
 {
     $detect = new \Mobile_Detect($this->statHandlerObject->getHeaders(), $this->statHandlerObject->getUserAgent());
     if ($detect->isMobile() && !$detect->isTablet()) {
         return 'mobile';
     } elseif ($detect->isTablet()) {
         return 'tablet';
     }
     return 'desktop';
 }
コード例 #3
0
 /**
  * Add class to body if mobile or tablet
  */
 function ci_add_class_to_body($classes)
 {
     $detect = new Mobile_Detect();
     if ($detect->isMobile() and !$detect->isTablet()) {
         $classes[] = 'mobile';
     }
     if ($detect->isTablet()) {
         $classes[] = 'tablet';
     }
     return $classes;
 }
コード例 #4
0
ファイル: Device.php プロジェクト: shx13/skeletor
 public static function detect()
 {
     // check the device being used, required by config::get('DEVICE'). (a bit dirty, need to rewrite this)
     $detect = new Mobile_Detect();
     if ($detect->isMobile() && !$detect->isTablet()) {
         $device = 'mobile';
     } elseif ($detect->isTablet()) {
         $device = 'tablet';
     } else {
         $device = 'desktop';
     }
     return $device;
 }
コード例 #5
0
 /**
  * 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;
     }
 }
コード例 #6
0
ファイル: SESSION_.php プロジェクト: Waper-IT/PHP-BOOTSTRAP
 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;
 }
コード例 #7
0
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);
    }
}
コード例 #8
0
ファイル: Template.php プロジェクト: silvranz/ovs
 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());
 }
 /**
  * スマートフォンかどうかを判別する。
  * $_SESSION['pc_disp'] = true の場合はPC表示。
  *
  * @return boolean
  */
 public function isSmartphone()
 {
     $detect = new Mobile_Detect();
     // SPでかつPC表示OFFの場合
     // TabletはPC扱い
     return $detect->isMobile() && !$detect->isTablet() && !SC_SmartphoneUserAgent_Ex::getSmartphonePcFlag();
 }
コード例 #10
0
function initLayoutType()
{
    // Safety check.
    if (!class_exists('Mobile_Detect')) {
        return 'classic';
    }
    $detect = new Mobile_Detect();
    $isMobile = $detect->isMobile();
    $isTablet = $detect->isTablet();
    $layoutTypes = layoutTypes();
    // Set the layout type.
    if (isset($_GET['layoutType'])) {
        $layoutType = $_GET['layoutType'];
    } else {
        if (empty($_SESSION['layoutType'])) {
            $layoutType = $isMobile ? $isTablet ? 'tablet' : 'mobile' : 'classic';
        } else {
            $layoutType = $_SESSION['layoutType'];
        }
    }
    // Fallback. If everything fails choose classic layout.
    if (!in_array($layoutType, $layoutTypes)) {
        $layoutType = 'classic';
    }
    // Store the layout type for future use.
    $_SESSION['layoutType'] = $layoutType;
    return $layoutType;
}
コード例 #11
0
 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);
 }
コード例 #12
0
 /**
  * スマートフォンかどうかを判別する。
  * $_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();
 }
コード例 #13
0
/**
 * Replace main.js with platform dependent scripts. God! Please, make it work!
 *
 */
function presscore_sc_cachedata_filter(&$cachedata)
{
    if (!class_exists('Mobile_Detect')) {
        include get_template_directory() . '/inc/extensions/mobile-detect.php';
    }
    $detect = new Mobile_Detect();
    $device_type = $detect->isMobile() ? $detect->isTablet() ? 'tablet' : 'phone' : 'computer';
    $stylesheet = get_template_directory_uri();
    $dynamic_scripts = array('desktop-tablet' => '<script type=\'text/javascript\' src=\'' . $stylesheet . '/js/desktop-tablet.js\'></script>', 'phone' => '<script type=\'text/javascript\' src=\'' . $stylesheet . '/js/phone.js\'></script>', 'desktop' => '<script type=\'text/javascript\' src=\'' . $stylesheet . '/js/desktop.js\'></script>');
    $main = '<script type=\'text/javascript\' src=\'' . $stylesheet . '/js/main.js\'></script>';
    $output = '';
    // enqueue device specific scripts
    switch ($device_type) {
        case 'tablet':
            $output .= $dynamic_scripts['desktop-tablet'];
            break;
        case 'phone':
            $output .= $dynamic_scripts['phone'];
            break;
        default:
            $output .= $dynamic_scripts['desktop-tablet'];
            $output .= $dynamic_scripts['desktop'];
    }
    $output .= $main;
    // remove cached scripts
    $cachedata = str_replace(array_values($dynamic_scripts), '', $cachedata);
    return str_replace($main, $output, $cachedata);
}
コード例 #14
0
ファイル: carousel.php プロジェクト: aljeicks/streamtube
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;
}
コード例 #15
0
ファイル: MobileDetect.php プロジェクト: nandaabiz/yona-cms
 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');
     }
 }
コード例 #16
0
ファイル: ress.php プロジェクト: alexandruspataru/Starter
function nexus_body_classes($classes)
{
    $detect = new Mobile_Detect();
    if ($detect->isMobile() && !$detect->isTablet()) {
        $classes[] = 'mobile not-tablet not-desktop';
    }
    /* Mobile Class */
    if ($detect->isTablet()) {
        $classes[] = 'tablet not-mobile not-desktop';
    }
    /* Tablet Class */
    if (!$detect->isMobile()) {
        $classes[] = 'desktop not-mobile not-tablet';
    }
    /* Desktop Class */
    return $classes;
}
コード例 #17
0
 public function detect()
 {
     if ($this->detected === null) {
         $headers = $this->request->getHeaders();
         $userAgent = $this->request->getHeaderLine('user-agent');
         if ($this->detector->isMobile($headers, $userAgent)) {
             $this->detected = 'mobile';
         } else {
             if ($this->detector->isTablet($headers, $userAgent)) {
                 $this->detected = 'tablet';
             } else {
                 $this->detected = 'desktop';
             }
         }
     }
     return $this->detected;
 }
コード例 #18
0
ファイル: DeviceController.php プロジェクト: shibiro/Melody
 public function executeIndex(HTTPRequest $request)
 {
     $this->run();
     $detect = new \Mobile_Detect();
     $deviceType = $detect->isMobile() ? $detect->isTablet() ? 'tablet' : 'phone' : 'computer';
     // on ajoute la variable du type
     $this->page()->addVar('deviceType', $deviceType);
 }
コード例 #19
0
 function type()
 {
     // instantiate Mobile_Detect Object
     $detect = new \Mobile_Detect();
     // get the device type
     $deviceType = $detect->isMobile() ? $detect->isTablet() ? 'tablet' : 'phone' : 'none';
     // return string value of device type
     return $deviceType;
 }
コード例 #20
0
ファイル: BasicsTest.php プロジェクト: kennygrage/dynastyDish
 public function testBasicMethods()
 {
     $this->assertNotEmpty($this->detect->getScriptVersion());
     $this->detect->setHttpHeaders(array('SERVER_SOFTWARE' => 'Apache/2.2.15 (Linux) Whatever/4.0 PHP/5.2.13', 'REQUEST_METHOD' => 'POST', 'HTTP_HOST' => 'home.ghita.org', 'HTTP_X_REAL_IP' => '1.2.3.4', 'HTTP_X_FORWARDED_FOR' => '1.2.3.5', 'HTTP_CONNECTION' => 'close', 'HTTP_USER_AGENT' => 'Mozilla/5.0 (iPhone; CPU iPhone OS 6_0_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A523 Safari/8536.25', 'HTTP_ACCEPT' => 'text/vnd.wap.wml, application/json, text/javascript, */*; q=0.01', 'HTTP_ACCEPT_LANGUAGE' => 'en-us,en;q=0.5', 'HTTP_ACCEPT_ENCODING' => 'gzip, deflate', 'HTTP_X_REQUESTED_WITH' => 'XMLHttpRequest', 'HTTP_REFERER' => 'http://mobiledetect.net', 'HTTP_PRAGMA' => 'no-cache', 'HTTP_CACHE_CONTROL' => 'no-cache', 'REMOTE_ADDR' => '11.22.33.44', 'REQUEST_TIME' => '01-10-2012 07:57'));
     //12 because only 12 start with HTTP_
     $this->assertCount(12, $this->detect->getHttpHeaders());
     $this->assertTrue($this->detect->checkHttpHeadersForMobile());
     $this->detect->setUserAgent('Mozilla/5.0 (iPhone; CPU iPhone OS 6_0_1 like Mac OS X) AppleWebKit/536.26 (KHTML, like Gecko) Version/6.0 Mobile/10A523 Safari/8536.25');
     $this->assertNotEmpty($this->detect->getUserAgent());
     $this->assertTrue($this->detect->isMobile());
     $this->assertFalse($this->detect->isTablet());
     $this->assertTrue($this->detect->isIphone());
     $this->assertTrue($this->detect->isiphone());
     $this->assertTrue($this->detect->isiOS());
     $this->assertTrue($this->detect->isios());
     $this->assertTrue($this->detect->is('iphone'));
     $this->assertTrue($this->detect->is('ios'));
 }
コード例 #21
0
ファイル: Data.php プロジェクト: ahsanmage/vr
 public function checkMobilePhp()
 {
     require_once Mage::getBaseDir('lib') . DS . 'em/Mobile_Detect.php';
     $check = 0;
     $detect = new Mobile_Detect();
     if ($detect->isMobile() && !$detect->isTablet()) {
         $check = 1;
     }
     return $check;
 }
コード例 #22
0
function InitMobileDetect(&$that)
{
    $that->load->library('Mobile_Detect');
    $detect = new Mobile_Detect();
    $that->data['PROFILE_DEVICE'] = DEVICE_UNKNOWN;
    $that->data['PATH_VIEW'] = 'pc';
    if ($detect->isMobile() && !$detect->isTablet()) {
        $that->data['PROFILE_DEVICE'] = DEVICE_PHONE;
        $that->data['PATH_VIEW'] = 'phone';
    } else {
        if ($detect->isTablet()) {
            $that->data['PROFILE_DEVICE'] = DEVICE_TABLET;
            $that->data['PATH_VIEW'] = 'pc';
        } else {
            $that->data['PROFILE_DEVICE'] = DEVICE_PC;
            $that->data['PATH_VIEW'] = 'pc';
        }
    }
}
コード例 #23
0
 public function get_index()
 {
     $detect = new Mobile_Detect();
     if ($detect->isMobile() || $detect->isTablet()) {
         $data['loginlayout'] = 'admin::layouts.m_admin';
     } else {
         $data['loginlayout'] = 'admin::layouts.admin';
     }
     return View::make('admin::login.index', $data);
 }
コード例 #24
0
ファイル: functions.php プロジェクト: Boooober/arch
function wp_mobile_detect()
{
    include_once ARC_THEME_DIR . 'Mobile_Detect.php';
    $detect = new Mobile_Detect();
    if ($detect->isMobile() || $detect->isTablet()) {
        return true;
    } else {
        return false;
    }
}
コード例 #25
0
ファイル: styles.class.php プロジェクト: venturepact/blog
 function __construct($option_name)
 {
     $this->options_name = $option_name;
     include_once XT_PARENT_DIR . '/lib/classes/Mobile_Detect.php';
     $detect = new Mobile_Detect();
     $this->is_touch_device = false;
     if ($detect->isMobile() || $detect->isTablet()) {
         $this->is_touch_device = true;
     }
 }
コード例 #26
0
 public function get_device_type()
 {
     require_once './php/library/Mobile_Detect.php';
     $detect = new Mobile_Detect();
     $device = 'desktop';
     if ($detect->isMobile() && !$detect->isTablet()) {
         $device = 'mobile';
     }
     return $device;
 }
コード例 #27
0
ファイル: MobileViews.php プロジェクト: stonedz/pff2
 /**
  * Executes actions before the Controller
  *
  * @return mixed
  */
 public function doBefore()
 {
     $this->_isMobile = $this->_md->isMobile();
     $this->_isTablet = $this->_md->isTablet();
     if (!isset($_SESSION[$this->_sessionAutoName]) && $this->_isTablet) {
         $_SESSION[$this->_sessionAutoName] = $this->_allowMobileForTablet;
     } elseif (!isset($_SESSION[$this->_sessionAutoName]) || $_SESSION[$this->_sessionAutoName] == '') {
         $_SESSION[$this->_sessionAutoName] = $this->_defaultBehaviour;
     }
     $_SESSION[$this->_sessionName] = $this->_isMobile;
 }
コード例 #28
0
 /**
  * 
  *
  * @package Kopa
  * @subpackage Core
  * @author thethangtran <*****@*****.**>
  * @since 1.0.0
  *      
  */
 public static function detect_image_size($size)
 {
     if ($size && 'true' == KopaOptions::get_option('is_use_mobile_detect', 'false')) {
         $detect = new Mobile_Detect();
         if ($detect->isMobile()) {
         }
         if ($detect->isTablet()) {
         }
     }
     return apply_filters('kopa_image_detect_image_size', $size);
 }
コード例 #29
0
ファイル: View.php プロジェクト: spelgrift/imageman
 public function detectDevice()
 {
     require 'libs/Mobile_Detect.php';
     $detect = new Mobile_Detect();
     $device = 'lg';
     if ($detect->isMobile()) {
         $device = 'sm';
         if ($detect->isTablet()) {
             $device = 'sm';
         }
     }
     return $device;
 }
コード例 #30
0
ファイル: templates.class.php プロジェクト: Gordondalos/union
 function __construct()
 {
     $this->dir = ROOT_DIR . '/templates/';
     $mobile_detect = new Mobile_Detect();
     if ($mobile_detect->isMobile()) {
         $this->smartphone = true;
         $this->desktop = false;
     }
     if ($mobile_detect->isTablet()) {
         $this->smartphone = false;
         $this->desktop = false;
         $this->tablet = true;
     }
 }