diff options
author | Chris Smith <chris.eureka@jalakai.co.uk> | 2008-11-19 15:07:58 +0100 |
---|---|---|
committer | Chris Smith <chris.eureka@jalakai.co.uk> | 2008-11-19 15:07:58 +0100 |
commit | fe9ec250a6558c8352a35b6537cdc30d6c9f5477 (patch) | |
tree | 47380d5a506ce55edac27e7b228cb9e292616c7f /inc/confutils.php | |
parent | 078467f9a746c4f129640c45b549b194de3fe7d2 (diff) | |
download | rpg-fe9ec250a6558c8352a35b6537cdc30d6c9f5477.tar.gz rpg-fe9ec250a6558c8352a35b6537cdc30d6c9f5477.tar.bz2 |
FS#630: allow $conf['useheading'] to individually apply to content links and/or navigation links
$conf['useheading'] values are now:
- 0 : off, use page name in link text
- 'content' : use first heading text for links in wiki page content
- 'navigation' : use first heading text for links in non-page content, e.g. breadcrumps, backlinks, search results, etc.
- 1 : use first heading text in all links
(for backwards compatibility, any other values are mapped to 0 or 1 by empty() function.)
$conf['useheading'] value should now be checked using the useHeading($linktype) function,
where linktype can be "content" or "navigation"
darcs-hash:20081119140758-f07c6-6e26456d50dcecc949fada31b0d4e72877fde1cc.gz
Diffstat (limited to 'inc/confutils.php')
-rw-r--r-- | inc/confutils.php | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/inc/confutils.php b/inc/confutils.php index d735b8b82..a7799b9d4 100644 --- a/inc/confutils.php +++ b/inc/confutils.php @@ -205,5 +205,36 @@ function actionOK($action){ return !in_array($action,$disabled); } +/** + * check if headings should be used as link text for the specified link type + * + * @author Chris Smith <chris@jalakai.co.uk> + * + * @param string $linktype 'content'|'navigation', content applies to links in wiki text + * navigation applies to all other links + * @returns boolean true if headings should be used for $linktype, false otherwise + */ +function useHeading($linktype) { + static $useHeading = null; + + if (is_null($useHeading)) { + global $conf; + + if (!empty($conf['useheading'])) { + switch ($conf['useheading']) { + case 'content' : $useHeading['content'] = true; break; + case 'navigation' : $useHeading['navigation'] = true; break; + default: + $useHeading['content'] = true; + $useHeading['navigation'] = true; + } + } else { + $useHeading = array(); + } + } + + return (!empty($useHeading[$linktype])); +} + //Setup VIM: ex: et ts=2 enc=utf-8 : |