'wikigraph', 'auto_activate' => FALSE, 'requires_pair' => TRUE, 'load_function' => 'data_wikigraph', 'title' => '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: pear install Image_GraphViz" ), 'help_function' => 'data_wikigraph_help', 'syntax' => "{wikigraph level= title= }".tra( "Wiki page name" )."{/wikigraph}", 'plugin_type' => DATA_PLUGIN ); $gLibertySystem->registerPlugin( PLUGIN_GUID_DATAWIKIGRAPH, $pluginParams ); $gLibertySystem->registerDataTag( $pluginParams['tag'], PLUGIN_GUID_DATAWIKIGRAPH ); function data_wikigraph_help() { $help = '' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'' .'
'.tra( "Key" ).''.tra( "Type" ).''.tra( "Comments" ).'
level'.tra( "numeric").'
'.tra( "(optional)" ).'
'.tra( "The number of levels that will be followed from the starting page." ).' '.tra( "Default").': 0
title'.tra( "string").'
'.tra( "(optional)" ).'
'.tra( "Title of the graph.").' '.tra( "Default ").': Wiki-Graph
nodesep'.tra( "numeric").'
'.tra( "(optional)" ).'
'.tra( "Distance between nodes in inches.").' '.tra( "Default").': 1.2
rankdir'.tra( "string").'
'.tra( "(optional)" ).'
'.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
bgcolor'.tra( "html colour").'
'.tra( "(optional)" ).'
'.tra( "Background colour of the graph.").' '.tra( "Default").': transparent
' .tra( "Example: " )."{wikigraph level=1}Welcome{/wikigraph}"; return $help; } function data_wikigraph( $pData, $pParams ) { global $gContent, $gBitThemes; $ret = " "; // check to see if we have pear available. if( $error = pear_check( "Image/GraphViz.php" )) { return $error; } if( !empty( $gContent ) && is_object( $gContent )) { $querystring = ""; $title = ( !empty( $pParams['title'] ) ? $pParams['title'] : 'Wiki-Graph' ); unset( $pParams['title'] ); foreach( $pParams as $param => $value ) { $querystring .= "&{$param}={$value}"; } if( empty( $pData ) ) { $pData = (( is_object( $gContent ) || !empty( $gContent->mPageName )) ? $gContent->mPageName : NULL ); } if( !empty( $pData ) ) { $params = array( 'graph' => $gBitThemes->getGraphvizGraphAttributes( $pParams ), 'node' => $gBitThemes->getGraphvizNodeAttributes( $pParams ), 'edge' => $gBitThemes->getGraphvizEdgeAttributes( $pParams ), ); $mapname = md5( microtime() ); $mapdata = $gContent->linkStructureMap( $pData, ( isset( $pParams['level'] ) ? $pParams['level'] : 0 ), $params ); $ret = "
{$title} $mapdata
"; $ret = preg_replace( "/\n|\r/", '', $ret ); } } return $ret; } } // graphviz check ?>