From c46406b209d36f697d419e2bcb6c4e37a3e660fd Mon Sep 17 00:00:00 2001 From: Evan Prodromou Date: Wed, 4 May 2011 11:28:49 -0700 Subject: [PATCH] low-level hook for loading templates --- lib/docfile.php | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/lib/docfile.php b/lib/docfile.php index 982177315a..e396870695 100644 --- a/lib/docfile.php +++ b/lib/docfile.php @@ -63,24 +63,29 @@ class DocFile $filename = null; - foreach ($paths as $path) { + if (Event::handle('StartDocFileForTitle', array($title, &$paths, &$filename))) { - $def = $path.'/'.$title; + foreach ($paths as $path) { - if (!file_exists($def)) { - $def = null; + $def = $path.'/'.$title; + + if (!file_exists($def)) { + $def = null; + } + + $lang = glob($path.'/'.$title.'.*'); + + if ($lang === false) { + $lang = array(); + } + + if (!empty($lang) || !empty($def)) { + $filename = self::negotiateLanguage($lang, $def); + break; + } } - $lang = glob($path.'/'.$title.'.*'); - - if ($lang === false) { - $lang = array(); - } - - if (!empty($lang) || !empty($def)) { - $filename = self::negotiateLanguage($lang, $def); - break; - } + Event::handle('EndDocFileForTitle', array($title, $paths, &$filename)); } if (empty($filename)) {