summaryrefslogtreecommitdiff
path: root/inc/confutils.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/confutils.php')
-rw-r--r--inc/confutils.php31
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 :