Permalink
Browse files

Merge remote-tracking branch 'upstream/master'

Conflicts:
	LICENSE.html
  • Loading branch information...
2 parents 1d11ce2 + fb85fd4 commit 73815c77a7c736ebe337fdb1e6ba25560562f003 @flesch flesch committed Oct 19, 2011
View
@@ -0,0 +1 @@
+.DS_Store
View
@@ -30,23 +30,9 @@
- @rem
-->
-<!--[if IE]>
-<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
-<![endif]-->
-<style>
-body {
- margin:0; padding: 50px;
- background: #fff url(bg.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; }
-</style>
+<!-- for HTML5 el styling -->
+<script>document.createElement('article');document.createElement('footer');</script>
+<link rel="stylesheet" href="/themes/{{theme}}.css">
</head>
<body>
<article>
@@ -72,8 +58,8 @@ <h1>The MIT License (MIT)</h1>
THE SOFTWARE.</p>
</article>
<footer>
-<p><a href="https://github.com/remy/mit-license"><img src="https://a248.e.akamai.net/assets.github.com/img/e6bef7a091f5f3138b8cd40bc3e114258dd68ddf/687474703a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67" alt="Fork me on GitHub">Fork this project to create your own MIT license that you can always link to.</a></p>
+<p><a href="https://github.com/remy/mit-license">Fork this project to create your own MIT license that you can always link to.</a></p>
</footer>
<script>var _gaq=[['_setAccount','UA-1656750-28'],['_trackPageview']];(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.src='//www.google-analytics.com/ga.js';s.parentNode.insertBefore(g,s)})(document,'script')</script>
-</body>
+<body>
</html>
View
@@ -36,6 +36,15 @@ the copyright text, you can include a `url` property:
"url": "http://remysharp.com"
}
+And if you want your license to appear as plain text, just add the
+`format` property (currently only `txt` and `html` are supported):
+
+ {
+ "copyright": "Remy Sharp, http://remysharp.com",
+ "url": "http://remysharp.com",
+ "format": "txt"
+ }
+
Finally you can also include a license version target in the JSON file
as explained in the next section.
@@ -64,6 +73,46 @@ This can also be targeted in my JSON file:
Note that if no version is supplied, the latest copy of the LICENSE.html
will be displayed with your information included.
+## Themes
+
+If you've got an eye for design (or like me: not): you can contribute a
+theme by adding a CSS file to the `themes` directory. The default theme
+is simple and clean, but you can add your own as you like.
+
+Current available themes:
+
+* default - [preview](http://mit-license.org) (by
+ [@remy](http://github.com/remy) &
+ [@raphaelbastide](http://github.com/raphaelbastide))
+* flesch - [preview](http://jsbin.com/ufefid/3) (by
+ [@flesch](http://github.com/flesch))
+
+To use a theme, add the `theme` property to your `user.json` file, for
+example:
+
+ {
+ "copyright": "Remy Sharp, http://remysharp.com",
+ "url": "http://remysharp.com",
+ "theme": "flesch"
+ }
+
+
+## Formats & URLs
+
+The following types of requests can be made to this project:
+
+* [http://rem.mit-license.org/](http://rem.mit-license.org/) # HTML, or the default format specified in
+the json file (currently none specified on `rem`)
+* [http://rem.mit-license.org/license.html](http://rem.mit-license.org/license.html) HTML
+* [http://rem.mit-license.org/license.txt](http://rem.mit-license.org/license.txt) Text
+* [http://rem.mit-license.org/a526bf7ad1](http://rem.mit-license.org/a526bf7ad1) a526bf7ad1 version, HTML, or the
+default format specified in the json file (again, none specified for
+`rem` so defaults to HTML)
+* [http://rem.mit-license.org/a526bf7ad1/license.html](http://rem.mit-license.org/a526bf7ad1/license.html) a526bf7ad1 version,
+HTML
+* [http://rem.mit-license.org/a526bf7ad1/license.txt](http://rem.mit-license.org/a526bf7ad1/license.txt) a526bf7ad1 version,
+text
+
## Ways to contribute
Aside from code contributions that make the project better, there are a
@@ -89,6 +138,15 @@ Domain contributions:
* [remy](http://github.com/remy) - 2011-2012
* [barberboy](http://github.com/barberboy) - 2012-2013
+* [paulirish](http://github.com/paulirish) - 2013-2014
+* [batuhanicoz](http://github.com/batuhanicoz) - 2014-2015
+* [buritica](http://github.com/buritica) - 2015-2016
+* [adamstrawson](http://github.com/adamstrawson) - 2016-2018 (2 years)
+* [keithamus](http://github.com/keithamus) - 2018-2026 (8 years)
+
+*Please note that the whois says 2014 currently, I'm following up with
+the domain registra to make sure it's renewed for the right amount of
+time!*
### 2. Hosting
@@ -103,11 +161,7 @@ being lovely.
I'm a developer, I seem only capable of *grey*! If you're a designer and
want to contribute a decent lick of paint on the project that would be
-super. Obviously the content should remain to the point and simple, but
-I'm sure it could be tightened or sharpened.
-
-Drop me a messsage with any idea you've got (or even just a bit of CSS)
-and we'll get it live.
+super. Just create a new theme and send me a pull request.
## License
View
@@ -2,6 +2,8 @@
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
@@ -15,15 +17,41 @@
if (property_exists($user, 'url')) {
$holder = '<a href="'.$user->url.'">' . $holder . '</a>';
}
+
+ if (property_exists($user, 'format')) {
+ if (strtolower($user->format) == 'txt') {
+ $format = 'txt';
+ }
+ }
+
+ if (property_exists($user, 'theme')) {
+ if (file_exists('themes/' . $user->theme . '.css')) {
+ $theme = $user->theme;
+ }
+ }
} else {
$holder = "&lt;copyright holders&gt;";
}
// grab sha from request uri
-$request = $_SERVER["REQUEST_URI"];
+$request_uri = explode('/', $_SERVER["REQUEST_URI"]);
+
+$request = array_pop($request_uri);
+// in case there's a trailing slash (unlikely)
+if ($request == '') $request = array_pop($request_uri);
+
+// url file format overrides user preference
+if (stripos($request, 'license') === 0) {
+ $format = array_pop(explode('.', strtolower($request))) == 'txt' ? 'txt' : 'html';
+
+ // move down to the next part of the request
+ $request = array_pop($request_uri);
+}
+
+// check if there's a SHA on the url and read this to switch license versions
$sha = '';
if ($request != "" && $request != "/" && $request != "/index.php") {
- $sha = preg_replace('/[^a-f0-9]/', '', $_SERVER["REQUEST_URI"]);
+ $sha = preg_replace('/[^a-f0-9]/', '', $request);
} else if (isset($user) && property_exists($user, 'version')) {
$sha = preg_replace('/[^a-f0-9]/', '', $user->version);
}
@@ -46,6 +74,18 @@
// replace info tag and display
$info = date('Y') . ' ' . $holder;
-echo str_replace('{{info}}', $info, $license);
+$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.
+if ($format == 'txt') {
+ $license = array_shift(explode('</article>', array_pop(explode('<article>', $license))));
+ $license = preg_replace('/<[^>]*>/', '', trim($license));
+ $license = html_entity_decode($license);
+ header('content-type: text/plain');
+}
+
+echo $license;
?>
View
@@ -0,0 +1,18 @@
+html { background: #eee; }
+body { margin: 0; font-family: "Inconsolata", "DejaVu Sans Mono","Bitstream Vera Sans Mono", monospace; font-size: 1.2em; line-height: 1.2em; }
+article, footer { display: block; min-width: 360px; max-width: 900px; width: 80%; }
+article { margin: 2.5em auto 0 auto; border: 1px solid ; border-color: #ddd #aaa #aaa #ddd; padding: 2em; background: #fff; }
+h1 { margin-top: 0; }
+article p:first-of-type { margin-top: 1.6em; }
+article p:last-child { margin-bottom: 0; }
+footer { margin: 0em auto 2em auto; }
+footer a { display: block; text-align: center; color: #999; text-shadow: 0 1px 1px #fff; text-decoration:none; font-size:.8em; }
+footer a:before{content: ""; font-size:1.5em; padding-right:.2em; }
+footer a:hover, footer a:focus { color: #333; }
+h1 {font-weight:normal; display:inline; border-bottom:1px solid black; padding:0 0 3px 0;}
+a { color:#2844FA; text-decoration:none;}
+a:hover, a:focus { color:#1B29A4; }
+:-moz-any-link:focus {background:#ccc;}
+::selection {background:#ccc;}
+::-moz-selection {background:#ccc;}
+
View
@@ -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; }
View
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View
@@ -0,0 +1,4 @@
+{
+ "copyright": "Bernhard Mäser, http://bmaeser.io",
+ "url": "http://bmaeser.io"
+}
View
@@ -0,0 +1,4 @@
+{
+ "copyright": "Daniel Knell, http://danielknell.co.uk",
+ "url": "http://danielknell.co.uk"
+}
View
@@ -0,0 +1,4 @@
+{
+ "copyright": "Eddie Monge Jr., http://eddiemonge.com",
+ "url": "http://eddiemonge.com"
+}
View
@@ -0,0 +1,4 @@
+{
+ "copyright": "Jamie Mason, @GotNoSugarBaby",
+ "url": "https://github.com/jamiemason"
+}
View
@@ -0,0 +1,4 @@
+{
+ "copyright": "Keith Cirkel, http://keithcirkel.co.uk",
+ "url": "http://keithcirkel.co.uk"
+}
View
@@ -0,0 +1,4 @@
+{
+ "copyright": "Keith Cirkel, http://keithcirkel.co.uk",
+ "url": "http://keithcirkel.co.uk"
+}
View
@@ -0,0 +1,4 @@
+{
+ "copyright": "Lindsay Evans <http://linz.id.au/>",
+ "url": "http://linz.id.au/"
+}
View
@@ -0,0 +1,4 @@
+{
+ "copyright": "Raphaël Bastide, http://raphaelbastide.com",
+ "url": "http://raphaelbastide.com"
+}
View
@@ -1,4 +1,5 @@
{
"copyright": "Remy Sharp, http://remysharp.com",
- "url": "http://remysharp.com"
+ "url": "http://remysharp.com",
+ "theme": "flesch"
}

0 comments on commit 73815c7

Please sign in to comment.