ILIAS  trunk Revision v11.0_alpha-1866-gfa368f7776e
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ILIAS\StaticURL\Request\StaticURLRequestBuilder Class Reference
+ Inheritance diagram for ILIAS\StaticURL\Request\StaticURLRequestBuilder:
+ Collaboration diagram for ILIAS\StaticURL\Request\StaticURLRequestBuilder:

Public Member Functions

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

Detailed Description

Member Function Documentation

◆ buildRequest()

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

Implements ILIAS\StaticURL\Request\RequestBuilder.

Definition at line 32 of file StaticURLRequestBuilder.php.

References $namespace, $requested_url, null, ILIAS\HTTP\Services\request(), ILIAS\Refinery\Factory\to(), and ILIAS\HTTP\Services\wrapper().

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('_', (string) $target);
43  $namespace = array_shift($target_parts);
44 
45  $reference_id = is_numeric($target_parts[0]) ? new ReferenceId((int) array_shift($target_parts)) : null;
46  $additional_parameters = [];
47  foreach ($target_parts as $target_part) {
48  $additional_parameters[] = urldecode($target_part);
49  }
50  return new Request(
51  $namespace,
52  $reference_id,
53  $additional_parameters
54  );
55  }
56 
57  // This part is for new urls
58  // everything behind goto.php/ is the requested target
59  $requested_url = (string) $http->request()->getUri();
60 
61  if (str_contains($requested_url, '/go/')) {
62  $offset = strpos($requested_url, '/go/') + strlen('/go/');
63  } else {
64  $offset = strpos($requested_url, '/goto.php/') + strlen('/goto.php/');
65  }
66 
67  $requested_url = substr(
69  $offset
70  );
71  $requested_url_parts = explode('/', $requested_url);
72  $namespace = array_shift($requested_url_parts);
73  $additional_parameters = [];
74  if (isset($requested_url_parts[0]) && is_numeric($requested_url_parts[0])) {
75  $reference_id = new ReferenceId((int) array_shift($requested_url_parts));
76  } else {
77  $reference_id = null;
78  }
79  foreach ($requested_url_parts as $requested_url_part) {
80  $additional_parameters[] = urldecode($requested_url_part);
81  }
82 
83  return new Request(
84  $namespace,
85  $reference_id,
86  $additional_parameters
87  );
88  }
if($err=$client->getError()) $namespace
$http
Definition: deliver.php:30
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
$requested_url
Definition: deliver.php:32
+ Here is the call graph for this function:

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