ILIAS  release_8 Revision v8.24
class.ilUriInputGUI.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22
29{
30 protected ?int $maxlength = 500;
31 protected int $size = 40;
32
33 public function __construct(
34 string $a_title = "",
35 string $a_postvar = ""
36 ) {
37 global $DIC;
38
39 $this->lng = $DIC->language();
40 parent::__construct($a_title, $a_postvar);
41 $this->setType("uri");
42 }
43
44 public function checkInput(): bool
45 {
47
48 // check required
49 if ($this->getRequired() && trim($this->str($this->getPostVar())) == "") {
50 $this->setAlert($lng->txt("msg_input_is_required"));
51 return false;
52 }
53
54 $url = $this->getInput();
55
56 try {
57 new URI($url);
58 } catch (Throwable $e) {
59 $this->setAlert($lng->txt("form_invalid_uri"));
60 return false;
61 }
62
63 return true;
64 }
65}
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="")
global $DIC
Definition: feed.php:28
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$url