From fe9ec250a6558c8352a35b6537cdc30d6c9f5477 Mon Sep 17 00:00:00 2001 From: Chris Smith Date: Wed, 19 Nov 2008 15:07:58 +0100 Subject: 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 --- inc/parser/metadata.php | 2 +- inc/parser/xhtml.php | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'inc/parser') diff --git a/inc/parser/metadata.php b/inc/parser/metadata.php index 640306f87..5994a4dd1 100644 --- a/inc/parser/metadata.php +++ b/inc/parser/metadata.php @@ -427,7 +427,7 @@ class Doku_Renderer_metadata extends Doku_Renderer { $isImage = false; if (is_null($title)){ - if ($conf['useheading'] && $id){ + if (useHeading('content') && $id){ $heading = p_get_first_heading($id,false); if ($heading) return $heading; } diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php index 96afd1593..4fb6cb548 100644 --- a/inc/parser/xhtml.php +++ b/inc/parser/xhtml.php @@ -472,12 +472,12 @@ class Doku_Renderer_xhtml extends Doku_Renderer { /** * Render an internal Wiki Link * - * $search and $returnonly are not for the renderer but are used + * $search,$returnonly & $linktype are not for the renderer but are used * elsewhere - no need to implement them in other renderers * * @author Andreas Gohr */ - function internallink($id, $name = NULL, $search=NULL,$returnonly=false) { + function internallink($id, $name = NULL, $search=NULL,$returnonly=false,$linktype='content') { global $conf; global $ID; // default name is based on $id as given @@ -485,7 +485,7 @@ class Doku_Renderer_xhtml extends Doku_Renderer { // now first resolve and clean up the $id resolve_pageid(getNS($ID),$id,$exists); - $name = $this->_getLinkTitle($name, $default, $isImage, $id); + $name = $this->_getLinkTitle($name, $default, $isImage, $id, $linktype); if ( !$isImage ) { if ( $exists ) { $class='wikilink1'; @@ -1026,12 +1026,12 @@ class Doku_Renderer_xhtml extends Doku_Renderer { * * @author Harry Fuecks */ - function _getLinkTitle($title, $default, & $isImage, $id=NULL) { + function _getLinkTitle($title, $default, & $isImage, $id=NULL, $linktype='content') { global $conf; $isImage = false; if ( is_null($title) || trim($title)=='') { - if ($conf['useheading'] && $id) { + if (useHeading($linktype) && $id) { $heading = p_get_first_heading($id,true); if ($heading) { return $this->_xmlEntities($heading); -- cgit v1.2.3