diff options
Diffstat (limited to 'inc/parserutils.php')
-rw-r--r-- | inc/parserutils.php | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/inc/parserutils.php b/inc/parserutils.php index e2b4e9feb..e190a0af7 100644 --- a/inc/parserutils.php +++ b/inc/parserutils.php @@ -235,4 +235,23 @@ function p_render_xhtml($instructions){ return $Renderer->doc; } +/** + * Gets the first heading from a file + * + * @author Jan Decaluwe <jan@jandecaluwe.com> + */ + +function p_get_first_heading($id){ + $file = wikiFN($id); + if (@file_exists($file)) { + $instructions = p_cached_instructions($file); + foreach ( $instructions as $instruction ) { + if ($instruction[0] == 'header') { + return $instruction[1][0]; + } + } + } + return NULL; +} + //Setup VIM: ex: et ts=2 enc=utf-8 : |