本文整理汇总了PHP中isMobile函数的典型用法代码示例。如果您正苦于以下问题:PHP isMobile函数的具体用法?PHP isMobile怎么用?PHP isMobile使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isMobile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cs_shortcode_menu_render
function cs_shortcode_menu_render($atts)
{
extract(shortcode_atts(array('title' => '', 'nav_menu' => '', 'el_class' => '', 'menu_align' => 'left', 'menu_line_height' => '80', 'css' => '', 'bg_image' => '', 'bg_color' => '', 'bg_image_repeat' => '', 'padding' => '', 'margin_bottom' => ''), $atts));
ob_start();
global $smof_data;
$css_class = apply_filters(VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, 'cs_custom_header_menu' . $el_class . $el_class . vc_shortcode_custom_css_class($css, ' '), 'cs-shortcode-menu', $atts);
?>
<div id="menu" class="cs_mega_menu main-menu cs-menu-align-<?php
echo $menu_align;
?>
cs-menu-line-height-<?php
echo $menu_line_height;
?>
<?php
echo $css_class;
?>
">
<div class="main-menu-content cshero-menu-dropdown clearfix nav-menu cshero-mobile">
<?php
$menus = wp_get_nav_menus();
if ($nav_menu) {
echo '<ul class="cshero-dropdown main-menu">';
wp_nav_menu(array('theme_location' => 'main_navigation', 'menu' => $nav_menu, 'depth' => 5, 'container' => false, 'menu_id' => 'nav', 'items_wrap' => '%3$s', 'walker' => new HeroMenuWalker()));
if (is_active_sidebar('cshero-header-content-widget-1')) {
?>
<li>
<div class="header-cart-search">
<?php
if (!function_exists('dynamic_sidebar') || !dynamic_sidebar("Header Content Widget 1")) {
}
?>
</div>
</li>
<?php
}
if (isset($smof_data['enable_hidden_sidebar']) && $smof_data['enable_hidden_sidebar'] && !isMobile()) {
?>
<li>
<a href="#"><i class="fa fa-navicon cs_open"></i></a>
</li>
<?php
}
echo '</ul>';
} elseif (empty($menus)) {
echo '<div class="menu-pages">';
wp_nav_menu(array('depth' => 5, 'container' => false, 'menu_id' => 'nav', 'items_wrap' => '%3$s'));
echo '</div>';
} else {
echo '<ul class="cshero-dropdown main-menu">';
wp_nav_menu(array('depth' => 5, 'container' => false, 'menu_id' => 'nav', 'items_wrap' => '%3$s', 'walker' => new HeroMenuWalker()));
echo '</ul>';
}
?>
</div>
</div>
<button type="button" class="btn btn-default btn-navbar navbar-toggle" data-toggle="collapse" data-target="#cshero-main-menu-mobile"><i class="fa fa-align-justify"></i></button>
<div id="cshero-main-menu-mobile" class="collapse navbar-collapse cshero-mmenu"></div>
<?php
return ob_get_clean();
}
示例2: commonAssign
/**
* Add common assign for simple mode on list page
*/
function commonAssign()
{
parent::commonAssign();
//search permissions
$searchPermis = $this->permis[$this->tName]['search'];
//export permissions
$exportPermis = $this->permis[$this->tName]['export'];
//add edit delete print export links
$this->xt->assign("record_controls_block", $this->permis[$this->tName]['export'] || $this->permis[$this->tName]['add'] || $this->permis[$this->tName]['delete'] || $this->permis[$this->tName]['edit']);
// adds style displat none to hiderecord controls, edit selected, delete selected, export selected and print selected if found 0 recs
$this->xt->assign("details_block", $searchPermis && $this->rowsFound);
if ($searchPermis && count($this->arrRecsPerPage) && ($this->rowsFound || $this->listAjax == LIST_AJAX)) {
$this->xt->assign("recordspp_block", true);
$this->createPerPage();
}
$this->xt->assign("pages_block", $searchPermis && $this->rowsFound);
$this->xt->assign("pages_attrs", "id=\"pageOf" . $this->id . "\" name=\"pageOf" . $this->id . "\"");
$this->xt->assign("shiftstyle_block", true);
$this->xt->assign("left_block", true);
//$this->xt->assign("toplinks_block", true);
//export selected link and attr
$this->xt->assign("exportselected_link", $exportPermis);
$this->xt->assign("exportselectedlink_span", $this->buttonShowHideStyle());
$this->xt->assign("exportselectedlink_attrs", $this->getPrintExportLinkAttrs('export'));
// print links and attrs
$this->xt->assign("prints_block", $exportPermis);
$this->xt->assign("print_link", $exportPermis);
$this->xt->assign("printlink_attrs", "id='print_" . $this->id . "' name='print_" . $this->id . "'");
//print selected link and attr
$this->xt->assign("printselected_link", $exportPermis);
$this->xt->assign("printselectedlink_attrs", $this->getPrintExportLinkAttrs('print'));
$this->xt->assign("printselectedlink_span", $this->buttonShowHideStyle());
//print all link and attr
$this->xt->assign("printall_link", $exportPermis);
$this->xt->assign("printalllink_attrs", "id='printAll_" . $this->id . "' name='printAll_" . $this->id . "'");
//export link and attr
$this->xt->assign("export_link", $exportPermis);
$this->xt->assign("exportlink_attrs", "id = 'export_" . $this->id . "'\r\n\t\t\t\t\t\t name = 'export_" . $this->id . "'\r\n\t\t\t\t\t\t onclick=\"window.open(this.href,'wExport');return false;\"");
//add link and attr
$this->xt->assign("add_link", $this->permis[$this->tName]['add']);
$this->xt->assign("addlink_attrs", "href='" . $this->shortTableName . "_add.php' id=\"addButton" . $this->id . "\"");
//advanced search and attr
$this->xt->assign("advsearchlink_attrs", "id=\"advButton" . $this->id . "\"");
//select all link and attr
$this->selectAllLinkAttrs();
//edit selected link and attr
$this->editSelectedLinkAttrs();
//save all link, attr, span
$this->saveAllLinkAttrs();
//cansel all link, attr, span
$this->cancelAllLinkAttrs();
$this->xt->assign("grid_block", true);
$this->xt->assign('menu_block', $this->isShowMenu() || $this->isAdminTable());
$this->xt->assign("languages_block", true);
if (isMobile()) {
$this->xt->assign('morelinkmobile_block', true);
$this->xt->assign('tableinfomobile_block', true);
$this->xt->displayBrickHidden("vmsearch2");
}
}
示例3: loadProductsListHtml
function loadProductsListHtml($cat)
{
$args = array('post_type' => 'product', 'product_cat' => $cat, 'posts_per_page' => -1);
$loop = new WP_Query($args);
while ($loop->have_posts()) {
$loop->the_post();
global $product;
$prod_html .= '<div class="product">';
$prod_html .= $product->get_image('shop_single');
$prod_html .= '<div class="product-info">';
if (!isMobile()) {
$prod_title = str_replace(" • ", "</br>", $product->get_title());
} else {
$prod_title = str_replace(" • ", " ", $product->get_title());
}
$prod_html .= '<h4>' . $prod_title . '</h4>';
$prod_html .= '<p class="excerpt">' . $product->get_post_data()->post_excerpt . '</p>';
$prod_html .= '<a class="more-info" href="' . $product->get_permalink() . '">Saiba mais</a>';
//$prod_html.= '<div class="product-info-accordion">';
//$prod_html.=mountAttributesAccordion($product->get_attributes(),$product->id);
//$prod_html.= '</div><!--end product-info-accordion-->';
$prod_html .= '</div><!--end product info-->';
$prod_html .= '</div><!--end product-->';
}
echo $prod_html;
wp_reset_postdata();
}
示例4: index
public function index()
{
$mobile = 13542147474;
dump(isMobile($mobile));
echo 1111;
// $this->show('<style type="text/css">*{ padding: 0; margin: 0; } div{ padding: 4px 48px;} body{ background: #fff; font-family: "微软雅黑"; color: #333;font-size:24px} h1{ font-size: 100px; font-weight: normal; margin-bottom: 12px; } p{ line-height: 1.8em; font-size: 36px } a,a:hover,{color:blue;}</style><div style="padding: 24px 48px;"> <h1>:)</h1><p>欢迎使用 <b>ThinkPHP</b>!</p><br/>版本 V{$Think.version}</div><script type="text/javascript" src="http://ad.topthink.com/Public/static/client.js"></script><thinkad id="ad_55e75dfae343f5a1"></thinkad><script type="text/javascript" src="http://tajs.qq.com/stats?sId=9347272" charset="UTF-8"></script>','utf-8');
}
示例5: songContainer
function songContainer($path, $title, $artist, $album, $length, $background, $class = "songContainer", $liked = 0)
{
if (!$artist) {
$artist = "Unknown";
}
if ($liked) {
$title = " " . $title;
}
$tileTextSize = isMobile() ? 17 : 14;
$tileTextSize .= "px;";
$containerStyle = "background: {$background};";
echo "<div data-path='{$path}' data-title='{$title}' data-artist='{$artist}' data-album='{$album}' data-length='{$length}' data-liked='{$liked}' class='{$class}' style='{$containerStyle}'>";
if ($class == "songContainer") {
echo "<div class='songInformation'>";
if (!isMobile()) {
echo "<div style='font-size: {$tileTextSize}'> <span class='songLength'>{$length}</span></div>";
}
echo "<div style='font-size: {$tileTextSize}'> <span class='songArtist'>{$artist}</span></div>";
if ($album) {
echo "<div style='font-size: {$tileTextSize}'> <span class='songAlbum'>{$album}</span></div>";
}
echo "<br> </div>";
}
echo "<div style='font-size: {$tileTextSize}'><span class='songTitle'>{$title}</span></div>";
echo "</div>";
}
示例6: getPhoneCode
public function getPhoneCode()
{
$mobile = I('mobile');
//手机号码
//验证手机号码格式
if (!isMobile($mobile)) {
$this->ajaxReturn(0, "手机号码格式错误", -1);
}
//判断手机号码是否存在
if (M('user')->where(array('mobile' => $mobile))->count('id') == 0) {
$this->ajaxReturn(0, "手机号码不存在", -2);
}
//发送短信验证码
$mobileCode = createMoibleCode();
if (sendMobileCode($mobile, '验证码:' . $mobileCode)) {
session('mobile', $mobile);
//注册手机号码传入session
session('mobileCode', $mobileCode);
//短信验证码传入session
session('mobileCodeTime', time());
//注册时间传入session
$this->ajaxReturn(0, "操作成功", 1);
} else {
$this->ajaxReturn(0, "系统错误", -101);
}
}
示例7: buildControl
function buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data)
{
parent::buildControl($value, $mode, $fieldNum, $validate, $additionalCtrlParams, $data);
$nWidth = $this->pageObject->pSetEdit->getNCols($this->field);
$nHeight = $this->pageObject->pSetEdit->getNRows($this->field);
if ($this->pageObject->pSetEdit->isUseRTE($this->field)) {
$value = $this->RTESafe($value);
// creating src url
$browser = "";
if (@$_REQUEST["browser"] == "ie") {
$browser = "&browser=ie";
}
// add JS code
echo "<iframe frameborder=\"0\" vspace=\"0\" hspace=\"0\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"no\" id=\"" . $this->cfield . "\" " . (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508 == true ? "alt=\"" . $this->strLabel . "\" " : "") . "name=\"" . $this->cfield . "\" title=\"Basic rich text editor\" style='";
if (!isMobile()) {
echo "width: " . ($nWidth + 1) . "px;";
}
echo "height: " . ($nHeight + 100) . "px;'";
echo " src=\"" . GetTableLink("rte", "", "ptype=" . $this->pageObject->pageType . "&table=" . GetTableURL($this->pageObject->tName) . "&" . "id=" . $this->id . "&" . $this->iquery . $browser . "&" . ($mode == MODE_ADD || $mode == MODE_INLINE_ADD ? "action=add" : '')) . "\">";
echo "</iframe>";
} else {
echo '<textarea id="' . $this->cfield . '" ' . (($mode == MODE_INLINE_EDIT || $mode == MODE_INLINE_ADD) && $this->is508 == true ? 'alt="' . $this->strLabel . '" ' : '') . 'name="' . $this->cfield . '" style="';
if (!isMobile()) {
echo "width: " . $nWidth . "px;";
}
echo 'height: ' . $nHeight . 'px;">' . runner_htmlspecialchars($value) . '</textarea>';
}
$this->buildControlEnd($validate);
}
示例8: _initialize
public function _initialize()
{
if (isMobile()) {
$this->redirect('index/Mobile/index?items_id =' . I('get.item_id'));
return 0;
}
}
示例9: _initialize
public function _initialize()
{
if (isMobile()) {
$this->redirect('Weixin/Jobs/pageJobs');
}
//验证是否为管理员登陆
if (session('user')['adminname'] == "luobo") {
session("user", null);
}
//定位城市
$nowCity = session("nowCity");
if (empty($nowCity)) {
$nowCity = "威海市";
session("nowCity", $nowCity);
$ip = get_client_ip();
if ($ip != "0.0.0.0") {
$data = file_get_contents("http://ip.taobao.com/service/getIpInfo.php?ip=" . $ip);
$data = json_decode($data, TRUE);
if ($data['code'] == 0) {
$db = M("city");
$city = str_replace("市", "", $data['data']['city']);
$where['name'] = array('like', "%" . $city . "%");
$re = $db->where($where)->find();
if ($re) {
$nowCity = $re['name'];
session("nowCity", $nowCity);
}
}
}
}
$this->assign("nowCity", $nowCity);
$sql = "SELECT * FROM job_level2 ORDER BY RAND() LIMIT 5";
$level2RandomList = M()->query($sql);
$this->assign("level2RandomList", $level2RandomList);
}
示例10: index_action
function index_action()
{
if (isMobile()) {
include template('project_m');
} else {
include template('project');
}
}
示例11: base_render_before
/**
* Remove mobile rendering from our custom non-forum pages.
*
* @param $sender
*/
public function base_render_before($sender)
{
$userFacing = $sender->MasterView == 'default' || $sender->MasterView == '';
$onForumPage = !in_array(strtolower($sender->Application), array('vanilla', 'conversations', 'dashboard'));
if ($userFacing && isMobile() && $onForumPage) {
// Use the main theme instead of mobile
$sender->Theme = c('Garden.Theme');
Gdn::pluginManager()->unregisterPlugin('MobileThemeHooks');
}
}
示例12: isMobileForWordPress
function isMobileForWordPress()
{
global $isMobileDevice;
if (isMobile()) {
$isMobileDevice = 1;
} else {
$isMobileDevice = 0;
}
return $isMobileDevice;
}
示例13: execApp
/**
* 执行App控制器
* @access public
* @return void
*/
public static function execApp()
{
//防止CSRF
if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST' && stripos($_SERVER['HTTP_REFERER'], SITE_URL) !== 0 && $_SERVER['HTTP_USER_AGENT'] !== 'Shockwave Flash') {
die('illegal request.');
}
// 使用手持设备时, 对用户的访问默认跳转至移动版, 除非用户指定访问普通版
if ($_SESSION['wap_to_normal'] != '1' && cookie('wap_to_normal') != '1' && $_REQUEST['wap_to_normal'] != '1' && !isiPad()) {
// 根据各应用的配置来判断是否存在手机版访问配置文件
$publicAccess = array('message', 'register', 'feed');
if (APP_NAME == 'public' && !in_array(strtolower(MODULE_NAME), $publicAccess) && strtolower(ACTION_NAME) != 'message' && isMobile() && in_array('wap', C('DEFAULT_APPS'))) {
// 智能手机到3G版
if (APP_NAME == 'public' && (isiPhone() || isAndroid())) {
// iOS和Android跳转至3G版
U('w3g/Index/index', '', true);
} else {
// 其他手机跳转至WAP版
U('wap/Index/index', '', true);
}
}
}
// 加载所有插件
if (C('APP_PLUGIN_ON')) {
tsload(CORE_LIB_PATH . '/addons.class.php');
tsload(CORE_LIB_PATH . '/addons/Hooks.class.php');
tsload(CORE_LIB_PATH . '/addons/AbstractAddons.class.php');
tsload(CORE_LIB_PATH . '/addons/NormalAddons.class.php');
tsload(CORE_LIB_PATH . '/addons/SimpleAddons.class.php');
tsload(CORE_LIB_PATH . '/addons/TagsAbstract.class.php');
Addons::loadAllValidAddons();
}
//创建Action控制器实例
$className = MODULE_NAME . 'Action';
tsload(APP_ACTION_PATH . '/' . $className . '.class.php');
if (!class_exists($className)) {
$className = 'EmptyAction';
tsload(APP_ACTION_PATH . '/EmptyAction.class.php');
if (!class_exists($className)) {
throw_exception(L('_MODULE_NOT_EXIST_') . ' ' . MODULE_NAME);
}
}
$module = new $className();
//异常处理
if (!$module) {
// 模块不存在 抛出异常
throw_exception(L('_MODULE_NOT_EXIST_') . ' ' . MODULE_NAME);
}
//获取当前操作名
$action = ACTION_NAME;
//执行当前操作
call_user_func(array(&$module, $action));
//执行计划任务
model('Schedule')->run();
return;
}
示例14: webInit
public function webInit($mustSignin = false)
{
if (!isMobile()) {
header('location:/index.php?s=/Index/Index');
exit;
}
if (!session('wcInfo')) {
$this->loginMode();
//exit();
}
}
示例15: getCtrlParamsArr
function getCtrlParamsArr($fName, $recId, $fieldNum = 0, $value, $renderHidden = false, $isCached = true)
{
$control = parent::getCtrlParamsArr($fName, $recId, $fieldNum, $value, $renderHidden, $isCached);
$control["params"]["additionalCtrlParams"]['skipDependencies'] = true;
$control["params"]["additionalCtrlParams"]["style"] = isMobile() ? 'width: 35%;' : 'width: 115px;';
$ctrlsMap = array('controls' => array());
$ctrlsMap['controls']["skipDependencies"] = true;
$ctrlsMap['controls']["style"] = isMobile() ? 'width: 35%;' : 'width: 115px;';
$this->pageObj->fillControlsMap($ctrlsMap, true);
return $control;
}