From 924949850322144036e281bf94fb8b88c42bbd74 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Tue, 16 Feb 2016 22:06:53 -0500 Subject: Add file preview for Markdown and text files --- app/Helper/File.php | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'app/Helper') diff --git a/app/Helper/File.php b/app/Helper/File.php index 6948fe6a..b493e64f 100644 --- a/app/Helper/File.php +++ b/app/Helper/File.php @@ -82,4 +82,26 @@ class File extends \Kanboard\Core\Base return 'image/jpeg'; } } + + /** + * Get the preview type + * + * @access public + * @param string $filename + * @return string + */ + public function getPreviewType($filename) + { + $extension = strtolower(pathinfo($filename, PATHINFO_EXTENSION)); + + switch ($extension) { + case 'md': + case 'markdown': + return 'markdown'; + case 'txt': + return 'text'; + } + + return null; + } } -- cgit v1.2.3