本文整理汇总了PHP中uri类的典型用法代码示例。如果您正苦于以下问题:PHP uri类的具体用法?PHP uri怎么用?PHP uri使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了uri类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: rel
public function rel($relativeUri)
{
$relativeUri = $relativeUri instanceof uri ? $relativeUri : uri::fromString(strval($relativeUri));
$rel = new uri();
$rel->setPath(array_merge($this->_uri->getPath(), $relativeUri->getPath()));
return $rel;
}
开发者ID:alexqwert,项目名称:kanon,代码行数:7,代码来源:view.php
示例2: _fetch
function & _fetch(&$counter, $params)
{
$result =& parent :: _fetch($counter, $params);
$uri = new uri($_SERVER['PHP_SELF']);
foreach($result as $key => $data)
{
$nav_uri = new uri($data['url']);
if ($uri->get_host() != $nav_uri->get_host())
continue;
if(is_integer($res = $uri->compare_path($nav_uri)))
{
if($res >= 0)
{
$result[$key]['in_path'] = true;
$params['path'] = $data['path'];
$result[$key]['items'] = $this->_fetch(&$counter, $params);
}
if($res == 0)
$result[$key]['selected'] = true;
}
}
return $result;
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:26,代码来源:recursive_navigation_datasource.class.php
示例3: _fetch
function & _fetch(&$counter, $params)
{
$result =& parent :: _fetch($counter, $params);
$uri = new uri($_SERVER['PHP_SELF']);
//we're trimming trailing slashes: thus /root/about == /root/about/
$uri->set_path(rtrim($uri->get_path(), '/'));
foreach($result as $key => $data)
{
$nav_uri = new uri($data['url']);
$nav_uri->set_path(rtrim($nav_uri->get_path(), '/'));
if ($uri->get_host() != $nav_uri->get_host())
continue;
if(is_integer($res = $uri->compare_path($nav_uri)))
{
if($res >= 0)
$result[$key]['in_path'] = true;
if($res == 0)
$result[$key]['selected'] = true;
}
}
return $result;
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:29,代码来源:simple_navigation_datasource.class.php
示例4: _compare_with_url
function _compare_with_url($url)
{
$uri = new uri($_SERVER['PHP_SELF']);
//we're trimming trailing slashes: thus /root/about == /root/about/
$uri->set_path(rtrim($uri->get_path(), '/'));
$nav_uri = new uri($url);
$nav_uri->set_path(rtrim($nav_uri->get_path(), '/'));
if ($uri->get_host() != $nav_uri->get_host()) {
return false;
}
return $uri->compare_path($nav_uri);
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:12,代码来源:simple_navigation_datasource.class.php
示例5: render
public function render()
{
if (!$this->links) {
throw new Kohana_User_Exception("Navbar not implemented correctly", "Links have not been set. Please call <code>$navbar->set_links({$links})</code>");
} else {
if ($this->view) {
return $this->render_to_view($this->view);
} else {
$html = "";
$i = 0;
foreach ($this->links as $link) {
$class = "";
if (str_replace("site", "", url::current()) == $link->seoURL || url::current() == $link->seoURL || uri::segment(1) == $link->seoURL) {
$class .= "selected";
}
if ($i == 0) {
$class .= " first";
}
if ($i == count($this->links) - 1) {
$class .= " last";
}
$html .= '<li class="' . $class . '" id="menu0' . ($i + 1) . '"><a href="' . url::site() . $link->seoURL . '" class="' . $class . '">' . $link->title . '</a></li>';
$i++;
}
# $html .= "</ul>";
return $html;
}
}
}
开发者ID:sydlawrence,项目名称:SocialFeed,代码行数:29,代码来源:Navbar.php
示例6: __construct
public function __construct()
{
parent::__construct();
if (!config::item('news_blog', 'news') && uri::segment(1) != 'news') {
router::redirect('news/' . utf8::substr(uri::getURI(), 5));
}
}
开发者ID:soremi,项目名称:tutornavi,代码行数:7,代码来源:blog.php
示例7: delete
public function delete()
{
// Get URI vars
$slugID = urldecode(utf8::trim(uri::segment(4)));
// Do we have a slug ID?
if ($slugID == '') {
error::show404();
}
// Get user
if (!($user = $this->users_model->getUser($slugID)) || !$user['active'] || !$user['verified']) {
error::show404();
} elseif ($user['user_id'] == session::item('user_id')) {
router::redirect($user['slug']);
}
// Does user exist?
if (!($blocked = $this->users_blocked_model->getUser($user['user_id'], true))) {
view::setError(__('no_blocked_user', 'users_blocked'));
router::redirect('users/blocked');
}
// Delete blocked user
$this->users_blocked_model->deleteBlockedUser(session::item('user_id'), $user['user_id']);
// Success
view::setInfo(__('user_unblocked', 'users_blocked'));
router::redirect(input::get('page') ? 'users/blocked' : $user['slug']);
}
开发者ID:soremi,项目名称:tutornavi,代码行数:25,代码来源:blocked.php
示例8: view
public function view()
{
// Get URI vars
$newsID = (int) uri::segment(3);
// Get news entry
if (!$newsID || !($news = $this->news_model->getEntry($newsID, 'in_view')) || !$news['active']) {
error::show404();
}
// Do we have views enabled?
if (config::item('news_views', 'news')) {
// Update views counter
$this->news_model->updateViews($newsID);
}
// Load ratings
if (config::item('news_rating', 'news') == 'stars') {
// Load votes model
loader::model('comments/votes');
// Get votes
$news['user_vote'] = $this->votes_model->getVote('news', $newsID);
} elseif (config::item('news_rating', 'news') == 'likes') {
// Load likes model
loader::model('comments/likes');
// Get likes
$news['user_vote'] = $this->likes_model->getLike('news', $newsID);
}
// Assign vars
view::assign(array('newsID' => $newsID, 'news' => $news));
// Set title
view::setTitle($news['data_title']);
// Set meta tags
view::setMetaDescription($news['data_meta_description']);
view::setMetaKeywords($news['data_meta_keywords']);
// Load view
view::load('news/view');
}
开发者ID:soremi,项目名称:tutornavi,代码行数:35,代码来源:news.php
示例9: uri
function &_fetch(&$counter, $params)
{
$result =& parent::_fetch($counter, $params);
$uri = new uri($_SERVER['PHP_SELF']);
foreach ($result as $key => $data) {
if (is_integer($res = $uri->compare_path(new uri($data['url'])))) {
if ($res >= 0) {
$result[$key]['in_path'] = true;
}
if ($res == 0) {
$result[$key]['selected'] = true;
}
}
}
return $result;
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:16,代码来源:tree_navigation_datasource.class.php
示例10: render_summary
/**
* Returns the formatted html
*
* html example
* e.g <h1>{TITLE}</h1><h2>{DATE}</h2><h3>by {AUTHOR}</h3>{IMAGE}{TEXT}<div class="spacer"> </div>
*
* @param array $options Options for the rendering array('count', 'date_format','image' = array($width,$height), 'word_count', 'html')
* @return string $html Formatted HTML
*/
public function render_summary($options = null, $feedpost_options = null)
{
$array = array('per_page' => 5, 'pagination' => 'classic', 'template' => 'feed', 'html' => '{FEEDPOSTS}{PAGINATION}');
if (!$options) {
$config = Kohana::config_load('zest');
$options = $config['feed.summary'];
}
$array = arr::overwrite($array, $options);
$uri = uri::instance();
$page = $uri->segment('page', 1);
$feedposts = "";
$posts = $this->get_posts($array['per_page'], ($page - 1) * $array['per_page']);
foreach ($posts as $post) {
$feedposts .= $post->render_summary($feedpost_options);
}
$pagination = new Pagination(array('uri_segment' => 'page', 'total_items' => count($this->get_posts()), 'items_per_page' => $array['per_page'], 'style' => $array['pagination']));
if ($array['template'] != '') {
$html = zest::template_to_html('snippets/' . $array['template']);
} else {
$html = $array['html'];
}
$html = str_replace("{RSS_LINK}", $this->get_rss(), $html);
$html = str_replace("{FEEDPOSTS}", $feedposts, $html);
$html = str_replace("{PAGINATION}", $pagination, $html);
$html = str_replace("{FEED_LINK}", $this->get_url(), $html);
return $html;
}
开发者ID:sydlawrence,项目名称:SocialFeed,代码行数:36,代码来源:feed.php
示例11: uri
function &_fetch(&$counter, $params)
{
$result =& parent::_fetch($counter, $params);
$requested_uri = new uri($_SERVER['REQUEST_URI']);
$nav_uri = new uri();
foreach ($result as $key => $data) {
$nav_uri->parse($data['url']);
if ($requested_uri->compare_path($nav_uri) === 0) {
$result[$key]['selected'] = true;
if ($nav_uri->get_query_item('action') !== $requested_uri->get_query_item('action')) {
$result[$key]['selected'] = false;
}
}
}
return $result;
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:16,代码来源:tree_navigation_datasource.class.php
示例12: uri
function &_fetch(&$counter, $params)
{
$result =& parent::_fetch($counter, $params);
$uri = new uri($_SERVER['PHP_SELF']);
foreach ($result as $key => $data) {
if ($uri->compare($data['url'], $url_rest, $query_match)) {
if ($url_rest >= 0) {
$result[$key]['in_path'] = true;
}
if ($url_rest == 0) {
$result[$key]['selected'] = true;
}
}
}
return $result;
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:16,代码来源:tree_navigation_datasource.class.php
示例13: delete
public function delete()
{
// Get URI vars
$fieldID = (int) uri::segment(7);
// Delete custom field
$this->deleteField('pages', 'pages_data', 0, $fieldID);
}
开发者ID:soremi,项目名称:tutornavi,代码行数:7,代码来源:pages.php
示例14: delete
public function delete()
{
// Get URI vars
$typeID = (int) uri::segment(6);
$fieldID = (int) uri::segment(7);
$typeID = $typeID == 0 || $typeID == 1 ? $typeID : 0;
// Delete custom field
$this->deleteField('pictures', 'pictures_' . ($typeID == 1 ? 'albums_' : '') . 'data', $typeID, $fieldID);
}
开发者ID:soremi,项目名称:tutornavi,代码行数:9,代码来源:pictures.php
示例15: click
public function click()
{
$bannerID = (int) uri::segment(3);
if ($bannerID && $bannerID > 0) {
loader::model('banners/banners');
$this->banners_model->updateClicks($bannerID);
}
exit;
}
开发者ID:soremi,项目名称:tutornavi,代码行数:9,代码来源:banners.php
示例16: __construct
public function __construct()
{
parent::__construct();
$authID = session::item('auth_id');
$userID = session::item('user_id');
$ipaddress = substr(input::ipaddress(), 0, 15);
$useragent = substr(input::useragent(), 0, 255);
$user = array();
if ($authID && ($user = $this->getSession($authID, $userID, $ipaddress, $useragent))) {
if ($user['active_date'] < date_helper::now() - 60 * $this->timeout) {
$this->saveSession($authID, $userID, $ipaddress, $useragent);
if (isset($user['user_id']) && $user['user_id']) {
$this->saveLastvisit($user['user_id']);
}
}
} else {
$cookie = cookie::item('sessdata');
$cookie = $cookie ? @json_decode($cookie, true) : array();
if ($cookie && is_array($cookie)) {
$userID = isset($cookie['user_id']) ? $cookie['user_id'] : '';
$email = isset($cookie['email']) ? $cookie['email'] : '';
$passhash = isset($cookie['passhash']) ? $cookie['passhash'] : '';
if ($userID && is_numeric($userID) && $userID > 0) {
if ($user = $this->getUser($userID, false, false)) {
$newPasshash = $this->generatePasshash($email, $user['password']);
if ($user['active'] && $user['verified'] && strcmp($email, $user['email']) == 0 && strcmp($passhash, $newPasshash) == 0) {
$authID = $this->saveSession(0, $user['user_id'], $ipaddress, $useragent);
$this->saveLastvisit($user['user_id']);
} else {
$user = array();
}
}
}
}
}
if (!$user || !isset($user['user_id']) || !$user['user_id'] || !$this->createUserSession($user)) {
$userID = 0;
if (!$user) {
$authID = $this->saveSession(0, $userID, $ipaddress, $useragent);
}
$this->createGuestSession();
}
session::set('auth_id', $authID);
session::set('user_id', $userID);
// Is the site offline?
if (!input::isCP() && !config::item('site_online', 'system') && !session::permission('site_access_offline', 'system') && uri::getURI() != 'site/offline' && uri::segment(1) != 'load') {
router::redirect('site/offline');
} elseif (input::isCP() && !session::permission('site_access_cp', 'system') && (uri::getURI() != 'cp' && uri::getURI() != 'cp/users/login' && uri::getURI() != 'cp/users/login/license')) {
router::redirect('cp/users/login');
}
if (!input::isCP() && $this->isLoggedin() && session::permission('site_access_cp', 'system') && uri::segment(1) != 'load' && input::demo(0, '', session::item('user_id'))) {
$this->logout();
view::setInfo('For the purposes of this demo you may not use front end of the site under the administrator account. As such we have now logged you out.<br/>Feel free ' . html_helper::anchor('users/signup', 'register on the site') . ' to test user end functionality or ' . html_helper::anchor('users/login', 'login') . ' using your existing account details if you have one already.');
router::redirect();
}
}
开发者ID:soremi,项目名称:tutornavi,代码行数:56,代码来源:session.php
示例17: confirm
public function confirm()
{
$class = uri::segment(4);
$action = uri::segment(5) == 'signup' ? 'signup' : 'login';
$service = $this->users_authentication_model->getService($class);
if ($service) {
loader::library('authentication/' . uri::segment(4), $service['settings'], 'users_authentication_' . $class . '_model');
$this->{'users_authentication_' . $class . '_model'}->confirm($action);
}
router::redirect('users/login');
}
开发者ID:soremi,项目名称:tutornavi,代码行数:11,代码来源:connect.php
示例18: action_send_reset_password_mail
/**
* Confirm reset password
*
* @access public
* @return Response
*/
public function action_send_reset_password_mail()
{
// Already logged in
Auth::check() and Response::redirect('member');
Util_security::check_method('POST');
Util_security::check_csrf();
$form = $this->form_resend_password();
$val = $form->validation();
if (!$val->run()) {
Session::set_flash('error', $val->show_errors());
$this->action_resend_password();
return;
}
$post = $val->validated();
$message = term('site.password') . 'のリセット方法をメールで送信しました。';
if (!($member_auth = Model_MemberAuth::get4email($post['email']))) {
Session::set_flash('message', $message);
Response::redirect(conf('login_uri.site'));
return;
}
$member = Model_Member::check_authority($member_auth->member_id);
$error_message = '';
$is_transaction_rollback = false;
try {
$maildata = array();
DB::start_transaction();
$token = Model_MemberPasswordPre::save_with_token($member_auth->member_id, $post['email']);
DB::commit_transaction();
$mail = new Site_Mail('memberResendPassword');
$mail->send($post['email'], array('to_name' => $member->name, 'register_url' => sprintf('%s?token=%s', uri::create('member/recover/reset_password'), $token)));
Session::set_flash('message', $message);
Response::redirect(conf('login_uri.site'));
} catch (EmailValidationFailedException $e) {
Util_Toolkit::log_error('send mail error: ' . __METHOD__ . ' validation error');
$error_message = 'メール送信エラー';
} catch (EmailSendingFailedException $e) {
Util_Toolkit::log_error('send mail error: ' . __METHOD__ . ' sending error');
$error_message = 'メール送信エラー';
} catch (\Database_Exception $e) {
$is_transaction_rollback = true;
$error_message = \Site_Controller::get_error_message($e, true);
} catch (FuelException $e) {
$is_transaction_rollback = true;
$error_message = $e->getMessage();
}
if ($error_message) {
if ($is_transaction_rollback && DB::in_transaction()) {
DB::rollback_transaction();
}
Session::set_flash('error', $error_message);
}
$this->action_resend_password();
}
开发者ID:uzura8,项目名称:flockbird,代码行数:59,代码来源:recover.php
示例19: index
public function index()
{
$service = config::item('default_captcha', 'security');
$settings = config::item('default_captcha_settings', 'security');
// Load library
$captcha = loader::library('captcha', $settings, null);
if (uri::segment(3) == 'reload') {
$captcha->create();
}
echo $captcha->render();
exit;
}
开发者ID:soremi,项目名称:tutornavi,代码行数:12,代码来源:captcha.php
示例20: delete
public function delete()
{
// Get URI vars
$typeID = (int) uri::segment(6);
$fieldID = (int) uri::segment(7);
// Get user type
if (!$typeID || !($type = $this->users_types_model->getType($typeID))) {
view::setError(__('no_type', 'users_types'));
router::redirect('cp/userstypes');
}
// Delete profile question
$this->deleteField('users', 'users_data_' . $type['keyword'], $typeID, $fieldID);
}
开发者ID:soremi,项目名称:tutornavi,代码行数:13,代码来源:users.php
注:本文中的uri类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论