14 use Symfony\Component\Routing\Exception\MethodNotAllowedException;
 
   15 use Symfony\Component\Routing\Exception\ResourceNotFoundException;
 
   64         if ($this->response->getSentResponse()) {
 
   70         return headers_sent();
 
   88         if (
$request->getFirstUrlSegment() == 
'action') {
 
   89             if (
$response->getForwardURL() === 
null) {
 
  112             $parameters = $this->matcher->match(
$path);
 
  115             unset($parameters[
'_resource']);
 
  118             unset($parameters[
'_handler']);
 
  121             unset($parameters[
'_controller']);
 
  124             unset($parameters[
'_file']);
 
  126             $deprecated = 
elgg_extract(
'_deprecated', $parameters, 
'');
 
  127             unset($parameters[
'_deprecated']);
 
  129             $middleware = 
elgg_extract(
'_middleware', $parameters, []);
 
  130             unset($parameters[
'_middleware']);
 
  132             unset($parameters[
'_detect_page_owner']);
 
  133             unset($parameters[
'_use_logged_in']);
 
  135             $route = $this->routes->get($parameters[
'_route']);
 
  136             $route->setMatchedParameters($parameters);
 
  140             $parameters[
'request'] = $envelope;
 
  142             if (!empty($deprecated)) {
 
  146             foreach ($middleware as $callable) {
 
  147                 $result = $this->handlers->call($callable, $envelope, 
null);
 
  154                 return $this->getResponseFromHandler(
$handler, $envelope);
 
  156                 $result = $this->handlers->call($controller, $envelope, 
null);
 
  161                 return $this->getResponseFromFile($file, $envelope);
 
  166         } 
catch (ResourceNotFoundException $ex) {
 
  168         } 
catch (MethodNotAllowedException $ex) {
 
  188         $identifier = array_shift(
$segments) ?: 
'';
 
  193         } 
catch (\Exception $ex) {
 
  219         if (!is_file($file)) {
 
  227         } 
catch (\Exception $ex) {
 
  258             'identifier' => $identifier,
 
  261         $new = $this->events->triggerResults(
'route:rewrite', $identifier, $old, $old);
 
  266         if (!isset($new[
'identifier']) ||
 
  267             !isset($new[
'segments']) ||
 
  268             !is_string($new[
'identifier']) ||
 
  269             !is_array($new[
'segments'])
 
  271             throw new RuntimeException(
'rewrite_path handler returned invalid route data.');
 
  276         array_unshift(
$segments, $new[
'identifier']);
 
Thrown when request is malformatted.
Thrown when page is not accessible.
Exception thrown if an error which can only be found on runtime occurs.
Helpers for providing callable-based APIs.
Delegates requests to controllers based on the registered configuration.
prepareResponse(HttpRequest $request)
Prepare response.
getResponseFromHandler($handler, \Elgg\Request $request)
Get response from handler function.
getResponseFromFile(string $file, \Elgg\Request $request)
Get response from file.
route(HttpRequest $request)
Routes the request to a registered page handler.
getResponse(HttpRequest $request)
Build a response.
__construct(protected EventsService $events, protected RouteCollection $routes, protected UrlMatcher $matcher, protected HandlersService $handlers, protected ResponseFactory $response)
Constructor.
allowRewrite(HttpRequest $request)
Filter a request through the 'route:rewrite' event.
const ELGG_HTTP_NOT_IMPLEMENTED
const REFERRER
Used in calls to forward() to specify the browser should be redirected to the referring page.
if($item instanceof \ElggEntity) elseif($item instanceof \ElggRiverItem) elseif($item instanceof \ElggRelationship) elseif(is_callable([ $item, 'getType']))
elgg()
Bootstrapping and helper procedural code available for use in Elgg core and plugins.
elgg_deprecated_notice(string $msg, string $dep_version)
Log a notice about deprecated use of a function, view, etc.
elgg_extract($key, $array, $default=null, bool $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
HTTP response builder interface.
elgg_echo(string $message_key, array $args=[], string $language='')
Elgg language module Functions to manage language and translations.
elgg_view_resource(string $name, array $vars=[])
Render a resource view.
trait Profilable
Make an object accept a timer.
beginTimer(array $keys)
Start the timer (when enabled)
elgg_ok_response($content='', string|array $message='', ?string $forward_url=null, int $status_code=ELGG_HTTP_OK)
Prepares a successful response to be returned by a page or an action handler.