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


PHP Agent::is_mobiledevice方法代码示例

本文整理汇总了PHP中Agent::is_mobiledevice方法的典型用法代码示例。如果您正苦于以下问题:PHP Agent::is_mobiledevice方法的具体用法?PHP Agent::is_mobiledevice怎么用?PHP Agent::is_mobiledevice使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Agent的用法示例。


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

示例1: action_index

 public function action_index($pr1 = null, $pr2 = null)
 {
     //パラメータが付いていた場合はリダイレクト
     if ($pr1 != null || $pr2 != null) {
         return Response::forge(Uri::base());
     }
     $msg = Session::get('errorMsg');
     Session::delete('errorMsg');
     /*		
     		//ログインフォーム作成
     		$loginFieldSet = Fieldset::forge('loginForm');
     		$loginFieldSet->add('username','',array('type'=>'text','size'=>20));
     		$loginFieldSet->add('password','',array('type'=>'password','size'=>20));
     		$loginFieldSet->repopulate();
     		//送信ボタン追加
     		$loginFieldSet->add('submit','',array('type'=>'submit','width'=>80,'value'=>' ログイン '));
     */
     $content = '';
     if (Agent::is_mobiledevice()) {
         $content = View::forge('index/index_mobile');
     } else {
         $content = View::forge('index/index_pc');
     }
     //掲示板全体の最新画像
     $query = Model_Attach::query();
     $query->select('id', 'bbsId');
     $query->limit(12);
     $query->order_by('created_at', 'desc');
     $images = $query->get();
     //最新の書き込み掲示板(10個)
     $query2 = Model_Board::query();
     $query2->select('id', 'shortName', 'title', 'updated_at');
     $query2->limit(10);
     $query2->order_by('updated_at', 'desc');
     $update = $query2->get();
     //投稿数順
     Model_Board::clear_cache();
     $query3 = Model_Board::query();
     $query3->select('id', 'shortName', 'title', 'postCount');
     $query3->limit(10);
     $query3->order_by('postCount', 'desc');
     $postCount = $query3->get();
     $this->setBoardTitle();
     //		$content->set('loginForm',$loginFieldSet->build('index/login'),false);
     $content->set('newestImages', $images);
     $content->set('updateBoards', $update);
     $content->set('postCount', $postCount);
     //エラーメッセージ設定
     if ($msg != null) {
         $content->set('msg', $msg, false);
     }
     $this->template->content = $content;
 }
开发者ID:katsuwo,项目名称:bbs,代码行数:53,代码来源:index.php

示例2: before

 public function before()
 {
     if (Agent::is_mobiledevice()) {
         \Response::redirect('mobile/index.html');
     }
     parent::before();
     foreach (\Auth::verified() as $driver) {
         if (($id = $driver->get_user_id()) !== false) {
             $this->current_user = Model\Auth_User::find($id[1]);
         }
         break;
     }
     // Set a global variable so views can use it
     View::set_global('current_user', $this->current_user);
 }
开发者ID:notfoundsam,项目名称:yahooauc,代码行数:15,代码来源:base.php

示例3: before

 public function before()
 {
     parent::before();
     if ($this->getNotOpenidAllowed()) {
         return;
     }
     if (!\Agent::is_mobiledevice()) {
         $this->theme = 'mobile';
         $this->template->set_filename('mobile/template');
     }
     if (!\Auth::check()) {
         \Response::redirect('/admin/login');
     }
     // 检测是否后台帐户
     if (!\Session::get('employee', false) && \Auth::get_user()->username != 'admin') {
         \Auth::logout();
         \Response::redirect('/admin/login');
     }
 }
开发者ID:wxl2012,项目名称:wx,代码行数:19,代码来源:basecontroller.php

示例4:

<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title><?php 
if (isset($title)) {
    echo $title;
}
?>
</title>
		<?php 
if (Agent::is_mobiledevice()) {
    echo '<meta name="viewport" content="width=device-width">';
    echo Asset::css('bootstrap.css');
    echo Asset::css('mobile.css');
} else {
    echo Asset::css('bootstrap.css');
    echo Asset::css('pc.css');
}
?>
		<?php 
if (isset($keywords)) {
    if (count($keywords) != 0) {
        echo '<meta name ="keywords" contents="' . $keywords . '">';
    }
}
?>

		<style>
			body {
				   color : <?php 
开发者ID:katsuwo,项目名称:bbs,代码行数:31,代码来源:template.php

示例5: action_deleteConfirm

 public function action_deleteConfirm($shortName = null)
 {
     if ($shortName == null) {
         return Response::forge('パラメータ異常');
     }
     $this->template->content = '';
     //ユーザーIDを取得
     $userId = Auth::get('id');
     //掲示板取得
     $query = Model_Board::query()->where('shortName', $shortName);
     $query->and_where_open();
     $query->where('userId', '=', $userId);
     $query->and_where_close();
     $board = $query->get_one();
     if ($board == null) {
         return Response::forge('パラメータ異常');
     }
     $data['board'] = $board;
     if (Agent::is_mobiledevice()) {
     } else {
         $content = View::forge('bbsadmin/deleteconfirm', $data);
     }
     $this->setBoardTitle();
     $this->template->boardDescription = '掲示板削除';
     $content->set('msg', $board->title . '(' . $board->shortName . ')を削除しますか?', false);
     $this->template->content = $content;
 }
开发者ID:katsuwo,项目名称:bbs,代码行数:27,代码来源:bbsadmin.php

示例6: test_is_mobiledevice

 /**
  * Tests Agent::is_mobiledevice()
  *
  * @test
  */
 public function test_is_mobiledevice()
 {
     $output = Agent::is_mobiledevice();
     $this->assertFalse($output);
 }
开发者ID:wushian,项目名称:MDD,代码行数:10,代码来源:agent.php

示例7: action_thread

 /**
  * スレッドを表示するコントローラ
  * @param type $shortName 掲示板shortName
  * @param type $threadId スレッドId(書き込みId)
  */
 public function action_thread($shortName = null, $threadId = null)
 {
     if ($shortName == null || $threadId == null) {
         return Response::redirect(Uri::base());
     }
     //投稿失敗の時のPOSTとエラーメッセージをSessionから取得
     $oldPost = Session::get('oldPost');
     Session::delete('oldPost');
     $oldAr = $this->getOldPostedData($oldPost);
     Session::delete('POST');
     $msg = Session::get('errorMsg');
     Session::delete('errorMsg');
     //shortNameからBoardオブジェクトを得る
     $board = $this->getBoardFromShortName($shortName);
     if ($board == null) {
         return Response::redirect(Uri::base());
     }
     $data = array();
     $data['board'] = $board;
     //共通広告取得
     $sys = Model_System::getSystemRecord();
     $headTag = $sys->headTag;
     //掲示板タイトル等設定
     $this->setBoardTitle($board);
     $data['shortName'] = $board->shortName;
     //スレッドの元書き込みを得る
     $query = Model_Article::query()->where('bbsId', $board->id);
     $query->where('id', '=', $threadId);
     $query->order_by('id', 'desc');
     $masterArticle = $query->get_one();
     if ($masterArticle == null) {
         return Response::redirect('bbs/index/' . $shortName);
     }
     $masterArticle->reserve1 = 1;
     //擬似的に書き込み番号(レス番)を与える
     $data['article'] = $masterArticle;
     //ページネーションの為のコメント数を得る
     $count = $masterArticle->getCountOfComments();
     //ページネーション
     $pConfig = array('pagination_url' => 'bbs/thread/' . $shortName . DS . $threadId, 'uri_segment' => 5, 'num_links' => 10, 'per_page' => 10, 'total_items' => $count, 'show_first' => true, 'show_last' => true, 'name' => 'bootstrap3');
     $pagiNation = Pagination::forge('myPaginationIndex', $pConfig);
     //投稿用フォームを得る
     $postFormFieldSet = null;
     if ($board->allowRes == true) {
         $postFormFieldSet = $this->makePostFormFieldSet($board);
         $postFormFieldSet->populate($oldAr);
         //CommentOf_をHiddenでフォームに仕込む(CommentOfはModel_Articleに含まれるので_を付ける)
         $postFormFieldSet->add('commentOf_', '', array('type' => 'hidden', 'value' => $threadId));
         //コメントはタイトル無し
         $postFormFieldSet->field('title')->set_type('hidden');
     }
     //コメントを得る
     if ($board->type == 2) {
         $comments = $masterArticle->getComments($threadId, $pagiNation->offset, $pagiNation->per_page, 'id', 'asc');
     } else {
         $comments = $masterArticle->getComments($threadId, $pagiNation->offset, $pagiNation->per_page);
     }
     //擬似的に書き込み番号(レス番)を与える
     $count = $pagiNation->offset + 2;
     foreach ($comments as $cm) {
         $cm->reserve1 = $count++;
     }
     //XViodes YoutubeのURLからコードを作成
     if ($board->allowXvideos) {
         foreach ($comments as $cm) {
             $this->setVideoPlayerFromURL($cm, Agent::is_mobiledevice());
         }
     }
     $data['comments'] = $comments;
     //添付ファイルを得る
     $data['attaches'] = $this->getAttach($board, $threadId, $data['comments']);
     //デバイス・掲示板タイプに応じてテンプレートを選択
     $articleStyle = '';
     $resStyle = '';
     if (Agent::is_mobiledevice()) {
         //共通広告
         $data['systemAd1'] = $sys->systemAdMobile1;
         $data['systemAd2'] = $sys->systemAdMobile2;
         $data['systemAd3'] = $sys->systemAdMobile3;
         if ($board->type == 1) {
             $this->template->title = "記事一覧";
             $content = View::forge('bbs/thread', $data);
             //背景色設定
             $articleStyle = "background: -moz-linear-gradient(top, {$board->articleTopColor}, {$board->articleBottomColor});";
             $articleStyle .= "background: -webkit-gradient(linear,left top,left bottom, from({$board->articleTopColor}), to({$board->articleBottomColor}));";
             $resStyle = "background: -moz-linear-gradient(top, {$board->resTopColor}, {$board->resBottomColor});";
             $resStyle .= "background: -webkit-gradient(linear,left top,left bottom, from({$board->resTopColor}), to({$board->resBottomColor}));";
         } else {
             if ($board->type == 2) {
                 $content = View::forge('bbs/thread_2ch', $data);
                 $content->set_safe('modeDescription', "<h4>スレッド:{$masterArticle->title}</h4>", false);
                 //背景色設定
                 $articleStyle = "background-color:{$board->articleTopColor}";
                 $resStyle = "background-color:{$board->articleTopColor}";
             }
//.........这里部分代码省略.........
开发者ID:katsuwo,项目名称:bbs,代码行数:101,代码来源:bbs.php


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