Created
October 8, 2018 05:56
-
-
Save shawnfromportland/f029e4a1ee76d7870d5dacf87e8cb3b0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ============================================================================ | |
// Optional: | |
// Select a random picture from different time-of-day sets | |
// selected choice is loaded into $headerImageName for use in your page | |
// ============================================================================ | |
// default to the daytime set | |
$activePicSet = $dayPics; | |
switch($nowSecond){ | |
case $nowSecond >= $sun['civil_twilight_end']: | |
//NIGHT TIME | |
$activePicSet = $nightPics; | |
break; | |
case $nowSecond <= $sun['sunrise']: | |
//DAWN | |
$activePicSet = $sunrisePics; | |
break; | |
case $nowSecond > $sun['sunset'] | |
&& | |
$nowSecond < $sun['civil_twilight_end'] : | |
//SUNSET | |
$activePicSet = $sunsetPics; | |
break; | |
case $nowSecond > $sun['sunrise'] | |
&& | |
$nowSecond < $sun['sunset'] : | |
default: | |
//DAY | |
$activePicSet = $dayPics; | |
break; | |
} | |
// choose at random from the active pic set | |
$headerImageName = $activePicSet[array_rand($activePicSet)]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment