This class represents a feed url property in a property form. More...
Inheritance diagram for ilFeedUrlInputGUI:
Collaboration diagram for ilFeedUrlInputGUI:Public Member Functions | |
| __construct ($a_title="", $a_postvar="") | |
| Constructor. | |
| checkInput () | |
| Check input, strip slashes etc. | |
Protected Attributes | |
| $value | |
| $maxlength = 200 | |
| $size = 40 | |
This class represents a feed url property in a property form.
Definition at line 31 of file class.ilFeedUrlInputGUI.php.
| ilFeedUrlInputGUI::__construct | ( | $ | a_title = "", |
|
| $ | a_postvar = "" | |||
| ) |
Constructor.
| string | $a_title Title | |
| string | $a_postvar Post Variable |
Reimplemented from ilTextInputGUI.
Definition at line 43 of file class.ilFeedUrlInputGUI.php.
References ilFormPropertyGUI::setType().
{
parent::__construct($a_title, $a_postvar);
$this->setType("feedurl");
}
Here is the call graph for this function:| ilFeedUrlInputGUI::checkInput | ( | ) |
Check input, strip slashes etc.
set alert, if input is not ok.
Reimplemented from ilTextInputGUI.
Definition at line 54 of file class.ilFeedUrlInputGUI.php.
References $lng, ilExternalFeed::_checkUrl(), ilExternalFeed::_determineFeedUrl(), ilFormPropertyGUI::getPostVar(), ilFormPropertyGUI::getRequired(), ilFormPropertyGUI::setAlert(), and ilUtil::stripSlashes().
{
global $lng;
$lng->loadLanguageModule("feed");
$_POST[$this->getPostVar()] =
ilUtil::stripSlashes($_POST[$this->getPostVar()]);
// remove safari pseudo protocol
if (substr($_POST[$this->getPostVar()], 0, 5) == "feed:")
{
$_POST[$this->getPostVar()] = "http:".
substr($_POST[$this->getPostVar()], 5);
}
// add missing http://
if (!is_int(strpos($_POST[$this->getPostVar()], "://")))
{
$_POST[$this->getPostVar()] = "http://".$_POST[$this->getPostVar()];
}
// check required
if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "")
{
$this->setAlert($lng->txt("msg_input_is_required"));
return false;
}
// check feed url
$url = $_POST[$this->getPostVar()];
include_once("./Services/Feeds/classes/class.ilExternalFeed.php");
$check = ilExternalFeed::_checkUrl($url);
// try to determine a feed url, if we failed here
if ($check !== true)
{
$url2 = ilExternalFeed::_determineFeedUrl($url);
$check2 = ilExternalFeed::_checkUrl($url2);
if ($check2 === true)
{
$_POST[$this->getPostVar()] = $url2;
$check = true;
}
}
// if check failed, output error message
if ($check !== true)
{
$check = str_replace("MagpieRSS:", "", $check);
$this->setAlert($lng->txt("feed_no_valid_url")."<br />".$check);
return false;
}
return true;
}
Here is the call graph for this function:ilFeedUrlInputGUI::$maxlength = 200 [protected] |
Reimplemented from ilTextInputGUI.
Definition at line 34 of file class.ilFeedUrlInputGUI.php.
ilFeedUrlInputGUI::$size = 40 [protected] |
Reimplemented from ilTextInputGUI.
Definition at line 35 of file class.ilFeedUrlInputGUI.php.
ilFeedUrlInputGUI::$value [protected] |
Reimplemented from ilTextInputGUI.
Definition at line 33 of file class.ilFeedUrlInputGUI.php.
1.7.1