ILIAS  trunk Revision v13.0_alpha-62-g3b72d83f2e5
ILIAS\StaticURL\Request\LegacyRequestBuilder Class Reference
+ Inheritance diagram for ILIAS\StaticURL\Request\LegacyRequestBuilder:
+ Collaboration diagram for ILIAS\StaticURL\Request\LegacyRequestBuilder:

Public Member Functions

 buildRequest (GlobalHttpState $http, Factory $refinery, array $handlers)
 
 buildRequest (GlobalHttpState $http, Factory $refinery, array $handlers)
 

Detailed Description

Member Function Documentation

◆ buildRequest()

ILIAS\StaticURL\Request\LegacyRequestBuilder::buildRequest ( GlobalHttpState  $http,
Factory  $refinery,
array  $handlers 
)

Implements ILIAS\StaticURL\Request\RequestBuilder.

Definition at line 34 of file LegacyRequestBuilder.php.

34 : ?Request
35 {
36 // try to get target from query
37 $target = $http->wrapper()->query()->has("target")
38 ? $http->wrapper()->query()->retrieve(
39 "target",
40 $refinery->to()->string()
41 )
42 : null;
43 if ($target !== null) {
44 $target_parts = explode('_', (string) $target);
45 if (isset($target_parts[0]) && array_key_exists($target_parts[0], $handlers)) {
46 return null;
47 }
48
49 return new Request(
51 null,
53 );
54 }
55
56 // try build target from path (since URL has been rewritten to goto/...)
57 $path = $http->request()->getUri()->getPath();
58 // get everything after /goto.php/ ot /go/
59 if (str_contains($path, StandardURIBuilder::LONG)) {
60 $path = substr($path, strpos($path, StandardURIBuilder::LONG) + strlen(StandardURIBuilder::LONG));
61 }
62
63 if (str_contains($path, StandardURIBuilder::SHORT)) {
64 $path = substr($path, strpos($path, StandardURIBuilder::SHORT) + strlen(StandardURIBuilder::SHORT));
65 }
66 $path = str_replace([StandardURIBuilder::LONG, StandardURIBuilder::SHORT], '', $path);
67 $target_parts = explode('/', $path);
68 if (isset($target_parts[0]) && array_key_exists($target_parts[0], $handlers)) {
69 return null;
70 }
71 $ref_id = null;
72 if (isset($target_parts[1]) && is_numeric($target_parts[1])) {
73 $ref_id = new ReferenceId((int) $target_parts[1]);
74 $target = $target_parts[2] ?? '';
75 } else {
76 $target = $target_parts[1] ?? '';
77 }
78
79 return new Request(
81 $ref_id,
82 [LegacyGotoHandler::TARGET => str_replace('/', '_', $path)]
83 );
84 }

References ILIAS\BookingManager\Common\Table\$http, ILIAS\UI\examples\Layout\Page\Mail\$refinery, ILIAS\Scripts\PHPStan\$target, ILIAS\BookingManager\Common\HttpService\has(), ILIAS\StaticURL\Builder\StandardURIBuilder\LONG, ILIAS\StaticURL\Handler\LegacyGotoHandler\NAMESPACE, ILIAS\StaticURL\Builder\StandardURIBuilder\SHORT, and ILIAS\StaticURL\Handler\LegacyGotoHandler\TARGET.

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: