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


PHP URI::segment方法代码示例

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


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

示例1: check

 /**
  * When visiting any page on the site, check if the user is already logged in,
  * or they are visiting a page that is allowed when logged out. Otherwise,
  * redirect to the login page. If visiting the login page, check the browser
  * supports cookies.
  */
 public function check()
 {
     $uri = new URI();
     // Skip check when accessing the data services, as it is redundant but would slow the services down.
     // Also no need to login when running the scheduled tasks.
     if ($uri->segment(1) == 'services' || $uri->segment(1) == 'scheduled_tasks') {
         return;
     }
     // check for setup request
     //
     if ($uri->segment(1) == 'setup_check') {
         // get kohana paths
         //
         $ipaths = Kohana::include_paths();
         // check if indicia_setup module folder exists
         //
         clearstatcache();
         foreach ($ipaths as $path) {
             if (preg_match("/indicia_setup/", $path) && file_exists($path)) {
                 return;
             }
         }
     }
     // Always logged in
     $auth = new Auth();
     if (!$auth->logged_in() and !$auth->auto_login() and $uri->segment(1) != 'login' and $uri->segment(1) != 'logout' and $uri->segment(1) != 'new_password' and $uri->segment(1) != 'forgotten_password') {
         $_SESSION['requested_page'] = $uri->string();
         url::redirect('login');
     } else {
         if ($auth->logged_in() and is_null($_SESSION['auth_user']->password) and $uri->segment(1) != 'new_password' and $uri->segment(1) != 'logout' and $uri->segment(1) != 'setup_check') {
             $_SESSION['requested_page'] = $uri->string();
             url::redirect('new_password');
         }
     }
 }
开发者ID:BirenRathod,项目名称:indicia-code,代码行数:41,代码来源:login.php

示例2: get_requestDetailinfo

 public function get_requestDetailinfo()
 {
     $data['claimID'] = $claimID = URI::segment(5);
     $data['app'] = $claimApp = Claims_App::appInfo($claimID);
     $data['detailList'] = Claims_App::listDetailsHistory($claimID);
     return View::make('claims.request.inforequestdetails', $data);
 }
开发者ID:farhan4648gul,项目名称:developer-side,代码行数:7,代码来源:request.php

示例3: get_list

 function get_list($gid)
 {
     $data = array('action' => 'list', 'name' => $this->name, 'role' => User::instance()->get_role());
     Event::run('steamcore.aclcheck', $data);
     // which model are we using? one passed through or the default?
     $model = steamcore::get_controls_model($this->gallery);
     $controller = URI::segment(1);
     $tdata = array();
     $page = Input::instance()->get('page', 0);
     $num = 18;
     $offset = 0;
     $limit = 18;
     if ($page) {
         $offset = $num * $page - $num;
     }
     $where = array();
     if (isset($gid) and is_numeric($gid)) {
         $where = array('galleries_id' => $gid);
     }
     // query the model
     $data['query'] = $model->where($where)->limit($limit, $offset)->find_all();
     $data['controller'] = $controller;
     $total = $model->count_last_query();
     $data['pagination'] = '';
     if ($total > $num) {
         $data['pagination'] = Pagination::factory(array('style' => 'digg', 'items_per_page' => $num, 'query_string' => 'page', 'total_items' => $total));
     }
     // merge any passed data and the data returned from the model
     $tdata = array_merge($tdata, $data);
     // return the result
     return $tdata;
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:32,代码来源:Gallery.php

示例4: __construct

 public function __construct()
 {
     $this->filter('before', array('admin'));
     if (is_numeric(URI::Segment(4))) {
         $this->studio_id = URI::Segment(4);
         $this->layout_id = URI::segment(4);
     }
 }
开发者ID:shainmcalindon,项目名称:boothsgardenstudios,代码行数:8,代码来源:pricing.php

示例5: __construct

 public function __construct()
 {
     parent::__construct();
     $this->filter('before', 'auth');
     $this->filter('before', 'perm', array('solder_modpacks'));
     $this->filter('before', 'perm', array('solder_create'))->only(array('create'));
     $this->filter('before', 'modpack', array(URI::segment(3)))->only(array('view', 'create', 'delete', 'edit'));
     $this->filter('before', 'build', array(URI::segment(3)))->only(array('build'));
 }
开发者ID:pustimeunutra,项目名称:TechnicSolder,代码行数:9,代码来源:modpack.php

示例6: get_datacontent

 public function get_datacontent()
 {
     $groupID = URI::segment(5);
     Group::getDataModel($groupID);
     $data['list'] = Group::getDataList();
     $data['groupID'] = $groupID;
     $data['header'] = Group::getDataHeader();
     return View::make('admin::data.data', $data);
 }
开发者ID:farhan4648gul,项目名称:developer-side,代码行数:9,代码来源:data.php

示例7: breadcrumb

 /**
  * breadcrumb function
  * Create breadcrumb
  * @return string
  * @author joharijumali
  **/
 public static function breadcrumb()
 {
     $Menu = Admin_Menu::menuGenerator();
     $butternbread = array();
     foreach ($Menu as $floor => $packet) {
         foreach ($packet->page->action as $key => $action) {
             if ($packet->packet == Str::lower(URI::segment(1)) && $packet->controller->name == Str::lower(URI::segment(2)) && $action->name == Str::lower(URI::segment(3)) || URI::segment(3) == NULL && $action->name == $packet->controller->name && Str::lower(URI::segment(2)) == $packet->controller->name) {
                 $butternbread[Str::upper($packet->controller->alias)] = '#';
                 array_push($butternbread, Str::title($action->alias));
             }
         }
     }
     return Breadcrumb::create($butternbread);
 }
开发者ID:jigeeshup,项目名称:bootstrap-base-application,代码行数:20,代码来源:Navigator.php

示例8: get_list

 /**
  * return list
  *
  * @param object $lc 
  * @return array
  * @author Andy Bennett
  */
 public function get_list()
 {
     $data = array('action' => 'list', 'name' => $this->name, 'role' => User::instance()->get_role());
     Event::run('steamcore.aclcheck', $data);
     $tdata = array();
     $limit = 10;
     $page_num = $this->input->get('page', 1);
     $offset = ($page_num - 1) * $limit;
     $model = ORM::factory($this->setup['model'], null);
     $data['query'] = $model->where('role', URI::segment(1))->find_all($limit, $offset);
     $data['controller'] = Kohana::instance()->uri->segment(1);
     $data['pagination'] = Pagination::factory(array('style' => 'digg', 'items_per_page' => $limit, 'query_string' => 'page', 'total_items' => $model->count_last_query()));
     // merge any passed data and the data returned from the model
     $tdata = array_merge($tdata, $data);
     // return the result
     return $tdata;
 }
开发者ID:AsteriaGamer,项目名称:steamdriven-kohana,代码行数:24,代码来源:Authadmin.php

示例9: get_view

 public function get_view()
 {
     // Convert a GET request layout ID to url format
     if (Input::get('layout_id', null) !== null) {
         return Redirect::to_action('quotations/view', array('id' => Input::get('layout_id')));
     }
     // Make sure we have the layout ID
     $layout_id = URI::segment(3);
     if (is_null($layout_id) && \Laravel\Session::get('quote_layout_id', null) !== null) {
         return Redirect::to_action('quotations/view', array('id' => \Laravel\Session::get('quote_layout_id')));
     }
     if (is_null($layout_id)) {
         return Redirect::to_action('quotations');
     }
     // Load page
     $data['layout'] = Layout::find($layout_id);
     if ($data['layout'] === null) {
         return Redirect::to_action('quotations')->with('error', 'Unable to find the studio layout you have selected. Please select from the list below');
     }
     $data['formatted_cost'] = $data['layout'] == '' ? '' : '£' . number_format($data['layout']->cost, 2);
     $data['layouts'] = Layout::where('studio_id', '=', $data['layout']->studio_id)->order_by('size_x', 'asc')->order_by('size_y', 'asc')->get();
     $data['size'] = $data['layout']->size_x . 'x' . $data['layout']->size_y;
     $data['postcode'] = Session::get('postcode') ? Session::get('postcode') : \Laravel\Session::get('quote_postcode');
     $data['layout_id'] = $layout_id;
     $data['error'] = Session::get('error') ? Session::get('error') : '';
     $data['success'] = Session::get('success') ? Session::get('success') : '';
     $data['establishedQuote'] = self::establishedQuote();
     $data['quotation_current_price'] = '£' . number_format(Quotation::calcSessionQuotationCurrentValue(), 2);
     // Its possible the selected layout has been changed
     // If this is the case we want to flush session data as we dont want any of the previous quotation customise data presisting and potentially causing errors
     if (\Laravel\Session::get('quote_layout_id', null) !== null) {
         if ((int) \Laravel\Session::get('quote_layout_id') !== $data['layout']->id) {
             self::resetQuotationSession();
             return Redirect::back();
         }
     }
     return View::make('quotations.view')->with('data', $data);
 }
开发者ID:shainmcalindon,项目名称:boothsgardenstudios,代码行数:38,代码来源:quotations.php

示例10: next

 /**
  * sidebar function
  * Create sidebar
  * @return string
  * @author joharijumali
  **/
 public static function next()
 {
     $path = URI::segment(2) . '/' . URI::segment(3) . '/' . URI::segment(4);
     $page = Console_Page::where('modul', '=', URI::segment(2))->where('controller', '=', URI::segment(3))->where('action', '=', URI::segment(4))->first();
     if ($page) {
         try {
             $currentStep = Console_Step::where('page', '=', $page->modulpageid)->first();
             if (!empty($currentStep)) {
                 if ($currentStep->parentid == 0) {
                     return $currentStep->stepid;
                 } else {
                     $nextStep = Console_Step::where('flowid', '=', $currentStep->flowid)->where('parentid', '=', $currentStep->stepid)->first();
                     if ($nextStep) {
                         return $nextStep->stepid;
                     }
                 }
             }
         } catch (Exception $e) {
             Log::write('Flow', 'Status Retrieving Failed: ' . $e->getMessage());
         }
     } else {
         Log::write('Flow', 'Page Not Exist: ');
     }
 }
开发者ID:farhan4648gul,项目名称:developer-side,代码行数:30,代码来源:Flow.php

示例11: action_display

 public function action_display()
 {
     $user = $this->is_logged();
     if ($user === false) {
         return Redirect::to_action('login');
     } else {
         $id_playlist = URI::segment(3);
         $adminPlaylist = new adminPlaylist($user->get_id_user_lif(), $id_playlist);
         if ($adminPlaylist->check_exists() == 1) {
             $song_array = array();
             $all = SongPlaylist::all_from_ids($id_playlist);
             foreach ($all as $value) {
                 $song = new Song($value->id_song);
                 $song->load();
                 array_push($song_array, $song);
             }
             $playlist = new Playlist($id_playlist);
             $playlist->load();
             return View::make('playlist.display')->with('playlist', $playlist)->with('songs', $song_array);
         } else {
             return Redirect::to_action('home@index');
         }
     }
 }
开发者ID:laiello,项目名称:atm-music,代码行数:24,代码来源:playlist.php

示例12: function

 }
 /**
  * Activate a new user and log them in
  * @todo Finish email authentication mechanism
  */
 if (FALSE && Config::get('xysti.routes.auth.activate')) {
     Route::get('activate/(:any)/(:any)', function () {
         Xysti::helper('dbug');
         $auth_driver = Config::get('xysti.auth', 'default');
         // Default auth
         if ($auth_driver == 'default') {
             Xysti::error(500, 'Default auth currently not configured for activation.');
             // Sentry auth
         } elseif ($auth_driver == 'sentry') {
             try {
                 $activate_user = Sentry::activate_user(URI::segment(2), URI::segment(3), FALSE);
             } catch (Sentry\SentryException $e) {
                 // issue activating the user
                 // store/set and display caught exceptions such as a suspended user with limit attempts feature.
                 $errors = $e->getMessage();
             }
         } else {
             return Xysti::error(500, 'Unknown authentication driver.');
         }
         if ($activate_user) {
             //Sentry::force_login(URI::segment(2));
             return Redirect::to(Xysti::page('login', 'post_login'));
         } else {
             return Xysti::make(500, 'User activation failed.');
         }
     });
开发者ID:SerdarSanri,项目名称:Xysti,代码行数:31,代码来源:routes.php

示例13: testSegmentMethodReturnsAURISegment

 /**
  * Test the URI::segment method.
  *
  * @group laravel
  */
 public function testSegmentMethodReturnsAURISegment()
 {
     $this->setRequestUri('/user/profile');
     $this->assertEquals('user', URI::segment(1));
     $this->assertEquals('profile', URI::segment(2));
 }
开发者ID:gilyaev,项目名称:framework-bench,代码行数:11,代码来源:uri.test.php

示例14: function

| You can even respond to more than one URI:
|
|		Route::post(array('hello', 'world'), function()
|		{
|			return 'Hello World!';
|		});
|
| It's easy to allow URI wildcards using (:num) or (:any):
|
|		Route::put('hello/(:any)', function($name)
|		{
|			return "Welcome, $name.";
|		});
|
*/
Log::info(sprintf("%s %s %s Seg[%d]: %s %s %s", Request::method(), URI::full(), Request::ip(), Router::$segments, URI::segment(1, '-'), URI::segment(2, '-'), URI::segment(3, '-')));
// start page
Route::get('/', 'sapoc@index');
// login/logout
Route::get('login', 'sapoc@login');
Route::post('login', 'sapoc@auth');
Route::get('logout', function () {
    Auth::logout();
    return Redirect::to('/');
});
// register
Route::get('verify', 'sapoc@verify');
Route::post('verify', 'sapoc@send_verification');
//Route::get('register', 'user@register');
Route::get('register', 'sapoc@register');
Route::post('register', 'sapoc@create_user');
开发者ID:rooslunn,项目名称:sapoc,代码行数:31,代码来源:routes.php

示例15: menuGenerator

 public static function menuGenerator()
 {
     $Menus = Admin_Menu::order_by('arrangement', 'asc')->get();
     $acces = Admin_UserAcl::aclRegistered();
     $selected = new stdClass();
     $page = new stdClass();
     $dev = array();
     $sub = array();
     $logged_user = Auth::user();
     foreach ($Menus as $id => $menu) {
         $content = new stdClass();
         $controller = new stdClass();
         $action = new stdClass();
         $pieces = explode("/", $menu->controller);
         if ($menu->action == NULL || $menu->header == 1 && $menu->footer == 1) {
             $content->footer = $menu->footer;
             $content->header = $menu->header;
             $content->auth = $menu->auth;
             $content->admin = $menu->admin;
             $content->packet = $pieces[0];
             if ($menu->action == NULL && ($menu->header == 1 || $menu->footer == 1)) {
                 $controller->name = $pieces[1];
                 $controller->alias = $menu->controlleralias;
             } else {
                 $controller->name = $menu->action;
                 $controller->alias = $menu->actionalias;
             }
             $content->controller = $controller;
             if ($content->controller->name == URI::segment(2)) {
                 $content->status = "active";
             } else {
                 $content->status = "";
             }
         } elseif ($menu->action != NULL && ($menu->header != 0 || $menu->footer != 0)) {
             $action->name = $menu->action;
             $action->alias = $menu->actionalias;
             $action->footer = $menu->footer;
             $action->header = $menu->header;
             $action->auth = $menu->auth;
             if ($action->name == URI::segment(3) || URI::segment(3) == NULL && $action->name == $pieces[1] && URI::segment(2) == $pieces[1]) {
                 $action->status = "active";
             } else {
                 $action->status = "";
             }
             //check acl access
             if (Auth::check()) {
                 if (isset($acces[$logged_user->role])) {
                     if (isset($acces[$logged_user->role][$menu->controller])) {
                         if (isset($acces[$logged_user->role][$menu->controller][$menu->action])) {
                             $sub[$pieces[1]][] = $action;
                         }
                     }
                 }
             } else {
                 $sub[$pieces[1]][] = $action;
             }
         }
         $cont = (array) $content;
         if (!empty($cont)) {
             $dev[$id] = $content;
         }
     }
     $final = array();
     foreach ($dev as $key => $value) {
         $action = new stdClass();
         $page = new stdClass();
         $ctrl = $value->controller->name;
         if (!empty($sub[$ctrl])) {
             $action->action = $sub[$ctrl];
         }
         $value->page = $action;
         // check acl access
         if (Auth::check()) {
             $pages = (array) $value->page;
             if (isset($acces[$logged_user->role])) {
                 if (isset($acces[$logged_user->role][$value->packet . '/' . $ctrl])) {
                     if ((!empty($pages) || $ctrl == 'dashboard') && ($value->admin == 1 ? $value->admin == Auth::user()->role : TRUE)) {
                         $final[$key] = $value;
                     }
                 }
             }
         } else {
             $final[$key] = $value;
         }
     }
     return $final;
 }
开发者ID:jigeeshup,项目名称:bootstrap-base-application,代码行数:87,代码来源:Menu.php


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