Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

texdebug.php now checks slasharguments setting

  • Loading branch information...
commit 9dd9a4267acb3d77ea5d452b170a62381de231e8 1 parent d71409c
fiedorow authored

Showing 1 changed file with 16 additions and 2 deletions. Show diff stats Hide diff stats

  1. +16 2 filter/tex/texdebug.php
18 filter/tex/texdebug.php
@@ -50,6 +50,8 @@
50 50 }
51 51 if (strpos($query,'ShowImage')) {
52 52 tex2image($texexp);
  53 + } else if (strpos($query,'SlashArguments')) {
  54 + slasharguments($texexp);
53 55 } else {
54 56 outputText($output);
55 57 }
@@ -71,7 +73,7 @@ function outputText($texexp) {
71 73 echo "</pre></body></html>\n";
72 74 }
73 75
74   - function tex2image($texexp) {
  76 + function tex2image($texexp, $return=false) {
75 77 global $CFG;
76 78 $error_message1 = "Your system is not configured to run mimeTeX. ";
77 79 $error_message1 .= "You need to download the appropriate<br /> executable ";
@@ -128,6 +130,9 @@ function tex2image($texexp) {
128 130 }
129 131 system($cmd, $status);
130 132 }
  133 + if ($return) {
  134 + return $image;
  135 + }
131 136 if ($texexp && file_exists($pathname)) {
132 137 $lastmodified = filemtime($pathname);
133 138 header("Last-Modified: " . gmdate("D, d M Y H:i:s", $lastmodified) . " GMT");
@@ -167,6 +172,13 @@ function tex2image($texexp) {
167 172 }
168 173 }
169 174
  175 + function slasharguments($texexp) {
  176 + $image = tex2image($texexp,true);
  177 + echo "<p>If the following image displays correctly, set your Administration->Configuration->Variables Setting for slasharguments to file.php/pic.jpg: <img src=\"pix.php/$image\" align=\"absmiddle\"></p>\n";
  178 + echo "<p>Otherwise set it to file.php?file=pic.jpg It should display correctly as <img src=\"pix.php?file=$image\" align=\"absmiddle\"></p>\n";
  179 + echo "<p>If neither equation image displays correctly, please seek further help at moodle.org at the <a href=\"http://moodle.org/mod/forum/view.php?id=752&username=guest\" target=\"_blank\">Mathematics Tools Forum</a></p>";
  180 + }
  181 +
170 182 ?>
171 183
172 184 <html>
@@ -185,8 +197,10 @@ function tex2image($texexp) {
185 197 to see the cache_filters database entry for this expression.</li>
186 198 <li>If the database entry looks corrupt, click on this button to delete it:
187 199 <input type="submit" name="DeleteDB" value="Delete DB Entry"></li>
188   - <li>Finally click on this button <input type="submit" name="ShowImage" value="Show Image">
  200 + <li>Then click on this button <input type="submit" name="ShowImage" value="Show Image">
189 201 to show a graphic image of the algebraic expression.</li>
  202 + <li>Finally check your slash arguments setting
  203 + <input type="submit" name="SlashArguments" value="Check Slash Arguments"></li>
190 204 </ol>
191 205 </form> <br /> <br />
192 206 <center>

0 comments on commit 9dd9a42

Please sign in to comment.
Something went wrong with that request. Please try again.