本文整理汇总了PHP中Agent::isMobile方法的典型用法代码示例。如果您正苦于以下问题:PHP Agent::isMobile方法的具体用法?PHP Agent::isMobile怎么用?PHP Agent::isMobile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Agent
的用法示例。
在下文中一共展示了Agent::isMobile方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: index
public function index()
{
Log::debug(__METHOD__);
if (Input::has('book_id')) {
$this->setCurrentBook(Input::get('book_id'));
}
if (Input::has('layout')) {
$this->setLayout(Input::get('layout'));
}
if (Agent::isMobile()) {
$user_name = Auth::user()->username;
$get_task_counts = $this->getTaskCounts();
$book_name = $this->getBookName();
$current_book_id = $this->currentBook() ? $this->currentBook()->id : 0;
$prefix = $this->getPrefix();
$recent_done_now = 10;
$books = $this->getAllBookCounts();
$tasks = $this->getTasks('', $recent_done_now);
return View::make('tasks.index', compact('user_name', 'book_name', 'current_book_id', 'prefix', 'recent_done_now', 'tasks', 'books'));
} else {
$this->tasks = $this->currentTasks();
// respond_to do |format|
// format.html
// format.csv { send_data(current_tasks.csv) }
// format.xls
// end
return View::make('tasks.index');
}
}
示例2: __construct
public function __construct()
{
if (Agent::isMobile()) {
$this->_vista = 'mobile';
} else {
$this->_vista = 'index';
}
$this->_imagesInstagram = array();
$this->_imagesTwitter = array();
$instagram = new instagram(array('apiKey' => '09fd60952ea742d5abb761b6c6a137aa', 'apiSecret' => 'ee25063e91e74d6c9f257be054a44ec3', 'apiCallback' => 'http://viernesdezapatillas.pe/'));
$tagInstagram = 'viernesdezapatillas';
$numphotosInstagram = 15;
$media = $instagram->getTagMedia($tagInstagram, $auth = false, array('count' => $numphotosInstagram));
$response = json_decode(json_encode($media));
foreach ($response->data as $data) {
$this->_imagesInstagram[] = $data->images->thumbnail->url;
}
$max_id = 0;
$totalTweets = 15;
$responset = Twitter::getSearch(array('q' => '#viernesdezapatillas since:2015-07-01 filter:images', 'count' => $totalTweets, 'max_id' => $max_id, 'since_id' => 0));
foreach ($responset->statuses as $tweet) {
foreach ($tweet->entities->media as $url) {
$this->_imagesTwitter[] = $url->media_url;
// . ':thumb';
}
}
}
示例3: detail
public function detail($idLook, $categoria, $name)
{
$producto = DB::table('looks')->where('looks.idlook', $idLook)->where('looks.estado', '>=', 1)->join('lookbook', 'lookbook.idlookbook', '=', 'looks.idlookbook')->select('looks.*', 'lookbook.nombre')->get();
$subcate = $producto[0]->subcategoria;
$ordensuperior = $producto[0]->orden2 + 1;
$ordeninferior = $producto[0]->orden2 - 1;
$numregistros = DB::table('looks')->where('looks.idlookbook', $categoria)->count();
if ($ordensuperior > $numregistros) {
$ordensuperior = 1;
}
if ($ordeninferior <= 1) {
$ordeninferior = $numregistros;
}
$prodsiguiente = DB::table('looks')->where('looks.orden2', $ordensuperior)->where('looks.estado', '>=', 1)->where('looks.idlookbook', $categoria)->select('looks.idlook', 'looks.nombrelook', 'looks.idlookbook')->take(1)->get();
$prodanterior = DB::table('looks')->where('looks.orden2', $ordeninferior)->where('looks.estado', '>=', 1)->where('looks.idlookbook', $categoria)->select('looks.idlook', 'looks.nombrelook', 'looks.idlookbook')->take(1)->get();
/*$similares = DB::table('looks')
->where('looks.idlookbook', '=', $categoria)
->where('looks.estado', '=', 1)
->where('looks.idlook', '!=', $idLook)
->select('looks.*')
->orderBy('looks.orden2')
->take(4)
->get();*/
$similares = DB::table('looks')->where('looks.idlookbook', '=', $categoria)->where('looks.estado', '>=', 1)->where('looks.idlook', '!=', $idLook)->where('looks.subcategoria', $subcate)->select('looks.*')->orderBy(DB::raw('RAND()'))->get();
$isMobile = Agent::isMobile();
if ($isMobile) {
return View::make('mobile/lookbook-detail')->with('producto', $producto)->with('similares', $similares)->with('sig', $prodsiguiente)->with('ant', $prodanterior);
} else {
return View::make('desktop/lookbook-detail')->with('producto', $producto)->with('similares', $similares)->with('sig', $prodsiguiente)->with('ant', $prodanterior);
}
}
示例4: index
public function index()
{
$isMobile = Agent::isMobile();
//$isMobile=true;
if ($isMobile) {
return View::make('mobile/home');
} else {
return View::make('desktop/home');
}
}
示例5: find
/**
* Get the fully qualified location of the view.
*
* @param string $name
* @return string
*/
public function find($name)
{
// Log::info('View Hook!! ' . $name);
if (Agent::isMobile()) {
try {
return parent::find($name . '@phone');
} catch (Exception $e) {
Log::debug(__METHOD__ . ": not find {$name}@phone");
}
}
return parent::find($name);
}
示例6: postSubirVideo
public function postSubirVideo()
{
$res = '';
$ie = Input::get('ie');
if (isset($_FILES['archivo'])) {
$file = $_FILES['archivo'];
$name = $file['name'];
$tmp_name = $file['tmp_name'];
$extension = explode('.', $name);
$extension = strtolower(end($extension));
$key = md5(uniqid());
$tmp_file_name = "{$key}.{$extension}";
$tmp_file_path = "../uploads/{$tmp_file_name}";
move_uploaded_file($tmp_name, $tmp_file_path);
$videos = new Videos();
$videos->dni = trim(Input::get('dni'));
$videos->archivo_original = $name;
$videos->archivo = $key;
$videos->extension = $extension;
$videos->ip = Request::getClientIp(true);
$videos->save();
$res = '1';
} else {
$res = '0';
}
/*if (Agent::isMobile())
return View::make('mensaje.mobile');
if ($ie === '1') {
return View::make('mensaje');
} else {
return $res;
}*/
if (Agent::isMobile()) {
return View::make('mensajeMobile');
} else {
return View::make('mensaje');
}
}
示例7: fileSource
/**
* get file's source
*
* @param string $url url
* @param string $id id
*
* @return void
*/
public function fileSource($url, $id)
{
$file = File::find($id);
/** @var \Xpressengine\Media\MediaManager $mediaManager */
$mediaManager = \App::make('xe.media');
if ($mediaManager->is($file) === true) {
$dimension = 'L';
if (\Agent::isMobile() === true) {
$dimension = 'M';
}
$media = Image::getThumbnail($mediaManager->make($file), PageModule::THUMBNAIL_TYPE, $dimension);
}
header('Content-type: ' . $media->mime);
echo $media->getContent();
}
示例8: fileSource
/**
* get file's source
*
* @param string $url url
* @param string $id id
* @return void
*/
public function fileSource($url, $id)
{
$permission = $this->permissionHandler->get($this->boardId);
if ($permission->unables(ACTION::READ) === true) {
throw new AccessDeniedHttpException();
}
// permission 추가 해야 함.
/** @var \Xpressengine\Storage\Storage $storage */
$storage = app('xe.storage');
$file = $storage->get($id);
/** @var \Xpressengine\Media\MediaManager $mediaManager */
$mediaManager = \App::make('xe.media');
if ($mediaManager->is($file) === true) {
/** @var \Xpressengine\Media\Handlers\ImageHandler $handler */
$handler = $mediaManager->getHandler(\Xpressengine\Media\Spec\Media::TYPE_IMAGE);
$dimension = 'L';
if (\Agent::isMobile() === true) {
$dimension = 'M';
}
$media = $handler->getThumbnail($mediaManager->make($file), Board::THUMBNAIL_TYPE, $dimension);
$file = $media->getFile();
}
header('Content-type: ' . $file->mime);
echo $storage->read($file);
}
示例9: fileSource
/**
* get file source
*
* @param EditorHandler $handler editor handler
* @param string $instanceId instance id
* @param string $id document id
* @return void
* @throws InvalidArgumentException
*/
public function fileSource(EditorHandler $handler, $instanceId, $id)
{
if (empty($id)) {
throw new InvalidArgumentException();
}
$file = File::find($id);
/** @var \Xpressengine\Media\MediaManager $mediaManager */
$mediaManager = app('xe.media');
if ($mediaManager->is($file) === true) {
$dimension = 'L';
if (\Agent::isMobile() === true) {
$dimension = 'M';
}
$media = Image::getThumbnail($mediaManager->make($file), EditorHandler::THUMBNAIL_TYPE, $dimension);
header('Content-type: ' . $media->mime);
echo $media->getContent();
}
}
示例10: isMobile
function isMobile()
{
return Agent::isMobile() || Agent::isTablet();
}
示例11: function
<?php
/**
* Render form validation message.
*
* @return string
*/
Form::macro('validationMessage', function () {
return '<span class="form-control-feedback" aria-hidden="true"></span><div class="help-block with-errors text-center"></div>';
});
/**
* Render Google recaptcha.
*
* @return string
*/
Form::macro('recaptcha', function () {
return sprintf('<div id="g-recaptcha" data-sitekey="%s" data-size="%s"></div>', env('RECAPTCHA_SITE_KEY', ''), Agent::isMobile() ? 'compact' : 'normal');
});
示例12: defineFolder
function defineFolder()
{
$isMobile = Agent::isMobile();
$ips = array('190.234.106.195', '179.7.84.155');
$ip = getIP();
$folder = 'desktop/';
if ($isMobile) {
$folder = 'mobile/';
}
// Hack
if (in_array($ip, $ips)) {
$folder = 'mobile/';
}
return $folder;
}
示例13: getView
public function getView($slug)
{
if (Agent::isMobile() || Agent::isTablet()) {
switch ($slug) {
case "film":
return Redirect::to('film-mobile');
break;
case "animation":
return Redirect::to('animation-mobile');
break;
case "game-production":
return Redirect::to('game-mobile');
break;
case "recording-arts":
return Redirect::to('recording-arts-mobile');
break;
case "mp":
return Redirect::to('mp-mobile');
break;
case "entertainment-business":
return Redirect::to('business-mobile');
break;
case "entertainment-business-online":
return Redirect::to('entertainment-business-online-mobile');
break;
case "digital-filmmaking":
return Redirect::to('digital-filmmaking-mobile');
break;
case "military":
return Redirect::to('omni-mobile');
break;
case "omni":
return Redirect::to('omni-mobile');
break;
}
} elseif (!Agent::isMobile() && !Agent::isTablet()) {
switch ($slug) {
case "film-mobile":
return Redirect::to('film');
break;
case "animation-mobile":
return Redirect::to('animation');
break;
case "game-mobile":
return Redirect::to('game-production');
break;
case "recording-arts-mobile":
return Redirect::to('recording-arts');
break;
case "mp-mobile":
return Redirect::to('mp');
break;
case "business-mobile":
return Redirect::to('entertainment-business');
break;
case "digital-filmmaking-mobile":
return Redirect::to('digital-filmmaking');
break;
case "entertainment-business-online-mobile":
return Redirect::to('entertainment-business-online');
break;
case "omni-mobile":
return Redirect::to('omni');
break;
}
}
$landingpage = $this->landingpage->where('slug', '=', $slug)->first();
// Check if the blog post exists
if (is_null($landingpage)) {
// If we ended up in here, it means that
// a page or a blog post didn't exist.
// So, this means that it is time for
// 404 error page.
//return App::abort(404);
return 'DAMN!';
}
// Get variants
$variants = $landingpage->variants($landingpage->id);
$lpcount = $this->landingpage->sumallhits($landingpage->id);
if ($lpcount == 0) {
$lpcount = 100;
}
$v = array();
foreach ($variants as $var) {
$hit = $this->landingpage->sumhits($var->id);
$varperc = $hit / $lpcount;
$percent = $var->percent / 100;
if ($varperc < $percent) {
$vid = $var->id;
break;
}
$v[] = $var->id;
}
if (empty($vid)) {
$key = array_rand($v);
$vid = $v[$key];
}
//echo $vid;
$varclass = new Variant();
$variant = $varclass->findOrFail($vid);
//.........这里部分代码省略.........