diff --git a/config.php b/config.php index 95314e6..5c31aaa 100644 --- a/config.php +++ b/config.php @@ -113,6 +113,13 @@ define('AUTOLINK_PAGE_TITLES', false); +// COLORIZE_MISSING_PAGES +// +// Automatically highlights as red links, any linked pages which are +// not yet written. Existing but blank pages are not colorized. This +// might degrade performance if you have thousands of links on a page. + +define('COLORIZE_MISSING_PAGES', true); // ----------------------------- // Security and session settings diff --git a/index.css b/index.css index 4443f61..3225c4d 100644 --- a/index.css +++ b/index.css @@ -149,6 +149,10 @@ a.tool { color: #eeeeee; } +a.missing-link { + color: #ba0000; +} + input.tool { font-size: 11px; color: #000000; diff --git a/index.php b/index.php index e1313ac..64f97c4 100644 --- a/index.php +++ b/index.php @@ -84,7 +84,18 @@ function _handle_links($match) { - return "" . htmlentities($match[1]) . ""; + $link = $match[1]; + if ( COLORIZE_MISSING_PAGES ) { + $link_page = sanitizeFilename($link); + $link_filename = PAGES_PATH . "/$link_page.txt"; + $link_page_exists = file_exists($link_filename); + } else { + $link_page_exists = true; + } + if ($link_page_exists) + return "" . htmlentities($link) . ""; + else + return "" . htmlentities($link) . ""; }