From: Andrey Kutejko Date: Sun, 4 Aug 2013 10:40:16 +0000 (+0300) Subject: show syntax errors in views X-Git-Tag: 0.5~84 X-Git-Url: https://git.andy128k.dev/?a=commitdiff_plain;h=3305f704fb1342f6d6f0c5feac7f84ff301a1193;p=ipf.git show syntax errors in views --- 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); }