created new theme option, adding the default and adding the one @flesch contributed, which closes #49

This commit is contained in:
Remy Sharp 2011-10-19 21:06:27 +01:00
parent 490f7ed74f
commit a7bfe5ff89
5 changed files with 34 additions and 13 deletions

View file

@ -30,19 +30,9 @@
- @rem
-->
<style>
html { background: #eee; }
body { margin: 0; font-family: monospace; font-size: 1.4em; }
article, footer {
display: block; margin: 1em auto; min-width: 320px; width: 90%;
}
<!-- article { display: block; margin: 1em auto; min-width: 320px; width: 90%; border: 1px solid #ccc; padding: 1em; background: #fff; border-radius: 5px; box-shadow: 0 5px 20px rgba(0,0,0,0.25);}-->
article { display: block; margin: 2em auto; min-width: 360px; max-width: 900px; width: 80%; border: 1px solid #ccc; padding: 2em; background: #fff; border-radius: 5px; box-shadow: 0 5px 10px rgba(0,0,0,0.25);}
h1 { margin-top: 0; }
p:last-child { margin-bottom: 0; }
footer a { display: block; text-align: center; color: #999; font-weight: bold; text-shadow: 0 1px 1px #fff; }
footer a:hover, footer a:focus { color: #333; }
</style>
<!-- for HTML5 el styling -->
<script>document.createElement('article');document.createElement('footer');</script>
<link rel="stylesheet" href="/themes/{{theme}}.css">
</head>
<body>
<article>

View file

@ -3,6 +3,7 @@
date_default_timezone_set('Europe/London'); // stop php from whining
$format = 'html';
$theme = 'default';
$user_file = preg_replace('/\.mit-license\..*$/', '', $_SERVER["HTTP_HOST"]);
// sanitise user (not for DNS, but for file reading, I don't know
@ -22,6 +23,12 @@
$format = 'txt';
}
}
if (property_exists($user, 'theme')) {
if (file_exists('themes/' . $user->theme . '.css')) {
$theme = $user->theme;
}
}
} else {
$holder = "&lt;copyright holders&gt;";
}
@ -68,6 +75,7 @@
// replace info tag and display
$info = date('Y') . ' ' . $holder;
$license = str_replace('{{info}}', $info, $license);
$license = str_replace('{{theme}}', $theme, $license);
// if we want text format, strip out the license from the article tag
// and then strip any other tags in the license.

11
themes/default.css Normal file
View file

@ -0,0 +1,11 @@
html { background: #eee; }
body { margin: 0; font-family: monospace; font-size: 1.4em; }
article, footer {
display: block; margin: 1em auto; min-width: 320px; width: 90%;
}
article { display: block; margin: 2em auto; min-width: 360px; max-width: 900px; width: 80%; border: 1px solid #ccc; padding: 2em; background: #fff; border-radius: 5px; box-shadow: 0 5px 10px rgba(0,0,0,0.25);}
h1 { margin-top: 0; }
p:last-child { margin-bottom: 0; }
footer a { display: block; text-align: center; color: #999; font-weight: bold; text-shadow: 0 1px 1px #fff; }
footer a:hover, footer a:focus { color: #333; }

12
themes/flesch.css Normal file
View file

@ -0,0 +1,12 @@
body {
margin:0; padding: 50px;
background: #fff url(/themes/flesch.png);
font: 16px/28px "Palatino Linotype", "Book Antiqua", Palatino, FreeSerif, serif; color: #252519;
}
article, footer { display:block; max-width:720px; margin:0; }
article { padding:28px; background:#fff; border:1px solid #ccc; }
footer { padding:0 28px; text-align:center; }
h1 { margin:0; font-size: 24px; line-height: 32px;}
a, a:visited { color:#105cb6; padding:4px; text-decoration:none; }
a:active, a:hover { color:#003; }
a img { position: absolute; top: 0; right: 0; border: 0; }

BIN
themes/flesch.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB