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


PHP URI::create方法代码示例

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


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

示例1: action_index

 /**
  * Инлексная страница
  */
 public function action_index()
 {
     // Если была отправлена форма фильтрации или сортировка
     if (\Input::method() == 'POST') {
         $category_id = (int) \Input::post('category_id');
         if ($category_id > 0) {
             \Session::set('filter_articles_category_id', $category_id);
         } else {
             \Session::set('filter_articles_category_id', null);
         }
         $title = trim(\Input::post('title'));
         \Session::set('filter_articles_title', $title);
         // Сортировка
         \Session::set('admin_articles_order_by', \Input::post('order_by', 'id'));
         \Session::set('admin_articles_order_method', \Input::post('order_method', 'desc'));
     }
     // Запрос на извлечение кол-ва статей
     $count = \Model_Article::get_articles_count(\Session::get('filter_articles_title'), \Session::get('filter_articles_category_id'));
     // Пагинация
     $config = array('pagination_url' => \URI::create('admin/articles/index'), 'total_items' => $count, 'per_page' => 15, 'uri_segment' => 4);
     $pagination = \Pagination::forge('articles_pagination', $config);
     $data['pagination'] = $pagination->render();
     // Передаём в представление данные пагинации (для нумерации статей)
     $data['current_page'] = is_null($pagination->current_page) ? 1 : $pagination->current_page;
     $data['per_page'] = $pagination->per_page;
     // Получение статей
     $data['articles'] = \Model_Article::get_articles(\Session::get('filter_articles_title'), \Session::get('filter_articles_category_id'), $pagination->per_page, $pagination->offset, \Session::get('admin_articles_order_by', 'id'), \Session::get('admin_articles_order_method', 'desc'));
     // Категории статей
     $data['categories'] = \Model_Category::get_categories_for_select();
     $this->template->title = "Статьи";
     $this->template->content = \View::forge('articles/index', $data, false);
 }
开发者ID:alexmon1989,项目名称:fcssadon.ru,代码行数:35,代码来源:articles.php

示例2: action_index

 /**
  * Список сезонов
  */
 public function action_index()
 {
     // Пагинация
     $config = array('pagination_url' => \URI::create('admin/competitions/seasons/index'), 'total_items' => \Model_Season::count(), 'per_page' => 10, 'uri_segment' => 5);
     $pagination = \Pagination::forge('seasons_pagination', $config);
     $data['pagination'] = $pagination->render();
     $data['seasons'] = \Model_Season::find('all', array('order_by' => array('id' => 'DESC'), 'offset' => $pagination->offset, 'limit' => $pagination->per_page));
     $this->template->content = \View::forge('competitions/seasons/index', $data);
 }
开发者ID:alexmon1989,项目名称:fcssadon.ru,代码行数:12,代码来源:seasons.php

示例3: action_index

 /**
  * Действие для вывода списка категорий
  */
 public function action_index()
 {
     // Пагинация
     $config = array('pagination_url' => \URI::create('admin/media/photos/categories/index'), 'total_items' => \Model_Media_Photos_Category::count(), 'per_page' => 10, 'uri_segment' => 6);
     $pagination = \Pagination::forge('categories_pagination', $config);
     $data['pagination'] = $pagination->render();
     $data['сategories'] = \Model_Media_Photos_Category::find('all', array('related' => 'photos', 'order_by' => array('created_at' => 'DESC'), 'offset' => $pagination->offset, 'limit' => $pagination->per_page));
     $this->template->content = \View::forge('media/photos/categories/index', $data, FALSE);
 }
开发者ID:alexmon1989,项目名称:fcssadon.ru,代码行数:12,代码来源:categories.php

示例4: action_index

 /**
  * Действие для отображения списка видеозаписей
  */
 public function action_index()
 {
     // Пагинация
     $config = array('pagination_url' => \URI::create('media/videos'), 'total_items' => \Model_Media_Video::count(), 'per_page' => 4, 'uri_segment' => 3);
     $pagination = \Pagination::forge('videos_pagination', $config);
     $data['pagination'] = $pagination->render();
     // Получаем список видеозаписей
     $data['videos'] = \Model_Media_Video::find('all', array('order_by' => array('created_at' => 'DESC'), 'offset' => $pagination->offset, 'limit' => $pagination->per_page));
     $this->template->page_title = 'Медиа :: Видео';
     $this->template->content = \View::forge('media/videos/index', $data, FALSE);
 }
开发者ID:alexmon1989,项目名称:fcssadon.ru,代码行数:14,代码来源:videos.php

示例5: action_index

 /**
  * Действие для отображения списка новостей
  */
 public function action_index()
 {
     // Запрос на извлечение количества статей
     $count = \Model_Article::get_articles_count(NULL, $this->category_id);
     // Пагинация
     $config = array('pagination_url' => \URI::create("news/{$this->uri}/page"), 'total_items' => $count, 'per_page' => 6, 'uri_segment' => 4);
     $pagination = \Pagination::forge('news_pagination', $config);
     $data['pagination'] = $pagination->render();
     // Получение статей
     $data['articles'] = \Model_Article::get_articles('', $this->category_id, $pagination->per_page, $pagination->offset);
     $this->template->content = \View::forge('articles/index', $data, FALSE);
 }
开发者ID:alexmon1989,项目名称:fcssadon.ru,代码行数:15,代码来源:base.php

示例6: action_view

 /**
  * Отображение списка фотографий категории
  * 
  * @param int $id
  */
 public function action_view($id = null)
 {
     is_null($id) and \Response::redirect('media/photos/categories');
     // Пагинация
     $config = array('pagination_url' => \URI::create('media/photos/categories/view/' . $id), 'total_items' => \Model_Media_Photo::count(array('where' => array(array('category_id', '=', $id)))), 'per_page' => 6, 'uri_segment' => 6);
     $pagination = \Pagination::forge('photos_pagination', $config);
     $data['pagination'] = $pagination->render();
     // Извлекаем данные категории
     $data['photos'] = \Model_Media_Photo::find('all', array('related' => 'category', 'where' => array(array('category_id', '=', $id)), 'order_by' => array('created_at' => 'DESC'), 'offset' => $pagination->offset, 'limit' => $pagination->per_page));
     $this->template->css = array('lightbox.css');
     $this->template->js = array('lightbox.min.js');
     $this->template->page_title = 'Медиа :: Фото :: ' . current($data['photos'])->category->title;
     $this->template->content = \View::forge('media/photos/categories/view', $data, FALSE);
 }
开发者ID:alexmon1989,项目名称:fcssadon.ru,代码行数:19,代码来源:categories.php

示例7: action_index

 /**
  * Действие для отображения списка фотографий категории
  */
 public function action_index($category_id = NULL)
 {
     is_null($category_id) and \Response::redirect('admin/media/photos/categories');
     if (!($data['category'] = \Model_Media_Photos_Category::find($category_id))) {
         \Session::set_flash('error', 'Категория не найдена.');
         \Response::redirect('admin/media/photos/categories');
     }
     // Пагинация
     $config = array('pagination_url' => \URI::create('admin/media/photos/list/index/' . $category_id), 'total_items' => \Model_Media_Photo::count(array('where' => array(array('category_id' => $category_id)))), 'per_page' => 10, 'uri_segment' => 7);
     $pagination = \Pagination::forge('categories_pagination', $config);
     $data['pagination'] = $pagination->render();
     $data['photos'] = \Model_Media_Photo::find('all', array('where' => array(array('category_id', '=', $category_id)), 'order_by' => array('created_at' => 'DESC'), 'offset' => $pagination->offset, 'limit' => $pagination->per_page));
     $this->template->title = 'Фотогалерея "' . $data['category']->title . '"';
     $this->template->content = \View::forge('media/photos/list/index', $data, FALSE);
 }
开发者ID:alexmon1989,项目名称:fcssadon.ru,代码行数:18,代码来源:list.php

示例8: __construct

 /**
  * @copydoc DBWorker::__construct
  *
  * @throws SystemException 'ERR_NO_SITE'
  * @throws SystemException 'ERR_403'
  */
 public function __construct()
 {
     parent::__construct();
     $uri = URI::create();
     $this->data = Site::load();
     if (!($this->getConfigValue('site.debug') && ($res = $this->getConfigValue('site.dev_domains')))) {
         $request = 'SELECT d . * , site_id as domain_site
                   FROM `share_domains` d
                   LEFT JOIN share_domain2site d2c
                   USING ( domain_id ) ';
         $res = $this->dbh->select($request);
     }
     if (!$res) {
         throw new SystemException('ERR_NO_SITE', SystemException::ERR_DEVELOPER);
     }
     foreach ($res as $domainData) {
         $domainData = E()->Utils->convertFieldNames($domainData, 'domain_');
         //Если не установлен уже домен - для сайта - дописываем
         //по сути первый домен будет дефолтным
         if (isset($domainData['site']) && is_null($this->data[$domainData['site']]->base)) {
             $tmp = $domainData;
             unset($tmp['id'], $tmp['site']);
             $this->data[$domainData['site']]->setDomain($tmp);
             unset($tmp);
         }
         if ($domainData['protocol'] == $uri->getScheme() && $domainData['host'] == $uri->getHost() && $domainData['port'] == $uri->getPort()) {
             $realPathSegments = array_values(array_filter(explode('/', $domainData['root'])));
             $pathSegments = array_slice($uri->getPath(false), 0, sizeof($realPathSegments));
             if ($realPathSegments == $pathSegments) {
                 $this->currentSiteID = $domainData['site'];
                 unset($domainData['id'], $domainData['site']);
                 $this->data[$this->currentSiteID]->setDomain($domainData);
             }
         }
     }
     if (is_null($this->currentSiteID)) {
         foreach ($this->data as $siteID => $site) {
             if ($site->isDefault == 1) {
                 $this->currentSiteID = $siteID;
             }
         }
     }
     //Если текущий сайт не активный
     if (!$this->data[$this->currentSiteID]->isActive) {
         throw new SystemException('ERR_403', SystemException::ERR_403);
     }
 }
开发者ID:energine-cmf,项目名称:energine,代码行数:53,代码来源:SiteManager.php

示例9: __construct

 /**
  * @throws SystemException
  */
 public function __construct()
 {
     $this->uri = URI::create();
     $path = $this->uri->getPath();
     if (strpos($path, E()->getSiteManager()->getCurrentSite()->root) !== false) {
         $path = array_values(array_diff(explode('/', substr($path, strlen(E()->getSiteManager()->getCurrentSite()->root))), array('')));
     } else {
         $path = array();
     }
     try {
         $language = E()->getLanguage();
         $this->lang = isset($path[0]) && $language->isValidLangAbbr($path[0]) ? array_shift($path) : '';
     } catch (SystemException $e) {
         $this->lang = '';
     }
     $this->path = $path;
 }
开发者ID:energine-cmf,项目名称:energine,代码行数:20,代码来源:Request.php


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