add stats

This commit is contained in:
quenousimporte 2024-03-11 13:58:27 +01:00
parent 5589822afb
commit 7d44dc86d2
2 changed files with 8 additions and 1 deletions

View File

@ -109,8 +109,12 @@
{ {
$content = file_get_contents($dir . '/' . $title); $content = file_get_contents($dir . '/' . $title);
} }
$lines = substr_count($content, "\r\n");
$words = substr_count($content, " ") + $lines;
$chars = strlen($content);
$rows = max(20, substr_count($content, "\r\n")) * 2; $rows = max(20, $lines) * 2;
require('note.php'); require('note.php');

View File

@ -4,6 +4,9 @@
<input type="submit" name="save" value="save" accesskey="s"> <input type="submit" name="save" value="save" accesskey="s">
<input type="submit" name="delete" value="delete" accesskey="d"> <input type="submit" name="delete" value="delete" accesskey="d">
<input type="submit" name="preview" value="preview" accesskey="p"> <input type="submit" name="preview" value="preview" accesskey="p">
<span class="grey"><?echo $lines; ?> lines</span>
<span class="grey"><?echo $words; ?> words</span>
<span class="grey"><?echo $chars; ?> chars</span>
<br> <br>
<input autocomplete="off" class="title" name="title" value="<? echo $title; ?>"> <input autocomplete="off" class="title" name="title" value="<? echo $title; ?>">
</div> </div>