Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00031 class ilFeedUrlInputGUI extends ilTextInputGUI
00032 {
00033 protected $value;
00034 protected $maxlength = 200;
00035 protected $size = 40;
00036
00043 function __construct($a_title = "", $a_postvar = "")
00044 {
00045 parent::__construct($a_title, $a_postvar);
00046 $this->setType("feedurl");
00047 }
00048
00054 function checkInput()
00055 {
00056 global $lng;
00057
00058 $lng->loadLanguageModule("feed");
00059
00060 $_POST[$this->getPostVar()] =
00061 ilUtil::stripSlashes($_POST[$this->getPostVar()]);
00062
00063
00064 if (substr($_POST[$this->getPostVar()], 0, 5) == "feed:")
00065 {
00066 $_POST[$this->getPostVar()] = "http:".
00067 substr($_POST[$this->getPostVar()], 5);
00068 }
00069
00070
00071 if (!is_int(strpos($_POST[$this->getPostVar()], "://")))
00072 {
00073 $_POST[$this->getPostVar()] = "http://".$_POST[$this->getPostVar()];
00074 }
00075
00076
00077 if ($this->getRequired() && trim($_POST[$this->getPostVar()]) == "")
00078 {
00079 $this->setAlert($lng->txt("msg_input_is_required"));
00080
00081 return false;
00082 }
00083
00084
00085 $url = $_POST[$this->getPostVar()];
00086 include_once("./Services/Feeds/classes/class.ilExternalFeed.php");
00087 $check = ilExternalFeed::_checkUrl($url);
00088
00089
00090 if ($check !== true)
00091 {
00092 $url2 = ilExternalFeed::_determineFeedUrl($url);
00093 $check2 = ilExternalFeed::_checkUrl($url2);
00094
00095 if ($check2 === true)
00096 {
00097 $_POST[$this->getPostVar()] = $url2;
00098 $check = true;
00099 }
00100 }
00101
00102
00103 if ($check !== true)
00104 {
00105 $check = str_replace("MagpieRSS:", "", $check);
00106 $this->setAlert($lng->txt("feed_no_valid_url")."<br />".$check);
00107 return false;
00108 }
00109
00110 return true;
00111 }
00112
00113 }