ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilUriInputGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
30{
31 protected ?int $maxlength = 500;
32 protected int $size = 40;
33
34 public function __construct(
35 string $a_title = "",
36 string $a_postvar = ""
37 ) {
38 global $DIC;
39
40 $this->lng = $DIC->language();
41 parent::__construct($a_title, $a_postvar);
42 $this->setType("uri");
43 }
44
45 public function checkInput(): bool
46 {
48
49 $uri_string = trim($this->getInput());
50
51 // check required
52 if ($uri_string === "") {
53 if ($this->getRequired()) {
54 $this->setAlert($lng->txt("msg_input_is_required"));
55 return false;
56 }
57 return true;
58 }
59
60 try {
61 new URI($uri_string);
62 } catch (Throwable $e) {
63 $this->setAlert($lng->txt("form_invalid_uri"));
64 return false;
65 }
66
67 return true;
68 }
69}
The scope of this class is split ilias-conform URI's into components.
Definition: URI.php:35
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
This class represents a text property in a property form.
Legacy Uri input.
checkInput()
Check input, strip slashes etc.
__construct(string $a_title="", string $a_postvar="")
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
global $DIC
Definition: shib_login.php:26