ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilUriInputGUI.php
Go to the documentation of this file.
1<?php
2
3/* Copyright (c) 1998-2021 ILIAS open source, GPLv3, see LICENSE */
4
11{
15 protected $lng;
16
17 protected $value;
18 protected $maxlength = 500;
19 protected $size = 40;
20
26 public function __construct($a_title = "", $a_postvar = "")
27 {
28 global $DIC;
29
30 $this->lng = $DIC->language();
31 parent::__construct($a_title, $a_postvar);
32 $this->setType("uri");
33 }
34
39 public function checkInput()
40 {
42
43 $_POST[$this->getPostVar()] =
45
46 // check required
47 if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "") {
48 $this->setAlert($lng->txt("msg_input_is_required"));
49 return false;
50 }
51
52 // check feed url
53 $url = $_POST[$this->getPostVar()];
54
55 try {
56 new \ILIAS\Data\URI($url);
57 } catch (\Throwable $e) {
58 $this->setAlert($lng->txt("form_invalid_uri"));
59 return false;
60 }
61
62 return true;
63 }
64}
$_POST["username"]
An exception for terminatinating execution or to throw for unit testing.
setType($a_type)
Set Type.
getPostVar()
Get Post Variable.
setAlert($a_alert)
Set Alert Text.
This class represents a text property in a property form.
Legacy Uri input.
checkInput()
Check input, strip slashes etc.
__construct($a_title="", $a_postvar="")
Constructor.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$url
$DIC
Definition: xapitoken.php:46