/**
  * Handle the match
  */
 function handle($data, $state, $pos, Doku_Handler $handler)
 {
     $data = explode("\n", $data);
     $conf = array_shift($data);
     array_pop($data);
     $conf = trim(substr($conf, 10, -1));
     $conf = $this->parseOpts($conf);
     // parse
     $count = count($data);
     for ($i = 0; $i < $count; $i++) {
         // copy line, free memory
         $line = $data[$i];
         unset($data[$i]);
         $line = trim($line);
         $line = rtrim($line, " ;");
         if (strpos($line, '->') === false) {
             $opt = $this->parseNode($line);
         } else {
             $opt = $this->parseEdge($line);
         }
     }
     $xml = $this->getXML($conf, $w, $h);
     $xmlid = md5($xml);
     $cache = getcachename($xmlid, 'graphgear');
     io_saveFile($cache, $xml);
     return array('xmlid' => $xmlid, 'width' => $w, 'height' => $h);
 }
<?php

/**
 * @license    GPL 2 (http://www.gnu.org/licenses/gpl.html)
 * @author     Andreas Gohr <*****@*****.**>
 */
if (!defined('DOKU_INC')) {
    define('DOKU_INC', realpath(dirname(__FILE__) . '/../../../') . '/');
}
define('NOSESSION', true);
require_once DOKU_INC . 'inc/init.php';
require_once DOKU_INC . 'inc/pageutils.php';
require_once DOKU_INC . 'inc/io.php';
$xmlid = $_REQUEST['xmlid'];
$cache = getcachename($xmlid, 'graphgear');
$time = @filemtime($cache);
if (!$time) {
    header("HTTP/1.0 404 Not Found");
    echo 'Not Found';
    exit;
}
header('Content-Type: text/xml; charset=utf-8');
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);
//Setup VIM: ex: et ts=4 enc=utf-8 :
Beispiel #3
0
 /**
  * Cache file is based on parameters that influence the result image
  */
 function _cachename($data, $ext)
 {
     $data = $this->_prepareData($data);
     return getcachename(join('x', array_values($data)), '.ditaa.' . $ext);
 }
Beispiel #4
0
 /**
  * Cache file is based on parameters that influence the result image
  */
 function _cachename($data, $ext)
 {
     unset($data['width']);
     unset($data['height']);
     unset($data['align']);
     unset($data['title']);
     return getcachename(join('x', array_values($data)), ".plantuml.{$ext}");
 }
 /**
  * Cache file is based on parameters that influence the result image
  */
 function _cachename($data, $ext)
 {
     unset($data['width']);
     unset($data['height']);
     unset($data['align']);
     return getcachename(join('x', array_values($data)), '.graphviz.' . $ext);
 }
function epub_check_for_math(&$xhtml, $renderer)
{
    $regex = '#mathpublish\\/img.php\\?img=([a-f0-9]+)\\"#';
    if (preg_match($regex, $xhtml, $matches)) {
        $cache = getcachename($matches[1], '.mathpublish.png');
        $name = $renderer->copy_media($cache, true);
        $name = 'src="../' . $name . '" ';
        $regex = '#src\\s*=.*?mathpublish\\/img.php\\?img=([a-f0-9]+)\\"#';
        $xhtml = preg_replace($regex, $name, $xhtml);
    }
}