当前位置: 首页>>代码示例>>PHP>>正文


PHP is_mobile_request函数代码示例

本文整理汇总了PHP中is_mobile_request函数的典型用法代码示例。如果您正苦于以下问题:PHP is_mobile_request函数的具体用法?PHP is_mobile_request怎么用?PHP is_mobile_request使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了is_mobile_request函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render

function render($data = NULL, $layout = NULL, $sharp = 'default', $pathinfo = false)
{
    if ($layout == null) {
        if (is_ajax_request()) {
            $layout = 'ajax';
        } elseif (is_mobile_request()) {
            $layout = 'mobile';
        } else {
            $layout = 'web';
        }
    }
    $GLOBALS['layout'] = $layout;
    $GLOBALS['sharp'] = $sharp;
    $layout_file = AROOT . 'view/layout/' . $layout . '/' . $sharp . '.tpl.html';
    $data = apply_filter('CTRL_' . g('c') . '_' . g('a') . '_RENDER_FILTER', $data);
    $GLOBALS['LP_RENDER_DATA'] = $data;
    if (file_exists($layout_file)) {
        @extract($data);
        require $layout_file;
    } else {
        $layout_file = CROOT . 'view/layout/' . $layout . '/' . $sharp . '.tpl.html';
        if (file_exists($layout_file)) {
            @extract($data);
            require $layout_file;
        }
    }
}
开发者ID:xianliflc,项目名称:teamirr,代码行数:27,代码来源:core.function.php

示例2: render

function render($data = NULL, $layout = NULL, $sharp = 'default')
{
    if ($layout == null) {
        if (is_ajax_request()) {
            $layout = 'ajax';
        } elseif (is_mobile_request()) {
            $layout = 'mobile';
        } else {
            $layout = 'web';
        }
    }
    $GLOBALS['layout'] = $layout;
    $GLOBALS['sharp'] = $sharp;
    $layout_file = AROOT . 'view/layout/' . $layout . '/' . $sharp . '.tpl.html';
    if (file_exists($layout_file)) {
        @extract($data);
        require $layout_file;
    } else {
        $layout_file = CROOT . 'view/layout/' . $layout . '/' . $sharp . '.tpl.html';
        if (file_exists($layout_file)) {
            @extract($data);
            require $layout_file;
        }
    }
}
开发者ID:jfojfo,项目名称:LazyPHP,代码行数:25,代码来源:core.function.php

示例3: __construct

 public function __construct()
 {
     if (is_mobile_request()) {
         $params = $_GET;
         $this->redirect('Mobile/' . CONTROLLER_NAME . '/' . ACTION_NAME, $params);
     }
     parent::__construct();
     $this->assign('controller', CONTROLLER_NAME);
     //读取配置信息
     $web_stting = F('setting');
     if ($web_stting === false) {
         $params = array();
         $list = M('Setting')->getField('name,value');
         foreach ($list as $key => $val) {
             $params[$key] = unserialize($val) ? unserialize($val) : $val;
         }
         F('setting', $params);
         $web_stting = F('setting');
     }
     $this->assign('web_stting', $web_stting);
     //站点状态判断
     if ($web_stting['site_status'] != 1) {
         echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
         echo $web_stting['closed_reason'];
         exit;
     } else {
         $link = M('Link')->where(array('status' => 1))->order('sort desc')->select();
         $this->assign('seo', seo());
         $this->assign('link', $link);
     }
 }
开发者ID:noikiy,项目名称:wakeup,代码行数:31,代码来源:BaseController.class.php

示例4: T

/**
 * 模板调用
 *
 * @param $m        模块名称
 * @param $template 模版名称
 * @param $style    模版风格
 * @return string
 */
function T($m = 'content', $template = 'index', $style = 'default')
{
    $mb = false;
    if (SUPPORT_MOBILE && is_mobile_request()) {
        $tmp = $template;
        $template = 'mobile/' . $template;
        $mb = true;
    }
    $cache_file = CACHE_ROOT . 'templates/' . $style . '/' . $m . '/' . $template . '.php';
    if (!file_exists($cache_file)) {
        $tpl_file = 'templates/' . $style . '/' . $m . '/' . $template . '.html';
        if (file_exists(COREFRAME_ROOT . $tpl_file)) {
            exit('Please update template cache!');
        } elseif ($mb) {
            $cache_file = CACHE_ROOT . 'templates/' . $style . '/' . $m . '/' . $tmp . '.php';
            if (!file_exists($cache_file)) {
                $tpl_file = 'templates/' . $style . '/' . $m . '/' . $tmp . '.html';
                if (file_exists(COREFRAME_ROOT . $tpl_file)) {
                    exit('Please update template cache!');
                } else {
                    exit('Template does not exists:' . $tpl_file);
                }
            } elseif (AUTO_CACHE_TPL) {
                $c_template = load_class('template');
                $c_template->cache_template($m, $tmp, $style);
            }
        } else {
            exit('Template does not exists:' . $tpl_file);
        }
    } elseif (AUTO_CACHE_TPL) {
        $c_template = load_class('template');
        $c_template->cache_template($m, $template, $style);
    }
    return $cache_file;
}
开发者ID:haizhilin2013,项目名称:wuzhicms,代码行数:43,代码来源:common.func.php

示例5: _initialize

 public function _initialize()
 {
     //判断是否是手机访问
     $check_platforms = is_mobile_request();
     if ($check_platforms) {
         $this->is_mobile = 1;
         C('DEFAULT_THEME', 'm');
     }
     $this->assign('now_action', CONTROLLER_NAME . '/' . ACTION_NAME);
 }
开发者ID:a3147972,项目名称:micro_business,代码行数:10,代码来源:BaseController.class.php

示例6: index

 function index()
 {
     if (is_mobile_request()) {
         return forward('client/');
     }
     if (is_login()) {
         return forward('?c=dashboard');
     }
     // do login
     $data['title'] = $data['top_title'] = __('LOGIN_PAGE_TITLE');
     $data['css'][] = 'login_screen.css';
     $data['langs'] = @glob(AROOT . 'local/*.lang.php');
     return render($data, 'web', 'fullwidth');
 }
开发者ID:xianliflc,项目名称:teamirr,代码行数:14,代码来源:guest.class.php

示例7: publish_feed

function publish_feed($content, $uid, $type = 0, $tid = 0)
{
    if (is_mobile_request()) {
        $device = 'mobile';
    } else {
        $device = 'web';
    }
    $tid = intval($tid);
    if ($type == 2 && $tid > 0) {
        $comment_count = get_var("SELECT COUNT(*) FROM `todo_history` WHERE `tid` = '" . intval($tid) . "' AND `type` = 2 ", db());
    } else {
        $comment_count = 0;
    }
    $sql = "INSERT INTO `feed` ( `content` , `tid` , `uid` , `type` ,`timeline` , `device` , `comment_count` ) VALUES ( '" . s($content) . "' , '" . intval($tid) . "', '" . intval($uid) . "'  , '" . intval($type) . "' , NOW() , '" . s($device) . "' , '" . intval($comment_count) . "' )";
    run_sql($sql);
    $lid = last_id();
    if (db_errno() != 0) {
        return false;
    } else {
        if ($comment_count > 0 && $type == 2 && $tid > 0) {
            $sql = "UPDATE `feed` SET `comment_count` = '" . intval($comment_count) . "' WHERE `tid` = '" . intval($tid) . "' AND `comment_count` != '" . intval($comment_count) . "' ";
            run_sql($sql);
        }
        return $lid;
    }
}
开发者ID:ramo01,项目名称:1kapp,代码行数:26,代码来源:api.function.php

示例8: feed_add_comment

 /**
  * 为Feed添加评论
  *
  *
  * @param string token , 必填
  * @param string fid - 必填
  * @param string text - 必填
  * @return feed array 
  * @author EasyChen
  */
 public function feed_add_comment($text = false, $fid = false)
 {
     if (!$text) {
         $content = $text = z(t(v('text')));
     }
     if (!not_empty($content)) {
         return self::send_error(LR_API_ARGS_ERROR, __('INPUT_CHECK_BAD_ARGS', 'TEXT'));
     }
     if (!$fid) {
         $fid = intval(v('fid'));
     }
     if (intval($fid) < 1) {
         return self::send_error(LR_API_ARGS_ERROR, __('INPUT_CHECK_BAD_ARGS', 'FID'));
     }
     $finfo = get_line("SELECT * FROM `feed` WHERE `id` = '" . intval($fid) . "' LIMIT 1");
     if (is_mobile_request()) {
         $device = 'mobile';
     } else {
         $device = 'web';
     }
     $sql = "INSERT INTO `comment` ( `fid` , `uid` , `content` , `timeline` , `device` ) \n\t\tVALUES ( '" . intval($fid) . "' , '" . intval($_SESSION['uid']) . "' , '" . s($content) . "' , NOW() , '" . s($device) . "' ) ";
     run_sql($sql);
     if (db_errno() != 0) {
         return self::send_error(LR_API_DB_ERROR, __('API_MESSAGE_DATABASE_ERROR') . mysql_error());
     } else {
         $lid = last_id();
         // feed表comment_count计数增加
         $count = get_var("SELECT COUNT(*) FROM `comment` WHERE `fid` = '" . intval($fid) . "' ", db());
         $sql = "UPDATE `feed` SET `comment_count` = '" . intval($count) . "' WHERE `id` = '" . intval($fid) . "' LIMIT 1";
         run_sql($sql);
         // 向Feed作者发通知
         if ($finfo['uid'] != uid()) {
             send_notice($finfo['uid'], __('API_TEXT_COMMENT_FEED_OWNED', array(uname(), $finfo['content'], $content)), 2, array('fid' => intval($fid), 'count' => $count));
         }
         // 向参与了该Feed讨论的同学发送通知
         $sql = "SELECT `uid` FROM `comment` WHERE `fid`= '" . intval($fid) . "' ";
         if ($uitems = get_data($sql)) {
             foreach ($uitems as $uitem) {
                 if ($uitem['uid'] != uid() && $uitem['uid'] != $finfo['uid']) {
                     $myuids[] = $uitem['uid'];
                 }
             }
         }
         if (isset($myuids)) {
             $myuids = array_unique($myuids);
             foreach ($myuids as $muid) {
                 send_notice($muid, __('API_TEXT_COMMENT_FEED_IN', array(uname(), $finfo['content'], $content)), 2, array('fid' => intval($fid), 'count' => $count));
             }
         }
         // 向被@的同学,发送通知
         if ($ats = find_at($content)) {
             $sql = "SELECT `id` FROM `user` WHERE ";
             foreach ($ats as $at) {
                 $at = z(t($at));
                 if ($gname = get_group_names()) {
                     if (in_array(strtoupper($at), $gname)) {
                         if ($ndata = get_group_unames($at)) {
                             foreach ($ndata as $nname) {
                                 $names[] = $nname;
                             }
                         }
                     } else {
                         $names[] = $at;
                     }
                 } else {
                     $names[] = $at;
                 }
             }
             foreach ($names as $at) {
                 $at = z(t($at));
                 if (mb_strlen($at, 'UTF-8') < 2) {
                     continue;
                 }
                 $wsql[] = " `name` = '" . s(t($at)) . "' ";
                 if (c('at_short_name')) {
                     if (mb_strlen($at, 'UTF-8') == 2) {
                         $wsql[] = " `name` LIKE '_" . s($at) . "' ";
                     }
                 }
             }
             if (isset($wsql) && is_array($wsql)) {
                 $sql = $sql . join(' OR ', $wsql);
                 if ($udata = get_data($sql)) {
                     foreach ($udata as $uitem) {
                         $myuids[] = $uitem['id'];
                     }
                     if (isset($myuids) && is_array($myuids)) {
                         $myuids = array_unique($myuids);
                         foreach ($myuids as $muid) {
                             if ($muid != uid() && $muid != $finfo['uid']) {
//.........这里部分代码省略.........
开发者ID:xianliflc,项目名称:teamirr,代码行数:101,代码来源:api.class.php

示例9: get_member_account

<?php

$member = get_member_account(true, true);
$openid = $member['openid'];
$member = member_get($openid);
$paymentconfig = "";
if (strpos($_SERVER['HTTP_USER_AGENT'], 'MicroMessenger')) {
    $paymentconfig = " and code!='alipay'";
} else {
    if (is_mobile_request()) {
        $paymentconfig = " and code!='weixin'";
    }
}
$paymentlist = mysqld_selectall("select * from " . table("payment") . " where `enabled`=1  and `code`!='gold' and `online`=1 {$paymentconfig} ");
$paymentscount = mysqld_selectcolumn("select count(id) from " . table("payment") . " where `enabled`=1  and `code`!='gold' and `online`=1 {$paymentconfig} ");
if (empty($paymentscount)) {
    message("未找到可用的在线支付方式,暂时不支持余额充值。");
}
if (checksubmit("submit")) {
    if (empty($_GP['charge']) || round($_GP['charge'], 2) <= 0) {
        message("请输入要充值的金额");
    }
    $paytypecode = $_GP['paymentcode'];
    if (empty($paytypecode)) {
        message("请选择充值方式。");
    }
    $payment = mysqld_select("select * from " . table("payment") . " where `enabled`=1 and `code`=:code and `code`!='gold' and `online`=1", array('code' => $paytypecode));
    if (empty($payment['id'])) {
        message("未找到付款方式,付款失败");
    }
    $goodtitle = "余额充值" . $_GP['charge'] . "元";
开发者ID:jaydom,项目名称:weishang,代码行数:31,代码来源:rechargegold.php

示例10: get_device

function get_device()
{
    if (is_mobile_request()) {
        return 'mobile';
    } else {
        return 'web';
    }
}
开发者ID:xianliflc,项目名称:teamirr,代码行数:8,代码来源:app.function.php

示例11: header

    // Pre-final check to reset everything if the user is on Windows
    if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'windows') !== false) {
        $mobile_browser = 0;
    }
    // But WP7 is also Windows, with a slightly different characteristic
    if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'windows phone') !== false) {
        $mobile_browser++;
    }
    if ($mobile_browser > 0) {
        return true;
    } else {
        return false;
    }
}
if (file_exists("config/install.lock")) {
    if (is_mobile_request() && ($_SERVER['REQUEST_URI'] == '/' || $_SERVER['REQUEST_URI'] == '/index.php')) {
        //手机访问的情况
        header("location:index.php?r=wap/default");
    } else {
        // change the following paths if necessary
        $yii = dirname(__FILE__) . '/framework/yii.php';
        $config = dirname(__FILE__) . '/protected/config/main.php';
        // remove the following lines when in production mode
        defined('YII_DEBUG') or define('YII_DEBUG', true);
        // specify how many levels of call stack should be shown in each log message
        defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3);
        require_once $yii;
        Yii::createWebApplication($config)->run();
    }
} else {
    header('Location:install/index.php');
开发者ID:Toney,项目名称:xmcms,代码行数:31,代码来源:index.php

示例12: header

<?php

header("content-type:text/html;charset=utf-8");
// 定义ThinkPHP框架路径(相对于入口文件)
define('THINK_PATH', './ThinkPHP/');
//定义项目名称
define('APP_NAME', 'wap_renrenlie');
//定义项目路径
define('APP_PATH', './Home/');
define('BACK_URL', './index.php');
define('APP_DEBUG', true);
if (is_mobile_request() === false) {
    //pc访问手机端职位详情
    if (strpos($_SERVER['REQUEST_URI'], "/Job/job_detail_new/jobid/") !== false) {
        $requesString = explode("/jobid/", $_SERVER['REQUEST_URI']);
        $requesString = explode("&share=", $requesString[1]);
        //            var_dump($requesString);die;
        //                header("Location: http://m.renrenlie.com/index.php?s=/Job/job_detail_redirect/jobid/" . $requesString[0]);
        //                die;
    }
    //        to_pc();
    //        header('Location: http://www.renrenlie.com/');
}
//加载框架入文件
require THINK_PATH . 'ThinkPHP.php';
function is_mobile_request()
{
    $_SERVER['ALL_HTTP'] = isset($_SERVER['ALL_HTTP']) ? $_SERVER['ALL_HTTP'] : '';
    $mobile_browser = '0';
    if (preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone|iphone|ipad|ipod|android|xoom)/i', strtolower($_SERVER['HTTP_USER_AGENT']))) {
        $mobile_browser++;
开发者ID:xiaoyueer98,项目名称:wap.rrl.com,代码行数:31,代码来源:index.php

示例13: from_to_weixin

function from_to_weixin()
{
    if (is_weixin() === false) {
        if (is_mobile_request() === false) {
            //                        header('Location: http://www.renrenlie.com/');
            //                        die;
        }
    }
}
开发者ID:xiaoyueer98,项目名称:pc.rrl.com,代码行数:9,代码来源:index.php

示例14: run

 public function run($setindex = '')
 {
     IUrl::beginUrl();
     $controller = IUrl::getInfo('controller');
     $action = IUrl::getInfo('action');
     $Taction = empty($action) ? $this->defaultAction : $action;
     $info = isset($_SERVER['HTTP_X_FORWARDED_HOST']) ? $_SERVER['HTTP_X_FORWARDED_HOST'] : (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '');
     $sitekey = isset($this->config['sitekey']) ? $this->config['sitekey'] : '';
     //if ($this->getkey() != $sitekey) {
     //	echo 'error! 关注好资源222-www.mx800.com';
     //	exit();
     //}
     /*
     		$hostcheck = array('wmr.xiaoshuhaochi.com', 'wmr.xiaoshuhaochi.com', 'xiaoshuhaochi.com');
     
     		if (!in_array($info, $hostcheck)) {
     			echo 'error! 关注好资源111-www.mx800.com';
     			exit();
     		}*/
     if ($controller === NULL) {
         $controller = $this->defaultController;
     }
     $this->controller = $controller;
     $this->Taction = $Taction;
     if ($controller == 'site' && $Taction == 'index') {
         if (is_mobile_request()) {
             $this->controller = 'html5';
         }
     }
     spl_autoload_register('Mysite::autoload');
     $filePath = hopedir . '/lib/Smarty/libs/Smarty.class.php';
     if (!class_exists('smarty')) {
         include_once $filePath;
     }
     if ($controller == 'adminpage') {
         $smarty = new Smarty();
         $smarty->assign('siteurl', Mysite::$app->config['siteurl']);
         $smarty->cache_lifetime = 0;
         $smarty->caching = false;
         $smarty->template_dir = hopedir . '/templates/';
         $smarty->compile_dir = hopedir . '/templates_c/adminpage';
         $smarty->cache_dir = hopedir . '/smarty_cache';
         $smarty->left_delimiter = '<{';
         $smarty->right_delimiter = '}>';
         $module = IUrl::getInfo('module');
         $module = empty($module) ? 'index' : $module;
         $doaction = Mysite::$app->getAction() == 'index' ? 'system' : Mysite::$app->getAction();
         $this->Taction = $doaction;
         $this->siteset();
         if (!file_exists(hopedir . '/module/' . Mysite::$app->getAction() . '/adminmethod.php')) {
         } else {
             include hopedir . '/module/' . Mysite::$app->getAction() . '/adminmethod.php';
             $method = new method();
             $method->init();
             if (method_exists($method, $module)) {
                 call_user_func(array($method, $module));
             }
         }
         $datas = $this->getdata();
         if (is_array($datas)) {
             foreach ($datas as $key => $value) {
                 $smarty->assign($key, $value);
             }
         }
         $nowID = ICookie::get('myaddress');
         $lng = ICookie::get('lng');
         $lat = ICookie::get('lat');
         $mapname = ICookie::get('mapname');
         $adminshopid = ICookie::get('adminshopid');
         $smarty->assign('myaddress', $nowID);
         $smarty->assign('mapname', $mapname);
         $smarty->assign('adminshopid', $adminshopid);
         $smarty->assign('lng', $lng);
         $smarty->assign('lat', $lat);
         $smarty->assign('controlname', Mysite::$app->getController());
         $smarty->assign('Taction', Mysite::$app->getAction());
         $smarty->assign('urlshort', Mysite::$app->getController() . '/' . Mysite::$app->getAction());
         $templtepach = hopedir . '/templates/adminpage/' . Mysite::$app->getAction() . '/' . $module . '.html';
         if (file_exists($templtepach)) {
         } else {
             if (file_exists(hopedir . '/module/' . Mysite::$app->getAction() . '/adminpage/' . $module . '.html')) {
                 $smarty->compile_dir = hopedir . '/templates_c/adminpage/' . Mysite::$app->getAction();
                 $templtepach = hopedir . '/module/' . Mysite::$app->getAction() . '/adminpage/' . $module . '.html';
             } else {
                 logwrite('模板不存在 ');
                 $smarty->assign('msg', '模板文件不存在');
                 $smarty->assign('sitetitle', '错误提示');
                 $errorlink = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
                 $smarty->assign('errorlink', $errorlink);
                 $templtepach = hopedir . '/templates/adminpage/public/error.html';
             }
         }
         $smarty->assign('tmodule', $module);
         $smarty->assign('tempdir', 'adminpage');
         $smarty->registerPlugin('function', 'ofunc', 'FUNC_function');
         $smarty->registerPlugin('block', 'oblock', 'FUNC_block');
         $smarty->display($templtepach);
         exit;
     } else {
         $smarty = new Smarty();
//.........这里部分代码省略.........
开发者ID:snamper,项目名称:xiaoshuhaochi,代码行数:101,代码来源:application_class.php


注:本文中的is_mobile_request函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。