summaryrefslogtreecommitdiff
path: root/public/app/views/components/theme.php
diff options
context:
space:
mode:
Diffstat (limited to 'public/app/views/components/theme.php')
-rw-r--r--public/app/views/components/theme.php89
1 files changed, 60 insertions, 29 deletions
diff --git a/public/app/views/components/theme.php b/public/app/views/components/theme.php
index 4e95193..a769dce 100644
--- a/public/app/views/components/theme.php
+++ b/public/app/views/components/theme.php
@@ -1,9 +1,29 @@
<?php
+/** themes
+ * --- -- -- - - -
+ * auto select one id of L = array.LENGTH, per month:
+ * ( ( (month*31 + day) % L*2 ) div 2 )
+ * this will allow theme exchange every 2 days
+ *
+ *
+ * 4-day rollup:
+ * --- -- -- - - -
+ * supports up to 21 themes/season
+ * = 84 themes/year
+ *
+ * algo:
+ * ( ( ( month*31 + day) % L*4 ) div 4 )
+ * change seasonal theme every 4 days
+ * ... Catch Exceptions:
+ * if (month == 12) : month = 0
+ * if (month == 6 && day == 1) then day = 2
+ *
+ */
-// decide a theme according to month
-$month = idate('m');
+// decide a theme season according to month
+$mo = intval(date('m'));
-switch ($month) {
+switch ($mo) {
case 12: case 1: case 2:
$season = 'winter';
break;
@@ -25,27 +45,6 @@ switch ($month) {
}
-/** themes
- * --- -- -- - - -
- * auto select one id of L = array.LENGTH, per month:
- * ( ( (month*31 + day) % L*2 ) div 2 )
- * this will allow theme exchange every 2 days
- *
- *
- * 4-day rollup:
- * --- -- -- - - -
- * supports up to 21 themes/season
- * = 84 themes/year
- *
- * algo:
- * ( ( ( month*31 + day) % L*4 ) div 4 )
- * change seasonal theme every 4 days
- * ... Catch Exceptions:
- * if (month == 12) : month = 0
- * if (month == 6 && day == 1) then day = 2
- *
- */
-
$theme_def = [
# --- summer ---
@@ -76,15 +75,40 @@ $theme_def = [
'label' => 'Doc Searls: Amazing Santa Barbara sunset (2014/01)'
],
+ 'f9' => [
+ 'css' => 'fall-09',
+ 'url' => 'https://www.freepik.com/free-photo/flock-birds-flying-during-sunset_13962565.htm',
+ 'label' => 'wirestock: View of a flock of birds flying into a beautiful sky during sunset'
+ ],
+
# --- winter ---
+ 'w3' => [
+ 'css' => 'winter-03',
+ 'url' => 'https://unsplash.com/photos/yzkoleKww6w',
+ 'label' => 'Raimond Klavins: Snow covered mountain under blue sky during daytime, Himalayas'
+ ],
+
+ 'w8' => [
+ 'css' => 'winter-08',
+ 'url' => 'https://www.freepik.com/free-photo/3d-iceberg-blue-sea_3585791.htm',
+ 'label' => 'kjpargeter: 3d iceberg in blue sea'
+ ],
+
'w9' => [
'css' => 'winter-09',
'url' => 'https://www.freepik.com/free-photo/abstract-water-waves-with-ink-dots_5068293.htm',
'label' => 'freepik: Abstract water waves with ink dots'
],
+ 'w10' => [
+ 'css' => 'winter-10',
+ 'url' => 'https://unsplash.com/photos/D1eFDB4CMj0',
+ 'label' => 'Vidar Nordli-Mathisen: Skogsøya, Norway'
+ ],
+
+
# --- spring ---
'g1' => [
@@ -111,21 +135,28 @@ $theme_def = [
$themes = [
- 'summer' => [ 's1', 's5', 'g9', 's2', 'g1' ],
+ 'summer' => [ 's1', 's2', 's5', 'g9', 'g1' ],
- 'fall' => [ 'f8', 's5', 'g4', 's2' ],
+ 'fall' => [ 'f8', 's5', 'g4', 's2', 'f9' ],
- 'winter' => [ 'w9' ],
+ 'winter' => [ 'w3', 'w8', 'w9', 'w10' ],
- 'spring' => [ 'g1', 'g4', 'g9' ]
+ 'spring' => [ 'g1', 'g4', 'w3', 'g9', 'f9' ]
];
+/** check algo in the begining of this file */
+$day = intval(date('d'));
+$themesLen = count($themes[$season]);
+if ($mo == 12) { $mo = 0; }
+if ($mo == 6 && $day == 1) { $day == 2; }
+$imageID = intdiv( ( ( $mo*31 + $day) % $themesLen*4 ), 4 );
-define('THEME', $theme_def[ $themes['summer'][0] ]);
+define('THEME', $theme_def[ $themes[ $season ][ $imageID ] ]);
+// testing: define('THEME', $theme_def[ $themes[ 'winter' ][ 1 ] ]);
?>
<!-- theme overides -->