update fetch.php remove warnings

This commit is contained in:
Odweta
2024-01-07 17:20:51 +00:00
parent 5c7ec71442
commit e0f9c0a2ab
+8 -7
View File
@@ -44,16 +44,13 @@ function make_login_request($username, $password) {
} }
function parse_teacher($onmouseover) { function parse_teacher($onmouseover) {
$explode_on_teacher = explode("Učitel:", $onmouseover); // [0] => something, [1] => teacher and something, 0 can be ignored if ($onmouseover == null) {
if ($explode_on_teacher == null) { $onmouseover = "Učitel:~ ~";
$explode_on_teacher = "~ ~";
} }
$explode_on_teacher = explode("Učitel:", $onmouseover); // [0] => something, [1] => teacher and something, 0 can be ignored
$explode_on_first_tilda = explode("~", $explode_on_teacher[1]); $explode_on_first_tilda = explode("~", $explode_on_teacher[1]);
$explode_on_second_tilda = explode("~", $explode_on_first_tilda[1]); $explode_on_second_tilda = explode("~", $explode_on_first_tilda[1]);
$teacher = $explode_on_second_tilda[0]; $teacher = $explode_on_second_tilda[0];
if ($teacher == " ") {
$teacher = "";
}
if (strstr($teacher, ">")) { if (strstr($teacher, ">")) {
$teacher = explode("<", explode(">", $teacher)[1])[0]; $teacher = explode("<", explode(">", $teacher)[1])[0];
@@ -87,7 +84,11 @@ function parse_cell($cell, $cell_counter, $times) {
if (!$is_empty && $cell->filter("table")->filter(".KuvSuplovanaHodina")->count() == 0) { if (!$is_empty && $cell->filter("table")->filter(".KuvSuplovanaHodina")->count() == 0) {
$name = $cell->filter(".KuvBunkaRozvrhNadpis")->first()->text(); $name = $cell->filter(".KuvBunkaRozvrhNadpis")->first()->text();
$place = explode("<br>", $cell->filter(".KuvBunkaRozvrhText")->first()->html())[1]; $maybe_place = $cell->filter(".KuvBunkaRozvrhText")->first()->html();
if ($maybe_place == null) {
$maybe_place = "<br>";
}
$place = explode("<br>", $maybe_place)[1];
if ($place == null) { if ($place == null) {
$place = ""; $place = "";
} }