Permalink
Browse files

complete rewrite based on wht I did with ditaa

remote rendering isn't working yet. still has some ditaa references and
is missing a few features the old version had.
  • Loading branch information...
1 parent 903f28d commit 517bd8367891ed3eeda89c7608688f50ccdd0d7a @splitbrain committed Aug 12, 2010
Showing with 211 additions and 190 deletions.
  1. +3 −0 conf/default.php
  2. +4 −0 conf/metadata.php
  3. +48 −0 img.php
  4. +4 −0 lang/en/settings.php
  5. +8 −0 plugin.info.txt
  6. +144 −190 syntax.php
View
@@ -0,0 +1,3 @@
+<?php
+
+$conf['path'] = '';
View
@@ -0,0 +1,4 @@
+<?php
+
+$meta['path'] = array('string');
+
View
48 img.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
+ * @author Andreas Gohr <gohr@cosmocode.de>
+ */
+
+if(!defined('DOKU_INC')) define('DOKU_INC',dirname(__FILE__).'/../../../');
+define('NOSESSION',true);
+require_once(DOKU_INC.'inc/init.php');
+require_once(DOKU_INC.'inc/pageutils.php');
+require_once(DOKU_INC.'inc/httputils.php');
+require_once(DOKU_INC.'inc/io.php');
+
+$data = $_REQUEST;
+$w = (int) $data['width'];
+$h = (int) $data['height'];
+unset($data['width']);
+unset($data['height']);
+unset($data['align']);
+
+$cache = getcachename(join('x',array_values($data)),'graphviz.png');
+
+// create the file if needed
+if(!file_exists($cache)){
+ $plugin = plugin_load('syntax','graphviz');
+ $plugin->_run($data,$cache);
+ clearstatcache();
+}
+
+// resized version
+if($w) $cache = media_resize_image($cache,'png',$w,$h);
+
+// something went wrong, we're missing the file
+if(!file_exists($cache)){
+ header("HTTP/1.0 404 Not Found");
+ header('Content-Type: image/png');
+ echo io_readFile('broken.png',false);
+ exit;
+}
+
+header('Content-Type: image/png;');
+header('Expires: '.gmdate("D, d M Y H:i:s", time()+max($conf['cachetime'], 3600)).' GMT');
+header('Cache-Control: public, proxy-revalidate, no-transform, max-age='.max($conf['cachetime'], 3600));
+header('Pragma: public');
+http_conditionalRequest($time);
+echo io_readFile($cache,false);
+
+//Setup VIM: ex: et ts=4 enc=utf-8 :
View
@@ -0,0 +1,4 @@
+<?php
+
+$lang['path'] = 'The path to your local graphviz dot binary (eg. <code>/usr/bin/dot</code>). Leave empty to use remote rendering at google.com.';
+
View
@@ -0,0 +1,8 @@
+base graphviz
+author Andreas Gohr
+email andi@splitbrain.org
+date 2010-08-12
+name Graphviz Plugin
+desc Create graph images from Graphviz dot language
+url http://www.dokuwiki.org/plugin:graphviz
+
Oops, something went wrong.

0 comments on commit 517bd83

Please sign in to comment.