本文整理汇总了PHP中request::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP request::instance方法的具体用法?PHP request::instance怎么用?PHP request::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类request
的用法示例。
在下文中一共展示了request::instance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: boot
static function boot()
{
$pathinfo = request::getPathInfo();
// 生成part
if (isset($pathinfo[1])) {
if ($p = strpos($pathinfo, '/', 2)) {
$part = substr($pathinfo, 0, $p);
} else {
$part = $pathinfo;
}
} else {
$part = '/';
}
if ($part == '/openapi') {
return kernel::single('base_rpc_service')->process($pathinfo);
} elseif ($part == '/app-doc') {
//cachemgr::init();
return kernel::single('base_misc_doc')->display($pathinfo);
}
// 确认是否安装流程. 如果是安装流程则开启debug. 如果不是则检查是否安装, 如果未安装则跳到安装流程
// 目前其他的url, 都应移到routes中进行
//
if ($part == '/setup') {
config::set('app.debug', true);
} else {
static::checkInstalled();
}
cacheobject::init();
static::registRouteMiddleware();
$response = route::dispatch(request::instance());
// 临时处理方式
kernel::single('base_session')->close();
$response->send();
exit;
}
示例2: _init_search_query_object
function _init_search_query_object()
{
$request = request::instance();
if ($search_query = trim($request->get_attribute('search_query'))) {
$this->query_object->add(search_text_normalizer::process($search_query));
}
}
示例3: array
function &get_dataset($params = array())
{
$request = request::instance();
if (!($class_id = $request->get_attribute('class_id'))) {
return new array_dataset();
}
$db_table =& db_table_factory::instance('sys_class');
$class_data = $db_table->get_row_by_id($class_id);
if (!$class_data) {
return new array_dataset();
}
$c =& site_object_factory::instance($class_data['class_name']);
$site_object_controller =& $c->get_controller();
$actions = $site_object_controller->get_actions_definitions();
$user_groups =& fetch_sub_branch('/root/user_groups', 'user_group', $counter);
$result = array();
foreach ($user_groups as $group_id => $group_data) {
foreach ($actions as $action => $action_params) {
if (!isset($action_params['can_have_access_template']) || !$action_params['can_have_access_template']) {
continue;
}
if (isset($action_params['action_name'])) {
$result[$group_id]['actions'][$action]['action_name'] = $action_params['action_name'];
} else {
$result[$group_id]['actions'][$action]['action_name'] = str_replace('_', ' ', strtoupper($action[0]) . substr($action, 1));
}
$result[$group_id]['group_name'] = $group_data['identifier'];
$result[$group_id]['actions'][$action]['read_selector_name'] = 'template[' . $action . '][' . $group_id . '][r]';
$result[$group_id]['actions'][$action]['write_selector_name'] = 'template[' . $action . '][' . $group_id . '][w]';
}
}
return new array_dataset($result);
}
示例4: render_attributes
function render_attributes()
{
if (!isset($this->attributes['path']) || !$this->attributes['path']) {
$action_path = $_SERVER['PHP_SELF'];
$request = request::instance();
if ($node_id = $request->get_attribute('node_id')) {
$action_path .= '?node_id=' . $node_id;
}
} else {
$action_path = $this->attributes['path'];
}
if (strpos($action_path, '?') === false) {
$action_path .= '?';
} else {
$action_path .= '&';
}
if (isset($this->attributes['action'])) {
$action_path .= 'action=' . $this->attributes['action'];
}
if (isset($this->attributes['reload_parent']) && $this->attributes['reload_parent']) {
$action_path .= '&reload_parent=1';
unset($this->attributes['reload_parent']);
}
if (!isset($this->attributes['onclick'])) {
$this->attributes['onclick'] = '';
}
$this->attributes['onclick'] .= "submit_form(this.form, '{$action_path}')";
unset($this->attributes['path']);
unset($this->attributes['action']);
parent::render_attributes();
}
示例5: array
function & get_dataset($params = array())
{
$request = request :: instance();
if(!$controller_id = $this->_get_controller_id())
return new array_dataset();
$db_table =& db_table_factory :: instance('sys_controller');
$controller_data = $db_table->get_row_by_id($controller_id);
if (!$controller_data)
return new array_dataset();
$site_object_controller =& site_object_controller :: create($controller_data['name']);
$actions = $site_object_controller->get_actions_definitions();
$result = array();
foreach($actions as $action => $action_params)
{
if (!isset($action_params['can_have_access_template']) || !$action_params['can_have_access_template'])
continue;
if(isset($action_params['action_name']))
$result[$action]['action_name'] = $action_params['action_name'];
else
$result[$action]['action_name'] = str_replace('_', ' ', strtoupper($action{0}) . substr($action, 1));
}
return new array_dataset($result);
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:31,代码来源:controller_template_actions_list_datasource.class.php
示例6: array
function &get_dataset(&$counter, $params = array())
{
$counter = 0;
$request = request::instance();
if (!($version = $request->get_attribute('version'))) {
return new empty_dataset();
}
if (!($node_id = $request->get_attribute('version_node_id'))) {
return new empty_dataset();
}
$version = (int) $version;
$node_id = (int) $node_id;
if (!($site_object = wrap_with_site_object(fetch_one_by_node_id($node_id)))) {
return new empty_dataset();
}
if (!is_subclass_of($site_object, 'content_object')) {
return new empty_dataset();
}
if (($version_data = $site_object->fetch_version($version)) === false) {
return new empty_dataset();
}
$result = array();
foreach ($version_data as $attrib => $value) {
$data['attribute'] = $attrib;
$data['value'] = $value;
$result[] = $data;
}
return new array_dataset($result);
}
示例7: save
function save()
{
$request =& request::instance();
$tab_id = session_history_manager::datermine_tab_id();
if (!($history = session::get('session_history'))) {
$history = array();
}
if (!isset($history[$tab_id])) {
$history[$tab_id] = array();
}
$uri =& $request->get_uri();
$uri->remove_query_item('rn');
if ($uri->get_query_item('popup')) {
return;
}
$object_data = fetch_requested_object();
if ($object_data['class_name'] == 'control_panel') {
return;
}
$history_item = array('title' => $object_data['title'], 'href' => $uri->to_string());
$first = end($history[$tab_id]);
if ($first) {
$latest_uri =& new uri($first['href']);
if ($uri->compare($latest_uri)) {
return;
}
}
if (count($history[$tab_id]) >= 10) {
$history[$tab_id] = array_reverse($history[$tab_id]);
array_pop($history[$tab_id]);
$history[$tab_id] = array_reverse($history[$tab_id]);
}
array_push($history[$tab_id], $history_item);
session::set('session_history', $history);
}
示例8: array
function &get_dataset($params = array())
{
$request = request::instance();
if (!($controller_id = $request->get_attribute('controller_id'))) {
return new array_dataset();
}
$db_table =& db_table_factory::instance('sys_controller');
$controller_data = $db_table->get_row_by_id($controller_id);
if (!$controller_data) {
return new array_dataset();
}
$site_object_controller =& site_object_controller::create($controller_data['name']);
$actions = $site_object_controller->get_actions_definitions();
$user_groups =& fetch_sub_branch('/root/user_groups', 'user_group', $counter);
$result = array();
foreach ($actions as $action => $action_params) {
if (isset($action_params['action_name'])) {
$result[$action]['action_name'] = $action_params['action_name'];
} else {
$result[$action]['action_name'] = str_replace('_', ' ', strtoupper($action[0]) . substr($action, 1));
}
$result[$action]['permissions_required'] = $action_params['permissions_required'];
foreach ($user_groups as $group_id => $group_data) {
$result[$action]['groups'][$group_id]['selector_name'] = 'policy[' . $group_id . '][' . $action . ']';
}
}
return new array_dataset($result);
}
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:28,代码来源:controller_group_action_access_datasource.class.php
示例9: instance
function determine_action($request = null)
{
if($request === null)
$request =& request :: instance();
if (!$action = $request->get_attribute('action'))
$action = $this->_default_action;
if (!$this->action_exists($action))
{
debug :: write_warning(
'action not found',
__FILE__ . ' : ' . __LINE__ . ' : ' . __FUNCTION__,
array(
'class' => get_class($this),
'action' => $action,
'default_action' => $this->_default_action
));
return false;
}
$this->_current_action = $action;
return $this->_current_action;
}
示例10: render_attributes
function render_attributes()
{
$this->_process_attributes();
if (!$this->path) {
$action_path = $_SERVER['PHP_SELF'];
$request = request::instance();
if ($node_id = $request->get_attribute('node_id')) {
$action_path .= '?node_id=' . $node_id;
}
} else {
$action_path = $this->path;
}
if (strpos($action_path, '?') === false) {
$action_path .= '?';
} else {
$action_path .= '&';
}
if ($this->action) {
$action_path .= 'action=' . $this->action;
}
if ((bool) $this->reload_parent) {
$action_path .= '&reload_parent=1';
}
$this->attributes['onclick'] = $this->onclick;
$this->attributes['onclick'] .= "submit_form(this.form, '{$action_path}')";
parent::render_attributes();
unset($this->attributes['onclick']);
}
示例11: add_url_query_items
function add_url_query_items($url, $items=array())
{
$str_params = '';
$request = request :: instance();
if (($node_id = $request->get_attribute('node_id')) && !isset($items['node_id']))
$items['node_id'] = $node_id;
if(strpos($url, '?') === false)
$url .= '?';
foreach($items as $key => $val)
{
$url = preg_replace("/&*{$key}=[^&]*/", '', $url);
$str_params .= "&$key=$val";
}
$items = explode('#', $url);
$url = $items[0];
$fragment = isset($items[1]) ? '#' . $items[1] : '';
return $url . $str_params . $fragment;
}
示例12: array
function &get_dataset($params = array())
{
$request = request::instance();
if (!($class_id = $request->get_attribute('class_id'))) {
return new array_dataset();
}
$db_table =& db_table_factory::instance('sys_class');
$class_data = $db_table->get_row_by_id($class_id);
if (!$class_data) {
return new array_dataset();
}
$c =& site_object_factory::instance($class_data['class_name']);
$site_object_controller =& $c->get_controller();
$actions = $site_object_controller->get_actions_definitions();
$result = array();
foreach ($actions as $action => $action_params) {
if (!isset($action_params['can_have_access_template']) || !$action_params['can_have_access_template']) {
continue;
}
if (isset($action_params['action_name'])) {
$result[$action]['action_name'] = $action_params['action_name'];
} else {
$result[$action]['action_name'] = str_replace('_', ' ', strtoupper($action[0]) . substr($action, 1));
}
}
return new array_dataset($result);
}
示例13: array
function &_fetch(&$counter, $params)
{
$items =& parent::_fetch($counter, $params);
if (!count($items)) {
return array();
}
reset($items);
$request = request::instance();
if (!($current_id = $request->get_attribute('id'))) {
$current_id = $items[key($items)]['id'];
}
foreach ($items as $id => $item) {
if ($current_id == $item['id']) {
$current_item = $item;
break;
} else {
next($items);
}
}
$result = array();
$result['prev'] = array($this->_get_prev_item($items, $current_id));
$result['next'] = array($this->_get_next_item($items, $current_id));
$result['current'] = array($current_item);
$result['prev']['presentation_path'] = $params['path'];
$result['next']['presentation_path'] = $params['path'];
$result['current']['presentation_path'] = $params['path'];
return array($result);
}
示例14: getFacadeAccessor
protected static function getFacadeAccessor()
{
if (!static::$__url) {
$routes = route::getRoutes();
static::$__url = new base_routing_urlgenerator($routes, request::instance());
}
return static::$__url;
}
示例15: getFacadeAccessor
protected static function getFacadeAccessor()
{
if (!static::$__router) {
static::$__router = kernel::single('base_routing_router', request::instance());
route::boot();
}
return static::$__router;
}