$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'); echo wrs_createTableRow($test_name, $report_text, $solution_link, file_exists($imageFile)); } else { if (function_exists('curl_init')) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, $prefix . $host . $src); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $content = curl_exec($ch); curl_close($ch); echo wrs_createTableRow($test_name, $report_text, $solution_link, file_exists($imageFile)); } else { echo wrs_createTableRow($test_name, $report_text, $solution_link, false, false); } } ?> </tr> </table> <br/> <h1>PHP tests</h1> <h3>Checking the existence of PHP functions that WIRIS plugin uses</h3> <table> <tr> <th>Function</th> <th>Status</th>
// $file = $wiris_plugin_base . '/VERSION'; // if (@fopen($file, 'r')){ // $content = file($file); // $plugin_version = $content[0]; // }else{ // $plugin_version = ""; // } if ($filter_version == $plugin_version) { $report_text = 'WIRIS plugin filter and WIRIS plugin for ' . $wiris_plugin_base_string . ' have the same version'; $condition = true; } else { $report_text = 'WIRIS plugin filter and WIRIS plugin for ' . $wiris_plugin_base_string . ' versions don\'t match'; $condition = false; } $solution_link = 'http://www.wiris.com/plugins/moodle/download'; echo wrs_createTableRow($test_name, $report_text, $solution_link, $condition); ?> </tr> </table> <p> <br/> <?php echo "Click the following button to test if the WIRIS plugin for " . $wiris_plugin_base_string . " is correctly installed.<br/>"; $link = $wiris_plugin_base . '/integration/test.php'; echo '<input type="button" value="WIRIS plugin for ' . $wiris_plugin_base_string . ' tests" onClick="javascript:window.open(\'' . $link . '\');" /><br/>'; $wqversion = get_config('qtype_wq', 'version'); if (!empty($wqversion)) { echo "Click the following button to test if the WIRIS quizzes is correctly installed.<br/>";
<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> <br/> <h1>PHP tests</h1> <h3>Checking the existence of PHP functions that WIRIS plugin uses</h3> <table> <tr> <th>Function</th> <th>Status</th> </tr> <tr>