Source for file data.wikigraph.php
Documentation is available at data.wikigraph.php
* @version $Revision: 1.6 $
* @subpackage plugins_data
global $gBitSystem, $gLibertySystem;
// only include this plugin if wiki is active and we have GraphViz
if( @include_once( 'Image/GraphViz.php' )) {
define( 'PLUGIN_GUID_DATAWIKIGRAPH', 'datawikigraph' );
'auto_activate' => FALSE,
'load_function' => 'data_wikigraph',
'help_page' => 'DataPluginWikiGraph',
'description' => tra( "Inserts a graph for visual navigation. The graph shows the page and every page that can be reached from that page. It requies the Image_GraphViz pear plugin and graphviz to be installed: <strong>pear install Image_GraphViz</strong>" ),
'help_function' => 'data_wikigraph_help',
'syntax' => "{wikigraph level= title= }". tra( "Wiki page name" ). "{/wikigraph}",
'<table class="data help">'
. '<th>'. tra( "Key" ). '</th>'
. '<th>'. tra( "Type" ). '</th>'
. '<th>'. tra( "Comments" ). '</th>'
. '<td>'. tra( "numeric"). '<br />'. tra( "(optional)" ). '</td>'
. '<td>'. tra( "The number of levels that will be followed from the starting page." ). ' '. tra( "Default"). ': 0</td>'
. '<td>'. tra( "string"). '<br />'. tra( "(optional)" ). '</td>'
. '<td>'. tra( "Title of the graph."). ' '. tra( "Default "). ': Wiki-Graph</td>'
. '<td>'. tra( "numeric"). '<br />'. tra( "(optional)" ). '</td>'
. '<td>'. tra( "Distance between nodes in inches."). ' '. tra( "Default"). ': 1.2</td>'
. '<td>'. tra( "string"). '<br />'. tra( "(optional)" ). '</td>'
. '<td>'. tra( "Direction of graph layout - can be Left to Right (LR), Right to Left (RL), Top to Bottom (TB), Bottom to Top (BT)."). ' '. tra( "Default"). ': TB</td>'
. '<td>'. tra( "html colour"). '<br />'. tra( "(optional)" ). '</td>'
. '<td>'. tra( "Background colour of the graph."). ' '. tra( "Default"). ': transparent</td>'
. tra( "Example: " ). "{wikigraph level=1}Welcome{/wikigraph}";
global $gContent, $gBitThemes;
// check to see if we have pear available.
if( $error = pear_check( "Image/GraphViz.php" )) {
if( !empty( $gContent ) && is_object( $gContent )) {
$title = ( !empty( $pParams['title'] ) ? $pParams['title'] : 'Wiki-Graph' );
unset ( $pParams['title'] );
foreach( $pParams as $param => $value ) {
$querystring .= "&{$param}={$value}";
$pData = (( is_object( $gContent ) || !empty( $gContent->mPageName )) ? $gContent->mPageName : NULL );
'graph' => $gBitThemes->getGraphvizGraphAttributes( $pParams ),
'node' => $gBitThemes->getGraphvizNodeAttributes( $pParams ),
'edge' => $gBitThemes->getGraphvizEdgeAttributes( $pParams ),
$mapdata = $gContent->linkStructureMap( $pData, ( isset ( $pParams['level'] ) ? $pParams['level'] : 0 ), $params );
<div style='text-align:center'>
<img src=\"". WIKI_PKG_URL. "wiki_graph.php?page=". urlencode( $pData ). "{ $querystring}\" alt='{ $title}' usemap='# $mapname' />
<map name='$mapname'>$mapdata</map>
|