$formula_text-->";
if (!is_file($cache_formula_path)) {
// Execute gnuplot with the file
$tmp="/tmp/tmpplot$ts";
file_put_contents($tmp,$formula_text);
$result=shell_exec("gnuplot $tmp 2>&1");
if (!strlen($result)) {
$result.=shell_exec("convert /tmp/my-plot$ts.ps /tmp/my-plot$ts.png 2>&1");
$result.=shell_exec("mv /tmp/my-plot$ts.png ".$cache_formula_path);
}
@unlink("/tmp/my-plot$ts.ps");
@unlink("/tmp/tmpplot$ts");
if (strlen($result)>0)
return "GNUPLOT error:$result