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


PHP Uri::segment方法代码示例

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


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

示例1: render_menu

 protected static function render_menu($menus)
 {
     $selected = \Uri::segment(1);
     $out = '';
     foreach ($menus as $k => $v) {
         is_int($k) and $k = $v;
         if (substr_compare($k, 'divider', 0, 7) == 0) {
             $out .= static::$template['menu_divider'];
             continue;
         }
         isset($v['label']) or $v['label'] = \Lang::get($k);
         isset($v['link']) or $v['link'] = '#';
         isset($v['level']) or $v['level'] = 0;
         $user = \Session::get('user_info');
         if ($user['level'] < $v['level']) {
             continue;
         }
         if (isset($v['submenu']) and count($v['submenu']) > 0) {
             $active = array_key_exists($selected, $v['submenu']) ? ' active' : '';
             $out .= str_replace(array('{item_id}', '{active}', '{label}', '{submenu}'), array($k, $active, $v['label'], static::render_menu($v['submenu'])), static::$template['menu_dropdown']);
         } else {
             $active = $selected == $k ? ' class="active"' : '';
             $out .= str_replace(array('{item_id}', '{active}', '{link}', '{label}'), array($k, $active, \Uri::base() . $v['link'], $v['label']), static::$template['menu_item']);
         }
     }
     return $out;
 }
开发者ID:ratiw,项目名称:petro,代码行数:27,代码来源:menu.php

示例2: before

 public function before()
 {
     parent::before();
     $this->app = \Uri::segment(1);
     // guess app_name, if it is not provided
     if (is_null($this->app_name)) {
         $this->app_name = \Inflector::classify($this->app);
     }
     // guess model name from URI segment, if it is not provided
     if (is_null($this->model)) {
         $this->model = 'Model_' . $this->app_name;
     }
     // set app title
     $this->template->title = static::$title;
     // render menus
     $this->template->set('menu', Petro_Menu::render(static::$menu), false);
     // use uri segment to find ref_type from defined menu for later use
     $menu = Petro_Menu::find($this->app, static::$menu);
     // if page_title is not set, default to menu label
     if (!isset($this->template->page_title)) {
         $this->template->page_title = empty($menu['label']) ? \Inflector::pluralize($this->app_name) : $menu['label'];
     }
     $this->sidebars = new Petro_Sidebar();
     is_null($this->must_login) and $this->must_login = \Config::get('petro.auth.enable', true);
     // if require login and not in the ignore login list, then check for login
     if ($this->must_login and !in_array(\Uri::string(), static::$ignore_login)) {
         if (!\Auth::instance()->check()) {
             $this->login_then_redirect(\Uri::string());
         }
     }
 }
开发者ID:ratiw,项目名称:petro,代码行数:31,代码来源:app.php

示例3: getNotOpenidAllowed

 /**
  * 允许没有openid下的访问列表
  *
  * @return array
  */
 protected function getNotOpenidAllowed()
 {
     $allowed = [['module' => 'order', 'controller' => 'home', 'actions' => ['save_wxpay_qrcode']]];
     foreach ($allowed as $item) {
         if ($item['module'] == \Uri::segment(1) && in_array(\Uri::segment(2), $item['actions'])) {
             return true;
         } else {
             if ($item['module'] == \Uri::segment(1) && $item['controller'] == \Uri::segment(2) && in_array(\Uri::segment(3), $item['actions'])) {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:wxl2012,项目名称:wx,代码行数:19,代码来源:wxcontroller.php

示例4: getNotLoginAllowed

 /**
  * 获取未登录时的可访问列表
  * @return bool
  */
 protected function getNotLoginAllowed()
 {
     $allowed = [['module' => 'ucenter', 'controller' => 'home', 'actions' => ['register', 'login', 'forget_pwd']]];
     foreach ($allowed as $item) {
         if ($item['module'] == \Uri::segment(1) && in_array(\Uri::segment(2), $item['actions'])) {
             return true;
         } else {
             if ($item['module'] == \Uri::segment(1) && $item['controller'] == \Uri::segment(2) && in_array(\Uri::segment(3), $item['actions'])) {
                 return true;
             }
         }
     }
     return false;
 }
开发者ID:wxl2012,项目名称:wx,代码行数:18,代码来源:basecontroller.php

示例5: _columns

 /**
  * Define columns
  */
 protected static function _columns($page = 'index')
 {
     $columns_for = array('view' => array('id' => array('required' => true), 'mk_no' => array('required' => true), 'mk_date' => array('required' => true, 'grid' => array('process' => function ($data) {
         return Petro::to_app_date($data->mk_date);
     })), 'client_id' => array('required' => true), 'client_po', 'delivery_date' => array('grid' => array('process' => function ($data) {
         return Petro::to_app_date($data['delivery_date']);
     })), 'deliver_to', 'product_type' => array('grid' => array('process' => function ($data) {
         return Petro_Lookup::get('product.type', $data->product_type);
     })), 'belt_type' => array('required' => true, 'grid' => array('process' => function ($data) {
         return Petro_Lookup::get('belt.type', $data['belt_type']);
     })), 'belt_color' => array('required' => true, 'grid' => array('process' => function ($data) {
         return Petro_Lookup::get('belt.color', $data['belt_color']);
     })), 'belt_width' => array('required' => true, 'grid' => array('process' => function ($data) {
         return $data->belt_width . ' ' . Petro_Lookup::get('belt.w.unit', $data->belt_width_unit);
     })), 'belt_width_unit' => array('required' => true, 'grid' => array('process' => function ($data) {
         return Petro_Lookup::get('belt.w.unit', $data['belt_width_unit']);
     })), 'belt_ply' => array('required' => true), 'belt_ep' => array('required' => true, 'grid' => array('process' => function ($data) {
         return Petro_Lookup::get('belt.ep', $data['belt_ep']);
     })), 'belt_grade' => array('required' => true, 'grid' => array('process' => function ($data) {
         return Petro_Lookup::get('belt.grade', $data['belt_grade']);
     })), 'belt_top_grade', 'belt_bot_grade', 'belt_thick' => array('required' => true), 'belt_top_thick' => array('required' => true), 'belt_bot_thick' => array('required' => true), 'belt_length' => array('required' => true), 'belt_length_unit' => array('required' => true), 'belt_end' => array('required' => true, 'grid' => array('process' => function ($data) {
         return Petro_Lookup::get('belt.end', $data['belt_end']);
     })), 'belt_qty' => array('required' => true), 'belt_price', 'belt_disc1' => array('label' => 'Discount1'), 'belt_disc2' => array('label' => 'Discount2'), 'belt_disc3' => array('label' => 'Discount3'), 'belt_price_net', 'belt_amount', 'remark', 'creator_id', 'creator_name', 'status'), 'index' => array('id' => array('visible' => false), 'mk_no' => array('label' => __('mk_no'), 'grid' => array('sortable' => true, 'process' => function ($data) {
         return '<a href="' . Uri::base() . Uri::segment(1) . '/view/' . $data->id . '">' . $data->mk_no . '</a>';
     })), 'mk_date' => array('label' => __('mk_date'), 'grid' => array('format' => 'date', 'sortable' => true)), 'client_id' => array('label' => __('client_id'), 'grid' => array('sortable' => true, 'process' => function ($data) {
         return Petro_Lookup::table('clients', 'id', 'code', $data->client_id);
     })), 'belt_info' => array('label' => __('belt_info'), 'grid' => array('process' => function ($data) {
         return BeltInfo::short($data);
     })), 'belt_qty' => array('label' => __('belt_qty'), 'grid' => array('align' => 'right', 'process' => function ($data) {
         return $data->belt_qty . '&nbsp;' . __('belt_piece');
     })), 'belt_price_net' => array('label' => __('belt_price_net'), 'grid' => array('align' => 'right', 'format' => 'number')), 'belt_amount' => array('label' => __('belt_amount'), 'grid' => array('align' => 'right', 'format' => 'number')), 'status' => array('label' => __('status'), 'grid' => array('process' => function ($data) {
         $t = '';
         switch ($data->status) {
             case 0:
                 $t = 'warning';
                 break;
             case 1:
                 $t = 'success';
                 break;
             case 2:
                 $t = '';
                 break;
             default:
                 $t = 'important';
         }
         return '<span class="label ' . $t . '">' . Petro_Lookup::get('prd.status', $data->status) . '</span>';
     })), '_action_' => Petro_Grid::default_actions()));
     return $columns_for[$page];
 }
开发者ID:ratiw,项目名称:petro-test,代码行数:52,代码来源:docmk2.php

示例6: _data

 private static function _data($sql = false)
 {
     if (!$sql || DB::$DB->cache == false) {
         return false;
     }
     // if this function has already been called return data from variable.
     if (count(self::$_data) > 0) {
         return self::$_data;
     }
     // the requested URI will become the cache sub-folder and
     // a MD5 hash of the SQL will be the filename
     $data['sone'] = !Uri::segment(1) ? 'default' : Uri::segment(1);
     $data['stwo'] = !Uri::segment(2) ? 'index' : Uri::segment(2);
     $data['path'] = DB::$DB->cachedir . $data['sone'] . '+' . $data['stwo'] . '/';
     $data['file'] = md5($sql);
     return $data;
 }
开发者ID:hectormenendez,项目名称:h23,代码行数:17,代码来源:cache.php

示例7: get_lang

 /**
  * Returns currently active language.
  *
  * @return   string    currently active language
  */
 public static function get_lang()
 {
     $language = \Config::get('language');
     if ($language == self::$default_language) {
         $lang_segment = \Uri::segment(1);
         if (!empty($lang_segment) and $lang_segment != false) {
             $languages = \Config::get('languages');
             if (!empty($languages) and array_search($lang_segment, $languages) !== false) {
                 $language = $lang_segment;
             }
         }
     }
     if (empty($language)) {
         $language = self::$fallback[0];
     }
     return $language;
 }
开发者ID:davispuh,项目名称:fuelphp-lang,代码行数:22,代码来源:lang.php

示例8: __construct

 /**
  * Constructor
  *
  * @param Exception Exception to be parsed for Amon
  *
  * @return null
  */
 public function __construct(\Exception $exception)
 {
     $this->exception = $exception;
     $trace = $this->exception->getTrace();
     foreach ($trace as $t) {
         if (!isset($t['file'])) {
             continue;
         }
         $this->backtrace[] = "{$t['file']}:{$t['line']}:in `{$t['function']}\\'";
     }
     // exception data
     $message = $this->exception->getMessage();
     // spoof 404 error
     $error_class = get_class($this->exception);
     if ($error_class == 'Http404Error') {
         $error_class = 'ActionController::UnknownAction';
     }
     $data['exception_class'] = $error_class;
     $data['message'] = $message;
     $data['backtrace'] = $this->backtrace;
     if (isset($_SERVER['HTTP_HOST'])) {
         // request data
         $session = isset($_SESSION) ? $_SESSION : array();
         // sanitize headers
         $headers = $this->getallheaders();
         if (isset($headers['Cookie'])) {
             $sessionKey = preg_quote(ini_get('session.name'), '/');
             $headers['Cookie'] = preg_replace("/{$sessionKey}=\\S+/", "{$sessionKey}=[FILTERED]", $headers['Cookie']);
         }
         $server = $_SERVER;
         $keys = array('HTTPS', 'HTTP_HOST', 'REQUEST_URI', 'REQUEST_METHOD', 'REMOTE_ADDR');
         $this->fill_keys($server, $keys);
         $protocol = $server['HTTPS'] && $server['HTTPS'] != 'off' ? 'https://' : 'http://';
         $url = $server['HTTP_HOST'] ? "{$protocol}{$server['HTTP_HOST']}{$server['REQUEST_URI']}" : "";
         $data['data']['request'] = array('url' => $url, 'request_method' => strtolower($server['REQUEST_METHOD']), 'session' => $session);
         $data['request']['controller'] = \Uri::segment(1);
         $data['request']['action'] = \Uri::segment(2);
         $params = array_merge($_GET, $_POST);
         if (!empty($params)) {
             $data['request']['parameters'] = $params;
         }
     }
     $this->data = (array) $data;
 }
开发者ID:maca134,项目名称:fuel-amon,代码行数:51,代码来源:data.php

示例9: Uri

 function __toString()
 {
     $modval = "";
     $uri = new Uri();
     $seg = $uri->segment('mod');
     if ($this->ModelDefault != NULL and $seg == '') {
         $seg = $this->ModelDefault;
     }
     if ($seg != '') {
         $lload = "fpp_{$seg}_Model";
         $libload = new $lload();
         $libload->set_property('edit', 1);
         $libload->set_property('delete', 1);
         $libload->set_property('add', 1);
         $modval = $libload->autoblock();
     }
     $str = '';
     if (@$_GET['AJAX_NO_LOAD'] == 'TRUE') {
         return $modval;
     }
     foreach ($this->block as $HeadModule => $Module) {
         $str .= "<div id='admingen_{$HeadModule}' class='HeadModule HM_{$HeadModule}'>\n      <div class='HeadTextModule'>{$HeadModule}</div></div>\n      \n<div class='BodyModule BM_{$HeadModule}'>";
         foreach ($Module as $valuemod) {
             $module_selected = null;
             $style = null;
             if ($valuemod == $seg) {
                 $module_selected = "MNSelected";
                 $style = "<style>.BM_{$HeadModule}{ display:block; }</style>";
             }
             //         echo Kohana::debug($this->FastText[$valuemod]);
             $modulename = Router::$controller . '/' . Router::$method . '/mod/' . $valuemod . '/action/pagina/1';
             $textvaluemod = @$this->FastText[$valuemod] == "" ? $valuemod : $this->FastText[$valuemod];
             $modulename = html::anchor($modulename, $textvaluemod, array('class' => 'kfppadmin_list'));
             $str .= "{$style}\n<div class='ModuleName MN_{$valuemod} {$module_selected}'>\n                    {$modulename}\n                </div>";
         }
         $str .= "</div>";
     }
     $indexadmin = "http://" . $_SERVER['SERVER_NAME'] . '/admin';
     $str .= "<div class='FooterModule'>&nbsp;&nbsp;</div>";
     return "<table width='100%' ><tr><td width='20%' id='tdizq'  valign='top' >\n    <div class='contentmenu'>\n    {$str}\n    </div>\n    </td><td id='tdder' valign='top'>\n      <div class='content-box'>\n      <div class='content-box-header'>\n<ul class='content-box-tabs'>\n<li><a href='http://knittingperuboutique.com/web/admin' class='default-tab'>Home</a></li>\n</ul>\n      </div>\n      <div class='content-box-content'>\n        <div id='main-content' >\n          {$modval}\n        </div>\n      </div>\n      </div>\n    </td></tr></table>";
 }
开发者ID:brojasmeneses,项目名称:floreriarosabel,代码行数:41,代码来源:KfppAdmin.php

示例10: action_view

 /**
  * Display detailed page of Article
  *
  * @param void
  * @access public
  * @author Nguyen Van Hiep
  *
  * @version 1.0
  * @since 1.0
  */
 public function action_view()
 {
     $art_check = Model_Article::get_art_from_slug(Uri::segment(2));
     if (!$art_check) {
         Response::redirect('common/error');
     }
     $uri = explode('-', Uri::string());
     $id = array_pop($uri);
     $art = Model_Article::find($id);
     $cat = Model_Categories::get_cat_from_slug(Uri::segment(1));
     $related_arts = Model_Article::articles_of_cat_limit($cat->id, $this->lang, $id);
     if (!$art) {
         Session::set_flash('error', __('message.art_not_exist'));
         Response::redirect('common/404');
     }
     $art->views = $art->views + 1;
     $art->save();
     if ($cat->display_type == DS_SANPHAM) {
         $this->template = \View::forge('customer/template_sanpham_detail');
         $view = View::forge('customer/article/detail_sp_slide');
     } elseif ($cat->display_type == DS_MONAN) {
         $this->template = \View::forge('customer/template_monan');
         $view = View::forge('customer/article/detail_monan_slide');
     } elseif ($cat->display_type == QUY_TRINH_SX) {
         $view = View::forge('customer/article/detail_quytrinhsx');
     } else {
         $view = View::forge('customer/article/detail');
     }
     $view->art = $art;
     $view->related_arts = $related_arts;
     $view->cat = $cat;
     if (!empty($cat->parent_id)) {
         $view->p_cat = Model_Categories::find($cat->parent_id);
     }
     // data to display menu
     $this->template->cats = Model_Categories::get_cats_home($this->lang);
     $this->template->pepper_arts = Model_Article::pepper_artilces($this->lang);
     $this->template->title = Security::strip_tags($art->title);
     $this->template->content = $view;
 }
开发者ID:aminh047,项目名称:pepperyou,代码行数:50,代码来源:article.php

示例11: action_index

 public function action_index()
 {
     $this->template->title = 'UOS求人システム';
     $data = array();
     $group = new \Model_Mgroups();
     $data['search_group'] = $group->get_type(1);
     $ujob_obj = new \Model_Ujob();
     $data['search_partner'] = $ujob_obj->get_list_partner();
     $where = Input::get('partner_search') != '' ? 'partner_code = "' . Input::get('partner_search') . '"' : '';
     $data['search_ss_list'] = $ujob_obj->get_list_ss($where);
     $data['search_media'] = $ujob_obj->get_list_media();
     $data['start_date'] = \Fuel\Core\Input::get('start_date');
     $data['end_date'] = \Fuel\Core\Input::get('end_date');
     if (Input::get('export', false)) {
         $res = $ujob_obj->get_search_data(true);
         $this->export($res['res']);
     } else {
         $res = $ujob_obj->get_search_data(false);
     }
     $data['res'] = $res;
     \Session::set('url_job_redirect', \Uri::base() . 'job/jobs/index/' . (\Uri::segment(4) ? \Uri::segment(4) : 1) . '?' . http_build_query(\Input::get()));
     $this->template->content = \Fuel\Core\View::forge('jobs/index', $data);
 }
开发者ID:huylv-hust,项目名称:uosbo,代码行数:23,代码来源:jobs.php

示例12: isset

<?php

echo $docinfo;
echo isset($flow) ? $flow : '';
echo $comments;
?>
<fieldset class="buttons">
	<?php 
echo Html::anchor(Uri::segment(1), 'Back', array('class' => 'button'));
?>
</fieldset>
开发者ID:ratiw,项目名称:petro-test,代码行数:11,代码来源:view.php

示例13: GlobIterator

    ?>
">
                                <?php 
    echo Html::anchor('admin/category', 'Categories');
    ?>
                            </li>
                            <li class="<?php 
    echo Uri::segment(2) == 'article' ? 'active' : '';
    ?>
">
                                <?php 
    echo Html::anchor('admin/article', 'Articles');
    ?>
                            </li>
                              <li class="<?php 
    echo Uri::segment(2) == 'date' ? 'active' : '';
    ?>
">
                                <?php 
    echo Html::anchor('admin/date', 'Dates');
    ?>
                            </li>

                            <?php 
    /*
     $files = new GlobIterator(APPPATH . 'classes/controller/admin/*.php');
     foreach ($files as $file) {
     $section_segment = $file->getBasename('.php');
     $section_title = Inflector::humanize($section_segment);
     ?>
     <li class="<?php echo Uri::segment(2) == $section_segment ? 'active' : '' ?>">
开发者ID:sajans,项目名称:cms,代码行数:31,代码来源:template.php

示例14: Config

 //Add App to Container
 $container['app'] = $app;
 //Initialize Config and add to Container
 $container['config'] = new Config();
 $timer->setTime('Config');
 //Set Error Handler
 set_error_handler(array($app, 'error'), E_ALL | E_STRICT);
 //Load all Configuration files in Config folder
 foreach (glob(__DIR__ . '/config/*.php') as $key => $val) {
     require_once $val;
 }
 $timer->setTime('Config Folder');
 $uri = new Uri();
 $timer->setTime('URI');
 if (!file_exists(__DIR__ . '/config/config.php')) {
     if ($uri->segment(0) != "Installer") {
         header("Location: Installer");
         exit;
     } elseif (file_exists(__DIR__ . '/install.config.php')) {
         require_once __DIR__ . '/install.config.php';
         $timer->setTime('installConfig');
     }
 }
 $timer->setTime('configFile Checked');
 if ($uri->segment(0) == 'Installer') {
     define('INSTALL', true);
 }
 date_default_timezone_set('UTC');
 $timer->setTime('setTimeZone');
 if (!file_exists(__DIR__ . "/config/routes.php") && !defined('INSTALL')) {
     $timer->setTime('Routes doesnt exist');
开发者ID:uaktags,项目名称:lyraEngine,代码行数:31,代码来源:index.php

示例15: array

					<div class="control-group">
						<label class="control-label" for="password">Password</label>
						<div class="controls">
							<?php 
echo Form::password('password', Input::post('password', ''));
?>
						</div>
					</div>
					<div class="control-group">
						<label class="control-label" for="password2">Confirm Password</label>
						<div class="controls">
							<?php 
echo Form::password('password2', Input::post('password2', ''));
?>
						</div>
					</div>
					<div class="form-actions">
						<button type="submit" class="btn btn-primary">Submit</button>
						<?php 
echo Html::anchor(\Str::lower(\Uri::segment(1)), 'Cancel', array('class' => 'btn'));
?>
					</div>
				<?php 
echo Form::close();
?>
			</div>
		</div>
	</div>
	

开发者ID:ratiw,项目名称:petro,代码行数:28,代码来源:signup.php


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