ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
ILIAS\StaticURL\Request\StaticURLRequestBuilder Class Reference
+ Inheritance diagram for ILIAS\StaticURL\Request\StaticURLRequestBuilder:
+ Collaboration diagram for ILIAS\StaticURL\Request\StaticURLRequestBuilder:

Public Member Functions

 buildRequest (\ILIAS\HTTP\Services $http, Factory $refinery, array $handlers)
 

Detailed Description

Member Function Documentation

◆ buildRequest()

ILIAS\StaticURL\Request\StaticURLRequestBuilder::buildRequest ( \ILIAS\HTTP\Services  $http,
Factory  $refinery,
array  $handlers 
)

Implements ILIAS\StaticURL\Request\RequestBuilder.

Definition at line 32 of file StaticURLRequestBuilder.php.

References $namespace, $requested_url, and ILIAS\Refinery\Factory\to().

32  : ?Request
33  {
34  // maybe we have a legacy parameter during transition phase
35  $target = $http->wrapper()->query()->has("target")
36  ? $http->wrapper()->query()->retrieve(
37  "target",
38  $refinery->to()->string()
39  )
40  : null;
41  if ($target !== null) {
42  $target_parts = explode('_', $target);
43  $namespace = array_shift($target_parts);
44 
45  if (is_numeric($target_parts[0])) {
46  $reference_id = new ReferenceId((int) array_shift($target_parts));
47  } else {
48  $reference_id = null;
49  }
50  $additional_parameters = [];
51  foreach ($target_parts as $target_part) {
52  $additional_parameters[] = urldecode($target_part);
53  }
54  return new Request(
55  $namespace,
56  $reference_id,
57  $additional_parameters
58  );
59  }
60 
61  // This part is for new urls
62  // everything behind goto.php/ is the requested target
63  $requested_url = (string) $http->request()->getUri();
64 
65  if (str_contains($requested_url, '/go/')) {
66  $offset = strpos($requested_url, '/go/') + strlen('/go/');
67  } else {
68  $offset = strpos($requested_url, '/goto.php/') + strlen('/goto.php/');
69  }
70 
71  $requested_url = substr(
73  $offset
74  );
75  $requested_url_parts = explode('/', $requested_url);
76  $namespace = array_shift($requested_url_parts);
77  $additional_parameters = [];
78  if (isset($requested_url_parts[0]) && is_numeric($requested_url_parts[0])) {
79  $reference_id = new ReferenceId((int) array_shift($requested_url_parts));
80  } else {
81  $reference_id = null;
82  }
83  foreach ($requested_url_parts as $requested_url_part) {
84  $additional_parameters[] = urldecode($requested_url_part);
85  }
86 
87  return new Request(
88  $namespace,
89  $reference_id,
90  $additional_parameters
91  );
92  }
if($err=$client->getError()) $namespace
$requested_url
Definition: deliver.php:18
$http
Definition: raiseError.php:7
Refinery Factory $refinery
+ Here is the call graph for this function:

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