ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
URLSafeSplitPathTransport.php
Go to the documentation of this file.
1<?php
2
20
25{
26 public function __construct(private int $max_length = 128)
27 {
28 }
29
30 public function prepareForTransport(string $compressed_token): string
31 {
32 $string = rtrim(str_replace(['+', '/'], ['-', '_'], base64_encode($compressed_token)), '=');
33 // split string into chunks of 255 characters and separate them with a slash
34 $string = chunk_split($string, $this->max_length, "/");
35
36 return $string;
37 }
38
39 public function readFromTransport(string $compressed_token): string
40 {
41 // combine chunks
42 $compressed_token = str_replace("/", "", $compressed_token);
43
44 return base64_decode(str_replace(['-', '_'], ['+', '/'], $compressed_token . '=='));
45 }
46
47}
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...