<?php // // Copyright (c) 2011, Maths for More S.L. http://www.wiris.com // This file is part of WIRIS Plugin. // // WIRIS Plugin is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. // // WIRIS Plugin is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with WIRIS Plugin. If not, see <http://www.gnu.org/licenses/>. // include 'api.php'; if (!empty($_POST['mml'])) { try { $api = new com_wiris_plugin_PluginAPI(); echo $api->mathml2img($_POST['mml'], dirname($_SERVER['PHP_SELF']), $_POST); } catch (Exception $e) { echo $e->getMessage(); } } else { echo 'Error: no mathml has been sent.'; }
</tr> <tr> <?php $file = wrs_getCacheDirectory($config) . '/test.png'; $test_name = 'Reading an image file'; $report_text = 'Reading file ' . $file; $solution_link = ''; echo wrs_createTableRow($test_name, $report_text, $solution_link, @fopen($file, 'r') !== false); ?> </tr> <tr> <?php $test_name = 'Creating a random image'; $mathml = '<math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mn>' . rand(0, 9999) . '</mn><mo>+</mo><mn>' . rand(0, 9999) . '</mn></mrow></math>'; $api = new com_wiris_plugin_PluginAPI(); $src = $api->mathml2img($mathml, dirname($_SERVER["REQUEST_URI"])); $prefix = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] ? 'https://' : 'http://'; if (isset($_SERVER['HTTP_HOST'])) { $host = $_SERVER['HTTP_HOST'] . '/'; } else { $host = $_SERVER['SERVER_NAME'] . '/'; } $query = parse_url($src, PHP_URL_QUERY); $query_array = array(); parse_str($query, $query_array); $report_text = '<img align="middle" src="' . $src . '" />'; $solution_link = ''; $imageFile = wrs_getCacheDirectory($config) . '/' . $query_array['formula']; if (ini_get('allow_url_fopen')) { @fopen($prefix . $host . $src, 'r');
// // WIRIS Plugin is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. // // WIRIS Plugin is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with WIRIS Plugin. If not, see <http://www.gnu.org/licenses/>. // require_once 'bootstrap.php'; include 'api.php'; if (!empty($_POST['mml'])) { try { $api = new com_wiris_plugin_PluginAPI(); if (isset($_SERVER['REQUEST_URI'])) { $d = dirname($_SERVER['REQUEST_URI']); } else { $d = dirname($_SERVER['PHP_SELF']); } echo $api->mathml2img($_POST['mml'], $d, $_POST); } catch (Exception $e) { echo $e->getMessage(); } } else { echo 'Error: no mathml has been sent.'; }
<?php // // Copyright (c) 2011, Maths for More S.L. http://www.wiris.com // This file is part of WIRIS Plugin. // // WIRIS Plugin is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // any later version. // // WIRIS Plugin is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with WIRIS Plugin. If not, see <http://www.gnu.org/licenses/>. // require_once 'bootstrap.php'; include 'api.php'; if (!empty($_POST['mml'])) { try { $api = new com_wiris_plugin_PluginAPI(); echo $api->mathml2img($_POST['mml'], dirname($_SERVER['REQUEST_URI']), $_POST); } catch (Exception $e) { echo $e->getMessage(); } } else { echo 'Error: no mathml has been sent.'; }
</tr> <tr> <?php $file = wrs_getCacheDirectory($config) . '/test.png'; $test_name = 'Reading an image file'; $report_text = 'Reading file ' . $file; $solution_link = ''; echo wrs_createTableRow($test_name, $report_text, $solution_link, @fopen($file, 'r') !== false); ?> </tr> <tr> <?php $test_name = 'Creating a random image'; $mathml = '<math xmlns="http://www.w3.org/1998/Math/MathML"><mrow><mn>' . rand(0, 9999) . '</mn><mo>+</mo><mn>' . rand(0, 9999) . '</mn></mrow></math>'; $api = new com_wiris_plugin_PluginAPI(); $src = $api->mathml2img($mathml, 'http://' . dirname($_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"])); $query = parse_url($src, PHP_URL_QUERY); $query_array = array(); parse_str($query, $query_array); $report_text = '<img align="middle" src="' . $src . '" />'; $solution_link = ''; $imageFile = wrs_getCacheDirectory($config) . '/' . $query_array['formula']; //Used to create the image @fopen($src, 'r'); //******* echo wrs_createTableRow($test_name, $report_text, $solution_link, file_exists($imageFile)); ?> </tr> </table>