本文整理汇总了PHP中get_device_type函数的典型用法代码示例。如果您正苦于以下问题:PHP get_device_type函数的具体用法?PHP get_device_type怎么用?PHP get_device_type使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_device_type函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: system_device_detection
function system_device_detection($debug = false)
{
platform_launch(PLATFORM_SANDBOX_SYSTEM_VENDORS_PATH . DS . PLATFORM_VENDORS_OPENDDR . DS . 'BuilderDataSource.class.php');
platform_launch(PLATFORM_SANDBOX_SYSTEM_VENDORS_PATH . DS . PLATFORM_VENDORS_OPENDDR . DS . 'DeviceDetection.class.php');
$device_detection = new DeviceDetection($_SERVER['HTTP_USER_AGENT']);
$device_options = $device_detection->getAllCapabilities();
$device_type = 'Unknown';
if ($device_options['all']) {
$user_agent = detect_user_agent();
$device_type = get_device_type();
} else {
$device_type = $device_options['vendor'] . ' ' . $device_options['model'];
}
if ($debug) {
echo "<h2>Device Info</h2>";
echo "<h3>User Agent: " . $user_agent . "</h3>";
echo "<pre>";
print_r($device_options);
echo "</pre>";
}
unset($device_detection);
return $device_type;
}
开发者ID:platform-project,项目名称:platform-project,代码行数:23,代码来源:system.php
示例2: moodle_url
$deviceurl = new moodle_url('/theme/index.php', array('device' => $thedevice, 'sesskey' => sesskey()));
$select = new single_button($deviceurl, $strthemeselect, 'get');
$table->data[] = array(
$OUTPUT->heading(ucfirst($thedevice), 3),
$screenshotcell,
$headingthemename . $OUTPUT->render($select) . $unsetthemebutton
);
}
} else {
// Either a device has been selected of $CFG->enabledevicedetection is off so display a list
// of themes to select.
$heading = get_string('selecttheme', 'admin', $device);
if (empty($device)) {
// if $CFG->enabledevicedetection is off this will return 'default'
$device = get_device_type();
}
$table->id = 'adminthemeselector';
$table->head = array(get_string('theme'), get_string('info'));
$themes = get_plugin_list('theme');
foreach ($themes as $themename => $themedir) {
// Load the theme config.
try {
$theme = theme_config::load($themename);
} catch (Exception $e) {
// Bad theme, just skip it for now.
continue;
开发者ID:verbazend,项目名称:AWFA,代码行数:31,代码来源:index.php
示例3: array
'redirect' => array(
'file' => 'embedded.php',
'regions' => array(),
'options' => array('nofooter'=>true, 'nonavbar'=>true, 'nocustommenu'=>true, 'nocourseheaderfooter'=>true),
),
// The pagelayout used for reports
'report' => array(
'file' => 'general.php',
'regions' => array(),
'options' => array('nofooter'=>true, 'nonavbar'=>false, 'noblocks'=>true),
),
);
// Get whether to show blocks and use appropriate pagelayout
// this is necessary for block JS errors and other block problems
$thisdevice = get_device_type();
if ($thisdevice == "default" || $thisdevice == "tablet" || optional_param('mymobile_blocks', false, PARAM_BOOL)) {
// These are layouts with blocks
$blocklayouts = array('course', 'incourse', 'frontpage', 'mydashboard', 'mypublic');
foreach ($blocklayouts as $layout) {
$THEME->layouts[$layout]['regions'] = array('myblocks');
$THEME->layouts[$layout]['defaultregion'] = 'myblocks';
}
}
// Sets a custom render factory to use with the theme, used when working with custom renderers.
$THEME->rendererfactory = 'theme_overridden_renderer_factory';
$THEME->csspostprocess = 'mymobile_user_settings';
// Disables CSS Optimiser for MyMobile theme.
$THEME->supportscssoptimisation = false;
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:31,代码来源:config.php
示例4: theme_switch_links
/**
* Renders theme links for switching between default and other themes.
*
* @return string
*/
protected function theme_switch_links()
{
$actualdevice = get_device_type();
$currentdevice = $this->page->devicetypeinuse;
$switched = $actualdevice != $currentdevice;
if (!$switched && $currentdevice == 'default' && $actualdevice == 'default') {
// The user is using the a default device and hasn't switched so don't shown the switch
// device links.
return '';
}
if ($switched) {
$linktext = get_string('switchdevicerecommended');
$devicetype = $actualdevice;
} else {
$linktext = get_string('switchdevicedefault');
$devicetype = 'default';
}
$linkurl = new moodle_url('/theme/switchdevice.php', array('url' => $this->page->url, 'device' => $devicetype, 'sesskey' => sesskey()));
$content = html_writer::start_tag('div', array('id' => 'theme_switch_link'));
$content .= html_writer::link($linkurl, $linktext);
$content .= html_writer::end_tag('div');
return $content;
}
开发者ID:saurabh947,项目名称:MoodleLearning,代码行数:28,代码来源:outputrenderers.php
示例5: lti_get_launch_container
function lti_get_launch_container($lti, $toolconfig) {
if (empty($lti->launchcontainer)) {
$lti->launchcontainer = LTI_LAUNCH_CONTAINER_DEFAULT;
}
if ($lti->launchcontainer == LTI_LAUNCH_CONTAINER_DEFAULT) {
if (isset($toolconfig['launchcontainer'])) {
$launchcontainer = $toolconfig['launchcontainer'];
}
} else {
$launchcontainer = $lti->launchcontainer;
}
if (empty($launchcontainer) || $launchcontainer == LTI_LAUNCH_CONTAINER_DEFAULT) {
$launchcontainer = LTI_LAUNCH_CONTAINER_EMBED_NO_BLOCKS;
}
$devicetype = get_device_type();
//Scrolling within the object element doesn't work on iOS or Android
//Opening the popup window also had some issues in testing
//For mobile devices, always take up the entire screen to ensure the best experience
if ($devicetype === 'mobile' || $devicetype === 'tablet' ) {
$launchcontainer = LTI_LAUNCH_CONTAINER_REPLACE_MOODLE_WINDOW;
}
return $launchcontainer;
}
开发者ID:numbas,项目名称:moodle,代码行数:28,代码来源:locallib.php
示例6: get_user_device_type
/**
* Returns the device the user is currently using, or if the user has chosen to switch devices
* for the current device type the type they have switched to.
*
* @return string The device the user is currently using or wishes to use
*/
function get_user_device_type() {
$device = get_device_type();
$switched = get_user_preferences('switchdevice'.$device, false);
if ($switched != false) {
return $switched;
}
return $device;
}
开发者ID:nottmoo,项目名称:moodle,代码行数:14,代码来源:moodlelib.php
示例7: test_get_device_type
function test_get_device_type() {
// IE8 (common pattern ~1.5% of IE7/8 users have embedded IE6 agent))
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; BT Openworld BB; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1) ; Hotbar 10.2.197.0; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; .NET CLR 2.0.50727)';
$this->assertEquals('default', get_device_type());
// Genuine IE6
$_SERVER['HTTP_USER_AGENT'] = 'Mozilla/4.0 (compatible; MSIE 6.0; AOL 9.0; Windows NT 5.1; SV1; FunWebProducts; .NET CLR 1.0.3705; Media Center PC 2.8)';
$this->assertEquals('legacy', get_device_type());
}
开发者ID:netspotau,项目名称:moodle-mod_assign,代码行数:8,代码来源:moodlelib_test.php
示例8: foreach
}
//Display links to surveys
if (count($arr_sids) > 0) {
echo '<h3>Please choose a survey to run</h3>';
echo '<ul>';
foreach ($arr_sids as $s) {
echo '<li><a href="?sid=' . $s . '">' . $s . '</a></li>';
}
echo '</ul>';
exit;
} else {
throw new Exception('No surveys found');
}
}
$did = get_device_id();
$device_type = get_device_type($did);
$langCode = isset($_SESSION['wrapper']['language']) ? $_SESSION['wrapper']['language'] : 'en';
$config = get_config($device_type, $sid, $langCode);
//Load page generator
$page = new SC_Page_Generator($sid, FOLDER_SURVEYS);
?>
<!DOCTYPE HTML>
<html>
<head>
<title>Survey preview</title>
<meta charset="utf-8">
<meta name="robots" content="noindex, nofollow, noarchive, nosnippet" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script>
</head>
开发者ID:elzadj,项目名称:DDESCCG,代码行数:30,代码来源:skeleton.php
示例9: date_default_timezone_set
<?php
date_default_timezone_set('Europe/London');
require_once '../-functions.php';
require_once '../toolkit/sc_survey_flow.php';
if (session_id() == '') {
session_start();
}
$surveyID = get_survey_id();
$deviceID = get_device_id();
$device_type = get_device_type($deviceID);
$langCode = isset($_SESSION['wrapper']['language']) ? $_SESSION['wrapper']['language'] : 'en';
$config = get_config($device_type, $surveyID, $langCode);
# Load rules
if ($survey = new SC_Survey_Flow($surveyID, FOLDER_SURVEYS, $langCode)) {
//Config
$survey->bool_store_bwd = TRUE;
//Process answers to questions
if (isset($_POST['sc_page_id'])) {
// Languages
if (isset($_POST['q_language'])) {
$langCode = $_POST['q_language'];
if (!is_null($langCode) && !empty($langCode)) {
$_SESSION['wrapper']['language'] = $langCode;
}
}
$next_id = $survey->go();
} else {
$first_id = $survey->obj_page_generator->get_first_page_id();
SC_Survey_Flow::reset_survey($first_id);
throw new Exception('no page id posted');
开发者ID:elzadj,项目名称:DDESCCG,代码行数:31,代码来源:process_page.php
示例10: get_device_type
}
function get_device_type()
{
$agent = strtolower($_SERVER['HTTP_USER_AGENT']);
$type = 'other';
if (strpos($agent, 'iphone') || strpos($agent, 'ipad')) {
$type = 'ios';
}
if (strpos($agent, 'android')) {
$type = 'android';
}
return $type;
}
$iswx = is_weixin();
$devicetype = 'android';
if (get_device_type() == 'ios') {
$devicetype = 'ios';
}
?>
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>红圈营销</title>
<meta http-equiv="pragram" content="no-cache">
<meta content="user-scalable=0;" name="viewport" />
<meta name="apple-itunes-app" content="app-id=967499300" />
<style>
body{
text-align: center;
padding:0px;
开发者ID:hecomwufenyao,项目名称:app.hecom.cn,代码行数:31,代码来源:index.php
示例11: foreach
$target_devices[] = "/dev/{$m[1]}";
} else {
$target_devices[] = "/dev/{$dev}";
}
}
} else {
if (preg_match("/^(.+)\\.nop\$/", $dev, $m)) {
$target_devices[] = "/dev/{$m[1]}";
} else {
$target_devices[] = "/dev/{$dev}";
}
}
foreach ($target_devices as $target_device) {
$index = array_search_ex($target_device, $config['zfs']['vdevices']['vdevice'], "device");
if ($index !== false) {
$type = get_device_type($target_device, $a_vdevice);
// remove spares if any
if ($type != "spare" && !empty($a_spares)) {
foreach ($a_spares as $spares) {
if (in_array($target_device, $spares) == false) {
continue;
}
// ok target in the array, remove spare
foreach ($spares as $spare_device) {
if (strcmp($spare_device, $target_device) == 0) {
continue;
}
$s_index = array_search_ex($spare_device, $config['zfs']['vdevices']['vdevice'], "device");
if ($s_index !== false) {
$new_devices = array();
foreach ($config['zfs']['vdevices']['vdevice'][$s_index]['device'] as $device) {
开发者ID:sdoney,项目名称:nas4free,代码行数:31,代码来源:disks_zfs_zpool_tools.php
注:本文中的get_device_type函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论