Hi there!
We’d like to have the Local Graphviz installation using the dot Graphviz binary, and with our path (online server) we receive an output with Permission denied.
Please, could you let us know how to proceed?
Thanks!
Iria
hi.
glad to see this plugin, but it don’t work for me.
in the plugin settings it shows the example graph and seems to work, but when i try to use it in a page/post it does not!
In option page, I can see content like this:
Graphviz generation method
Only available methods will be shown. If you have Graphviz installed locally and no options are shown, make sure the “graphviz path” option below is set correctly.
– Local Graphviz installation using the dot Graphviz binary (recommended)graphviz path
/usr/bin/dot
Not found. Enter full path to a Graphviz binary, for example/usr/bin/dot
, or choose another Graphwiz generation method.
I have installed graphviz with yum install graphviz grapviz-php grapviz-devel
.
I am sure that dot is installed at /usr/bin/dot
.
Problem:
I can see and choose a generation method but I cannot set graphviz path.
Of course, It cannot be run.
More
============
There are some js library such as jsviz. Could I use them with this plugin?
first, it works out of the box, and I like it!
Except for image maps, where I don’t get any clickable links. I’m using this to generate an image map with the graph:
[graphviz imap="yes" title="mymap" id="mymap"]digraph {
input[shape="box", style="rounded", label="my Label", URL="/myurl"];
}
and the generated image map, where the curious looking ‘id=”%3″‘ may be the problem, looks like this:
<img src="/wp-content/tfo-graphviz/8d8cd6138ba2d261111e54b3ca338dbb.png" class="graphviz" alt="mymap" title="mymap" usemap="#mymap" />
<map id="%3" name="%3">
<area shape="rect" id="node4" href="/myurl" title="my Label" alt="" coords="302,5,565,53"/>
</map>
Helpful feedback appreciated ??
]]>Using this:
digraph hierarchy {
size="5,5"
node[shape=record,style=filled,fillcolor=gray95]
edge[dir=back, arrowtail=empty]
2[label = "{AbstractSuffixTree|+ text\n+ root|...}"]
3[label = "{SimpleSuffixTree|...| + constructTree()\l...}"]
4[label = "{CompactSuffixTree|...| + compactNodes()\l...}"]
5[label = "{SuffixTreeNode|...|+ addSuffix(...)\l...}"]
6[label = "{SuffixTreeEdge|...|+ compactLabel(...)\l...}"]
2->3
2->4
5->5[constraint=false, arrowtail=odiamond]
4->3[constraint=false, arrowtail=odiamond]
2->5[constraint=false, arrowtail=odiamond]
5->6[arrowtail=odiamond]
}
Putting the dot source inside hierarchy.dot
and running dot -O -Tsvg hierarchy.dot
works just fine, putting it between [graphviz]
markers gives me this:
Error generating Graphviz image
Graphviz cannot generate graph
Warning: : syntax error in line 2 near ']'
I have no way of finding out what’s wrong.
Well okay removing the size parameter gave me another error, so I can find out problems by commenting out individual lines. Actually I’d be okay with that if errors happened just occasionally, but I’m not okay if I need to do this multiple times with no indication how many more problems of that kind mind be waiting for me.
It would be nice if the plugin printed the full path name of the generated .dot
file and the command-line invokation it used.
The plugin page shows the generated sample graph, and pasting the code there to the WP page works just fine, too.
Using TFO-Graphviz 1.12, which is accessing Graphviz through graphviz path /usr/bin/dot
. Graphviz itself is dot - graphviz version 2.36.0 (20140111.2315)
.
As things are, my only way forward is to generate the graphs offline.
That will also fix the lack of svg support.
clean_url()
and attribute_escape()
have both been deprecated. Could you update to esc_url()
and esc_attr()
(or esc_attr__()
where applicable)? ?? Thanks Chris!
I upgraded GV and got the following error when trying to view the tfo-graphviz options page:
Fatal error: Class 'TFO_Graphviz_Graphviz' not found in C:\work\public_html\wp\dev\src\wp-content\plugins\tfo-graphviz\tfo-graphviz.php on line 268
This is because it can no longer find GV.
I fixed it with:
Index: tfo-graphviz.php =================================================================== --- tfo-graphviz.php (revision 1259511) +++ tfo-graphviz.php (working copy) @@ -262,6 +262,9 @@ $gv_method = $this->options['method']; require_once dirname( __FILE__ ).'/tfo-graphviz-'.$this->methods[$gv_method].'.php'; + if ( ! class_exists( $gv_method ) ) { + $gv_method = 'TFO_Graphviz_Method'; + } $gv_object = new $gv_method($dot, $atts, TFO_GRAPHVIZ_CONTENT_DIR, TFO_GRAPHVIZ_CONTENT_URL); if (!$gv_object) { $this->err = "Unable to create Graphviz renderer, check your plugin settings";]]>
I’m getting the following error:
Strict Standards: Redefining already defined constructor for class TFO_Graphviz_Graphviz in ~/wp-content/plugins/tfo-graphviz/tfo-graphviz-graphviz.php on line 74
]]>Hi Chris,
I’ve been trying to insert images into the graphs. I’ve tried using both:
p1 [margin=0 shape=hexagon, style=bold, label=<<TABLE border=”0″ cellborder=”0″>
<TR><TD><IMG SRC=”https://site.com/img.png”/></TD></TR>
<TR><TD>first line
<font point-size=”8″>second line</font></TD></TR>
</TABLE>>]
d [shape=none, label=””, image=”https://site.com/img.png”%5D;
But unfortunately neither renders the image. Is this supported in Graphviz?
All the best,
Jamie
I was getting the above error code on one Windows machine, and solved it by making sure that /tmp
existed on the drive containing WP.
Hi,
Thanks for a great plugin! Are you still developing it? I do hope so. ??
I have submitted a patch to change from exec’ing mv to using rename:
https://plugins.trac.www.ads-software.com/ticket/2397
Thanks,
Sam.
Don’t know how to contact author; but was able to get this working on my WordPress 3.5.1 w/ Debian squeeze.
libgv-php5 was enabled via:
apt-get install libgv-php5
echo “extension=gv.so” > /etc/php5/conf.d/graphviz.ini
Patch included:
]]>diff –git a/tfo-graphviz-admin.php b/tfo-graphviz-admin.php
index 6ae1dfd..1985233 100644
— a/tfo-graphviz-admin.php
+++ b/tfo-graphviz-admin.php
@@ -146,7 +146,7 @@ class TFO_Graphviz_Admin extends TFO_Graphviz {
exec( $exec, $out, $r );
$message .= “<h4>Command run:</h4>\n”;
$message .= “<div class=’pre’>$exec
</div>\n”;
– $out = preg_replace( ‘/tex_.+?\.log/i’, ‘test.log‘, join(“\n”, $out));
+ $out = preg_replace( ‘/tex_.+?\.log/i’, ‘test.log‘, join(“\n”, $out));
$message .= “<h4>Result:</h4>\n”;
$message .= “<div class=’pre’>$out
</div>\n”;
$message .= “<p>Exit code: $r</p>\n”;
@@ -161,8 +161,8 @@ class TFO_Graphviz_Admin extends TFO_Graphviz {
$url = content_url( TFO_GRAPHVIZ_CONTENT.’/test.png’ ) . “?” . mt_rand();
}
@unlink(TFO_GRAPHVIZ_CONTENT_DIR.’/test.log’);
– $alt = attribute_escape( __( ‘Test Image’, ‘tfo-graphviz’ ) );
– echo “<img class=’test-image’ src='” . clean_url( $url ) . “‘ alt=’$alt’ />\n”;
+ $alt = esc_attr( __( ‘Test Image’, ‘tfo-graphviz’ ) );
+ echo “<img class=’test-image’ src='” . esc_url( $url ) . “‘ alt=’$alt’ />\n”;
echo “<p class=’test-image’>” . __( ‘If you can see a graph then all is well.’, ‘tfo-graphviz’ ) . ‘</p>’;
$r = true;
}
@@ -224,7 +224,7 @@ tr.tfo-graphviz-method-<?php echo $current_method; ?> {
$available_methods[$class] = $method;
if(‘TFO_Graphviz_Remote’ == $class)
continue;
– $graphviz_object = new $class(‘a->b;’, array(id=>’admin’,simple=>true));
+ $graphviz_object = new $class(‘a->b;’, array(‘id’=>’admin’,’simple’=>true));
}
unset( $class, $method, $graphviz_object );@@ -256,7 +256,7 @@ tr.tfo-graphviz-method-<?php echo $current_method; ?> {
<?php if ( empty( $errors ) ) $this->test_image(); ?>
– <form action=”<?php echo clean_url( remove_query_arg( ‘updated’ ) ); ?>” method=”post”>
+ <form action=”<?php echo esc_url( remove_query_arg( ‘updated’ ) ); ?>” method=”post”><table class=”form-table”>
<tbody>
@@ -288,7 +288,7 @@ tr.tfo-graphviz-method-<?php echo $current_method; ?> {<tr class=”tfo-graphviz-path tfo-graphviz-method tfo-graphviz-method-graphviz <?php if ( in_array( ‘graphviz_path’, $errors ) ) echo ‘ form-invalid’; ?>”>
<th scope=”row”><label for=”tfo-graphviz-graphviz-path”><?php _e( ‘graphviz
path’ ); ?></label></th>
– <td><input type=’text’ name=’tfo-graphviz[graphviz_path]’ value='<?php echo attribute_escape( $values[‘graphviz_path’] ); ?>’ id=’tfo-graphviz-graphviz-path’ /><?php
+ <td><input type=’text’ name=’tfo-graphviz[graphviz_path]’ value='<?php echo esc_attr( $values[‘graphviz_path’] ); ?>’ id=’tfo-graphviz-graphviz-path’ /><?php
if ( !$this->options[‘graphviz_path’] ) {
$guess_graphviz_path = trim( @exec( ‘which dot’ ) );
if ( $guess_graphviz_path && file_exists( $guess_graphviz_path ) )
@@ -301,13 +301,13 @@ tr.tfo-graphviz-method-<?php echo $current_method; ?> {<tr class=”tfo-graphviz-path tfo-graphviz-method tfo-graphviz-method-remote <?php if ( in_array( ‘graphviz_remote_key’, $errors ) ) echo ‘ form-invalid’; ?>”>
<th scope=”row”><label for=”tfo-graphviz-remote-key”><?php _e( ‘Remote TFO Graphviz API key (blank or invalid keymeans “free” mode)’ ); ?></label></th>
– <td><input type=’text’ name=’tfo-graphviz[remote_key]’ value='<?php echo attribute_escape( $values[‘remote_key’] ); ?>’ size=’64’ id=’tfo-graphviz-remote-key’ /><?php
+ <td><input type=’text’ name=’tfo-graphviz[remote_key]’ value='<?php echo esc_attr( $values[‘remote_key’] ); ?>’ size=’64’ id=’tfo-graphviz-remote-key’ /><?php
?></td>
</tr><tr class=”tfo-graphviz-maxage<?php if ( in_array( ‘graphviz_maxage’, $errors ) ) echo ‘ form-invalid’; ?>”>
<th scope=”row”><label for=”tfo-graphviz-maxage”><?php _e(‘Maximum age, in days, of generated content (enter 0 to disable expiration)’); ?></label></th>
– <td><input type=’text’ name=’tfo-graphviz[maxage]’ value='<?php echo attribute_escape( $values[‘maxage’] ); ?>’ id=’tfo-graphviz-maxage’ /></td>
+ <td><input type=’text’ name=’tfo-graphviz[maxage]’ value='<?php echo esc_attr( $values[‘maxage’] ); ?>’ id=’tfo-graphviz-maxage’ /></td>
</tr></tbody>
@@ -315,7 +315,7 @@ tr.tfo-graphviz-method-<?php echo $current_method; ?> {<p class=”submit”>
– <input type=”submit” class=”button-primary” value=”<?php echo attribute_escape( __( ‘Update TFO Graphviz Options’, ‘tfo-graphviz’ ) ); ?>” />
+ <input type=”submit” class=”button-primary” value=”<?php echo esc_attr( __( ‘Update TFO Graphviz Options’, ‘tfo-graphviz’ ) ); ?>” />
<?php wp_nonce_field( ‘tfo-graphviz’ ); ?>
</p>
</form>
diff –git a/tfo-graphviz-graphviz.php b/tfo-graphviz-graphviz.php
index 67765a8..f43c5af 100644
— a/tfo-graphviz-graphviz.php
+++ b/tfo-graphviz-graphviz.php
@@ -69,7 +69,7 @@ class TFO_Graphviz_Graphviz extends TFO_Graphviz_Method {
1 => array(‘pipe’, ‘w’),
2 => array(‘file’, ‘/dev/null’, ‘w’),
);
– $pipes = undef;
+ $pipes = array();
$proc = proc_open($cmd, $ds, $pipes, ‘/tmp’, array());
if(is_resource($proc)) {
fwrite($pipes[0], $this->dot);
@@ -114,7 +114,7 @@ class TFO_Graphviz_Graphviz extends TFO_Graphviz_Method {
$mapfile = “$this->img_path_base/$hash.map”;
if (is_super_admin() || !file_exists($imgfile) || ($this->imap && !file_exists($mapfile))) {
$ret = $this->process_dot($imgfile, $mapfile);
– if ( is_wp_error( $file ) ) {
+ if ( is_wp_error( $ret ) ) {
$this->error =& $ret;
return $this->error;
}
diff –git a/tfo-graphviz-method.php b/tfo-graphviz-method.php
index bbfe32d..01a1e5b 100644
— a/tfo-graphviz-method.php
+++ b/tfo-graphviz-method.php
@@ -14,7 +14,7 @@ class TFO_Graphviz_Method {
function __construct($dot, $atts) {
$this->dot = (string) $dot;
foreach(array(‘id’, ‘lang’, ‘simple’, ‘output’, ‘href’, ‘imap’, ‘title’) as $att) {
– if($atts[$att]) $this->$att = $atts[$att];
+ if(array_key_exists($att, $atts)) $this->$att = $atts[$att];
}
$this->url = false;
}
diff –git a/tfo-graphviz.php b/tfo-graphviz.php
index 4773dc5..8c6b5e2 100644
— a/tfo-graphviz.php
+++ b/tfo-graphviz.php
@@ -121,13 +121,13 @@ class TFO_Graphviz {
else $e .= ‘.’;
return $e;
}
– $url = clean_url($gv->url());
+ $url = esc_url($gv->url());
$href = $gv->href;
if($href) {
if(strtolower($href) == ‘self’) $href = $url;
– else $href = clean_url($href);
+ else $href = esc_url($href);
}
– $alt = attribute_escape(is_wp_error($gv->error) ? $gv->error->get_error_message() . “: $gv->dot” : $gv->title);
+ $alt = esc_attr(is_wp_error($gv->error) ? $gv->error->get_error_message() . “: $gv->dot” : $gv->title);$ret = “<img src=\”$url\” class=\”graphviz\””;
if(!empty($alt)) $ret .= ” alt=\”$alt\” title=\”$alt\””;
@@ -147,7 +147,7 @@ class TFO_Graphviz {
}// Validate atts
– $atts[‘id’] = attribute_escape($atts[‘id’]);
+ $atts[‘id’] = esc_attr($atts[‘id’]);
if($atts[‘lang’] && !in_array($atts[‘lang’], $this->langs)) {
$this->err = “Unknown lang: “.$atts[‘lang’];
return false;