本文整理汇总了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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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;
}