From 3305f704fb1342f6d6f0c5feac7f84ff301a1193 Mon Sep 17 00:00:00 2001 From: Andrey Kutejko Date: Sun, 4 Aug 2013 13:40:16 +0300 Subject: [PATCH] show syntax errors in views --- ipf.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ipf.php b/ipf.php index d51e9c1..01d2a2a 100644 --- a/ipf.php +++ b/ipf.php @@ -106,6 +106,12 @@ final class IPF return $default; } + private static function include_existing($filename) + { + if (is_file($filename)) + include_once $filename; + } + public static function loadFunction($function) { if (function_exists($function)) @@ -117,8 +123,10 @@ final class IPF $elts = explode('_', $function); array_pop($elts); $file = '/' . strtolower(implode(DIRECTORY_SEPARATOR, $elts)).'.php'; - @include_once IPF::$settings['ipf_path'] . $file; - @include_once IPF::$settings['project_path'] . $file; + + self::include_existing(IPF::$settings['ipf_path'] . $file); + self::include_existing(IPF::$settings['project_path'] . $file); + if (!function_exists($function)) throw new IPF_Exception('Impossible to load the function: '.$function.' in '.$file); } -- 2.49.0