From eef5297f9898a37977ed7dbf2d197699092dc031 Mon Sep 17 00:00:00 2001 From: Eric van der Vlist Date: Sat, 28 Jan 2012 11:16:17 +0100 Subject: [PATCH] Quick fix for Wikipedia archives issues #6. --- wordpress/plugins/owark/owark.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/wordpress/plugins/owark/owark.php b/wordpress/plugins/owark/owark.php index 099d0cd..a4875cc 100644 --- a/wordpress/plugins/owark/owark.php +++ b/wordpress/plugins/owark/owark.php @@ -439,7 +439,14 @@ if (!class_exists("Owark")) { $loc = '/wp-content/plugins/owark' . substr($link->arc_location, $pos); $arc_loc = home_url() . $loc; - $file_location = '.'. $loc .'/index.html'; + // The file name is either index.html or guessed from the URL + if ($home_url[strlen($home_url)] == '/') { + $file_location = '.'. $loc .'/index.html'; + } else { + $parts = str_split($home_url, '/'); + $file_location = '.'. $loc . $parts[count($parts)] . '.html'; + } + if (!file_exists($file_location)) { // If index.html doesn't exist, find another html file! $dir = opendir('.'.$loc);