コード例 #1
0
ファイル: index.php プロジェクト: Eu-JinOoi/NightOwl
function parseJSON($json)
{
    global $DLRA;
    global $DCA;
    foreach ($json["weeks"] as $week) {
        foreach ($week as $day) {
            if ($day["id"] != NULL) {
                $date = substr($day["id"], 0, 4) . "-" . substr($day["id"], 4, 2) . "-" . substr($day["id"], -2);
                echo $date . "<br>";
                $dowe = date("l (w)", strtotime($date));
                $dow = date("w", strtotime($date));
                echo "Day of Week:" . $dowe . "<br>\n";
                //var_dump($day);
                foreach ($day["locations"] as $park) {
                    echo $park["title"] . "<br>";
                    echo $park["parkHours"] . "<br>";
                    $hrs = explode(" - ", $park["parkHours"]);
                    $o = convertDHours($hrs[0]);
                    $c = convertDHours($hrs[1]);
                    $is24 = 0;
                    if ($o == $c) {
                        echo "<span style='color:green; font-weight:bolder;'>OPEN 24 HOURS!</span><br>";
                        $is24 = 1;
                    } else {
                        echo "Opens at: " . $o . "<br>";
                        echo "Closes at: " . $c . "<br>";
                    }
                    if ($park["title"] == "Disneyland Park" && !$DLRA->hoursSet()) {
                        $DLRA->addHours($dow, $o, $c, $is24, 0);
                        echo "<span style='color:green;'>SET</span>";
                    } else {
                        if ($park["title"] == "Disney California Adventure Park" && !$DCA->hoursSet()) {
                            $DCA->addHours($dow, $o, $c, $is24, 0);
                            echo "<span style='color:green;'>SET</span>";
                        } else {
                            echo "<span style='color:red;'>NOT SET</span>";
                        }
                    }
                    echo "<br><br>";
                }
                echo "<br><hr><br>";
            }
        }
    }
}
コード例 #2
0
ファイル: index-orig.php プロジェクト: Eu-JinOoi/NightOwl
$DCA->timeSettings($timezone, $dlst);
foreach ($json["weeks"] as $week) {
    foreach ($week as $day) {
        if ($day["id"] != NULL) {
            $date = substr($day["id"], 0, 4) . "-" . substr($day["id"], 4, 2) . "-" . substr($day["id"], -2);
            echo $date . "<br>";
            $dowe = date("l (w)", strtotime($date));
            $dow = date("w", strtotime($date));
            echo "Day of Week:" . $dowe . "<br>\n";
            //var_dump($day);
            foreach ($day["locations"] as $park) {
                echo $park["title"] . "<br>";
                echo $park["parkHours"] . "<br>";
                $hrs = explode(" - ", $park["parkHours"]);
                $o = convertDHours($hrs[0]);
                $c = convertDHours($hrs[1]);
                $is24 = 0;
                if ($o == $c) {
                    echo "<span style='color:green; font-weight:bolder;'>OPEN 24 HOURS!</span><br>";
                    $is24 = 1;
                } else {
                    echo "Opens at: " . $o . "<br>";
                    echo "Closes at: " . $c . "<br>";
                }
                if ($park["title"] == "Disneyland Park" && !$DLRA->hoursSet()) {
                    $DLRA->addHours($dow, $o, $c, $is24, 0);
                    echo "<span style='color:green;'>SET</span>";
                } else {
                    if ($park["title"] == "Disney California Adventure Park" && !$DCA->hoursSet()) {
                        $DCA->addHours($dow, $o, $c, $is24, 0);
                        echo "<span style='color:green;'>SET</span>";