From 443c7ef95af7a8c157ca9655ea51e742be278552 Mon Sep 17 00:00:00 2001 From: physikerwelt Date: Thu, 30 May 2013 07:53:30 +0000 Subject: [PATCH] Calculate HTTP POST data in separate method for debugging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To check if the renderer works correctly it is desired to be able to separate the test of the renderer and the function of the extension PHP code. Therefore the method getPostData can be used to get the values can be sent to the renderer directly via curl –d 'POSTDATA' URL Change-Id: I530f5fcba46364458643914bca81cf0bc1b60a58 --- MathLaTeXML.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/MathLaTeXML.php b/MathLaTeXML.php index ee38317..42e25d2 100644 --- a/MathLaTeXML.php +++ b/MathLaTeXML.php @@ -151,15 +151,22 @@ class MathLaTeXML extends MathRenderer { return $host; } + /** + * Calculates the HTTP POST Data for the request. Depends on the settings + * and the input string only. + * @return string HTTP POST data + */ + public function getPostData(){ + $texcmd = urlencode( $this->tex ); + return $this->getLaTeXMLSettings() . '&tex=' . $texcmd; + } /** * Does the actual web request to convert TeX to MathML. * @return boolean */ private function doRender( ) { $host = self::pickHost(); - $texcmd = urlencode( $this->tex ); - $post = $this->getLaTeXMLSettings(); - $post .= '&tex=' . $texcmd; + $post = $this->getPostData(); $this->lastError = ''; if ( $this->makeRequest( $host, $post, $res, $this->lastError ) ) { $result = json_decode( $res );