function getMobileInformation()
{
    $detect = new Mobile_Detect();
    $isMobile = "false";
    $isTablet = "false";
    $mobileOS = '';
    $mobileVersion = '';
    $versionIsSufficient = false;
    if ($detect->isMobile()) {
        $isMobile = "true";
        if ($detect->isTablet()) {
            $isTablet = "true";
        }
        if ($detect->isiOs()) {
            $mobileOS = 'iOS';
            $mobileVersion = $detect->version('iOS');
            $versionArray = explode('_', $mobileVersion);
            if ($versionArray[0] >= 6) {
                $versionIsSufficient = true;
            }
        } elseif ($detect->isAndroidOS()) {
            $mobileOS = 'Android';
            $mobileVersion = $detect->version('Android');
            $versionArray = explode('.', $mobileVersion);
            if ($versionArray[0] >= 4 && $versionArray[1] >= 1) {
                $versionIsSufficient = true;
            }
        } elseif ($detect->isWindowsPhoneOS()) {
            $mobileOS = 'WindowsPhoneOS';
            $mobileVersion = $detect->version('WindowsPhoneOS');
        } else {
            $mobileOS = 'Other mobile OS';
            $mobileVersion = 'NONE';
        }
    }
    return array('isMobile' => $isMobile, 'isTablet' => $isTablet, 'mobileOS' => $mobileOS, 'mobileVersion' => $mobileVersion, 'mobileIsSufficient' => $versionIsSufficient);
}
Exemplo n.º 2
0
Arquivo: demo.php Projeto: ssrsfs/blg
><?php 
    var_dump($check);
    ?>
</td>
            </tr>
        <?php 
}
?>
        </tbody>
        <tbody>
            <tr>
                <th colspan="2">Experimental version() method</th>
            </tr>
            <?php 
foreach ($detect->getProperties() as $name => $match) {
    $check = $detect->version($name);
    if ($check !== false) {
        ?>
            <tr>
                <td>version(<?php 
        echo $name;
        ?>
)</td>
                <td><?php 
        var_dump($check);
        ?>
</td>
            </tr>
            <?php 
    }
    ?>
Exemplo n.º 3
0
 /**
  * @dataProvider versionDataProvider
  * @covers Mobile_Detect::version
  */
 public function testVersionExtraction($userAgent, $property, $stringVersion, $floatVersion)
 {
     $md = new Mobile_Detect(array('HTTP_USER_AGENT' => $userAgent));
     $prop = $md->version($property);
     $this->assertSame($stringVersion, $prop);
     $prop = $md->version($property, 'float');
     $this->assertSame($floatVersion, $prop);
     //assert that garbage data is always === false
     $prop = $md->version('garbage input is always garbage');
     $this->assertFalse($prop);
 }
 function doCheckBuyAndDownload($config)
 {
     $objFormParam = new SC_FormParam();
     $this->lfInitParam($objFormParam);
     $objFormParam->setParam($_REQUEST);
     $objCustomer = new SC_Customer_Ex();
     $objQuery = SC_Query::getSingletonInstance();
     $detect = new Mobile_Detect();
     $version = $detect->version("iOS", Mobile_Detect::VERSION_TYPE_FLOAT);
     $contentid = $this->arrProduct["product_code_min"];
     $curl = $this->curl_init(KISEKAE_TOUCH_IPHONE_API01);
     $post = $this->getPost($config, array("contentid" => $contentid, "device" => $objFormParam->getValue("device_name", "iPhone6"), "version" => floor($version), "apiversion" => null, "operator" => "au", "lang" => "ja"));
     $this->getDs($post, $config);
     curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));
     GC_Utils_Ex::gfPrintLog(print_r($post, TRUE), DEBUG_LOG_REALFILE);
     $result = curl_exec($curl);
     $status = SC_XML::xpath($result, "//status/@value");
     $vid = SC_XML::xpath($result, "//validation/@id");
     switch ($status) {
         default:
             SC_Utils_Ex::sfDispSiteError(PAGE_ERROR);
         case "000":
             GC_Utils_Ex::gfDebugLog($result);
             $_COOKIE["product_ktc_vid"] = $vid;
             break;
     }
     // API2
     $openid = $objCustomer->getValue("au_open_id");
     $curl = $this->curl_init(KISEKAE_TOUCH_IPHONE_API02);
     $post = $this->getPost($config, array("contentid" => $contentid, "userid" => $openid, "vid" => $vid));
     $this->getDs($post, $config);
     curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));
     GC_Utils_Ex::gfPrintLog(print_r($post, TRUE), DEBUG_LOG_REALFILE);
     $result = curl_exec($curl);
     $status = SC_XML::xpath($result, "//status/@value");
     switch ($status) {
         default:
             SC_Utils_Ex::sfDispSiteError(PAGE_ERROR);
             break;
         case "000":
         case "010":
             // TEST
             // /ios/products/detail.php?mode=check_buy_and_download&product_id=13&classcategory_id1=0&classcategory_id2=0&quantity=1&admin=&favorite_product_id=&product_class_id=&device_name=iPhone6Plus&device_height=736&device_width=414&device_rate=3&device_lang=ja&ignore_redownload=1
             if ($_GET["ignore_redownload"] == "1") {
                 $status = "000";
             }
             break;
     }
     if ($status == "000") {
         // FIXME 課金処理
         // API03
         $curl = $this->curl_init(KISEKAE_TOUCH_IPHONE_API03);
         if ($objCustomer->getValue("buy_to_nopoint") == "1") {
             $price = $this->arrProduct["price02_min"];
             $settlementtype = "998";
             $redownloaddate = date("Ymd");
         } else {
             $price = $this->arrProduct["price02_min"];
             $settlementtype = "001";
             $redownloaddate = date("Ymd", strtotime($this->downloadable_days2));
         }
         $post = $this->getPost($config, array("contentid" => $contentid, "price" => $price, "redownloaddate" => $redownloaddate, "userid" => $openid, "vid" => $vid, "settlementtype" => $settlementtype));
         $this->getDs($post, $config);
         curl_setopt($curl, CURLOPT_POSTFIELDS, http_build_query($post));
         GC_Utils_Ex::gfPrintLog(print_r($post, TRUE), DEBUG_LOG_REALFILE);
         $result = curl_exec($curl);
         $authentication_id = SC_XML::xpath($result, "//authentication/@id");
         $objFormParam = new SC_FormParam();
         $this->setOrderParam($objFormParam, $vid, $authentication_id);
         $objFormParam->convParam();
         $message = '';
         $arrValBef = array();
         $objPurchase = new SC_Helper_Purchase_Ex();
         $objPurchase->saveShippingTemp(array());
         $order_id = $this->doRegister("", $objPurchase, $objFormParam, $message, $arrValBef);
         $customer_id = $objCustomer->getValue("customer_id");
         $this->addPointHistory($order_id, $customer_id, $objFormParam, $objQuery);
     } else {
         $authentication_id = SC_XML::xpath($result, "//authentication/@id");
     }
     $netUrl = new Net_URL(KISEKAE_TOUCH_IPHONE_CST02);
     $netUrl->addQueryString("aid", $authentication_id);
     $netUrl->addQueryString("cpid", $config["cpid"]);
     $netUrl->addQueryString("siteid", $config["siteid"]);
     $netUrl->addQueryString("contentid", $contentid);
     $netUrl->addQueryString("ts", date("YmdHis"));
     $post2 = $netUrl->querystring;
     $this->getDs($post2, $config);
     $netUrl->addRawQueryString(http_build_query($post2));
     GC_Utils_Ex::gfPrintLog(print_r($post2, TRUE), DEBUG_LOG_REALFILE);
     header("Location: " . $netUrl->getURL());
 }
Exemplo n.º 5
0
 /**
  * @medium
  * @dataProvider userAgentData
  */
 public function testUserAgents($userAgent, $isMobile, $isTablet, $version, $model, $vendor)
 {
     //make sure we're passed valid data
     if (!is_string($userAgent) || !is_bool($isMobile) || !is_bool($isTablet)) {
         $this->markTestIncomplete("The User-Agent {$userAgent} does not have sufficient information for testing.");
         return;
     }
     //setup
     $md = new Mobile_Detect();
     $md->setUserAgent($userAgent);
     //is mobile?
     $this->assertEquals($md->isMobile(), $isMobile);
     //is tablet?
     $this->assertEquals($md->isTablet(), $isTablet, 'FAILED: ' . $userAgent . ' isTablet: ' . $isTablet);
     if (isset($version)) {
         foreach ($version as $condition => $assertion) {
             $this->assertEquals($assertion, $md->version($condition), 'FAILED UA (version("' . $condition . '")): ' . $userAgent);
         }
     }
     //version property tests
     if (isset($version)) {
         foreach ($version as $property => $stringVersion) {
             $v = $md->version($property);
             $this->assertSame($stringVersion, $v);
         }
     }
     //@todo: model test, not sure how exactly yet
     //@todo: vendor test. The below is theoretical, but fails 50% of the tests...
     /*if (isset($vendor)) {
           $method = "is$vendor";
           $this->assertTrue($md->{$method}(), "Expected Mobile_Detect::{$method}() to be true.");
       }*/
 }
Exemplo n.º 6
0
 public function getOsVersion()
 {
     $detect = new Mobile_Detect();
     if ($this->getDeviceOs() == "IOS") {
         return $detect->version('iPhone');
     }
     if ($this->getDeviceOs() == "ANDROID") {
         return $detect->version('Android');
     }
     return 0;
 }
Exemplo n.º 7
0
<?php

require_once '../Mobile_Detect.php';
/*
$detect = new Mobile_Detect;
$detect->setUserAgent('Mozilla/5.0 (iPhone; CPU iPhone OS 8_0_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) CriOS/38.0.2125.59 Mobile/12A405 Safari/600.1.4');
var_dump($detect->version('Chrome'));
var_dump($detect->version('iPhone'));
*/
/*
$user_agents = array(
    'android' => 'Mozilla/5.0 (Linux; Android 4.2; Nexus 7 Build/JOP40C) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.166 Safari/535.19',
    'iphone6' => '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',
    'blackberry' => 'Mozilla/5.0 (BB10; Touch) AppleWebKit/537.10+ (KHTML, like Gecko) Version/10.0.9.2372 Mobile Safari/537.10+'
);
$mobile_detect = new Mobile_Detect;

foreach($user_agents as $user_agent)
{
    $mobile_detect->setUserAgent($user_agent);
    var_dump($mobile_detect->isAndroidOS());
}
*/
$detect = new Mobile_Detect();
//$detect->setUserAgent('Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko');
//var_dump($detect->version('IE'));
$detect->setUserAgent('Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko');
var_dump($detect->version('IE'));
Exemplo n.º 8
0
 /**
  * Check the version of the given property in the User-Agent.
  *
  * @inherit
  */
 public function version($propertyName, $type = self::VERSION_TYPE_STRING)
 {
     $check = key(static::$additionalProperties);
     // Check if the additional properties have been added already
     if (!array_key_exists($check, parent::$properties)) {
         // TODO: why is mergeRules not working here?
         parent::$properties = array_merge(parent::$properties, static::$additionalProperties);
     }
     return parent::version($propertyName, $type);
 }
Exemplo n.º 9
0
/**
 * Builds the Smart Image shortcode output.
 *
 * Allows a plugin to replace the content that would otherwise be returned. The
 * filter is 'img_smart_image_shortcode' and passes an empty string, the attr
 * parameter and the content parameter values.
 *
 * The supported attributes for the shortcode are 'id', 'align', 'width', and
 * 'caption'.
 *
 * @since 2.6.0
 *
 * @param array  $attr {
 *     Attributes of the caption shortcode.
 *
 *     @type string $id      ID of the div element for the caption.
 *     @type string $align   Class name that aligns the caption. Default 'alignnone'. Accepts 'alignleft',
 *                           'aligncenter', alignright', 'alignnone'.
 *     @type int    $width   The width of the caption, in pixels.
 *     @type string $caption The caption text.
 *     @type string $class   Additional class name(s) added to the caption container.
 * }
 * @param string $content Shortcode content.
 * @return string HTML content to display the caption.
 */
function img_smart_image_shortcode($attr, $content = null)
{
    // New-style shortcode with the caption inside the shortcode with the link and image tags.
    $image_meta = wp_get_attachment_metadata($attr['image_id']);
    //echo json_encode($image_meta);
    $mobile_detect = new Mobile_Detect();
    if ($mobile_detect->version('IE') === "8.0") {
        $image_large = wp_get_attachment_image_src($attr['image_id'], 'full');
        $final_image = '<img src="' . make_href_root_relative($image_large[0]) . '" class="aligncenter" />';
        return $final_image;
    }
    if (get_field('image_animated_png', $attr['image_id'])) {
        $image_large = wp_get_attachment_image_src($attr['image_id'], 'full');
        // See if the uploaded image is retina
        if (strpos($image_meta['file'], '@2x') > 0) {
            $attr['retina'] = true;
        }
        if (strpos($image_meta['file'], '@3x') > 0) {
            $attr['super_retina'] = true;
        }
        // If this image has bleed, but it's turned off
        if (!isset($attr['bleed']) || isset($attr['bleed']) && $attr['bleed'] === "false") {
            // set the image width if it's a retina image
            $css_max_width = isset($attr['retina']) && $attr['retina'] === true ? 'max-width:' . $image_large[1] / 2 . 'px;' : 'max-width:' . $image_large[1] . 'px;';
            $css_max_width = isset($attr['super_retina']) && $attr['super_retina'] === true ? 'max-width:' . $image_large[1] / 3 . 'px;' : $css_max_width;
            // set the image width if it's a standard image
            if (isset($attr['retina']) && $attr['retina'] !== true) {
                $css_max_width = isset($attr['width']) && $attr['width'] !== true ? 'max-width:' . $attr['width'] . 'px;' : $css_max_width;
            }
        } else {
            // otherwise, set bleed on.
            $has_bleed = ' has_bleed';
            $css_max_width = 'max-width:100%;';
        }
        $final_image = '<img src="' . make_href_root_relative($image_large[0]) . '" style="' . $css_max_width . '" class="aligncenter apng-image" />';
        return $final_image;
    }
    if ($image_meta) {
        // Return the svg instead of the smart iamge stuff here.
        if (strpos($image_meta['file'], '.svg') > 0) {
            $image_large = wp_get_attachment_image_src($attr['image_id'], 'full');
            $final_image = '<img src="' . $image_large[0] . '" class="' . $attr['class'] . '" />';
        } else {
            $image_meta = wp_get_attachment_metadata($attr['image_id']);
            // gets the images
            $image_large = wp_get_attachment_image_src($attr['image_id'], 'full');
            $image_md = wp_get_attachment_image_src($attr['image_id'], 'medium-hero-png');
            $image_sm = wp_get_attachment_image_src($attr['image_id'], 'small-hero-png');
            $placeholder = wp_get_attachment_image_src($attr['image_id'], 'apple-square-76');
            // update to
            // Sets up the images array
            $images = array('(min-width:1023px), (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)' => make_href_root_relative($image_large[0]), '(min-width:1023px)' => make_href_root_relative($image_large[0]), '(min-width:1023px), (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)' => make_href_root_relative($image_large[0]), '(min-width:1023px)' => make_href_root_relative($image_md[0]), '(max-width:640px), (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi)' => make_href_root_relative($image_md[0]), '(max-width:640px)' => make_href_root_relative($image_sm[0]));
            // encodes the images array for future use in Javascript
            $images = base64_encode(json_encode($images));
            // If this image has zoom enabled, we turn it on here.
            $has_zoom = isset($attr['zoom']) && $attr['zoom'] === 'true' ? true : false;
            $has_zoom = $has_zoom ? ' has_zoom' : '';
            $has_bleed = false;
            $background_color = get_field('image_preload_color', $attr['image_id']);
            $zoom_color = isset($attr['zoom']) && $attr['zoom'] === 'true' ? ' data-zoom_bg="' . $background_color . '"' : '';
            // if the image hasn't been uploaded through the dashboard, we make it so that a string is echo'd to find those bugs.
            echo $image_meta === false ? 'Looks like image ' . $attr['image_id'] . ' hasn\'t been uploaded through the dashboard.' : '';
            // Sets the maximum width of the current image.
            $css_max_width = ' style="max-width:100%"';
            // See if the uploaded image is retina
            if (strpos($image_meta['file'], '@2x') > 0) {
                $attr['retina'] = true;
            }
            if (strpos($image_meta['file'], '@3x') > 0) {
                $attr['super_retina'] = true;
            }
            // If this image has bleed, but it's turned off
            if (!isset($attr['bleed']) || isset($attr['bleed']) && $attr['bleed'] === "false") {
                // set the image width if it's a retina image
                $css_max_width = isset($attr['retina']) && $attr['retina'] === true ? 'max-width:' . $image_large[1] / 2 . 'px;' : 'max-width:' . $image_large[1] . 'px;';
                $css_max_width = isset($attr['super_retina']) && $attr['super_retina'] === true ? 'max-width:' . $image_large[1] / 3 . 'px;' : $css_max_width;
                // set the image width if it's a standard image
                if (isset($attr['retina']) && $attr['retina'] !== true) {
                    $css_max_width = isset($attr['width']) && $attr['width'] !== true ? 'max-width:' . $attr['width'] . 'px;' : $css_max_width;
                }
            } else {
                // otherwise, set bleed on.
                $has_bleed = ' has_bleed';
                $css_max_width = 'max-width:100%;';
            }
            // Sets the aspect ratio
            $css_padding_bottom = $image_large[1] !== null && $image_large[2] !== null ? $image_large[2] / $image_large[1] * 100 . '%' : 0;
            // begin creating the $final_image video with for the javascript to parse.
            $final_image = '<figure id="' . $attr['image_id'] . '" class="progressive_image js-not_loaded' . $has_zoom . $has_bleed . ' ' . $attr['class'] . '" width="' . $attr['width'] . '" height="' . $attr['height'] . '" style="' . $css_max_width . '" ' . $zoom_color . ' itemscope="" itemtype="http://schema.org/ImageObject">';
            //$final_image .= '<div class="aspect_ratio_placeholder" style="' . $css_max_width . ' background-image:url(\''.make_href_root_relative($placeholder[0]).'\');">';
            $final_image .= '<div class="aspect_ratio_placeholder" style="' . $css_max_width . '">';
            $final_image .= '<div class="aspect_ratio_fill" style="padding-bottom:' . $css_padding_bottom . ';"></div>';
            // this div keeps the aspect ratio so the placeholder doesn't collapse
            $final_image .= '<div class="progressiveMedia is-imageLoaded" style="' . $css_max_width . '">';
            $final_image .= '<img src="' . $placeholder[0] . '" class="low-quality-image" style="' . $css_max_width . '" itemscope="contentUrl" content="' . make_href_root_relative($image_lg[0]) . '"/>';
            // this is a tiny image with a resolution of e.g. ~27x17 and low quality
            // 		<canvas/> <!-- takes the above image and applies a blur filter -->
            $final_image .= '<div class="js-swap-for-picture" data-image_info="' . $images . '"></div>';
            // <!-- the large image to be displayed -->
            $no_script_image = '<img class="progressiveMedia-noscript js-progressiveMedia-inner" src="' . make_href_root_relative($image_large[0]) . '" data-action="zoom" />';
            $final_image .= '<noscript>' . $no_script_image . '</noscript>';
            // fallback for no JS
            $final_image .= '</div>';
            $final_image .= '</div>';
            // If this image has a caption, echo it here.
            if ($content) {
                $final_image .= '<figcaption class="wp-caption-text">' . $content . '</figcaption>';
            }
            $final_image .= '</figure>';
        }
    } else {
        $image_large = wp_get_attachment_image_src($attr['image_id'], 'full');
        $final_image = '<img src="' . make_href_root_relative($image_large[0]) . '" class="aligncenter" />';
    }
    return $final_image;
}
Exemplo n.º 10
0
 function coll_body_class($classes)
 {
     global $coll_is_mobile;
     $classes[] = 'coll-custom-structure';
     if ($coll_is_mobile) {
         $classes[] = 'coll-mobile';
     }
     $coll_detect = new Mobile_Detect();
     if ($coll_detect->isiOS()) {
         $ver = $coll_detect->version('iOS');
         if ($ver[0] == 8) {
             $classes[] = 'coll-safari8';
         }
     }
     if (strpos($_SERVER['HTTP_USER_AGENT'], 'Safari') && !strpos($_SERVER['HTTP_USER_AGENT'], 'Chrome')) {
         $ver = $coll_detect->version('Safari');
         if ($ver[0] == 8) {
             $classes[] = 'coll-safari8';
         }
     }
     return $classes;
 }
Exemplo n.º 11
0
<?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.");
}
Exemplo n.º 12
0
 public function actionIndex()
 {
     $newsModules = AppbymePoralModule::getModuleList();
     $forumList = ForumUtils::getForumListForHtml();
     $navInfo = AppbymeUIDiyModel::getNavigationInfo(true);
     $tempModules = AppbymeUIDiyModel::getModules(true);
     // 初始化默认配置
     if (empty($navInfo) || empty($navInfo['navItemList']) || empty($tempModules)) {
         $navInfo = AppbymeUIDiyModel::initNavigation();
         $tempModules = AppbymeUIDiyModel::initModules();
     }
     // 必须存在发现导航
     $hasDiscoverNavItem = false;
     foreach ($navInfo['navItemList'] as $navItem) {
         if ($navItem['moduleId'] == AppbymeUIDiyModel::MODULE_ID_DISCOVER) {
             $hasDiscoverNavItem = true;
             break;
         }
     }
     !$hasDiscoverNavItem && array_unshift($navInfo['navItemList'], AppbymeUIDiyModel::initNavItemDiscover());
     // 必须存在发现和快发模块
     $isFindDiscover = $isFindFastpost = false;
     $discoverModule = AppbymeUIDiyModel::initDiscoverModule();
     $fastpostModule = AppbymeUIDiyModel::initFastpostModule();
     $modules = array();
     foreach ($tempModules as $module) {
         switch ($module['id']) {
             case AppbymeUIDiyModel::MODULE_ID_DISCOVER:
                 if (!$isFindDiscover) {
                     $isFindDiscover = true;
                     $discoverModule = $module;
                 }
                 break;
             case AppbymeUIDiyModel::MODULE_ID_FASTPOST:
                 if (!$isFindFastpost) {
                     $isFindFastpost = true;
                     $fastpostModule = $module;
                 }
                 break;
             default:
                 $modules[] = $module;
                 break;
         }
     }
     array_unshift($modules, $discoverModule, $fastpostModule);
     // 检测浏览器信息
     $mobileDetect = new Mobile_Detect();
     $browserInfo = $mobileDetect->version('Chrome');
     $this->renderPartial('index', array('navInfo' => $navInfo, 'modules' => $modules, 'newsModules' => $newsModules, 'forumList' => $forumList, 'browserInfo' => $browserInfo, 'appLevel' => AppUtils::getAppLevel(), 'topicTypeSortInfos' => $this->_getTopicTypeSortInfos()));
 }
Exemplo n.º 13
0
 function init()
 {
     parent::init();
     $objCustomer = new SC_Customer_Ex();
     if (isset($_GET["sid"]) && isset($_GET["admin"])) {
         $sid = $_REQUEST["sid"];
         $email = $objCustomer->getValue("email");
         $osid = session_id();
         if ($osid != $sid) {
             session_destroy();
             session_id($sid);
             session_start();
         }
         $objCustomer->setLogin($email);
         $get = $_GET;
         unset($get["sid"]);
         SC_Response_Ex::reload($get, true);
     }
     $objQuery = SC_Query_Ex::getSingletonInstance();
     $objProduct = new SC_Product_Ex();
     if (GC_Utils_Ex::isFrontFunction() && $this->skip_load_page_layout == false) {
         $objCustomer = new SC_Customer_Ex();
         // 画面更新毎に情報を更新する
         if ($objCustomer->isLoginSuccess()) {
             // 初回アクセス時に更新
             $objCustomer->updateSession();
             $this->tpl_login = true;
             $this->tpl_point = $objCustomer->getValue("point");
             $this->tpl_customer_id = $objCustomer->getValue("customer_id");
             $this->tpl_first_buy_date = $objCustomer->getValue("first_buy_date");
             $this->tpl_carrier = $objCustomer->getValue("carrier");
             $downloadable_days = $this->arrSiteInfo["downloadable_days"];
             $downloadable_days_unlimited = $this->arrSiteInfo["downloadable_days_unlimited"];
             $date = null;
             if ($downloadable_days_unlimited) {
                 $date = SC_Utils_Ex::sfGetTimestamp(RELEASE_YEAR, 1, 1, false);
                 $date2 = SC_Utils_Ex::sfGetTimestamp(9999, 12, 31, false);
             } else {
                 $xdate = strtotime("-{$downloadable_days} day");
                 $date = SC_Utils_Ex::sfGetTimestamp(date("Y", $xdate), date("m", $xdate), date("d", $xdate), false);
                 $xdate = strtotime("+{$downloadable_days} day");
                 $date2 = SC_Utils_Ex::sfGetTimestamp(date("Y", $xdate), date("m", $xdate), date("d", $xdate), false);
             }
             $this->downloadable_days = $date;
             $this->downloadable_days2 = $date2;
             $objPurchase = new SC_Helper_Purchase_Ex();
             $arrOrderId = $objQuery->getCol("order_id", "dtb_order", "payment_date > ? AND customer_id = ?", array($date, $this->tpl_customer_id));
             $this->arrRedownloadProduct = array();
             foreach ($arrOrderId as $order_id) {
                 $arrOrderDetail = $objPurchase->getOrderDetail($order_id, true);
                 $this->arrRedownloadProduct = array_merge($this->arrRedownloadProduct, $arrOrderDetail);
             }
             // 再ダウンロード可能な商品一覧
             $this->arrRedownloadProduct = SC_Utils_Ex::makeArrayIDToKey("product_id", $this->arrRedownloadProduct);
             foreach ($this->arrRedownloadProduct as $product_id => $row) {
                 $row["product"] = $objProduct->getDetail($product_id);
                 $this->arrRedownloadProduct[$product_id] = $row;
             }
         } else {
             $this->tpl_login = false;
             $this->tpl_point = 0;
             $this->tpl_customer_id = 0;
             $this->tpl_first_buy_date = null;
             $this->tpl_carrier = 9;
             $this->arrRedownloadProduct = array();
         }
         $objDb = new SC_Helper_DB_Ex();
         if ($objDb->sfColumnExists("cp_dtb_customer_transaction", "id")) {
             $where = " customer_id =  ? AND transaction_status =  ? AND continue_account_id IS NOT NULL AND del_flg = 0";
             $arrWhereVal = array($this->tpl_customer_id, 40);
             if ($objQuery->exists("cp_dtb_customer_transaction", $where, $arrWhereVal)) {
                 // OK
             } else {
                 switch (basename(dirname($_SERVER["SCRIPT_NAME"]))) {
                     case "au":
                         break;
                     default:
                         if ($objCustomer->isLoginSuccess()) {
                             $objCustomer->EndSession();
                             SC_Response_Ex::reload();
                         }
                         break;
                 }
             }
         }
         $objCategory = new SC_Helper_Category_Ex();
         $this->arrCommonCategory = $objCategory->getList(true);
         $this->arrCommonCategoryTree = $objCategory->getTree();
         $detect = new Mobile_Detect();
         $script_file = $_SERVER["SCRIPT_NAME"];
         $script_file = ltrim($script_file, "/");
         $script_file2 = str_replace("ios/", "", $script_file);
         if ($detect->is("iOS")) {
             if (file_exists(HTML_REALDIR . "ios/{$script_file}")) {
                 SC_Response_Ex::sendRedirect(HTTP_URL . "ios/{$script_file}", $_GET);
             }
         } elseif (strcmp($script_file, $script_file2) !== 0) {
             SC_Response_Ex::sendRedirect(HTTP_URL . "{$script_file2}", $_GET);
         }
         $_SESSION["is_android"] = $detect->is("AndroidOS");
         if ($detect->isMobile() == false) {
             // NG
             $this->device_support = false;
         } elseif ($detect->is("iOS")) {
             if ($detect->match("iPhone")) {
                 // OK
                 $this->device_support = true;
             } elseif ($detect->match("iPod")) {
                 // NG
                 $this->device_support = false;
             } elseif ($detect->match("iPad")) {
                 // NG
                 $this->device_support = false;
             } else {
                 // NG
                 $this->device_support = false;
             }
             $version = $detect->version("iOS", $detect::VERSION_TYPE_FLOAT);
             if ($version < 6) {
                 // NG
                 $this->device_support = false;
             }
         } elseif ($detect->match("Android") == false) {
             // NG
             $this->device_support = false;
         } elseif (class_exists("SC_DeviceAndroidSelect_Ex", true)) {
             $useragent = array();
             if (preg_match("|.*; ([^;]+) Build/.*|", $_SERVER["HTTP_USER_AGENT"], $useragent)) {
                 $device = new SC_DeviceAndroidSelect_Ex(array("search_device_user_agent_word" => $useragent[1], "search_status" => 1));
                 $this->device_support = $device->exists();
                 $this->tpl_device = $device->getOne();
             }
         } elseif ($detect->match("Android")) {
             // OK
             $this->device_support = true;
         } else {
             // NG
             $this->device_support = false;
         }
     }
     if ($this->device_support) {
         GC_Utils_Ex::gfPrintLog("対応端末:" . $_SERVER['HTTP_USER_AGENT']);
         return;
     } else {
         GC_Utils_Ex::gfPrintLog("非対応端末:" . $_SERVER['HTTP_USER_AGENT']);
         if (is_a($this, "LC_Page_Index")) {
             SC_Response_Ex::sendRedirect(HTTP_URL . "unsupported/index.php");
         } elseif (is_a($this, "LC_Page_Unsupported")) {
             // 非対応端末表示を行わない
             return;
         } elseif (is_a($this, "LC_Page_Entry_Kiyaku")) {
             // 非対応端末表示を行わない
             return;
         } elseif ($this->not_unsupported) {
             // 非対応端末表示を行わない
             return;
         } else {
             SC_Response_Ex::sendRedirect(HTTP_URL . "unsupported/index.php");
         }
     }
 }
Exemplo n.º 14
0
<?php

include_once 'libraries/Mobile-Detect-2.8.15/Mobile_Detect.php';
$detect = new Mobile_Detect();
if (!$detect->isMobile()) {
    echo "PC: play.stdio.vn";
} else {
    if ($detect->isTablet()) {
        echo "TABLET: ";
        if ($detect->version("Windows Phone")) {
            echo "Windows Phone 8";
        } else {
            if ($detect->isiOS()) {
                echo "iOS";
            } else {
                if ($detect->isAndroidOS()) {
                    echo "Android";
                }
            }
        }
    } else {
        echo "PHONE: ";
        if ($detect->version("Windows Phone")) {
            echo "Windows Phone 8";
        } else {
            if ($detect->isiOS()) {
                echo "iOS";
            } else {
                if ($detect->isAndroidOS()) {
                    echo "Android";
                }
Exemplo n.º 15
0
}
?>
    
    <?php 
if ($detect->isMobile() || $detect->isTablet()) {
    ?>
    <script src="<?php 
    echo $this->baseurl . '/templates/' . $this->template . '/js/desktop-mobile.js';
    ?>
"></script>
    <?php 
}
?>
    
    <?php 
if (!$detect->isMobile() && !$detect->isTablet() && ((int) $detect->version('IE') == '' || (int) $detect->version('IE') > 8)) {
    ?>
    <script src="<?php 
    echo $this->baseurl . '/templates/' . $this->template . '/js/jquery.simplr.smoothscroll.stellar.modernizr.min.js';
    ?>
"></script>  
    
    <script>
    jQuery(function($) {
		if (!Modernizr.touch) {
		$.srSmoothscroll({ease: 'easeOutQuart'});
		$(window).load(function(){
		$.stellar({responsive: true,horizontalScrolling: false});
		});
		}
    });
Exemplo n.º 16
0
}
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';
}
//checking for mobile web apps
$user_agent = $detect->getUserAgent();
// $user_agent = 'Mozilla/5.0 (Linux; Android 5.0.2; D5803 Build/23.1.A.1.28; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/43.0.2357.121 Mobile Safari/537.36 [FB_IAB/FB4A;FBAV/36.0.0.39.166;]';
// $user_agent = 'Mozilla/5.0 (iPhone; CPU iPhone OS 8_2 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12D508';
Exemplo n.º 17
0
        if (preg_match("#^Description#", $line)) {
            $release_description = trim(preg_replace("#^(.+):\\s*(.+)#", "\$2", $line));
        }
    }
} else {
    $release_origin = __('Empty Page');
}
if (isset($_GET['pid'])) {
    if (ctype_digit($_GET['pid']) && intval($_GET['pid']) <= 10000) {
        if (isset($_GET['method']) && $_GET['method'] == 'screenshot') {
            $index = 2;
            $title = __('View Screenshots');
        } elseif (isset($_GET['method']) && $_GET['method'] == 'report') {
            $device_type = array('iPhone', 'iPod', 'iPad');
            for ($i = 0; $i < count($device_type); $i++) {
                $check = $detect->version($device_type[$i]);
                if ($check !== false) {
                    if (isset($_SERVER['HTTP_X_MACHINE'])) {
                        $DEVICE = $_SERVER['HTTP_X_MACHINE'];
                    } else {
                        $DEVICE = 'Unknown';
                    }
                    $OS = str_replace('_', '.', $check);
                    break;
                }
            }
            if (!isset($_GET['support'])) {
                $index = 3;
            } else {
                if ($_GET['support'] == '1') {
                    $support = 1;
 /**
  * Identify the browser based on Mobile_Detect data
  * 
  * @param Mobile_Detect $md
  * 
  * @return array or false
  */
 protected static function parseBrowserMd(Mobile_Detect $md)
 {
     foreach (self::$md_browsers as $family) {
         if ($md->is($family)) {
             return self::parseBrowserOrOs($family, $md->version($family));
         }
     }
     return false;
 }