init
This commit is contained in:
commit
28f28e1510
5
composer.json
Normal file
5
composer.json
Normal file
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"require": {
|
||||
"twitter/bootstrap": "dev-master"
|
||||
}
|
||||
}
|
1
web/bootstrap
Symbolic link
1
web/bootstrap
Symbolic link
|
@ -0,0 +1 @@
|
|||
../vendor/twitter/bootstrap/dist
|
10
web/bot.html
Normal file
10
web/bot.html
Normal file
|
@ -0,0 +1,10 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<p>Come on :)</p>
|
||||
</body>
|
||||
</html>
|
8
web/css/main.css
Normal file
8
web/css/main.css
Normal file
|
@ -0,0 +1,8 @@
|
|||
body {
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
textarea {
|
||||
width: 100%;
|
||||
height: 50%;
|
||||
}
|
61
web/index.php
Normal file
61
web/index.php
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
|
||||
if (isset($_POST['code'])) {
|
||||
if (trim($_POST['code']) !== '') {
|
||||
require '../vendor/indent/parser.php';
|
||||
|
||||
$output_dir = 'sources';
|
||||
$output_file = $output_dir.'/'.time().'.txt';
|
||||
|
||||
if (!is_dir($output_dir)) {
|
||||
mkdir($output_dir);
|
||||
}
|
||||
|
||||
file_put_contents($output_file, indent($_POST['code']));
|
||||
|
||||
header('Location: '.$output_file);
|
||||
die(0);
|
||||
} else {
|
||||
$error = 'Invalid value.';
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<!DOCTYPE HTML>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Markup language indenter</title>
|
||||
<link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="/bootstrap/css/bootstrap-theme.min.css" />
|
||||
<link rel="stylesheet" href="/css/main.css" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Markup language indenter</h1>
|
||||
|
||||
<p>Give me your source code and let me indent it!</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<?php if(!empty($error)): ?>
|
||||
<div class="alert alert-danger"><p><?php echo htmlentities($error); ?></p></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<form data-action="/index.php" action="/bot.html" method="post">
|
||||
<div class="form-group">
|
||||
<textarea class="form-control" required name="code" rows="15"></textarea>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input class="btn btn-primary" type="submit" value="Indent it!" />
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<hr />
|
||||
|
||||
<p>Developed by <a href="http://www.deblan.tv/">Simon Vieille</a> - <a href="https://guest:guest@svn.deblan.org/websvn/listing.php?repname=indentation.deblan.org">Open-source project</a></p>
|
||||
|
||||
<script type="text/javascript" src="//codeorigin.jquery.com/jquery-1.10.2.min.js"></script>
|
||||
<script type="text/javascript" src="/js/main.js"></script>
|
||||
</body>
|
||||
</html>
|
8
web/js/main.js
Normal file
8
web/js/main.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
$('body').on(
|
||||
'mousemove',
|
||||
function() {
|
||||
$('form').each(function() {
|
||||
$(this).attr('action', $(this).data('action'));
|
||||
});
|
||||
}
|
||||
);
|
Loading…
Reference in a new issue