本文整理汇总了PHP中is_mobile函数的典型用法代码示例。如果您正苦于以下问题:PHP is_mobile函数的具体用法?PHP is_mobile怎么用?PHP is_mobile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了is_mobile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search_result_action
public function search_result_action()
{
if (!in_array($_GET['search_type'], array('questions', 'topics', 'users', 'articles'))) {
$_GET['search_type'] = null;
}
$search_result = $this->model('search')->search(cjk_substr($_GET['q'], 0, 64), $_GET['search_type'], $_GET['page'], get_setting('contents_per_page'), null, $_GET['is_recommend']);
if ($this->user_id and $search_result) {
foreach ($search_result as $key => $val) {
switch ($val['type']) {
case 'questions':
$search_result[$key]['focus'] = $this->model('question')->has_focus_question($val['search_id'], $this->user_id);
break;
case 'topics':
$search_result[$key]['focus'] = $this->model('topic')->has_focus_topic($this->user_id, $val['search_id']);
break;
case 'users':
$search_result[$key]['focus'] = $this->model('follow')->user_follow_check($this->user_id, $val['search_id']);
break;
}
}
}
TPL::assign('search_result', $search_result);
if (is_mobile()) {
TPL::output('m/ajax/search_result');
} else {
TPL::output('search/ajax/search_result');
}
}
示例2: run
/**
* 项目运行函数
*/
public static function run()
{
global $config;
if (!empty($config['site_mobile']) && is_mobile()) {
$config['site_theme'] = is_dir(TEMPLATE_DIR . 'mobile') ? 'mobile' : $config['site_theme'];
}
static $_app = array();
$app_id = self::$controller . '_' . self::$action;
define('SYS_THEME_DIR', $config['site_theme'] . DIRECTORY_SEPARATOR);
//模板风格
self::parse_request();
if (!isset($_app[$app_id])) {
$controller = self::$controller;
$action = self::$action . 'Action';
if (is_file(CONTROLLER_DIR . $controller . '.php')) {
self::load_file(CONTROLLER_DIR . $controller . '.php');
} else {
exit('XiaoCms:Controller does not exist.');
}
$app_object = new $controller();
if (method_exists($controller, $action)) {
$_app[$app_id] = $app_object->{$action}();
} else {
exit('XiaoCms:Action does not exist.');
}
}
return $_app[$app_id];
}
示例3: getMethod
public function getMethod($address, $total)
{
$this->load->language('payment/alipay_direct');
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int) $this->config->get('pp_standard_geo_zone_id') . "' AND country_id = '" . (int) $address['country_id'] . "' AND (zone_id = '" . (int) $address['zone_id'] . "' OR zone_id = '0')");
if ($this->config->get('alipay_direct_total') > $total) {
$status = false;
} elseif (!$this->config->get('alipay_direct_geo_zone_id')) {
$status = true;
} elseif ($query->num_rows) {
$status = true;
} else {
$status = false;
}
//判断是否移动设备访问
$this->load->helper('mobile');
if (is_mobile()) {
$status = false;
}
$currencies = array('CNY');
if (!in_array(strtoupper($this->currency->getCode()), $currencies)) {
$status = false;
}
$method_data = array();
if ($status) {
$method_data = array('code' => 'alipay_direct', 'title' => $this->language->get('text_title'), 'terms' => '', 'sort_order' => $this->config->get('alipay_direct_sort_order'));
}
return $method_data;
}
示例4: do_login
/**
* 登录接口
*/
public function do_login()
{
$this->load->helper('validate');
$account = $this->input->post('account');
$password = $this->input->post('password');
$device_id = $this->input->post('device_id');
$device = $this->input->post('device');
$check_mobile = is_mobile($account);
$logined = false;
if (!$check_mobile['status']) {
$check_account = is_email($account);
if (!$check_account['status']) {
$this->set_response(10800);
} else {
$logined = $this->api_auth->login($account, $password, true, array($device, $device_id));
}
} else {
$logined = $this->api_auth->login($account, $password, false, array($device, $device_id));
}
if (!$logined) {
$errors = $this->api_auth->get_error();
if (isset($errors['banned'])) {
// banned user
$this->set_response(20501);
} elseif (isset($errors['not_activated'])) {
// not activated user
$this->set_response(20502);
} else {
$this->set_response(20503);
}
}
$this->set_response(0, array($this->api_auth->get_user()->user_id, $this->api_auth->get_token()));
}
示例5: embed_bbs_appgame_callback
function embed_bbs_appgame_callback($match)
{
$ori_url = $match[1];
$ori_url = preg_replace("#amp;#", "", $ori_url);
$save_name = get_savename($ori_url);
if ($res = get_cache_data($save_name)) {
return $res;
}
if ($res = get_cache_data($save_name . ERROR_NAME)) {
return $res;
}
$pid = null;
if ($match[2] == 'redirect') {
$pid = $match[4];
}
$mobile = is_mobile();
$return = get_bbspage_form_url($ori_url, $pid, $mobile);
if ($return) {
put_cache_data($save_name, $return);
error_log('new done: ' . $ori_url . ' from ' . $_SERVER['REQUEST_URI']);
} else {
//错误?需要通知相关人等
put_cache_data($save_name . ERROR_NAME, $return);
error_log('not done: ' . $ori_url . ' from ' . $_SERVER['REQUEST_URI']);
}
return $return;
}
示例6: list_action
public function list_action()
{
if ($_GET['feature_id']) {
$topic_ids = $this->model('feature')->get_topics_by_feature_id($_GET['feature_id']);
} else {
$topic_ids = explode(',', $_GET['topic_id']);
}
if ($_GET['per_page']) {
$per_page = intval($_GET['per_page']);
} else {
$per_page = get_setting('contents_per_page');
}
if ($_GET['sort_type'] == 'hot') {
$posts_list = $this->model('posts')->get_hot_posts($_GET['post_type'], $_GET['category'], $topic_ids, $_GET['day'], $_GET['page'], $per_page);
} else {
$posts_list = $this->model('posts')->get_posts_list($_GET['post_type'], $_GET['page'], $per_page, $_GET['sort_type'], $topic_ids, $_GET['category'], $_GET['answer_count'], $_GET['day'], $_GET['is_recommend']);
}
if (!is_mobile() and $posts_list) {
foreach ($posts_list as $key => $val) {
if ($val['answer_count']) {
$posts_list[$key]['answer_users'] = $this->model('question')->get_answer_users_by_question_id($val['question_id'], 2, $val['published_uid']);
}
}
}
TPL::assign('posts_list', $posts_list);
if (is_mobile()) {
TPL::output('m/ajax/explore_list');
} else {
TPL::output('explore/ajax/list');
}
}
示例7: index
public function index()
{
$this->load->model('account/customer');
$this->load->language('extension/module/weixin_login');
$this->document->setTitle($this->language->get('heading_title'));
$data['text_weixin_login'] = $this->language->get('text_weixin_login');
if ($this->customer->isLogged()) {
$data['logged'] = 1;
} else {
$data['logged'] = 0;
}
if (isset($this->session->data['weixin_login_unionid'])) {
$data['weixin_login_authorized'] = 1;
} else {
$data['weixin_login_authorized'] = 0;
}
$this->load->helper('mobile');
if (is_weixin()) {
$data['is_weixin'] = 1;
} else {
$data['is_weixin'] = 0;
}
if (is_mobile()) {
$data['is_mobile'] = 1;
} else {
$data['is_mobile'] = 0;
}
$appid = $this->config->get('weixin_login_appid');
$appkey = $this->config->get('weixin_login_appkey');
$data['weixin_login'] = $this->url->link('extension/module/weixin_login/login', '', 'SSL');
$weixin_pclogin_redirect_uri = HTTPS_SERVER . 'index.php?route=extension/module/weixin_login/weixin_pclogin_code';
$data['wxpclogin_url'] = 'https://open.weixin.qq.com/connect/qrconnect?appid=' . $appid . '&redirect_uri=' . urlencode($weixin_pclogin_redirect_uri) . '&response_type=code&scope=snsapi_login&state=STATE#wechat_redirect';
return $this->load->view('extension/module/weixin_login', $data);
}
示例8: sendErrorImage
function sendErrorImage($message)
{
/* get all of the required data from the HTTP request */
$document_root = $_SERVER['DOCUMENT_ROOT'];
$requested_uri = parse_url(urldecode($_SERVER['REQUEST_URI']), PHP_URL_PATH);
$requested_file = basename($requested_uri);
$source_file = $document_root . $requested_uri;
if (!is_mobile()) {
$is_mobile = "FALSE";
} else {
$is_mobile = "TRUE";
}
$im = ImageCreateTrueColor(800, 300);
$text_color = ImageColorAllocate($im, 233, 14, 91);
$message_color = ImageColorAllocate($im, 91, 112, 233);
ImageString($im, 5, 5, 5, "Adaptive Images encountered a problem:", $text_color);
ImageString($im, 3, 5, 25, $message, $message_color);
ImageString($im, 5, 5, 85, "Potentially useful information:", $text_color);
ImageString($im, 3, 5, 105, "DOCUMENT ROOT IS: {$document_root}", $text_color);
ImageString($im, 3, 5, 125, "REQUESTED URI WAS: {$requested_uri}", $text_color);
ImageString($im, 3, 5, 145, "REQUESTED FILE WAS: {$requested_file}", $text_color);
ImageString($im, 3, 5, 165, "SOURCE FILE IS: {$source_file}", $text_color);
ImageString($im, 3, 5, 185, "DEVICE IS MOBILE? {$is_mobile}", $text_color);
header("Cache-Control: no-store");
header('Expires: ' . gmdate('D, d M Y H:i:s', time() - 1000) . ' GMT');
header('Content-Type: image/jpeg');
ImageJpeg($im);
ImageDestroy($im);
exit;
}
示例9: getMethod
public function getMethod($address, $total)
{
$this->load->language('extension/payment/qrcode_wxpay');
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "zone_to_geo_zone WHERE geo_zone_id = '" . (int) $this->config->get('qrcode_wxpay_geo_zone_id') . "' AND country_id = '" . (int) $address['country_id'] . "' AND (zone_id = '" . (int) $address['zone_id'] . "' OR zone_id = '0')");
if ($this->config->get('qrcode_wxpay_total') > $total) {
$status = false;
} elseif (!$this->config->get('qrcode_wxpay_geo_zone_id')) {
$status = true;
} elseif ($query->num_rows) {
$status = true;
} else {
$status = false;
}
//只在PC端显示
$this->load->helper('mobile');
if (is_mobile()) {
$status = false;
}
$currencies = array('CNY');
if (!in_array(strtoupper($this->session->data['currency']), $currencies)) {
$status = false;
}
$method_data = array();
if ($status) {
$method_data = array('code' => 'qrcode_wxpay', 'title' => $this->language->get('text_title'), 'terms' => '', 'sort_order' => $this->config->get('qrcode_wxpay_sort_order'));
}
return $method_data;
}
示例10: index
/**
* 淘宝跳转
*/
public function index()
{
$id = I('id', '', 'trim');
$iid = I('iid', '', 'number_int');
$date = I('date');
$dt = '1';
if ($date) {
$dt = '2';
}
$tpl = 'index';
if ($id) {
if (!intval($id)) {
exit('input error');
}
if (strlen($id) > 9) {
$item = $this->_mod->where(array('num_iid' => $id))->find();
} else {
$item = $this->_mod->where(array('id' => $id))->find();
}
if (!$item) {
$item['num_iid'] = $id;
}
}
if ($iid) {
if (!intval($iid)) {
exit('input error');
}
$this->_mod = M('items');
$item = $this->_mod->where(array('num_iid' => $iid))->find();
if (!$item) {
$item['num_iid'] = $iid;
}
}
if (C('ftx_click_ai')) {
$tpl = 'taobao';
if (!is_mobile()) {
if ($item['click_url'] && 0 < strpos($item['click_url'], "s.click")) {
$this->jump_hidden_referer($item['click_url']);
} else {
if (0 < strpos($item['click_url'], "redirect.simba.taobao.com")) {
$this->jump_hidden_referer($item['click_url']);
}
}
}
}
if ($item['shop_type'] == "D") {
$this->jump_hidden_referer($item['click_url']);
}
$taodianjin = C('ftx_taojindian_html');
if (strpos($taodianjin, 'text/javascript')) {
$pid = get_word($taodianjin, 'pid: "', '"');
} else {
$pid = $taodianjin;
}
$this->assign('pid', $pid);
$this->assign('date', $dt);
$this->assign('item', $item);
$this->display($tpl);
}
示例11: cls
public function cls()
{
echo "开发中。。。";
if ($this->Config["wap"] && is_mobile()) {
$tmp = THEME_PATH . "wap/Index_index.html";
}
$this->display($tmp);
}
示例12: _empty
public function _empty()
{
if ($this->Config["wap"] && is_mobile()) {
/*开启手机访问*/
$tmp = THEME_PATH . "wap/Index_" . ACTION_NAME . ".html";
}
$this->display($tmp);
}
示例13: page_split
function page_split($total_page, $current_page, $base = '', $query_str = '')
{
global $lan;
$base = rtrim($base, '/');
$is_moible = is_mobile();
$page_string = '';
$query_str = preg_replace('/page\\=[^&]*(&|&)*/i', '', $query_str);
if ($query_str != '') {
$query_str = '&' . $query_str;
}
if ($total_page == 1) {
return '';
}
if ($current_page == 2) {
$page_string = ($is_moible ? '' : '<a href="' . $base . '/"><strong>' . $lan['page_first'] . '</strong></a> ') . '<a href="' . $base . $page_base . '/page_' . ($current_page - 1) . '/" class="_p_p"><strong>' . $lan['page_previous'] . '</strong></a> ';
} elseif ($current_page > 2) {
$page_string = ($is_moible ? '' : '<a href="' . $base . '/"><strong>' . $lan['page_first'] . '</strong></a> ') . '<a href="' . $base . $page_base . '/page_' . ($current_page - 1) . '/" class="_p_p"><strong>' . $lan['page_previous'] . '</strong></a> ';
} else {
$page_string = ($is_moible ? '' : '<del><strong>' . $lan['page_first'] . '</strong></del> ') . '<del class="_p_p"><strong>' . $lan['page_previous'] . '</strong></del> ';
}
if ($current_page > 6) {
$page_string .= '<a href="' . $base . '/">1</a> ';
$page_string .= '...';
for ($i = $current_page - 3; $i <= $current_page - 1; $i++) {
$page_string .= ' <a href="' . $base . $page_base . '/page_' . $i . '/">' . $i . '</a> ';
}
$page_string .= '<b>' . $current_page . '</b> ';
} else {
for ($i = 1; $i <= $current_page; $i++) {
if ($i == $current_page) {
$page_string .= '<b>' . $current_page . '</b> ';
} elseif ($i == 1) {
$page_string .= ' <a href="' . $base . '/">' . $i . '</a> ';
} else {
$page_string .= ' <a href="' . $base . $page_base . '/page_' . $i . '/">' . $i . '</a> ';
}
}
}
if ($total_page - $current_page > 5) {
for ($i = $current_page + 1; $i <= $current_page + 3; $i++) {
$page_string .= ' <a href="' . $base . $page_base . '/page_' . $i . '/">' . $i . '</a> ';
}
$page_string = $page_string . '...';
for ($i = $total_page; $i <= $total_page; $i++) {
$page_string .= ' <a href="' . $base . $page_base . '/page_' . $i . '/">' . $i . '</a> ';
}
} else {
for ($i = $current_page + 1; $i <= $total_page; $i++) {
$page_string .= ' <a href="' . $base . $page_base . '/page_' . $i . '/">' . $i . '</a> ';
}
}
if ($current_page < $total_page) {
$page_string .= '<a href="' . $base . $page_base . '/page_' . ($current_page + 1) . '/" class="_p_n"><strong>' . $lan['page_next'] . '</strong></a>' . ($is_moible ? '' : ' <a href="' . $base . $page_base . '/page_' . $total_page . '/"><strong>' . $lan['page_last'] . '</strong></a>');
} else {
$page_string .= '<del class="_p_n"><strong>' . $lan['page_next'] . '</strong></del>' . ($is_moible ? '' : ' <del><strong>' . $lan['page_last'] . '</strong></del>');
}
return $page_string;
}
示例14: fix_links
function fix_links($html)
{
if (isset($_GET["print"]) || is_mobile()) {
$patterns = array('/<a href=([\'"])#!?\\/(api\\/[^-\'"]+)-([^\'"]+)/' => '<a href=$1?print=/$2#$3', '/<a href=([\'"])#!?\\//' => '<a href=$1?print=/');
return preg_replace(array_keys($patterns), array_values($patterns), $html);
} else {
return $html;
}
}
示例15: _empty
public function _empty()
{
if ($this->Config["wap"] && is_mobile()) {
/*开启手机访问*/
} else {
$tmp = TMPL_PATH . 'User/' . C('DEFAULT_THEME') . "/" . MODULE_NAME . '_' . ACTION_NAME . ".html";
}
$this->display($tmp);
}