本文整理汇总了PHP中midcom_core_context::run方法的典型用法代码示例。如果您正苦于以下问题:PHP midcom_core_context::run方法的具体用法?PHP midcom_core_context::run怎么用?PHP midcom_core_context::run使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类midcom_core_context
的用法示例。
在下文中一共展示了midcom_core_context::run方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _process
/**
* Process the request
*
* Basically this method will parse the URL and search for a component that can
* handle the request. If one is found, it will process the request, if not, it
* will report an error, depending on the situation.
*
* Details: The logic will traverse the node tree and for each node it will load
* the component that is responsible for it. This component gets the chance to
* accept the request (this is encapsulated in the _can_handle call), which is
* basically a call to can_handle. If the component declares to be able to handle
* the call, its handle function is executed. Depending if the handle was successful
* or not, it will either display an HTTP error page or prepares the content handler
* to display the content later on.
*
* If the parsing process doesn't find any component that declares to be able to
* handle the request, an HTTP 404 - Not Found error is triggered.
*/
private function _process(midcom_core_context $context)
{
$resolver = new midcom_core_resolver($context);
$handler = $resolver->process();
if (false === $handler) {
/**
* Simple: if current context is not '0' we were called from another context.
* If so we should not break application now - just gracefully continue.
*/
if ($context->id == 0) {
// We couldn't fetch a node due to access restrictions
if (midcom_connection::get_error() == MGD_ERR_ACCESS_DENIED) {
throw new midcom_error_forbidden(midcom::get('i18n')->get_string('access denied', 'midcom'));
} else {
throw new midcom_error_notfound("This page is not available on this server.");
}
}
$this->_status = MIDCOM_STATUS_ABORT;
return false;
}
$context->run($handler);
if ($context->id == 0 && $this->skip_page_style == true) {
$this->_status = MIDCOM_STATUS_CONTENT;
// Enter Context
$oldcontext = $context;
midcom_core_context::get(0)->set_current();
midcom::get('style')->enter_context(0);
$this->_output();
// Leave Context
midcom::get('style')->leave_context();
$oldcontext->set_current();
$this->finish();
_midcom_stop_request();
} else {
$this->_status = MIDCOM_STATUS_CONTENT;
}
}