From: <var...@us...> - 2014-07-02 09:20:20
|
Revision: 8948 http://sourceforge.net/p/phpwiki/code/8948 Author: vargenau Date: 2014-07-02 09:20:18 +0000 (Wed, 02 Jul 2014) Log Message: ----------- No trigger_error, display error inline Modified Paths: -------------- trunk/lib/plugin/TeX2png.php Modified: trunk/lib/plugin/TeX2png.php =================================================================== --- trunk/lib/plugin/TeX2png.php 2014-07-02 09:10:30 UTC (rev 8947) +++ trunk/lib/plugin/TeX2png.php 2014-07-02 09:20:18 UTC (rev 8948) @@ -181,8 +181,7 @@ $this->createTexFile($texfile, $text); $this->createPngFile($this->imagepath, $imagename); } else { - $error_html = _("TeX imagepath not writable."); - trigger_error($error_html, E_USER_NOTICE); + return HTML::span(array('class' => 'error'), _("TeX imagepath not writable.")); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-06-21 11:30:31
|
Revision: 10305 http://sourceforge.net/p/phpwiki/code/10305 Author: vargenau Date: 2021-06-21 11:30:30 +0000 (Mon, 21 Jun 2021) Log Message: ----------- lib/plugin/TeX2png.php: need to escape \e that is escape character Modified Paths: -------------- trunk/lib/plugin/TeX2png.php Modified: trunk/lib/plugin/TeX2png.php =================================================================== --- trunk/lib/plugin/TeX2png.php 2021-06-17 17:42:17 UTC (rev 10304) +++ trunk/lib/plugin/TeX2png.php 2021-06-21 11:30:30 UTC (rev 10305) @@ -113,12 +113,12 @@ $str = "\documentclass{article}\n"; $str .= "\usepackage{amsfonts}\n"; $str .= "\usepackage{amssymb}\n"; - // Here tou can add some package in order + // Here you can add some package in order // to produce more sophisticated output $str .= "\pagestyle{empty}\n"; $str .= "\begin{document}\n"; $str .= $text . "\n"; - $str .= "\end{document}"; + $str .= "\\end{document}"; // need to escape \e that is escape character fwrite($fp, $str); fclose($fp); return 0; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-06-21 14:00:19
|
Revision: 10306 http://sourceforge.net/p/phpwiki/code/10306 Author: vargenau Date: 2021-06-21 14:00:15 +0000 (Mon, 21 Jun 2021) Log Message: ----------- Make lib/plugin/TeX2png.php work: escape \e; better test imagepath; fix image URL Modified Paths: -------------- trunk/lib/plugin/TeX2png.php Modified: trunk/lib/plugin/TeX2png.php =================================================================== --- trunk/lib/plugin/TeX2png.php 2021-06-21 11:30:30 UTC (rev 10305) +++ trunk/lib/plugin/TeX2png.php 2021-06-21 14:00:15 UTC (rev 10306) @@ -118,10 +118,9 @@ $str .= "\pagestyle{empty}\n"; $str .= "\begin{document}\n"; $str .= $text . "\n"; - $str .= "\\end{document}"; // need to escape \e that is escape character + $str .= "\\end{document}\n"; // need to escape \e that is escape character fwrite($fp, $str); fclose($fp); - return 0; } function createPngFile($imagepath, $imagename) @@ -141,13 +140,13 @@ exec("cd $imagepath;$commandes"); unlink("$imagepath/temp.dvi"); unlink("$imagepath/temp.ps"); - } else + } else { echo _(" (syntax error for latex) "); + } // to clean the directory unlink("$imagepath/temp.tex"); unlink("$imagepath/temp.aux"); unlink("$imagepath/temp.log"); - return 0; } function isMathExp(&$text) @@ -175,7 +174,7 @@ { // the name of the png cached file $imagename = md5($text) . ".png"; - $url = $this->imagepath . "/$imagename"; + $url = '/' . $this->imagepath . "/$imagename"; if (!file_exists($url)) { if (is_writable($this->imagepath)) { @@ -222,6 +221,21 @@ */ function run($dbi, $argstr, &$request, $basepage) { + // if imagepath does not exist, try to create it + if (!file_exists($this->imagepath)) { + if (mkdir($this->imagepath, 0777, true) === false) { + return HTML::p(fmt("Cannot create directory “%s”", $this->imagepath)); + } + } + + // imagepath exists, check is a directory and is writable + if (!is_dir($this->imagepath)) { + return HTML::p(fmt("“%s” must be a directory", $this->imagepath)); + } + if (!is_writable($this->imagepath)) { + return HTML::p(fmt("“%s” must be a writable", $this->imagepath)); + } + // from text2png.php if (imagetypes() & IMG_PNG) { // we have gd & png so go ahead. @@ -232,7 +246,6 @@ $error_html = _("Sorry, this version of PHP cannot create PNG image files."); $link = "http://www.php.net/manual/pl/ref.image.php"; $error_html .= sprintf(_("See %s"), $link) . "."; - trigger_error($error_html); return HTML::p($error_html); } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-06-21 14:10:17
|
Revision: 10307 http://sourceforge.net/p/phpwiki/code/10307 Author: vargenau Date: 2021-06-21 14:10:17 +0000 (Mon, 21 Jun 2021) Log Message: ----------- lib/plugin/TeX2png.php: add class "error" Modified Paths: -------------- trunk/lib/plugin/TeX2png.php Modified: trunk/lib/plugin/TeX2png.php =================================================================== --- trunk/lib/plugin/TeX2png.php 2021-06-21 14:00:15 UTC (rev 10306) +++ trunk/lib/plugin/TeX2png.php 2021-06-21 14:10:17 UTC (rev 10307) @@ -224,16 +224,19 @@ // if imagepath does not exist, try to create it if (!file_exists($this->imagepath)) { if (mkdir($this->imagepath, 0777, true) === false) { - return HTML::p(fmt("Cannot create directory “%s”", $this->imagepath)); + return HTML::span(array('class' => 'error'), + fmt("Cannot create directory “%s”", $this->imagepath)); } } // imagepath exists, check is a directory and is writable if (!is_dir($this->imagepath)) { - return HTML::p(fmt("“%s” must be a directory", $this->imagepath)); + return HTML::span(array('class' => 'error'), + fmt("“%s” must be a directory", $this->imagepath)); } if (!is_writable($this->imagepath)) { - return HTML::p(fmt("“%s” must be a writable", $this->imagepath)); + return HTML::span(array('class' => 'error'), + fmt("“%s” must be a writable", $this->imagepath)); } // from text2png.php @@ -246,7 +249,7 @@ $error_html = _("Sorry, this version of PHP cannot create PNG image files."); $link = "http://www.php.net/manual/pl/ref.image.php"; $error_html .= sprintf(_("See %s"), $link) . "."; - return HTML::p($error_html); + return HTML::p(array('class' => 'error'), $error_html); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-06-21 14:12:35
|
Revision: 10308 http://sourceforge.net/p/phpwiki/code/10308 Author: vargenau Date: 2021-06-21 14:12:30 +0000 (Mon, 21 Jun 2021) Log Message: ----------- lib/plugin/TeX2png.php: fix man page URL Modified Paths: -------------- trunk/lib/plugin/TeX2png.php Modified: trunk/lib/plugin/TeX2png.php =================================================================== --- trunk/lib/plugin/TeX2png.php 2021-06-21 14:10:17 UTC (rev 10307) +++ trunk/lib/plugin/TeX2png.php 2021-06-21 14:12:30 UTC (rev 10308) @@ -247,7 +247,7 @@ } else { // we don't have png and/or gd. $error_html = _("Sorry, this version of PHP cannot create PNG image files."); - $link = "http://www.php.net/manual/pl/ref.image.php"; + $link = "https://www.php.net/manual/en/ref.image.php"; $error_html .= sprintf(_("See %s"), $link) . "."; return HTML::p(array('class' => 'error'), $error_html); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-06-21 15:07:07
|
Revision: 10309 http://sourceforge.net/p/phpwiki/code/10309 Author: vargenau Date: 2021-06-21 15:07:05 +0000 (Mon, 21 Jun 2021) Log Message: ----------- lib/plugin/TeX2png.php: better error messages Modified Paths: -------------- trunk/lib/plugin/TeX2png.php Modified: trunk/lib/plugin/TeX2png.php =================================================================== --- trunk/lib/plugin/TeX2png.php 2021-06-21 14:12:30 UTC (rev 10308) +++ trunk/lib/plugin/TeX2png.php 2021-06-21 15:07:05 UTC (rev 10309) @@ -191,8 +191,8 @@ // or mathematical expression is wrong switch ($this->isMathExp($text)) { case 0: // not a mathematical expression - $html = HTML::samp(array('class' => 'tex', - 'style' => 'color:red;'), $text); + $html = HTML::span(array('class' => 'error'), + fmt("Not a mathematical expression: “%s”", $text)); break; case 1: // an inlined mathematical expression $html = HTML::img(array('class' => 'tex', @@ -247,9 +247,11 @@ } else { // we don't have png and/or gd. $error_html = _("Sorry, this version of PHP cannot create PNG image files."); - $link = "https://www.php.net/manual/en/ref.image.php"; - $error_html .= sprintf(_("See %s"), $link) . "."; - return HTML::p(array('class' => 'error'), $error_html); + $error_html .= " "; + $error_html .= _("See") . _(": "); + $link = HTML::a(array('href' => "https://www.php.net/manual/en/ref.image.php"), + "https://www.php.net/manual/en/ref.image.php") ; + return HTML::span(array('class' => 'error'), $error_html, $link); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-06-22 13:21:56
|
Revision: 10313 http://sourceforge.net/p/phpwiki/code/10313 Author: vargenau Date: 2021-06-22 13:21:55 +0000 (Tue, 22 Jun 2021) Log Message: ----------- lib/plugin/TeX2png.php: Check if the needed binaries are available Modified Paths: -------------- trunk/lib/plugin/TeX2png.php Modified: trunk/lib/plugin/TeX2png.php =================================================================== --- trunk/lib/plugin/TeX2png.php 2021-06-22 09:09:11 UTC (rev 10312) +++ trunk/lib/plugin/TeX2png.php 2021-06-22 13:21:55 UTC (rev 10313) @@ -221,6 +221,23 @@ */ function run($dbi, $argstr, &$request, $basepage) { + // Check if the needed binaries are available + if (!file_exists($this->latexbin)) { + return HTML::span(array('class' => 'error'), + fmt("Cannot run %1s plugin, “%2s” does not exist", + "TeX2png", $this->latexbin)); + } + if (!file_exists($this->dvipsbin)) { + return HTML::span(array('class' => 'error'), + fmt("Cannot run %1s plugin, “%2s” does not exist", + "TeX2png", $this->dvipsbin)); + } + if (!file_exists($this->pstoimgbin)) { + return HTML::span(array('class' => 'error'), + fmt("Cannot run %1s plugin, “%2s” does not exist", + "TeX2png", $this->pstoimgbin)); + } + // if imagepath does not exist, try to create it if (!file_exists($this->imagepath)) { if (mkdir($this->imagepath, 0777, true) === false) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-06-28 12:16:27
|
Revision: 10330 http://sourceforge.net/p/phpwiki/code/10330 Author: vargenau Date: 2021-06-28 12:16:29 +0000 (Mon, 28 Jun 2021) Log Message: ----------- lib/plugin/TeX2png.php: use DATA_PATH Modified Paths: -------------- trunk/lib/plugin/TeX2png.php Modified: trunk/lib/plugin/TeX2png.php =================================================================== --- trunk/lib/plugin/TeX2png.php 2021-06-28 10:36:36 UTC (rev 10329) +++ trunk/lib/plugin/TeX2png.php 2021-06-28 12:16:29 UTC (rev 10330) @@ -174,7 +174,7 @@ { // the name of the png cached file $imagename = md5($text) . ".png"; - $url = '/' . $this->imagepath . "/$imagename"; + $url = DATA_PATH . '/' . $this->imagepath . "/$imagename"; if (!file_exists($url)) { if (is_writable($this->imagepath)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-07-26 08:22:20
|
Revision: 10363 http://sourceforge.net/p/phpwiki/code/10363 Author: vargenau Date: 2021-07-26 08:22:17 +0000 (Mon, 26 Jul 2021) Log Message: ----------- lib/plugin/TeX2png.php: avoid warnings Modified Paths: -------------- trunk/lib/plugin/TeX2png.php Modified: trunk/lib/plugin/TeX2png.php =================================================================== --- trunk/lib/plugin/TeX2png.php 2021-07-23 17:32:02 UTC (rev 10362) +++ trunk/lib/plugin/TeX2png.php 2021-07-26 08:22:17 UTC (rev 10363) @@ -70,12 +70,17 @@ $defaults = array(); while (preg_match("/^$opt_ws $argspec_p $opt_ws/x", $argstr, $m)) { - @ list(, $arg, $op, $qq_val, $q_val, $gt_val, $word_val) = $m; + $arg = $m[1]; + $op = $m[2]; + $qq_val = $m[3]; + if (array_key_exists(4, $m)) $q_val = $m[4]; + if (array_key_exists(5, $m)) $gt_val = $m[4]; + if (array_key_exists(6, $m)) $word_val = $m[4]; $argstr = substr($argstr, strlen($m[0])); // Remove quotes from string values. if ($qq_val) - // we don't remove backslashes in tex formulas + // We don't remove backslashes in TeX formulas // $val = stripslashes($qq_val); $val = $qq_val; elseif ($q_val) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |