diff --git a/index.php b/index.php index 0b6c217..916ea05 100644 --- a/index.php +++ b/index.php @@ -39,6 +39,35 @@ array_unshift($_SESSION['index'], $dir . '/' . $title); } + function linksdiv($content) + { + $divcontent = '
'; + $links = array(); + if (preg_match_all('/\[\[(.*)\]\]/', $content, $links, PREG_SET_ORDER)) + { + $divcontent .= '
Internal links:
'; + foreach($links as $link) + { + $divcontent .= '
+ ' . $link[1] . ' +
'; + } + } + $links = array(); + if (preg_match_all('/https:(.*)\b/', $content, $links, PREG_SET_ORDER)) + { + $divcontent .= '
External links:
'; + foreach($links as $link) + { + $divcontent .= '
+ https:' . $link[1] . ' +
'; + } + } + $divcontent .= '
'; + return $divcontent; + } + $nextpage = 'home'; if (isset($_GET['clip']) && $_GET['param']) @@ -47,7 +76,7 @@ savenote('todo', $content); $_GET['param'] = ''; } - else if (isset($_POST['save']) || isset($_POST['home'])) + else if (isset($_POST['save']) || isset($_POST['home']) || isset($_POST['links'])) { $title = $_POST['title']; $content = $_POST['content']; @@ -109,7 +138,7 @@ { $content = file_get_contents($dir . '/' . $title); } - + $lines = substr_count($content, "\r\n"); $words = substr_count($content, " ") + $lines; $chars = strlen($content); @@ -118,30 +147,6 @@ require('note.php'); - $links = array(); - if (preg_match_all('/\[\[(.*)\]\]/', $content, $links, PREG_SET_ORDER)) - { - echo '
Internal links:
'; - foreach($links as $link) - { - echo '
- ' . $link[1] . ' -
'; - } - echo '
'; - } - $links = array(); - if (preg_match_all('/https:(.*)\b/', $content, $links, PREG_SET_ORDER)) - { - echo '
External links:
'; - foreach($links as $link) - { - echo '
- https:' . $link[1] . ' -
'; - } - echo '
'; - } } else if ($nextpage == 'home') { diff --git a/note.php b/note.php index bf47fa3..1d8264d 100644 --- a/note.php +++ b/note.php @@ -4,11 +4,15 @@ + lines words chars -
- + +