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


PHP Device::is_mobile方法代码示例

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


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

示例1: set_metatags_and_content

 public function set_metatags_and_content($url, $name = 'page', $items_on_page = null)
 {
     $name = mb_strtolower($name);
     $name = ucfirst($name);
     $model = ORM::factory($name)->get_page_by_url($url);
     if (!$model->loaded() || isset($model->md5_url) && $model->md5_url != md5($url)) {
         $this->forward_404();
     }
     $this->_items_on_page = $items_on_page;
     $this->_model = $model;
     $this->template->model = $model;
     $this->_object_name = str_replace('Model_', '', get_class($this->_model));
     $list_columns = $this->_model->list_columns();
     foreach ($list_columns as $column => $params) {
         $this->template->{$column} = $this->_model->{$column};
         switch ($column) {
             case 's_title':
                 $this->template->s_title = $this->set_title();
                 break;
         }
     }
     foreach ($this->_model->has_many() as $column => $params) {
         if ($this->_items_on_page && $column != 'children' && $column != 'filters') {
             $pagination_items = $this->get_pagination_items($column, $params);
             $this->template->{$column} = $pagination_items['items'];
             if ($pagination_items['pagination']) {
                 $this->template->pagination = $pagination_items['pagination'];
             }
         } else {
             if ($column != 'filters') {
                 $this->template->{$column} = $this->_model->{$column}->where('active', '=', 1)->find_all();
             }
         }
     }
     foreach ($this->_model->belongs_to() as $column => $params) {
         if ($params['model'] == 'Brand' || $params['model'] == 'Category') {
             continue;
         }
         $model = ORM::factory($params['model'])->fetchByUrl($this->param($column));
         if ($model->id != $this->_model->{$params['foreign_key']} && $column != 'parent' && $column != 'parent') {
             $this->forward_404();
         }
         foreach ($model->list_columns() as $model_column => $model_params) {
             $this->template->{$column . '_' . $model_column} = $model->{$model_column};
         }
     }
     if (isset($list_columns['more_images'])) {
         $this->template->content = $this->replace_images();
     }
     $device = new Device();
     $this->template->is_mobile = $device->is_mobile();
 }
开发者ID:ariol,项目名称:cosm.by,代码行数:52,代码来源:Site.php

示例2: Scripts

        }
    }
    if (!empty($_USER['theme'])) {
        if (is_dir($_CONF['path_themes'] . $_USER['theme'])) {
            $_CONF['theme'] = $_USER['theme'];
            $_CONF['path_layout'] = $_CONF['path_themes'] . $_CONF['theme'] . '/';
            $_CONF['layout_url'] = $_CONF['site_url'] . '/layout/' . $_CONF['theme'];
        } else {
            $_USER['theme'] = $_CONF['theme'];
        }
    }
}
// Set template class default template variables option
$TEMPLATE_OPTIONS['default_vars']['layout_url'] = $_CONF['layout_url'];
$TEMPLATE_OPTIONS['default_vars']['anonymous_user'] = COM_isAnonUser();
$TEMPLATE_OPTIONS['default_vars']['device_mobile'] = $_DEVICE->is_mobile();
/**
 * This provides the ability to set css and javascript.
 *
 * @global $_SCRIPTS Scripts
 */
$_SCRIPTS = new Scripts();
// Include theme functions file which may/may not do anything
if (file_exists($_CONF['path_layout'] . 'functions.php')) {
    require_once $_CONF['path_layout'] . 'functions.php';
}
// Get the configuration values from the theme
$_CONF['theme_default'] = '';
// Default is none
$_CONF['path_layout_default'] = '';
// Default is none
开发者ID:Geeklog-Japan,项目名称:geeklog-japan,代码行数:31,代码来源:lib-common.php

示例3: action_index


//.........这里部分代码省略.........
     }
     $query .= ' WHERE pr.parent_product = 0 AND pr.active=1 AND pr.category_id=' . $category->id . ' AND pr.price > 0';
     if ($brands) {
         $brandsList = join('", "', $brands);
         $query .= ' AND br.id IN ("' . $brandsList . '")';
     }
     if ($lines) {
         $linesList = join('", "', array_keys($lines));
         $query .= ' AND pr.line_id IN ("' . $linesList . '")';
     }
     if ($current_max_price && $current_min_price) {
         $query .= ' AND pr.price >= ' . $current_min_price . ' AND pr.price <= ' . $current_max_price;
     }
     $this->template->current_max_price = $current_max_price;
     $this->template->current_min_price = $current_min_price;
     $properties_count = 0;
     $bool_query = '';
     $integer_query = '';
     $select_query = '';
     $bool_count = 0;
     $integer_count = 0;
     foreach ($get_filters as $filter_id => $filter_value) {
         if ($filters_hash[$filter_id]['type'] == 'B' && $filter_value) {
             if (!$bool_count) {
                 $bool_query .= '(';
             }
             if ($bool_count) {
                 $bool_query .= ' OR ';
             }
             $bool_query .= 'pp.property_id=' . $filter_id . ' AND pp.value=1';
             $bool_count++;
             $properties_count++;
         }
     }
     if ($properties_count) {
         $query .= ' AND (';
     }
     if ($bool_count) {
         $bool_query .= ')';
     }
     $query .= $bool_query;
     if ($integer_query) {
         if ($bool_count) {
             $query .= ' OR ';
         }
         $query .= $integer_query;
     }
     if ($select_query) {
         if ($bool_count || $integer_count) {
             $query .= ' OR ';
         }
         $query .= $select_query;
     }
     if ($properties_count) {
         $query .= ')';
     }
     if ($page == 1) {
         $url = str_replace('/' . $page, '', $this->request->url());
         $this->redirect($url, 301);
     }
     if (is_null($this->param('page'))) {
         $page = 1;
     }
     $order = Arr::get($_GET, 'order');
     $dest = Arr::get($_GET, 'dest');
     $order_by_str = '';
     if ($order && $dest && in_array($dest, array('asc', 'desc', 'ASC', 'DESC')) && array_key_exists($order, ORM::factory('Product')->as_array())) {
         $order_by_str = ' ORDER BY ' . 'pr.' . $order . ' ' . $dest;
     }
     $offset = $this->_items_on_page * $page - $this->_items_on_page;
     $query .= ' GROUP BY pr.id HAVING cnt >=' . $properties_count . $order_by_str;
     $query .= ' LIMIT ' . $offset . ',' . $this->_items_on_page;
     $items = ORM::factory('Product')->query($query);
     if ($this->request->is_ajax()) {
         exit(json_encode(array('count' => $items['total_items'])));
     }
     $max_pages = intval(ceil($items['total_items'] / $this->_items_on_page));
     if (!$max_pages) {
         $max_pages = 1;
     }
     if ($page < 1 || $page > $max_pages) {
         $this->forward_404();
     }
     $img_width = 320;
     $img_height = 150;
     $mobile = '';
     $device = new Device();
     if ($device->is_mobile()) {
         $img_width = 700;
         $img_height = 300;
         $mobile = 'mobile';
     }
     $this->template->mobile = $mobile;
     $this->template->img_height = $img_height;
     $this->template->img_width = $img_width;
     $this->template->pagination = Pagination::factory(array('current_page' => array('source' => 'route', 'key' => 'page'), 'total_items' => $items['total_items'], 'items_per_page' => $this->_items_on_page, 'view' => 'site/pagination/pagination'))->render();
     $this->template->product = $items['items'];
     $this->template->s_description = $category->s_description;
     $this->template->s_title = $category->name . ' - купить ' . $category->name . ' в Минске в интернет магазине cosm.by: лучшие цены, большой каталог, отзывы';
 }
开发者ID:ariol,项目名称:adminshop,代码行数:101,代码来源:Category.php

示例4: switch

    switch ($_CONF['doctype']) {
        case 'xhtml10transitional':
        case 'xhtml10strict':
        case 'xhtml5':
            define('XHTML', ' /');
            break;
        default:
            define('XHTML', '');
            break;
    }
}
// Set template class default template variables option
/**
 * @global $TEMPLATE_OPTIONS array
 */
$TEMPLATE_OPTIONS = array('path_cache' => $_CONF['path_data'] . 'layout_cache/', 'path_prefixes' => array($_CONF['path_themes'], $_CONF['path'], '/'), 'incl_phpself_header' => true, 'cache_by_language' => true, 'cache_for_mobile' => $_CONF['cache_mobile'], 'default_vars' => array('xhtml' => XHTML, 'site_url' => $_CONF['site_url'], 'site_admin_url' => $_CONF['site_admin_url'], 'layout_url' => $_CONF['layout_url'], 'anonymous_user' => COM_isAnonUser(), 'device_mobile' => $_DEVICE->is_mobile()), 'hook' => array('set_root' => 'CTL_setTemplateRoot'));
\Geeklog\Autoload::load('template');
// Template library contains helper functions for template class
require_once $_CONF['path_system'] . 'lib-template.php';
// Set language
if (isset($_COOKIE[$_CONF['cookie_language']]) && empty($_USER['language'])) {
    $language = COM_sanitizeFilename($_COOKIE[$_CONF['cookie_language']]);
    if (is_file($_CONF['path_language'] . $language . '.php') && $_CONF['allow_user_language'] == 1) {
        $_USER['language'] = $language;
        $_CONF['language'] = $language;
    }
} elseif (!empty($_USER['language'])) {
    if (is_file($_CONF['path_language'] . $_USER['language'] . '.php') && $_CONF['allow_user_language'] == 1) {
        $_CONF['language'] = $_USER['language'];
    }
} elseif (!empty($_CONF['languages']) && !empty($_CONF['language_files'])) {
开发者ID:mystralkk,项目名称:geeklog,代码行数:31,代码来源:lib-common.php


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