PHP Math Publisher. Version: 1.0.3 Author: Matteo Bertini Author URI: http://www.slug.it/naufraghi/ */ //######## CONFIG START ######## $basedir = "/naufraghi/wp-content/plugins/phpmathpublisher"; //######## CONFIG END ######## // Include the PHP Math Publisher library // See: http://www.xm1math.net/phpmathpublisher/ include_once("mathpublisher.php") ; //Overwrite dir locations $dirfonts=$_SERVER["DOCUMENT_ROOT"].$basedir."/fonts"; $dirimg=$_SERVER["DOCUMENT_ROOT"].$basedir."/img"; function wpmathfilter($ascii_math) { global $basedir; //mathfilter($text, $size, $pathtoimg) $phpmath = mathfilter("".$ascii_math."", 12, $basedir."/img/"); return $phpmath; } function to_phpmath($content) { $content = preg_replace('#\[pmath\](.*?)\[/pmath\]#sie', 'wpmathfilter(\'\\1\');', $content); return $content; } // Register this filter before Markdown (index=6) add_filter('the_content', 'to_phpmath', 5); ?>