From 98eadce23a775a9c578a091683ab8c85f0b72ff5 Mon Sep 17 00:00:00 2001 From: Robert Sesek Date: Thu, 16 Aug 2007 20:35:59 +0000 Subject: [PATCH] Simplifying the loading of templates so we don't have two exceptions to throw for the same type of error * Template.php (BSTemplate::_loadTemplate): Check if the path is a file and can be read, instead of checking the result of file_get_contents() becaues that way we don't throw multiple exceptions in the same method unnecessarily --- Template.php | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/Template.php b/Template.php index 81f7062..9056132 100644 --- a/Template.php +++ b/Template.php @@ -333,16 +333,9 @@ class BSTemplate protected function _loadTemplate($name) { $path = $this->templateDir . $name . '.' . $this->extension; - if (is_file($path)) + if (is_file($path) AND is_readable($path)) { - if (($template = @file_get_contents($path)) !== false) - { - return $template; - } - else - { - throw new Exception("Could not load the template '$path'"); - } + return @file_get_contents($path); } else { -- 2.22.5